Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 20 Aug 1999 23:43:40 -0700
From:      "Ronald F. Guilmette" <rfg@monkeys.com>
To:        freebsd-questions@freebsd.org
Subject:   Passing file descriptors via UNIX domain sockets
Message-ID:  <7989.935217820@monkeys.com>

next in thread | raw e-mail | index | archive | help

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


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?7989.935217820>