An initial revision of "kill -l [exitstatus]"
Mats Erik Andersson
mats.andersson64 at comhem.se
Sat Apr 28 13:42:09 UTC 2007
Hi there,
let me return to the subject of "kill -l", as it is present
in an ash builtin and as an applet. Luciano M. F. Rocha had
an important point earlier on, when observing that the ash
builtin command must supply a functionality "kill -9 %1",
which the applet "kill" can never do. Therefore I have as a
first step, in response to Denis Vlasenko's challenge to
integrate the two kill commands into a single code,
concentrated on a partial task:
1) Make a shared code for "kill -l [exitstatus]".
2) Conform to all parts of SUSv3 for "kill -l [exitstatus]"
Both these are accomplished using the two attached files. They are not
intended to immediately be applied to the source tree, since they have
two macros
ENABLE_FEATURE_KILL_STRICTLY_SUSV3
and
ENABLE_FEATURE_KILL_MANY_SIGNALS
defined internally, but they are functional on my testing system
and they save 235 bytes, in addition to complying to SUSv3, which both
the earlier kill-instances fail to do. I would like comments on these
snippets. My implementation presently touches upon the files
libbb/signallist.c (new builtin/shared functionality)
libbb/Kbuild
include/libbb.h
procps/kill.c
shell/ash.c
Our earlier discussion on "kill -l exitstatus" did not properly fathom
what the standard intends with this. I have been studying this and
believe I know their intention. SUSv3 would like this functionality:
$ cat > /dev/null
<Ctrl-C>
$ echo "Died of SIG$(kill -l $?)"
Died of SIGINT
$
The actual value of "$?" is 130 when evaluated in the above situation.
My code correctly delivers this functionality, where both the previous
kill-instances aborted with an error, since 130 is not an allowed signal
in their implementation.
As a minimal extension on SUSv3, my code allows a bidirectional
conversion, where SUSv3 is uni-directional:
$ kill -l 3 # Required by SUSv3
QUIT
$ kill -l QUIT
3
I hope to hear your views and criticism in due time.
Best regards, Mats E Andersson
-------------- next part --------------
A non-text attachment was scrubbed...
Name: revised_kill_susv3.diff
Type: text/x-patch
Size: 2170 bytes
Desc: not available
Url : http://lists.busybox.net/pipermail/busybox/attachments/20070428/9e809759/attachment-0002.bin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signallist.c
Type: text/x-csrc
Size: 1620 bytes
Desc: not available
Url : http://lists.busybox.net/pipermail/busybox/attachments/20070428/9e809759/attachment-0002.c
More information about the busybox
mailing list