In Unix, a pseudo terminal is a pseudo-device pair that provides a text terminal interface without associated virtual console, computer terminal or serial port hardware. Instead, a process replaces the role of the underlying hardware for the pseudo terminal session.
The master and slave devices, in their most common deployment, form an association between a Unix shell and a terminal emulation program or some sort of network server.
The slave device file, which generally has a nomenclature of /dev/ttyp*, has the appearance and supported system calls of any text terminal. Thus it has the understanding of a login session and session leader process (which is typically the shell program).
The master device file, which generally has a nomenclature of /dev/ptyp*, is the endpoint for communication with the terminal emulator. It receives the control requests and information from the other party over this interface and responds accordingly.
For example, if the first master device file available is /dev/ptypa, most library functions will return a descriptor for the master (/dev/ptypa) along with a descriptor for the corresponding slave (/dev/ttypa), and establish the permissions of the slave device file in some predefined fashion.
It is generally not allowed to open a pseudo terminal master device that is currently open elsewhere.
Some systems, notably System V derived systems, include a multiplexer device (usually /dev/ptmx) that will return a descriptor established to the first available master device.
Other important applications include remote login handlers such as ssh and telnet servers, which serve as the master for a corresponding shell, bridged by a pseudo terminal.
This article is licensed under the GNU Free Documentation License.
It uses material from the
"Pseudo terminal".
Home Page • arts • business • computers • games • health • hospitals • home • kids & teens • news • physicians • recreation• reference • regional • science • shopping • society • sports • world