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
Signal handlers usually execute on the current stack of the process. This lets the signal handler return to the point that execution was interrupted in the process. This can be changed on a per-signal basis so that a signal handler executes on a special stack.
Inside the main() function, the signal() function is used to register a handler (sig_handler()) for SIGINT signal. The while loop simulates an infinite delay. So, the program waits for SIGNIT signal infinitely. The signal handler 'sig_handler' prints a debug statement by checking if the desired signal is SIGINT or not.
Under Linux, you can find the PID of your process, then look at /proc/$PID/status . It contains lines describing which signals are blocked (SigBlk), ignored (SigIgn), or caught (SigCgt).
All threads in a process share the set of signal handlers set up by sigaction(2) and its variants. A thread in one process cannot send a signal to a specific thread in another process.
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
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)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With