svn commit: r196036 - head/sys/kern
Ed Schouten
ed at FreeBSD.org
Sun Aug 2 14:25:27 UTC 2009
Author: ed
Date: Sun Aug 2 14:25:26 2009
New Revision: 196036
URL: http://svn.freebsd.org/changeset/base/196036
Log:
Fix two bugs related to TTY input:
- fix write() on pseudo-terminal masters to return the amount of bytes
passed to the TTY, not the amount of bytes read from user.
- fix ttydisc_rint_bypass() to set the high watermark when it cannot
write all input, just like ttydisc_rint() itself.
Approved by: re (kib)
Modified:
head/sys/kern/tty_pts.c
head/sys/kern/tty_ttydisc.c
Modified: head/sys/kern/tty_pts.c
==============================================================================
--- head/sys/kern/tty_pts.c Sun Aug 2 13:37:00 2009 (r196035)
+++ head/sys/kern/tty_pts.c Sun Aug 2 14:25:26 2009 (r196036)
@@ -204,8 +204,10 @@ ptsdev_write(struct file *fp, struct uio
error = uiomove(ib, iblen, uio);
tty_lock(tp);
- if (error != 0)
+ if (error != 0) {
+ iblen = 0;
goto done;
+ }
/*
* When possible, avoid the slow path. rint_bypass()
@@ -260,6 +262,12 @@ ptsdev_write(struct file *fp, struct uio
done: ttydisc_rint_done(tp);
tty_unlock(tp);
+
+ /*
+ * Don't account for the part of the buffer that we couldn't
+ * pass to the TTY.
+ */
+ uio->uio_resid += iblen;
return (error);
}
Modified: head/sys/kern/tty_ttydisc.c
==============================================================================
--- head/sys/kern/tty_ttydisc.c Sun Aug 2 13:37:00 2009 (r196035)
+++ head/sys/kern/tty_ttydisc.c Sun Aug 2 14:25:26 2009 (r196036)
@@ -1060,6 +1060,8 @@ ttydisc_rint_bypass(struct tty *tp, cons
ret = ttyinq_write(&tp->t_inq, buf, len, 0);
ttyinq_canonicalize(&tp->t_inq);
+ if (ret < len)
+ tty_hiwat_in_block(tp);
return (ret);
}
More information about the svn-src-head
mailing list