summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorbde <bde@FreeBSD.org>1994-11-26 18:54:25 +0000
committerbde <bde@FreeBSD.org>1994-11-26 18:54:25 +0000
commitc879ab57fdf04799367f95d66a66ccbbd32c1d08 (patch)
tree0f4105be4842c12379d690eb8b971ee2d4e2230e /sys
parentb15a8bf05a943cb8004969a2df8375b1d21fea4f (diff)
downloadFreeBSD-src-c879ab57fdf04799367f95d66a66ccbbd32c1d08.zip
FreeBSD-src-c879ab57fdf04799367f95d66a66ccbbd32c1d08.tar.gz
Don't block for output in non-blocking mode if clists run out.
Remove an unnecessary test (if the output queue is above high water then it is nonempty).
Diffstat (limited to 'sys')
-rw-r--r--sys/kern/tty.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/sys/kern/tty.c b/sys/kern/tty.c
index c9c29f7..dca12f9 100644
--- a/sys/kern/tty.c
+++ b/sys/kern/tty.c
@@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)tty.c 8.8 (Berkeley) 1/21/94
- * $Id: tty.c,v 1.12 1994/10/23 06:18:13 davidg Exp $
+ * $Id: tty.c,v 1.13 1994/11/01 22:23:29 bde Exp $
*/
#include <sys/param.h>
@@ -1594,6 +1594,10 @@ loop:
if (ttyoutput(*cp, tp) >= 0) {
/* No Clists, wait a bit. */
ttstart(tp);
+ if (flag & IO_NDELAY) {
+ error = EWOULDBLOCK;
+ goto out;
+ }
error = ttysleep(tp, &lbolt,
TTOPRI | PCATCH, ttybuf, 0);
if (error)
@@ -1625,6 +1629,10 @@ loop:
if (i > 0) {
/* No Clists, wait a bit. */
ttstart(tp);
+ if (flag & IO_NDELAY) {
+ error = EWOULDBLOCK;
+ goto out;
+ }
error = ttysleep(tp,
&lbolt, TTOPRI | PCATCH, ttybuf, 0);
if (error)
@@ -1662,10 +1670,8 @@ ovhiwat:
uio->uio_resid += cc;
return (uio->uio_resid == cnt ? EWOULDBLOCK : 0);
}
- if (tp->t_outq.c_cc || ISSET(tp->t_state, TS_BUSY)) {
- SET(tp->t_state, TS_ASLEEP);
- error = ttysleep(tp, &tp->t_outq, TTOPRI | PCATCH, ttyout, 0);
- }
+ SET(tp->t_state, TS_ASLEEP);
+ error = ttysleep(tp, &tp->t_outq, TTOPRI | PCATCH, ttyout, 0);
splx(s);
if (error)
goto out;
OpenPOWER on IntegriCloud