* Amos Shapira <[EMAIL PROTECTED]> [070216 03:17]:
> Hi,
> 
> I'm trying to help complete Shachar Shemesh' privbind project (
> http://sourceforge.net/projects/privbind) and it mostly works except that
> when the writing side of the socketpair exits, the side which calls
> "recvfrom" keeps waiting for messages.
> 
> I couldn't find anything which suggests that I'm doing it wrong.
> 
> More details (the code is pretty small):
> 
> privbind creates an AF_UNIX, SOCK_DGRAM socketpair to communicate between a
> parent and a child process. The parent then calls recvmsg(2) and waits for
> request from the child.
> If the child exits then the parent will keep on waiting on the receiving
> socket.
> 
> I expected the recvmsg to return an empty message when the child exits but
> this doesn't happen. Explicitly closing the socket by the child didn't help
> either.
> 
> What am I missing?

If it is a process parent/child pair then you could listen on the signal
SIGCHLD and when the child exits your process will be notified by the
kernel. You'll need to wait() on the child process in the signal handler
to reap the zombie child process.

Baruch

=================================================================
To unsubscribe, send mail to [EMAIL PROTECTED] with
the word "unsubscribe" in the message body, e.g., run the command
echo unsubscribe | mail [EMAIL PROTECTED]

Reply via email to