Bug 26695

Summary: change request: killall(1) -l output
Product: Base System Reporter: david <david>
Component: binAssignee: freebsd-bugs (Nobody) <bugs>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: Unspecified   
Hardware: Any   
OS: Any   

Description david 2001-04-19 07:20:02 UTC
My request changes the output of both kill -l and killall -l.  
Maybe, make `killall -ll` do the new output, and leave -l alone?

The current /usr/bin/killall -l outputs:
hup int quit ill trap abrt emt fpe kill bus segv sys pipe alrm term urg
stop tstp cont chld ttin ttou io xcpu xfsz vtalrm prof winch info usr1 usr2

The new way I think is more helpful, since it displays the numbers and actual words. (bash's way)
 1) sighup       2) sigint       3) sigquit      4) sigill 
 5) sigtrap      6) sigabrt      7) sigemt       8) sigfpe 
 9) sigkill     10) sigbus      11) sigsegv     12) sigsys 
13) sigpipe     14) sigalrm     15) sigterm     16) sigurg 
17) sigstop     18) sigtstp     19) sigcont     20) sigchld 
21) sigttin     22) sigttou     23) sigio       24) sigxcpu 
25) sigxfsz     26) sigvtalrm   27) sigprof     28) sigwinch 
29) siginfo     30) sigusr1     31) sigusr2

Fix: 

static void--alSbKFZyTD9oHbDpkdqpPWj8f13xLRwKBHftWASeJuCNxk2P
Content-Type: text/plain; name="file.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="file.diff"

--- killall.c.old       Thu Dec 28 07:14:41 2000
+++ killall.c   Thu Apr 19 02:05:17 2001
@@ -73,18 +73,23 @@
 static void
 printsig(FILE *fp)
 {
-       const char      *const * p;
-       int             cnt;
-       int             offset = 0;
-
-       for (cnt = NSIG, p = sys_signame + 1; --cnt; ++p) {
-               offset += fprintf(fp, "%s ", upper(*p));
-               if (offset >= 75 && cnt > 1) {
-                       offset = 0;
+       int     n, column;
+
+       for (n = 1, column = 0; n < NSIG; n++)
+       {
+               fprintf(fp, "%2d) sig%s%s", n, sys_signame[n],
+                       (n == NSIG -1) ? "" : " ");
+
+               if (++column < 4)
+                       fprintf(fp, "\t");
+               else {
                        fprintf(fp, "\n");
+                       column = 0;
                }
        }
+
        fprintf(fp, "\n");
+
 }
Comment 1 Jilles Tjoelker freebsd_committer freebsd_triage 2010-10-15 22:20:17 UTC
> [Adding signal numbers to kill/killall -l output]

I don't think kill -l should be made not POSIX compliant to allow for
this. killall might be changed, but this may be unlikely too given how
long this PR has been in the system.

-- 
Jilles Tjoelker
Comment 2 Eitan Adler freebsd_committer freebsd_triage 2012-01-21 19:01:19 UTC
State Changed
From-To: open->closed

POSIX does not allow for kill -l to be changed like this (see 
http://pubs.opengroup.org/onlinepubs/007904875/utilities/kill.html ). 
killall should have similar behavior to kill. We can rely on the shell 
command completion to supply the extra info 

Thanks for making FreeBSD better!