aboutsummaryrefslogtreecommitdiff
path: root/toys/posix
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2016-05-23 10:34:01 -0700
committerRob Landley <rob@landley.net>2016-05-23 18:23:26 -0500
commit148a0c3760bfd6f03152f44422a48b37a4a9f393 (patch)
tree4afa1b0ae461fa42b8a91ac572b1c32807f8ead8 /toys/posix
parent6abf1328f4afe934d514180bbcb3b06c2d128cd7 (diff)
downloadtoybox-148a0c3760bfd6f03152f44422a48b37a4a9f393.tar.gz
Fix pkill -9.
This fixes the existing test. Internal Android bug 28877702. I've left -l as-is, even though the desktop doesn't support that.
Diffstat (limited to 'toys/posix')
-rw-r--r--toys/posix/ps.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/toys/posix/ps.c b/toys/posix/ps.c
index a62918ce..e5adc192 100644
--- a/toys/posix/ps.c
+++ b/toys/posix/ps.c
@@ -48,7 +48,7 @@ USE_PS(NEWTOY(ps, "k(sort)*P(ppid)*aAdeflMno*O*p(pid)*s*t*Tu*U*g*G*wZ[!ol][+Ae][
USE_TOP(NEWTOY(top, ">0m" "O*Hk*o*p*u*s#<1d#=3<1n#<1bq[!oO]", TOYFLAG_USR|TOYFLAG_BIN|TOYFLAG_LOCALE))
USE_IOTOP(NEWTOY(iotop, ">0AaKO" "k*o*p*u*s#<1=7d#=3<1n#<1bq", TOYFLAG_USR|TOYFLAG_BIN|TOYFLAG_STAYROOT|TOYFLAG_LOCALE))
USE_PGREP(NEWTOY(pgrep, "?cld:u*U*t*s*P*g*G*fnovxL:[-no]", TOYFLAG_USR|TOYFLAG_BIN))
-USE_PKILL(NEWTOY(pkill, "Vu*U*t*s*P*g*G*fnovxl:[-no]", TOYFLAG_USR|TOYFLAG_BIN))
+USE_PKILL(NEWTOY(pkill, "?Vu*U*t*s*P*g*G*fnovxl:[-no]", TOYFLAG_USR|TOYFLAG_BIN))
config PS
bool "ps"
@@ -194,9 +194,9 @@ config PKILL
default y
depends on PGKILL_COMMON
help
- usage: pkill [-l SIGNAL] [PATTERN]
+ usage: pkill [-SIGNAL|-l SIGNAL] [PATTERN]
- -l SIGNAL to send
+ -l Send SIGNAL (default SIGTERM)
-V verbose
config PGKILL_COMMON
@@ -1725,6 +1725,9 @@ void pgrep_main(void)
void pkill_main(void)
{
+ char **args = toys.optargs;
+
+ if (!(toys.optflags&FLAG_l) && *args && **args=='-') TT.pgrep.L = *(args++)+1;
if (!TT.pgrep.L) TT.pgrep.signal = SIGTERM;
if (toys.optflags & FLAG_V) TT.tty = 1;
pgrep_main();