detect sender of signal (linux, ptrace)
Posted
by osgx
on Stack Overflow
See other posts from Stack Overflow
or by osgx
Published on 2010-03-29T16:08:36Z
Indexed on
2010/03/29
16:13 UTC
Read the original article
Hit count: 314
Hello
Can I distinguish signal, between delivered directly to a process and delivered via debugger.
Case 1:
$ ./process1
process1 (not ptraced)
set up handler
alarm(5);
....
signal is handled and I can parse handler parameters
Case 2:
$ debugger1 ./process1
process1 (is ptraced by debugger1)
set up handler
alarm(5);
...
signal is catched by debugger1. It resumes process1 with PTRACE_CONT,
signal_number is 4th parameter of PTRACE_CONT.
signal is redelivered to process1
it is handled.
So, how can I detect in signal handler, was it redelivered by debugger or send by system?
OS is Linux, kernel is 2.6.30. Programs are written in plain C.
© Stack Overflow or respective owner