Print this page
12306 XPG4v2 slave pty behaviour should generally be disabled
Reviewed by: Robert Mustacchi <rm@fingolfin.org>
Change-ID: I7ccd399c22866f34dd20c6bb9d28e77ba4e24c67

@@ -1,11 +1,12 @@
 '\" te
+.\" Copyright 2020 OmniOS Community Edition (OmniOSce) Association.
 .\"  Copyright 1992 Sun Microsystems
 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
-.TH PTS 7D "Aug 21, 1992"
+.TH PTS 7D "Feb 29, 2020"
 .SH NAME
 pts \- STREAMS pseudo-tty slave driver
 .SH DESCRIPTION
 .sp
 .LP

@@ -24,13 +25,14 @@
 .LP
 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 \fBptem\fR(7M) and \fBldterm\fR(7M) modules onto the slave side of
-the pseudo-terminal subsystem to get terminal semantics.
+user may then push modules onto either side of the stream pair. Unless
+compiled in strict XPG4v2 mode (see below), the consumer needs to push the
+\fBptem\fR(7M) and \fBldterm\fR(7M) modules onto the slave side of the
+pseudo-terminal subsystem to get terminal semantics.
 .sp
 .LP
 The master and slave drivers pass all messages to their adjacent queues. Only
 the \fBM_FLUSH\fR needs some processing. Because the read queue of one side is
 connected to the write queue of the other, the \fBFLUSHR\fR flag is changed to

@@ -46,16 +48,31 @@
 \fBclose()\fR that dismantles 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  \fBptem\fR module.
+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 \fBptem\fR module.
 .sp
 .LP
 The standard STREAMS system calls can access the pseudo-tty devices. The slave
 devices support the \fBO_NDELAY\fR and \fBO_NONBLOCK\fR flags.
+.SH STRICT XPG4v2 MODE
+.sp
+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.
+.sp
+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.
+.sp
+To enable it for an application, the \fB_XPG4_2\fR and \fB_STRICT_SYMBOLS\fR
+macros must be set during compilation and the application must be linked with
+\fBvalues-xpg4.o\fR or \fBvalues-xp6.o\fR.
 .SH EXAMPLES
 .sp
 .in +2
 .nf
 int    fdm fds;

@@ -93,9 +110,9 @@
 
 .SH SEE ALSO
 .sp
 .LP
 \fBgrantpt\fR(3C), \fBptsname\fR(3C), \fBunlockpt\fR(3C), \fBldterm\fR(7M),
-\fBptm\fR(7D), \fBptem\fR(7M)
+\fBptm\fR(7D), \fBptem\fR(7M), \fBstandards\fR(5)
 .sp
 .LP
 \fISTREAMS Programming Guide\fR