mirror of
https://github.com/freebsd/freebsd-src
synced 2024-09-22 17:54:52 +00:00
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).
This commit is contained in:
parent
5dd2c633c9
commit
ba77d4e47b
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=4824
|
@ -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 @@ ttwrite(tp, uio, flag)
|
|||
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 @@ ttwrite(tp, uio, flag)
|
|||
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 @@ ttwrite(tp, uio, flag)
|
|||
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;
|
||||
|
|
Loading…
Reference in a new issue