[J. Noel Chiappa <JNC>: Bug (?) in tty]

utzoo!decvax!ucbvax!unix-wizards utzoo!decvax!ucbvax!unix-wizards
Fri Aug 14 09:41:28 AEST 1981


>From JNC at MIT-XX Fri Aug 14 09:10:13 1981
	This was garbaged in transit; here it is again.
                ---------------
Date: 13 Aug 1981 1932-EDT
From: J. Noel Chiappa <JNC>
Subject: Bug (?) in tty$ttyopen
To: unix-wizards at SRI-UNIX
cc: JNC

	This is only sort of a bug, but here goes (I'm running a 
hevily modified V6.5 UNIX that some of you out there now of; the
MIT one); this is for information and comments both. In tty$ttyopen
there's some code of the form:

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

which assigns the terminal to that process (and all its children)
if it didn't already have any TTY. This worked fine until one day
we put into service an on-line backup daemon that did (essentially)
a 'blast' (or 'wall' or whatever YOUR version is called) to tell people
to mount the right volume so that it could do the backup. Great. The
first time it was started from /etc/rc as an installed daemon, when
it sent out its first message all the terminals on the system no
longer sent interrupts to their process trees . We deinstalled the
daemon, and it wasn't until just recently that I found the cause:
that innocent looking code in tty$ttyopen. Since the daemon was
started from /etc/rc, it had no associated terminal; thus, when it
started opening terminals it smashed all the old t_pgrp assignments.

	My planned fix is to add the following code in sys1$exit:

if (p->p_pid == p->p_pgrp)
	u.u_ttyp->t_pgrp = 0;

and change the code in tty$ttyopen to be:

if ((p->p_pgrp == 0) && (tp->t_pgrp == 0)) {

which will deassign the TTY in question when the process group leader
croaks and will only assign the tty to a process without a pgrp if the
TTY doesn't already have an owner. Comments?
-------
                ---------------
-------




More information about the Comp.unix.wizards mailing list