Print this page
12306 XPG4v2 slave pty behaviour should generally be disabled
Reviewed by: Robert Mustacchi <rm@fingolfin.org>
Change-ID: I7ccd399c22866f34dd20c6bb9d28e77ba4e24c67
@@ -23,13 +23,14 @@
Only one open is allowed on a master device. Multiple opens are allowed
on the slave device. After both the master and slave have been opened,
the user has two file descriptors which are end points of a full duplex
connection composed of two streams automatically connected at the
master and slave drivers. The user may then push modules onto either
- side of the stream pair. The user needs to push the ptem(7M) and
- ldterm(7M) modules onto the slave side of the pseudo-terminal subsystem
- to get terminal semantics.
+ side of the stream pair. Unless compiled in strict XPG4v2 mode (see
+ below), the consumer needs to push the ptem(7M) and ldterm(7M) modules
+ onto the slave side of the pseudo-terminal subsystem to get terminal
+ semantics.
The master and slave drivers pass all messages to their adjacent
queues. Only the M_FLUSH needs some processing. Because the read queue
of one side is connected to the write queue of the other, the FLUSHR
@@ -46,17 +47,33 @@
the pseudo-terminal subsystem. If the master device is not closed, the
pseudo-tty subsystem will be available to another user to open the
slave device. Since 0-length messages are used to indicate that the
process on the slave side has closed and should be interpreted that way
by the process on the master side, applications on the slave side
- should not write 0-length messages. If that occurs, the write returns
- 0, and the 0-length message is discarded by the ptem module.
+ should not write 0-length messages. Unless the application is compiled
+ in strict XPG4v2 mode (see below) then any 0-length messages written on
+ the slave side will be discarded by the ptem module.
The standard STREAMS system calls can access the pseudo-tty devices.
The slave devices support the O_NDELAY and O_NONBLOCK flags.
+STRICT XPG4v2 MODE
+ XPG4v2 requires that open of a slave pseudo terminal device provides
+ the process with an interface that is identical to the terminal
+ interface (without having to explicitly push any modules to achieve
+ this). It also requires that 0-length messages written on the slave
+ side will be propagated to the master.
+
+ Experience has shown, however, that most software does not expect slave
+ pty devices to operate in this manner and therefore this
+ XPG4v2-compliant behaviour is disabled in illumos by default.
+
+ To enable it for an application, the _XPG4_2 and _STRICT_SYMBOLS macros
+ must be set during compilation and the application must be linked with
+ values-xpg4.o or values-xp6.o.
+
EXAMPLES
int fdm fds;
char *slavename;
extern char *ptsname();
@@ -77,13 +94,14 @@
/dev/pts/M
slave devices (M = 0 -> N-1)
SEE ALSO
- grantpt(3C), ptsname(3C), unlockpt(3C), ldterm(7M), ptm(7D), ptem(7M)
+ grantpt(3C), ptsname(3C), unlockpt(3C), ldterm(7M), ptm(7D), ptem(7M),
+ standards(5)
STREAMS Programming Guide
- August 21, 1992 PTS(7D)
+ February 29, 2020 PTS(7D)