Results 1 to 4 of 4
Need to kill child process, if parent dies on SIGTERM, SIGINT or SIGSEGV.
Read MAN, default action to these signals are abnormal termination.
Created signal handler for these signals, send ...
- 09-23-2011 #1
Is abort() enough to handle SIGTERM, SIGINT, SIGSEGV?
Need to kill child process, if parent dies on SIGTERM, SIGINT or SIGSEGV.
Read MAN, default action to these signals are abnormal termination.
Created signal handler for these signals, send kill(child, SIGTERM) before abort().
Works as expected, just not sure if doing it this way covers all the termination actions default dispositions of those signals do.
I will need to restart the parent and repeat thousands time without reboot the system. Needs system stability.
exit() vs abort() could make some difference,
http://stackoverflow.com/questions/3...exit-and-abort
Please comment,
Last edited by legendbb; 09-23-2011 at 09:13 PM. Reason: added more thoughts
- 09-25-2011 #2Linux Guru
- Join Date
- Apr 2009
- Location
- I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
- Posts
- 8,974
When you kill a parent process, no matter how, its attached children will also be terminated - no special handling required. Under other circumstances, if a child dies and the parent doesn't execute a wait() then the child will be a zombie until the parent terminates.
Sometimes, real fast is almost as good as real time.
Just remember, Semper Gumbi - always be flexible!
- 09-25-2011 #3Just Joined!
- Join Date
- Aug 2011
- Posts
- 48
If you did something like:
xterm &
and then kill the old xterm, the xterm that you just started which would the a child of the first xterm and it doesn't go away. What happens in that case is the PPID of the xterm becomes 1 (init). So, if the parent goes away the child doesn't exit.
- 09-25-2011 #4Linux Guru
- Join Date
- Apr 2009
- Location
- I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
- Posts
- 8,974
Processes can detach themselves from their parent process. This is how daemons work. Other applications, such as xterm do the same. My previous comment was for the general case, where the child process does not run as a detached process.
Sometimes, real fast is almost as good as real time.
Just remember, Semper Gumbi - always be flexible!


Reply With Quote