tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Detecting parent's termination

> I discovered a possible easier way: perfused shares a socketpair with
> the parent (that is, the filesystem), and it uses send/recv to talk
> with it.  I just noticed I used MSG_NOSIGNAL here.  As I understand,
> if I remove MSG_NOSIGNAL, I should get a SIGPIPE when parent dies.

Um, not quite.  If you remove MSG_NOSIGNAL - and SIGPIPE is not ignored
or blocked, of course - you should get a SIGPIPE when you write
something after the peer has died.  That is, peer shutdown alone won't
generate SIGPIPE, only sending into a shut-down connection.

This is also assuming nobody but the parent has a descriptor on the
parent's socket; all descriptors on that socket need to be closed, or a
shutdown that includes SHUT_RD done, to provoke broken-pipe behaviour.

> Unfortunately I do not get any signal.  I understand that is wrong,
> and I suspect it may be a SOCK_SEQPACKET bug.

If it's not the issue in my previous paragraph, then I would say it's
SOCK_SEQPACKET and/or the address family in question (AF_LOCAL, I
assume?) that's at fault here.  I'm not sure I'd go so far as to call
it a _bug_, exactly; depending on the protocol and socket type, SIGPIPE
is not necesarily to be expected, though I agree it seems sensible to
expect SIGPIPE potential from AF_LOCAL/SOCK_SEQPACKET.

/~\ The ASCII                             Mouse
\ / Ribbon Campaign
 X  Against HTML      
/ \ Email!           7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B

Home | Main Index | Thread Index | Old Index