ptem(7) — SPECIAL FILES AND DEVICES
NAME
ptem − STREAMS Pseudo Terminal Emulation module
DESCRIPTION
ptem is a STREAMS module that when used in conjunction with a line discipline and pseudo terminal driver emulates a terminal.
The ptem module must be pushed [see I_PUSH, streamio(7)] onto the slave side of a pseudo terminal STREAM, before the ldterm module is pushed.
On the write-side, the TCSETA, TCSETAF, TCSETAW, TCGETA, TCSETS, TCSETSW, TCSETSF, TCGETS, TCSBRK, JWINSIZE, TIOCGWINSZ, and TIOCSWINSZ termio ioctl(2) messages are processed and acknowledged. A hang up (such as stty 0) is converted to a zero length M_DATA message and passed downstream. Termio 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.
On the read-side all messages are passed upstream unmodified with the following exceptions. All M_READ and M_DELAY messages are freed in both directions. An ioctl TCSBRK is converted to an M_BREAK message and passed upstream and an acknowledgement is returned downstream. An ioctl TIOCSIGNAL is converted into an M_PCSIG message, and passed upstream and an acknowledgement is returned downstream.
Finally an ioctl TIOCREMOTE is converted into an M_CTL message, acknowledged, and passed upstream. The argument is a pointer to an int. If the value of the int is non-zero, remote mode is enabled; if the value of the int is zero, remote mode is disabled. This mode can be enabled or disabled independently of packet mode. When a pseudo-terminal is in remote mode, input to the slave device of the pseudo-terminal is flow controlled and not input edited (regardless of the mode of the slave side of the pseudo-terminal). Each write to the master device produces a record boundary for the process reading the slave device. In normal usage, a write of data is like the data typed as a line on the terminal; a write of 0 bytes is like typing an EOF character. This means that a process writing to a pseudo-terminal master in remote mode must keep track of line boundaries, and write only one line at a time to the master. For example, if a process were to buffer up several newline characters and write them to the master with one write, it would appear to a process reading from the slave as if a single line containing several newline characters had been typed (as if, for example, a user had typed the LNEXT character before typing all but the last of those newline characters). Remote mode can be used when doing remote line editing in a window manager, or whenever flow controlled input is required.
FILES
<sys/ptem.h>
SEE ALSO
crash(1M), stty(1), ioctl(2), ldterm(7), pckt(7), pty(7), streamio(7), termio(7).