I am testing ptrace and signals.
The problem is that when I am forwarding a signal with sigaction and then senting the interrupt signal to the process via kill(pid, SIGKILL)
and after the ptrace(PTRACE_SYSCALL, pid, NULL, tracee_signal)
the process is printed as zombie at the output of ps aux
.
Only when I quit the "master" process, then the zombie process has its return status collected by wait (at the end of the "master" process") so it stops being a zombie.
When I receive a signal the signal handler is called and the value of the signal is assigned to a global variable declared as volatile sig_atomic_t gotsig
(Rockkind).
So at the main loop of the tracer I check that global variable for a value >0
and then I kill(pid, gotsig);
.
After that there is this ptrace(PTRACE_SYSCALL, pid, NULL, tracee_signal)
.
And then the process becomes zombie.
Why does that happen? Is that proper behaviour?
Addition:
Could it be because we have to explicitly wait the child after the latest ptrace call? So as to reap its exit status?