new blag post: A Lesser-Known Feature of kill(1)
authorRoland Hieber <rohieb@rohieb.name>
Fri, 8 Nov 2013 23:14:00 +0000 (00:14 +0100)
committerRoland Hieber <rohieb@rohieb.name>
Fri, 8 Nov 2013 23:14:00 +0000 (00:14 +0100)
blag/post/a-lesser-known-feature-of-kill-1-.mdwn [new file with mode: 0644]

diff --git a/blag/post/a-lesser-known-feature-of-kill-1-.mdwn b/blag/post/a-lesser-known-feature-of-kill-1-.mdwn
new file mode 100644 (file)
index 0000000..4c0c149
--- /dev/null
@@ -0,0 +1,54 @@
+[[!meta title="A Lesser-Known Feature of kill(1)"]]
+[[!meta author="rohieb"]]
+[[!meta license="CC-BY-SA 3.0"]]
+
+## Problem ##
+I was debugging a program, which suddenly died with
+
+    QFATAL : TestEdge::testSaveRemove() Received signal 11
+
+For better understanding of the problem, it would be nice to know what
+the meaning of “signal 11” is.
+
+
+## Solution ##
+I was not so fluent in signal numbers (maybe I should take [a
+course][memrise]). Of course, I _could_ dig in the [`signal(7)` man
+page][mansignal], or in the respective C header (`signal.h`). However,
+while digging in the manpages, I noticed that `kill(1)` does not only
+kill processes, but also does exactly what I want.[^1] Citing from the
+[man page][mankill]:
+
+    -l, --list [signal]
+      List  signal  names.   This  option has optional argument, which
+      will convert signal number to signal name, or other way round.
+
+[^1]: At least the version in Debian, which is from
+    [procps](https://gitorious.org/procps)
+
+So I could just say:
+
+    $ kill -l 11
+    SEGV
+
+Ah, segmentation fault. Nice to know :-)
+
+In addition, the man page also mentions a useful parameter `-L`, which
+prints a nice table of signal numbers and mnemonics:
+
+    $ /bin/kill -L
+     1 HUP      2 INT      3 QUIT     4 ILL      5 TRAP     6 ABRT  7 BUS
+     8 FPE      9 KILL    10 USR1    11 SEGV    12 USR2    13 PIPE 14 ALRM
+    15 TERM    16 STKFLT  17 CHLD    18 CONT    19 STOP    20 TSTP 21 TTIN
+    22 TTOU    23 URG     24 XCPU    25 XFSZ    26 VTALRM  27 PROF 28 WINCH
+    29 POLL    30 PWR     31 SYS
+
+(Also, the man page also warns about `kill` probably being a shell
+built-in. At least the Bash and zsh built-ins also know `-l`, but not
+`-L`, so you have to call `/bin/kill` explicitly.)
+
+[memrise]: http://www.memrise.com/course/158486/unix-signals/
+[mansignal]: http://manpages.debian.net/cgi-bin/man.cgi?query=signal&apropos=0&sektion=7&manpath=Debian+7.0+wheezy&format=html&locale=en
+[mankill]: http://manpages.debian.net/cgi-bin/man.cgi?query=kill&apropos=0&sektion=0&manpath=Debian+7.0+wheezy&format=html&locale=en
+
+[[!tag UNIX Linux Debian UNIX_signal_numbers signal.h SIGSEGV kill]]
This page took 0.027356 seconds and 4 git commands to generate.