From: Gurusamy Sarathy Date: Fri, 30 Oct 1998 21:08:11 +0000 (+0000) Subject: mention the C<$SIG{CHLD} = 'IGNORE'> special case X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=f648820cb158526d3c3e16f712206316f2112b7e;p=p5sagit%2Fp5-mst-13.2.git mention the C<$SIG{CHLD} = 'IGNORE'> special case p4raw-id: //depot/perl@2152 --- diff --git a/pod/perlfunc.pod b/pod/perlfunc.pod index 58c3e71..e72624f 100644 --- a/pod/perlfunc.pod +++ b/pod/perlfunc.pod @@ -4432,7 +4432,8 @@ If you know the exact length in bits, it can be used in place of the C<*>. Waits for a child process to terminate and returns the pid of the deceased process, or C<-1> if there are no child processes. The status is -returned in C<$?>. +returned in C<$?>. Note that a return value of C<-1> could mean that +child processes are being automatically reaped, as described in L. =item waitpid PID,FLAGS @@ -4451,7 +4452,8 @@ FLAGS of C<0> is implemented everywhere. (Perl emulates the system call by remembering the status values of processes that have exited but have not been harvested by the Perl script yet.) -See L for other examples. +Note that a return value of C<-1> could mean that child processes are being +automatically reaped. See L for details, and for other examples. =item wantarray diff --git a/pod/perlipc.pod b/pod/perlipc.pod index cc2a1a9..c74c520 100644 --- a/pod/perlipc.pod +++ b/pod/perlipc.pod @@ -56,7 +56,17 @@ So to check whether signal 17 and SIGALRM were the same, do just this: You may also choose to assign the strings C<'IGNORE'> or C<'DEFAULT'> as the handler, in which case Perl will try to discard the signal or do the -default thing. Some signals can be neither trapped nor ignored, such as +default thing. + +On most UNIX platforms, the C (sometimes also known as C) signal +has special behavior with respect to a value of C<'IGNORE'>. +Setting C<$SIG{CHLD}> to C<'IGNORE'> on such a platform has the effect of +not creating zombie processes when the parent process fails to C +on its child processes (i.e. child processes are automatically reaped). +Calling C with C<$SIG{CHLD}> set to C<'IGNORE'> usually returns +C<-1> on such platforms. + +Some signals can be neither trapped nor ignored, such as the KILL and STOP (but not the TSTP) signals. One strategy for temporarily ignoring signals is to use a local() statement, which will be automatically restored once your block is exited. (Remember that local() diff --git a/pod/perlvar.pod b/pod/perlvar.pod index 739dd55..af5f62f 100644 --- a/pod/perlvar.pod +++ b/pod/perlvar.pod @@ -835,6 +835,10 @@ signals. Example: $SIG{'INT'} = 'DEFAULT'; # restore default action $SIG{'QUIT'} = 'IGNORE'; # ignore SIGQUIT +Using a value of C<'IGNORE'> usually has the effect of ignoring the +signal, except for the C signal. See L for more about +this special case. + The %SIG array contains values for only the signals actually set within the Perl script. Here are some other examples: