Ticket #9046: 0001-Fix-mapping-between-signal-number-and-signal-string.patch

File 0001-Fix-mapping-between-signal-number-and-signal-string.patch, 3.2 KB (added by Prasad, 7 years ago)
  • src/bin/bash/signames_haiku.h

    From 62d2a68d91896e22426c9e547691fa0c371497da Mon Sep 17 00:00:00 2001
    From: Prasad Joshi <prasadjoshi.linux@gmail.com>
    Date: Sun, 7 Oct 2012 11:46:16 +0530
    Subject: [PATCH] Fix mapping between signal number and signal string
    
    Signals are mapped to the string so that userland utilities can use
    easy and verbose strings for sending the signals. However, the current
    mapping is not correct.
    
    For example: Running command kill -l shows
    > kill -l
     1) SIGHUP	 2) SIGINT	 3) SIGQUIT	 4) SIGILL	 5) SIGCHLD
     6) SIGABRT	 7) SIGPIPE	 8) SIGFPE	 9) SIGKILL	10) SIGSTOP
    11) SIGSEGV	12) SIGCONT	13) SIGTSTP	14) SIGALRM	15) SIGTERM
    16) SIGTTIN	17) SIGTTOU	18) SIGUSR1	19) SIGUSR2	20) SIGWINCH
    21) SIGKILLTHR	22) SIGTRAP	23) SIGPOLL	24) SIGPROF	25) SIGSYS
    26) SIGURG	27) SIGVTALRM	28) SIGXCPU	29) SIGXFSZ	30) DEBUG
    31) ERR	32) RETURN	33) invalid signal number
    		34) invalid signal number 35) invalid signal number
    36) invalid signal number 37) invalid signal number
    		38) invalid signal number 39) invalid signal number
    
    ...
    ...
    61) invalid signal number 62) invalid signal number
    	63) invalid signal number 64) invalid signal number
    
    As can be seen from the above output many of the signals are missing
    from the list, for example, SIGBUS (30)
    
    Using SIGBUS with kill shows an error
    > kill -SIGBUS <pid>
    bash: kill: SIGBUS invalid signal specification
    
    However,
    > kill -30 <pid>
    sends SIGBUS to the process.
    
    The patch uses the mapping generated from mksignames program when ran
    on a Haiku machine.
    
    After applying the patch, kill -l shows the correct list of signals
    supported on Haiku
    > kill -l
     1) SIGHUP	 2) SIGINT	 3) SIGQUIT	 4) SIGILL	 5) SIGCHLD
     6) SIGABRT	 7) SIGPIPE	 8) SIGFPE	 9) SIGKILL	10) SIGSTOP
    11) SIGSEGV	12) SIGCONT	13) SIGTSTP	14) SIGALRM	15) SIGTERM
    16) SIGTTIN	17) SIGTTOU	18) SIGUSR1	19) SIGUSR2	20) SIGWINCH
    21) SIGKILLTHR	22) SIGTRAP	23) SIGPOLL	24) SIGPROF	25) SIGSYS
    26) SIGURG	27) SIGVTALRM	28) SIGXCPU	29) SIGXFSZ	30) SIGBUS
    33) SIGRTMIN	34) SIGRTMIN+1	35) SIGRTMIN+2	36) SIGRTMIN+3	37) SIGRTMAX-3
    38) SIGRTMAX-2	39) SIGRTMAX-1	40) SIGRTMAX
    
    The patch fixes the BUG: https://dev.haiku-os.org/ticket/9046
    ---
     src/bin/bash/signames_haiku.h |   35 +++++++++++++++++++++++++++++++++++
     1 files changed, 35 insertions(+), 0 deletions(-)
    
    diff --git a/src/bin/bash/signames_haiku.h b/src/bin/bash/signames_haiku.h
    index 8125c7a..784b80a 100644
    a b char *signal_names[NSIG + 4] = {  
    3333    "SIGVTALRM",
    3434    "SIGXCPU",
    3535    "SIGXFSZ",
     36    "SIGBUS",
     37    "SIGJUNK(31)",
     38    "SIGJUNK(32)",
     39    "SIGRTMIN",
     40    "SIGRTMIN+1",
     41    "SIGRTMIN+2",
     42    "SIGRTMIN+3",
     43    "SIGRTMAX-3",
     44    "SIGRTMAX-2",
     45    "SIGRTMAX-1",
     46    "SIGRTMAX",
     47    "SIGJUNK(41)",
     48    "SIGJUNK(42)",
     49    "SIGJUNK(43)",
     50    "SIGJUNK(44)",
     51    "SIGJUNK(45)",
     52    "SIGJUNK(46)",
     53    "SIGJUNK(47)",
     54    "SIGJUNK(48)",
     55    "SIGJUNK(49)",
     56    "SIGJUNK(50)",
     57    "SIGJUNK(51)",
     58    "SIGJUNK(52)",
     59    "SIGJUNK(53)",
     60    "SIGJUNK(54)",
     61    "SIGJUNK(55)",
     62    "SIGJUNK(56)",
     63    "SIGJUNK(57)",
     64    "SIGJUNK(58)",
     65    "SIGJUNK(59)",
     66    "SIGJUNK(60)",
     67    "SIGJUNK(61)",
     68    "SIGJUNK(62)",
     69    "SIGJUNK(63)",
     70    "SIGJUNK(64)",
    3671    "DEBUG",
    3772    "ERR",
    3873    "RETURN",