UNIX question

Richard Mathews lcc.rich-wiz at locus.ucla.edu
Thu Dec 19 03:18:07 AEST 1985


> From: Chris Torek <chris%umcp-cs.uucp at BRL.ARPA>

> ... But that is
> not all that is amiss.  In V7, 3BSD, and 4BSD, and I suspect also
> in Sys III and V (and Vr2 and Vr2V2), and probably in V8 as well,
> signals are not queued...

> The problem is that several children may exit in quick succession.
> Only one SIGCLD signal will be delivered, since the parent process
> will (just this once) not manage to run before all have exited.
> The sigcld handler has no way of determining how many children are
> to be processed.

In System V, SIGCLDs are queued (well, sort of).  See the signal(2)
manual page.  In reality what Sys V does is this (at least on a VAX):

The SIGCLD action gets reset to SIG_DFL when the signal is caught.
The signal handler must reestablish itself as the handler for SIGCLD.
System V assumes that this is done just before the handler returns.
When you call signal(SIGCLD, func), the system checks for any zombies
and sends a SIGCLD to the parent if there are any zombie children.  Thus
it looks as if SIGCLDs are queued (unfortunately, the manual lies and
just says "the signal-catching function will be continually reentered
until the queue is empty").

Richard M. Mathews
Locus Computing Corporation		       lcc.richard at LOCUS.UCLA.EDU
					       lcc.richard at UCLA-CS
			  {ihnp4,ucivax,trwrb}!lcc!richard
       {randvax,sdcrdcf,ucbvax,trwspp}!ucla-cs!lcc!richard



More information about the Comp.unix.wizards mailing list