> Brian Somers <[EMAIL PROTECTED]> 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 [EMAIL PROTECTED] [EMAIL PROTECTED]
> "And remember my friend, future events such
> as these will affect you in the future."
Cheers.
--
Brian <[EMAIL PROTECTED]> <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 [EMAIL PROTECTED]
with "unsubscribe freebsd-net" in the body of the message