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
//and then 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. In real program SIGALRM is used, but it is generated not by alarm()
, but with setitimer()
.