mirror of
https://git.FreeBSD.org/src.git
synced 2025-01-03 12:35:02 +00:00
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 <to my trociny gmail com> MFC after: 1 month
This commit is contained in:
parent
99087885be
commit
5ed8d12443
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=198214
@ -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
|
||||
|
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user