Date: Sat, 21 Aug 1999 22:50:22 +0100 From: Brian Somers <brian@Awfulhak.org> To: "Ronald F. Guilmette" <rfg@monkeys.com> Cc: Brian Somers <brian@Awfulhak.org>, freebsd-questions@FreeBSD.ORG Subject: Re: Passing file descriptors via UNIX domain sockets Message-ID: <199908212150.WAA06688@keep.lan.Awfulhak.org> In-Reply-To: Your message of "Sat, 21 Aug 1999 13:01:31 PDT." <29451.935265691@monkeys.com>
next in thread | previous in thread | raw e-mail | index | archive | help
One caveat (I had to learn the hard way!) is that you *must* also pass some data in the oivec. If you don't, the descriptor isn't passed. Also, make sure you get an acknowledgement from the other side before closing the descriptor. If you close it while it's in transit, the other side will receive a closed descriptor as the open count isn't incremented as it's passed (in case the other side never does a recvmsg()). > In message <199908212022.VAA04816@keep.lan.Awfulhak.org>, you wrote: > > >Take a look at the ppp(8) code - specifically at > >bundle_ReceiveDatalink() and bundle_SendDatalink() in bundle.c. > > Yep! That's the ticket alrightee! That's exactly what I was looking > for. That code is most helpful as an example, and I am now gleefully > (and successfully) passing file descriptors! > > (I found the exact code you mentioned late last night, after I posted > my question to freebsd-questions. DUH! I guess I should have gone > grepping sources before I bothered everybody here. Sorry.) > > -- rfg > > P.S. The capability to pass open file descriptors between processes... > even between otherwise unrelated processes... is way cool! I can do some > neat things with this! Too bad the little pair of programs I wrote (just to > see if I could actually make this fd passing stuff work) doesn't actually > work under the Linux 2.2.7 kernel I have installed :-( even though it > works just fine on FreeBSD. :-) > > -- Brian <brian@Awfulhak.org> <brian@FreeBSD.org> <http://www.Awfulhak.org> <brian@OpenBSD.org> Don't _EVER_ lose your sense of humour ! <brian@FreeBSD.org.uk> To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199908212150.WAA06688>