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
pty(7) pty(7)
trapping is enabled if the int addressed by arg is nonzero and disabled if the int
addressed by arg is zero. By default, TIOCMONITOR trapping is disabled. TIOCMONI-
TOR
works in series with TIOCTTY; that is, the TIOCMONITOR trapping must be enabled
and TIOCTTY must be enabled for termio ioctl() requests to be trapped by TIOC-
MONITOR
. TIOCMONITOR trapping can be enabled or disabled regardless of the state of
TIOCTTY.
When TIOCTTY is disabled, termio ioctl() requests are not trapped by TIOCMONI-
TOR
. However, ioctl() requests are trapped by TIOCTRAP if TIOCTTY is disabled
and TIOCTRAP is enabled. TIOCTRAP trapping allows the master side server to modify
the parameters and return values of an ioctl() request, whereas TIOCTMONITOR
trapping does not.
TIOCMONITOR trapping allows the server on the master side to know when characteris-
tics of the line discipline in the pty are changed by an application on its slave side. The
mechanism for handshaking termio requests trapped by TIOCMONITOR is the same as
the mechanism described above for requests trapped by TIOCTRAP. (It is recommended
that termio ioctl() requests be used on the master side to interrogate the configured
state of the line discipline in the pty. This compensates for the window of time before
TIOCMONITOR is enabled, when termio ioctl() requests are not trapped.)
When using select() on the master side of a pty, the "exceptional condition" refers to an
open(),
close(),orioctl() request pending on the slave side, while "ready for reading or writing" indicates
that the device can be read from or written to successfully.
Of the ioctl() requests subject to being trapped, only one-per-pty can be handled at a time. This means
that when an application does a non-termio ioctl() request to the slave side, all other ioctl()
requests to the same pty slave side are blocked until the first one is handshaked back by the master side.
(ioctl() requests that are not trapped, such as termio when TIOCTTY is enabled and TIOCMONI-
TOR
is disabled, are not blocked.) This permits the implementation of indivisible operations by an
ioctl() call on the slave side that is passed to the server process.
In summary, the following method of handling trapped ioctl(), open(), and close() requests is
preferred:
1. Call
select(). This system call blocks the master side until a slave side
ioctl(), open(),
or
close() request is trapped.
2. Make TIOCREQCHECK ioctl() request. This step returns information about a trapped
ioctl(), open(),orclose() request. If TIOCREQCHECK returns the external variable
errno error [EINVAL], loop back to the select() call.
3. Make
argget ioctl() request. This optional step is used if argget is nonzero and the
server wants to do more than just reject the trapped slave
ioctl() request.
4. Make argset ioctl() request. This optional step is done if argset is nonzero and the
server wants to pass back a modified ioctl() structure. It is done after the trapped
ioctl() request is processed via the server on the master side.
5. Set errno_error and return_value . If the trapped request is an ioctl(), set
errno_error appropriately. If the appropriate value for
errno_error is zero,
return_value must be set. If open error mode is enabled, set errno_error to a nonzero
value to return an error to a trapped open() request.
6. Make TIOCREQSET ioctl() request. This step completes the trapped ioctl(), open()
,
or
close() request.
While a process is waiting in the slave side of the pty for the server to complete a handshake, it is suscep-
tible to receiving signals. The following master side ioctl() request allows the server process to control
how the pty responds when a signal attempts to interrupt a trapped open() or ioctl() request:
TIOCSIGMODE
Set the signal handling state of the pty to the mode specified as the argument. The mode
can have three values, which are TIOCSIGBLOCK, TIOCSIGABORT , and TIOCSIGNOR-
MAL
.
TIOCSIGBLOCK
Cause some signals to be postponed that are destined for the slave-side process whose
open() or ioctl() request is trapped. Signals are postponed if they would
HP-UX Release 11i: December 2000 − 6 − Section 7−−101
___
___