Bourne | Ash |  #!  | find | ARG_MAX | Shells | whatshell | portability | permissions | UUOC | ancient | - | ../Various | HOME
"$@" | echo/printf | set -e | test | tty defs | tty chars | $() vs ) | IFS | using siginfo | nanosleep | line charset | locale

Using siginfo(5) on System V related Unix flavours to find the sender of a signal


Originally I needed it on Solaris,

I tried to get it running on AIX 4.3.2 and Linux 2.4 (2.2 actually doesn't report UID/PID); apparently minor modifications sufficed, but I haven't looked thoroughly at it again


Sample output on SunOS 5.5 and AIX 4.3.2


These versions do have at least on flaw, they use libc functions in the handler. As the program is catching all signals anyway, this worked for all my needs that time.

When adding fork() to such a program, pay attention about signals from or due to the child, as well as other possibly frequently occuring signals to the parent: beware of a forkbomb. F.i. I got SIGWAITING on SunOS 5.5, although I was not even using threads...


And yes, I found the buggy causer in my case eventually: a nightly running rsync(1) with euid 0, running amok and signalling everything with SIGHUP...