pty.7 (2010 09)
p
pty(7) pty(7)
handshake is done automatically.
Trapping occurs in two forms that are identified by the
ioctl() requests that enable or disable them —
TIOCTRAP and TIOCMONITOR. These two forms are distinguished by the types of requests they affect
and by the capabilities they provide. Trapping
open() and close() requests is enabled or disabled by
TIOCTRAP. Trapping
ioctl() requests not defined by termio (7) are enabled or disabled by TIOC-
TRAP. Trapping
ioctl() requests defined by termio (7) are enabled or disabled by TIOCTRAP
only
when
TIOCTTY is also disabled. When TIOCTTY is enabled, trapping
ioctl() requests defined by ter-
mio(7) are enabled or disabled by
TIOCMONITOR. Briefly, both TIOCTRAP and TIOCMONITOR trap-
ping allow the server on the master side to examine the request’s parameters, the pid making the request,
etc. In addition,
TIOCTRAP trapping allows the server to modify the parameters and return values of an
ioctl() request.
The following
ioctl() calls apply only to the master side of a
pty and pertain to trapping ioctl(),
open(), and close() requests. They are defined in
<sys/ptyio.h>
:
TIOCTRAP Enable or disable trapping of ioctl()
, open(), and close() requests made by the
application on the slave side of a
pty
. Trapping is enabled if the int addressed by arg
is nonzero and disabled if the
int addressed by arg is zero. By default,
TIOCTRAP trap-
ping is disabled.
TIOCTRAPSTATUS
Check for a pending ioctl(), open(),orclose() trap. The argument points to an
int that is set to one if a trap is pending and to zero if nothing is pending. Use
TIOC-
TRAPSTATUS when the preferred method of a select() "exceptional condition" is not
available.
TIOCREQCHECK
Return the trapped ioctl(), open(),orclose() information to the master side.
Use TIOCREQCHECK in response to either a select() "exceptional condition" or a
TIOCTRAPSTATUS indicating that a trap is pending. A
TIOCREQCHECK reads the
pending
ioctl(), open(),orclose() information into the memory pointed to by the
arg of TIOCREQCHECK. The information takes the form of the following
request_info structure, defined in <sys/ptyio.h>
:
struct request_info {
int request;
int argget;
int argset;
pid_t pgrp;
pid_t pid;
int errno_error;
int return_value;
};
All elements of request_info refer to the slave side of the pty and include the follow-
ing:
request The ioctl() command received.
argget The ioctl() request applied to master side to receive the trapped
ioctl() structure, if one exists (a zero value means there is none).
(When nonzero, argget is a TIOCARGGET request with the size field
precomputed.)
argset The ioctl() request applied to master side to send back the resulting
ioctl() structure, if one exists (a zero value means there is none).
(When nonzero, argset is a TIOCARGSET request with the size field
precomputed.)
pgrp The process group number of the process doing the operation.
pid The process ID of the process doing the operation.
errno_error
The errno external variable error code (initialized to zero) returned by
ioctl() on the slave side. When open error mode is enabled,
4 Hewlett-Packard Company − 4 − HP-UX 11i Version 3: September 2010