X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=pod%2Fperlipc.pod;h=416ded56057d991123d409f436eb82d7f9f462cc;hb=6e0733998eff7a098d2d21d5602f3eb2a7521e1f;hp=f027d23839fa26ecfc628e66a3e59846151db748;hpb=f979aebcf2bd35d620f0ca3623215cc1355f26d9;p=p5sagit%2Fp5-mst-13.2.git diff --git a/pod/perlipc.pod b/pod/perlipc.pod index f027d23..416ded5 100644 --- a/pod/perlipc.pod +++ b/pod/perlipc.pod @@ -119,14 +119,14 @@ handlers: But that will be problematic for the more complicated handlers that need to reinstall themselves. Because Perl's signal mechanism is currently based on the signal(3) function from the C library, you may sometimes be so -misfortunate as to run on systems where that function is "broken", that +unfortunate as to run on systems where that function is "broken", that is, it behaves in the old unreliable SysV way rather than the newer, more reasonable BSD and POSIX fashion. So you'll see defensive people writing signal handlers like this: sub REAPER { $waitedpid = wait; - # loathe sysV: it makes us not only reinstate + # loathe SysV: it makes us not only reinstate # the handler, but place it after the wait $SIG{CHLD} = \&REAPER; } @@ -145,7 +145,7 @@ or better still: while (($child = waitpid(-1,WNOHANG)) > 0) { $Kid_Status{$child} = $?; } - $SIG{CHLD} = \&REAPER; # still loathe sysV + $SIG{CHLD} = \&REAPER; # still loathe SysV } $SIG{CHLD} = \&REAPER; # do something that forks... @@ -536,7 +536,7 @@ output doesn't wind up on the user's terminal). or die "Can't write to /dev/null: $!"; defined(my $pid = fork) or die "Can't fork: $!"; exit if $pid; - setsid or die "Can't start a new session: $!"; + die "Can't start a new session: $!" if setsid == -1; open STDERR, '>&STDOUT' or die "Can't dup stdout: $!"; } @@ -581,7 +581,7 @@ you opened whatever your kid writes to his STDOUT. open (FILE, "> /safe/file") || die "can't open /safe/file: $!"; while () { - print FILE; # child's STDIN is parent's KID + print FILE; # child's STDIN is parent's KID_TO_WRITE } exit; # don't forget this } @@ -933,7 +933,7 @@ go back to service a new client. while ((my $pid = waitpid(-1,WNOHANG)) > 0 && WIFEXITED($?)) { logmsg "reaped $waitedpid" . ($? ? " with exit $?" : ''); } - $SIG{CHLD} = \&REAPER; # loathe sysV + $SIG{CHLD} = \&REAPER; # loathe SysV } $SIG{CHLD} = \&REAPER; @@ -1115,7 +1115,7 @@ to be on the localhost, and thus everything works right. while (($waitedpid = waitpid(-1,WNOHANG)) > 0) { logmsg "reaped $waitedpid" . ($? ? " with exit $?" : ''); } - $SIG{CHLD} = \&REAPER; # loathe sysV + $SIG{CHLD} = \&REAPER; # loathe SysV } $SIG{CHLD} = \&REAPER;