Why doesn't my process get SIGHUP when its parent dies?

Why doesn't my process get SIGHUP when its parent dies?


Because it's not supposed to.



SIGHUP is a signal that means, by convention, "the terminal line
got hung up". It has nothing to do with parent processes, and is
usually generated by the tty driver (and delivered to the foreground
process group).



However, as part of the session management system, there are exactly two
cases where SIGHUP is sent on the death of a process:






  • When the process that dies is the session leader of a session that is
    attached to a terminal device, SIGHUP is sent to all processes in
    the foreground process group of that terminal device.



  • When the death of a process causes a process group to become orphaned,
    and one or more processes in the orphaned group are stopped, then
    SIGHUP and SIGCONT are sent to all members of the orphaned
    group. (An orphaned process group is one where no process in the group
    has a parent which is part of the same session, but not the same process
    group.)







Home FAQ