diff options
-rw-r--r-- | pod/perlfunc.pod | 6 | ||||
-rw-r--r-- | pod/perlipc.pod | 12 | ||||
-rw-r--r-- | pod/perlvar.pod | 4 |
3 files changed, 19 insertions, 3 deletions
diff --git a/pod/perlfunc.pod b/pod/perlfunc.pod index 58c3e7199c..e72624faa0 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<perlipc>. =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<perlipc> for other examples. +Note that a return value of C<-1> could mean that child processes are being +automatically reaped. See L<perlipc> for details, and for other examples. =item wantarray diff --git a/pod/perlipc.pod b/pod/perlipc.pod index cc2a1a9d81..c74c520637 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<CHLD> (sometimes also known as C<CLD>) 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<wait()> +on its child processes (i.e. child processes are automatically reaped). +Calling C<wait()> 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 739dd55cd2..af5f62f74b 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<CHLD> signal. See L<perlipc> 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: |