pseudo terminal driver
pseudo-device pty [count]
Provides support for a character device-pair known as a pseudo terminal,
a primary device and a replica device. The replica device provides a process with an interface
provided by another process manipulating it through the primary half of the pseudo terminal. Anything written on the primary device is
given to the replica device as input and anything written on the replica device is presented as input on the primary
count is the number of pseudo terminal pairs
configured; the default is 32.
ioctl(2) calls apply to pseudo terminals:
| Stops output to a terminal as with typing x-off.
| Restarts output (as typing x-on) stopped by TIOCSTOP or by typing x-off).
| Enable/disable packet mode, enabled by specifying (by reference) a nonzero parameter and
disabled by specifying (by reference) a zero parameter. When applied to the primary side of a pseudo
terminal, each subsequent read(2) from the terminal will return data written on the replica part of the
pseudo terminal preceded by a zero byte (|
TIOCPKT_DATA), or a single byte
reflecting control status information, an OR of of the bits:
While this mode is in use, the presence of control status information to be read from the primary side
may be detected by a select(2) for exceptional conditions.
| 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 a la `^S'.
| whenever output to the terminal is restarted.
| whenever t_stopc is `^S' and t_startc is `^Q'.
| whenever the start and stop characters are not `^S/^Q'.
rlogind to implement a remote-echoed, locally
controlled remote login with proper back-flushing of output; it can be used by other similar programs.
| Enable/disable the mode that allows a small number of simple user ioctl(2) commands to be passed through
the pseudo-terminal, using a protocol similar to that of |
TIOCPKT modes are mutually exclusive.
This mode is enabled from the primary side of a pseudo terminal by specifying (by
reference) a nonzero parameter and disabled by specifying (by reference) a zero parameter.
Each read from the primary side will return data written on the replica part of the pseudo
terminal preceded by a control byte (which may be 00) reflecting a user control operation on the replica
side. A user control command consists of a special
ioctl operation with no data;
The command is given as
n is in the range 1-255.
The operation value
n will be received as
a single byte on the next read(2) from the primary side.
ioctl(2) UIOCCMD(0) is a no-op that may be
used to probe for the existence of this facility.
TIOCPKT mode, command operations may be detected with
select(2) for exceptional conditions.
/dev/pty[p-sP-S][a-z0-9] primary pseudo terminals
/dev/tty[p-sP-S][a-z0-9] replica pseudo terminals
/dev/tty is the controlling terminal for the current process.
To display tty's attached to which processes use
ioctl(int fildes, unsigned long request, …);
Manipulates the operating characteristics of
fildes must be an open file descriptor.
request has encoded in it whether it is an "in" parameter or "out" parameter, and the size of
the in bytes.
If an error occurrs, -1 is returned and errno is set to indicate the error.
fildes is a BAD File descriptor.
request or argp is INVALid.
fildes is not associated with a tty.
request does not apply.
cdio(1), chio(1), mt(1), execve(2), fcntl(2), intro(4), tty(4)