Avoiding <exiting> processes on Ultrix
Dan Bernstein
bernsten at phoenix.Princeton.EDU
Wed Apr 12 08:01:46 AEST 1989
In article <520 at pan.UUCP> jw at pan.UUCP (Jamie Watson) writes:
> Is there any way under Ultrix (2.0 or later) to write a C program
> such that any child processes created by that program will exit,
> without hanging in an <exiting> status until the parent does a wait()
> for the child? Under SysV this is done with signal(SIGCLD, SIG_IGN);
> I have tried that under Ultrix, to no avail.
I'm surprised nobody's mentioned setting up a SIGCLD/SIGCHLD handler
that does a wait().
sigchld() { wait(0); }
signal(SIGCHLD,sigchld);
This is faster (on some machines, much much faster) than an extra
fork(). It is certainly more general than ignoring the signal, and
it's the basis for the shell job control (with a more intelligent
sigchld()).
---Dan Bernstein, bernsten at phoenix.princeton.edu
More information about the Comp.unix.questions
mailing list