How to transfer file descriptors with UNIX domain sockets?
BURNS,JIM
gt0178a at prism.gatech.EDU
Sun Jul 1 14:04:58 AEST 1990
in article <1421 at tub.UUCP>, net at tub.UUCP (Oliver Laumann) says:
> In article <37317 at ucbvax.BERKELEY.EDU> rgm at OCF.Berkeley.EDU (Rob Menke) writes:
>> possible to transfer file descriptors between processes via UNIX domain
>> sockets using sendmsg(2) and recvmsg(2).
> The following two trivial programs demonstrate this functionality.
> The first of them accepts a connection on a UNIX domain socket, opens
> /etc/passwd, sends the file descriptor to the peer process, and then exits.
I don't understand the concept here - if the program exits, its files are
closed, and the file descriptor is no longer valid. I know that child procs
can refer to parent fds even after the parent exits, but merely sending an
fd in a message - so what? How does the system know that the message
contains an fd that must remain valid after the program that opened it
exits?
--
BURNS,JIM
Georgia Institute of Technology, Box 30178, Atlanta Georgia, 30332
uucp: ...!{decvax,hplabs,ncar,purdue,rutgers}!gatech!prism!gt0178a
Internet: gt0178a at prism.gatech.edu
More information about the Comp.unix.questions
mailing list