Re: figuring out a filename from it's handle...



On Aug 30, 11:53 pm, daneyu...@xxxxxxxxx wrote:
If I've lost track of a filename that a channel was opened for, is
there a way to get the filename from just the channel name?

In other words, after doing the following:

set file_handle [open $filename r]

can I then use $file_handle to determine $filename?

If you're at the design step, just keep the association at script
level.
If you want to debug a large and barely modifiable script, on Linux
you can do some I/O on the channel under strace, find the underlying
file descriptor, and then look for the same descriptor in /proc/[pid]/
fd. These are pseudo-symbolic links giving the path of the files (or
pipe or socket IDs).

-Alex

.



Relevant Pages

  • Re: figuring out a filename from its handle...
    ... there a way to get the filename from just the channel name? ... If you want to debug a large and barely modifiable script, ... you can do some I/O on the channel under strace, ... These are pseudo-symbolic links giving the path of the files (or ...
    (comp.lang.tcl)
  • Re: figuring out a filename from its handle...
    ... there a way to get the filename from just the channel name? ... Linux, is that the file name may no longer be valid anyhow. ... It's this inode that the system then uses to ...
    (comp.lang.tcl)
  • Re: Registering Interfaces
    ... I get an extra interface instance with no appended filename even though I didn't register any interface instances and specify the NULL as the reference string. ... In an attempt to have each channel opened and used individually I ...
    (microsoft.public.development.device.drivers)
  • Re: TIP #210: Add tempname Subcommand to file
    ... > Or is there a more elegant approach? ... Return a channel and use [fconfigure] to find out the filename? ...
    (comp.lang.tcl)