Re: wait code is fishy

Harald van Dijk <[email protected]> Mon, 11 Aug 2025 02:21:57 +0100
Newsgroups org.kernel.vger.dash
Message-ID <[email protected]>
On 10/08/2025 22:30, Denys Vlasenko wrote:
> The reason for "pid == 0" retrying NONBLOCK wait for more processes
> is unclear: if we got here, we already did wait for processes
> just now, got none, waited for signals and got a not-SIGCHLD one,
> so there should not be more processes to wait for.
> A comment explaining it would be nice?

A signal that gets sent to a process group can simultaneously be a 
nonfatal signal to the shell, and a fatal signal to the child, where the 
nonfatal signal to the shell may get processed by the shell before the 
SIGCHLD resulting from the fatal signal to the child. I do think it's 
possible for that extra loop iteration to find more processes that have 
terminated.

Whether this is an important case to handle, I do not know.

Cheers,
Harald van Dijk