PTEM(7M) | STREAMS Modules | PTEM(7M) |
ptem
— STREAMS
Pseudo-Terminal Emulation module
#include
<unistd.h>
#include <stropts.h>
int
ioctl
(int fildes,
I_PUSH
, "ptem");
ptem
is a STREAMS module that emulates a
terminal device when used in conjunction with the line discipline,
ldterm(7M), and the pseudo terminal driver,
ptm(7D).
The ptem
module must be pushed (see
I_PUSH
in streamio(7I)) onto the
subsidiary device of a pseudo-terminal STREAM, before the
ldterm(7M) module is pushed.
The TCSETA
,
TCSETAF
, TCSETAW
,
TCGETA
, TCSETS
,
TCSETSW
, TCSETSF
,
TCGETS
, TCSBRK
,
JWINSIZE
, TIOCGWINSZ
, and
TIOCSWINSZ
termio(7I)
ioctl(2) messages are processed and acknowledged.
If remote mode is not in effect,
ptem
handles the TIOCSTI
ioctl by copying the argument bytes into an M_DATA
message and passing it back up the read side. Regardless of the
remote mode setting, ptem
acknowledges the ioctl and passes a copy of it downstream for possible
further processing.
A hang up (e.g., stty 0
) is
converted to a zero length M_DATA
message and passed
downstream. termio(7I)
cflags and window
row and column information are stored locally, one per stream.
M_DELAY
messages are discarded.
All other messages are passed downstream unmodified.
All messages are passed upstream unmodified with the following exceptions:
M_READ
and M_DELAY
messages are freed in both directions.TCSBRK
ioctl is converted to an
M_BREAK
message and passed upstream and an
acknowledgement is returned downstream.TIOCSIGNAL
ioctl is converted into an
M_PCSIG
message, passed upstream, and an
acknowledgement is returned downstream.TIOCREMOTE
ioctl is converted into an
M_CTL
message, acknowledged, and passed upstream;
the resulting mode is retained for use in subsequent
TIOCSTI
parsing.stty(1), ioctl(2), streamio(7I), termio(7I), ldterm(7M), pckt(7M)
February 5, 2022 | illumos |