summaryrefslogtreecommitdiff
path: root/doio.c
diff options
context:
space:
mode:
authorDavid Mitchell <davem@iabyn.com>2014-02-23 13:25:05 +0000
committerDavid Mitchell <davem@iabyn.com>2014-02-28 13:55:56 +0000
commit111f73b5d79a652d1b6c6e3df3c6cd4c14c17ea7 (patch)
treeea2bdb9c5f80d8f2f365cc5bac5492d2a1aa4f44 /doio.c
parent3d147ac29d12abdb2ed2e2bc6a5c0963319ea7b1 (diff)
downloadperl-111f73b5d79a652d1b6c6e3df3c6cd4c14c17ea7.tar.gz
[perl #121230] fix kill -SIG on win32
v5.17.1-137-gc2fd40c tidied up perl's kill() implementation, making -SIGNAME be handled correctly, It also eliminated the use of the killpg() system/library call, which these days is usually just a thin wrapper over kill(). By doing this, it assumed that the following are functionally equivalent: killpg(pgrp, sig) kill(-pgrp, sig). Unfortunately this broke Window's use of the (perl-level) kill negative_value, pid, ... since under Windows, the killpg()/kill() identity doesn't hold (win32_kill() uses negative ids for fake-PIds, not process groups). Fix this by restoring the use of killpg() where available.
Diffstat (limited to 'doio.c')
-rw-r--r--doio.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/doio.c b/doio.c
index 81abd9cc6e..205365ae74 100644
--- a/doio.c
+++ b/doio.c
@@ -1789,12 +1789,15 @@ nothing in the core.
if (!(SvNIOK(*mark) || looks_like_number(*mark)))
Perl_croak(aTHX_ "Can't kill a non-numeric process ID");
proc = SvIV_nomg(*mark);
- if (killgp)
- {
- proc = -proc;
- }
APPLY_TAINT_PROPER();
- if (PerlProc_kill(proc, val))
+#ifdef HAS_KILLPG
+ /* use killpg in preference, as the killpg() wrapper for Win32
+ * understands process groups, but the kill() wrapper doesn't */
+ if (killgp ? PerlProc_killpg(proc, val)
+ : PerlProc_kill(proc, val))
+#else
+ if (PerlProc_kill(killgp ? -proc: proc, val))
+#endif
tot--;
}
PERL_ASYNC_CHECK();