[prev in list] [next in list] [prev in thread] [next in thread] 

List:       busybox
Subject:    Re: An initial revision of "kill -l [exitstatus]"
From:       Mats Erik Andersson <mats.andersson64 () comhem ! se>
Date:       2007-04-29 21:17:21
Message-ID: 1177881441.3674.27.camel () localhost
[Download RAW message or body]

sön 2007-04-29 klockan 16:35 +0200 skrev Denis Vlasenko:
> I was thinking of making shared code for entire kill,
> not just kill -l. This way we can save much more on code size.
> 
> I am attaching my proposal. Please test & report whereever I goof up
> (a lot of subtle error cases there - kill_main must be very careful now
> to not exit, but return to caller!)

The trick of using a space character to parse job numbers is a
good one, I did not find a work around in order to do the full
program of integrating both modes of operation into one code.

In a first test run I could not uncover any errors, but I cannot
agree an the output for the full listing case "kill -l". The SUSv3
specification gives the implementor his freedom, but I dislike
a long listing that include explicit numbers like 7, 16, and 22--31,
which do not correspond to named signals. I attach a patch to 
correct this. Unfortunately it adds, in its present form, 16 bytes.
That "kill -l 7" outputs "7", instead of silence like bash does, is
not particularly concerning to me, since SUSv3 leaves it as one
of the undefined cases, and error/exception handling is equally
well left to the script author,

Regards		Mats E A


P.S.

In the process of testing this, I made a strange observation how
my Debian Sarge is behaving. See it as a warning to be observant
when revising and improving on Busybox!

Outputs from Sarge with bash:

$ kill -l 16
                    # My addition: signal does not exist!
$ /bin/kill -l 16
STKFLT
$ kill -l 29
IO
$ /bin/kill -l 29
POLL






["only_existing_signals.diff" (only_existing_signals.diff)]

--- kill.c.vda	2007-04-29 22:27:04.273270128 +0200
+++ kill.c	2007-04-29 22:45:23.969090952 +0200
@@ -52,5 +52,9 @@
 			/* Print the whole signal list */
 			for (signo = 1; signo < 32; signo++) {
-				puts(get_signame(signo));
+				/* Needed to catch numbers without valid signal name. */
+				char *name;
+				name = (char *) get_signame(signo);
+				if (!isdigit(name[0]))
+					puts(name);
 			}
 		} else { /* -l <sig list> */


_______________________________________________
busybox mailing list
busybox@busybox.net
http://busybox.net/cgi-bin/mailman/listinfo/busybox

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic