Path: utzoo!attcan!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sun-barr!rutgers!cmcl2!kramden.acf.nyu.edu!brnstnd From: brnstnd@kramden.acf.nyu.edu (Dan Bernstein) Newsgroups: comp.unix.internals Subject: Re: Is it possible to get filename from file descriptor ? Message-ID: <13836:Sep1510:15:5390@kramden.acf.nyu.edu> Date: 15 Sep 90 10:15:53 GMT References: <870@gtenmc.UUCP> Organization: IR Lines: 19 In article <870@gtenmc.UUCP> kumar@gtenmc.UUCP (S.Kumar) writes: > A Unix question > Is there a way to get the filename in UNIX given the file descriptor. > (in a given process) Not reliably. A file descriptor may be associated with several different filenames, or none at all. The filenames may be hidden inside directories that you can't read. They may change at any time. > I think the crash program provides a list of inodes for the filenames > which the process has opened. Filenames can change; how do you know it's the same file as when the process was running? A root process can search the filesystem and (unreliably, unless the disks are unmounted) find a file with a given inode, but that's slow and really suitable only for administrative duties. ---Dan