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 o
Child can ask kernel to deliver SIGHUP (or other signal) when parent dies by specifying option PR_SET_PDEATHSIG in prctl() syscall like this:
SIGHUP
PR_SET_PDEATHSIG
prctl()
prctl(PR_SET_PDEATHSIG, SIGHUP);
See man 2 prctl for details.
man 2 prctl
Edit: This is Linux-only