diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 1997-11-13 03:56:56 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 1997-11-13 03:56:56 +0000 |
commit | dd23b68005df91269d7997a47d250602d06cd57a (patch) | |
tree | 29fc5437d03d7d07ec7f3118fcd9714db26d1de5 /sys/kern | |
parent | 8ca244c36666cd1c5ec7c18ec008a0546ed93c6d (diff) |
in ttywait(), double check if we need to sleep before sleeping
Diffstat (limited to 'sys/kern')
-rw-r--r-- | sys/kern/tty.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/sys/kern/tty.c b/sys/kern/tty.c index 9fc8057b4dc..d40ee80f0d5 100644 --- a/sys/kern/tty.c +++ b/sys/kern/tty.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tty.c,v 1.31 1997/11/06 05:58:21 csapuntz Exp $ */ +/* $OpenBSD: tty.c,v 1.32 1997/11/13 03:56:55 deraadt Exp $ */ /* $NetBSD: tty.c,v 1.68.4.2 1996/06/06 16:04:52 thorpej Exp $ */ /*- @@ -1082,9 +1082,14 @@ ttywait(tp) (ISSET(tp->t_state, TS_CARR_ON) || ISSET(tp->t_cflag, CLOCAL)) && tp->t_oproc) { (*tp->t_oproc)(tp); - SET(tp->t_state, TS_ASLEEP); - error = ttysleep(tp, &tp->t_outq, TTOPRI | PCATCH, ttyout, 0); - if (error) + if ((tp->t_outq.c_cc || ISSET(tp->t_state, TS_BUSY)) && + (ISSET(tp->t_state, TS_CARR_ON) || ISSET(tp->t_cflag, CLOCAL)) + && tp->t_oproc) { + SET(tp->t_state, TS_ASLEEP); + error = ttysleep(tp, &tp->t_outq, TTOPRI | PCATCH, ttyout, 0); + if (error) + break; + } else break; } splx(s); |