--- old/usr/src/cmd/ed/ed.c	Sat Feb 29 17:13:01 2020
+++ new/usr/src/cmd/ed/ed.c	Sat Feb 29 17:13:01 2020
@@ -161,7 +161,6 @@
 
 extern  char	*optarg;	/* Value of argument */
 extern  int	optind;		/* Indicator of argument */
-extern	int __xpg4;	/* defined in xpg4.c; 0 if not xpg4-compiled program */
 
 struct  Fspec   {
 	char    Ftabs[22];
--- old/usr/src/cmd/zlogin/zlogin.c	Sat Feb 29 17:13:02 2020
+++ new/usr/src/cmd/zlogin/zlogin.c	Sat Feb 29 17:13:02 2020
@@ -24,7 +24,7 @@
  * Copyright (c) 2014 Gary Mills
  * Copyright 2015 Nexenta Systems, Inc. All rights reserved.
  * Copyright 2019 Joyent, Inc.
- * Copyright 2019 OmniOS Community Edition (OmniOSce) Association.
+ * Copyright 2020 OmniOS Community Edition (OmniOSce) Association.
  */
 
 /*
@@ -115,8 +115,6 @@
 static const char *pname;
 static char *username;
 
-extern int __xpg4;	/* 0 if not an xpg4/6-compiled program */
-
 /*
  * When forced_login is true, the user is not prompted
  * for an authentication password in the target zone.
@@ -770,16 +768,8 @@
 	cc = read(in_fd, ibuf, ZLOGIN_BUFSIZ);
 	if (cc == -1 && (errno != EINTR || dead))
 		return (-1);
-	if (cc == 0) {
-		/*
-		 * A return value of 0 when calling read() on a terminal
-		 * indicates end-of-file pre-XPG4 and no data available
-		 * for XPG4 and above.
-		 */
-		if (__xpg4 == 0)
-			return (-1);
-		return (0);
-	}
+	if (cc == 0)
+		return (-1);	/* EOF */
 	if (cc == -1)	/* The read was interrupted. */
 		return (0);
 
--- old/usr/src/head/stdlib.h	Sat Feb 29 17:13:02 2020
+++ new/usr/src/head/stdlib.h	Sat Feb 29 17:13:02 2020
@@ -28,7 +28,7 @@
 
 /*
  * Copyright (c) 2013, OmniTI Computer Consulting, Inc. All rights reserved.
- * Copyright 2019 OmniOS Community Edition (OmniOSce) Association.
+ * Copyright 2020 OmniOS Community Edition (OmniOSce) Association.
  */
 
 /*	Copyright (c) 1988 AT&T	*/
@@ -250,6 +250,19 @@
 extern int unsetenv(const char *);
 #endif
 
+/*
+ * In strict XPG4v2 mode, slave pseudo terminal devices behave differently.
+ * See the block comment in usr/src/lib/libc/port/gen/pt.c
+ */
+#if defined(_STRICT_SYMBOLS) && defined(_XPG4_2)
+#ifdef	__PRAGMA_REDEFINE_EXTNAME
+#pragma redefine_extname unlockpt __unlockpt_xpg4
+#else
+extern int __unlockpt_xpg4(int);
+#define	unlockpt __unlockpt_xpg4
+#endif
+#endif	/* defined(_STRICT_SYMBOLS) && defined(_XPG4_2) */
+
 #if defined(__EXTENSIONS__) || \
 	(!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX))
 extern char *canonicalize_file_name(const char *);
--- old/usr/src/lib/libc/port/gen/pt.c	Sat Feb 29 17:13:02 2020
+++ new/usr/src/lib/libc/port/gen/pt.c	Sat Feb 29 17:13:02 2020
@@ -24,11 +24,13 @@
  * Use is subject to license terms.
  */
 
+/*
+ * Copyright 2020 OmniOS Community Edition (OmniOSce) Association.
+ */
+
 /*	Copyright (c) 1988 AT&T	*/
-/*	  All Rights Reserved  	*/
+/*	  All Rights Reserved	*/
 
-#pragma ident	"%Z%%M%	%I%	%E% SMI"
-
 #pragma weak _ptsname = ptsname
 #pragma weak _grantpt = grantpt
 #pragma weak _unlockpt = unlockpt
@@ -133,6 +135,45 @@
 	return (0);
 }
 
+/*
+ * XPG4v2 requires that open of a slave pseudo terminal device
+ * provides the process with an interface that is identical to
+ * the terminal interface.
+ *
+ * To satisfy this, in strict XPG4v2 mode, this routine also sends
+ * a message down the stream that sets a flag in the kernel module
+ * so that additional actions are performed when opening an
+ * associated slave PTY device. When this happens, modules are
+ * automatically pushed onto the stream to provide terminal
+ * semantics and those modules are then informed that they should
+ * behave in strict XPG4v2 mode which modifies their behaviour. In
+ * particular, in strict XPG4v2 mode, empty blocks will be sent up
+ * the master side of the stream rather than being suppressed.
+ *
+ * Most applications do not expect this behaviour so it is only
+ * enabled for programs compiled in strict XPG4v2 mode (see
+ * stdlib.h).
+ */
+int
+__unlockpt_xpg4(int fd)
+{
+	int ret;
+
+	if ((ret = unlockpt(fd)) == 0) {
+		struct strioctl istr;
+
+		istr.ic_cmd = PTSSTTY;
+		istr.ic_len = 0;
+		istr.ic_timout = 0;
+		istr.ic_dp = NULL;
+
+		if (ioctl(fd, I_STR, &istr) < 0)
+			ret = -1;
+	}
+
+	return (ret);
+}
+
 int
 grantpt(int fd)
 {
--- old/usr/src/lib/libc/port/mapfile-vers	Sat Feb 29 17:13:02 2020
+++ new/usr/src/lib/libc/port/mapfile-vers	Sat Feb 29 17:13:02 2020
@@ -27,7 +27,7 @@
 # Copyright (c) 2013, OmniTI Computer Consulting, Inc. All rights reserved.
 # Copyright (c) 2013 Gary Mills
 # Copyright 2014 Garrett D'Amore <garrett@damore.org>
-# Copyright 2019 OmniOS Community Edition (OmniOSce) Association.
+# Copyright 2020 OmniOS Community Edition (OmniOSce) Association.
 #
 
 #
@@ -78,6 +78,11 @@
 $add amd64
 $endif
 
+SYMBOL_VERSION ILLUMOS_0.31 {
+    protected:
+	__unlockpt_xpg4;
+} ILLUMOS_0.30;
+
 SYMBOL_VERSION ILLUMOS_0.30 {
     protected:
 	reallocf;
--- old/usr/src/lib/libc/port/sys/open.c	Sat Feb 29 17:13:02 2020
+++ new/usr/src/lib/libc/port/sys/open.c	Sat Feb 29 17:13:02 2020
@@ -22,36 +22,25 @@
 /*
  * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
+ *
+ * Copyright 2020 OmniOS Community Edition (OmniOSce) Association.
  */
 
 /*	Copyright (c) 1988 AT&T	*/
-/*	  All Rights Reserved  	*/
+/*	  All Rights Reserved	*/
 
 #include "lint.h"
-#include <sys/mkdev.h>
 #include <limits.h>
 #include <stdarg.h>
 #include <unistd.h>
-#include <strings.h>
-#include <errno.h>
-#include <sys/stat.h>
 #include <sys/fcntl.h>
-#include <sys/stropts.h>
-#include <sys/stream.h>
-#include <sys/ptms.h>
 #include <sys/syscall.h>
 #include "libc.h"
 
-static int xpg4_fixup(int fd);
-static void push_module(int fd);
-static int isptsfd(int fd);
-static void itoa(int i, char *ptr);
-
 int
 __openat(int dfd, const char *path, int oflag, mode_t mode)
 {
-	int fd = syscall(SYS_openat, dfd, path, oflag, mode);
-	return (xpg4_fixup(fd));
+	return (syscall(SYS_openat, dfd, path, oflag, mode));
 }
 
 int
@@ -58,8 +47,7 @@
 __open(const char *path, int oflag, mode_t mode)
 {
 #if defined(_RETAIN_OLD_SYSCALLS)
-	int fd = syscall(SYS_open, path, oflag, mode);
-	return (xpg4_fixup(fd));
+	return (syscall(SYS_open, path, oflag, mode));
 #else
 	return (__openat(AT_FDCWD, path, oflag, mode));
 #endif
@@ -70,8 +58,7 @@
 int
 __openat64(int dfd, const char *path, int oflag, mode_t mode)
 {
-	int fd = syscall(SYS_openat64, dfd, path, oflag, mode);
-	return (xpg4_fixup(fd));
+	return (syscall(SYS_openat64, dfd, path, oflag, mode));
 }
 
 int
@@ -78,8 +65,7 @@
 __open64(const char *path, int oflag, mode_t mode)
 {
 #if defined(_RETAIN_OLD_SYSCALLS)
-	int fd = syscall(SYS_open64, path, oflag, mode);
-	return (xpg4_fixup(fd));
+	return (syscall(SYS_open64, path, oflag, mode));
 #else
 	return (__openat64(AT_FDCWD, path, oflag, mode));
 #endif
@@ -86,98 +72,3 @@
 }
 
 #endif	/* !_LP64 */
-
-/*
- * XPG4v2 requires that open of a slave pseudo terminal device
- * provides the process with an interface that is identical to
- * the terminal interface. For a more detailed discussion,
- * see bugid 4025044.
- */
-static int
-xpg4_fixup(int fd)
-{
-	if (libc__xpg4 != 0 && fd >= 0 && isptsfd(fd))
-		push_module(fd);
-	return (fd);
-}
-
-/*
- * Check if the file matches an entry in the /dev/pts directory.
- * Be careful to preserve errno.
- */
-static int
-isptsfd(int fd)
-{
-	char buf[TTYNAME_MAX];
-	char *str1 = buf;
-	const char *str2 = "/dev/pts/";
-	struct stat64 fsb, stb;
-	int oerrno = errno;
-	int rval = 0;
-
-	if (fstat64(fd, &fsb) == 0 && S_ISCHR(fsb.st_mode)) {
-		/*
-		 * Do this without strcpy() or strlen(),
-		 * to avoid invoking the dynamic linker.
-		 */
-		while (*str2 != '\0')
-			*str1++ = *str2++;
-		/*
-		 * Inline version of minor(dev), to avoid the dynamic linker.
-		 */
-		itoa(fsb.st_rdev & MAXMIN, str1);
-		if (stat64(buf, &stb) == 0)
-			rval = (stb.st_rdev == fsb.st_rdev);
-	}
-	errno = oerrno;
-	return (rval);
-}
-
-/*
- * Converts a number to a string (null terminated).
- */
-static void
-itoa(int i, char *ptr)
-{
-	int dig = 0;
-	int tempi;
-
-	tempi = i;
-	do {
-		dig++;
-		tempi /= 10;
-	} while (tempi);
-
-	ptr += dig;
-	*ptr = '\0';
-	while (--dig >= 0) {
-		*(--ptr) = i % 10 + '0';
-		i /= 10;
-	}
-}
-
-/*
- * Push modules to provide tty semantics
- */
-static void
-push_module(int fd)
-{
-	struct strioctl istr;
-	int oerrno = errno;
-
-	istr.ic_cmd = PTSSTTY;
-	istr.ic_len = 0;
-	istr.ic_timout = 0;
-	istr.ic_dp = NULL;
-	if (ioctl(fd, I_STR, &istr) != -1) {
-		(void) ioctl(fd, __I_PUSH_NOCTTY, "ptem");
-		(void) ioctl(fd, __I_PUSH_NOCTTY, "ldterm");
-		(void) ioctl(fd, __I_PUSH_NOCTTY, "ttcompat");
-		istr.ic_cmd = PTSSTTY;
-		istr.ic_len = 0;
-		istr.ic_timout = 0;
-		istr.ic_dp = NULL;
-		(void) ioctl(fd, I_STR, &istr);
-	}
-	errno = oerrno;
-}
--- old/usr/src/man/man3lib/libc.3lib	Sat Feb 29 17:13:03 2020
+++ new/usr/src/man/man3lib/libc.3lib	Sat Feb 29 17:13:03 2020
@@ -1,4 +1,5 @@
 '\" te
+.\" Copyright 2020 OmniOS Community Edition (OmniOSce) Association.
 .\" Copyright 2014 Garrett D'Amore <garrett@damore.org>
 .\" Copyright (c) 2009, Sun Microsystems, Inc.  All rights reserved.
 .\" Copyright 2016 Joyent, Inc.
@@ -6,7 +7,7 @@
 .\"  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]
 .\" Copyright 2011 by Delphix.  All rights reserved.
-.TH LIBC 3LIB "Dec 10, 2015"
+.TH LIBC 3LIB "Feb 14, 2020"
 .SH NAME
 libc \- C library
 .SH DESCRIPTION
@@ -43,54 +44,54 @@
 \fB__posix_sigwait\fR	\fB__posix_ttyname_r\fR
 \fB__priocntl\fR	\fB__priocntlset\fR
 \fB__pthread_cleanup_pop\fR	\fB__pthread_cleanup_push\fR
-\fB__sysconf_xpg5\fR	\fB__xpg4\fR
-\fB__xpg4_putmsg\fR	\fB__xpg4_putpmsg\fR
-\fB_Exit\fR	\fB_altzone\fR
-\fB_assert\fR	\fB_cleanup\fR
-\fB_ctype\fR	\fB_daylight\fR
-\fB_environ\fR	\fB_exit\fR
-\fB_exithandle\fR	\fB_filbuf\fR
-\fB_flsbuf\fR	\fB_flushlbf\fR
-\fB_getdate_err\fR	\fB_getdate_err_addr\fR
-\fB_iob\fR	\fB_isnan\fR
-\fB_isnand\fR	\fB_lwp_cond_broadcast\fR
-\fB_lwp_cond_reltimedwait\fR	\fB_lwp_cond_signal\fR
-\fB_lwp_cond_timedwait\fR	\fB_lwp_cond_wait\fR
-\fB_lwp_continue\fR	\fB_lwp_info\fR
-\fB_lwp_kill\fR	\fB_lwp_mutex_lock\fR
-\fB_lwp_mutex_trylock\fR	\fB_lwp_mutex_unlock\fR
-\fB_lwp_self\fR	\fB_lwp_sema_init\fR
-\fB_lwp_sema_post\fR	\fB_lwp_sema_trywait\fR
-\fB_lwp_sema_wait\fR	\fB_lwp_suspend\fR
-\fB_lwp_suspend2\fR	\fB_modf\fR
-\fB_nextafter\fR	\fB_nsc_trydoorcall\fR
-\fB_nss_XbyY_buf_alloc\fR	\fB_nss_XbyY_buf_free\fR
-\fB_nss_netdb_aliases\fR	\fB_numeric\fR
-\fB_scalb\fR	\fB_sibuf\fR
-\fB_sobuf\fR	\fB_stack_grow\fR
-\fB_sys_buslist\fR	\fB_sys_cldlist\fR
-\fB_sys_fpelist\fR	\fB_sys_illlist\fR
-\fB_sys_segvlist\fR	\fB_sys_siginfolistp\fR
-\fB_sys_siglist\fR	\fB_sys_siglistn\fR
-\fB_sys_siglistp\fR	\fB_sys_traplist\fR
-\fB_timezone\fR	\fB_tolower\fR
-\fB_toupper\fR	\fB_tzname\fR
-\fB_xftw\fR	\fB\fR
-\fBa64l\fR	\fBabort\fR
-\fBabs\fR	\fBaccess\fR
-\fBacct\fR	\fBacl\fR
-\fBaddrtosymstr\fR	\fBaddsev\fR
-\fBaddseverity\fR	\fBadjtime\fR
-\fBaio_cancel\fR	\fBaio_error\fR
-\fBaio_fsync\fR	\fBaio_read\fR
-\fBaio_return\fR	\fBaio_suspend\fR
-\fBaio_waitn\fR	\fBaio_write\fR
-\fBaiocancel\fR	\fBaioread\fR
-\fBaiowait\fR	\fBaiowrite\fR
-\fBalarm\fR	\fBalphasort\fR
-\fBaltzone\fR	\fBascftime\fR
-\fBasctime\fR	\fBasctime_r\fR
-\fBasprintf\fR
+\fB__sysconf_xpg5\fR	\fB__unlockpt_xpg4\fR
+\fB__xpg4\fR	\fB__xpg4_putmsg\fR
+\fB__xpg4_putpmsg\fR	\fB_Exit\fR
+\fB_altzone\fR	\fB_assert\fR
+\fB_cleanup\fR	\fB_ctype\fR
+\fB_daylight\fR	\fB_environ\fR
+\fB_exit\fR	\fB_exithandle\fR
+\fB_filbuf\fR	\fB_flsbuf\fR
+\fB_flushlbf\fR	\fB_getdate_err\fR
+\fB_getdate_err_addr\fR	\fB_iob\fR
+\fB_isnan\fR	\fB_isnand\fR
+\fB_lwp_cond_broadcast\fR	\fB_lwp_cond_reltimedwait\fR
+\fB_lwp_cond_signal\fR	\fB_lwp_cond_timedwait\fR
+\fB_lwp_cond_wait\fR	\fB_lwp_continue\fR
+\fB_lwp_info\fR	\fB_lwp_kill\fR
+\fB_lwp_mutex_lock\fR	\fB_lwp_mutex_trylock\fR
+\fB_lwp_mutex_unlock\fR	\fB_lwp_self\fR
+\fB_lwp_sema_init\fR	\fB_lwp_sema_post\fR
+\fB_lwp_sema_trywait\fR	\fB_lwp_sema_wait\fR
+\fB_lwp_suspend\fR	\fB_lwp_suspend2\fR
+\fB_modf\fR	\fB_nextafter\fR
+\fB_nsc_trydoorcall\fR	\fB_nss_XbyY_buf_alloc\fR
+\fB_nss_XbyY_buf_free\fR	\fB_nss_netdb_aliases\fR
+\fB_numeric\fR	\fB_scalb\fR
+\fB_sibuf\fR	\fB_sobuf\fR
+\fB_stack_grow\fR	\fB_sys_buslist\fR
+\fB_sys_cldlist\fR	\fB_sys_fpelist\fR
+\fB_sys_illlist\fR	\fB_sys_segvlist\fR
+\fB_sys_siginfolistp\fR	\fB_sys_siglist\fR
+\fB_sys_siglistn\fR	\fB_sys_siglistp\fR
+\fB_sys_traplist\fR	\fB_timezone\fR
+\fB_tolower\fR	\fB_toupper\fR
+\fB_tzname\fR	\fB_xftw\fR
+\fB\fR	\fBa64l\fR
+\fBabort\fR	\fBabs\fR
+\fBaccess\fR	\fBacct\fR
+\fBacl\fR	\fBaddrtosymstr\fR
+\fBaddsev\fR	\fBaddseverity\fR
+\fBadjtime\fR	\fBaio_cancel\fR
+\fBaio_error\fR	\fBaio_fsync\fR
+\fBaio_read\fR	\fBaio_return\fR
+\fBaio_suspend\fR	\fBaio_waitn\fR
+\fBaio_write\fR	\fBaiocancel\fR
+\fBaioread\fR	\fBaiowait\fR
+\fBaiowrite\fR	\fBalarm\fR
+\fBalphasort\fR	\fBaltzone\fR
+\fBascftime\fR	\fBasctime\fR
+\fBasctime_r\fR	\fBasprintf\fR
 \fBatexit\fR	\fBatof\fR
 \fBatoi\fR	\fBatol\fR
 \fBatoll\fR	\fBatomic_add_16\fR
@@ -152,10 +153,9 @@
 \fBbcmp\fR	\fBbcopy\fR
 \fBbindtextdomain\fR	\fBbind_textdomain_codeset\fR
 \fBbrk\fR	\fBbsd_signal\fR
-\fBbsearch\fR
-\fBbtowc\fR	\fBbtowc_l\fR
-\fBbzero\fR	\fBcalloc\fR
-\fBcanonicalize_file_name\fR
+\fBbsearch\fR	\fBbtowc\fR
+\fBbtowc_l\fR	\fBbzero\fR
+\fBcalloc\fR	\fBcanonicalize_file_name\fR
 \fBcatclose\fR	\fBcatgets\fR
 \fBcatopen\fR	\fBcfgetispeed\fR
 \fBcfgetospeed\fR	\fBcfsetispeed\fR
@@ -163,22 +163,21 @@
 \fBchdir\fR	\fBchmod\fR
 \fBchown\fR	\fBchroot\fR
 \fBclearerr\fR	\fBclearenv\fR
-\fBclock\fR
-\fBclock_getres\fR	\fBclock_gettime\fR
-\fBclock_nanosleep\fR	\fBclock_settime\fR
-\fBclose\fR	\fBclosedir\fR
-\fBclosefrom\fR	\fBcloselog\fR
-\fBcond_broadcast\fR	\fBcond_destroy\fR
-\fBcond_init\fR	\fBcond_reltimedwait\fR
-\fBcond_signal\fR	\fBcond_timedwait\fR
-\fBcond_wait\fR	\fBconfstr\fR
-\fBcreat\fR	\fBcrypt\fR
-\fBcrypt_genhash_impl\fR	\fBcrypt_gensalt\fR
-\fBcrypt_gensalt_impl\fR	\fBcsetcol\fR
-\fBcsetlen\fR	\fBctermid\fR
-\fBctermid_r\fR	\fBctime\fR
-\fBctime_r\fR	\fBcuserid\fR
-\fBdaemon\fR
+\fBclock\fR	\fBclock_getres\fR
+\fBclock_gettime\fR	\fBclock_nanosleep\fR
+\fBclock_settime\fR	\fBclose\fR
+\fBclosedir\fR	\fBclosefrom\fR
+\fBcloselog\fR	\fBcond_broadcast\fR
+\fBcond_destroy\fR	\fBcond_init\fR
+\fBcond_reltimedwait\fR	\fBcond_signal\fR
+\fBcond_timedwait\fR	\fBcond_wait\fR
+\fBconfstr\fR	\fBcreat\fR
+\fBcrypt\fR	\fBcrypt_genhash_impl\fR
+\fBcrypt_gensalt\fR	\fBcrypt_gensalt_impl\fR
+\fBcsetcol\fR	\fBcsetlen\fR
+\fBctermid\fR	\fBctermid_r\fR
+\fBctime\fR	\fBctime_r\fR
+\fBcuserid\fR	\fBdaemon\fR
 \fBdaylight\fR	\fBdbm_clearerr\fR
 \fBdbm_close\fR	\fBdbm_delete\fR
 \fBdbm_error\fR	\fBdbm_fetch\fR
@@ -203,9 +202,8 @@
 \fBdoor_ucred\fR	\fBdoor_unbind\fR
 \fBdouble_to_decimal\fR	\fBdrand48\fR
 \fBdup\fR	\fBdup2\fR
-\fBduplocale\fR
-\fBeconvert\fR	\fBecvt\fR
-\fBenable_extended_FILE_stdio\fR
+\fBduplocale\fR	\fBeconvert\fR
+\fBecvt\fR	\fBenable_extended_FILE_stdio\fR
 \fBencrypt\fR	\fBendgrent\fR
 \fBendnetgrent\fR	\fBendpwent\fR
 \fBendspent\fR	\fBendusershell\fR
@@ -218,10 +216,9 @@
 \fBexeclp\fR	\fBexecv\fR
 \fBexecve\fR	\fBexecvp\fR
 \fBexit\fR	\fBextended_to_decimal\fR
-\fBfaccessat\fR
-\fBfacl\fR	\fBfattach\fR
-\fBfchdir\fR	\fBfchmod\fR
-\fBfchmodat\fR
+\fBfaccessat\fR	\fBfacl\fR
+\fBfattach\fR	\fBfchdir\fR
+\fBfchmod\fR	\fBfchmodat\fR
 \fBfchown\fR	\fBfchownat\fR
 \fBfchroot\fR	\fBfclose\fR
 \fBfcloseall\fR	\fBfcntl\fR
@@ -239,69 +236,66 @@
 \fBfgetpwent_r\fR	\fBfgets\fR
 \fBfgetspent\fR	\fBfgetspent_r\fR
 \fBfgetwc\fR	\fBfgetwc_l\fR
-\fBfgetws\fR
-\fBfile_to_decimal\fR	\fBfileno\fR
-\fBfinite\fR	\fBflockfile\fR
-\fBfmtmsg\fR	\fBfnmatch\fR
-\fBfopen\fR	\fBfork\fR
-\fBfork1\fR	\fBforkall\fR
-\fBforkallx\fR	\fBforkx\fR
-\fBfpathconf\fR	\fBfpclass\fR
-\fBfpgetmask\fR	\fBfpgetround\fR
-\fBfpgetsticky\fR	\fBfprintf\fR
-\fBfpsetmask\fR	\fBfpsetround\fR
-\fBfpsetsticky\fR	\fBfputc\fR
-\fBfputs\fR	\fBfputwc\fR
-\fBfputws\fR	\fBfread\fR
-\fBfree\fR	\fBfreelocale\fR
-\fBfreopen\fR
+\fBfgetws\fR	\fBfile_to_decimal\fR
+\fBfileno\fR	\fBfinite\fR
+\fBflockfile\fR	\fBfmtmsg\fR
+\fBfnmatch\fR	\fBfopen\fR
+\fBfork\fR	\fBfork1\fR
+\fBforkall\fR	\fBforkallx\fR
+\fBforkx\fR	\fBfpathconf\fR
+\fBfpclass\fR	\fBfpgetmask\fR
+\fBfpgetround\fR	\fBfpgetsticky\fR
+\fBfprintf\fR	\fBfpsetmask\fR
+\fBfpsetround\fR	\fBfpsetsticky\fR
+\fBfputc\fR	\fBfputs\fR
+\fBfputwc\fR	\fBfputws\fR
+\fBfread\fR	\fBfree\fR
+\fBfreelocale\fR	\fBfreopen\fR
 \fBfrexp\fR	\fBfscanf\fR
 \fBfseek\fR	\fBfseeko\fR
-\fBfsetattr\fR
-\fBfsetpos\fR	\fBfstat\fR
-\fBfstatat\fR	\fBfstatfs\fR
-\fBfstatvfs\fR	\fBfsync\fR
-\fBftell\fR	\fBftello\fR
-\fBftime\fR	\fBftok\fR
-\fBftruncate\fR	\fBftrylockfile\fR
-\fBftw\fR	\fBfunc_to_decimal\fR
-\fBfunlockfile\fR	\fBfutimens\fR
-\fBfutimesat\fR
+\fBfsetattr\fR	\fBfsetpos\fR
+\fBfstat\fR	\fBfstatat\fR
+\fBfstatfs\fR	\fBfstatvfs\fR
+\fBfsync\fR	\fBftell\fR
+\fBftello\fR	\fBftime\fR
+\fBftok\fR	\fBftruncate\fR
+\fBftrylockfile\fR	\fBftw\fR
+\fBfunc_to_decimal\fR	\fBfunlockfile\fR
+\fBfutimens\fR	\fBfutimesat\fR
 \fBfwide\fR	\fBfwprintf\fR
 \fBfwrite\fR	\fBfwscanf\fR
 \fBgconvert\fR	\fBgcvt\fR
 \fBgetacct\fR	\fBgetattrat\fR
-\fBgetc\fR
-\fBgetc_unlocked\fR	\fBgetchar\fR
-\fBgetchar_unlocked\fR	\fBgetcontext\fR
-\fBgetcpuid\fR	\fBgetcwd\fR
-\fBgetdate\fR	\fBgetdate_err\fR
-\fBgetdents\fR	\fBgetdtablesize\fR
-\fBgetegid\fR	\fBgetenv\fR
-\fBgeteuid\fR	\fBgetexecname\fR
-\fBgetextmntent\fR	\fBgetgid\fR
-\fBgetgrent\fR	\fBgetgrent_r\fR
-\fBgetgrgid\fR	\fBgetgrgid_r\fR
-\fBgetgrnam\fR	\fBgetgrnam_r\fR
-\fBgetgroups\fR	\fBgethomelgroup\fR
-\fBgethostid\fR	\fBgethostname\fR
-\fBgethrtime\fR	\fBgethrvtime\fR
-\fBgetisax\fR	\fBgetitimer\fR
-\fBgetloadavg\fR	\fBgetlogin\fR
-\fBgetlogin_r\fR	\fBgetmntany\fR
-\fBgetmntent\fR	\fBgetmsg\fR
-\fBget_nprocs\fR	\fBget_nprocs_conf\fR
-\fBgetnetgrent\fR	\fBgetnetgrent_r\fR
-\fBgetopt\fR	\fBgetopt_clip\fR
-\fBgetopt_long\fR	\fBgetopt_long_only\fR
-\fBgetpagesize\fR	\fBgetpagesizes\fR
-\fBgetpass\fR	\fBgetpassphrase\fR
-\fBgetpeerucred\fR	\fBgetpflags\fR
-\fBgetpgid\fR	\fBgetpgrp\fR
-\fBgetpid\fR	\fBgetpmsg\fR
-\fBgetppid\fR	\fBgetppriv\fR
-\fBgetpriority\fR	\fBgetprogname\fR
-\fBgetprojid\fR
+\fBgetc\fR	\fBgetc_unlocked\fR
+\fBgetchar\fR	\fBgetchar_unlocked\fR
+\fBgetcontext\fR	\fBgetcpuid\fR
+\fBgetcwd\fR	\fBgetdate\fR
+\fBgetdate_err\fR	\fBgetdents\fR
+\fBgetdtablesize\fR	\fBgetegid\fR
+\fBgetenv\fR	\fBgeteuid\fR
+\fBgetexecname\fR	\fBgetextmntent\fR
+\fBgetgid\fR	\fBgetgrent\fR
+\fBgetgrent_r\fR	\fBgetgrgid\fR
+\fBgetgrgid_r\fR	\fBgetgrnam\fR
+\fBgetgrnam_r\fR	\fBgetgroups\fR
+\fBgethomelgroup\fR	\fBgethostid\fR
+\fBgethostname\fR	\fBgethrtime\fR
+\fBgethrvtime\fR	\fBgetisax\fR
+\fBgetitimer\fR	\fBgetloadavg\fR
+\fBgetlogin\fR	\fBgetlogin_r\fR
+\fBgetmntany\fR	\fBgetmntent\fR
+\fBgetmsg\fR	\fBget_nprocs\fR
+\fBget_nprocs_conf\fR	\fBgetnetgrent\fR
+\fBgetnetgrent_r\fR	\fBgetopt\fR
+\fBgetopt_clip\fR	\fBgetopt_long\fR
+\fBgetopt_long_only\fR	\fBgetpagesize\fR
+\fBgetpagesizes\fR	\fBgetpass\fR
+\fBgetpassphrase\fR	\fBgetpeerucred\fR
+\fBgetpflags\fR	\fBgetpgid\fR
+\fBgetpgrp\fR	\fBgetpid\fR
+\fBgetpmsg\fR	\fBgetppid\fR
+\fBgetppriv\fR	\fBgetpriority\fR
+\fBgetprogname\fR	\fBgetprojid\fR
 \fBgetpw\fR	\fBgetpwent\fR
 \fBgetpwent_r\fR	\fBgetpwnam\fR
 \fBgetpwnam_r\fR	\fBgetpwuid\fR
@@ -320,10 +314,9 @@
 \fBgetutxid\fR	\fBgetutxline\fR
 \fBgetvfsany\fR	\fBgetvfsent\fR
 \fBgetvfsfile\fR	\fBgetvfsspec\fR
-\fBgetw\fR
-\fBgetwc\fR	\fBgetwc_l\fR
-\fBgetwchar\fR	\fBgetwchar_l\fR
-\fBgetwd\fR
+\fBgetw\fR	\fBgetwc\fR
+\fBgetwc_l\fR	\fBgetwchar\fR
+\fBgetwchar_l\fR	\fBgetwd\fR
 \fBgetwidth\fR	\fBgetws\fR
 \fBgetzoneid\fR	\fBgetzoneidbyname\fR
 \fBgetzonenamebyid\fR	\fBglob\fR
@@ -337,27 +330,23 @@
 \fBindex\fR	\fBinitgroups\fR
 \fBinitstate\fR	\fBinnetgr\fR
 \fBinsque\fR	\fBioctl\fR
-\fBis_system_labeled\fR
-\fBisaexec\fR
+\fBis_system_labeled\fR	\fBisaexec\fR
 \fBisalnum\fR	\fBisalnum_l\fR
 \fBisalpha\fR	\fBisalpha_l\fR
 \fBisascii\fR	\fBisastream\fR
-\fBisatty\fR
-\fBisblank\fR	\fBisblank_l\fR
-\fBiscntrl\fR	\fBiscntrl_l\fR
-\fBisdigit\fR	\fBisdigit_l\fR
-\fBisenglish\fR
+\fBisatty\fR	\fBisblank\fR
+\fBisblank_l\fR	\fBiscntrl\fR
+\fBiscntrl_l\fR	\fBisdigit\fR
+\fBisdigit_l\fR	\fBisenglish\fR
 \fBisgraph\fR	\fBisgraph_l\fR
-\fBisideogram\fR
-\fBislower\fR	\fBislower_l\fR
-\fBisnan\fR
+\fBisideogram\fR	\fBislower\fR
+\fBislower_l\fR	\fBisnan\fR
 \fBisnand\fR	\fBisnanf\fR
 \fBisnumber\fR	\fBisphonogram\fR
 \fBisprint\fR	\fBisprint_l\fR
 \fBispunct\fR	\fBispunct_l\fR
-\fBissetugid\fR
-\fBisspace\fR	\fBisspace_l\fR
-\fBisspecial\fR
+\fBissetugid\fR	\fBisspace\fR
+\fBisspace_l\fR	\fBisspecial\fR
 \fBisupper\fR	\fBisupper_l\fR
 \fBiswalnum\fR	\fBiswalnum_l\fR
 \fBiswalpha\fR	\fBiswalpha_l\fR
@@ -398,31 +387,29 @@
 \fBlsub\fR	\fBlten\fR
 \fBlzero\fR	\fBmadvise\fR
 \fBmakecontext\fR	\fBmakeutx\fR
-\fBmalloc\fR
-\fBmblen\fR	\fBmblen_l\fR
-\fBmbrlen\fR	\fBmbrlen_l\fR
-\fBmbrtowc\fR	\fBmbrtowc_l\fR
-\fBmbsinit\fR	\fBmbsinit_l\fR
-\fBmbsnrtowcs\fR	\fBmbsnrtowcs_l\fR
-\fBmbsrtowcs\fR	\fBmbsrtowcs_l\fR
-\fBmbstowcs\fR	\fBmbstowcs_l\fR
-\fBmbtowc\fR	\fBmbtowc_l\fR
-\fBmemalign\fR	\fBmembar_consumer\fR
-\fBmembar_enter\fR	\fBmembar_exit\fR
-\fBmembar_producer\fR	\fBmemccpy\fR
-\fBmemchr\fR	\fBmemcmp\fR
-\fBmemcntl\fR	\fBmemcpy\fR
-\fBmeminfo\fR	\fBmemmem\fR
-\fBmemmove\fR
+\fBmalloc\fR	\fBmblen\fR
+\fBmblen_l\fR	\fBmbrlen\fR
+\fBmbrlen_l\fR	\fBmbrtowc\fR
+\fBmbrtowc_l\fR	\fBmbsinit\fR
+\fBmbsinit_l\fR	\fBmbsnrtowcs\fR
+\fBmbsnrtowcs_l\fR	\fBmbsrtowcs\fR
+\fBmbsrtowcs_l\fR	\fBmbstowcs\fR
+\fBmbstowcs_l\fR	\fBmbtowc\fR
+\fBmbtowc_l\fR	\fBmemalign\fR
+\fBmembar_consumer\fR	\fBmembar_enter\fR
+\fBmembar_exit\fR	\fBmembar_producer\fR
+\fBmemccpy\fR	\fBmemchr\fR
+\fBmemcmp\fR	\fBmemcntl\fR
+\fBmemcpy\fR	\fBmeminfo\fR
+\fBmemmem\fR	\fBmemmove\fR
 \fBmemset\fR	\fBmincore\fR
 \fBmkdir\fR	\fBmkdirat\fR
 \fBmkfifo\fR	\fBmkfifoat\fR
 \fBmknod\fR	\fBmknodat\fR
-\fBmkstemp\fR
-\fBmktemp\fR	\fBmktime\fR
-\fBmlock\fR	\fBmlockall\fR
-\fBmmap\fR	\fBmmapobj\fR
-\fBmodctl\fR
+\fBmkstemp\fR	\fBmktemp\fR
+\fBmktime\fR	\fBmlock\fR
+\fBmlockall\fR	\fBmmap\fR
+\fBmmapobj\fR	\fBmodctl\fR
 \fBmodf\fR	\fBmodff\fR
 \fBmodutx\fR	\fBmonitor\fR
 \fBmount\fR	\fBmprotect\fR
@@ -445,34 +432,31 @@
 \fBnfs_getfh\fR	\fBnftw\fR
 \fBngettext\fR	\fBnice\fR
 \fBnl_langinfo\fR	\fBnl_langinfo_l\fR
-\fBnrand48\fR
-\fBnss_default_finders\fR	\fBnss_delete\fR
-\fBnss_endent\fR	\fBnss_getent\fR
-\fBnss_search\fR	\fBnss_setent\fR
-\fBntp_adjtime\fR	\fBntp_gettime\fR
-\fBopen\fR	\fBopenat\fR
-\fBopendir\fR	\fBopenlog\fR
-\fBoptarg\fR	\fBopterr\fR
-\fBoptind\fR	\fBoptopt\fR
-\fBp_online\fR	\fBpathconf\fR
-\fBpause\fR	\fBpclose\fR
-\fBpcsample\fR	\fBperror\fR
-\fBpfmt\fR	\fBpipe\fR
-\fBplock\fR	\fBpoll\fR
-\fBpopen\fR	\fBport_alert\fR
-\fBport_associate\fR	\fBport_create\fR
-\fBport_dissociate\fR	\fBport_get\fR
-\fBport_getn\fR	\fBport_send\fR
-\fBport_sendn\fR	\fBposix_fadvise\fR
-\fBposix_fallocate\fR	\fBposix_madvise\fR
-\fBposix_memalign\fR	\fBposix_openpt\fR
-\fBposix_spawn\fR	\fBposix_spawn_file_actions_addclose\fR
-\fBposix_spawn_file_actions_addclosefrom_np\fR	\fBposix_spawn_file_actions_adddup2\fR
-\fBposix_spawn_file_actions_addopen\fR
-\fBposix_spawn_file_actions_destroy\fR
-\fBposix_spawn_file_actions_init\fR
-\fBposix_spawn_pipe_np\fR
-\fBposix_spawnattr_destroy\fR
+\fBnrand48\fR	\fBnss_default_finders\fR
+\fBnss_delete\fR	\fBnss_endent\fR
+\fBnss_getent\fR	\fBnss_search\fR
+\fBnss_setent\fR	\fBntp_adjtime\fR
+\fBntp_gettime\fR	\fBopen\fR
+\fBopenat\fR	\fBopendir\fR
+\fBopenlog\fR	\fBoptarg\fR
+\fBopterr\fR	\fBoptind\fR
+\fBoptopt\fR	\fBp_online\fR
+\fBpathconf\fR	\fBpause\fR
+\fBpclose\fR	\fBpcsample\fR
+\fBperror\fR	\fBpfmt\fR
+\fBpipe\fR	\fBplock\fR
+\fBpoll\fR	\fBpopen\fR
+\fBport_alert\fR	\fBport_associate\fR
+\fBport_create\fR	\fBport_dissociate\fR
+\fBport_get\fR	\fBport_getn\fR
+\fBport_send\fR	\fBport_sendn\fR
+\fBposix_fadvise\fR	\fBposix_fallocate\fR
+\fBposix_madvise\fR	\fBposix_memalign\fR
+\fBposix_openpt\fR	\fBposix_spawn\fR
+\fBposix_spawn_file_actions_addclose\fR	\fBposix_spawn_file_actions_addclosefrom_np\fR
+\fBposix_spawn_file_actions_adddup2\fR	\fBposix_spawn_file_actions_addopen\fR
+\fBposix_spawn_file_actions_destroy\fR	\fBposix_spawn_file_actions_init\fR
+\fBposix_spawn_pipe_np\fR	\fBposix_spawnattr_destroy\fR
 \fBposix_spawnattr_getflags\fR	\fBposix_spawnattr_getpgroup\fR
 \fBposix_spawnattr_getschedparam\fR	\fBposix_spawnattr_getschedpolicy\fR
 \fBposix_spawnattr_getsigdefault\fR	\fBposix_spawnattr_getsigignore_np\fR
@@ -482,30 +466,29 @@
 \fBposix_spawnattr_setsigdefault\fR	\fBposix_spawnattr_setsigignore_np\fR
 \fBposix_spawnattr_setsigmask\fR	\fBposix_spawnp\fR
 \fBpread\fR	\fBpreadv\fR
-\fBprintf\fR
-\fBprintstack\fR	\fBpriocntl\fR
-\fBpriocntlset\fR	\fBpriv_addset\fR
-\fBpriv_allocset\fR	\fBpriv_copyset\fR
-\fBpriv_delset\fR	\fBpriv_emptyset\fR
-\fBpriv_fillset\fR	\fBpriv_freeset\fR
-\fBpriv_getbyname\fR	\fBpriv_getbynum\fR
-\fBpriv_getsetbyname\fR	\fBpriv_getsetbynum\fR
-\fBpriv_gettext\fR	\fBpriv_ineffect\fR
-\fBpriv_intersect\fR	\fBpriv_inverse\fR
-\fBpriv_isemptyset\fR	\fBpriv_isequalset\fR
-\fBpriv_isfullset\fR	\fBpriv_ismember\fR
-\fBpriv_issubset\fR	\fBpriv_set\fR
-\fBpriv_set_to_str\fR	\fBpriv_str_to_set\fR
-\fBpriv_union\fR	\fBprocessor_bind\fR
-\fBprocessor_info\fR	\fBprofil\fR
-\fBpselect\fR	\fBpset_assign\fR
-\fBpset_bind\fR	\fBpset_create\fR
-\fBpset_destroy\fR	\fBpset_getattr\fR
-\fBpset_getloadavg\fR	\fBpset_info\fR
-\fBpset_list\fR	\fBpset_setattr\fR
-\fBpsiginfo\fR	\fBpsignal\fR
-\fBpthread_atfork\fR	\fBpthread_attr_destroy\fR
-\fBpthread_attr_get_np\fR
+\fBprintf\fR	\fBprintstack\fR
+\fBpriocntl\fR	\fBpriocntlset\fR
+\fBpriv_addset\fR	\fBpriv_allocset\fR
+\fBpriv_copyset\fR	\fBpriv_delset\fR
+\fBpriv_emptyset\fR	\fBpriv_fillset\fR
+\fBpriv_freeset\fR	\fBpriv_getbyname\fR
+\fBpriv_getbynum\fR	\fBpriv_getsetbyname\fR
+\fBpriv_getsetbynum\fR	\fBpriv_gettext\fR
+\fBpriv_ineffect\fR	\fBpriv_intersect\fR
+\fBpriv_inverse\fR	\fBpriv_isemptyset\fR
+\fBpriv_isequalset\fR	\fBpriv_isfullset\fR
+\fBpriv_ismember\fR	\fBpriv_issubset\fR
+\fBpriv_set\fR	\fBpriv_set_to_str\fR
+\fBpriv_str_to_set\fR	\fBpriv_union\fR
+\fBprocessor_bind\fR	\fBprocessor_info\fR
+\fBprofil\fR	\fBpselect\fR
+\fBpset_assign\fR	\fBpset_bind\fR
+\fBpset_create\fR	\fBpset_destroy\fR
+\fBpset_getattr\fR	\fBpset_getloadavg\fR
+\fBpset_info\fR	\fBpset_list\fR
+\fBpset_setattr\fR	\fBpsiginfo\fR
+\fBpsignal\fR	\fBpthread_atfork\fR
+\fBpthread_attr_destroy\fR	\fBpthread_attr_get_np\fR
 \fBpthread_attr_getdetachstate\fR	\fBpthread_attr_getguardsize\fR
 \fBpthread_attr_getinheritsched\fR	\fBpthread_attr_getschedparam\fR
 \fBpthread_attr_getschedpolicy\fR	\fBpthread_attr_getscope\fR
@@ -531,44 +514,43 @@
 \fBpthread_getconcurrency\fR	\fBpthread_getschedparam\fR
 \fBpthread_getspecific\fR	\fBpthread_join\fR
 \fBpthread_key_create\fR	\fBpthread_key_create_once_np\fR
-\fBpthread_key_delete\fR
-\fBpthread_kill\fR	\fBpthread_mutex_consistent\fR
-\fBpthread_mutex_destroy\fR	\fBpthread_mutex_getprioceiling\fR
-\fBpthread_mutex_init\fR	\fBpthread_mutex_lock\fR
-\fBpthread_mutex_reltimedlock_np\fR	\fBpthread_mutex_setprioceiling\fR
-\fBpthread_mutex_timedlock\fR	\fBpthread_mutex_trylock\fR
-\fBpthread_mutex_unlock\fR	\fBpthread_mutexattr_destroy\fR
-\fBpthread_mutexattr_getprioceiling\fR	\fBpthread_mutexattr_getprotocol\fR
-\fBpthread_mutexattr_getpshared\fR	\fBpthread_mutexattr_getrobust\fR
-\fBpthread_mutexattr_gettype\fR	\fBpthread_mutexattr_init\fR
-\fBpthread_mutexattr_setprioceiling\fR	\fBpthread_mutexattr_setprotocol\fR
-\fBpthread_mutexattr_setpshared\fR	\fBpthread_mutexattr_setrobust\fR
-\fBpthread_mutexattr_settype\fR	\fBpthread_once\fR
-\fBpthread_rwlock_destroy\fR	\fBpthread_rwlock_init\fR
-\fBpthread_rwlock_rdlock\fR	\fBpthread_rwlock_reltimedrdlock_np\fR
-\fBpthread_rwlock_reltimedwrlock_np\fR	\fBpthread_rwlock_timedrdlock\fR
-\fBpthread_rwlock_timedwrlock\fR	\fBpthread_rwlock_tryrdlock\fR
-\fBpthread_rwlock_trywrlock\fR	\fBpthread_rwlock_unlock\fR
-\fBpthread_rwlock_wrlock\fR	\fBpthread_rwlockattr_destroy\fR
-\fBpthread_rwlockattr_getpshared\fR	\fBpthread_rwlockattr_init\fR
-\fBpthread_rwlockattr_setpshared\fR	\fBpthread_self\fR
-\fBpthread_setcancelstate\fR	\fBpthread_setcanceltype\fR
-\fBpthread_setconcurrency\fR	\fBpthread_setspecific\fR
-\fBpthread_sigmask\fR	\fBpthread_setschedparam\fR
-\fBpthread_setschedprio\fR	\fBpthread_spin_destroy\fR
-\fBpthread_spin_init\fR	\fBpthread_spin_lock\fR
-\fBpthread_spin_trylock\fR	\fBpthread_spin_unlock\fR
-\fBpthread_testcancel\fR	\fBptsname\fR
-\fBputacct\fR	\fBputc\fR
-\fBputc_unlocked\fR	\fBputchar\fR
-\fBputchar_unlocked\fR	\fBputenv\fR
-\fBputmsg\fR	\fBputpmsg\fR
-\fBputpwent\fR	\fBputs\fR
-\fBputspent\fR	\fBpututline\fR
-\fBpututxline\fR	\fBputw\fR
-\fBputwc\fR	\fBputwchar\fR
-\fBputws\fR	\fBpwrite\fR
-\fBpwritev\fR
+\fBpthread_key_delete\fR	\fBpthread_kill\fR
+\fBpthread_mutex_consistent\fR	\fBpthread_mutex_destroy\fR
+\fBpthread_mutex_getprioceiling\fR	\fBpthread_mutex_init\fR
+\fBpthread_mutex_lock\fR	\fBpthread_mutex_reltimedlock_np\fR
+\fBpthread_mutex_setprioceiling\fR	\fBpthread_mutex_timedlock\fR
+\fBpthread_mutex_trylock\fR	\fBpthread_mutex_unlock\fR
+\fBpthread_mutexattr_destroy\fR	\fBpthread_mutexattr_getprioceiling\fR
+\fBpthread_mutexattr_getprotocol\fR	\fBpthread_mutexattr_getpshared\fR
+\fBpthread_mutexattr_getrobust\fR	\fBpthread_mutexattr_gettype\fR
+\fBpthread_mutexattr_init\fR	\fBpthread_mutexattr_setprioceiling\fR
+\fBpthread_mutexattr_setprotocol\fR	\fBpthread_mutexattr_setpshared\fR
+\fBpthread_mutexattr_setrobust\fR	\fBpthread_mutexattr_settype\fR
+\fBpthread_once\fR	\fBpthread_rwlock_destroy\fR
+\fBpthread_rwlock_init\fR	\fBpthread_rwlock_rdlock\fR
+\fBpthread_rwlock_reltimedrdlock_np\fR	\fBpthread_rwlock_reltimedwrlock_np\fR
+\fBpthread_rwlock_timedrdlock\fR	\fBpthread_rwlock_timedwrlock\fR
+\fBpthread_rwlock_tryrdlock\fR	\fBpthread_rwlock_trywrlock\fR
+\fBpthread_rwlock_unlock\fR	\fBpthread_rwlock_wrlock\fR
+\fBpthread_rwlockattr_destroy\fR	\fBpthread_rwlockattr_getpshared\fR
+\fBpthread_rwlockattr_init\fR	\fBpthread_rwlockattr_setpshared\fR
+\fBpthread_self\fR	\fBpthread_setcancelstate\fR
+\fBpthread_setcanceltype\fR	\fBpthread_setconcurrency\fR
+\fBpthread_setspecific\fR	\fBpthread_sigmask\fR
+\fBpthread_setschedparam\fR	\fBpthread_setschedprio\fR
+\fBpthread_spin_destroy\fR	\fBpthread_spin_init\fR
+\fBpthread_spin_lock\fR	\fBpthread_spin_trylock\fR
+\fBpthread_spin_unlock\fR	\fBpthread_testcancel\fR
+\fBptsname\fR	\fBputacct\fR
+\fBputc\fR	\fBputc_unlocked\fR
+\fBputchar\fR	\fBputchar_unlocked\fR
+\fBputenv\fR	\fBputmsg\fR
+\fBputpmsg\fR	\fBputpwent\fR
+\fBputs\fR	\fBputspent\fR
+\fBpututline\fR	\fBpututxline\fR
+\fBputw\fR	\fBputwc\fR
+\fBputwchar\fR	\fBputws\fR
+\fBpwrite\fR	\fBpwritev\fR
 \fBqeconvert\fR	\fBqecvt\fR
 \fBqfconvert\fR	\fBqfcvt\fR
 \fBqgconvert\fR	\fBqgcvt\fR
@@ -586,38 +568,37 @@
 \fBre_comp\fR	\fBre_exec\fR
 \fBread\fR	\fBreaddir\fR
 \fBreaddir_r\fR	\fBreadlink\fR
-\fBreadlinkat\fR
-\fBreadv\fR	\fBrealloc\fR
-\fBrealpath\fR	\fBreboot\fR
-\fBregcmp\fR	\fBregcomp\fR
-\fBregerror\fR	\fBregex\fR
-\fBregexec\fR	\fBregfree\fR
-\fBremove\fR	\fBremque\fR
-\fBrename\fR	\fBrenameat\fR
-\fBresetmnttab\fR	\fBresolvepath\fR
-\fBrewind\fR	\fBrewinddir\fR
-\fBrindex\fR	\fBrmdir\fR
-\fBrw_rdlock\fR	\fBrw_read_held\fR
-\fBrw_tryrdlock\fR	\fBrw_trywrlock\fR
-\fBrw_unlock\fR	\fBrw_write_held\fR
-\fBrw_wrlock\fR	\fBrwlock_destroy\fR
-\fBrwlock_init\fR	\fBsbrk\fR
-\fBscalb\fR	\fBscandir\fR
-\fBscanf\fR	\fBsched_get_priority_max\fR
-\fBsched_get_priority_min\fR	\fBsched_getparam\fR
-\fBsched_getscheduler\fR	\fBsched_rr_get_interval\fR
-\fBsched_setparam\fR	\fBsched_setscheduler\fR
-\fBsched_yield\fR	\fBschedctl_exit\fR
-\fBschedctl_init\fR	\fBschedctl_lookup\fR
-\fBschedctl_start\fR	\fBschedctl_stop\fR
-\fBseconvert\fR	\fBseed48\fR
-\fBseekdir\fR	\fBselect\fR
-\fBsem_close\fR	\fBsem_destroy\fR
-\fBsem_getvalue\fR	\fBsem_init\fR
-\fBsem_open\fR	\fBsem_post\fR
-\fBsem_reltimedwait_np\fR	\fBsem_timedwait\fR
-\fBsem_trywait\fR	\fBsem_unlink\fR
-\fBsem_wait\fR
+\fBreadlinkat\fR	\fBreadv\fR
+\fBrealloc\fR	\fBrealpath\fR
+\fBreboot\fR	\fBregcmp\fR
+\fBregcomp\fR	\fBregerror\fR
+\fBregex\fR	\fBregexec\fR
+\fBregfree\fR	\fBremove\fR
+\fBremque\fR	\fBrename\fR
+\fBrenameat\fR	\fBresetmnttab\fR
+\fBresolvepath\fR	\fBrewind\fR
+\fBrewinddir\fR	\fBrindex\fR
+\fBrmdir\fR	\fBrw_rdlock\fR
+\fBrw_read_held\fR	\fBrw_tryrdlock\fR
+\fBrw_trywrlock\fR	\fBrw_unlock\fR
+\fBrw_write_held\fR	\fBrw_wrlock\fR
+\fBrwlock_destroy\fR	\fBrwlock_init\fR
+\fBsbrk\fR	\fBscalb\fR
+\fBscandir\fR	\fBscanf\fR
+\fBsched_get_priority_max\fR	\fBsched_get_priority_min\fR
+\fBsched_getparam\fR	\fBsched_getscheduler\fR
+\fBsched_rr_get_interval\fR	\fBsched_setparam\fR
+\fBsched_setscheduler\fR	\fBsched_yield\fR
+\fBschedctl_exit\fR	\fBschedctl_init\fR
+\fBschedctl_lookup\fR	\fBschedctl_start\fR
+\fBschedctl_stop\fR	\fBseconvert\fR
+\fBseed48\fR	\fBseekdir\fR
+\fBselect\fR	\fBsem_close\fR
+\fBsem_destroy\fR	\fBsem_getvalue\fR
+\fBsem_init\fR	\fBsem_open\fR
+\fBsem_post\fR	\fBsem_reltimedwait_np\fR
+\fBsem_timedwait\fR	\fBsem_trywait\fR
+\fBsem_unlink\fR	\fBsem_wait\fR
 \fBsema_destroy\fR	\fBsema_held\fR
 \fBsema_init\fR	\fBsema_post\fR
 \fBsema_trywait\fR	\fBsema_wait\fR
@@ -624,20 +605,19 @@
 \fBsemctl\fR	\fBsemget\fR
 \fBsemids\fR	\fBsemop\fR
 \fBsemtimedop\fR	\fBsetattrat\fR
-\fBsetbuf\fR
-\fBsetbuffer\fR	\fBsetcat\fR
-\fBsetcontext\fR	\fBsetegid\fR
-\fBsetenv\fR	\fBseteuid\fR
-\fBsetgid\fR	\fBsetgrent\fR
-\fBsetgroups\fR	\fBsethostname\fR
-\fBsetitimer\fR	\fBsetjmp\fR
-\fBsetkey\fR	\fBsetlabel\fR
-\fBsetlinebuf\fR	\fBsetlocale\fR
-\fBsetlogmask\fR	\fBsetnetgrent\fR
-\fBsetpflags\fR	\fBsetpgid\fR
-\fBsetpgrp\fR	\fBsetppriv\fR
-\fBsetpriority\fR	\fBsetprogname\fR
-\fBsetpwent\fR
+\fBsetbuf\fR	\fBsetbuffer\fR
+\fBsetcat\fR	\fBsetcontext\fR
+\fBsetegid\fR	\fBsetenv\fR
+\fBseteuid\fR	\fBsetgid\fR
+\fBsetgrent\fR	\fBsetgroups\fR
+\fBsethostname\fR	\fBsetitimer\fR
+\fBsetjmp\fR	\fBsetkey\fR
+\fBsetlabel\fR	\fBsetlinebuf\fR
+\fBsetlocale\fR	\fBsetlogmask\fR
+\fBsetnetgrent\fR	\fBsetpflags\fR
+\fBsetpgid\fR	\fBsetpgrp\fR
+\fBsetppriv\fR	\fBsetpriority\fR
+\fBsetprogname\fR	\fBsetpwent\fR
 \fBsetrctl\fR	\fBsetregid\fR
 \fBsetreuid\fR	\fBsetrlimit\fR
 \fBsetsid\fR	\fBsetspent\fR
@@ -659,14 +639,13 @@
 \fBsiglongjmp\fR	\fBsignal\fR
 \fBsigpause\fR	\fBsigpending\fR
 \fBsigprocmask\fR	\fBsigqueue\fR
-\fBsigrelse\fR
-\fBsigsend\fR	\fBsigsendset\fR
-\fBsigset\fR	\fBsigsetjmp\fR
-\fBsigstack\fR	\fBsigsuspend\fR
-\fBsigtimedwait\fR	\fBsigwait\fR
-\fBsigwaitinfo\fR	\fBsingle_to_decimal\fR
-\fBsleep\fR	\fBsmt_pause\fR
-\fBsnprintf\fR
+\fBsigrelse\fR	\fBsigsend\fR
+\fBsigsendset\fR	\fBsigset\fR
+\fBsigsetjmp\fR	\fBsigstack\fR
+\fBsigsuspend\fR	\fBsigtimedwait\fR
+\fBsigwait\fR	\fBsigwaitinfo\fR
+\fBsingle_to_decimal\fR	\fBsleep\fR
+\fBsmt_pause\fR	\fBsnprintf\fR
 \fBsprintf\fR	\fBsrand\fR
 \fBsrand48\fR	\fBsrandom\fR
 \fBsscanf\fR	\fBssignal\fR
@@ -674,16 +653,15 @@
 \fBstack_setbounds\fR	\fBstack_violation\fR
 \fBstat\fR	\fBstatfs\fR
 \fBstatvfs\fR	\fBstime\fR
-\fBstr2sig\fR
-\fBstrcasecmp\fR	\fBstrcasecmp_l\fR
-\fBstrcat\fR	\fBstrchr\fR
-\fBstrcmp\fR	\fBstrcoll\fR
-\fBstrcpy\fR	\fBstrcspn\fR
-\fBstrdup\fR	\fBstrerror\fR
-\fBstrerror_l\fR	\fBstrerror_r\fR
-\fBstrfmon\fR	\fBstrfmon_l\fR
-\fBstrftime\fR	\fBstrftime_l\fR
-\fBstring_to_decimal\fR
+\fBstr2sig\fR	\fBstrcasecmp\fR
+\fBstrcasecmp_l\fR	\fBstrcat\fR
+\fBstrchr\fR	\fBstrcmp\fR
+\fBstrcoll\fR	\fBstrcpy\fR
+\fBstrcspn\fR	\fBstrdup\fR
+\fBstrerror\fR	\fBstrerror_l\fR
+\fBstrerror_r\fR	\fBstrfmon\fR
+\fBstrfmon_l\fR	\fBstrftime\fR
+\fBstrftime_l\fR	\fBstring_to_decimal\fR
 \fBstrlcat\fR	\fBstrlcpy\fR
 \fBstrlen\fR	\fBstrncasecmp\fR
 \fBstrncasecmp_l\fR	\fBstrncat\fR
@@ -702,23 +680,22 @@
 \fBswab\fR	\fBswapcontext\fR
 \fBswapctl\fR	\fBswprintf\fR
 \fBswscanf\fR	\fBsymlink\fR
-\fBsymlinkat\fR
-\fBsync\fR	\fBsync_instruction_memory\fR
-\fBsysconf\fR	\fBsysfs\fR
-\fBsysinfo\fR	\fBsyslog\fR
-\fBsystem\fR	\fBtcdrain\fR
-\fBtcflow\fR	\fBtcflush\fR
-\fBtcgetattr\fR	\fBtcgetpgrp\fR
-\fBtcgetsid\fR	\fBtcsendbreak\fR
-\fBtcsetattr\fR	\fBtcsetpgrp\fR
-\fBtdelete\fR	\fBtell\fR
-\fBtelldir\fR	\fBtempnam\fR
-\fBtextdomain\fR	\fBtfind\fR
-\fBthr_continue\fR	\fBthr_create\fR
-\fBthr_exit\fR	\fBthr_getconcurrency\fR
-\fBthr_getprio\fR	\fBthr_getspecific\fR
-\fBthr_join\fR	\fBthr_keycreate\fR
-\fBthr_keycreate_once\fR
+\fBsymlinkat\fR	\fBsync\fR
+\fBsync_instruction_memory\fR	\fBsysconf\fR
+\fBsysfs\fR	\fBsysinfo\fR
+\fBsyslog\fR	\fBsystem\fR
+\fBtcdrain\fR	\fBtcflow\fR
+\fBtcflush\fR	\fBtcgetattr\fR
+\fBtcgetpgrp\fR	\fBtcgetsid\fR
+\fBtcsendbreak\fR	\fBtcsetattr\fR
+\fBtcsetpgrp\fR	\fBtdelete\fR
+\fBtell\fR	\fBtelldir\fR
+\fBtempnam\fR	\fBtextdomain\fR
+\fBtfind\fR	\fBthr_continue\fR
+\fBthr_create\fR	\fBthr_exit\fR
+\fBthr_getconcurrency\fR	\fBthr_getprio\fR
+\fBthr_getspecific\fR	\fBthr_join\fR
+\fBthr_keycreate\fR	\fBthr_keycreate_once\fR
 \fBthr_kill\fR	\fBthr_main\fR
 \fBthr_min_stack\fR	\fBthr_self\fR
 \fBthr_setconcurrency\fR	\fBthr_setprio\fR
@@ -727,42 +704,40 @@
 \fBthr_yield\fR	\fBtime\fR
 \fBtimer_create\fR	\fBtimer_delete\fR
 \fBtimer_getoverrun\fR	\fBtimer_gettime\fR
-\fBtimer_settime\fR
-\fBtimes\fR	\fBtimezone\fR
-\fBtmpfile\fR	\fBtmpnam\fR
-\fBtmpnam_r\fR	\fBtoascii\fR
-\fBtolower\fR	\fBtolower_l\fR
-\fBtoupper\fR	\fBtoupper_l\fR
-\fBtowctrans\fR	\fBtowctrans_l\fR
-\fBtowlower\fR	\fBtowlower_l\fR
-\fBtowupper\fR	\fBtowupper_l\fR
-\fBtruncate\fR
+\fBtimer_settime\fR	\fBtimes\fR
+\fBtimezone\fR	\fBtmpfile\fR
+\fBtmpnam\fR	\fBtmpnam_r\fR
+\fBtoascii\fR	\fBtolower\fR
+\fBtolower_l\fR	\fBtoupper\fR
+\fBtoupper_l\fR	\fBtowctrans\fR
+\fBtowctrans_l\fR	\fBtowlower\fR
+\fBtowlower_l\fR	\fBtowupper\fR
+\fBtowupper_l\fR	\fBtruncate\fR
 \fBtsearch\fR	\fBttyname\fR
 \fBttyname_r\fR	\fBttyslot\fR
 \fBtwalk\fR	\fBtzname\fR
 \fBtzset\fR	\fBu8_strcmp\fR
 \fBu8_textprep_str\fR	\fBu8_validate\fR
-\fBuadmin\fR
-\fBualarm\fR	\fBuconv_u16tou32\fR
-\fBuconv_u16tou8\fR	\fBuconv_u32tou16\fR
-\fBuconv_u32tou8\fR	\fBuconv_u8tou16\fR
-\fBuconv_u8tou32\fR	\fBucred_free\fR
-\fBucred_get\fR	\fBucred_getegid\fR
-\fBucred_geteuid\fR	\fBucred_getgroups\fR
-\fBucred_getpflags\fR	\fBucred_getpid\fR
-\fBucred_getprivset\fR	\fBucred_getprojid\fR
-\fBucred_getrgid\fR	\fBucred_getruid\fR
-\fBucred_getsgid\fR	\fBucred_getsuid\fR
-\fBucred_getzoneid\fR	\fBucred_size\fR
-\fBulckpwdf\fR	\fBulimit\fR
-\fBulltostr\fR	\fBumask\fR
-\fBumount\fR	\fBumount2\fR
-\fBuname\fR	\fBungetc\fR
-\fBungetwc\fR	\fBunlink\fR
-\fBunlinkat\fR	\fBunlockpt\fR
-\fBunordered\fR	\fBunsetenv\fR
-\fBupdwtmp\fR	\fBupdwtmpx\fR
-\fBuselocale\fR
+\fBuadmin\fR	\fBualarm\fR
+\fBuconv_u16tou32\fR	\fBuconv_u16tou8\fR
+\fBuconv_u32tou16\fR	\fBuconv_u32tou8\fR
+\fBuconv_u8tou16\fR	\fBuconv_u8tou32\fR
+\fBucred_free\fR	\fBucred_get\fR
+\fBucred_getegid\fR	\fBucred_geteuid\fR
+\fBucred_getgroups\fR	\fBucred_getpflags\fR
+\fBucred_getpid\fR	\fBucred_getprivset\fR
+\fBucred_getprojid\fR	\fBucred_getrgid\fR
+\fBucred_getruid\fR	\fBucred_getsgid\fR
+\fBucred_getsuid\fR	\fBucred_getzoneid\fR
+\fBucred_size\fR	\fBulckpwdf\fR
+\fBulimit\fR	\fBulltostr\fR
+\fBumask\fR	\fBumount\fR
+\fBumount2\fR	\fBuname\fR
+\fBungetc\fR	\fBungetwc\fR
+\fBunlink\fR	\fBunlinkat\fR
+\fBunlockpt\fR	\fBunordered\fR
+\fBunsetenv\fR	\fBupdwtmp\fR
+\fBupdwtmpx\fR	\fBuselocale\fR
 \fBusleep\fR	\fBustat\fR
 \fButime\fR	\fButimensat\fR
 \fButimes\fR	\fButmpname\fR
@@ -787,26 +762,24 @@
 \fBwcpcpy\fR	\fBwcpncpy\fR
 \fBwcrtomb\fR	\fBwcrtomb_l\fR
 \fBwcscasecmp\fR	\fBwcscasecmp_l\fR
-\fBwcscat\fR
-\fBwcschr\fR	\fBwcscmp\fR
-\fBwcscoll\fR	\fBwcscoll_l\fR
-\fBwcscpy\fR	\fBwcscspn\fR
-\fBwcsdup\fR	\fBwcsftime\fR
-\fBwcslen\fR	\fBwcsncat\fR
-\fBwcsncasecmp\fR	\fBwcsncasecmp_l\fR
-\fBwcsncmp\fR	\fBwcsncpy\fR
-\fBwcsnrtombs\fR	\fBwcsnrtombs_l\fR
-\fBwcspbrk\fR	\fBwcsrchr\fR
-\fBwcsrtombs\fR	\fBwcsrtombs_l\fR
-\fBwcsspn\fR
+\fBwcscat\fR	\fBwcschr\fR
+\fBwcscmp\fR	\fBwcscoll\fR
+\fBwcscoll_l\fR	\fBwcscpy\fR
+\fBwcscspn\fR	\fBwcsdup\fR
+\fBwcsftime\fR	\fBwcslen\fR
+\fBwcsncat\fR	\fBwcsncasecmp\fR
+\fBwcsncasecmp_l\fR	\fBwcsncmp\fR
+\fBwcsncpy\fR	\fBwcsnrtombs\fR
+\fBwcsnrtombs_l\fR	\fBwcspbrk\fR
+\fBwcsrchr\fR	\fBwcsrtombs\fR
+\fBwcsrtombs_l\fR	\fBwcsspn\fR
 \fBwcsstr\fR	\fBwcstod\fR
 \fBwcstof\fR	\fBwcstoimax\fR
 \fBwcstok\fR	\fBwcstol\fR
 \fBwcstold\fR	\fBwcstoll\fR
 \fBwcstombs\fR	\fBwctombs_l\fR
-\fBwcstoul\fR
-\fBwcstoull\fR	\fBwcstoumax\fR
-\fBwcswcs\fR
+\fBwcstoul\fR	\fBwcstoull\fR
+\fBwcstoumax\fR	\fBwcswcs\fR
 \fBwcswidth\fR	\fBwcswidth_l\fR
 \fBwcsxfrm\fR	\fBwcsxfrm_l\fR
 \fBwctob\fR	\fBwctob_l\fR
--- old/usr/src/man/man7d/pts.7d	Sat Feb 29 17:13:03 2020
+++ new/usr/src/man/man7d/pts.7d	Sat Feb 29 17:13:03 2020
@@ -1,9 +1,10 @@
 '\" 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
@@ -26,9 +27,10 @@
 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
@@ -48,12 +50,27 @@
 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
@@ -95,7 +112,7 @@
 .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
--- old/usr/src/uts/common/io/ldterm.c	Sat Feb 29 17:13:03 2020
+++ new/usr/src/uts/common/io/ldterm.c	Sat Feb 29 17:13:03 2020
@@ -22,7 +22,7 @@
  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  * Copyright (c) 2018, Joyent, Inc.
- * Copyright 2018 OmniOS Community Edition (OmniOSce) Association.
+ * Copyright 2020 OmniOS Community Edition (OmniOSce) Association.
  */
 
 /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T	*/
@@ -4087,7 +4087,8 @@
 
 	if (c != '\0') {
 		if ((tp->t_echomp = allocb(4, BPRI_HI)) != NULL) {
-			if (ldterm_echo(c, WR(q), 4, tp) > 0)
+			if (ldterm_echo(c, WR(q), 4, tp) > 0 ||
+			    (tp->t_state & TS_ISPTSTTY))
 				putnext(WR(q), tp->t_echomp);
 			else
 				freemsg(tp->t_echomp);
--- old/usr/src/uts/common/io/ptm.c	Sat Feb 29 17:13:04 2020
+++ new/usr/src/uts/common/io/ptm.c	Sat Feb 29 17:13:04 2020
@@ -24,8 +24,10 @@
 /*	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T	*/
 /*	  All Rights Reserved	*/
 
+/*
+ * Copyright 2020 OmniOS Community Edition (OmniOSce) Association.
+ */
 
-
 /*
  * Pseudo Terminal Master Driver.
  *
@@ -521,6 +523,13 @@
 			DBG(("ack the UNLKPT/ISPTM\n"));
 			miocack(qp, mp, 0, 0);
 			break;
+		case PTSSTTY:
+			mutex_enter(&ptmp->pt_lock);
+			ptmp->pt_state |= PTSTTY;
+			mutex_exit(&ptmp->pt_lock);
+			DBG(("ack PTSSTTY\n"));
+			miocack(qp, mp, 0, 0);
+			break;
 		case ZONEPT:
 		{
 			zoneid_t z;
--- old/usr/src/uts/common/io/pts.c	Sat Feb 29 17:13:04 2020
+++ new/usr/src/uts/common/io/pts.c	Sat Feb 29 17:13:04 2020
@@ -25,8 +25,10 @@
 /*	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T	*/
 /*	  All Rights Reserved	*/
 
+/*
+ * Copyright 2020 OmniOS Community Edition (OmniOSce) Association.
+ */
 
-
 /*
  * Pseudo Terminal Slave Driver.
  *
@@ -106,6 +108,7 @@
 #include <sys/sysmacros.h>
 #include <sys/stream.h>
 #include <sys/stropts.h>
+#include <sys/strsubr.h>
 #include <sys/stat.h>
 #include <sys/errno.h>
 #include <sys/debug.h>
@@ -337,7 +340,6 @@
 	DDBGP("ptsopen: p = %p\n", (uintptr_t)ptsp);
 	DDBG("ptsopen: state = %x\n", ptsp->pt_state);
 
-
 	ASSERT(ptsp->pt_minor == dminor);
 
 	if ((ptsp->pt_state & PTLOCK) || !(ptsp->pt_state & PTMOPEN)) {
@@ -347,7 +349,7 @@
 	}
 
 	/*
-	 * if already, open simply return...
+	 * if already open, simply return...
 	 */
 	if (ptsp->pt_state & PTSOPEN) {
 		ASSERT(rqp->q_ptr == ptsp);
@@ -386,6 +388,9 @@
 	mutex_exit(&ptsp->pt_lock);
 	mutex_exit(&ptms_lock);
 
+	if (ptsp->pt_state & PTSTTY)
+		STREAM(rqp)->sd_flag |= STRXPG4TTY;
+
 	qprocson(rqp);
 
 	/*
@@ -416,8 +421,6 @@
 	return (0);
 }
 
-
-
 /*
  * Find the address to private data identifying the slave's write
  * queue. Send a 0-length msg up the slave's read queue to designate
--- old/usr/src/uts/common/os/streamio.c	Sat Feb 29 17:13:04 2020
+++ new/usr/src/uts/common/os/streamio.c	Sat Feb 29 17:13:04 2020
@@ -25,7 +25,7 @@
 /*
  * Copyright (c) 1988, 2010, Oracle and/or its affiliates. All rights reserved.
  * Copyright 2017 Joyent, Inc.
- * Copyright 2019 OmniOS Community Edition (OmniOSce) Association.
+ * Copyright 2020 OmniOS Community Edition (OmniOSce) Association.
  */
 
 #include <sys/types.h>
@@ -78,6 +78,7 @@
 #include <sys/policy.h>
 #include <sys/dld.h>
 #include <sys/zone.h>
+#include <sys/ptms.h>
 #include <c2/audit.h>
 
 /*
@@ -231,6 +232,50 @@
 	return (0);
 }
 
+static int
+xpg4_fixup(queue_t *qp, dev_t *devp, struct stdata *stp, cred_t *crp)
+{
+	static const char *ptsmods[] = {
+	    "ptem", "ldterm", "ttcompat"
+	};
+	dev_t dummydev = *devp;
+	struct strioctl strioc;
+	zoneid_t zoneid;
+	int32_t rval;
+	uint_t i;
+
+	/*
+	 * Push modules required for the slave PTY to have terminal
+	 * semantics out of the box; this is required by XPG4v2.
+	 * These three modules are flagged as single-instance so that
+	 * the system will never end up with duplicate copies pushed
+	 * onto a stream.
+	 */
+
+	zoneid = crgetzoneid(crp);
+	for (i = 0; i < ARRAY_SIZE(ptsmods); i++) {
+		int error;
+
+		error = push_mod(qp, &dummydev, stp, ptsmods[i], 0,
+		    crp, zoneid);
+		if (error != 0)
+			return (error);
+	}
+
+	/*
+	 * Send PTSSTTY down the stream
+	 */
+
+	strioc.ic_cmd = PTSSTTY;
+	strioc.ic_timout = 0;
+	strioc.ic_len = 0;
+	strioc.ic_dp = NULL;
+
+	(void) strdoioctl(stp, &strioc, FNATIVE, K_TO_K, crp, &rval);
+
+	return (0);
+}
+
 /*
  * Open a stream device.
  */
@@ -549,10 +594,15 @@
 
 opendone:
 
+	if (error == 0 &&
+	    (stp->sd_flag & (STRISTTY|STRXPG4TTY)) == (STRISTTY|STRXPG4TTY)) {
+		error = xpg4_fixup(qp, devp, stp, crp);
+	}
+
 	/*
 	 * let specfs know that open failed part way through
 	 */
-	if (error) {
+	if (error != 0) {
 		mutex_enter(&stp->sd_lock);
 		stp->sd_flag |= STREOPENFAIL;
 		mutex_exit(&stp->sd_lock);
--- old/usr/src/uts/common/sys/strsubr.h	Sat Feb 29 17:13:04 2020
+++ new/usr/src/uts/common/sys/strsubr.h	Sat Feb 29 17:13:04 2020
@@ -288,7 +288,7 @@
 #define	SNDMREAD	0x00008000	/* used for read notification */
 #define	OLDNDELAY	0x00010000	/* use old TTY semantics for */
 					/* NDELAY reads and writes */
-	/*		0x00020000	   unused */
+#define	STRXPG4TTY	0x00020000	/* Use XPG4 TTY semantics */
 	/*		0x00040000	   unused */
 #define	STRTOSTOP	0x00080000	/* block background writes */
 #define	STRCMDWAIT	0x00100000	/* someone is doing an _I_CMD */
