Sending SIGSTOP to the child process terminates. FROM

When I call kill(Child_PID, SIGSTOP); from the parent, I expect the child to stop execution and the parent to continue. Is this expected behavior, or should I explicitly declare a SIGSTOP handler in the child? I searched everywhere and could not find this information.

Thanks. Braden

+4
source share
3 answers

POSIX says:

The system must not allow the process to capture SIGKILL and SIGSTOP signals.

So, the child has no option but to stop - if the signal is sent successfully. And you cannot set the SIGSTOP handler in a child (or parent or any other) process.

+2
source

This is the expected behavior. Quoting from the unix man page:

SIGKILL and SIGSTOP signals cannot be caught, blocked, or ignored.

And the BSD man page indicates that:

The signal () function will not be executed, and no action will be taken if one of the following events occurs:

 [EINVAL] The sig argument is not a valid signal number. [EINVAL] An attempt is made to ignore or supply a handler for SIGKILL or SIGSTOP. 

In conclusion, you cannot install a handler for SIGSTOP. And the process will remain paused until it receives SIGCONT .

+2
source

This is the expected behavior.

Use strace your_program to find out what is happening.

+1
source

All Articles