psig for Linux

Problem

psig is a Solaris proc utility for listing the signal actions and handlers of a process. Anyone who uses Linux would know that there is no equivalent tool in Linux, and getting information related to the process signals’ disposition is not trivial, so I decided to write one using SystemTap.

The version of psig I wrote looks very much like the Solaris’ psig tool but it is not a port. It was written based on the example output of “Comparison of Solaris OS and Linux for Application Developers” article, and it is licensed GPL.

Here is how it looks like when I run the script:

$ psig $$ | egrep ":|^HUP|^SEGV|^BUS"
5981:    bash
HUP      caught   0x0808d040  0  HUP,INT,ILL,TRAP,ABRT,BUS,FPE,USR1,SEGV,USR2,PIPE,
  ALRM,TERM,XCPU,XFSZ,VTALRM,SYS
BUS      caught   0x0808d040  0  HUP,INT,ILL,TRAP,ABRT,BUS,FPE,USR1,SEGV,USR2,PIPE,
  ALRM,TERM,XCPU,XFSZ,VTALRM,SYS
SEGV     caught   0x0808d040  0  HUP,INT,ILL,TRAP,ABRT,BUS,FPE,USR1,SEGV,USR2,PIPE,
  ALRM,TERM,XCPU,XFSZ,VTALRM,SYS

From here, we can tell that the signals SIG{HUP,BUS,SEGV} have the same signal handler at address 0x0808d040. The output may look daunting but it is actually easy to understand.

Let’s look closer at the SIGHUP signal:

HUP      caught   0x0808d040  0  HUP,INT,ILL,TRAP,ABRT,BUS,...

From here, we can see that:

So if you are interested, you can download and install the latest version of SystemTap, download psig.sh, patch the tapset/signal.stp script, and you are all set to play with psig. I will be submitting my signal tapset changes to the upstream, and hopefully it will be accepted.

psig.sh signal.stp-psig.patch signal.stp signal.stp.default


WarStories

None: WSPsig (last edited 2008-01-20 04:27:11 by EugeneTeo)