From owner-svn-src-head@FreeBSD.ORG Sun Oct 18 19:48:54 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 927951065692; Sun, 18 Oct 2009 19:48:54 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 43B0C8FC14; Sun, 18 Oct 2009 19:48:54 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n9IJmspX077276; Sun, 18 Oct 2009 19:48:54 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9IJmsUd077273; Sun, 18 Oct 2009 19:48:54 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <200910181948.n9IJmsUd077273@svn.freebsd.org> From: Ed Schouten Date: Sun, 18 Oct 2009 19:48:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r198214 - in head: etc sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Oct 2009 19:48:54 -0000 Author: ed Date: Sun Oct 18 19:48:53 2009 New Revision: 198214 URL: http://svn.freebsd.org/changeset/base/198214 Log: Allow the buffer size to be configured for pseudo-like TTY devices. Devices that don't implement param() (which means they don't support hardware parameters such as flow control, baud rate) hardcode the baud rate to TTYDEF_SPEED. This means the buffer size cannot be configured, which is a little inconvenient when using canonical mode with big lines of input, etc. Make it adjustable, but do clamp it between B50 and B115200 to prevent awkward buffer sizes. Remove the baud rate assignment from /etc/gettytab. Trust the kernel to fill in a proper value. Reported by: Mikolaj Golub MFC after: 1 month Modified: head/etc/gettytab head/sys/kern/tty.c Modified: head/etc/gettytab ============================================================================== --- head/etc/gettytab Sun Oct 18 19:45:44 2009 (r198213) +++ head/etc/gettytab Sun Oct 18 19:48:53 2009 (r198214) @@ -162,7 +162,7 @@ X|Xwindow|X window system:\ :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 Modified: head/sys/kern/tty.c ============================================================================== --- head/sys/kern/tty.c Sun Oct 18 19:45:44 2009 (r198213) +++ head/sys/kern/tty.c Sun Oct 18 19:48:53 2009 (r198214) @@ -870,8 +870,19 @@ static int 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); }