* Mikolaj Golub <to.my.troc...@gmail.com> wrote:
> So 115200/5=23040 would be more then enough for me :-)

Great. I've attached a patch that should allow the buffer size to be
configured. Unfortunately gettytab currently sets the baud rate to
115200, which means we'll always use buffer sizes. I think we'd better
just remove the baud rate assignment and let the kernel decide which
default baud rate for the console is the best.

I'll commit the patch within the next couple of days. Let me know
whether you experience any problems with it.

-- 
 Ed Schouten <e...@80386.nl>
 WWW: http://80386.nl/
Index: etc/gettytab
===================================================================
--- etc/gettytab	(revision 197973)
+++ etc/gettytab	(working copy)
@@ -162,7 +162,7 @@
 	:fd@:nd@:cd@:rw:sp#9600:
 
 P|Pc|Pc console:\
-	:ht:np:sp#115200:
+	:ht:np:
 
 #
 # Wierdo special case for fast crt's with hardcopy devices
Index: sys/kern/tty.c
===================================================================
--- sys/kern/tty.c	(revision 197973)
+++ sys/kern/tty.c	(working copy)
@@ -842,8 +842,19 @@
 ttydevsw_defparam(struct tty *tp, struct termios *t)
 {
 
-	/* Use a fake baud rate, we're not a real device. */
-	t->c_ispeed = t->c_ospeed = TTYDEF_SPEED;
+	/*
+	 * Allow the baud rate to be adjusted for pseudo-devices, but at
+	 * least restrict it to 115200 to prevent excessive buffer
+	 * usage.  Also disallow 0, to prevent foot shooting.
+	 */
+	if (t->c_ispeed < B50)
+		t->c_ispeed = B50;
+	else if (t->c_ispeed > B115200)
+		t->c_ispeed = B115200;
+	if (t->c_ospeed < B50)
+		t->c_ospeed = B50;
+	else if (t->c_ospeed > B115200)
+		t->c_ospeed = B115200;
 
 	return (0);
 }

Attachment: pgp4uX75ig0Jl.pgp
Description: PGP signature

Reply via email to