lkml.org 
[lkml]   [1996]   [Jun]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: More SIGCHLD musings
Hi,

Michiel Boland wrote:
> When I run the included program on SunOS 4.1.3. and Solaris 2.5,
> it prints "sig" as expected. But when I run it on Linux 2.0.0,
> or indeed Linux 1.2.13, nothing happens.

> What's going on here?

The correct behaviour, for Linux, - I think.

If SIGCLD is blocked, then wait(2) should _not_ unblock the signal.

When the child dies, SIGCLD is posted and is left pending - ie. it is
not processed by the parent (it's blocked!). This would cause wait()
to not return, as the parent would not be notified of the childs death.
To avoid this, when the child dies it ensures it wakes up a parent that
may be waiting for it - by sending SIGCLD _and_ directly calling
wake_up() on 'wait_chldexit'.

Hence, the wait(2) returns, and the SIGCLD signal handler is not called.

I'm guesing here, but SunOS/Solaris is probably unblocking SIGCLD signal
so that the parent process's wait() always gets woken up by the SIGCLD
when the child dies - it does not have a 'back-door' for waking-up the
parent. This would cause the signal handler to be called.

markhe


\
 
 \ /
  Last update: 2005-03-22 13:37    [W:0.031 / U:0.048 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site