Commit Graph

8 Commits

Author SHA1 Message Date
Arun Chandrasekaran
cd7ea2abf3 kill: use sigqueue to pass value with the signal.
New -q/--queue option for kill so it will send an integer to the
signalled process. See sigqueue(3) for details.

References:
 https://pubs.opengroup.org/onlinepubs/009695399/functions/sigqueue.html
 procps-ng/procps!32

Signed-off-by: Craig Small <csmall@dropbear.xyz>
2020-05-11 17:36:12 +10:00
Qualys Security Advisory
c704460c7d 0022-skill: Simplify the kill_main() loop.
Right now the "loop=0; break;" is never reached.
2018-06-23 21:59:14 +10:00
Craig Small
aa41c309dd kill: -l space between name parses correctly
This was supposed to be just a cherry-pick of the referenced
commit. However there were two problems:
 1. kill code was moved out to its own file
 2. strtosig() had a latent bug where signal numbers were not
 converted to names.

Original note:
kill -lHUP would work correctly, but kill -l HUP would not.

The list option in kill was hit by a quirk of getopt_long where an
option with an optional argument would not attempt to get the argument
beyond the space, even though a mandatory argument would do that.

The fix is a kludge to scan to the next argument and if it looks
like something we can use, use it. Lucky for us, the list option is
one where parsing can stop immediately.

Thanks to Brian Vandenberg for the way forward.

References:
 http://stackoverflow.com/questions/1052746/getopt-does-not-parse-optional-arguments-to-parameters
 https://bugs.debian.org/854407
 commit 537cea324b121f54744369425332c256aa84a181
2017-05-22 22:15:59 +10:00
Craig Small
96da4bad5e kill: Correct pid type
Previous commit used a pid type of int in the printf, this should
be a long.

References:
 commit 5e9c522eea
2016-07-02 15:04:22 +10:00
Craig Small
5e9c522eea kill: report error if cannot kill process
Shell kill would report a problem if you tried to kill a process
while procps kill was silent. This meant it looked like kill worked
when it actually failed.

References:
 commit 07642b8ea6
 https://bugs.debian.org/733172
2016-07-02 14:49:51 +10:00
Filipe Brandenburger
8d6466a48d kill: print usage if no pid is passed in command line
Modication of master line patch 27b2937

Signed-off-by: Craig Small <csmall@enc.com.au>
2016-04-11 21:04:41 +10:00
Craig Small
6586f9f9ce skill: fix command line with signal, again
Application of master patch d1d2ccf

Original by Filipe Brandenburger <filbranden@google.com>

Signed-off-by: Craig Small <csmall@enc.com.au>
2016-04-11 20:59:48 +10:00
Craig Small
f65121ef74 kill: split out from skill/snice
The first part of fixing skill/snice to use the library instead
of directly readdir()ing /proc which is what it does now.

Remove the kill code from the skill/snice code and put common
elements into lib/signals.c Not 100% sure that is the right
destination instead of a new lib file, but ok for now.

kill shares some parsing logic with skill/snice but mainly
around signal specifications. The "do it" code is very different.

Signed-off-by: Craig Small <csmall@enc.com.au>
2015-09-26 09:13:13 +10:00