Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 13 Dec 2000 23:55:19 +0000
From:      Brian Somers <brian@Awfulhak.org>
To:        Tony Finch <dot@dotat.at>
Cc:        Brian Somers <brian@Awfulhak.org>, Alfred Perlstein <bright@wintelcom.net>, arch@FreeBSD.ORG, net@FreeBSD.ORG, brian@Awfulhak.org
Subject:   Re: patch to cleanup inflight desciptor handling. 
Message-ID:  <200012132355.eBDNtJU70418@hak.lan.Awfulhak.org>
In-Reply-To: Message from Tony Finch <dot@dotat.at>  of "Wed, 13 Dec 2000 22:57:53 GMT." <20001213225753.B30050@hand.dotat.at> 

next in thread | previous in thread | raw e-mail | index | archive | help
> Brian Somers <brian@Awfulhak.org> wrote:
> >
> >Hmm, the last time i looked at this, I believe the whole thing was 
> >dealt with by not increasing the file descriptor reference count 
> >when it was put in the message header.  If process A closed the 
> >descriptor before process B actually recvmsg()d it, it would be 
> >EBADF.  The recvmsg() actually incremented the reference count.
> 
> But it has always been documented behaviour that the receiving process
> gets a valid descriptor even if the sender closes it directly after
> sendmsging it. If this was not the case then descriptor handoff would
> require an "ok" reply from the receiving process before the sender
> could close it, which is a pain.
> 
> Hmm, the only references for this I can think of are Stevens and the
> red & black daemon books, but I'm sure I've read a good discussion of
> it somewhere else.

I've just looked back through my archives... the problem I'm thinking 
of was a different problem - where the descriptor passed was the only 
descriptor open for a tty whose pgrp was that of process A.  A passed 
the descriptor to B and then exited at which point the tty 
(correctly) revoked all it's remaining descriptors (the one en-route 
or in process B).

There's no way to avoid this - except by having A fork(), the child 
close the descriptor and continue where it left off and the parent 
pause() waiting for a signal from B to tell it that it's finished 
with that tty.

This is why I implemented ``enable keep-session'' :-)

> Tony.
> -- 
> f.a.n.finch    fanf@covalent.net    dot@dotat.at
> "And remember my friend, future events such
> as these will affect you in the future."

Cheers.

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




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




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