X.M.
X.M.

Reputation: 981

Linux: how to see if a living process has signal handlers set?

There is a process happy running and I wonder if it has set some signal handlers. I recall I have once read something about this somewhere but could not find such information. Is it possible?

Thanks

Upvotes: 13

Views: 8872

Answers (2)

chaosless
chaosless

Reputation: 537

gotta love that - presumably these are actually the signal sets...

cat /proc/self/status | grep -i '^Sig'

SigQ:   0/31404
SigPnd: 0000000000000000
SigBlk: 0000000000000000
SigIgn: 0000000000000803
SigCgt: 0000000180014664

would seem could make a utility to print those out - unless anyone know of one already?

hmmm - time to read some kernel code for procfs

from this excellent article:

http://kernel.org/doc/Documentation/filesystems/proc.txt

SigQ                        number of signals queued/max. number for queue
SigPnd                      bitmap of pending signals for the thread
ShdPnd                      bitmap of shared pending signals for the process
SigBlk                      bitmap of blocked signals
SigIgn                      bitmap of ignored signals
SigCgt                      bitmap of catched signals

Upvotes: 13

Cédric Julien
Cédric Julien

Reputation: 80761

you can detect this while checking the /proc/PID/status file.

The SigCgt mask display the caught signals by your application. (see man 7 signal for sigmask explanations)

Upvotes: 10

Related Questions