Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 14 May 1999 13:36:41 -0400 (EDT)
From:      Luoqi Chen <luoqi@watermarkgroup.com>
To:        fullermd@futuresouth.com, sheldonh@uunet.co.za
Cc:        current@FreeBSD.ORG, gmarco@scotty.masternet.it
Subject:   Re:  Panic with screen w/info (was Re: Today's kernel crashes on starting X)
Message-ID:  <199905141736.NAA06376@lor.watermarkgroup.com>

next in thread | raw e-mail | index | archive | help
> It seems that screen was trying to flush the master pty, before the slave
> tty was even open. We were lucky that this didn't crash our machines before
> the dev_t changes, it only caused the console to be flushed instead. But
> after the dev_t changes, it is fatal. Try this fix (band-aid only, better
> fix should involve checking of TS_OPEN bit),
> 
Here's the better fix, please let me know if it works,

Index: tty_pty.c
===================================================================
RCS file: /home/ncvs/src/sys/kern/tty_pty.c,v
retrieving revision 1.57
diff -u -r1.57 tty_pty.c
--- tty_pty.c	1999/05/08 06:39:43	1.57
+++ tty_pty.c	1999/05/14 17:32:33
@@ -674,8 +674,7 @@
 			tp->t_lflag &= ~EXTPROC;
 		}
 		return(0);
-	} else
-	if (devsw(dev)->d_open == ptcopen)
+	} else if (devsw(dev)->d_open == ptcopen) {
 		switch (cmd) {
 
 		case TIOCGPGRP:
@@ -711,7 +710,16 @@
 				pti->pt_flags &= ~PF_REMOTE;
 			ttyflush(tp, FREAD|FWRITE);
 			return (0);
+		}
+
+		/*
+		 * The rest of the ioctls shouldn't be called until 
+		 * the slave is open. (Should we return an error?)
+		 */
+		if ((tp->t_state & TS_ISOPEN) == 0)
+			return (0);
 
+		switch (cmd) {
 #ifdef COMPAT_43
 		case TIOCSETP:
 		case TIOCSETN:
@@ -735,6 +743,7 @@
 				ttyinfo(tp);
 			return(0);
 		}
+	}
 	error = (*linesw[tp->t_line].l_ioctl)(tp, cmd, data, flag, p);
 	if (error == ENOIOCTL)
 		 error = ttioctl(tp, cmd, data, flag);

-lq


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199905141736.NAA06376>