diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig index ad1a503ac75..2d53923eb3d 100644 --- a/drivers/serial/Kconfig +++ b/drivers/serial/Kconfig @@ -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 diff --git a/drivers/serial/pty.c b/drivers/serial/pty.c index c8edacd9871..c3c090abcee 100644 --- a/drivers/serial/pty.c +++ b/drivers/serial/pty.c @@ -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;