SYS V SIGCLD Handling

Doug McCallum dougm at queso.ico.isc.com
Tue Nov 21 12:28:29 AEST 1989


In article <1989Nov20.124459.26023 at virtech.uucp> cpcahil at virtech.uucp (Conor P. Cahill) writes:
   In article <957 at sdrc.UUCP>, scjones at sdrc.UUCP (Larry Jones) writes:
...
   > When I run this on my Sys Vr3.0 system, it goes into recursive
   > death.  As soon as the handler calls signal to reestablish
   > itself, it is immediately reinvoked.  Am I doing something wrong,

   Yes.  You need to wait for the child in the handler.  If you have more
   than one possible child, you need to wait for however many of them
   there could be (usually you use alarm() to time out the wait).

You only need to wait for one child in the signal handler.  With SYSV,
the SIGCLD handler will be called once for each child process that
dies.  By waiting for just one and returning, you will get called for
each exiting child with no need to timeout with an alarm.

Another difference between SYSV and BSD handling of SIGCLD/SIGCHLD is
that with SYSV if you set the signal handler to SIG_IGN, the zombie
will be handled without being waited for.



More information about the Comp.unix.questions mailing list