TTY problem (final word)

utzoo!decvax!ucbvax!unix-wizards utzoo!decvax!ucbvax!unix-wizards
Thu Aug 20 01:02:49 AEST 1981


>From JNC at MIT-XX Thu Aug 20 00:54:35 1981
	Well, the final word on what to do with this seems to depend on
what you want to have happen to child processes when the top-level process
logs out, and what to do with new processes when there's already a tree
attached to the TTY. There are several semi-orthagonal issues:

1) Should the children can receive a hangup signal?
2) Should they remain attached to the terminal for signals?
3) Should new processes that get created and open the TTY
   become attached to the pgrp?

I guess my answer is no to the first two, which leads to the code I suggested,
but if I answer yes to the third the code in tty$ttyopen becomes:

if (p->pgrp == 0) {
	if (tp->t_pgrp == 0)
		tp->t_pgrp = p->p_pid;
	p->p_pgrp = tp->t_pgrp;
	}

Whether you smash tp->t_pgrp back to zero in sys1$exit depends on your
answer to question 2; if you decide the answer is no you do, but then
you more or less have to answer 3 yes, otherwise gross lossage ensues
with new shells when old processes are still active. You can attempt
to win by smashing tp->t_pgrp to zero in tty$ttyclose, but this
doesn't really win. I count that as useless code. I hope this recitation
isn't too confusing; as far as I can tell it is 'the right thing'.
	To answer question 1 the other way around (which Berkeley
does) you need support to do the right thing, which 4BSD has. Thanks
to Tom Texeira (TJT) for digging out the code fragmemnt above.
				Noel
-------




More information about the Comp.unix.wizards mailing list