summaryrefslogtreecommitdiff
path: root/sys/kern
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2013-01-17 21:24:59 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2013-01-17 21:24:59 +0000
commit451e13e2152f6150f2887728eba210ceeedab951 (patch)
tree09ba61bff937e22ae2f0898c87678cd4c9a5b447 /sys/kern
parenta76146c54b1f994852289ce97b73afa755f9c25a (diff)
Ensure the tty hiwat is less than the size of the ring buffer (since
we do not grow space like clist chains). Clamp it a bit more precisely, ensuring a bit of space for kernel ^T handling and such. It was definately wrong, and we can tune this if required later. ok kettenis
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/tty.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/sys/kern/tty.c b/sys/kern/tty.c
index 906702d0285..45f7283658c 100644
--- a/sys/kern/tty.c
+++ b/sys/kern/tty.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tty.c,v 1.95 2012/04/22 02:26:11 matthew Exp $ */
+/* $OpenBSD: tty.c,v 1.96 2013/01/17 21:24:58 deraadt Exp $ */
/* $NetBSD: tty.c,v 1.68.4.2 1996/06/06 16:04:52 thorpej Exp $ */
/*-
@@ -2066,15 +2066,15 @@ ttspeedtab(int speed, const struct speedtab *table)
void
ttsetwater(struct tty *tp)
{
- int cps, x;
+ int cps, x, omost;
#define CLAMP(x, h, l) ((x) > h ? h : ((x) < l) ? l : (x))
cps = tp->t_ospeed / 10;
tp->t_lowat = x = CLAMP(cps / 2, TTMAXLOWAT, TTMINLOWAT);
x += cps;
- x = CLAMP(x, TTMAXHIWAT, TTMINHIWAT);
- tp->t_hiwat = roundup(x, CBSIZE);
+ omost = MIN(tp->t_outq.c_cn - 200, tp->t_outq.c_cn);
+ tp->t_hiwat = CLAMP(x, omost, 100);
#undef CLAMP
}