Bug (?) in tty

utzoo!decvax!ucbvax!unix-wizards utzoo!decvax!ucbvax!unix-wizards
Fri Aug 14 14:38:23 AEST 1981


>From Greg at NPRDC Fri Aug 14 14:35:53 1981
I have encountered the same problem.  My fix was to check the ISOPEN bit
in the tty struct to see if it was busy, but to permit a child of init
to force ownership.  If there is a prior claim, it tries to do away with
it.  The code from tty$ttyopen is reproduced below.  Zapping the tty struct
in exit may not be sufficient if there are background jobs still running.

	pp = u.u_procp;
	tp = atp;
	if(pp->p_pgrp == 0) {
		pp->p_pgrp = pp->p_pid;
		u.u_ttyp = tp;
		u.u_ttyd = dev;
		if((tp->t_state&ISOPEN) == 0  ||  pp->p_ppid == 1) {
			if(tp->t_pgrp) {
				signal(tp->t_pgrp, SIGHUP);
				flushtty(tp);
			}
			tp->t_pgrp = pp->p_pid;
			tp->t_col = -1;
		}
	}
	tp->t_state =& ~WOPEN;
	tp->t_state =| ISOPEN;




More information about the Comp.unix.wizards mailing list