4.2 C Shell does *not* kill stopped jobs on logout.

Rick Lindsley richl at daemon.UUCP
Mon Apr 1 05:31:11 AEST 1985


Let's try to disseminate the correct information. The kernel does not
indiscriminately kill orphan processes. The process only receives a SIGKILL
when a) it is a child of init, and b) when it receives a "keyboard generated"
stop signal (SIGTTOU, SIGTTIN, SIGTSTP). It can be made a child of init by
orphaning it, true, but the given example

	% (date&)&

only fails if the user has tostop set to prevent terminal writes. In that
case it will receive a SIGTTOU as an orphan and be killed. Otherwise it
works fine.

Upon logout, all processes in the terminal process group will receive a
SIGCONT and a SIGHUP. If you are using csh, the only process in the
terminal process group will likely be the csh itself, because csh manipulates
process groups. However, if you had ^Z'ed (SIGTSTP) any processes, then
when you log out they become orphans and are thus SIGKILLed. If a process
is running and its output will not cause a SIGTTOU (because it either
produces none or the output has been redirected into a file) then it will
continue running, untouched. If it were stopped with a SIGSTOP (not a
keyboard generated stop), it will remain stopped.

I might add that this is contrary to the information in tty(4), which states
that orphans are allowed to write to a terminal without fear of a SIGTTOU,
but that is a different story for a different time.

Rick Lindsley
...{allegra,decvax,ihnp4}!tektronix!richl



More information about the Comp.unix.wizards mailing list