Content-type: text/html Man page of pty

pty

Section: Environments, Tables, and Troff Macros (7)
Index Return to Main Contents
 

NAME

pty - Pseudo terminal driver  

SYNOPSIS

pseudo-device pty [count ]
options RPTY  

DESCRIPTION

The pty driver provides support for a device-pair termed a pseudo terminal. A pseudo terminal is a pair of character devices, a master device and a slave device. The slave device provides an interface identical to that described in the tty(7) reference page. However, whereas all other devices which provide the interface described in the tty reference page have a hardware device behind them, the slave device has, instead, another process manipulating it through the master half of the pseudo terminal. That is, anything written on the master device is given to the slave device as input and anything written on the slave device is presented as input on the master device.

The Tru64 UNIX operating system supports a STREAMS-based and clist-based implementation of the pty subsystem. The default configuration uses STREAMS-based ptys. STREAMS-based ptys use the options RPTY line in the kernel configuration file, while clist-based ptys use the pseudo-device, pty. By default, 32 pseudo-terminal special device files are created.

Note that you cannot have both types of ptys configured at the same time.

To enhance compatibility, STREAMS-based ptys offers two master pseudo terminal drivers, the BSD compatible master and the System V compatible master. The BSD master is a non-STREAMS device which interfaces to the STREAMS-based slave pty. The System V master is a STREAMS-based device which also interfaces to the STREAMS-based slave pty. The BSD master is opened through the cloning device, /dev/ptmx_bsd, and through the master pty special files, /dev/ptyXX. The System V master is opened only through the cloning device /dev/ptmx. Currently the BSD master cloning device is used by the libc routine openpty(3).

You should allocate ptys by using the openpty(3) function, which hides the pty name space that will change in the next major operating system release.

The following ioctl calls apply only to pseudo terminals: Returns the dev_t of the master file descriptor. ISPTM is valid only on the master half of the pseudo terminal, and takes no arguments. Stops output to a terminal (for example, like entering <ctrl-S>). Takes no parameter. Restarts output (stopped by TIOCSTOP or by typing <ctrl-S>). Takes no parameter. Enable or disable packet mode. Packet mode is enabled by specifying (by reference) a nonzero parameter and disabled by specifying (by reference) a zero parameter. When applied to the master side of a pseudo terminal, each subsequent read() from the terminal will return data written on the slave part of the pseudo terminal preceded by a zero byte (symbolically defined as TIOCPKT_DATA), or a single byte reflecting control status information. In the latter case, the byte is an inclusive-OR of zero or more of the bits: Whenever the read queue for the terminal is flushed. Whenever the write queue for the terminal is flushed. Whenever output to the terminal is stopped by <ctrl-S>. Whenever output to the terminal is restarted. Whenever t_stopc is <ctrl-S> and t_startc is <ctrl-Q>. Whenever the start and stop characters are not <ctrl-S> and <ctrl-Q>.

While this mode is in use, the presence of control status information to be read from the master side may be detected by a select() for exceptional conditions.
This mode is used by the rlogin and rlogind commands to implement a remote-echoed, locally <ctrl-S>/<ctrl-Q> flow-controlled remote login with proper back-flushing of output; it can be used by other similar programs. Enable or disable a mode that allows a small number of simple user ioctl commands to be passed through the pseudo-terminal, using a protocol similar to that of TIOCPKT. The TIOCUCNTL and TIOCPKT modes are mutually exclusive. This mode is enabled from the master side of a pseudo terminal by specifying (by reference) a nonzero parameter and disabled by specifying (by reference) a zero parameter. Each subsequent read() from the master side will return data written on the slave part of the pseudo terminal preceded by a zero byte, or a single byte reflecting a user control operation on the slave side. A user control command consists of a special ioctl operation with no data; the command is given as UIOCCMD(n), where n is a number in the range 1-255. The operation value n will be received as a single byte on the next read() from the master side. The ioctl UIOCCMD(0) is a no-op that may be used to probe for the existence of this facility. As with TIOCPKT mode, command operations may be detected with a select() for exceptional conditions. A mode for the master half of a pseudo terminal, independent of TIOCPKT. This mode causes input to the pseudo terminal to be flow controlled and not input edited (regardless of the terminal mode). Each write to the control terminal produces a record boundary for the process reading the terminal. In normal usage, a write of data is like the data typed as a line on the terminal; a write of 0 (zero) bytes is like typing an End-of-File character. The TIOCREMOTE mode can be used when doing remote line editing in a window manager, or whenever flow controlled input is required. Allows the open of the corresponding slave to succeed when using the System V master. If UNLKPT is not used in conjunction with the System V master the open of the corresponding slave will fail with EPERM. This ioctl takes no arguments.
 

FILES

Master pseudo terminals Slave pseudo terminals System V master cloning device BSD master cloning device SVR4 slave pseudo terminal  

RELATED INFORMATION

openpty(3)
System Administration delim off


 

Index

NAME
SYNOPSIS
DESCRIPTION
FILES
RELATED INFORMATION

This document was created by man2html, using the manual pages.
Time: 02:40:19 GMT, October 02, 2010