In The Linux Programming Interface:
SIGHUP is generated when a process group becomes orphaned.
In an interactive bash process,
$ ( sleep 123 &)
will first forks a subshell, and the subshell then forks to execute sleep 123 &. The subshell exits immediately without waiting sleep 123 to finish because of &. At that time,
is the
sleepprocess orphaned? (I think yes, Figure 34.3)is SIGHUP sent to the
sleepprocess because it becomes orphaned? (I guess it is, by the quote)why doesn't the
sleepprocess terminate because SIGHUP is sent to it? (I am not sure)
Thanks.
I also have similar question when create a daemon process by first forking a child process and then the child process forking a grandchild and exiting immediately. The grandchild becomes orphaned and isn't SIGHUP sent to it, making it terminate?