Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 12 Oct 2009 09:08:29 +0200
From:      Ed Schouten <ed@80386.nl>
To:        Mikolaj Golub <to.my.trociny@gmail.com>
Cc:        stable@FreeBSD.org
Subject:   Re: can't change tty speed and buffer size on 8.0
Message-ID:  <20091012070829.GA71731@hoeg.nl>
In-Reply-To: <81k4z1p3fj.fsf@zhuzha.ua1>
References:  <20091011201715.GY71731@hoeg.nl> <81k4z1p3fj.fsf@zhuzha.ua1>

next in thread | previous in thread | raw e-mail | index | archive | help

--9MdG657QzbOEWl1C
Content-Type: multipart/mixed; boundary="4vu0d+lqoSa2/ZEk"
Content-Disposition: inline


--4vu0d+lqoSa2/ZEk
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

* Mikolaj Golub <to.my.trociny@gmail.com> wrote:
> So 115200/5=3D23040 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.

--=20
 Ed Schouten <ed@80386.nl>
 WWW: http://80386.nl/

--4vu0d+lqoSa2/ZEk
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment; filename="tty.diff"
Content-Transfer-Encoding: quoted-printable

Index: etc/gettytab
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- etc/gettytab	(revision 197973)
+++ etc/gettytab	(working copy)
@@ -162,7 +162,7 @@
 	:fd@:nd@:cd@:rw:sp#9600:
=20
 P|Pc|Pc console:\
-	:ht:np:sp#115200:
+	:ht:np:
=20
 #
 # Wierdo special case for fast crt's with hardcopy devices
Index: sys/kern/tty.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- sys/kern/tty.c	(revision 197973)
+++ sys/kern/tty.c	(working copy)
@@ -842,8 +842,19 @@
 ttydevsw_defparam(struct tty *tp, struct termios *t)
 {
=20
-	/* Use a fake baud rate, we're not a real device. */
-	t->c_ispeed =3D t->c_ospeed =3D 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 =3D B50;
+	else if (t->c_ispeed > B115200)
+		t->c_ispeed =3D B115200;
+	if (t->c_ospeed < B50)
+		t->c_ospeed =3D B50;
+	else if (t->c_ospeed > B115200)
+		t->c_ospeed =3D B115200;
=20
 	return (0);
 }

--4vu0d+lqoSa2/ZEk--

--9MdG657QzbOEWl1C
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (FreeBSD)

iEYEARECAAYFAkrS1e0ACgkQ52SDGA2eCwWAVQCdE+bmZOAHZjdek3D/+Kg2ylBk
lDMAni22ckCPX6k9/tGHC3O52oc2vsdD
=kDPP
-----END PGP SIGNATURE-----

--9MdG657QzbOEWl1C--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20091012070829.GA71731>