diff options
author | Niklas Hallqvist <niklas@cvs.openbsd.org> | 1997-10-21 07:22:14 +0000 |
---|---|---|
committer | Niklas Hallqvist <niklas@cvs.openbsd.org> | 1997-10-21 07:22:14 +0000 |
commit | dc25e691f7356e22329ad5d9738903d81ac73097 (patch) | |
tree | bf1530b3776dda834dd1129df05ca43bc7118ec2 /sys | |
parent | afbce255c9297d835ab6894e8b84f99f0d241e33 (diff) |
When the input queues are flushed on a blocked tty, make sure to unblock
it, if it's currently in a blocked state due to input flow control. This
was typically seen with drivers implementing th t_hwiflow function, and
starting of ppp (line discipline changes flushes the input queue).
Independently discovered and fixed slightly different than NetBSD PR#4227.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/kern/tty.c | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/sys/kern/tty.c b/sys/kern/tty.c index 9fe1894c125..60fbaf88719 100644 --- a/sys/kern/tty.c +++ b/sys/kern/tty.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tty.c,v 1.29 1997/10/06 20:20:04 deraadt Exp $ */ +/* $OpenBSD: tty.c,v 1.30 1997/10/21 07:22:13 niklas Exp $ */ /* $NetBSD: tty.c,v 1.68.4.2 1996/06/06 16:04:52 thorpej Exp $ */ /*- @@ -66,6 +66,7 @@ static int ttnread __P((struct tty *)); static void ttyblock __P((struct tty *)); +void ttyunblock __P((struct tty *)); static void ttyecho __P((int, struct tty *)); static void ttyrubo __P((struct tty *, int)); static int proc_compare __P((struct proc *, struct proc *)); @@ -1121,6 +1122,7 @@ ttyflush(tp, rw) tp->t_rocount = 0; tp->t_rocol = 0; CLR(tp->t_state, TS_LOCAL); + ttyunblock(tp); ttwakeup(tp); } if (rw & FWRITE) { @@ -1498,7 +1500,20 @@ read: * the input queue has gone down. */ s = spltty(); - if (ISSET(tp->t_state, TS_TBLOCK) && tp->t_rawq.c_cc < TTYHOG/5) { + if (tp->t_rawq.c_cc < TTYHOG/5) + ttyunblock(tp); + splx(s); + return (error); +} + +/* Call at spltty */ +void +ttyunblock(tp) + struct tty *tp; +{ + u_char *cc = tp->t_cc; + + if (ISSET(tp->t_state, TS_TBLOCK)) { if (ISSET(tp->t_iflag, IXOFF) && cc[VSTART] != _POSIX_VDISABLE && putc(cc[VSTART], &tp->t_outq) == 0) { @@ -1510,8 +1525,6 @@ read: (*tp->t_hwiflow)(tp, 0) != 0) CLR(tp->t_state, TS_TBLOCK); } - splx(s); - return (error); } /* |