In some , including Unix-like systems, a pseudoterminal, pseudotty, or PTY is a pair of pseudo-device endpoints (files) which establish an asynchronous, bidirectional communication (IPC socket) channel (with two ports) between two or more processes.
One pseudo-device in the pair, the master, provides means by which a terminal emulator or remote login server (e.g. a Telnet, rlogin, or Secure Shell server) computer process controls the slave. The other pseudo-device, the slave, emulates a hardware serial port device, and is used by terminal-oriented programs such as shells (e.g. bash) as a processes to read/write data back from/to master endpoint. PTYs are similar to bidirectional pipes.
Devpts is a Linux kernel virtual file system containing pseudoterminal devices.
Linux implementation is based on System V-style terminals (commonly referred as UNIX 98 pseudoterminals) and provides POSIX and the Single Unix Specification API in the form of a function since 1998.
Implementations of Unix pseudo terminals date back to the modifications that RAND and BBN made to a 6th Edition in the late 1970s to support remote access over a network. ``PTY Driver for SRI-NOSC Net UNIX'' lines 15-31 Modern Unix pseudoterminals originated in 1983 during the development of Eighth Edition Unix and were based on a similar feature in TENEX. They were part of the 4.3BSD-Reno, with a rather cumbersome interface defined for use.
AT&T's System V included support for pseudoterminals as a driver in their STREAMS device model, along with the pseudoterminal multiplexer (). This later evolved to become the Unix98 style of PTYs.
Pseudoterminals have been standardized by the Single UNIX Specification (maintained by the Austin Group) since 2004 (Issue 6). IEEE Std 1003.1, 2004 Edition From Issue 8 (2024) IEEE Std 1003.1-2024 the description adopts inclusive language by replacing the word master with manager and the word slave with subsidiary (defect 1466 Pseudo-terminal devices should be renamed).
The Windows Console was extended to have a PTY interface called ConPTY in 2018.
The terminal emulator process must also handle terminal control commands, e.g., for resizing the screen. Widely used terminal emulator programs include , GNOME Terminal, Konsole, and Terminal.
Remote login servers such as Secure Shell and Telnet servers play the same role but communicate with a remote user instead of a local one.
GNU Screen and Tmux are used to add a session context to a pseudoterminal, making for a much more robust and versatile solution. For example, each provides terminal persistence, allowing a user to disconnect from one computer and then connect later from another computer.
BSD PTYs have been rendered obsolete by Unix98 ptys whose naming system does not limit the number of pseudo-terminals and access to which occurs without danger of race conditions. /dev/pty[p-za-e][0-9a-f] is the "pseudo-terminal master multiplexer". Opening it returns a file descriptor of a master node and causes an associated slave node /dev/ptmx to be created.
|
|