From owner-freebsd-questions Sat Aug 21 13:27: 4 1999 Delivered-To: freebsd-questions@freebsd.org Received: from awfulhak.org (dynamic-52.max1-du-ws.dialnetwork.pavilion.co.uk [212.74.8.52]) by hub.freebsd.org (Postfix) with ESMTP id 9E3051545E for ; Sat, 21 Aug 1999 13:25:19 -0700 (PDT) (envelope-from brian@Awfulhak.org) Received: from keep.lan.Awfulhak.org (root@keep.lan.Awfulhak.org [172.16.0.8]) by awfulhak.org (8.9.3/8.9.3) with ESMTP id VAA10008; Sat, 21 Aug 1999 21:19:13 +0100 (BST) (envelope-from brian@lan.awfulhak.org) Received: from keep.lan.Awfulhak.org (brian@localhost.lan.Awfulhak.org [127.0.0.1]) by keep.lan.Awfulhak.org (8.9.3/8.9.3) with ESMTP id VAA04816; Sat, 21 Aug 1999 21:22:11 +0100 (BST) (envelope-from brian@keep.lan.Awfulhak.org) Message-Id: <199908212022.VAA04816@keep.lan.Awfulhak.org> X-Mailer: exmh version 2.0.2 2/24/98 To: "Ronald F. Guilmette" Cc: freebsd-questions@FreeBSD.ORG Subject: Re: Passing file descriptors via UNIX domain sockets In-reply-to: Your message of "Fri, 20 Aug 1999 23:43:40 PDT." <7989.935217820@monkeys.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Sat, 21 Aug 1999 21:22:11 +0100 From: Brian Somers Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Take a look at the ppp(8) code - specifically at bundle_ReceiveDatalink() and bundle_SendDatalink() in bundle.c. > Greetings, > > I'm trying to figure out exactly how to pass file descriptors between > programs. > > It appears that the examples given in Stevens' ``UNIX Network Programming'' > (original edition) on pages 308-312 no longer accurately describes what one > must do to actually pass file descriptors. > > The man page for recvmsg(2) definitely provides some clues regarding the > new programatic idiom that must be used to pass files descriptors around, > but it is a little too terse, saying only: > > Open file descriptors are now passed as ancillary data for > AF_UNIX domain sockets, with cmsg_level set to SOL_SOCKET > and cmsg_type set to SCM_RIGHTS. > > It would be REALLY helpful for me to be able to actually _see_ an example > of some real working code that used the new style for file descriptor passing > between processes. Then I could just mimic that code in a monkey-see / > monkey-do fashion. > > So can anyone point me at a _current_ hunk of example code that shows open > file descriptors being passed between programs? If so, I would be much > obliged. > > > -- rfg -- Brian Don't _EVER_ lose your sense of humour ! To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message