Suppose I have a process which spawns exactly one child process. Now when the parent process exits for whatever reason (normally or abnormally, by kill, ^C, assert failure or anything else) I want the child process to die. How to do that correctly?
Child can ask kernel to deliver
SIGHUP (or other signal) when parent dies by specifying option
prctl() syscall like this:
man 2 prctl for details.
Edit: This is Linux-only