Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 31 Aug 1998 23:14:07 +0100
From:      Brian Somers <brian@Awfulhak.org>
To:        freebsd-hackers@FreeBSD.ORG
Cc:        luigi@labinfo.iet.unipi.it (Luigi Rizzo)
Subject:   Re: Help with passing fd on FreeBSD
Message-ID:  <199808312214.XAA06366@awfulhak.org>

next in thread | raw e-mail | index | archive | help
: > Oops, I turned the page and the BSD4.3+ example looks like the FreeBSD
: > struct.  The Stevens book appears to have a good example.
: >
: > > Can someone give me pointers on passing open file descriptors on FreeBSD?
: 
: still, this looks to me one of the most obscure interfaces in the OS.
: Does any real application use that ?

User-ppp in -current does.  When it negotiates multi-link with a 
peer, it creates a local domain socket based on that peers id.  If 
the socket already exists, it passes the link to the other ppp 
invocation that's already running multi-link with the same peer.

Effectively, it allows a machine to open up several connections to us 
and we bundle the links up into one logical link.  This of course can 
be extremely confusing if you aren't in -direct mode - I ``dial'' the 
peer, connect successfully, do the LCP stuff, get the auth stuff 
right and then all of a sudden I get my shell prompt back.  Reading 
the log reveals that the link was passed to another ppp instance.

A word of caution - be *very* careful when passing a descriptor for 
your ctty.  If you subsequently close the ctty, the descriptor that's 
been passed to the other process gets revoked !  This is why ppp 
must sometimes leave pause()d ``session leader'' processes lying 
around ;-I

:          cheers
:          luigi
: -----------------------------+--------------------------------------
: Luigi Rizzo                  |  Dip. di Ingegneria dell'Informazione
: email: luigi@iet.unipi.it    |  Universita' di Pisa
: tel: +39-50-568533           |  via Diotisalvi 2, 56126 PISA (Italy)
: fax: +39-50-568522           |  http://www.iet.unipi.it/~luigi/
: _____________________________|______________________________________

-- 
Brian <brian@Awfulhak.org>, <brian@FreeBSD.org>, <brian@OpenBSD.org>
      <http://www.Awfulhak.org>;
Don't _EVER_ lose your sense of humour....



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199808312214.XAA06366>