Its a bit more subtle than that [at least in user space, kernel launched processes are probably at least as complex if not more so].

In order not to be killed by your parent dying, you need to do several things, other than just ignore SIGHUP.

In theory [from my working in this area 10 years ago now] you are supposed to become a process group leader - this is normally done in the child side of the fork() process.

You can become a process group leader by various arcane means, one common way is I recall using is by closing all open file descriptors you have open (including stdin,stdout,stderr), then ignoring SIGHUP, and then you call setpgrp() I think, then you (re)open a new controlling tty, then do the execve or whatever you are going to do.

The closing and opening of the stdin/err/out etc breaks the connection between the parent process'es process group leader (probably the kernel or init or something) and the forked child process.

The child process then becomes its own process group leader and will not die if the parent dies [all of this is what the nohup command does].


so, I'm no linux expert on this, but this may jog a few memories amoungst some others and get on the right track.