Child can ask kernel to deliver SIGHUP
(or other signal) when parent dies by specifying option PR_SET_PDEATHSIG
in prctl()
syscall like this:
prctl(PR_SET_PDEATHSIG, SIGHUP);
See man 2 prctl
for details.
Edit: This is Linux-only
More Related Contents:
- printf anomaly after “fork()”
- Why does this program print “forked!” 4 times?
- After forking, are global variables shared?
- Are file descriptors shared when fork()ing?
- what the output of this code and why?
- Why do I get two values for this variable when forking?
- Creating child process in C linux [closed]
- Differences between fork and exec
- How to capture Control+D signal?
- stdout thread-safe in C on Linux?
- Why does ENOENT mean “No such file or directory”?
- Are child processes created with fork() automatically killed when the parent is killed?
- Re-opening stdout and stdin file descriptors after closing them
- Turn a simple socket into an SSL socket
- Are there any platforms where using structure copy on an fd_set (for select() or pselect()) causes problems?
- Detecting 64bit compile in C
- What is the difference between using _exit() & exit() in a conventional Linux fork-exec?
- fork() and output
- fork and existing threads?
- How to make parent wait for all child processes to finish?
- Why the address of variable of child process and parent process is same
- Do forked child processes use the same semaphore?
- Difference between “system” and “exec” in Linux?
- Questions about putenv() and setenv()
- In C, what’s the size of stdout buffer?
- get command output in pipe, C for Linux
- fork() and wait() with two child processes
- Duplicated output using printf() and fork() in C
- Just check status process in c
- how to set close-on-exec by default