Path: utzoo!attcan!uunet!lll-winken!lll-tis!helios.ee.lbl.gov!pasteur!ucbvax!decwrl!labrea!csli!gandalf
From: gandalf@csli.STANFORD.EDU (Juergen Wagner)
Newsgroups: comp.unix.wizards
Subject: Re: Getting the pathname from a FILE*.
Message-ID: <4531@csli.STANFORD.EDU>
Date: 9 Jul 88 03:11:51 GMT
References: <651@umb.umb.edu>
Reply-To: gandalf@csli.stanford.edu (Juergen Wagner)
Organization: Center for the Study of Language and Information, Stanford U.
Lines: 19

The _iobuf structure as defined in  includes a component _file
which is supposed to hold the file descriptor number. With fdopen() you
can create a FILE* structure from an arbitrary file descriptor (which
may refer to a UNIX file, a socket, or whatsoever), so the FILE* structure
may access something else than a plain UNIX file.

fstat(fd, &statbuf) gives information about the open file descriptor, so
you can find out the device the inode is on, the inode's number, and a 
few other attributes of interest. With that you should be able to find
out the information wanted by looking at the st_mode field (check the 
fd type), and eventually by walking through the file system the inode is
on.

I know, it's a painful procedure but as far as I know, there is no other
way to obtain the information you're looking for, other than by fiddling
around with statbuf.

-- 
Juergen "Gandalf" Wagner,		   gandalf@csli.stanford.edu
Center for the Study of Language and Information (CSLI), Stanford CA