Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!linus!decvax!harpo!seismo!hao!hplabs!sri-unix!gwyn@brl-vld From: gwyn%brl-vld@sri-unix.UUCP Newsgroups: net.unix Subject: Re: file descriptors --> filenames Message-ID: <16845@sri-arpa.UUCP> Date: Mon, 20-Feb-84 21:29:06 EST Article-I.D.: sri-arpa.16845 Posted: Mon Feb 20 21:29:06 1984 Date-Received: Fri, 2-Mar-84 07:53:49 EST Lines: 21 From: Doug Gwyn (VLD/VMB)There is no practical way to obtain the "file" name (really, the link name) of a file from its file descriptor. The kernel does not keep this information after opening the file. It is in fact possible for the link under which the file was opened to have gone away although the data may remain (under some new name), by the time you inspect the file descriptor. This "feature" is a consequence of the more general idea of file names ("links") that UNIX uses. Although all the file (inode) information of real value is in the stat return structure, it is true that on most UNIXes one cannot change this information (permissions, etc.) without using some link name to access the file. 4.2BSD supplies some new system calls (fchmod, etc.) to let one change inode information via the file descriptor alone. Although I think a more general interface might have been a better way to go, I am glad to see the new system calls IF they work their way into the AT&T distribution. However, I would recommend that you not rely on them for the time being, which is to say, you may well need to pass the file name to the module that needs to change file permissions. The name must exist somewhere in the system you are converting.