RFC: better signal names?

Denys Vlasenko dvlasenk at redhat.com
Thu Mar 15 15:13:18 UTC 2012


Currently we emit something like this:

--- {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=19483, si_status=0, si_utime=0, si_stime=0} (Child exited) ---
--- {si_signo=SIGWINCH, si_code=SI_USER, si_pid=15407, si_uid=0} (Window changed) ---
--- {si_signo=SIGSTOP, si_code=SI_USER, si_pid=15407, si_uid=0} (Stopped (signal)) ---
--- Stopped (signal) by SIGSTOP ---
--- {si_signo=SIGTSTP, si_code=SI_USER, si_pid=15407, si_uid=0} (Stopped) ---
--- Stopped by SIGTSTP ---
--- {si_signo=SIGTTIN, si_code=SI_USER, si_pid=15407, si_uid=0} (Stopped (tty input)) ---
--- Stopped (tty input) by SIGTTIN ---

The part where we try to emit a "descriptive" signal string
does not look like succeeding in this regard: it's often
barely comprehensible, and sometimes plainly wrong.

Such as: SIGSTOP is shown as "Stopped (signal)".
Gosh. OF COURSE it is stopped by signal, there are no other
methods to stop processes in Unix but signal.
Showing "Stopped" and "Stopped (signal)" does not tell
the real difference (stopped by different signals)
but instead alludes that "Stopped" w/o "(signal)" did not
use a signal to stop. Wrong.

SIGCHLD is "Child exited". But SIGCHLD can be sent when child
is *stopped*, not exited! It is lying.

Good news is that it's not our fault. We just use strsignal(sig)
hoping that its returned string is good. Well, it is not (IMO).

I propose that we stop using strsignal() and just use short
SIGfoo names instead. The above examples will look like this:

--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=19483, si_status=0, si_utime=0, si_stime=0} ---
--- SIGWINCH {si_signo=SIGWINCH, si_code=SI_USER, si_pid=15407, si_uid=0} ---
--- SIGSTOP {si_signo=SIGSTOP, si_code=SI_USER, si_pid=15407, si_uid=0} ---
--- stopped by SIGSTOP ---
--- SIGTSTP {si_signo=SIGTSTP, si_code=SI_USER, si_pid=15407, si_uid=0} ---
--- stopped by SIGTSTP ---
--- SIGTTIN {si_signo=SIGTTIN, si_code=SI_USER, si_pid=15407, si_uid=0} ---
--- stopped by SIGTTIN ---

I am confident users of strace are knowledgeable enough to understand
(or be able to find out) what each SIGfoo means.

As a bonus, we can get rid of #ifndef HAVE_STRSIGNAL code block
where we reimplement strsignal for systems which don't have it.

-- 
vda




More information about the Strace-devel mailing list