Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!cs.utexas.edu!rutgers!mephisto!prism!gt0178a From: gt0178a@prism.gatech.EDU (BURNS,JIM) Newsgroups: comp.unix.questions Subject: Re: How to transfer file descriptors with UNIX domain sockets? Message-ID: <10970@hydra.gatech.EDU> Date: 1 Jul 90 04:04:58 GMT References: <1421@tub.UUCP> Organization: Georgia Institute of Technology Lines: 20 in article <1421@tub.UUCP>, net@tub.UUCP (Oliver Laumann) says: > In article <37317@ucbvax.BERKELEY.EDU> rgm@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@prism.gatech.edu