develooper Front page | perl.perl5.porters | Postings from February 2007

Re: system() behavior with $SIG{CHLD} = IGNORE (was Re: [perl #36976])

Thread Previous | Thread Next
From:
Rick Delaney
Date:
February 5, 2007 14:35
Subject:
Re: system() behavior with $SIG{CHLD} = IGNORE (was Re: [perl #36976])
Message ID:
20070205220240.GT26648@bort.ca
On Feb 05 2007, Alan Ferrency wrote:
> - According to the Fedora man page for sigaction(), POSIX specification
>   (B.3.3.1.3) disallows setting SIGCHLD to SIG_IGN at all. (I can't seem
>   to find the actual section text, unfortunately.) From a Perl
>   perspective, does this mean it's illegal for Perl to set SIGCHLD to
>   SIG_IGN, or that it's illegal for me to set $SIG{CHLD} = 'IGNORE' in
>   my Perl code?

From my Ubuntu manpage for sigaction(2):

   POSIX.1-1990 disallowed setting the  action  for  SIGCHLD  to  SIG_IGN.
   POSIX.1-2001  allows  this possibility, so that ignoring SIGCHLD can be
   used to prevent the creation of zombies (see  wait(2)).   Nevertheless,
   the historical BSD and System V behaviours for ignoring SIGCHLD differ,
   so that the only completely portable method of ensuring that terminated
   children  do not become zombies is to catch the SIGCHLD signal and per‐
   form a wait(2) or similar.

Regardless, I think Perl's wait() can only be expected to call the
OS's wait(2).  If there are any POSIX.1-1990 conformant systems out there
then I'd expect them to balk at setting SIGCHLD to SIG_IGN with
sigaction().  And by extension, Perl should fail when setting 
$SIG{CHLD} = 'IGNORE' on such a system.  If not, please file a bug report.
:-)

As long as Perl is using the underlying system calls, it has some hope of
meeting the standards of the OS it's running on.  I don't think it's
Perl's place to try to be the One True Standard, certainly not for
low-level system calls.

-- 
Rick Delaney
rick@bort.ca

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About