On 18/02/07, Peter <[EMAIL PROTECTED]> wrote:


On Sun, 18 Feb 2007, Amos Shapira wrote:

>> That's why you must use both a reaper and select() with timeout.
>
> What's the point of select(2) with a timeout? How long should the
timeout be
> set and what should be checked when it's reached? Why wouldn't a child
> reaper be enough in the situation Baruch describes?
>
> In general - I'm very vey unfond of solutions which involve busy waits
(and
> a select with a timeout is busy wait in my dictionary).

This is not a busy wait at all. Select with a timeout yields until one
of the sockets needs attention.


Or the timer expires and makes the waiter do some "test and repeat" job,
which falls under my definition of "busy wait" (even if it gets to rest for
a while between iterations).

It is very possible and very likely that there will be no SIGCHLD from a
properly written deaemon child because it will become a process group
leader. Also many daemons whose source is not available will go into the


Huh?? When a group leader exits his parent gets SIGCHLD. That's one of those
sticky PITA's of UNIX process programming. (I've just double-checked this
with a quick program which demonstrate it). The only way I can remember to
avoid receving SIGCHLD is by setting it's handler to SIG_IGN (ignore).

background and become a pgld as above and thus anything forking them
will exit and give off a SIGCHLD.


Right, as I replied to Shachar's post (half-addressed to Baruch).

There is NO way to tell if a daemon is 'alive' or stuck etc excepting
when it sends or receives data through a socket. The only part of the
system that is able to detect this is the network subsystem, using
iptables or the method applied by SE Linux. iptables can be 'booby
trapped' to call a user mode application when packets are detected on
certain ports. This can be used to open the firewall when needed if
desired (like windows firewalls do).

Peter


You are getting off subject - the original question was about how to find
out that the other side of a socketpair has closed it.

--Amos

Reply via email to