Psuedo-terminal pipe size is now configurable

This commit is contained in:
Gregory Nutt 2016-07-19 14:26:41 -06:00
parent b28fa8a609
commit 318f34fb7d
2 changed files with 24 additions and 5 deletions

View File

@ -2012,18 +2012,19 @@ config SCI1_2STOP
endmenu # SCI1 Configuration
config PSEUDOTERM
menuconfig PSEUDOTERM
bool "Pseudo-Terminal (PTY) suppport"
default n
select ARCH_HAVE_SERIAL_TERMIOS
---help---
Enable support support for master and slave pseudo-terminal devices.
if PSEUDOTERM
choice
prompt "PTY model"
default PSEUDOTERM_BSD if DISABLE_PSEUDOFS_OPERATIONS
default PSEUDOTERM_SUSV1 if !DISABLE_PSEUDOFS_OPERATIONS
depends on PSEUDOTERM
config PSEUDOTERM_BSD
bool "BSD style"
@ -2047,3 +2048,17 @@ config PSEUDOTERM_SUSV1
Where N is the minor number
endchoice # PTY model
config PSEUDOTERM_RXBUFSIZE
int "Pseudo-Terminal Rx buffer size"
default 256
---help---
Master-to-slave pipe buffer size. Default: 256
config PSEUDOTERM_TXBUFSIZE
int "Pseudo-Terminal Tx buffer size"
default 256
---help---
Slave-to-master buffer size. Default: 256
endif # PSEUDOTERM

View File

@ -918,15 +918,19 @@ int pty_register(int minor)
devpair->pp_master.pd_master = true;
devpair->pp_slave.pd_devpair = devpair;
/* Create two pipes */
/* Create two pipes:
*
* pipe_a: Master source, slave sink (TX, slave-to-master)
* pipe_b: Master sink, slave source (RX, master-to-slave)
*/
ret = pipe(pipe_a);
ret = pipe2(pipe_a, CONFIG_PSEUDOTERM_TXBUFSIZE);
if (ret < 0)
{
goto errout_with_devpair;
}
ret = pipe(pipe_b);
ret = pipe2(pipe_b, CONFIG_PSEUDOTERM_RXBUFSIZE);
if (ret < 0)
{
goto errout_with_pipea;