ptem(7) ptem(7)
NAME [Toc] [Back]
ptem - STREAMS pty (pesudo-terminal) Emulation module
SYNOPSIS [Toc] [Back]
#include <sys/stropts.h>
int ioctl(fd_slave, I_PUSH, "ptem");
DESCRIPTION [Toc] [Back]
ptem is a STREAMS module that emulates a terminal when used in
conjunction with ldterm (STREAMS line discipline) and pts (STREAMS
slave pty driver). The ptem module normally sits above pts and below
ldterm. The user process must push the ptem module onto the slave
side of the pty with a call to the STREAMS I_PUSH ioctl(2) system call
before ldterm is pushed. ptem is responsible for processing all of
the terminal ioctl commands that are passed downstream from ldterm or
from ptm (STREAMS pty master driver).
ldterm and ptem together provide a real terminal behavior for the
STREAMS pty slave. However, some of the terminal ioctl commands are
ignored and cause only an acknowledgement of the command since there
is no real terminal or modem in the pty subsystem. In fact, none of
the flags in the c_clfag field of the termio or termios structures,
(which is used by the TCSETA or TCSETS ioctls, respectively), have any
effect on the pty except if the baud rate is set to zero. Setting the
baud rate to zero will have the effect of hanging up the pty
connection. Similarly, the parity or delay flags in the c_iflag field
will not have any effect at all on the pty.
As a summary, the ptem module performs the following tasks:
+ The following ioctls are processed, if appropriate, and
acknowledged by sending an M_IOCACK message upstream when they
are received on ptem's write queue:
TCSETA, TCSETAW, TCSETAF, TCSETS, TCSETSW, TCSETSF, TCGETA,
TCGETS, and TCSBRK.
+ Keeps track of the window size needed for the TIOCSWINSZ,
TIOCGWINSZ, and JWINSIZE ioctls.
+ Upon receiving any other ioctl on its write queue, ptem
acknowledges them negatively by sending an M_IOCNAK message
upstream.
+ The following ioctls are passed downstream by ptem after they
have been processed:
TCSETA, TCSETAW, TCSETAF, TCSETS, TCSETSW, TCSETSF, TCSBRK,
and TIOCSWINSZ.
Hewlett-Packard Company - 1 - HP-UX 11i Version 2: August 2003
ptem(7) ptem(7)
+ Any M_IOCNAK message that is received on ptem's read queue
will be freed in case the pckt module is not pushed on the ptm
and the above ioctls get to the pty master STREAMS head, which
would then send an M_IOCNAK message downstream.
+ When ptem is opened and all conditions for setting up a
controlling terminal are met, it sends an M_SETOPTS message
(with the SO_ISATTY flag set) upstream to the STREAMS head to
allocate a controlling terminal.
+ Upon receiving an M_IOCTL message of type TCSBRK on its read
queue, ptem sends an M_IOCACK message downstream and an
M_BREAK message upstream.
+ When an ioctl message is received on its write queue to set
the baud rate to zero (e.g. TCSETA with CBAUD set to B0), ptem
sends an M_IOCACK message upstream and a zero-length message
downstream to be read by the pty master process.
+ When an M_IOCTL message of type TIOCSIGNAL is received on its
read queue, ptem sends an M_IOCACK message downstream and an
M_PCSIG message upstream with the signal number set to the
same value used in the M_IOCTL message.
+ When an M_IOCTL message of type TIOCREMOTE is received on its
read queue, ptem sends an M_IOCACK message downstream and an
M_CTL message (with ioc_cmd set to MC_DO_CANON or MC_NO_CANON)
upstream to enable or disable the input processing on ldterm.
+ When an M_DELAY message is received on its read or write
queue, ptem simply discards the message without any action.
+ When an M_IOCTL message of type JWINSIZE is received on its
write queue and if the values in the jwinsize structure in
ptem are not zero, ptem sends an M_IOCACK message upstream
with the jwinsize structure. If the values are zero, ptem
sends an M_IOCNAK message upstream.
+ When an M_IOCTL message of type TIOCGWINSZ is received on its
write queue and if the values in the winsize structure in ptem
are not zero, ptem sends an M_IOCACK message upstream with the
winsize structure. If the values are zero, ptem sends an
M_IOCNAK message upstream.
+ When an M_IOCTL message of type TIOCSWINSZ is received in its
write queue, ptem saves the information passed to it in the
winsize structure and sends an M_PCSIG (with the signal number
set to SIGWINCH) upstream to the pty slave process if the
window size is changed.
Hewlett-Packard Company - 2 - HP-UX 11i Version 2: August 2003
ptem(7) ptem(7)
+ When an M_IOCTL message of type TIOCGWINSZ is received on its
read queue and if the values in the winsize structure in ptem
are not zero, ptem sends an M_IOCACK message downstream with
the winsize structure. If the values are zero, ptem sends an
M_IOCNAK message downstream.
+ When an M_IOCTL message of type TIOCSWINSZ is received in its
read queue, ptem saves the information passed to it in the
winsize structure and sends an M_PCSIG (with the signal number
is set to SIGWINCH) upstream to the pty slave process if the
window size is changed.
+ All other messages not mentioned above are passed to the next
module or driver.
AUTHOR [Toc] [Back]
ptem was developed by HP.
SEE ALSO [Toc] [Back]
ioctl(2), streamio(7), ptm(7), pts(7), ldterm(7).
Hewlett-Packard Company - 3 - HP-UX 11i Version 2: August 2003 [ Back ] |