file descriptor vs file handle
Jonathan I. Kamens
jik at athena.mit.edu
Wed Feb 27 03:00:43 AEST 1991
In article <27C9CB35.5F7 at wilbur.coyote.trw.com>, cwong at charlie.coyote.trw.com (Chun Wong) writes:
|> Can someone distinguish the differences between a file descriptor and
|> a file handle? I know that creat returns a file handle whereas fopen
|> returns a file descriptor. What's the difference? Are they interchangeable?
First of all, creat is obsolete. :-)
Second, creat returns a file descriptor, not a file handle. If your manual
claims that it returns a file handle, then it's out-of-date.
The reason I say "out-of-date" instead of "wrong" is that I have heard file
handle and file descriptor used interchangeably in the past, but it's probably
a bad idea to use them that way nowadays, becavuse "file handle" has taken on
a very different meaning in some circles.
For example, the NFS people use the term "file handle" to refer to the
widget used to represent a particular file on an NFS server in communications
between NFS servers and NFS clients. Hence you might get the error "stale NFS
file handle" if you cd into an NFS directory on a client machine, then delete
the directory on the server, then try to do a "pwd" or other operation on the
directory in the client.
--
Jonathan Kamens USnail:
MIT Project Athena 11 Ashford Terrace
jik at Athena.MIT.EDU Allston, MA 02134
Office: 617-253-8085 Home: 617-782-0710
More information about the Comp.lang.c
mailing list