Sample Header Ad - 728x90

Is SIGHUP sent to this orphaned process, and why doesn't it terminate?

3 votes
1 answer
989 views
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 sleep process orphaned? (I think yes, [Figure 34.3](https://books.google.com/books?id=2SAQAQAAQBAJ&lpg=PA726&ots=qRt089CDsy&dq=In%20Figure%2034-3%2C%20the%20process%20group%20containingthe%20child%20is%20orphaned%20because%20the%20child%20is%20in%20a%20process%20group%20on%20its%20own%20and%20its%20par-ent%20(init)%20is%20in%20a%20different%20session&pg=PA726#v=onepage&q&f=false)) - is SIGHUP sent to the sleep process because it becomes orphaned? (I guess it is, by the quote) - why doesn't the sleep process 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?
Asked by Tim (106440 rep)
Nov 27, 2018, 02:41 AM
Last activity: Nov 27, 2018, 02:27 PM