I have a parent process and set of child process associated with it.
If I run system("reboot")
in parent process,
- What signal will be sent to the child process?
- Are we able to handle those signals?
I have a parent process and set of child process associated with it.
If I run system("reboot")
in parent process,
Possibly SIGTERM or SIGKILL, which are sent by init
as the system is rebooted.
Sort of, but not really. You can trap SIGTERM, but SIGKILL is always fatal, and the system is rebooting anyway. Your process is inevitably going to die when that happens.
On a system reboot init sends SIGTERM to all the child process and waits for it to terminate. It again sends SIGTERM after some time if the child did not terminate and finally sends a SIGKILL which cannot be blocked to kill the child.