diff options
author | John P. Linderman <jpl@research.att.com> | 2003-08-10 11:44:33 -0400 |
---|---|---|
committer | Rafael Garcia-Suarez <rgarciasuarez@gmail.com> | 2003-08-10 20:44:23 +0000 |
commit | 41f8dfce38b6daf46f052c48ff12fd2c3db9aa84 (patch) | |
tree | eb761164cc5f5cf8ea73d8919e3082f1ccd29413 /pod | |
parent | 005a0d108858cb2016fd716a429d39b93f3aa32d (diff) | |
download | perl-41f8dfce38b6daf46f052c48ff12fd2c3db9aa84.tar.gz |
Re: killing for vital signs [PATCH]
From: "John P. Linderman" <jpl@research.att.com>
Message-Id: <200308101944.PAA96547@raptor.research.att.com>
p4raw-id: //depot/perl@20607
Diffstat (limited to 'pod')
-rw-r--r-- | pod/perlfunc.pod | 6 | ||||
-rw-r--r-- | pod/perlipc.pod | 11 |
2 files changed, 14 insertions, 3 deletions
diff --git a/pod/perlfunc.pod b/pod/perlfunc.pod index f47b6a5d86..f10927ed85 100644 --- a/pod/perlfunc.pod +++ b/pod/perlfunc.pod @@ -2378,7 +2378,7 @@ same as the number actually killed). kill 9, @goners; If SIGNAL is zero, no signal is sent to the process. This is a -useful way to check that the process is alive and hasn't changed +useful way to check that a child process is alive and hasn't changed its UID. See L<perlport> for notes on the portability of this construct. @@ -2386,7 +2386,9 @@ Unlike in the shell, if SIGNAL is negative, it kills process groups instead of processes. (On System V, a negative I<PROCESS> number will also kill process groups, but that's not portable.) That means you usually want to use positive not negative signals. You may also -use a signal name in quotes. See L<perlipc/"Signals"> for details. +use a signal name in quotes. + +See L<perlipc/"Signals"> for more details. =item last LABEL diff --git a/pod/perlipc.pod b/pod/perlipc.pod index 637030c726..8412bfd809 100644 --- a/pod/perlipc.pod +++ b/pod/perlipc.pod @@ -95,13 +95,22 @@ it doesn't kill itself): } Another interesting signal to send is signal number zero. This doesn't -actually affect another process, but instead checks whether it's alive +actually affect a child process, but instead checks whether it's alive or has changed its UID. unless (kill 0 => $kid_pid) { warn "something wicked happened to $kid_pid"; } +When directed at a process whose UID is not identical to that +of the sending process, signal number zero may fail because +you lack permission to send the signal, even though the process is alive. +You may be able to determine the cause of failure using C<$!>. + + unless (kill 0 => $pid or $! == $!{EPERM}) { + warn "$pid looks dead"; + } + You might also want to employ anonymous functions for simple signal handlers: |