HP-UX Reference (11i v1 00/12) - 5 Miscellaneous Topics, 7 Device (Special) Files, 9 General Information, Index (vol 9)
__________________________________________________________________________________________________________________________________________________________________________________________________
__________________________________________________________________________________________________________________________________________________________________________________________________
STANDARD Printed by: Nora Chuang [nchuang] STANDARD
/build/1111/BRICK/man7/!!!intro.7
________________________________________________________________
___ ___
p
ptem(7) ptem(7)
NAME
ptem - STREAMS pty (pesudo-terminal) Emulation module
SYNOPSIS
#include <sys/stropts.h>
int ioctl(fd_slave, I_PUSH, "ptem");
DESCRIPTION
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 responsi-
ble 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 .
• 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 allo-
cate 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 mes-
sage 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
Section 7−−90 − 1 − HP-UX Release 11i: December 2000
___
___