Path: utzoo!attcan!uunet!virtech!cpcahil From: cpcahil@virtech.UUCP (Conor P. Cahill) Newsgroups: comp.unix.wizards Subject: Re: how can I get filename from file descriptor? Message-ID: <1019@virtech.UUCP> Date: 16 Aug 89 01:51:49 GMT References: <20613@adm.BRL.MIL> Organization: Virtual Technologies Inc Lines: 13 In article <20613@adm.BRL.MIL>, Pabbisetty.henr@xerox.com (Nagesh Pabbisetty) writes: > If I have a descriptor to a file, how can I find out the name of the file > associated with it? I'm not sure if this is the most efficient way, but it will work for any standard file descriptors. 1. get the device and inode number using fstat(2). 2. Find the block special file that contains the file system that contains the file (the device number will match). 3. Look up the device in /etc/mnttab (to find the mount point). 4. cd to the mount point 5. Search the indicated file system for a file with the same inode.