[lkml]   [2007]   [Feb]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH] fix handling of SIGCHILD from reaped child
On Tue, 20 Feb 2007 20:20:49 +0300
Oleg Nesterov <> wrote:
> > > > + clear_stale_sigchild(current, retval);
> > >
> > > But we are not checking that SIGCHLD is blocked?
> > >
> > I'm sorry if I don't read SUSv3 correctly. SUSv3 doesn't define how we should
> > do if SIGCHLD is not blocked.(so I don't check not-blocked case.)
> Probably it is me who misunderstands SUSv3. Could you point me the reference
> to authoritative document? My understanding: if blocked AND wait() succeeds.
I read this:

> > IMHO, user's sig-child-handler is tend to call wait()/waitpid() and expects
> > successful return. So removing stale signal here may be good.
> Yes. But sig-child-handler should do
> while (wait() >= 0)
> ....
> anyway, because SIGCHLD is not a realtime signal.
> looks I should explation why I found this more.

A user (who is migrated from Solaris) met following situation.
==(single threaded program.)

pid1 = fork();
if (!pid1) {
....set SIGCHLD handler here to catch pid1's error-exit....

if (!pid2) {
ret = waitpid(pid2, hoge, hoge); // wait for pid2

And SIGCHLD handler didn't use WNOHANG.
I asked him to fix his program. He agreed.(So, no problem now.)

While our problem was fixed, it seems Linux doesn't meet spec.(SUSv3)
So I posted.
But this is rare situation and this fix makes codes ugly....


To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

 \ /
  Last update: 2007-02-21 01:47    [W:0.030 / U:31.712 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site