pty.7 (2010 09)
p
pty(7) pty(7)
default, termio processing is enabled. termio processing refers to processing of input
and output described by termio (7) (such as tab expansion), as well as the processing of
the ioctl() requests described by termio (7). When disabled, all input and output data
is passed through the pty without modification. Issuing a
TIOCTTY ioctl() request
flushes all data buffered in the pseudo terminal and releases any processes blocked wait-
ing for data. Enabling and disabling
TIOCTTY
affects the operation of the following
ioctl() requests: TIOCPKT, TIOCREMOTE, TIOCBREAK
, TIOCSTOP, TIOCSTART,
TIOCTRAP, and TIOCMONITOR.
When
TIOCTTY is enabled, all termio ioctl()
requests execute as specified in ter-
mio(7), regardless of the side from which the
ioctl() request is made. When
TIOCTTY is disabled, master side termio ioctl() requests set and return the the
external variable errno to [EINVAL]. Slave side
termio ioctl() requests are pro-
cessed like any other
ioctl() request when
TIOCTTY is disabled. In particular, slave
side
termio ioctl() requests set and return the external variable
errno to [EIN-
VAL] when both
TIOCTTY and
TIOCTRAP are disabled. (See the discussion of
ioctl(), open(), and close() trapping below).
ioctl() requests not defined by
termio (7) are not affected by the state of
TIOCTTY.
Data written through a pseudo terminal with
TIOCTTY
disabled is handled in a manner
similar to data flowing through a pipe. A write request blocks in the
pty until all data
has been written into the
pty. A read request blocks if there is no data available unless
the O_NDELAY flag is set (see fcntl (2)). When data is available to be read, the read
request returns whatever is available, and does not wait for the number of bytes
requested to be satisfied. The number of bytes a pty can contain in its internal memory
is implementation dependent, but is at least 256 bytes in each direction. For example, a
write on the slave side of a pty of 1024 bytes might be read on the master side by four
read requests returning 256 bytes each. The size of the chunks of data that are read is
not guaranteed to be consistent, but no data is lost.
The following
ioctl() requests, defined in <sys/ptyio.h>
, apply only to the master side of a pty.
In particular, these
ioctl() requests enable/disable specific modes of
pty driver operation. These
ioctl() requests work in series with TIOCTTY; that is, the mode must be enabled by its
ioctl()
request and TIOCTTY must be enabled for the mode to operate. The mode can be enabled or disabled
regardless of the state of TIOCTTY.
TIOCPKT Enable or disable packet mode. Packet mode is enabled if the
int addressed by arg is
nonzero and disabled if the
int addressed by arg is zero. By default, packet mode is dis-
abled. When applied to the master side of a pseudo terminal, each subsequent read()
from the master side returns data written on the slave part of the pseudo terminal pre-
ceded by a zero byte (symbolically defined as
TIOCPKT_DATA), or a single byte reflecting
control status information. The value of such a status byte is composed of zero or more
bit flags:
TIOCPKT_FLUSHREAD
The read queue for the slave side has been flushed.
TIOCPKT_FLUSHWRITE
The write queue for the slave side has been flushed.
TIOCPKT_STOP
Data flowing from the slave side of the pty to the master side has been stopped by
means of ˆS, TIOCSTOP,orTCXONC.
TIOCPKT_START
Data flowing from the slave side of the pty to the master side has been restarted.
TIOCPKT_DOSTOP
Stop and start characters have been set to ˆS or ˆQ.
TIOCPKT_NOSTOP
Stop and start characters are set to something other than ˆS or ˆQ.
TIOCREMOTE Enable or disable remote mode. Remote mode is enabled if the int value of arg is
nonzero and disabled if the int value of arg is zero. By default, remote mode is dis-
abled. Remote mode is independent of packet mode. 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 master side produces a record boundary for the process reading
2 Hewlett-Packard Company − 2 − HP-UX 11i Version 3: September 2010