TANDEM mode bugs in 4.3bsd
Steve Feldman
feldman at tymix.UUCP
Fri Jan 9 05:35:06 AEST 1987
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);
More information about the Comp.bugs.4bsd.ucb-fixes
mailing list