tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: wait(2) and SIGCHLD



On Fri, Aug 14, 2020 at 03:51:12PM -0400, Mouse wrote:
 > > What I observe is that a process that explicitly ignores SIGCHLD
 > > (SIG_IGN), then forks a child which exits, when wait()ing for the
 > > child, gets ECHILD (i.e., wait returns -1 and errno is ECHILD).
 > 
 > And the ECHILD return is delayed until all children have terminated
 > (ie, until there are no outstanding children, until the ECHILD return
 > is accurate).  That's important for some use cases.

Huh, I hadn't realized (or expected) that. So I guess it's wrong to
implement this by just detaching the child up front...?

I'm guessing also then that it's the signal setting when the child
exits that matters; I had always thought it was the signal setting
when the child was forked.

"signals are a semantic cesspool"

-- 
David A. Holland
dholland%netbsd.org@localhost


Home | Main Index | Thread Index | Old Index