lkml.org 
[lkml]   [1996]   [Jun]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: On SIGCHLD signal semantics
On Tue, 4 Jun 1996 Mark.Hemment@Uniplex.Co.UK wrote:

> >> 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 :(

> > What you say is true, but only if the parent isn't ignoring SIGCHLD
> > or the child exits before the parent waits. Thus there's a timing
> > problem when the parent's SIGCHLD handler is SIG_IGN.

> At times I have used setting SIGCLD to SIG_IGN, and called wait(2). This
> does have a specified action. While there are child processes, wait(2)
> will not return. When all childern have died, wait(2) returns with
> ECHILD. This is a useful, and is (possibly) a POSIX.2 requirement.

OK. So, this makes a case for setting your SIGCHLD handler to SIG_IGN
and calling wait. Except for one thing: in Linux, wait *will* return
with the pid of a child that exited during the wait call. Kernel changes
would be required to make it exactly as you describe.

Aside from this, all I need now is a case for >inheriting< a SIGCHLD
handler of SIG_IGN and calling wait, and a case for causing your children
to inherit a SIGCHLD handler of SIG_IGN.

Marc.

+----------------------------------+-----------------------------------+
| Marc Aurele La France | work: 1-403-492-9310 |
| Computing and Network Services | fax: 1-403-492-1729 |
| 352 General Services Building | email: tsi@ualberta.ca |
| University of Alberta +-----------------------------------+
| Edmonton, Alberta | |
| T6G 2H1 | Standard disclaimers apply |
| CANADA | |
+----------------------------------+-----------------------------------+



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