Re: On SIGCHLD signal semantics

Mark.Hemment@uniplex.co.uk
Tue, 4 Jun 96 11:46:11 +0100


> Marc La France, wrote;
> The circumstances addressed are when a parent process decides to wait
> for termination of one of its child processes, but does so with
> its SIGCHLD signal handler set to SIG_IGN. If the child process
> terminates while its parent is waiting, this is not a problem. But
> if the child terminates before the parent waits, then the parent
> will be told it has no children (because the kernel has already gotten
> rid of any indication of the child's existence). This can confuse the
> parent process.

> Marc.

wait(2) should fail if a process has no existing unwaited-for child
processes. errno should be set to ECHILD. The parent shouldn't get
confused if it is written correctly.
This is traditional behaviour; I'm sure POSIX.2 hasn't broken it :(

I believe this is what Linux already does (or did do, havn't checked
recently...).

markhe