Path: utzoo!attcan!uunet!ginosko!gem.mps.ohio-state.edu!tut.cis.ohio-state.edu!rutgers!att!chinet!les From: les@chinet.chi.il.us (Leslie Mikesell) Newsgroups: comp.unix.wizards Subject: Re: how can I get filename from file descriptor? Message-ID: <9340@chinet.chi.il.us> Date: 24 Aug 89 03:36:26 GMT References: <20613@adm.BRL.MIL> <1019@virtech.UUCP> <20482@sequent.UUCP> <19208@mimsy.UUCP> Reply-To: les@chinet.chi.il.us (Leslie Mikesell) Organization: Chinet - Public Access Unix Lines: 19 In article <19208@mimsy.UUCP> chris@mimsy.UUCP (Chris Torek) writes: >>Have the FILE structure have a name field in it: >> char *name; >>then when the fopen() call is made, have it fill in the field .... >This is all well and good, but you will have to define what happens >when you ask for the name of stdin, stdout, stderr, or a file opened >with fdopen. (Also, but rather incidentally, I am not terribly thrilled >with the idea of fopen having to call getwd.) It would _almost_ be worthwhile to have open() store the pathname of the thing being opened so that it could be retreived by some sort of fcntl(), just like it would almost be worthwhile to store a per-process cwd. The problem would be that these pathnames are subject to change if someone mv's or rm's any of the components and it's probably not worth the effort to keep them updated. Les Mikesell