diff options
author | Lukas Mai <l.mai@web.de> | 2016-01-01 15:35:58 +0100 |
---|---|---|
committer | Lukas Mai <l.mai@web.de> | 2016-01-05 12:26:24 +0100 |
commit | a6b6b8ec1b4f13c49a1d7ea81f89a87a654406cb (patch) | |
tree | 2e4d21a7b6574a7cdacda74411ea6fcb71a3f62f | |
parent | d691474c4cf3d3119367a72ebb28a990d039baf3 (diff) | |
download | perl-a6b6b8ec1b4f13c49a1d7ea81f89a87a654406cb.tar.gz |
explain meaning of negative PIDs in waitpid [perl #127080]
-rw-r--r-- | pod/perlfunc.pod | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/pod/perlfunc.pod b/pod/perlfunc.pod index 72e62a5337..d27806cbae 100644 --- a/pod/perlfunc.pod +++ b/pod/perlfunc.pod @@ -9052,8 +9052,15 @@ X<waitpid> Waits for a particular child process to terminate and returns the pid of the deceased process, or C<-1> if there is no such child process. On some -systems, a value of 0 indicates that there are processes still running. -The status is returned in C<$?> and C<${^CHILD_ERROR_NATIVE}>. If you say +systems, a return value of 0 indicates that there are processes still running. +The status is returned in C<$?> and C<${^CHILD_ERROR_NATIVE}>. + +A PID of C<0> indicates to wait for any child process whose process group ID is +equal to that of the current process. A PID of less than C<-1> indicates to +wait for any child process whose process group ID is equal to -PID. A PID of +C<-1> indicates to wait for any child process. + +If you say use POSIX ":sys_wait_h"; #... @@ -9061,7 +9068,8 @@ The status is returned in C<$?> and C<${^CHILD_ERROR_NATIVE}>. If you say $kid = waitpid(-1, WNOHANG); } while $kid > 0; -then you can do a non-blocking wait for all pending zombie processes. +then you can do a non-blocking wait for all pending zombie processes (see +L<POSIX/WAIT>). Non-blocking wait is available on machines supporting either the waitpid(2) or wait4(2) syscalls. However, waiting for a particular pid with FLAGS of C<0> is implemented everywhere. (Perl emulates the |