Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!rutgers!ames!oliveb!tymix!feldman From: feldman@tymix.UUCP (Steve Feldman) Newsgroups: comp.bugs.4bsd Subject: TANDEM mode bugs in 4.3bsd Message-ID: <973@tymix.UUCP> Date: Thu, 8-Jan-87 14:35:06 EST Article-I.D.: tymix.973 Posted: Thu Jan 8 14:35:06 1987 Date-Received: Fri, 9-Jan-87 01:36:45 EST Reply-To: feldman@tymix.UUCP (Steve Feldman) Distribution: world Organization: Tymnet NTD, Cupertino CA Lines: 59 Index: sys/sys/tty.c 4.3BSD +FIX Description: There are two problems in the TANDEM mode handling in the 4.3 bsd tty driver. (They were in 4.2 as well.) First, if you have a device which is slow responding to a control-S, the driver can send additional control-S's when the last few characters arrive. Second, there is a deadlock condition possible if the tty is in cooked mode. If input is stopped with more than TTYHOG/5 characters left in the rawq, input can't ever be started again since the application won't see those characters. Repeat-By: Send lots of data to a slow system in cooked mode. Fix: Apply the following patch to /sys/sys/tty.c: (your line numbers will vary.) *** tty.c.old Thu Jan 8 11:09:58 1987 --- tty.c Mon Jan 5 17:33:13 1987 *************** *** 191,197 **** * Current input > threshold AND input is available to user program */ if (x >= TTYHOG/2 && ! ((tp->t_flags & (RAW|CBREAK)) || (tp->t_canq.c_cc > 0))) { if (putc(tp->t_stopc, &tp->t_outq)==0) { tp->t_state |= TS_TBLOCK; ttstart(tp); --- 191,198 ---- * Current input > threshold AND input is available to user program */ if (x >= TTYHOG/2 && ! ((tp->t_flags & (RAW|CBREAK)) || (tp->t_canq.c_cc > 0)) && ! (tp->t_state&TS_TBLOCK) == 0) { if (putc(tp->t_stopc, &tp->t_outq)==0) { tp->t_state |= TS_TBLOCK; ttstart(tp); *************** *** 1245,1251 **** * Look to unblock output now that (presumably) * the input queue has gone down. */ ! if (tp->t_state&TS_TBLOCK && tp->t_rawq.c_cc < TTYHOG/5) if (putc(tp->t_startc, &tp->t_outq) == 0) { tp->t_state &= ~TS_TBLOCK; ttstart(tp); --- 1246,1254 ---- * Look to unblock output now that (presumably) * the input queue has gone down. */ ! if (tp->t_state&TS_TBLOCK && ! (tp->t_rawq.c_cc+tp->t_canq.c_cc < TTYHOG/5 || ! (t_flags&(RAW|CBREAK)) == 0 && tp->t_canq.c_cc == 0)) if (putc(tp->t_startc, &tp->t_outq) == 0) { tp->t_state &= ~TS_TBLOCK; ttstart(tp);