summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2010-06-28 14:13:37 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2010-06-28 14:13:37 +0000
commitdf4647207f6e0f0893a85469177623af4f68589d (patch)
treec68295fb4d614022365c0395896029d963f4abc3 /sys
parenta315d252b85e1baec7c359b23ab4dcb169ea2b00 (diff)
Allow tty drivers to request larger buffers at attach time using a
max-baud-rate hint. Adjust TTYHOG (the nearly full logic) to this new situation. The larger buffers are required by the very high speed KDDI devices in Japan (CF com, or USB ucom) so those are the only two drivers which currently ask for a larger buffer size. ok yasuoka miod
Diffstat (limited to 'sys')
-rw-r--r--sys/arch/alpha/alpha/promcons.c4
-rw-r--r--sys/arch/alpha/tc/scc.c6
-rw-r--r--sys/arch/aviion/dev/dart.c4
-rw-r--r--sys/arch/hp300/dev/apci.c4
-rw-r--r--sys/arch/hp300/dev/dca.c4
-rw-r--r--sys/arch/hp300/dev/dcm.c4
-rw-r--r--sys/arch/hppa/dev/pdc.c4
-rw-r--r--sys/arch/hppa64/dev/pdc.c4
-rw-r--r--sys/arch/luna88k/dev/siotty.c4
-rw-r--r--sys/arch/mac68k/dev/z8530tty.c4
-rw-r--r--sys/arch/macppc/dev/z8530tty.c4
-rw-r--r--sys/arch/mvme68k/dev/cl.c4
-rw-r--r--sys/arch/mvme68k/dev/dart.c4
-rw-r--r--sys/arch/mvme68k/dev/wl.c4
-rw-r--r--sys/arch/mvme68k/dev/zs.c4
-rw-r--r--sys/arch/mvme88k/dev/cl.c4
-rw-r--r--sys/arch/mvme88k/dev/dart.c4
-rw-r--r--sys/arch/mvme88k/dev/vx.c4
-rw-r--r--sys/arch/mvmeppc/dev/bugtty.c4
-rw-r--r--sys/arch/sh/dev/scif.c4
-rw-r--r--sys/arch/sparc/dev/magma.c4
-rw-r--r--sys/arch/sparc/dev/spif.c4
-rw-r--r--sys/arch/sparc/dev/z8530tty.c4
-rw-r--r--sys/arch/sparc64/dev/pcons.c4
-rw-r--r--sys/arch/sparc64/dev/sab.c4
-rw-r--r--sys/arch/sparc64/dev/sbbc.c4
-rw-r--r--sys/arch/sparc64/dev/vcctty.c4
-rw-r--r--sys/arch/sparc64/dev/vcons.c4
-rw-r--r--sys/arch/sparc64/dev/z8530tty.c4
-rw-r--r--sys/arch/vax/qbus/dhu.c4
-rw-r--r--sys/arch/vax/qbus/dl.c4
-rw-r--r--sys/arch/vax/qbus/dz.c4
-rw-r--r--sys/arch/vax/qbus/qd.c4
-rw-r--r--sys/arch/vax/vax/gencons.c4
-rw-r--r--sys/arch/vax/vxt/qsc.c4
-rw-r--r--sys/dev/ic/com.c4
-rw-r--r--sys/dev/ic/cy.c4
-rw-r--r--sys/dev/ic/z8530tty.c4
-rw-r--r--sys/dev/pci/cz.c4
-rw-r--r--sys/dev/sbus/magma.c4
-rw-r--r--sys/dev/sbus/spif.c4
-rw-r--r--sys/dev/usb/ucom.c4
-rw-r--r--sys/dev/wscons/wsdisplay.c4
-rw-r--r--sys/kern/tty.c23
-rw-r--r--sys/kern/tty_pty.c18
-rw-r--r--sys/sys/tty.h7
46 files changed, 113 insertions, 109 deletions
diff --git a/sys/arch/alpha/alpha/promcons.c b/sys/arch/alpha/alpha/promcons.c
index e2396acbb03..1705e3085dc 100644
--- a/sys/arch/alpha/alpha/promcons.c
+++ b/sys/arch/alpha/alpha/promcons.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: promcons.c,v 1.14 2010/06/26 23:24:43 guenther Exp $ */
+/* $OpenBSD: promcons.c,v 1.15 2010/06/28 14:13:25 deraadt Exp $ */
/* $NetBSD: promcons.c,v 1.5 1996/11/13 22:20:55 cgd Exp $ */
/*
@@ -74,7 +74,7 @@ promopen(dev, flag, mode, p)
s = spltty();
if (prom_tty[unit] == NULL) {
- tp = prom_tty[unit] = ttymalloc();
+ tp = prom_tty[unit] = ttymalloc(0);
} else
tp = prom_tty[unit];
diff --git a/sys/arch/alpha/tc/scc.c b/sys/arch/alpha/tc/scc.c
index 9f63eabbfac..cb2dcd3c0b5 100644
--- a/sys/arch/alpha/tc/scc.c
+++ b/sys/arch/alpha/tc/scc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: scc.c,v 1.27 2010/06/06 11:26:17 miod Exp $ */
+/* $OpenBSD: scc.c,v 1.28 2010/06/28 14:13:26 deraadt Exp $ */
/* $NetBSD: scc.c,v 1.58 2002/03/17 19:40:27 atatat Exp $ */
/*
@@ -326,7 +326,7 @@ sccattach(parent, self, aux)
/* init pseudo DMA structures */
for (cntr = 0; cntr < 2; cntr++) {
pdp->p_addr = (void *)sccaddr;
- tp = sc->scc_tty[cntr] = ttymalloc();
+ tp = sc->scc_tty[cntr] = ttymalloc(0);
pdp->p_arg = (long)tp;
pdp->p_fcn = (void (*)(struct tty*))0;
tp->t_dev = (dev_t)((sc->sc_dv.dv_unit << 1) | cntr);
@@ -461,7 +461,7 @@ sccopen(dev, flag, mode, p)
return (ENXIO);
tp = sc->scc_tty[line];
if (tp == NULL) {
- tp = sc->scc_tty[line] = ttymalloc();
+ tp = sc->scc_tty[line] = ttymalloc(0);
}
tp->t_oproc = sccstart;
tp->t_param = sccparam;
diff --git a/sys/arch/aviion/dev/dart.c b/sys/arch/aviion/dev/dart.c
index fe83d35661e..f2be4e0c7d3 100644
--- a/sys/arch/aviion/dev/dart.c
+++ b/sys/arch/aviion/dev/dart.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dart.c,v 1.9 2010/04/24 18:46:55 miod Exp $ */
+/* $OpenBSD: dart.c,v 1.10 2010/06/28 14:13:27 deraadt Exp $ */
/*
* Mach Operating System
@@ -605,7 +605,7 @@ dartopen(dev_t dev, int flag, int mode, struct proc *p)
if (dart->tty != NULL)
tp = dart->tty;
else
- tp = dart->tty = ttymalloc();
+ tp = dart->tty = ttymalloc(0);
tp->t_oproc = dartstart;
tp->t_param = dartparam;
diff --git a/sys/arch/hp300/dev/apci.c b/sys/arch/hp300/dev/apci.c
index f14822f878d..709af09962a 100644
--- a/sys/arch/hp300/dev/apci.c
+++ b/sys/arch/hp300/dev/apci.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: apci.c,v 1.38 2010/04/12 12:57:51 tedu Exp $ */
+/* $OpenBSD: apci.c,v 1.39 2010/06/28 14:13:27 deraadt Exp $ */
/* $NetBSD: apci.c,v 1.9 2000/11/02 00:35:05 eeh Exp $ */
/*-
@@ -276,7 +276,7 @@ apciopen(dev, flag, mode, p)
s = spltty();
if (sc->sc_tty == NULL) {
- tp = sc->sc_tty = ttymalloc();
+ tp = sc->sc_tty = ttymalloc(0);
} else
tp = sc->sc_tty;
splx(s);
diff --git a/sys/arch/hp300/dev/dca.c b/sys/arch/hp300/dev/dca.c
index 3a5b18d0959..c59e047f311 100644
--- a/sys/arch/hp300/dev/dca.c
+++ b/sys/arch/hp300/dev/dca.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dca.c,v 1.39 2010/04/12 12:57:51 tedu Exp $ */
+/* $OpenBSD: dca.c,v 1.40 2010/06/28 14:13:27 deraadt Exp $ */
/* $NetBSD: dca.c,v 1.35 1997/05/05 20:58:18 thorpej Exp $ */
/*
@@ -308,7 +308,7 @@ dcaopen(dev, flag, mode, p)
s = spltty();
if (sc->sc_tty == NULL) {
- tp = sc->sc_tty = ttymalloc();
+ tp = sc->sc_tty = ttymalloc(0);
} else
tp = sc->sc_tty;
splx(s);
diff --git a/sys/arch/hp300/dev/dcm.c b/sys/arch/hp300/dev/dcm.c
index a344b8cc287..9691f312a2f 100644
--- a/sys/arch/hp300/dev/dcm.c
+++ b/sys/arch/hp300/dev/dcm.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dcm.c,v 1.33 2010/04/12 12:57:51 tedu Exp $ */
+/* $OpenBSD: dcm.c,v 1.34 2010/06/28 14:13:27 deraadt Exp $ */
/* $NetBSD: dcm.c,v 1.41 1997/05/05 20:59:16 thorpej Exp $ */
/*
@@ -453,7 +453,7 @@ dcmopen(dev, flag, mode, p)
s = spltty();
if (sc->sc_tty[port] == NULL) {
- tp = sc->sc_tty[port] = ttymalloc();
+ tp = sc->sc_tty[port] = ttymalloc(0);
} else
tp = sc->sc_tty[port];
splx(s);
diff --git a/sys/arch/hppa/dev/pdc.c b/sys/arch/hppa/dev/pdc.c
index b6457ae787f..5a411fa8d89 100644
--- a/sys/arch/hppa/dev/pdc.c
+++ b/sys/arch/hppa/dev/pdc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pdc.c,v 1.36 2010/04/20 23:27:01 deraadt Exp $ */
+/* $OpenBSD: pdc.c,v 1.37 2010/06/28 14:13:27 deraadt Exp $ */
/*
* Copyright (c) 1998-2003 Michael Shalayeff
@@ -207,7 +207,7 @@ pdcopen(dev, flag, mode, p)
if (sc->sc_tty)
tp = sc->sc_tty;
else {
- tp = sc->sc_tty = ttymalloc();
+ tp = sc->sc_tty = ttymalloc(0);
}
tp->t_oproc = pdcstart;
diff --git a/sys/arch/hppa64/dev/pdc.c b/sys/arch/hppa64/dev/pdc.c
index df735089543..6716b95c027 100644
--- a/sys/arch/hppa64/dev/pdc.c
+++ b/sys/arch/hppa64/dev/pdc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pdc.c,v 1.8 2010/06/26 23:24:43 guenther Exp $ */
+/* $OpenBSD: pdc.c,v 1.9 2010/06/28 14:13:28 deraadt Exp $ */
/*
* Copyright (c) 2005 Michael Shalayeff
@@ -197,7 +197,7 @@ pdcopen(dev, flag, mode, p)
if (sc->sc_tty)
tp = sc->sc_tty;
else {
- tp = sc->sc_tty = ttymalloc();
+ tp = sc->sc_tty = ttymalloc(0);
}
tp->t_oproc = pdcstart;
diff --git a/sys/arch/luna88k/dev/siotty.c b/sys/arch/luna88k/dev/siotty.c
index 695d452704e..34665475dd5 100644
--- a/sys/arch/luna88k/dev/siotty.c
+++ b/sys/arch/luna88k/dev/siotty.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: siotty.c,v 1.12 2010/06/26 23:24:43 guenther Exp $ */
+/* $OpenBSD: siotty.c,v 1.13 2010/06/28 14:13:28 deraadt Exp $ */
/* $NetBSD: siotty.c,v 1.9 2002/03/17 19:40:43 atatat Exp $ */
/*-
@@ -358,7 +358,7 @@ sioopen(dev, flag, mode, p)
if ((sc = siotty_cd.cd_devs[minor(dev)]) == NULL)
return ENXIO;
if ((tp = sc->sc_tty) == NULL) {
- tp = sc->sc_tty = ttymalloc();
+ tp = sc->sc_tty = ttymalloc(0);
}
else if ((tp->t_state & TS_ISOPEN) && (tp->t_state & TS_XCLUDE)
&& suser(p, 0) != 0)
diff --git a/sys/arch/mac68k/dev/z8530tty.c b/sys/arch/mac68k/dev/z8530tty.c
index da3b4e23007..56a6ac66254 100644
--- a/sys/arch/mac68k/dev/z8530tty.c
+++ b/sys/arch/mac68k/dev/z8530tty.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: z8530tty.c,v 1.22 2010/04/12 12:57:52 tedu Exp $ */
+/* $OpenBSD: z8530tty.c,v 1.23 2010/06/28 14:13:28 deraadt Exp $ */
/* $NetBSD: z8530tty.c,v 1.14 1996/12/17 20:42:43 gwr Exp $ */
/*
@@ -245,7 +245,7 @@ zstty_attach(parent, self, aux)
}
printf("\n");
- tp = ttymalloc();
+ tp = ttymalloc(0);
tp->t_dev = dev;
tp->t_oproc = zsstart;
tp->t_param = zsparam;
diff --git a/sys/arch/macppc/dev/z8530tty.c b/sys/arch/macppc/dev/z8530tty.c
index 987e8c412ef..2bbaff08527 100644
--- a/sys/arch/macppc/dev/z8530tty.c
+++ b/sys/arch/macppc/dev/z8530tty.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: z8530tty.c,v 1.12 2010/04/12 12:57:52 tedu Exp $ */
+/* $OpenBSD: z8530tty.c,v 1.13 2010/06/28 14:13:29 deraadt Exp $ */
/* $NetBSD: z8530tty.c,v 1.13 1996/10/16 20:42:14 gwr Exp $ */
/*-
@@ -339,7 +339,7 @@ zstty_attach(struct device *parent, struct device *self, void *aux)
printf("\n");
- tp = ttymalloc();
+ tp = ttymalloc(0);
tp->t_dev = dev;
tp->t_oproc = zsstart;
tp->t_param = zsparam;
diff --git a/sys/arch/mvme68k/dev/cl.c b/sys/arch/mvme68k/dev/cl.c
index a0450e172de..75cabd57771 100644
--- a/sys/arch/mvme68k/dev/cl.c
+++ b/sys/arch/mvme68k/dev/cl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cl.c,v 1.51 2010/04/12 12:57:52 tedu Exp $ */
+/* $OpenBSD: cl.c,v 1.52 2010/06/28 14:13:29 deraadt Exp $ */
/*
* Copyright (c) 1995 Dale Rahn. All rights reserved.
@@ -554,7 +554,7 @@ clopen(dev, flag, mode, p)
if (cl->tty) {
tp = cl->tty;
} else {
- tp = cl->tty = ttymalloc();
+ tp = cl->tty = ttymalloc(0);
}
tp->t_oproc = clstart;
tp->t_param = clparam;
diff --git a/sys/arch/mvme68k/dev/dart.c b/sys/arch/mvme68k/dev/dart.c
index 425a39d2586..9c2abb5a137 100644
--- a/sys/arch/mvme68k/dev/dart.c
+++ b/sys/arch/mvme68k/dev/dart.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dart.c,v 1.6 2010/04/12 12:57:52 tedu Exp $ */
+/* $OpenBSD: dart.c,v 1.7 2010/06/28 14:13:29 deraadt Exp $ */
/*
* Mach Operating System
@@ -620,7 +620,7 @@ dartopen(dev_t dev, int flag, int mode, struct proc *p)
if (dart->tty != NULL)
tp = dart->tty;
else
- tp = dart->tty = ttymalloc();
+ tp = dart->tty = ttymalloc(0);
tp->t_oproc = dartstart;
tp->t_param = dartparam;
diff --git a/sys/arch/mvme68k/dev/wl.c b/sys/arch/mvme68k/dev/wl.c
index 4f5e8303e60..d335f3bc557 100644
--- a/sys/arch/mvme68k/dev/wl.c
+++ b/sys/arch/mvme68k/dev/wl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: wl.c,v 1.22 2010/04/12 12:57:52 tedu Exp $ */
+/* $OpenBSD: wl.c,v 1.23 2010/06/28 14:13:29 deraadt Exp $ */
/*
* Copyright (c) 1995 Dale Rahn. All rights reserved.
@@ -518,7 +518,7 @@ wlopen(dev, flag, mode, p)
if (cl->tty) {
tp = cl->tty;
} else {
- tp = cl->tty = ttymalloc();
+ tp = cl->tty = ttymalloc(0);
}
tp->t_oproc = clstart;
tp->t_param = clparam;
diff --git a/sys/arch/mvme68k/dev/zs.c b/sys/arch/mvme68k/dev/zs.c
index 6896a0462b4..801dbe43a76 100644
--- a/sys/arch/mvme68k/dev/zs.c
+++ b/sys/arch/mvme68k/dev/zs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: zs.c,v 1.32 2010/06/26 23:24:43 guenther Exp $ */
+/* $OpenBSD: zs.c,v 1.33 2010/06/28 14:13:29 deraadt Exp $ */
/*
* Copyright (c) 2000 Steve Murphree, Jr.
@@ -351,7 +351,7 @@ zsopen(dev, flag, mode, p)
zp = &sc->sc_zs[zsside(dev)];
if (zp->tty == NULL) {
- zp->tty = ttymalloc();
+ zp->tty = ttymalloc(0);
zs_ttydef(zp);
if (minor(dev) < NZSLINE)
zs_tty[minor(dev)] = zp->tty;
diff --git a/sys/arch/mvme88k/dev/cl.c b/sys/arch/mvme88k/dev/cl.c
index a759c06ecdd..7cd54e5478a 100644
--- a/sys/arch/mvme88k/dev/cl.c
+++ b/sys/arch/mvme88k/dev/cl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cl.c,v 1.58 2010/04/12 12:57:52 tedu Exp $ */
+/* $OpenBSD: cl.c,v 1.59 2010/06/28 14:13:29 deraadt Exp $ */
/*
* Copyright (c) 1995 Dale Rahn. All rights reserved.
@@ -543,7 +543,7 @@ clopen(dev, flag, mode, p)
if (cl->tty) {
tp = cl->tty;
} else {
- tp = cl->tty = ttymalloc();
+ tp = cl->tty = ttymalloc(0);
}
tp->t_oproc = clstart;
tp->t_param = clparam;
diff --git a/sys/arch/mvme88k/dev/dart.c b/sys/arch/mvme88k/dev/dart.c
index 0ecedf33613..689209f8c73 100644
--- a/sys/arch/mvme88k/dev/dart.c
+++ b/sys/arch/mvme88k/dev/dart.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dart.c,v 1.55 2010/04/12 12:57:52 tedu Exp $ */
+/* $OpenBSD: dart.c,v 1.56 2010/06/28 14:13:29 deraadt Exp $ */
/*
* Mach Operating System
@@ -642,7 +642,7 @@ dartopen(dev_t dev, int flag, int mode, struct proc *p)
if (dart->tty != NULL)
tp = dart->tty;
else
- tp = dart->tty = ttymalloc();
+ tp = dart->tty = ttymalloc(0);
tp->t_oproc = dartstart;
tp->t_param = dartparam;
diff --git a/sys/arch/mvme88k/dev/vx.c b/sys/arch/mvme88k/dev/vx.c
index 5ff188bc045..6a8f1dc5abf 100644
--- a/sys/arch/mvme88k/dev/vx.c
+++ b/sys/arch/mvme88k/dev/vx.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vx.c,v 1.41 2010/04/12 12:57:52 tedu Exp $ */
+/* $OpenBSD: vx.c,v 1.42 2010/06/28 14:13:29 deraadt Exp $ */
/*
* Copyright (c) 1999 Steve Murphree, Jr.
* All rights reserved.
@@ -415,7 +415,7 @@ vxopen(dev_t dev, int flag, int mode, struct proc *p)
if (vxt->tty) {
tp = vxt->tty;
} else {
- tp = vxt->tty = ttymalloc();
+ tp = vxt->tty = ttymalloc(0);
}
/* set line status */
diff --git a/sys/arch/mvmeppc/dev/bugtty.c b/sys/arch/mvmeppc/dev/bugtty.c
index fb2b3022628..a8d45b16e50 100644
--- a/sys/arch/mvmeppc/dev/bugtty.c
+++ b/sys/arch/mvmeppc/dev/bugtty.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bugtty.c,v 1.13 2010/04/12 12:57:52 tedu Exp $ */
+/* $OpenBSD: bugtty.c,v 1.14 2010/06/28 14:13:30 deraadt Exp $ */
/* Copyright (c) 1998 Steve Murphree, Jr.
* Copyright (c) 1995 Dale Rahn.
@@ -165,7 +165,7 @@ bugttyopen(dev, flag, mode, p)
if (bugtty_tty[unit]) {
tp = bugtty_tty[unit];
} else {
- tp = bugtty_tty[unit] = ttymalloc();
+ tp = bugtty_tty[unit] = ttymalloc(0);
}
tp->t_oproc = bugttyoutput;
tp->t_param = NULL;
diff --git a/sys/arch/sh/dev/scif.c b/sys/arch/sh/dev/scif.c
index 060b243f886..2163eda9af5 100644
--- a/sys/arch/sh/dev/scif.c
+++ b/sys/arch/sh/dev/scif.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: scif.c,v 1.12 2010/04/16 02:20:25 deraadt Exp $ */
+/* $OpenBSD: scif.c,v 1.13 2010/06/28 14:13:30 deraadt Exp $ */
/* $NetBSD: scif.c,v 1.47 2006/07/23 22:06:06 ad Exp $ */
/*-
@@ -455,7 +455,7 @@ scif_attach(struct device *parent, struct device *self, void *aux)
sc->sc_si = softintr_establish(IPL_SOFTSERIAL, scifsoft, sc);
SET(sc->sc_hwflags, SCIF_HW_DEV_OK);
- tp = ttymalloc();
+ tp = ttymalloc(0);
tp->t_oproc = scifstart;
tp->t_param = scifparam;
tp->t_hwiflow = NULL;
diff --git a/sys/arch/sparc/dev/magma.c b/sys/arch/sparc/dev/magma.c
index 38413d86e58..3209d16bb23 100644
--- a/sys/arch/sparc/dev/magma.c
+++ b/sys/arch/sparc/dev/magma.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: magma.c,v 1.25 2010/04/12 12:57:52 tedu Exp $ */
+/* $OpenBSD: magma.c,v 1.26 2010/06/28 14:13:30 deraadt Exp $ */
/*-
* Copyright (c) 1998 Iain Hibbert
@@ -861,7 +861,7 @@ mtty_attach(parent, dev, args)
chan = 1; /* skip channel 0 if parmode */
mp->mp_channel = chan;
- tp = ttymalloc();
+ tp = ttymalloc(0);
tp->t_oproc = mtty_start;
tp->t_param = mtty_param;
diff --git a/sys/arch/sparc/dev/spif.c b/sys/arch/sparc/dev/spif.c
index ab6cca4aa9f..03fb662aab9 100644
--- a/sys/arch/sparc/dev/spif.c
+++ b/sys/arch/sparc/dev/spif.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: spif.c,v 1.25 2010/04/12 12:57:52 tedu Exp $ */
+/* $OpenBSD: spif.c,v 1.26 2010/06/28 14:13:30 deraadt Exp $ */
/*
* Copyright (c) 1999 Jason L. Wright (jason@thought.net)
@@ -234,7 +234,7 @@ sttyattach(parent, dev, aux)
sp->sp_dtr = 0;
sc->sc_regs->dtrlatch[port] = 1;
- tp = ttymalloc();
+ tp = ttymalloc(0);
tp->t_oproc = stty_start;
tp->t_param = stty_param;
diff --git a/sys/arch/sparc/dev/z8530tty.c b/sys/arch/sparc/dev/z8530tty.c
index 1ee386b33ae..c7765b4ee07 100644
--- a/sys/arch/sparc/dev/z8530tty.c
+++ b/sys/arch/sparc/dev/z8530tty.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: z8530tty.c,v 1.15 2010/04/12 12:57:52 tedu Exp $ */
+/* $OpenBSD: z8530tty.c,v 1.16 2010/06/28 14:13:30 deraadt Exp $ */
/* $NetBSD: z8530tty.c,v 1.13 1996/10/16 20:42:14 gwr Exp $ */
/*-
@@ -338,7 +338,7 @@ zstty_attach(parent, self, aux)
printf("\n");
- tp = ttymalloc();
+ tp = ttymalloc(0);
tp->t_dev = dev;
tp->t_oproc = zsstart;
tp->t_param = zsparam;
diff --git a/sys/arch/sparc64/dev/pcons.c b/sys/arch/sparc64/dev/pcons.c
index 3c63bfe1814..84ebc0ac4a5 100644
--- a/sys/arch/sparc64/dev/pcons.c
+++ b/sys/arch/sparc64/dev/pcons.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pcons.c,v 1.17 2010/04/12 12:57:52 tedu Exp $ */
+/* $OpenBSD: pcons.c,v 1.18 2010/06/28 14:13:31 deraadt Exp $ */
/* $NetBSD: pcons.c,v 1.7 2001/05/02 10:32:20 scw Exp $ */
/*-
@@ -226,7 +226,7 @@ pconsopen(dev, flag, mode, p)
return ENXIO;
#endif
if (!(tp = sc->of_tty)) {
- sc->of_tty = tp = ttymalloc();
+ sc->of_tty = tp = ttymalloc(0);
}
tp->t_oproc = pconsstart;
tp->t_param = pconsparam;
diff --git a/sys/arch/sparc64/dev/sab.c b/sys/arch/sparc64/dev/sab.c
index 55586f3dff7..12496c4aa5f 100644
--- a/sys/arch/sparc64/dev/sab.c
+++ b/sys/arch/sparc64/dev/sab.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sab.c,v 1.28 2010/04/12 12:57:52 tedu Exp $ */
+/* $OpenBSD: sab.c,v 1.29 2010/06/28 14:13:31 deraadt Exp $ */
/*
* Copyright (c) 2001 Jason L. Wright (jason@thought.net)
@@ -377,7 +377,7 @@ sabtty_attach(parent, self, aux)
struct sabtty_attach_args *sa = aux;
int r;
- sc->sc_tty = ttymalloc();
+ sc->sc_tty = ttymalloc(0);
sc->sc_tty->t_oproc = sabtty_start;
sc->sc_tty->t_param = sabtty_param;
diff --git a/sys/arch/sparc64/dev/sbbc.c b/sys/arch/sparc64/dev/sbbc.c
index e10555e3ab5..d1ea24ad6e3 100644
--- a/sys/arch/sparc64/dev/sbbc.c
+++ b/sys/arch/sparc64/dev/sbbc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sbbc.c,v 1.8 2010/04/12 12:57:52 tedu Exp $ */
+/* $OpenBSD: sbbc.c,v 1.9 2010/06/28 14:13:31 deraadt Exp $ */
/*
* Copyright (c) 2008 Mark Kettenis
*
@@ -515,7 +515,7 @@ sbbcopen(dev_t dev, int flag, int mode, struct proc *p)
if (sc->sc_tty)
tp = sc->sc_tty;
else
- tp = sc->sc_tty = ttymalloc();
+ tp = sc->sc_tty = ttymalloc(0);
tp->t_oproc = sbbcstart;
tp->t_param = sbbcparam;
diff --git a/sys/arch/sparc64/dev/vcctty.c b/sys/arch/sparc64/dev/vcctty.c
index b8177d9e159..1d710e71188 100644
--- a/sys/arch/sparc64/dev/vcctty.c
+++ b/sys/arch/sparc64/dev/vcctty.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vcctty.c,v 1.4 2010/04/12 12:57:52 tedu Exp $ */
+/* $OpenBSD: vcctty.c,v 1.5 2010/06/28 14:13:31 deraadt Exp $ */
/*
* Copyright (c) 2009 Mark Kettenis
*
@@ -311,7 +311,7 @@ vccttyopen(dev_t dev, int flag, int mode, struct proc *p)
if (sc->sc_tty)
tp = sc->sc_tty;
else
- tp = sc->sc_tty = ttymalloc();
+ tp = sc->sc_tty = ttymalloc(0);
tp->t_oproc = vccttystart;
tp->t_param = vccttyparam;
diff --git a/sys/arch/sparc64/dev/vcons.c b/sys/arch/sparc64/dev/vcons.c
index e17bce33fb3..847883a38fb 100644
--- a/sys/arch/sparc64/dev/vcons.c
+++ b/sys/arch/sparc64/dev/vcons.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vcons.c,v 1.8 2010/04/12 12:57:52 tedu Exp $ */
+/* $OpenBSD: vcons.c,v 1.9 2010/06/28 14:13:31 deraadt Exp $ */
/*
* Copyright (c) 2008 Mark Kettenis
*
@@ -166,7 +166,7 @@ vconsopen(dev_t dev, int flag, int mode, struct proc *p)
if (sc->sc_tty)
tp = sc->sc_tty;
else
- tp = sc->sc_tty = ttymalloc();
+ tp = sc->sc_tty = ttymalloc(0);
tp->t_oproc = vconsstart;
tp->t_param = vconsparam;
diff --git a/sys/arch/sparc64/dev/z8530tty.c b/sys/arch/sparc64/dev/z8530tty.c
index dfa79ac9a47..c485899c08d 100644
--- a/sys/arch/sparc64/dev/z8530tty.c
+++ b/sys/arch/sparc64/dev/z8530tty.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: z8530tty.c,v 1.20 2010/04/12 12:57:52 tedu Exp $ */
+/* $OpenBSD: z8530tty.c,v 1.21 2010/06/28 14:13:31 deraadt Exp $ */
/* $NetBSD: z8530tty.c,v 1.77 2001/05/30 15:24:24 lukem Exp $ */
/*-
@@ -334,7 +334,7 @@ zstty_attach(parent, self, aux)
printf("\n");
- tp = ttymalloc();
+ tp = ttymalloc(0);
tp->t_dev = dev;
tp->t_oproc = zsstart;
tp->t_param = zsparam;
diff --git a/sys/arch/vax/qbus/dhu.c b/sys/arch/vax/qbus/dhu.c
index c95d6c3acbc..4704c654201 100644
--- a/sys/arch/vax/qbus/dhu.c
+++ b/sys/arch/vax/qbus/dhu.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dhu.c,v 1.16 2010/04/12 12:57:52 tedu Exp $ */
+/* $OpenBSD: dhu.c,v 1.17 2010/06/28 14:13:31 deraadt Exp $ */
/* $NetBSD: dhu.c,v 1.19 2000/06/04 06:17:01 matt Exp $ */
/*
* Copyright (c) 2003, Hugh Graham.
@@ -243,7 +243,7 @@ dhu_attach(parent, self, aux)
for (i = 0; i < sc->sc_lines; i++) {
struct tty *tp;
- tp = sc->sc_dhu[i].dhu_tty = ttymalloc();
+ tp = sc->sc_dhu[i].dhu_tty = ttymalloc(0);
sc->sc_dhu[i].dhu_state = STATE_IDLE;
bus_dmamap_create(sc->sc_dmat, tp->t_outq.c_cn, 1,
tp->t_outq.c_cn, 0, BUS_DMA_ALLOCNOW|BUS_DMA_NOWAIT,
diff --git a/sys/arch/vax/qbus/dl.c b/sys/arch/vax/qbus/dl.c
index b0e07c19fe3..f337ce38329 100644
--- a/sys/arch/vax/qbus/dl.c
+++ b/sys/arch/vax/qbus/dl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dl.c,v 1.10 2010/04/12 12:57:52 tedu Exp $ */
+/* $OpenBSD: dl.c,v 1.11 2010/06/28 14:13:31 deraadt Exp $ */
/* $NetBSD: dl.c,v 1.11 2000/01/24 02:40:29 matt Exp $ */
/*-
@@ -206,7 +206,7 @@ dl_attach (parent, self, aux)
/* Initialize our softc structure. Should be done in open? */
- sc->sc_tty = ttymalloc();
+ sc->sc_tty = ttymalloc(0);
/* Now register the TX & RX interrupt handlers */
uba_intr_establish(ua->ua_icookie, ua->ua_cvec , dlxint, sc);
diff --git a/sys/arch/vax/qbus/dz.c b/sys/arch/vax/qbus/dz.c
index 6d08ed1b5b5..a9ffa096858 100644
--- a/sys/arch/vax/qbus/dz.c
+++ b/sys/arch/vax/qbus/dz.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dz.c,v 1.21 2010/04/12 12:57:52 tedu Exp $ */
+/* $OpenBSD: dz.c,v 1.22 2010/06/28 14:13:31 deraadt Exp $ */
/* $NetBSD: dz.c,v 1.23 2000/06/04 02:14:12 matt Exp $ */
/*
* Copyright (c) 1996 Ken C. Wellsch. All rights reserved.
@@ -126,7 +126,7 @@ dzattach(struct dz_softc *sc)
for (n = 0; n < sc->sc_type; n++) {
sc->sc_dz[n].dz_sc = sc;
sc->sc_dz[n].dz_line = n;
- sc->sc_dz[n].dz_tty = ttymalloc();
+ sc->sc_dz[n].dz_tty = ttymalloc(0);
}
/* Alas no interrupt on modem bit changes, so we manually scan */
diff --git a/sys/arch/vax/qbus/qd.c b/sys/arch/vax/qbus/qd.c
index ea77385df4b..940e8a0e9c3 100644
--- a/sys/arch/vax/qbus/qd.c
+++ b/sys/arch/vax/qbus/qd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: qd.c,v 1.17 2010/04/12 12:57:52 tedu Exp $ */
+/* $OpenBSD: qd.c,v 1.18 2010/06/28 14:13:31 deraadt Exp $ */
/* $NetBSD: qd.c,v 1.17 2000/01/24 02:40:29 matt Exp $ */
/*-
@@ -826,7 +826,7 @@ qdopen(dev, flag, mode, p)
/* If not done already, allocate tty structure */
if (qd_tty[minor_dev] == NULL)
- qd_tty[minor_dev] = ttymalloc();
+ qd_tty[minor_dev] = ttymalloc(0);
/*
* this is the console
diff --git a/sys/arch/vax/vax/gencons.c b/sys/arch/vax/vax/gencons.c
index ae085b62f87..90632e31a14 100644
--- a/sys/arch/vax/vax/gencons.c
+++ b/sys/arch/vax/vax/gencons.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: gencons.c,v 1.22 2010/04/12 12:57:52 tedu Exp $ */
+/* $OpenBSD: gencons.c,v 1.23 2010/06/28 14:13:31 deraadt Exp $ */
/* $NetBSD: gencons.c,v 1.22 2000/01/24 02:40:33 matt Exp $ */
/*
@@ -86,7 +86,7 @@ gencnopen(dev, flag, mode, p)
return ENXIO;
if (gencn_tty[unit] == NULL)
- gencn_tty[unit] = ttymalloc();
+ gencn_tty[unit] = ttymalloc(0);
tp = gencn_tty[unit];
diff --git a/sys/arch/vax/vxt/qsc.c b/sys/arch/vax/vxt/qsc.c
index 274a4c57375..3e09171455e 100644
--- a/sys/arch/vax/vxt/qsc.c
+++ b/sys/arch/vax/vxt/qsc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: qsc.c,v 1.6 2010/04/12 12:57:52 tedu Exp $ */
+/* $OpenBSD: qsc.c,v 1.7 2010/06/28 14:13:32 deraadt Exp $ */
/*
* Copyright (c) 2006 Miodrag Vallat.
*
@@ -569,7 +569,7 @@ qscopen(dev_t dev, int flag, int mode, struct proc *p)
if (sc->sc_tty[line] != NULL)
tp = sc->sc_tty[line];
else
- tp = sc->sc_tty[line] = ttymalloc();
+ tp = sc->sc_tty[line] = ttymalloc(0);
tp->t_oproc = qscstart;
tp->t_param = qscparam;
diff --git a/sys/dev/ic/com.c b/sys/dev/ic/com.c
index 83bce029147..28369ca10fa 100644
--- a/sys/dev/ic/com.c
+++ b/sys/dev/ic/com.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: com.c,v 1.140 2010/06/28 04:36:31 ckuethe Exp $ */
+/* $OpenBSD: com.c,v 1.141 2010/06/28 14:13:32 deraadt Exp $ */
/* $NetBSD: com.c,v 1.82.4.1 1996/06/02 09:08:00 mrg Exp $ */
/*
@@ -286,7 +286,7 @@ comopen(dev_t dev, int flag, int mode, struct proc *p)
s = spltty();
if (!sc->sc_tty) {
- tp = sc->sc_tty = ttymalloc();
+ tp = sc->sc_tty = ttymalloc(1000000);
} else
tp = sc->sc_tty;
splx(s);
diff --git a/sys/dev/ic/cy.c b/sys/dev/ic/cy.c
index 5f6fddbba4f..3280a72a846 100644
--- a/sys/dev/ic/cy.c
+++ b/sys/dev/ic/cy.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cy.c,v 1.30 2010/06/26 23:24:44 guenther Exp $ */
+/* $OpenBSD: cy.c,v 1.31 2010/06/28 14:13:32 deraadt Exp $ */
/*
* Copyright (c) 1996 Timo Rossi.
* All rights reserved.
@@ -299,7 +299,7 @@ cyopen(dev, flag, mode, p)
s = spltty();
if (cy->cy_tty == NULL) {
- cy->cy_tty = ttymalloc();
+ cy->cy_tty = ttymalloc(0);
}
splx(s);
diff --git a/sys/dev/ic/z8530tty.c b/sys/dev/ic/z8530tty.c
index 2206573686d..890ca335712 100644
--- a/sys/dev/ic/z8530tty.c
+++ b/sys/dev/ic/z8530tty.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: z8530tty.c,v 1.21 2010/04/12 12:57:52 tedu Exp $ */
+/* $OpenBSD: z8530tty.c,v 1.22 2010/06/28 14:13:33 deraadt Exp $ */
/* $NetBSD: z8530tty.c,v 1.13 1996/10/16 20:42:14 gwr Exp $ */
/*
@@ -254,7 +254,7 @@ zstty_attach(parent, self, aux)
}
printf("\n");
- tp = ttymalloc();
+ tp = ttymalloc(0);
tp->t_dev = dev;
tp->t_oproc = zsstart;
tp->t_param = zsparam;
diff --git a/sys/dev/pci/cz.c b/sys/dev/pci/cz.c
index 6ba9554e252..99befa0d60e 100644
--- a/sys/dev/pci/cz.c
+++ b/sys/dev/pci/cz.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cz.c,v 1.16 2010/04/12 12:57:52 tedu Exp $ */
+/* $OpenBSD: cz.c,v 1.17 2010/06/28 14:13:33 deraadt Exp $ */
/* $NetBSD: cz.c,v 1.15 2001/01/20 19:10:36 thorpej Exp $ */
/*-
@@ -418,7 +418,7 @@ cz_attach(parent, self, aux)
timeout_set(&sc->sc_diag_to, cztty_diag, sc);
- tp = ttymalloc();
+ tp = ttymalloc(0);
tp->t_dev = makedev(cztty_major,
(cz->cz_dev.dv_unit * ZFIRM_MAX_CHANNELS) + i);
tp->t_oproc = czttystart;
diff --git a/sys/dev/sbus/magma.c b/sys/dev/sbus/magma.c
index 87d831c5f6d..54a3be568e1 100644
--- a/sys/dev/sbus/magma.c
+++ b/sys/dev/sbus/magma.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: magma.c,v 1.21 2010/04/12 12:57:52 tedu Exp $ */
+/* $OpenBSD: magma.c,v 1.22 2010/06/28 14:13:34 deraadt Exp $ */
/*-
* Copyright (c) 1998 Iain Hibbert
@@ -805,7 +805,7 @@ mtty_attach(struct device *parent, struct device *dev, void *args)
}
mp->mp_channel = chan;
- tp = ttymalloc();
+ tp = ttymalloc(0);
tp->t_oproc = mtty_start;
tp->t_param = mtty_param;
diff --git a/sys/dev/sbus/spif.c b/sys/dev/sbus/spif.c
index db6c09075a5..75d88e5d9e1 100644
--- a/sys/dev/sbus/spif.c
+++ b/sys/dev/sbus/spif.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: spif.c,v 1.17 2010/04/12 12:57:52 tedu Exp $ */
+/* $OpenBSD: spif.c,v 1.18 2010/06/28 14:13:34 deraadt Exp $ */
/*
* Copyright (c) 1999-2002 Jason L. Wright (jason@thought.net)
@@ -304,7 +304,7 @@ sttyattach(parent, dev, aux)
DTR_WRITE(sc, port, 0);
- tp = ttymalloc();
+ tp = ttymalloc(0);
tp->t_oproc = stty_start;
tp->t_param = stty_param;
diff --git a/sys/dev/usb/ucom.c b/sys/dev/usb/ucom.c
index ead332cd742..eae70ed4ec8 100644
--- a/sys/dev/usb/ucom.c
+++ b/sys/dev/usb/ucom.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ucom.c,v 1.47 2010/04/12 12:57:52 tedu Exp $ */
+/* $OpenBSD: ucom.c,v 1.48 2010/06/28 14:13:35 deraadt Exp $ */
/* $NetBSD: ucom.c,v 1.49 2003/01/01 00:10:25 thorpej Exp $ */
/*
@@ -203,7 +203,7 @@ ucom_attach(struct device *parent, struct device *self, void *aux)
sc->sc_parent = uca->arg;
sc->sc_portno = uca->portno;
- tp = ttymalloc();
+ tp = ttymalloc(1000000);
tp->t_oproc = ucomstart;
tp->t_param = ucomparam;
sc->sc_tty = tp;
diff --git a/sys/dev/wscons/wsdisplay.c b/sys/dev/wscons/wsdisplay.c
index 62663eea3e9..4682d8aaa1e 100644
--- a/sys/dev/wscons/wsdisplay.c
+++ b/sys/dev/wscons/wsdisplay.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: wsdisplay.c,v 1.99 2010/04/12 12:57:52 tedu Exp $ */
+/* $OpenBSD: wsdisplay.c,v 1.100 2010/06/28 14:13:35 deraadt Exp $ */
/* $NetBSD: wsdisplay.c,v 1.82 2005/02/27 00:27:52 perry Exp $ */
/*
@@ -310,7 +310,7 @@ wsscreen_attach(struct wsdisplay_softc *sc, int console, const char *emul,
}
scr->scr_dconf = dconf;
- scr->scr_tty = ttymalloc();
+ scr->scr_tty = ttymalloc(0);
scr->sc = sc;
return (scr);
diff --git a/sys/kern/tty.c b/sys/kern/tty.c
index 9250b7ac59d..b83cec50834 100644
--- a/sys/kern/tty.c
+++ b/sys/kern/tty.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tty.c,v 1.85 2010/04/12 12:57:52 tedu Exp $ */
+/* $OpenBSD: tty.c,v 1.86 2010/06/28 14:13:35 deraadt Exp $ */
/* $NetBSD: tty.c,v 1.68.4.2 1996/06/06 16:04:52 thorpej Exp $ */
/*-
@@ -526,7 +526,7 @@ parmrk: (void)putc(0377 | TTY_QUOTE, &tp->t_rawq);
/*
* Check for input buffer overflow
*/
- if (tp->t_rawq.c_cc + tp->t_canq.c_cc >= TTYHOG) {
+ if (tp->t_rawq.c_cc + tp->t_canq.c_cc >= TTYHOG(tp)) {
if (ISSET(iflag, IMAXBEL)) {
if (tp->t_outq.c_cc < tp->t_hiwat)
(void)ttyoutput(CTRL('g'), tp);
@@ -1269,7 +1269,7 @@ ttyblock(struct tty *tp)
int total;
total = tp->t_rawq.c_cc + tp->t_canq.c_cc;
- if (tp->t_rawq.c_cc > TTYHOG) {
+ if (tp->t_rawq.c_cc > TTYHOG(tp)) {
ttyflush(tp, FREAD | FWRITE);
CLR(tp->t_state, TS_TBLOCK);
}
@@ -1277,7 +1277,7 @@ ttyblock(struct tty *tp)
* Block further input iff: current input > threshold
* AND input is available to user program.
*/
- if ((total >= TTYHOG / 2 &&
+ if ((total >= TTYHOG(tp) / 2 &&
!ISSET(tp->t_state, TS_TBLOCK) &&
!ISSET(tp->t_lflag, ICANON)) || tp->t_canq.c_cc > 0) {
if (ISSET(tp->t_iflag, IXOFF) &&
@@ -1606,7 +1606,7 @@ read:
* the input queue has gone down.
*/
s = spltty();
- if (tp->t_rawq.c_cc < TTYHOG/5)
+ if (tp->t_rawq.c_cc < TTYHOG(tp)/5)
ttyunblock(tp);
splx(s);
@@ -2250,17 +2250,20 @@ tty_init(void)
* tty list.
*/
struct tty *
-ttymalloc(void)
+ttymalloc(int baud)
{
struct tty *tp;
tp = malloc(sizeof(struct tty), M_TTYS, M_WAITOK|M_ZERO);
- /* XXX: default to 1024 chars for now */
- clalloc(&tp->t_rawq, 1024, 1);
- clalloc(&tp->t_canq, 1024, 1);
+ if (baud <= 115200)
+ tp->t_qlen = 1024;
+ else
+ tp->t_qlen = 8192;
+ clalloc(&tp->t_rawq, tp->t_qlen, 1);
+ clalloc(&tp->t_canq, tp->t_qlen, 1);
/* output queue doesn't need quoting */
- clalloc(&tp->t_outq, 1024, 0);
+ clalloc(&tp->t_outq, tp->t_qlen, 0);
TAILQ_INSERT_TAIL(&ttylist, tp, tty_link);
++tty_count;
diff --git a/sys/kern/tty_pty.c b/sys/kern/tty_pty.c
index 9833b619580..16e63e2a12e 100644
--- a/sys/kern/tty_pty.c
+++ b/sys/kern/tty_pty.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tty_pty.c,v 1.45 2010/04/12 12:57:52 tedu Exp $ */
+/* $OpenBSD: tty_pty.c,v 1.46 2010/06/28 14:13:36 deraadt Exp $ */
/* $NetBSD: tty_pty.c,v 1.33.4.1 1996/06/02 09:08:11 mrg Exp $ */
/*
@@ -197,7 +197,7 @@ check_pty(int minor)
if (!pt_softc[minor]) {
pti = malloc(sizeof(struct pt_softc), M_DEVBUF,
M_WAITOK|M_ZERO);
- pti->pt_tty = ttymalloc();
+ pti->pt_tty = ttymalloc(0);
ptydevname(minor, pti);
pt_softc[minor] = pti;
}
@@ -240,7 +240,7 @@ ptsopen(dev_t dev, int flag, int devtype, struct proc *p)
pti = pt_softc[minor(dev)];
if (!pti->pt_tty) {
- tp = pti->pt_tty = ttymalloc();
+ tp = pti->pt_tty = ttymalloc(0);
} else
tp = pti->pt_tty;
if ((tp->t_state & TS_ISOPEN) == 0) {
@@ -417,7 +417,7 @@ ptcopen(dev_t dev, int flag, int devtype, struct proc *p)
pti = pt_softc[minor(dev)];
if (!pti->pt_tty) {
- tp = pti->pt_tty = ttymalloc();
+ tp = pti->pt_tty = ttymalloc(0);
} else
tp = pti->pt_tty;
if (tp->t_oproc)
@@ -532,10 +532,10 @@ again:
if (pti->pt_flags & PF_REMOTE) {
if (tp->t_canq.c_cc)
goto block;
- while (uio->uio_resid > 0 && tp->t_canq.c_cc < TTYHOG - 1) {
+ while (uio->uio_resid > 0 && tp->t_canq.c_cc < TTYHOG(tp) - 1) {
if (cc == 0) {
cc = MIN(uio->uio_resid, BUFSIZ);
- cc = min(cc, TTYHOG - 1 - tp->t_canq.c_cc);
+ cc = min(cc, TTYHOG(tp) - 1 - tp->t_canq.c_cc);
if (cc > bufcc)
bufcc = cc;
cp = buf;
@@ -574,7 +574,7 @@ again:
}
bufcc = cc;
while (cc > 0) {
- if ((tp->t_rawq.c_cc + tp->t_canq.c_cc) >= TTYHOG - 2 &&
+ if ((tp->t_rawq.c_cc + tp->t_canq.c_cc) >= TTYHOG(tp) - 2 &&
(tp->t_canq.c_cc > 0 || !ISSET(tp->t_lflag, ICANON))) {
wakeup(&tp->t_rawq);
goto block;
@@ -642,7 +642,7 @@ ptcpoll(dev_t dev, int events, struct proc *p)
if (events & (POLLOUT | POLLWRNORM)) {
if ((pti->pt_flags & PF_REMOTE) ?
(tp->t_canq.c_cc == 0) :
- ((tp->t_rawq.c_cc + tp->t_canq.c_cc < TTYHOG - 2) ||
+ ((tp->t_rawq.c_cc + tp->t_canq.c_cc < TTYHOG(tp) - 2) ||
(tp->t_canq.c_cc == 0 && ISSET(tp->t_lflag, ICANON))))
revents |= events & (POLLOUT | POLLWRNORM);
}
@@ -718,7 +718,7 @@ filt_ptcwrite(struct knote *kn, long hint)
if (ISSET(pti->pt_flags, PF_REMOTE)) {
if (tp->t_canq.c_cc == 0)
kn->kn_data = tp->t_canq.c_cn;
- } else if (tp->t_rawq.c_cc + tp->t_canq.c_cc < TTYHOG-2)
+ } else if (tp->t_rawq.c_cc + tp->t_canq.c_cc < TTYHOG(tp)-2)
kn->kn_data = tp->t_canq.c_cn -
(tp->t_rawq.c_cc + tp->t_canq.c_cc);
}
diff --git a/sys/sys/tty.h b/sys/sys/tty.h
index 1e048b65617..ef9749e16e3 100644
--- a/sys/sys/tty.h
+++ b/sys/sys/tty.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: tty.h,v 1.24 2010/04/12 12:57:52 tedu Exp $ */
+/* $OpenBSD: tty.h,v 1.25 2010/06/28 14:13:36 deraadt Exp $ */
/* $NetBSD: tty.h,v 1.30.4.1 1996/06/02 09:08:13 mrg Exp $ */
/*-
@@ -107,6 +107,7 @@ struct tty {
long t_cancc; /* Canonical queue statistics. */
struct clist t_outq; /* Device output queue. */
long t_outcc; /* Output queue statistics. */
+ int t_qlen; /* Length of above queues */
u_char t_line; /* Interface to device drivers. */
dev_t t_dev; /* Device. */
int t_state; /* Device and driver (TS*) state. */
@@ -165,7 +166,7 @@ struct itty {
#define TTMASK 15
#define OBUFSIZ 512
-#define TTYHOG 1024
+#define TTYHOG(tp) (tp)->t_qlen
#ifdef _KERNEL
#define TTMAXHIWAT roundup(2048, CBSIZE)
@@ -295,7 +296,7 @@ int ttywflush(struct tty *tp);
void ttytstamp(struct tty *tp, int octs, int ncts, int odcd, int ndcd);
void tty_init(void);
-struct tty *ttymalloc(void);
+struct tty *ttymalloc(int);
void ttyfree(struct tty *);
u_char *firstc(struct clist *clp, int *c);