--- old/usr/src/cmd/cmd-inet/sbin/dhcpagent/Makefile	Sun Aug  5 23:40:55 2018
+++ new/usr/src/cmd/cmd-inet/sbin/dhcpagent/Makefile	Sun Aug  5 23:40:55 2018
@@ -47,7 +47,7 @@
 
 CPPFLAGS  += -D_XOPEN_SOURCE=500 -D__EXTENSIONS__
 LDLIBS    += -lxnet -lnvpair -ldhcpagent -ldhcputil -linetutil -ldevinfo \
-	-ldlpi -lresolv -lsocket -lipadm
+	-ldlpi -lresolv -lipadm
 
 # Disable warnings that affect all XPG applications.
 LINTFLAGS += -erroff=E_INCONS_ARG_DECL2 -erroff=E_INCONS_VAL_TYPE_DECL2
--- old/usr/src/cmd/hal/addons/network-devices/Makefile	Sun Aug  5 23:40:55 2018
+++ new/usr/src/cmd/hal/addons/network-devices/Makefile	Sun Aug  5 23:40:55 2018
@@ -39,8 +39,7 @@
 
 ROOTCMDDIR =	$(ROOTLIB_HAL)
 
-LDLIBS +=	-lc -ldbus-1 -lhal -lglib-2.0 -ldbus-glib-1
-LDLIBS +=	-lnsl -lsocket
+LDLIBS +=	-lc -ldbus-1 -lhal -lglib-2.0 -ldbus-glib-1 -lnsl
 LDLIBS +=	$(ZIGNORE) -lnetsnmp
 
 CPPFLAGS +=	$(HAL_DBUS_CPPFLAGS) $(HAL_GLIB_CPPFLAGS) $(HAL_CONFIG_CPPFLAGS)
--- old/usr/src/cmd/print/bsd-sysv-commands/Makefile	Sun Aug  5 23:40:55 2018
+++ new/usr/src/cmd/print/bsd-sysv-commands/Makefile	Sun Aug  5 23:40:55 2018
@@ -62,7 +62,7 @@
 CPPFLAGS +=	-I../../lp/include
 LDLIBS +=	$(LIBLP) -lpapi -lc
 in.lpd:=	CFLAGS +=	-DSOLARIS_PRIVATE_POST_0_9
-in.lpd:=	LDLIBS +=	-lnsl -lsocket
+in.lpd:=	LDLIBS +=	-lnsl
 
 CERRWARN +=	-_gcc=-Wno-unused-variable
 CERRWARN +=	-_gcc=-Wno-uninitialized
--- old/usr/src/lib/krb5/kadm5/clnt/amd64/Makefile	Sun Aug  5 23:40:56 2018
+++ new/usr/src/lib/krb5/kadm5/clnt/amd64/Makefile	Sun Aug  5 23:40:56 2018
@@ -22,13 +22,11 @@
 # Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
 # Use is subject to license terms.
 #
-# ident	"%Z%%M%	%I%	%E% SMI"
-#
 
 include ../Makefile.com
 include ../../../../Makefile.lib.64
 
 DYNFLAGS += $(KRUNPATH64) $(KMECHLIB64)
-LDLIBS += -L $(ROOTLIBDIR) -lgss -lnsl -lsocket -lc
+LDLIBS += -L $(ROOTLIBDIR) -lgss -lnsl -lc
 
 install: all $(ROOTLIBS64) $(ROOTLINKS64)
--- old/usr/src/lib/krb5/kadm5/clnt/i386/Makefile	Sun Aug  5 23:40:56 2018
+++ new/usr/src/lib/krb5/kadm5/clnt/i386/Makefile	Sun Aug  5 23:40:56 2018
@@ -22,12 +22,10 @@
 # Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
 # Use is subject to license terms.
 #
-# ident	"%Z%%M%	%I%	%E% SMI"
-#
 
 include ../Makefile.com
 
 DYNFLAGS += $(KRUNPATH) $(KMECHLIB)
-LDLIBS += -L $(ROOTLIBDIR) -lgss -lnsl -lsocket -lc
- 
+LDLIBS += -L $(ROOTLIBDIR) -lgss -lnsl -lc
+
 install: all $(ROOTLIBS) $(ROOTLINKS)
--- old/usr/src/lib/krb5/kadm5/clnt/sparc/Makefile	Sun Aug  5 23:40:56 2018
+++ new/usr/src/lib/krb5/kadm5/clnt/sparc/Makefile	Sun Aug  5 23:40:56 2018
@@ -22,12 +22,10 @@
 # Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
 # Use is subject to license terms.
 #
-# ident	"%Z%%M%	%I%	%E% SMI"
-#
 
 include ../Makefile.com
 
 DYNFLAGS += $(KRUNPATH) $(KMECHLIB)
-LDLIBS += -L $(ROOTLIBDIR) -lgss -lnsl -lsocket -lc
+LDLIBS += -L $(ROOTLIBDIR) -lgss -lnsl -lc
 
 install: all $(ROOTLIBS) $(ROOTLINKS)
--- old/usr/src/lib/krb5/kadm5/clnt/sparcv9/Makefile	Sun Aug  5 23:40:56 2018
+++ new/usr/src/lib/krb5/kadm5/clnt/sparcv9/Makefile	Sun Aug  5 23:40:57 2018
@@ -22,13 +22,11 @@
 # Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
 # Use is subject to license terms.
 #
-# ident	"%Z%%M%	%I%	%E% SMI"
-#
 
 include ../Makefile.com
 include ../../../../Makefile.lib.64
 
 DYNFLAGS += $(KRUNPATH64) $(KMECHLIB64)
-LDLIBS += -L $(ROOTLIBDIR) -lgss -lnsl -lsocket -lc
+LDLIBS += -L $(ROOTLIBDIR) -lgss -lnsl -lc
 
 install: all $(ROOTLIBS64) $(ROOTLINKS64)
--- old/usr/src/lib/krb5/kadm5/srv/i386/Makefile	Sun Aug  5 23:40:57 2018
+++ new/usr/src/lib/krb5/kadm5/srv/i386/Makefile	Sun Aug  5 23:40:57 2018
@@ -22,8 +22,6 @@
 # Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
 # Use is subject to license terms.
 #
-# ident	"%Z%%M%	%I%	%E% SMI"
-#
 
 include ../Makefile.com
 
@@ -30,6 +28,6 @@
 # library dependency
 DYNFLAGS += $(KRUNPATH) $(KERBRUNPATH) $(KMECHLIB)
 DYNFLAGS += $(KRB5LIB)/libkdb.so $(KRB5LIB)/libdyn.so
-LDLIBS += -L $(ROOTLIBDIR) -lgss -lnsl -lc -lsocket
+LDLIBS += -L $(ROOTLIBDIR) -lgss -lnsl -lc
 
 install: all $(ROOTLIBS) $(ROOTLINKS)
--- old/usr/src/lib/krb5/kadm5/srv/sparc/Makefile	Sun Aug  5 23:40:57 2018
+++ new/usr/src/lib/krb5/kadm5/srv/sparc/Makefile	Sun Aug  5 23:40:57 2018
@@ -22,8 +22,6 @@
 # Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
 # Use is subject to license terms.
 #
-# ident	"%Z%%M%	%I%	%E% SMI"
-#
 
 include ../Makefile.com
 
@@ -30,6 +28,6 @@
 # library dependency
 DYNFLAGS += $(KRUNPATH) $(KERBRUNPATH) $(KMECHLIB)
 DYNFLAGS += $(KRB5LIB)/libkdb.so $(KRB5LIB)/libdyn.so
-LDLIBS += -L $(ROOTLIBDIR) -lgss -lnsl -lc -lsocket
+LDLIBS += -L $(ROOTLIBDIR) -lgss -lnsl -lc
 
 install: all $(ROOTLIBS) $(ROOTLINKS)
--- old/usr/src/lib/libc/Makefile.targ	Sun Aug  5 23:40:57 2018
+++ new/usr/src/lib/libc/Makefile.targ	Sun Aug  5 23:40:57 2018
@@ -205,6 +205,11 @@
 	-I$(LIBCBASE)/../port/gen -o $@ $<
 	$(POST_PROCESS_O)
 
+# socket rules
+pics/%.o: $(LIBCBASE)/../port/socket/%.c
+	$(COMPILE.c) -o $@ $<
+	$(POST_PROCESS_O)
+
 # stdio rules
 pics/%.o: $(LIBCBASE)/../port/stdio/%.c
 	$(COMPILE.c) -o $@ $<
--- old/usr/src/lib/libc/amd64/Makefile	Sun Aug  5 23:40:58 2018
+++ new/usr/src/lib/libc/amd64/Makefile	Sun Aug  5 23:40:58 2018
@@ -622,6 +622,11 @@
 	vwprintf.o		\
 	wprintf.o
 
+PORTSOCKET=			\
+	sockatmark.o		\
+	socket.o		\
+	socketpair.o
+
 # Preserved solely to ease maintenance of 32-bit and 64-bit library builds
 # This macro should ALWAYS be empty; native APIs are already 'large file'.
 PORTSTDIO64=
@@ -975,6 +980,7 @@
 	$(PORTPRINT)		\
 	$(PORTPRINT_W)		\
 	$(PORTREGEX)		\
+	$(PORTSOCKET)		\
 	$(PORTSTDIO)		\
 	$(PORTSTDIO64)		\
 	$(PORTSTDIO_W)		\
@@ -1108,6 +1114,7 @@
 	$(PORTLOCALE:%.o=$(LIBCDIR)/port/locale/%.c)	\
 	$(PORTPRINT:%.o=$(LIBCDIR)/port/print/%.c)	\
 	$(PORTREGEX:%.o=$(LIBCDIR)/port/regex/%.c)	\
+	$(PORTSOCKET:%.o=$(LIBCDIR)/port/socket/%.c)	\
 	$(PORTSTDIO:%.o=$(LIBCDIR)/port/stdio/%.c)	\
 	$(PORTSYS:%.o=$(LIBCDIR)/port/sys/%.c)		\
 	$(AIOOBJS:%.o=$(LIBCDIR)/port/aio/%.c)		\
--- old/usr/src/lib/libc/common/sys/_so_accept.s	Sun Aug  5 23:40:58 2018
+++ new/usr/src/lib/libc/common/sys/_so_accept.s	Sun Aug  5 23:40:58 2018
@@ -31,10 +31,10 @@
 
 	.file	"_so_accept.s"
 
-/* C library -- __so_accept						*/
 /*
- * int __so_accept(int sock, struct sockaddr *addr, int *addrlen, int vers,
- *     int flags)
+ * C library -- __so_accept
+ *
+ * int __so_accept(int, struct sockaddr *, socklen_t *, int, int)
  */
 
 #include "SYS.h"
--- old/usr/src/lib/libc/common/sys/_so_bind.s	Sun Aug  5 23:40:58 2018
+++ new/usr/src/lib/libc/common/sys/_so_bind.s	Sun Aug  5 23:40:58 2018
@@ -18,10 +18,10 @@
  *
  * CDDL HEADER END
  */
+
 /*	Copyright (c) 1988 AT&T	*/
 /*	  All Rights Reserved	*/
 
-
 /*
  * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
@@ -29,8 +29,11 @@
 
 	.file	"_so_bind.s"
 
-/* C library -- _so_bind						*/
-/* int _so_bind (int fildes, struct sockaddr *name, int namelen, int vers); */
+/*
+ * C library -- _so_bind
+ *
+ * int _so_bind(int, const struct sockaddr *, socklen_t, int);
+ */
 
 #include "SYS.h"
 
--- old/usr/src/lib/libc/common/sys/_so_connect.s	Sun Aug  5 23:40:58 2018
+++ new/usr/src/lib/libc/common/sys/_so_connect.s	Sun Aug  5 23:40:58 2018
@@ -29,8 +29,11 @@
 
 	.file	"_so_connect.s"
 
-/* C library -- __so_connect						*/
-/* int __so_connect(int sock, struct sockaddr *addr, int addrlen, int vers) */
+/*
+ * C library -- __so_connect
+ *
+ * int __so_connect(int, const struct sockaddr *, socklen_t, int)
+ */
 
 #include "SYS.h"
 
--- old/usr/src/lib/libc/common/sys/_so_getpeername.s	Sun Aug  5 23:40:59 2018
+++ new/usr/src/lib/libc/common/sys/_so_getpeername.s	Sun Aug  5 23:40:59 2018
@@ -18,10 +18,10 @@
  *
  * CDDL HEADER END
  */
+
 /*	Copyright (c) 1988 AT&T	*/
 /*	  All Rights Reserved	*/
 
-
 /*
  * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
@@ -29,9 +29,11 @@
 
 	.file	"_so_getpeername.s"
 
-/* C library -- _so_getpeername					*/
-/* int _so_getpeername (int fildes, struct sockaddr *name,	*/
-/*			int namelen, int vers);			*/
+/*
+ * C library -- _so_getpeername
+ *
+ * int _so_getpeername(int, struct sockaddr *, socklen_t *, int);
+ */
 
 #include "SYS.h"
 
--- old/usr/src/lib/libc/common/sys/_so_getsockname.s	Sun Aug  5 23:40:59 2018
+++ new/usr/src/lib/libc/common/sys/_so_getsockname.s	Sun Aug  5 23:40:59 2018
@@ -18,10 +18,10 @@
  *
  * CDDL HEADER END
  */
+
 /*	Copyright (c) 1988 AT&T	*/
 /*	  All Rights Reserved	*/
 
-
 /*
  * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
@@ -29,9 +29,11 @@
 
 	.file	"_so_getsockname.s"
 
-/* C library -- _so_getsockname						*/
-/* int _so_getsockname (int fildes, struct sockaddr *name, int namelen,	*/
-/*			int vers);					*/
+/*
+ * C library -- _so_getsockname
+ *
+ * int _so_getsockname(int, struct sockaddr *, socklen_t *, int);
+ */
 
 #include "SYS.h"
 
--- old/usr/src/lib/libc/common/sys/_so_getsockopt.s	Sun Aug  5 23:40:59 2018
+++ new/usr/src/lib/libc/common/sys/_so_getsockopt.s	Sun Aug  5 23:40:59 2018
@@ -18,10 +18,10 @@
  *
  * CDDL HEADER END
  */
+
 /*	Copyright (c) 1988 AT&T	*/
 /*	  All Rights Reserved	*/
 
-
 /*
  * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
@@ -29,9 +29,11 @@
 
 	.file	"_so_getsockopt.s"
 
-/* C library -- _so_getsockopt					*/
-/* int _so_getsockopt (int socket, int level, int option_name,	*/
-/*	 void *option_value, size_t *option_len, int vers);	*/
+/*
+ * C library -- _so_getsockopt
+ *
+ * int _so_getsockopt(int, int, int, void *, socklen_t *, int);
+ */
 
 #include "SYS.h"
 
--- old/usr/src/lib/libc/common/sys/_so_listen.s	Sun Aug  5 23:40:59 2018
+++ new/usr/src/lib/libc/common/sys/_so_listen.s	Sun Aug  5 23:40:59 2018
@@ -18,10 +18,10 @@
  *
  * CDDL HEADER END
  */
+
 /*	Copyright (c) 1988 AT&T	*/
 /*	  All Rights Reserved	*/
 
-
 /*
  * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
@@ -29,8 +29,11 @@
 
 	.file	"_so_listen.s"
 
-/* C library -- _so_listen					*/
-/* int _so_listen (int socket, int backlog, int vers);	 	*/
+/*
+ * C library -- _so_listen
+ *
+ * int _so_listen(int, int, int);
+ */
 
 #include "SYS.h"
 
--- old/usr/src/lib/libc/common/sys/_so_recv.s	Sun Aug  5 23:41:00 2018
+++ new/usr/src/lib/libc/common/sys/_so_recv.s	Sun Aug  5 23:41:00 2018
@@ -29,8 +29,11 @@
 
 	.file	"_so_recv.s"
 
-/* C library -- _so_recv						*/
-/* int __so_recv(int sock, void *buffer, size_t len, int flags)		*/
+/*
+ * C library -- __so_recv
+ *
+ * ssize_t __so_recv(int, void *, size_t, int)
+ */
 
 #include "SYS.h"
 
--- old/usr/src/lib/libc/common/sys/_so_recvfrom.s	Sun Aug  5 23:41:00 2018
+++ new/usr/src/lib/libc/common/sys/_so_recvfrom.s	Sun Aug  5 23:41:00 2018
@@ -29,10 +29,11 @@
 
 	.file	"_so_recvfrom.s"
 
-/* C library -- __so_recvfrom					*/
 /*
- * int __so_recvfrom(int sock, void *buffer, size_t len, int flags,
- *		 struct sockaddr *addr, size_t *addrlen)
+ * C library -- __so_recvfrom
+ *
+ * ssize_t __so_recvfrom(int, void *, size_t, int, struct sockaddr *,
+ *     socklen_t *)
  */
 
 #include "SYS.h"
--- old/usr/src/lib/libc/common/sys/_so_recvmsg.s	Sun Aug  5 23:41:00 2018
+++ new/usr/src/lib/libc/common/sys/_so_recvmsg.s	Sun Aug  5 23:41:00 2018
@@ -29,8 +29,11 @@
 
 	.file	"_so_recvmsg.s"
 
-/* C library -- __so_recvmsg					*/
-/* int __so_recvmsg(int sock, struct msghdr *msg, int flags)	*/
+/*
+ * C library -- __so_recvmsg
+ *
+ * ssize_t __so_recvmsg(int, struct msghdr *, int)
+ */
 
 #include "SYS.h"
 
--- old/usr/src/lib/libc/common/sys/_so_send.s	Sun Aug  5 23:41:01 2018
+++ new/usr/src/lib/libc/common/sys/_so_send.s	Sun Aug  5 23:41:01 2018
@@ -29,8 +29,11 @@
 
 	.file	"_so_send.s"
 
-/* C library -- __so_send						*/
-/* int __so_send(int socket, const void *buffer, size_t len, int flags)	*/
+/*
+ * C library -- __so_send
+ *
+ * ssize_t __so_send(int, const void *, size_t, int)
+ */
 
 #include "SYS.h"
 
--- old/usr/src/lib/libc/common/sys/_so_sendmsg.s	Sun Aug  5 23:41:01 2018
+++ new/usr/src/lib/libc/common/sys/_so_sendmsg.s	Sun Aug  5 23:41:01 2018
@@ -29,8 +29,11 @@
 
 	.file	"_so_sendmsg.s"
 
-/* C library -- __so_sendmsg						*/
-/* int __so_sendmsg(int sock, const struct msghdr *msg, int flags)	*/
+/*
+ * C library -- __so_sendmsg
+ *
+ * ssize_t __so_sendmsg(int, const struct msghdr *, int)
+ */
 
 #include "SYS.h"
 
--- old/usr/src/lib/libc/common/sys/_so_sendto.s	Sun Aug  5 23:41:01 2018
+++ new/usr/src/lib/libc/common/sys/_so_sendto.s	Sun Aug  5 23:41:01 2018
@@ -29,10 +29,11 @@
 
 	.file	"_so_sendto.s"
 
-/* C library -- __so_sendto					*/
 /*
- * int __so_sendto(int sock, const void *buffer, size_t len, int flags,
- *		 const struct sockaddr *addr, int addrlen);
+ * C library -- __so_sendto
+ *
+ * ssize_t __so_sendto(int, const void *, size_t, int, const struct sockaddr *,
+ *     socklen_t);
  */
 
 #include "SYS.h"
--- old/usr/src/lib/libc/common/sys/_so_setsockopt.s	Sun Aug  5 23:41:01 2018
+++ new/usr/src/lib/libc/common/sys/_so_setsockopt.s	Sun Aug  5 23:41:01 2018
@@ -29,9 +29,11 @@
 
 	.file	"_so_setsockopt.s"
 
-/* C library -- _so_setsockopt					*/
-/* int _so_setsockopt (int socket, int level, int option_name,	*/
-/*	 void *option_value, size_t option_len, int vers);	*/
+/*
+ * C library -- _so_setsockopt
+ *
+ * int _so_setsockopt(int, int, int, const void *, socklen_t, int);
+ */
 
 #include "SYS.h"
 
--- old/usr/src/lib/libc/common/sys/_so_shutdown.s	Sun Aug  5 23:41:02 2018
+++ new/usr/src/lib/libc/common/sys/_so_shutdown.s	Sun Aug  5 23:41:02 2018
@@ -29,8 +29,11 @@
 
 	.file	"_so_shutdown.s"
 
-/* C library -- _so_shutdown					*/
-/* int _so_shutdown (int fildes, int how, int vers);		*/
+/*
+ * C library -- _so_shutdown
+ *
+ * int _so_shutdown (int, int, int);
+ */
 
 #include "SYS.h"
 
--- old/usr/src/lib/libc/common/sys/_so_socket.s	Sun Aug  5 23:41:02 2018
+++ new/usr/src/lib/libc/common/sys/_so_socket.s	Sun Aug  5 23:41:02 2018
@@ -29,10 +29,10 @@
 
 	.file	"_so_socket.s"
 
-/* C library -- _so_socket					*/
 /*
- * int _so_socket (int domain, int type, int protocol,
- *			dev_t dev, int version);
+ * C library -- _so_socket
+ *
+ * int _so_socket(int, int, int, dev_t, int);
  */
 
 #include "SYS.h"
--- old/usr/src/lib/libc/common/sys/_so_socketpair.s	Sun Aug  5 23:41:02 2018
+++ new/usr/src/lib/libc/common/sys/_so_socketpair.s	Sun Aug  5 23:41:02 2018
@@ -18,10 +18,10 @@
  *
  * CDDL HEADER END
  */
+
 /*	Copyright (c) 1988 AT&T	*/
 /*	  All Rights Reserved	*/
 
-
 /*
  * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
@@ -29,9 +29,10 @@
 
 	.file	"_so_socketpair.s"
 
-/* C library -- _so_socketpair					*/
 /*
- * int _so_socketpair (int sv[2]);
+ * C library -- _so_socketpair
+ *
+ * int _so_socketpair(int *);
  */
 
 #include "SYS.h"
--- old/usr/src/lib/libc/i386/Makefile.com	Sun Aug  5 23:41:02 2018
+++ new/usr/src/lib/libc/i386/Makefile.com	Sun Aug  5 23:41:02 2018
@@ -662,6 +662,11 @@
 	vsprintf_c89.o		\
 	vwprintf_c89.o
 
+PORTSOCKET=			\
+	sockatmark.o		\
+	socket.o		\
+	socketpair.o
+
 PORTSTDIO_C89=			\
 	vscanf_c89.o		\
 	vwscanf_c89.o		\
@@ -1016,6 +1021,7 @@
 	$(PORTPRINT_W)		\
 	$(PORTREGEX)		\
 	$(PORTREGEX64)		\
+	$(PORTSOCKET)		\
 	$(PORTSTDIO)		\
 	$(PORTSTDIO64)		\
 	$(PORTSTDIO_C89)	\
@@ -1171,6 +1177,7 @@
 	$(PORTLOCALE:%.o=$(LIBCDIR)/port/locale/%.c)	\
 	$(PORTPRINT:%.o=$(LIBCDIR)/port/print/%.c)	\
 	$(PORTREGEX:%.o=$(LIBCDIR)/port/regex/%.c)	\
+	$(PORTSOCKET:%.o=$(LIBCDIR)/port/socket/%.c)	\
 	$(PORTSTDIO:%.o=$(LIBCDIR)/port/stdio/%.c)	\
 	$(PORTSYS:%.o=$(LIBCDIR)/port/sys/%.c)		\
 	$(AIOOBJS:%.o=$(LIBCDIR)/port/aio/%.c)		\
--- old/usr/src/lib/libc/inc/libc.h	Sun Aug  5 23:41:03 2018
+++ new/usr/src/lib/libc/inc/libc.h	Sun Aug  5 23:41:03 2018
@@ -200,16 +200,6 @@
 extern greg_t _getsp(void);
 
 /*
- * defined in _so_setsockopt.s
- */
-extern int _so_setsockopt(int, int, int, const char *, int);
-
-/*
- * defined in _so_getsockopt.s
- */
-extern int _so_getsockopt(int, int, int, char *, int *);
-
-/*
  * defined in lsign.s
  */
 extern int lsign(dl_t);
--- old/usr/src/lib/libc/port/mapfile-vers	Sun Aug  5 23:41:03 2018
+++ new/usr/src/lib/libc/port/mapfile-vers	Sun Aug  5 23:41:03 2018
@@ -77,6 +77,29 @@
 $add amd64
 $endif
 
+SYMBOL_VERSION ILLUMOS_0.26 {	# socket moved from libsocket
+    protected:
+	accept4;
+	accept;
+	bind;
+	connect;
+	getpeername;
+	getsockname;
+	getsockopt;
+	listen;
+	recv;
+	recvfrom;
+	recvmsg;
+	send;
+	sendmsg;
+	sendto;
+	setsockopt;
+	sockatmark;
+	socketpair;
+	shutdown;
+	socket;
+} ILLUMOS_0.25;
+
 SYMBOL_VERSION ILLUMOS_0.25 {	# inet_* moved from libnsl/libsocket
     protected:
 	inet_addr;
@@ -2909,10 +2932,12 @@
 $endif
 
     protected:
+	_accept;
+	_accept4;
 	acctctl;
 	allocids;
-	_assert_c99;
 	__assert_c99;
+	_assert_c99;
 	_assfail;
 	attr_count;
 	attr_to_data_type;
@@ -2920,9 +2945,11 @@
 	attr_to_option;
 	attr_to_xattr_view;
 	_autofssys;
+	_bind;
 	_bufsync;
 	_cladm;
 	__class_quadruple;
+	_connect;
 	core_get_default_content;
 	core_get_default_path;
 	core_get_global_content;
@@ -2989,7 +3016,10 @@
 	_getfp;
 	_getgroupsbymember;
 	_getlogin_r;
+	_getpeername;
 	getrandom;
+	_getsockname;
+	_getsockopt;
 	_getsp;
 	__gettsp;
 	getvmusage;
@@ -3014,6 +3044,7 @@
 	klpd_unregister_id;
 	_lgrp_home_fast		{ FLAGS = NODYNSORT };
 	_lgrpsys;
+	_listen;
 	_lltostr;
 	_lock_clear;
 	_lock_try;
@@ -3065,6 +3096,9 @@
 	__priv_bracket;
 	__priv_relinquish;
 	psecflags;
+	psecflags_default;
+	psecflags_validate;
+	psecflags_validate_delta;
 	pset_assign_forced;
 	pset_bind_lwp;
 	_psignal;
@@ -3076,6 +3110,9 @@
 	rctlctl;
 	rctllist;
 	_realbufend;
+	_recv;
+	_recvfrom;
+	_recvmsg;
 	_resume;
 	_resume_ret;
 	_rpcsys;
@@ -3083,35 +3120,37 @@
 	scrwidth;
 	secflag_by_name;
 	secflag_clear;
+	secflag_isset;
 	secflags_copy;
 	secflags_difference;
+	secflag_set;
 	secflags_fullset;
 	secflags_intersection;
 	secflags_isempty;
-	secflag_isset;
 	secflags_issubset;
 	secflags_issuperset;
-	secflag_set;
-	secflag_to_bit;
-	secflag_to_str;
-	secflags_union;
-	psecflags_validate_delta;
-	secflags_zero;
-	psecflags_default;
 	secflags_parse;
 	secflags_to_str;
-	psecflags_validate;
-	semctl64;
+	secflags_union;
+	secflags_zero;
+	secflag_to_bit;
+	secflag_to_str;
 	_semctl64;
-	set_setcontext_enforcement;
+	semctl64;
+	_send;
+	_sendmsg;
+	_sendto;
 	_setbufend;
 	__set_errno;
 	setprojrctl;
 	_setregid;
 	_setreuid;
+	set_setcontext_enforcement;
 	setsigacthandler;
-	shmctl64;
+	_setsockopt;
 	_shmctl64;
+	shmctl64;
+	_shutdown;
 	sigflag;
 	_signal;
 	_sigoff;
@@ -3119,6 +3158,10 @@
 	_so_accept;
 	_so_bind;
 	_sockconfig;
+	_socket;
+	_socket_bsd;
+	_socketpair;
+	_socketpair_bsd;
 	_so_connect;
 	_so_getpeername;
 	_so_getsockname;
@@ -3142,51 +3185,51 @@
 	syscall;
 	_sysconfig;
 	__systemcall;
-	thr_continue_allmutators;
 	_thr_continue_allmutators;
-	thr_continue_mutator;
+	thr_continue_allmutators;
 	_thr_continue_mutator;
-	thr_getstate;
+	thr_continue_mutator;
 	_thr_getstate;
-	thr_mutators_barrier;
+	thr_getstate;
 	_thr_mutators_barrier;
+	thr_mutators_barrier;
 	thr_probe_setup;
 	_thr_schedctl;
-	thr_setmutator;
 	_thr_setmutator;
-	thr_setstate;
+	thr_setmutator;
 	_thr_setstate;
-	thr_sighndlrinfo;
+	thr_setstate;
 	_thr_sighndlrinfo;
+	thr_sighndlrinfo;
 	_thr_slot_offset;
-	thr_suspend_allmutators;
 	_thr_suspend_allmutators;
-	thr_suspend_mutator;
+	thr_suspend_allmutators;
 	_thr_suspend_mutator;
-	thr_wait_mutator;
+	thr_suspend_mutator;
 	_thr_wait_mutator;
+	thr_wait_mutator;
 	__tls_get_addr;
 	_tmem_get_base;
 	_tmem_get_nentries;
 	_tmem_set_cleanup;
 	tpool_create;
-	tpool_dispatch;
 	tpool_destroy;
-	tpool_wait;
+	tpool_dispatch;
+	tpool_member;
+	tpool_resume;
 	tpool_suspend;
 	tpool_suspended;
-	tpool_resume;
-	tpool_member;
+	tpool_wait;
 	_ttyname_dev;
 	_ucred_alloc;
-	ucred_getamask;
 	_ucred_getamask;
-	ucred_getasid;
+	ucred_getamask;
 	_ucred_getasid;
-	ucred_getatid;
+	ucred_getasid;
 	_ucred_getatid;
-	ucred_getauid;
+	ucred_getatid;
 	_ucred_getauid;
+	ucred_getauid;
 	_ulltostr;
 	_uncached_getgrgid_r;
 	_uncached_getgrnam_r;
@@ -3209,6 +3252,15 @@
 	_wrtchk;
 	_xflsbuf;
 	_xgetwidth;
+	__xnet_bind;
+	__xnet_connect;
+	__xnet_getsockopt;
+	__xnet_listen;
+	__xnet_recvmsg;
+	__xnet_sendmsg;
+	__xnet_sendto;
+	__xnet_socket;
+	__xnet_socketpair;
 	zone_add_datalink;
 	zone_boot;
 	zone_check_datalink;
--- old/usr/src/lib/libsocket/socket/sockatmark.c	Sun Aug  5 23:41:03 2018
+++ /dev/null	Sun Aug  5 23:40:50 2018
@@ -1,46 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (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]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright 2003 Sun Microsystems, Inc.  All rights reserved.
- * Use is subject to license terms.
- */
-
-#pragma ident	"%Z%%M%	%I%	%E% SMI"
-
-#include <sys/sockio.h>
-#include <unistd.h>
-
-#pragma weak sockatmark = _sockatmark
-
-/*
- * Determine whether the socket is at the out-of-band
- * data mark.
- */
-int
-_sockatmark(int sock)
-{
-	int val;
-
-	if (ioctl(sock, SIOCATMARK, &val) == -1)
-		return (-1);
-	return (val);
-}
--- /dev/null	Sun Aug  5 23:40:50 2018
+++ new/usr/src/lib/libc/port/socket/sockatmark.c	Sun Aug  5 23:41:03 2018
@@ -0,0 +1,44 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (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]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2003 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#include <sys/sockio.h>
+#include <unistd.h>
+
+#pragma weak sockatmark = _sockatmark
+
+/*
+ * Determine whether the socket is at the out-of-band
+ * data mark.
+ */
+int
+_sockatmark(int sock)
+{
+	int val;
+
+	if (ioctl(sock, SIOCATMARK, &val) == -1)
+		return (-1);
+	return (val);
+}
--- /dev/null	Sun Aug  5 23:41:04 2018
+++ new/usr/src/lib/libc/port/socket/socket.c	Sun Aug  5 23:41:04 2018
@@ -0,0 +1,303 @@
+/*
+ * CDDL HEADER START
+ *
+ * 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]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+/*
+ * Copyright (c) 2013, OmniTI Computer Consulting, Inc. All rights reserved.
+ * Copyright 2018 Nexenta Systems, Inc.
+ */
+
+#include "lint.h"
+
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <sys/stropts.h>
+#include <sys/stream.h>
+#include <sys/socketvar.h>
+#include <sys/sockio.h>
+
+#include <errno.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <stropts.h>
+#include <stdio.h>
+#include <strings.h>
+#include <netinet/sctp.h>
+
+#pragma weak accept = _accept
+#pragma weak accept4 = _accept4
+#pragma weak bind = _bind
+#pragma weak connect = _connect
+#pragma weak getpeername = _getpeername
+#pragma weak getsockname = _getsockname
+#pragma weak getsockopt = _getsockopt
+#pragma weak listen = _listen
+#pragma weak recv = _recv
+#pragma weak recvfrom = _recvfrom
+#pragma weak recvmsg = _recvmsg
+#pragma weak send = _send
+#pragma weak sendmsg = _sendmsg
+#pragma weak sendto = _sendto
+#pragma weak setsockopt = _setsockopt
+#pragma weak shutdown = _shutdown
+#pragma weak socket = _socket
+
+extern int _so_accept(int, struct sockaddr *, socklen_t *, int, int);
+extern int _so_bind(int, const struct sockaddr *, socklen_t, int);
+extern int _so_connect(int, const struct sockaddr *, socklen_t, int);
+extern int _so_getpeername(int, struct sockaddr *, socklen_t *,
+    int);
+extern int _so_getsockname(int, struct sockaddr *, socklen_t *,
+    int);
+extern int _so_getsockopt(int, int, int, void *, socklen_t *, int);
+extern int _so_listen(int, int, int);
+extern ssize_t _so_recv(int, void *, size_t, int);
+extern ssize_t _so_recvfrom(int, void *, size_t, int, struct sockaddr *,
+    socklen_t *);
+extern ssize_t _so_recvmsg(int, struct msghdr *, int);
+extern ssize_t _so_send(int, const void *, size_t, int);
+extern ssize_t _so_sendmsg(int, const struct msghdr *, int);
+extern ssize_t _so_sendto(int, const void *, size_t, int,
+    const struct sockaddr *, socklen_t);
+extern int _so_setsockopt(int, int, int, const void *, socklen_t, int);
+extern int _so_shutdown(int, int, int);
+extern int _so_socket(int, int, int, dev_t, int);
+
+int
+_accept(int sock, struct sockaddr *_RESTRICT_KYWD addr, socklen_t *addrlen)
+{
+	return (_so_accept(sock, addr, addrlen, SOV_DEFAULT, 0));
+}
+
+int
+_accept4(int sock, struct sockaddr *_RESTRICT_KYWD addr, socklen_t *addrlen,
+    int flags)
+{
+	return (_so_accept(sock, addr, addrlen, SOV_DEFAULT, flags));
+}
+
+/*
+ * Note that regular sockets use SOV_SOCKBSD here to not allow a rebind of an
+ * already bound socket.
+ */
+int
+_bind(int sock, const struct sockaddr *addr, socklen_t addrlen)
+{
+	return (_so_bind(sock, addr, addrlen, SOV_SOCKBSD));
+}
+
+int
+_connect(int sock, const struct sockaddr *addr, socklen_t addrlen)
+{
+	return (_so_connect(sock, addr, addrlen, SOV_DEFAULT));
+}
+
+int
+_getpeername(int sock, struct sockaddr *_RESTRICT_KYWD name, socklen_t *namelen)
+{
+	return (_so_getpeername(sock, name, namelen, SOV_DEFAULT));
+}
+
+int
+_getsockname(int sock, struct sockaddr *_RESTRICT_KYWD name, socklen_t *namelen)
+{
+	return (_so_getsockname(sock, name, namelen, SOV_DEFAULT));
+}
+
+int
+_getsockopt(int sock, int level, int optname, void *_RESTRICT_KYWD optval,
+    socklen_t *optlen)
+{
+	if (level == IPPROTO_SCTP) {
+		sctp_assoc_t id = 0;
+		socklen_t len = *optlen;
+		int err = 0;
+		struct sctpopt sopt;
+
+		switch (optname) {
+		case SCTP_RTOINFO:
+		case SCTP_ASSOCINFO:
+		case SCTP_SET_PEER_PRIMARY_ADDR:
+		case SCTP_PRIMARY_ADDR:
+		case SCTP_PEER_ADDR_PARAMS:
+		case SCTP_STATUS:
+		case SCTP_GET_PEER_ADDR_INFO:
+			/*
+			 * Association ID is the first element params struct
+			 */
+			bcopy(optval, &id, sizeof (id));
+			break;
+		case SCTP_DEFAULT_SEND_PARAM:
+			bcopy(&((struct sctp_sndrcvinfo *)
+			    optval)->sinfo_assoc_id, &id, sizeof (id));
+			break;
+		}
+
+		sopt.sopt_aid = id;
+		sopt.sopt_name = optname;
+		sopt.sopt_val = optval;
+		sopt.sopt_len = len;
+		if (ioctl(sock, SIOCSCTPGOPT, &sopt) == -1) {
+			err = -1;
+		} else {
+			*optlen = sopt.sopt_len;
+		}
+		return (err);
+	} else {
+		return (_so_getsockopt(sock, level, optname, optval, optlen,
+		    SOV_DEFAULT));
+	}
+}
+
+int
+_listen(int sock, int backlog)
+{
+	return (_so_listen(sock, backlog, SOV_DEFAULT));
+}
+
+ssize_t
+_recv(int sock, void *buf, size_t len, int flags)
+{
+	return (_so_recv(sock, buf, len, flags & ~MSG_XPG4_2));
+}
+
+int
+_recvfrom(int sock, void *_RESTRICT_KYWD buf, size_t len, int flags,
+    struct sockaddr *_RESTRICT_KYWD addr, socklen_t *addrlen)
+{
+	return (_so_recvfrom(sock, buf, len, flags & ~MSG_XPG4_2,
+	    addr, addrlen));
+}
+
+ssize_t
+_recvmsg(int sock, struct msghdr *msg, int flags)
+{
+	return (_so_recvmsg(sock, msg, flags & ~MSG_XPG4_2));
+}
+
+ssize_t
+_send(int sock, const void *buf, size_t len, int flags)
+{
+	return (_so_send(sock, buf, len, flags & ~MSG_XPG4_2));
+}
+
+ssize_t
+_sendmsg(int sock, const struct msghdr *msg, int flags)
+{
+	return (_so_sendmsg(sock, msg, flags & ~MSG_XPG4_2));
+}
+
+ssize_t
+_sendto(int sock, const void *buf, size_t len, int flags,
+    const struct sockaddr *addr, socklen_t addrlen)
+{
+	return (_so_sendto(sock, buf, len, flags & ~MSG_XPG4_2, addr, addrlen));
+}
+
+int
+_setsockopt(int sock, int level, int optname, const void *optval,
+    socklen_t optlen)
+{
+	return (_so_setsockopt(sock, level, optname, optval, optlen,
+	    SOV_DEFAULT));
+}
+
+int
+_shutdown(int sock, int how)
+{
+	return (_so_shutdown(sock, how, SOV_DEFAULT));
+}
+
+int
+_socket(int family, int type, int protocol)
+{
+	return (_so_socket(family, type, protocol, NULL, SOV_DEFAULT));
+}
+
+/*
+ * Used by the BCP library.
+ */
+int
+_socket_bsd(int family, int type, int protocol)
+{
+	return (_so_socket(family, type, protocol, NULL, SOV_SOCKBSD));
+}
+
+
+int
+__xnet_bind(int sock, const struct sockaddr *addr, socklen_t addrlen)
+{
+	return (_so_bind(sock, addr, addrlen, SOV_XPG4_2));
+}
+
+int
+__xnet_connect(int sock, const struct sockaddr *addr, socklen_t addrlen)
+{
+	return (_so_connect(sock, addr, addrlen, SOV_XPG4_2));
+}
+
+int
+__xnet_getsockopt(int sock, int level, int optname, void *optval,
+    socklen_t *optlen)
+{
+	if (level == IPPROTO_SCTP) {
+		return (_getsockopt(sock, level, optname, optval, optlen));
+	} else {
+		return (_so_getsockopt(sock, level, optname, optval, optlen,
+		    SOV_XPG4_2));
+	}
+}
+
+int
+__xnet_listen(int sock, int backlog)
+{
+	return (_so_listen(sock, backlog, SOV_XPG4_2));
+}
+
+int
+__xnet_recvmsg(int sock, struct msghdr *msg, int flags)
+{
+	return (_so_recvmsg(sock, msg, flags | MSG_XPG4_2));
+}
+
+int
+__xnet_sendmsg(int sock, const struct msghdr *msg, int flags)
+{
+	return (_so_sendmsg(sock, msg, flags | MSG_XPG4_2));
+}
+
+int
+__xnet_sendto(int sock, const void *buf, size_t len, int flags,
+	const struct sockaddr *addr, socklen_t addrlen)
+{
+	return (_so_sendto(sock, buf, len, flags | MSG_XPG4_2,
+	    addr, addrlen));
+}
+
+int
+__xnet_socket(int family, int type, int protocol)
+{
+	return (_so_socket(family, type, protocol, NULL, SOV_XPG4_2));
+}
--- old/usr/src/lib/libsocket/socket/socketpair.c	Sun Aug  5 23:41:04 2018
+++ /dev/null	Sun Aug  5 23:41:04 2018
@@ -1,130 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (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]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright 1997 Sun Microsystems, Inc.  All rights reserved.
- * Use is subject to license terms.
- */
-
-/*	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/*	  All Rights Reserved   */
-
-/*
- * University Copyright- Copyright (c) 1982, 1986, 1988
- * The Regents of the University of California
- * All Rights Reserved
- *
- * University Acknowledgment- Portions of this document are derived from
- * software developed by the University of California, Berkeley, and its
- * contributors.
- */
-
-#pragma ident	"%Z%%M%	%I%	%E% SMI"
-
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <sys/stropts.h>
-#include <sys/stream.h>
-#include <sys/socketvar.h>
-#include <errno.h>
-#include <unistd.h>
-#include <stdlib.h>
-
-extern int _socket_create(int, int, int, int);
-extern int _so_socketpair(int*);
-
-int _socketpair_create(int, int, int, int*, int);
-
-#pragma weak socketpair = _socketpair
-
-int
-_socketpair(int family, int type, int protocol, int sv[2])
-{
-	return (_socketpair_create(family, type, protocol, sv, SOV_DEFAULT));
-}
-
-/*
- * Used by the BCP library.
- */
-int
-_socketpair_bsd(int family, int type, int protocol, int sv[2])
-{
-	return (_socketpair_create(family, type, protocol, sv, SOV_SOCKBSD));
-}
-
-int
-_socketpair_svr4(int family, int type, int protocol, int sv[2])
-{
-	return (_socketpair_create(family, type, protocol, sv,
-				SOV_SOCKSTREAM));
-}
-
-int
-__xnet_socketpair(int family, int type, int protocol, int sv[2])
-{
-	return (_socketpair_create(family, type, protocol, sv,
-				SOV_XPG4_2));
-}
-
-int
-_socketpair_create(int family, int type, int protocol, int sv[2], int version)
-{
-	int res;
-	int fd1, fd2;
-
-	/*
-	 * Create the two sockets and pass them to _so_socketpair, which
-	 * will connect them together.
-	 */
-	fd1 = _socket_create(family, type, protocol, version);
-	if (fd1 < 0)
-		return (-1);
-	fd2 = _socket_create(family, type, protocol, version);
-	if (fd2 < 0) {
-		int error = errno;
-
-		(void) close(fd1);
-		errno = error;
-		return (-1);
-	}
-	sv[0] = fd1;
-	sv[1] = fd2;
-	res = _so_socketpair(sv);
-	if (res < 0) {
-		int error = errno;
-
-		(void) close(fd1);
-		(void) close(fd2);
-		errno = error;
-		return (-1);
-	}
-	/*
-	 * Check if kernel returned different fds in which case we close
-	 * the original ones. This is the case for SOCK_STREAM where
-	 * one of the original sockets is used as a listener and
-	 * _so_socketpair passes out the newly accepted socket.
-	 */
-	if (sv[0] != fd1)
-		(void) close(fd1);
-	if (sv[1] != fd2)
-		(void) close(fd2);
-	return (res);
-}
--- /dev/null	Sun Aug  5 23:41:04 2018
+++ new/usr/src/lib/libc/port/socket/socketpair.c	Sun Aug  5 23:41:04 2018
@@ -0,0 +1,128 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (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]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 1997 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+/*	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
+/*	  All Rights Reserved   */
+
+/*
+ * University Copyright- Copyright (c) 1982, 1986, 1988
+ * The Regents of the University of California
+ * All Rights Reserved
+ *
+ * University Acknowledgment- Portions of this document are derived from
+ * software developed by the University of California, Berkeley, and its
+ * contributors.
+ */
+
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <sys/stropts.h>
+#include <sys/stream.h>
+#include <sys/socketvar.h>
+#include <errno.h>
+#include <unistd.h>
+#include <stdlib.h>
+
+extern int _so_socket(int, int, int, dev_t, int);
+extern int _so_socketpair(int *);
+
+int _socketpair_create(int, int, int, int*, int);
+
+#pragma weak socketpair = _socketpair
+
+int
+_socketpair(int family, int type, int protocol, int sv[2])
+{
+	return (_socketpair_create(family, type, protocol, sv, SOV_DEFAULT));
+}
+
+/*
+ * Used by the BCP library.
+ */
+int
+_socketpair_bsd(int family, int type, int protocol, int sv[2])
+{
+	return (_socketpair_create(family, type, protocol, sv, SOV_SOCKBSD));
+}
+
+int
+_socketpair_svr4(int family, int type, int protocol, int sv[2])
+{
+	return (_socketpair_create(family, type, protocol, sv,
+				SOV_SOCKSTREAM));
+}
+
+int
+__xnet_socketpair(int family, int type, int protocol, int sv[2])
+{
+	return (_socketpair_create(family, type, protocol, sv,
+				SOV_XPG4_2));
+}
+
+int
+_socketpair_create(int family, int type, int protocol, int sv[2], int version)
+{
+	int res;
+	int fd1, fd2;
+
+	/*
+	 * Create the two sockets and pass them to _so_socketpair, which
+	 * will connect them together.
+	 */
+	fd1 = _so_socket(family, type, protocol, NULL, version);
+	if (fd1 < 0)
+		return (-1);
+	fd2 = _so_socket(family, type, protocol, NULL, version);
+	if (fd2 < 0) {
+		int error = errno;
+
+		(void) close(fd1);
+		errno = error;
+		return (-1);
+	}
+	sv[0] = fd1;
+	sv[1] = fd2;
+	res = _so_socketpair(sv);
+	if (res < 0) {
+		int error = errno;
+
+		(void) close(fd1);
+		(void) close(fd2);
+		errno = error;
+		return (-1);
+	}
+	/*
+	 * Check if kernel returned different fds in which case we close
+	 * the original ones. This is the case for SOCK_STREAM where
+	 * one of the original sockets is used as a listener and
+	 * _so_socketpair passes out the newly accepted socket.
+	 */
+	if (sv[0] != fd1)
+		(void) close(fd1);
+	if (sv[1] != fd2)
+		(void) close(fd2);
+	return (res);
+}
--- old/usr/src/lib/libc/port/threads/scalls.c	Sun Aug  5 23:41:04 2018
+++ new/usr/src/lib/libc/port/threads/scalls.c	Sun Aug  5 23:41:04 2018
@@ -1067,10 +1067,10 @@
 }
 
 int
-_so_accept(int sock, struct sockaddr *addr, uint_t *addrlen, int version,
-    int flags)
+_so_accept(int sock, struct sockaddr *addr, socklen_t *addrlen,
+    int version, int flags)
 {
-	extern int __so_accept(int, struct sockaddr *, uint_t *, int, int);
+	extern int __so_accept(int, struct sockaddr *, socklen_t *, int, int);
 	int rv;
 
 	PERFORM(__so_accept(sock, addr, addrlen, version, flags))
@@ -1077,67 +1077,68 @@
 }
 
 int
-_so_connect(int sock, struct sockaddr *addr, uint_t addrlen, int version)
+_so_connect(int sock, const struct sockaddr *addr, socklen_t addrlen,
+    int version)
 {
-	extern int __so_connect(int, struct sockaddr *, uint_t, int);
+	extern int __so_connect(int, const struct sockaddr *, socklen_t, int);
 	int rv;
 
 	PERFORM(__so_connect(sock, addr, addrlen, version))
 }
 
-int
+ssize_t
 _so_recv(int sock, void *buf, size_t len, int flags)
 {
-	extern int __so_recv(int, void *, size_t, int);
+	extern ssize_t __so_recv(int, void *, size_t, int);
 	int rv;
 
 	PERFORM(__so_recv(sock, buf, len, flags))
 }
 
-int
-_so_recvfrom(int sock, void *buf, size_t len, int flags,
-    struct sockaddr *addr, int *addrlen)
+ssize_t
+_so_recvfrom(int sock, void *buf, size_t len, int flags, struct sockaddr *addr,
+    socklen_t *addrlen)
 {
-	extern int __so_recvfrom(int, void *, size_t, int,
-	    struct sockaddr *, int *);
+	extern ssize_t __so_recvfrom(int, void *, size_t, int,
+	    struct sockaddr *, socklen_t *);
 	int rv;
 
 	PERFORM(__so_recvfrom(sock, buf, len, flags, addr, addrlen))
 }
 
-int
+ssize_t
 _so_recvmsg(int sock, struct msghdr *msg, int flags)
 {
-	extern int __so_recvmsg(int, struct msghdr *, int);
+	extern ssize_t __so_recvmsg(int, struct msghdr *, int);
 	int rv;
 
 	PERFORM(__so_recvmsg(sock, msg, flags))
 }
 
-int
+ssize_t
 _so_send(int sock, const void *buf, size_t len, int flags)
 {
-	extern int __so_send(int, const void *, size_t, int);
+	extern ssize_t __so_send(int, const void *, size_t, int);
 	int rv;
 
 	PERFORM(__so_send(sock, buf, len, flags))
 }
 
-int
+ssize_t
 _so_sendmsg(int sock, const struct msghdr *msg, int flags)
 {
-	extern int __so_sendmsg(int, const struct msghdr *, int);
+	extern ssize_t __so_sendmsg(int, const struct msghdr *, int);
 	int rv;
 
 	PERFORM(__so_sendmsg(sock, msg, flags))
 }
 
-int
+ssize_t
 _so_sendto(int sock, const void *buf, size_t len, int flags,
-    const struct sockaddr *addr, int *addrlen)
+    const struct sockaddr *addr, socklen_t addrlen)
 {
-	extern int __so_sendto(int, const void *, size_t, int,
-	    const struct sockaddr *, int *);
+	extern ssize_t __so_sendto(int, const void *, size_t, int,
+	    const struct sockaddr *, socklen_t);
 	int rv;
 
 	PERFORM(__so_sendto(sock, buf, len, flags, addr, addrlen))
--- old/usr/src/lib/libdhcpagent/Makefile.com	Sun Aug  5 23:41:04 2018
+++ new/usr/src/lib/libdhcpagent/Makefile.com	Sun Aug  5 23:41:04 2018
@@ -34,12 +34,12 @@
 
 LIBS =		$(DYNLIB) $(LINTLIB)
 
-LDLIBS +=	-lc -lsocket -ldhcputil -luuid -ldlpi -lcontract
+LDLIBS +=	-lc -ldhcputil -luuid -ldlpi -lcontract
 
 SRCDIR =	../common
 $(LINTLIB) :=	SRCS = $(SRCDIR)/$(LINTSRC)
 
-CFLAGS += 	$(CCVERBOSE) 
+CFLAGS += 	$(CCVERBOSE)
 CERRWARN +=	-_gcc=-Wno-type-limits
 
 .KEEP_STATE:
--- old/usr/src/lib/libilb/Makefile.com	Sun Aug  5 23:41:05 2018
+++ new/usr/src/lib/libilb/Makefile.com	Sun Aug  5 23:41:05 2018
@@ -44,7 +44,6 @@
 
 CFLAGS +=	-mt $(CCVERBOSE)
 CPPFLAGS +=	$(INCS)
-LDLIBS +=	-lsocket
 
 .KEEP_STATE:
 
--- old/usr/src/lib/libipmi/Makefile.com	Sun Aug  5 23:41:05 2018
+++ new/usr/src/lib/libipmi/Makefile.com	Sun Aug  5 23:41:05 2018
@@ -52,9 +52,9 @@
 
 SRCDIR=		../common
 
-CLEANFILES +=	$(SRCDIR)/ipmi_tables.c	
+CLEANFILES +=	$(SRCDIR)/ipmi_tables.c
 INCS +=		-I$(SRCDIR)
-LDLIBS +=	-lc -lm -lnvpair -lsocket -lnsl
+LDLIBS +=	-lc -lm -lnvpair -lnsl
 CPPFLAGS +=	$(INCS)
 CSTD = $(CSTD_GNU99)
 
--- old/usr/src/lib/libslp/Makefile.com	Sun Aug  5 23:41:05 2018
+++ new/usr/src/lib/libslp/Makefile.com	Sun Aug  5 23:41:05 2018
@@ -36,7 +36,7 @@
 include ../../Makefile.lib
 
 LIBS =		$(DYNLIB) $(LINTLIB)
-LDLIBS +=	-lc -lnsl -lsocket
+LDLIBS +=	-lc -lnsl
 $(LINTLIB):=	SRCS = $(SRCDIR)/$(LINTSRC)
 
 SRCDIR =	../clib
--- old/usr/src/lib/libsocket/Makefile.com	Sun Aug  5 23:41:05 2018
+++ new/usr/src/lib/libsocket/Makefile.com	Sun Aug  5 23:41:05 2018
@@ -26,14 +26,12 @@
 LIBRARY	=	libsocket.a
 VERS =		.1
 
-INETOBJS =	bindresvport.o bootparams_getbyname.o ether_addr.o \
+OBJECTS =	bindresvport.o bootparams_getbyname.o ether_addr.o \
 		getaddrinfo.o getnameinfo.o getnetent.o getnetent_r.o \
 		getprotoent.o getprotoent_r.o getservbyname_r.o getservent.o \
 		getservent_r.o inet6_opt.o inet6_rthdr.o interface_id.o \
 		link_addr.o netmasks.o rcmd.o rexec.o ruserpass.o \
 		sourcefilter.o getifaddrs.o
-SOCKOBJS =	_soutil.o sockatmark.o socket.o socketpair.o weaks.o
-OBJECTS	=	$(INETOBJS) $(SOCKOBJS)
 
 include ../../Makefile.lib
 
@@ -42,7 +40,7 @@
 
 LIBS =		$(DYNLIB) $(LINTLIB)
 
-SRCS =		$(INETOBJS:%.o=../inet/%.c) $(SOCKOBJS:%.o=../socket/%.c)
+SRCS =		$(OBJECTS:%.o=../inet/%.c)
 LDLIBS +=	-lnsl -lc
 
 SRCDIR =	../common
--- old/usr/src/lib/libsocket/common/mapfile-vers	Sun Aug  5 23:41:06 2018
+++ new/usr/src/lib/libsocket/common/mapfile-vers	Sun Aug  5 23:41:06 2018
@@ -49,7 +49,7 @@
 
 SYMBOL_VERSION ILLUMOS_0.1 {    # illumos additions
     global:
-	accept4;
+	accept4			{ TYPE = FUNCTION; FILTER = libc.so.1 };
 } SUNW_1.7;
 
 SYMBOL_VERSION SUNW_1.7 {
@@ -81,7 +81,7 @@
 	inet6_rth_reverse;
 	inet6_rth_segments;
 	inet6_rth_space;
-	sockatmark;
+	sockatmark		{ TYPE = FUNCTION; FILTER = libc.so.1 };
 	__xnet_getaddrinfo;
 } SUNW_1.4;
 
@@ -118,15 +118,15 @@
 
 SYMBOL_VERSION SUNW_1.1 {
     global:
-	__xnet_bind;
-	__xnet_connect;
-	__xnet_getsockopt;
-	__xnet_listen;
-	__xnet_recvmsg;
-	__xnet_sendmsg;
-	__xnet_sendto;
-	__xnet_socket;
-	__xnet_socketpair;
+	__xnet_bind		{ TYPE = FUNCTION; FILTER = libc.so.1 };
+	__xnet_connect		{ TYPE = FUNCTION; FILTER = libc.so.1 };
+	__xnet_getsockopt	{ TYPE = FUNCTION; FILTER = libc.so.1 };
+	__xnet_listen		{ TYPE = FUNCTION; FILTER = libc.so.1 };
+	__xnet_recvmsg		{ TYPE = FUNCTION; FILTER = libc.so.1 };
+	__xnet_sendmsg		{ TYPE = FUNCTION; FILTER = libc.so.1 };
+	__xnet_sendto		{ TYPE = FUNCTION; FILTER = libc.so.1 };
+	__xnet_socket		{ TYPE = FUNCTION; FILTER = libc.so.1 };
+	__xnet_socketpair	{ TYPE = FUNCTION; FILTER = libc.so.1 };
 } SUNW_0.7;
 
 SYMBOL_VERSION SUNW_0.7 {
@@ -163,7 +163,7 @@
 	setnetent;
 	setprotoent;
 	setservent;
-	socketpair;
+	socketpair		{ TYPE = FUNCTION; FILTER = libc.so.1 };
 
 	# For ABI reasons, the following symbols are in SISCD_2.3 on 32-bit
 	# sparc, which is inherited by SUNW_0.7. On all other platforms,
@@ -174,30 +174,30 @@
 SYMBOL_VERSION SISCD_2.3 {
     global:
 $endif
-	accept;
-	bind;
-	connect;
-	getpeername;
+	accept			{ TYPE = FUNCTION; FILTER = libc.so.1 };
+	bind			{ TYPE = FUNCTION; FILTER = libc.so.1 };
+	connect			{ TYPE = FUNCTION; FILTER = libc.so.1 };
+	getpeername		{ TYPE = FUNCTION; FILTER = libc.so.1 };
 	getprotobyname;
 	getprotobynumber;
 	getprotoent;
 	getservbyname;
 	getservbyport;
-	getsockname;
-	getsockopt;
+	getsockname		{ TYPE = FUNCTION; FILTER = libc.so.1 };
+	getsockopt		{ TYPE = FUNCTION; FILTER = libc.so.1 };
 	inet_lnaof		{ TYPE = FUNCTION; FILTER = libc.so.1 };
 	inet_makeaddr		{ TYPE = FUNCTION; FILTER = libc.so.1 };
 	inet_network		{ TYPE = FUNCTION; FILTER = libc.so.1 };
-	listen;
-	recv;
-	recvfrom;
-	recvmsg;
-	send;
-	sendmsg;
-	sendto;
-	setsockopt;
-	shutdown;
-	socket;
+	listen			{ TYPE = FUNCTION; FILTER = libc.so.1 };
+	recv			{ TYPE = FUNCTION; FILTER = libc.so.1 };
+	recvfrom		{ TYPE = FUNCTION; FILTER = libc.so.1 };
+	recvmsg			{ TYPE = FUNCTION; FILTER = libc.so.1 };
+	send			{ TYPE = FUNCTION; FILTER = libc.so.1 };
+	sendmsg			{ TYPE = FUNCTION; FILTER = libc.so.1 };
+	sendto			{ TYPE = FUNCTION; FILTER = libc.so.1 };
+	setsockopt		{ TYPE = FUNCTION; FILTER = libc.so.1 };
+	shutdown		{ TYPE = FUNCTION; FILTER = libc.so.1 };
+	socket			{ TYPE = FUNCTION; FILTER = libc.so.1 };
 };
 
 # There really should be only one SUNWprivate version.
@@ -205,7 +205,7 @@
 
 SYMBOL_VERSION SUNWprivate_1.3 {
     global:
-	_accept4;
+	_accept4		{ TYPE = FUNCTION; FILTER = libc.so.1 };
 	_link_aton;
 	_link_ntoa;
 	_nss_initf_ethers;
@@ -229,29 +229,29 @@
 
 SYMBOL_VERSION SUNWprivate_1.1 {
     global:
-	_accept;
-	_bind;
+	_accept			{ TYPE = FUNCTION; FILTER = libc.so.1 };
+	_bind			{ TYPE = FUNCTION; FILTER = libc.so.1 };
 	bindresvport;
 	bootparams_getbyname;
-	_connect;
-	_getpeername;
-	_getsockname;
-	_getsockopt;
-	_listen;
-	_recv;
-	_recvfrom;
-	_recvmsg;
+	_connect		{ TYPE = FUNCTION; FILTER = libc.so.1 };
+	_getpeername		{ TYPE = FUNCTION; FILTER = libc.so.1 };
+	_getsockname		{ TYPE = FUNCTION; FILTER = libc.so.1 };
+	_getsockopt		{ TYPE = FUNCTION; FILTER = libc.so.1 };
+	_listen			{ TYPE = FUNCTION; FILTER = libc.so.1 };
+	_recv			{ TYPE = FUNCTION; FILTER = libc.so.1 };
+	_recvfrom		{ TYPE = FUNCTION; FILTER = libc.so.1 };
+	_recvmsg		{ TYPE = FUNCTION; FILTER = libc.so.1 };
 	rresvport_addr;
 	_ruserpass;
-	_send;
-	_sendmsg;
-	_sendto;
-	_setsockopt;
-	_shutdown;
-	_socket;
-	_socket_bsd;
-	_socketpair;
-	_socketpair_bsd;
+	_send			{ TYPE = FUNCTION; FILTER = libc.so.1 };
+	_sendmsg		{ TYPE = FUNCTION; FILTER = libc.so.1 };
+	_sendto			{ TYPE = FUNCTION; FILTER = libc.so.1 };
+	_setsockopt		{ TYPE = FUNCTION; FILTER = libc.so.1 };
+	_shutdown		{ TYPE = FUNCTION; FILTER = libc.so.1 };
+	_socket			{ TYPE = FUNCTION; FILTER = libc.so.1 };
+	_socket_bsd		{ TYPE = FUNCTION; FILTER = libc.so.1 };
+	_socketpair		{ TYPE = FUNCTION; FILTER = libc.so.1 };
+	_socketpair_bsd		{ TYPE = FUNCTION; FILTER = libc.so.1 };
     local:
 	*;
 };
--- old/usr/src/lib/libsocket/socket/_soutil.c	Sun Aug  5 23:41:06 2018
+++ /dev/null	Sun Aug  5 23:41:04 2018
@@ -1,246 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * 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]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright (c) 1995, 2010, Oracle and/or its affiliates. All rights reserved.
- */
-
-/*	Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
-/*	  All Rights Reserved   */
-
-/*
- * Portions of this source code were derived from Berkeley 4.3 BSD
- * under license from the Regents of the University of California.
- */
-
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <sys/stat.h>
-#include <netinet/in.h>
-#include <errno.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <string.h>
-
-/*
- * XXX The functions in this file are only needed to support transport
- * providers that have not yet been converted to use /etc/sock2path.d.
- * Once all transport providers have been converted this file can be
- * removed.
- */
-
-static struct netconfig *_s_match_netconf(int family, int type, int proto,
-		void **nethandle);
-
-/*
- * The following two string arrays map a number as specified
- * by a user of sockets, to the string as would be returned
- * by a call to getnetconfig().
- *
- * They are used by _s_match_netconf();
- *
- * proto_sw contains protocol entries for which there is a corresponding
- * /dev device. All others would presumably use raw IP and download the
- * desired protocol.
- */
-static char *proto_sw[] = {
-	"",
-	"icmp",		/* 1 = ICMP */
-	"",
-	"",
-	"",
-	"",
-	"tcp",		/* 6 = TCP */
-	"",
-	"",
-	"",
-	"",
-	"",
-	"",
-	"",
-	"",
-	"",
-	"",
-	"udp",		/* 17 = UDP */
-};
-
-static char *family_sw[] = {
-	"-",		/* 0 = AF_UNSPEC */
-	"loopback",	/* 1 = AF_UNIX */
-	"inet",		/* 2 = AF_INET */
-	"implink",	/* 3 = AF_IMPLINK */
-	"pup",		/* 4 = AF_PUP */
-	"chaos",	/* 5 = AF_CHAOS */
-	"ns",		/* 6 = AF_NS */
-	"nbs",		/* 7 = AF_NBS */
-	"ecma",		/* 8 = AF_ECMA */
-	"datakit",	/* 9 = AF_DATAKIT */
-	"ccitt",	/* 10 = AF_CCITT */
-	"sna",		/* 11 = AF_SNA */
-	"decnet",	/* 12 = AF_DECnet */
-	"dli",		/* 13 = AF_DLI */
-	"lat",		/* 14 = AF_LAT */
-	"hylink",	/* 15 = AF_HYLINK */
-	"appletalk",	/* 16 = AF_APPLETALK */
-	"nit",		/* 17 = AF_NIT */
-	"ieee802",	/* 18 = AF_802 */
-	"osi",		/* 19 = AF_OSI */
-	"x25",		/* 20 = AF_X25 */
-	"osinet",	/* 21 = AF_OSINET */
-	"gosip",	/* 22 = AF_GOSIP */
-	"ipx",		/* 23 = AF_IPX */
-	"route",	/* 24 = AF_ROUTE */
-	"link",		/* 25 = AF_LINK */
-	"inet6",	/* 26 = AF_INET6 */
-	"key",		/* 27 = AF_KEY */
-};
-
-/*
- * Lookup family/type/protocol in /etc/netconfig.
- * Returns the pathname and a prototype value (to be passed into SO_PROTOTYPE)
- * The path is malloc'ed and has to be freed by the caller.
- */
-int
-_s_netconfig_path(int family, int type, int protocol,
-	char **pathp, int *prototype)
-{
-	struct netconfig	*net;
-	void				*nethandle;
-	struct stat			stats;
-
-	net = _s_match_netconf(family, type, protocol, &nethandle);
-	if (net == NULL)
-		return (-1);
-
-	if (strcmp(net->nc_proto, NC_NOPROTO) != 0)
-		*prototype = 0;
-	else
-		*prototype = protocol;
-
-retry:
-	if (stat(net->nc_device, &stats) < 0) {
-		switch (errno) {
-		case EINTR:
-			goto retry;
-
-		case ENOENT:
-		case ENOLINK:
-		case ELOOP:
-		case EMULTIHOP:
-		case ENOTDIR:
-			errno = EPFNOSUPPORT;
-			break;
-		}
-		endnetconfig(nethandle); /* finished with netconfig struct */
-		return (-1);
-	}
-	if (!S_ISCHR(stats.st_mode)) {
-		errno = EPFNOSUPPORT;
-		endnetconfig(nethandle); /* finished with netconfig struct */
-		return (-1);
-	}
-	*pathp = malloc(strlen(net->nc_device) + 1);
-	if (*pathp == NULL) {
-		endnetconfig(nethandle);
-		errno = ENOMEM;
-		return (-1);
-	}
-	(void) strcpy(*pathp, net->nc_device);
-	endnetconfig(nethandle); /* finished with netconfig struct */
-	return (0);
-}
-
-/*
- * Match config entry for protocol
- * requested.
- */
-static struct netconfig *
-_s_match_netconf(int family, int type, int proto, void **nethandle)
-{
-	struct netconfig	*net;
-	struct netconfig	*maybe;
-	char			*oproto;
-
-	if (family < 0 ||
-	    family >= (int)sizeof (family_sw) / (int)sizeof (char *) ||
-	    proto < 0 || proto >= IPPROTO_MAX)  {
-		errno = EPROTONOSUPPORT;
-		return (NULL);
-	}
-	if (proto) {
-		if (proto >= (int)sizeof (proto_sw) / (int)sizeof (char *))
-			oproto = "";
-		else
-			oproto = proto_sw[proto];
-	}
-
-	/*
-	 * Loop through each entry in netconfig
-	 * until one matches or we reach the end.
-	 */
-	if ((*nethandle = setnetconfig()) == NULL) {
-		return (NULL);
-	}
-
-	maybe = NULL;
-	while ((net = getnetconfig(*nethandle)) != NULL) {
-		/*
-		 * We make a copy of net->nc_semantics rather than modifying
-		 * it in place because the network selection code shares the
-		 * structures returned by getnetconfig() among all its callers.
-		 * See bug #1160886 for more details.
-		 */
-		unsigned int semantics = net->nc_semantics;
-
-		if (semantics == NC_TPI_COTS_ORD)
-			semantics = NC_TPI_COTS;
-		if (proto) {
-			if (strcmp(net->nc_protofmly, family_sw[family]) == 0 &&
-			    semantics == type &&
-			    strcmp(net->nc_proto, oproto) == 0)
-				break;
-
-			if (strcmp(net->nc_protofmly, family_sw[family]) == 0 &&
-			    type == SOCK_RAW &&
-			    semantics == SOCK_RAW &&
-			    strcmp(net->nc_proto, NC_NOPROTO) == 0 &&
-			    maybe == NULL)
-				maybe = net;	/* in case no exact match */
-
-			continue;
-		} else	{
-			if (strcmp(net->nc_protofmly, family_sw[family]) == 0 &&
-			    semantics == type) {
-				break;
-			}
-		}
-	}
-	if (net == NULL && maybe)
-		net = maybe;
-
-	if (net == NULL) {
-		endnetconfig(*nethandle);
-		errno = EPROTONOSUPPORT;
-		return (NULL);
-	}
-
-	return (net);
-}
--- old/usr/src/lib/libsocket/socket/socket.c	Sun Aug  5 23:41:06 2018
+++ /dev/null	Sun Aug  5 23:41:04 2018
@@ -1,152 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * 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]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright (c) 1990, 2010, Oracle and/or its affiliates. All rights reserved.
- */
-
-/*	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/*	  All Rights Reserved   */
-
-/*
- * University Copyright- Copyright (c) 1982, 1986, 1988
- * The Regents of the University of California
- * All Rights Reserved
- *
- * University Acknowledgment- Portions of this document are derived from
- * software developed by the University of California, Berkeley, and its
- * contributors.
- */
-
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <sys/stropts.h>
-#include <sys/stream.h>
-#include <sys/socketvar.h>
-#include <errno.h>
-#include <unistd.h>
-#include <stdlib.h>
-
-extern int _so_socket();
-extern int _s_netconfig_path();
-extern int _setsockopt();
-
-int _socket_create(int, int, int, int);
-
-#pragma weak socket = _socket
-
-int
-_socket(int family, int type, int protocol)
-{
-	return (_socket_create(family, type, protocol, SOV_DEFAULT));
-}
-
-/*
- * Used by the BCP library.
- */
-int
-_socket_bsd(int family, int type, int protocol)
-{
-	return (_socket_create(family, type, protocol, SOV_SOCKBSD));
-}
-
-int
-_socket_svr4(int family, int type, int protocol)
-{
-	return (_socket_create(family, type, protocol, SOV_SOCKSTREAM));
-}
-
-int
-__xnet_socket(int family, int type, int protocol)
-{
-	return (_socket_create(family, type, protocol, SOV_XPG4_2));
-}
-
-/*
- * Create a socket endpoint for socket() and socketpair().
- * In SunOS 4.X and in SunOS 5.X prior to XPG 4.2 the only error
- * that could be returned due to invalid <family, type, protocol>
- * was EPROTONOSUPPORT. (While the SunOS 4.X source contains EPROTOTYPE
- * error as well that error can only be generated if the kernel is
- * incorrectly configured.)
- * For backwards compatibility only applications that request XPG 4.2
- * (through c89 or XOPEN_SOURCE) will get EPROTOTYPE or EAFNOSUPPORT errors.
- */
-int
-_socket_create(int family, int type, int protocol, int version)
-{
-	int fd;
-
-	/*
-	 * Try creating without knowing the device assuming that
-	 * the transport provider is registered in /etc/sock2path.d.
-	 * If none found fall back to using /etc/netconfig to look
-	 * up the name of the transport device name. This provides
-	 * backwards compatibility for transport providers that have not
-	 * yet been converted to using /etc/sock2path.d.
-	 * XXX When all transport providers use /etc/sock2path.d. this
-	 * part of the code can be removed.
-	 */
-	fd = _so_socket(family, type, protocol, NULL, version);
-	if (fd == -1) {
-		char *devpath;
-		int saved_errno = errno;
-		int prototype = 0;
-
-		switch (saved_errno) {
-		case EAFNOSUPPORT:
-		case EPROTOTYPE:
-			if (version != SOV_XPG4_2)
-				saved_errno = EPROTONOSUPPORT;
-			break;
-		case EPROTONOSUPPORT:
-			break;
-
-		default:
-			errno = saved_errno;
-			return (-1);
-		}
-		if (_s_netconfig_path(family, type, protocol,
-		    &devpath, &prototype) == -1) {
-			errno = saved_errno;
-			return (-1);
-		}
-		fd = _so_socket(family, type, protocol, devpath, version);
-		free(devpath);
-		if (fd == -1) {
-			errno = saved_errno;
-			return (-1);
-		}
-		if (prototype != 0) {
-			if (_setsockopt(fd, SOL_SOCKET, SO_PROTOTYPE,
-			    (caddr_t)&prototype, (int)sizeof (prototype)) < 0) {
-				(void) close(fd);
-				/*
-				 * setsockopt often fails with ENOPROTOOPT
-				 * but socket() should fail with
-				 * EPROTONOSUPPORT.
-				 */
-				errno = EPROTONOSUPPORT;
-				return (-1);
-			}
-		}
-	}
-	return (fd);
-}
--- old/usr/src/lib/libstmfproxy/Makefile.com	Sun Aug  5 23:41:06 2018
+++ new/usr/src/lib/libstmfproxy/Makefile.com	Sun Aug  5 23:41:06 2018
@@ -38,7 +38,7 @@
 
 CSTD=	$(CSTD_GNU99)
 C99LMODE=	-Xc99=%all
-LDLIBS +=	-lc -lsocket -lnsl
+LDLIBS +=	-lc -lnsl
 CPPFLAGS +=	$(INCS) -D_REENTRANT
 
 $(LINTLIB) := SRCS=	$(SRCDIR)/$(LINTSRC)
--- old/usr/src/lib/libvrrpadm/Makefile.com	Sun Aug  5 23:41:06 2018
+++ new/usr/src/lib/libvrrpadm/Makefile.com	Sun Aug  5 23:41:06 2018
@@ -33,7 +33,7 @@
 #include ../../Makefile.rootfs
 
 LIBS =		$(DYNLIB) $(LINTLIB)
-LDLIBS +=	-lc -lsocket -ldladm -lscf
+LDLIBS +=	-lc -ldladm -lscf
 
 SRCDIR =	../common
 $(LINTLIB) :=	SRCS = $(SRCDIR)/$(LINTSRC)
--- old/usr/src/lib/libxnet/common/mapfile-vers	Sun Aug  5 23:41:07 2018
+++ new/usr/src/lib/libxnet/common/mapfile-vers	Sun Aug  5 23:41:07 2018
@@ -58,7 +58,7 @@
 	if_indextoname		{ TYPE = FUNCTION; FILTER = libsocket.so.1 };
 	if_nameindex		{ TYPE = FUNCTION; FILTER = libsocket.so.1 };
 	if_nametoindex		{ TYPE = FUNCTION; FILTER = libsocket.so.1 };
-	sockatmark		{ TYPE = FUNCTION; FILTER = libsocket.so.1 };
+	sockatmark		{ TYPE = FUNCTION; FILTER = libc.so.1 };
 } SUNW_1.2;
 
 SYMBOL_VERSION SUNW_1.2 {
@@ -77,15 +77,15 @@
 SYMBOL_VERSION SUNW_1.1 {
     global:
 	__t_errno		{ TYPE = FUNCTION; FILTER = libnsl.so.1 };
-	__xnet_bind		{ TYPE = FUNCTION; FILTER = libsocket.so.1 };
-	__xnet_connect		{ TYPE = FUNCTION; FILTER = libsocket.so.1 };
-	__xnet_getsockopt	{ TYPE = FUNCTION; FILTER = libsocket.so.1 };
-	__xnet_listen		{ TYPE = FUNCTION; FILTER = libsocket.so.1 };
-	__xnet_recvmsg		{ TYPE = FUNCTION; FILTER = libsocket.so.1 };
-	__xnet_sendmsg		{ TYPE = FUNCTION; FILTER = libsocket.so.1 };
-	__xnet_sendto		{ TYPE = FUNCTION; FILTER = libsocket.so.1 };
-	__xnet_socket		{ TYPE = FUNCTION; FILTER = libsocket.so.1 };
-	__xnet_socketpair	{ TYPE = FUNCTION; FILTER = libsocket.so.1 };
+	__xnet_bind		{ TYPE = FUNCTION; FILTER = libc.so.1 };
+	__xnet_connect		{ TYPE = FUNCTION; FILTER = libc.so.1 };
+	__xnet_getsockopt	{ TYPE = FUNCTION; FILTER = libc.so.1 };
+	__xnet_listen		{ TYPE = FUNCTION; FILTER = libc.so.1 };
+	__xnet_recvmsg		{ TYPE = FUNCTION; FILTER = libc.so.1 };
+	__xnet_sendmsg		{ TYPE = FUNCTION; FILTER = libc.so.1 };
+	__xnet_sendto		{ TYPE = FUNCTION; FILTER = libc.so.1 };
+	__xnet_socket		{ TYPE = FUNCTION; FILTER = libc.so.1 };
+	__xnet_socketpair	{ TYPE = FUNCTION; FILTER = libc.so.1 };
 	_xti_accept		{ TYPE = FUNCTION; FILTER = libnsl.so.1 };
 	_xti_alloc		{ TYPE = FUNCTION; FILTER = libnsl.so.1 };
 	_xti_bind		{ TYPE = FUNCTION; FILTER = libnsl.so.1 };
@@ -113,9 +113,9 @@
 	_xti_strerror		{ TYPE = FUNCTION; FILTER = libnsl.so.1 };
 	_xti_sync		{ TYPE = FUNCTION; FILTER = libnsl.so.1 };
 	_xti_unbind		{ TYPE = FUNCTION; FILTER = libnsl.so.1 };
-	accept			{ TYPE = FUNCTION; FILTER = libsocket.so.1 };
-	bind			{ TYPE = FUNCTION; FILTER = libsocket.so.1 };
-	connect			{ TYPE = FUNCTION; FILTER = libsocket.so.1 };
+	accept			{ TYPE = FUNCTION; FILTER = libc.so.1 };
+	bind			{ TYPE = FUNCTION; FILTER = libc.so.1 };
+	connect			{ TYPE = FUNCTION; FILTER = libc.so.1 };
 	endhostent		{ TYPE = FUNCTION; FILTER = libnsl.so.1 };
 	endnetent		{ TYPE = FUNCTION; FILTER = libsocket.so.1 };
 	endprotoent		{ TYPE = FUNCTION; FILTER = libsocket.so.1 };
@@ -127,7 +127,7 @@
 	getnetbyaddr		{ TYPE = FUNCTION; FILTER = libsocket.so.1 };
 	getnetbyname		{ TYPE = FUNCTION; FILTER = libsocket.so.1 };
 	getnetent		{ TYPE = FUNCTION; FILTER = libsocket.so.1 };
-	getpeername		{ TYPE = FUNCTION; FILTER = libsocket.so.1 };
+	getpeername		{ TYPE = FUNCTION; FILTER = libc.so.1 };
 	getprotobyname		{ TYPE = FUNCTION; FILTER = libsocket.so.1 };
 	getprotobynumber	{ TYPE = FUNCTION; FILTER = libsocket.so.1 };
 	getprotoent		{ TYPE = FUNCTION; FILTER = libsocket.so.1 };
@@ -134,8 +134,8 @@
 	getservbyname		{ TYPE = FUNCTION; FILTER = libsocket.so.1 };
 	getservbyport		{ TYPE = FUNCTION; FILTER = libsocket.so.1 };
 	getservent		{ TYPE = FUNCTION; FILTER = libsocket.so.1 };
-	getsockname		{ TYPE = FUNCTION; FILTER = libsocket.so.1 };
-	getsockopt		{ TYPE = FUNCTION; FILTER = libsocket.so.1 };
+	getsockname		{ TYPE = FUNCTION; FILTER = libc.so.1 };
+	getsockopt		{ TYPE = FUNCTION; FILTER = libc.so.1 };
 	h_errno {
 		TYPE = DATA;
 		SIZE = 0x4;
@@ -150,23 +150,23 @@
 	inet_netof		{ TYPE = FUNCTION; FILTER = libc.so.1 };
 	inet_network		{ TYPE = FUNCTION; FILTER = libc.so.1 };
 	inet_ntoa		{ TYPE = FUNCTION; FILTER = libc.so.1 };
-	listen			{ TYPE = FUNCTION; FILTER = libsocket.so.1 };
+	listen			{ TYPE = FUNCTION; FILTER = libc.so.1 };
 	ntohl			{ TYPE = FUNCTION; FILTER = libc.so.1 };
 	ntohs			{ TYPE = FUNCTION; FILTER = libc.so.1 };
-	recv			{ TYPE = FUNCTION; FILTER = libsocket.so.1 };
-	recvfrom		{ TYPE = FUNCTION; FILTER = libsocket.so.1 };
-	recvmsg			{ TYPE = FUNCTION; FILTER = libsocket.so.1 };
-	send			{ TYPE = FUNCTION; FILTER = libsocket.so.1 };
-	sendmsg			{ TYPE = FUNCTION; FILTER = libsocket.so.1 };
-	sendto			{ TYPE = FUNCTION; FILTER = libsocket.so.1 };
+	recv			{ TYPE = FUNCTION; FILTER = libc.so.1 };
+	recvfrom		{ TYPE = FUNCTION; FILTER = libc.so.1 };
+	recvmsg			{ TYPE = FUNCTION; FILTER = libc.so.1 };
+	send			{ TYPE = FUNCTION; FILTER = libc.so.1 };
+	sendmsg			{ TYPE = FUNCTION; FILTER = libc.so.1 };
+	sendto			{ TYPE = FUNCTION; FILTER = libc.so.1 };
 	sethostent		{ TYPE = FUNCTION; FILTER = libnsl.so.1 };
 	setnetent		{ TYPE = FUNCTION; FILTER = libsocket.so.1 };
 	setprotoent		{ TYPE = FUNCTION; FILTER = libsocket.so.1 };
 	setservent		{ TYPE = FUNCTION; FILTER = libsocket.so.1 };
-	setsockopt		{ TYPE = FUNCTION; FILTER = libsocket.so.1 };
-	shutdown		{ TYPE = FUNCTION; FILTER = libsocket.so.1 };
-	socket			{ TYPE = FUNCTION; FILTER = libsocket.so.1 };
-	socketpair		{ TYPE = FUNCTION; FILTER = libsocket.so.1 };
+	setsockopt		{ TYPE = FUNCTION; FILTER = libc.so.1 };
+	shutdown		{ TYPE = FUNCTION; FILTER = libc.so.1 };
+	socket			{ TYPE = FUNCTION; FILTER = libc.so.1 };
+	socketpair		{ TYPE = FUNCTION; FILTER = libc.so.1 };
 	t_errno {
 		TYPE = DATA;
 		SIZE = 0x4;
--- old/usr/src/lib/print/libipp-listener/Makefile.com	Sun Aug  5 23:41:07 2018
+++ new/usr/src/lib/print/libipp-listener/Makefile.com	Sun Aug  5 23:41:07 2018
@@ -57,7 +57,7 @@
 
 MAPFILES =	$(SRCDIR)/mapfile
 
-LDLIBS +=	-lipp-core -lpapi -lc -lsocket -lnsl
+LDLIBS +=	-lipp-core -lpapi -lc -lnsl
 
 .KEEP_STATE:
 
--- old/usr/src/lib/print/libpapi-common/Makefile.com	Sun Aug  5 23:41:07 2018
+++ new/usr/src/lib/print/libpapi-common/Makefile.com	Sun Aug  5 23:41:07 2018
@@ -45,7 +45,7 @@
 
 MAPFILES =	$(SRCDIR)/mapfile
 
-LDLIBS +=	-lc -lsocket -lnsl
+LDLIBS +=	-lc -lnsl
 
 .KEEP_STATE:
 
--- old/usr/src/man/man3c/Makefile	Sun Aug  5 23:41:08 2018
+++ new/usr/src/man/man3c/Makefile	Sun Aug  5 23:41:08 2018
@@ -27,6 +27,7 @@
 		a64l.3c						\
 		abort.3c					\
 		abs.3c						\
+		accept.3c					\
 		addsev.3c					\
 		addseverity.3c					\
 		aio_cancel.3c					\
@@ -55,6 +56,7 @@
 		atomic_swap.3c					\
 		attropen.3c					\
 		basename.3c					\
+		bind.3c						\
 		bsd_signal.3c					\
 		bsearch.3c					\
 		bstring.3c					\
@@ -73,6 +75,7 @@
 		cnd.3c						\
 		cond_init.3c					\
 		confstr.3c					\
+		connect.3c					\
 		crypt.3c					\
 		crypt_genhash_impl.3c				\
 		crypt_gensalt.3c				\
@@ -179,6 +182,7 @@
 		getpagesize.3c					\
 		getpagesizes.3c					\
 		getpass.3c					\
+		getpeername.3c					\
 		getpeerucred.3c					\
 		getpriority.3c					\
 		getprogname.3c					\
@@ -186,6 +190,8 @@
 		getpwnam.3c					\
 		getrusage.3c					\
 		gets.3c						\
+		getsockname.3c					\
+		getsockopt.3c					\
 		getspnam.3c					\
 		getsubopt.3c					\
 		gettext.3c					\
@@ -224,6 +230,7 @@
 		lckpwdf.3c					\
 		lfmt.3c						\
 		lio_listio.3c					\
+		listen.3c					\
 		localeconv.3c					\
 		lockf.3c					\
 		lsearch.3c					\
@@ -381,6 +388,7 @@
 		readdir.3c					\
 		realpath.3c					\
 		reboot.3c					\
+		recv.3c						\
 		regcmp.3c					\
 		regcomp.3c					\
 		remove.3c					\
@@ -409,6 +417,7 @@
 		sem_unlink.3c					\
 		sem_wait.3c					\
 		semaphore.3c					\
+		send.3c						\
 		setbuf.3c					\
 		setbuffer.3c					\
 		setcat.3c					\
@@ -419,6 +428,7 @@
 		setlocale.3c					\
 		shm_open.3c					\
 		shm_unlink.3c					\
+		shutdown.3c					\
 		sigfpe.3c					\
 		siginterrupt.3c					\
 		signal.3c					\
@@ -429,6 +439,9 @@
 		sigwaitinfo.3c					\
 		sleep.3c					\
 		smt_pause.3c					\
+		sockaddr.3c					\
+		socket.3c					\
+		socketpair.3c					\
 		ssignal.3c					\
 		stack_getbounds.3c				\
 		stack_inbounds.3c				\
@@ -558,7 +571,7 @@
 		wordexp.3c					\
 		wsprintf.3c					\
 		wsscanf.3c					\
-		wstring.3c					\
+		wstring.3c
 
 MANLINKS=	FD_CLR.3c				\
 		FD_ISSET.3c				\
@@ -578,6 +591,7 @@
 		_exithandle.3c				\
 		_flushlbf.3c				\
 		_setjmp.3c				\
+		accept4.3c				\
 		addrtosymstr.3c				\
 		aiowrite.3c				\
 		alloca.3c				\
@@ -1151,6 +1165,8 @@
 		realloc.3c				\
 		reallocarray.3c				\
 		recallocarray.3c			\
+		recvfrom.3c				\
+		recvmsg.3c				\
 		regerror.3c				\
 		regex.3c				\
 		regexec.3c				\
@@ -1179,6 +1195,8 @@
 		sema_post.3c				\
 		sema_trywait.3c				\
 		sema_wait.3c				\
+		sendmsg.3c				\
+		sendto.3c				\
 		setattrat.3c				\
 		setgrent.3c				\
 		sethostname.3c				\
@@ -1188,6 +1206,7 @@
 		setpriority.3c				\
 		setprogname.3c				\
 		setpwent.3c				\
+		setsockopt.3c				\
 		setspent.3c				\
 		setstate.3c				\
 		settimeofday.3c				\
@@ -1213,6 +1232,12 @@
 		sigtimedwait.3c				\
 		single_to_decimal.3c			\
 		snprintf.3c				\
+		sockaddr_dl.3c				\
+		sockaddr_in.3c				\
+		sockaddr_in6.3c				\
+		sockaddr_ll.3c				\
+		sockaddr_storage.3c			\
+		sockaddr_un.3c				\
 		sprintf.3c				\
 		srand.3c				\
 		srand48.3c				\
@@ -1436,6 +1461,8 @@
 labs.3c					:= LINKSRC = abs.3c
 llabs.3c				:= LINKSRC = abs.3c
 
+accept4.3c				:= LINKSRC = accept.3c
+
 aiowrite.3c				:= LINKSRC = aioread.3c
 
 arc4random_buf.3c			:= LINKSRC = arc4random.3c
@@ -1829,6 +1856,8 @@
 
 fgets.3c				:= LINKSRC = gets.3c
 
+setsockopt.3c				:= LINKSRC = getsockopt.3c
+
 endspent.3c				:= LINKSRC = getspnam.3c
 fgetspent.3c				:= LINKSRC = getspnam.3c
 fgetspent_r.3c				:= LINKSRC = getspnam.3c
@@ -2222,6 +2251,9 @@
 
 readdir_r.3c				:= LINKSRC = readdir.3c
 
+recvfrom.3c				:= LINKSRC = recv.3c
+recvmsg.3c				:= LINKSRC = recv.3c
+
 regex.3c				:= LINKSRC = regcmp.3c
 
 regerror.3c				:= LINKSRC = regcomp.3c
@@ -2267,6 +2299,9 @@
 sema_trywait.3c				:= LINKSRC = semaphore.3c
 sema_wait.3c				:= LINKSRC = semaphore.3c
 
+sendmsg.3c				:= LINKSRC = send.3c
+sendto.3c				:= LINKSRC = send.3c
+
 setvbuf.3c				:= LINKSRC = setbuf.3c
 
 setlinebuf.3c				:= LINKSRC = setbuffer.3c
@@ -2289,6 +2324,13 @@
 
 sigtimedwait.3c				:= LINKSRC = sigwaitinfo.3c
 
+sockaddr_dl.3c				:= LINKSRC = sockaddr.3c
+sockaddr_in.3c				:= LINKSRC = sockaddr.3c
+sockaddr_in6.3c				:= LINKSRC = sockaddr.3c
+sockaddr_ll.3c				:= LINKSRC = sockaddr.3c
+sockaddr_storage.3c			:= LINKSRC = sockaddr.3c
+sockaddr_un.3c				:= LINKSRC = sockaddr.3c
+
 gsignal.3c				:= LINKSRC = ssignal.3c
 
 stderr.3c				:= LINKSRC = stdio.3c
--- /dev/null	Sun Aug  5 23:41:08 2018
+++ new/usr/src/man/man3c/accept.3c	Sun Aug  5 23:41:08 2018
@@ -0,0 +1,263 @@
+.\"
+.\" 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]
+.\"
+.\"
+.\" Copyright 1989 AT&T
+.\" Copyright (C) 2002, Sun Microsystems, Inc. All Rights Reserved
+.\" Copyright (c) 2013, OmniTI Computer Consulting, Inc. All rights reserved.
+.\" Copyright 2018 Nexenta Systems, Inc.
+.\"
+.Dd August 2, 2018
+.Dt ACCEPT 3C
+.Os
+.Sh NAME
+.Nm accept
+.Nd accept a connection on a socket
+.Sh LIBRARY
+.Lb libc
+.Sh SYNOPSIS
+.In sys/types.h
+.In sys/socket.h
+.Ft int
+.Fo accept
+.Fa "int s"
+.Fa "struct sockaddr *restrict addr"
+.Fa "socklen_t *addrlen"
+.Fc
+.Ft int
+.Fo accept4
+.Fa "int s"
+.Fa "struct sockaddr *restrict addr"
+.Fa "socklen_t *addrlen"
+.Fa "int flags"
+.Fc
+.Sh DESCRIPTION
+The argument
+.Fa s
+is a socket that has been created with
+.Xr socket 3C
+and bound to an address with
+.Xr bind 3C ,
+and that is listening for connections after a call to
+.Xr listen 3C .
+The
+.Fn accept
+function extracts the first connection on the queue of pending connections,
+creates a new socket with the properties of
+.Fa s ,
+and allocates a new file descriptor,
+.Va ns ,
+for the socket.
+If no pending connections are present on the queue and the socket is not marked
+as non-blocking,
+.Fn accept
+blocks the caller until a connection is present.
+If the socket is marked as non-blocking and no pending connections are present
+on the queue,
+.Fn accept
+returns an error as described below.
+The
+.Fn accept
+function uses the
+.Xr netconfig 4
+file to determine the STREAMS device file name associated with
+.Fa s .
+This is the device on which the connect indication will be accepted.
+The accepted socket,
+.Va ns ,
+is used to read and write data to and from the socket that connected to
+.Va ns .
+It is not used to accept more connections.
+The original socket
+.Pq Fa s
+remains open for accepting further connections.
+.Pp
+The argument
+.Fa addr
+is a result parameter that is filled in with the address of the connecting
+entity as it is known to the communications layer.
+The exact format of the
+.Fa addr
+parameter is determined by the domain in which the communication occurs.
+.Pp
+The argument
+.Fa addrlen
+is a value-result parameter.
+Initially, it contains the amount of space pointed to by
+.Fa addr ;
+on return it contains the length in bytes of the address returned.
+.Pp
+The
+.Fn accept
+function is used with connection-based socket types, currently with
+.Dv SOCK_STREAM .
+.Pp
+The
+.Fn accept4
+function allows flags that control the behavior of a successfully accepted
+socket.
+If
+.Fa flags
+is 0,
+.Fn accept4
+acts identically to
+.Fn accept .
+Values for
+.Fa flags
+are constructed by a bitwise-inclusive-OR of flags from the following list,
+defined in
+.In sys/socketvar.h :
+.Bl -tag -width Ds
+.It Dv SOCK_CLOEXEC
+The accepted socket will have the
+.Dv FD_CLOEXEC
+flag set as if
+.Xr fcntl 2
+was called on it.
+This flag is set before the socket is passed to the caller thus avoiding the
+race condition between
+.Fn accept
+and
+.Xr fcntl 2 .
+See
+.Dv O_CLOEXEC
+in
+.Xr open 2
+for more details.
+.It Dv SOCK_NDELAY
+The accepted socket will have the
+.Dv O_NDELAY
+flag set as if
+.Xr fcntl 2
+was called on it.
+This sets the socket into non-blocking mode.
+See
+.Dv O_NDELAY
+in
+.Xr fcntl.h 3HEAD
+for more details.
+.It Dv SOCK_NONBLOCK
+The accepted socket will have the
+.Dv O_NONBLOCK
+flag set as if
+.Xr fcntl 2
+was called on it.
+This sets the socket into non-blocking mode
+.Po POSIX; see
+.Xr standards 5
+.Pc .
+See
+.Dv O_NONBLOCK
+in
+.Xr fcntl.h 3HEAD
+for more details.
+.El
+.Pp
+It is possible to
+.Xr select 3C
+or
+.Xr poll 2
+a socket for the purpose of an
+.Fn accept
+by selecting or polling it for a read.
+However, this will only indicate when a connect indication is pending; it is
+still necessary to call
+.Fn accept .
+.Sh RETURN VALUES
+The
+.Fn accept
+function returns -1 on error.
+If it succeeds, it returns a non-negative integer that is a descriptor for the
+accepted socket.
+.Sh ERRORS
+.Fn accept
+and
+.Fn accept4
+will fail if:
+.Bl -tag -width Er
+.It Bq Er EBADF
+The descriptor is invalid.
+.It Bq Er ECONNABORTED
+The remote side aborted the connection before the
+.Fn accept
+operation completed.
+.It Bq Er EFAULT
+The
+.Fa addr
+parameter or the
+.Fa addrlen
+parameter is invalid.
+.It Bq Er EINTR
+The
+.Fn accept
+attempt was interrupted by the delivery of a signal.
+.It Bq Er EMFILE
+The per-process descriptor table is full.
+.It Bq Er ENODEV
+The protocol family and type corresponding to
+.Fa s
+could not be found in the
+.Pa netconfig
+file.
+.It Bq Er ENOMEM
+There was insufficient user memory available to complete the operation.
+.It Bq Er ENOSR
+There were insufficient STREAMS resources available to complete the operation.
+.It Bq Er ENOTSOCK
+The descriptor does not reference a socket.
+.It Bq Er EOPNOTSUPP
+The referenced socket is not of type
+.Dv SOCK_STREAM .
+.It Bq Er EPROTO
+A protocol error has occurred; for example, the STREAMS protocol stack has not
+been initialized or the connection has already been released.
+.It Bq Er EWOULDBLOCK
+The socket is marked as non-blocking and no connections are present to be
+accepted.
+.El
+.Pp
+Additionally,
+.Fn accept4
+will fail if:
+.Bl -tag -width Er
+.It Bq Er EINVAL
+The
+.Fa flags
+value is invalid.
+The
+.Fa flags
+argument can only be the bitwise inclusive-OR of
+.Dv SOCK_CLOEXEC ,
+.Dv SOCK_NONBLOCK ,
+and
+.Dv SOCK_NDELAY .
+.El
+.Sh MT-LEVEL
+.Sy Safe
+.Sh SEE ALSO
+.Xr fcntl 2 ,
+.Xr poll 2 ,
+.Xr bind 3C ,
+.Xr connect 3C ,
+.Xr listen 3C ,
+.Xr select 3C ,
+.Xr sockaddr 3C ,
+.Xr socket 3C ,
+.Xr fcntl.h 3HEAD ,
+.Xr socket.h 3HEAD ,
+.Xr netconfig 4 ,
+.Xr attributes 5 ,
+.Xr standards 5
--- /dev/null	Sun Aug  5 23:41:08 2018
+++ new/usr/src/man/man3c/bind.3c	Sun Aug  5 23:41:08 2018
@@ -0,0 +1,125 @@
+.\"
+.\" 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]
+.\"
+.\"
+.\" Copyright 1989 AT&T
+.\" Copyright (C) 2009, Sun Microsystems, Inc. All Rights Reserved
+.\" Copyright 2018 Nexenta Systems, Inc.
+.\"
+.Dd August 2, 2018
+.Dt BIND 3C
+.Os
+.Sh NAME
+.Nm bind
+.Nd bind a name to a socket
+.Sh LIBRARY
+.Lb libc
+.Sh SYNOPSIS
+.In sys/types.h
+.In sys/socket.h
+.Ft int
+.Fo bind
+.Fa "int s"
+.Fa "const struct sockaddr *name"
+.Fa "socklen_t namelen"
+.Fc
+.Sh DESCRIPTION
+The
+.Fn bind
+function assigns a name to an unnamed socket.
+When a socket is created with
+.Xr socket 3C ,
+it exists in a name space (address family) but has no name assigned.
+The
+.Fn bind
+function requests that the name pointed to by
+.Fa name
+be assigned to the socket.
+.Sh RETURN VALUES
+Upon successful completion 0 is returned.
+Otherwise, -1
+is returned and
+.Va errno
+is set to indicate the error.
+.Sh ERRORS
+The
+.Fn bind
+function will fail if:
+.Bl -tag -width Er
+.It Bq Er EACCES
+The requested address is protected, and
+.Bq Dv PRIV_NET_PRIVADDR
+is not asserted in the effective set of the current process.
+.It Bq Er EADDRINUSE
+The specified address is already in use.
+.It Bq Er EADDRNOTAVAIL
+The specified address is not available on the local machine.
+.It Bq Er EBADF
+.Fa s
+is not a valid descriptor.
+.It Bq Er EINVAL
+.Fa namelen
+is not the size of a valid address for the specified address family.
+.Pp
+The socket is already bound to an address.
+.Pp
+Socket options are inconsistent with port attributes.
+.It Bq Er ENOSR
+There were insufficient STREAMS resources for the operation to complete.
+.It Bq Er ENOTSOCK
+.Fa s
+is a descriptor for a file, not a socket.
+.El
+.Pp
+The following errors are specific to binding names in the UNIX domain:
+.Bl -tag -width Er
+.It Bq Er EACCES
+Search permission is denied for a component of the path prefix of the pathname
+in
+.Fa name .
+.It Bq Er EIO
+An I/O error occurred while making the directory entry or allocating the inode.
+.It Bq Er EISDIR
+A null pathname was specified.
+.It Bq Er ELOOP
+Too many symbolic links were encountered in translating the pathname in
+.Fa name .
+.It Bq Er ENOENT
+A component of the path prefix of the pathname in
+.Fa name
+does not exist.
+.It Bq Er ENOTDIR
+A component of the path prefix of the pathname in
+.Fa name
+is not a directory.
+.It Bq Er EROFS
+The inode would reside on a read-only file system.
+.El
+.Sh MT-LEVEL
+.Sy Safe
+.Sh SEE ALSO
+.Xr unlink 2 ,
+.Xr sockaddr 3C ,
+.Xr socket 3C ,
+.Xr socket.h 3HEAD ,
+.Xr attributes 5 ,
+.Xr privileges 5
+.Sh NOTES
+Binding a name in the UNIX domain creates a socket in the file system that must
+be deleted by the caller when it is no longer needed by using
+.Xr unlink 2 .
+.Pp
+The rules used in name binding vary between communication domains.
--- /dev/null	Sun Aug  5 23:41:08 2018
+++ new/usr/src/man/man3c/connect.3c	Sun Aug  5 23:41:08 2018
@@ -0,0 +1,379 @@
+.\"
+.\" 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]
+.\"
+.\"
+.\" Copyright 1989 AT&T  All Rights Reserved
+.\" Copyright (C) 2005, Sun Microsystems, Inc. All Rights Reserved.
+.\" Copyright (c) 2014, Joyent, Inc.
+.\" Copyright 2018 Nexenta Systems, Inc.
+.\"
+.Dd August 2, 2018
+.Dt CONNECT 3C
+.Os
+.Sh NAME
+.Nm connect
+.Nd initiate a connection on a socket
+.Sh LIBRARY
+.Lb libc
+.Sh SYNOPSIS
+.In sys/types.h
+.In sys/socket.h
+.Ft int
+.Fo connect
+.Fa "int s"
+.Fa "const struct sockaddr *name"
+.Fa "socklen_t namelen"
+.Fc
+.Sh DESCRIPTION
+The parameter
+.Fa s
+is a socket.
+If it is of type
+.Dv SOCK_DGRAM ,
+.Fn connect
+specifies the peer with which the socket is to be associated.
+This address is the address to which datagrams are to be sent if a receiver is
+not explicitly designated.
+This address is the only address from which datagrams are to be received.
+If the socket
+.Fa s
+is of type
+.Dv SOCK_STREAM ,
+.Fn connect
+attempts to make a connection to another socket.
+The other socket is specified by
+.Fa name .
+.Fa name
+is an address in the communication space of the socket.
+Each communication space interprets the
+.Fa name
+parameter in its own way.
+If
+.Fa s
+is not bound, then
+.Fa s
+will be bound to an address selected by the underlying transport provider.
+Generally, stream sockets can successfully
+.Fn connect
+only once.
+Datagram sockets can use
+.Fn connect
+multiple times to change their association.
+Datagram sockets can dissolve the association by connecting to a null address.
+.Ss Non-blocking Sockets
+When a socket is created, it is by default a blocking socket.
+A socket may be configured to be non-blocking either at socket creation time or
+through the use of
+.Xr fcntl 2 .
+When a socket is set to be non-blocking, a call to
+.Fn connect
+initiates an asynchronous connection.
+If the connection cannot be completed without blocking, such as when making a
+TCP connection to a remote server, then  the connection attempt is made in the
+background and
+.Fn connect
+returns -1 and
+.Va errno
+is set to
+.Er EINPROGRESS .
+.Pp
+Applications can obtain the state of this connection attempt by polling the
+socket's file descriptor for
+.Dv POLLOUT .
+The event ports facility is the preferred means of polling on the file
+descriptor, see
+.Xr port_create 3C
+and
+.Xr port_get 3C
+for more information on event ports; however, applications may also use
+traditional portable routines like
+.Xr poll 2
+and
+.Xr select 3C .
+.Pp
+When an asynchronous connection has completed, the application must call
+.Xr getsockopt 3C
+using the macro
+.Dv SOL_SOCKET
+as the
+.Fa level
+argument and the macro
+.Dv SO_ERROR
+as the value of the
+.Fa option
+argument.
+If the value of the
+.Dv SO_ERROR
+socket option is zero, then the connect was successfully established.
+Otherwise, the connection could not be established and the value is the
+corresponding error code that would be commonly found in
+.Va errno .
+.Pp
+Even when a socket is in non-blocking mode, a call to
+.Fn connect
+may fail synchronously.
+If any error other than
+.Er EINPROGRESS
+or
+.Er EINTR
+occurs, then there is no need for the application to poll for asynchronous
+completion.
+Similarly, if a call to
+.Fn connect
+returns successfully, then the socket connection will be established and there
+is no need to poll for completion.
+.Sh RETURN VALUES
+If the connection or binding succeeds, 0 is returned.
+Otherwise, -1 is returned and sets
+.Va errno
+to indicate the error.
+.Sh EXAMPLES
+.Bl -tag -width Ds
+.It Sy Example 1 No Performing an asynchronous connection
+The following sample C program shows how to create and connect to a remote host
+using TCP.
+.Bd -literal
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#include <inttypes.h>
+#include <stdio.h>
+#include <strings.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <port.h>
+#include <unistd.h>
+#include <assert.h>
+
+int
+main(int argc, char *argv[])
+{
+	char *eptr;
+	long port;
+	int sock, ret, eport;
+	struct sockaddr_in6 sin6;
+
+	if (argc != 3) {
+		fprintf(stderr, "connect: <IP> <port>\\n");
+		return (1);
+	}
+
+	bzero(&sin6, sizeof (struct sockaddr_in6));
+	sin6.sin6_family = AF_INET6;
+
+	/*
+	 * Try to parse as an IPv6 address and then try v4.
+	 */
+	ret = inet_pton(AF_INET6, argv[1], &sin6.sin6_addr);
+	if (ret == -1) {
+		perror("inet_pton");
+		return (1);
+	} else if (ret == 0) {
+		struct in_addr v4;
+		ret = inet_pton(AF_INET, argv[1], &v4);
+		if (ret == -1) {
+			perror("inet_pton");
+			return (1);
+		} else if (ret == 0) {
+			fprintf(stderr, "connect: %s is not a valid "
+			    "IPv4 or IPv6 address\\n", argv[1]);
+			return (1);
+		}
+		/* N.B. Not a portable macro */
+		IN6_INADDR_TO_V4MAPPED(&v4, &sin6.sin6_addr);
+	}
+
+	errno = 0;
+	port = strtol(argv[2], &eptr, 10);
+	if (errno != 0 || *eptr != '\e0') {
+		fprintf(stderr, "failed to parse port %s\\n", argv[2]);
+		return (1);
+	}
+	if (port <= 0 || port > UINT16_MAX) {
+		fprintf(stderr, "invalid port: %ld\\n", port);
+		return (1);
+	}
+	sin6.sin6_port = htons(port);
+
+	sock = socket(AF_INET6, SOCK_STREAM | SOCK_NONBLOCK, 0);
+	if (sock < 0) {
+		perror("socket");
+		return (1);
+	}
+
+	eport = port_create();
+	if (eport < 0) {
+		perror("port_create");
+		(void) close(sock);
+		return (1);
+	}
+
+	ret = connect(sock, (struct sockaddr *)&sin6,
+	    sizeof (struct sockaddr_in6));
+	if (ret != 0 && errno != EINPROGRESS && errno != EINTR) {
+		perror("connect");
+		(void) close(sock);
+		(void) close(eport);
+		return (1);
+	}
+
+	if (ret != 0) {
+		port_event_t pe;
+		int err;
+		socklen_t sz = sizeof (err);
+		if (port_associate(eport, PORT_SOURCE_FD, sock, POLLOUT,
+		    NULL) != 0) {
+			perror("port_associate");
+			(void) close(sock);
+			(void) close(eport);
+			return (1);
+		}
+		if (port_get(eport, &pe, NULL) != 0) {
+			perror("port_get");
+			(void) close(sock);
+			(void) close(eport);
+			return (1);
+		}
+		assert(pe.portev_source == PORT_SOURCE_FD);
+		assert(pe.portev_object == (uintptr_t)sock);
+		if (getsockopt(sock, SOL_SOCKET, SO_ERROR, &err, &sz) != 0) {
+			perror("getsockopt");
+			(void) close(sock);
+			(void) close(eport);
+			return (1);
+		}
+		if (err != 0) {
+			/* Asynch connect failed */
+			fprintf(stderr, "asnchronous connect: %s\\n",
+			    strerror(err));
+			(void) close(sock);
+			(void) close(eport);
+			return (1);
+		}
+	}
+
+	/* Read and write to the socket and then clean up */
+
+	return (0);
+}
+.Ed
+.El
+.Sh ERRORS
+The call fails if:
+.Bl -tag -width Er
+.It Bq Er EACCES
+Search permission is denied for a component of the path prefix of the pathname
+in
+.Fa name .
+.It Bq Er EADDRINUSE
+The address is already in use.
+.It Bq Er EADDRNOTAVAIL
+The specified address is not available on the remote machine.
+.It Bq Er EAFNOSUPPORT
+Addresses in the specified address family cannot be used with this socket.
+.It Bq Er EALREADY
+The socket is non-blocking,  and a previous connection attempt has not yet been
+completed.
+.It Bq Er EBADF
+.Fa s
+is not a valid descriptor.
+.It Bq Er ECONNREFUSED
+The attempt to connect was forcefully rejected.
+The calling program should
+.Xr close 2
+the socket descriptor, and issue another
+.Xr socket 3C
+call to obtain a new descriptor before attempting another
+.Fn connect
+call.
+.It Bq Er EINPROGRESS
+The socket is non-blocking, and the connection cannot be completed immediately.
+See the section on
+.Sx Non-blocking Sockets
+for more information.
+.It Bq Er EINTR
+The connection attempt was interrupted before any data arrived by the delivery
+of a signal.
+The connection, however, will be established asynchronously.
+.It Bq Er EINVAL
+.Fa namelen
+is not the size of a valid address for the specified address family.
+.It Bq Er EIO
+An I/O error occurred while reading from or writing to the file system.
+.It Bq Er EISCONN
+The socket is already connected.
+.It Bq Er ELOOP
+Too many symbolic links were encountered in translating the pathname in
+.Fa name .
+.It Bq Er ENETUNREACH
+The network is not reachable from this host.
+.It Bq Er EHOSTUNREACH
+The remote host is not reachable from this host.
+.It Bq Er ENOENT
+A component of the path prefix of the pathname in
+.Fa name
+does not exist.
+.Pp
+The socket referred to by the pathname in
+.Fa name
+does not exist.
+.It Bq Er ENOSR
+There were insufficient STREAMS resources available to complete the operation.
+.It Bq Er ENXIO
+The server exited before the connection was complete.
+.It Bq Er ETIMEDOUT
+Connection establishment timed out without establishing a connection.
+.It Bq Er EWOULDBLOCK
+The socket is marked as non-blocking, and the requested operation would block.
+.El
+.Pp
+The following errors are specific to connecting names in the UNIX domain.
+These errors might not apply in future versions of the UNIX IPC domain.
+.Bl -tag -width Er
+.It Bq Er ENOTDIR
+A component of the path prefix of the pathname in
+.Fa name
+is not a directory.
+.It Bq Er ENOTSOCK
+.Fa s
+is not a socket.
+.It Bq Er EPROTOTYPE
+The file that is referred to by
+.Fa name
+is a socket of a type other than type
+.Fa s .
+For example,
+.Fa s
+is a
+.Dv SOCK_DGRAM
+socket, while
+.Fa name
+refers to a
+.Dv SOCK_STREAM
+socket.
+.El
+.Sh MT-LEVEL
+.Sy Safe
+.Sh SEE ALSO
+.Xr close 2 ,
+.Xr accept 3C ,
+.Xr getsockname 3C ,
+.Xr select 3C ,
+.Xr sockaddr 3C ,
+.Xr socket 3C ,
+.Xr socket.h 3HEAD ,
+.Xr attributes 5
--- /dev/null	Sun Aug  5 23:41:09 2018
+++ new/usr/src/man/man3c/getpeername.3c	Sun Aug  5 23:41:09 2018
@@ -0,0 +1,86 @@
+.\"
+.\" 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]
+.\"
+.\"
+.\" Copyright 1989 AT&T
+.\" Copyright (c) 1998, Sun Microsystems, Inc.  All Rights Reserved
+.\" Copyright 2018 Nexenta Systems, Inc.
+.\"
+.Dd August 2, 2018
+.Dt GETPEERNAME 3C
+.Os
+.Sh NAME
+.Nm getpeername
+.Nd get name of connected peer
+.Sh LIBRARY
+.Lb libc
+.Sh SYNOPSIS
+.In sys/types.h
+.In sys/socket.h
+.Ft int
+.Fo getpeername
+.Fa "int s"
+.Fa "struct sockaddr *restrict name"
+.Fa "socklen_t *namelen"
+.Fc
+.Sh DESCRIPTION
+.Fn getpeername
+returns the name of the peer connected to socket
+.Fa s .
+The
+.Vt int
+pointed to by the
+.Fa namelen
+parameter should be initialized to indicate the amount of space pointed to by
+.Fa name .
+On return it contains the actual size of the name returned (in bytes), prior to
+any truncation.
+The name is truncated if the buffer provided is too small.
+.Sh RETURN VALUES
+If successful,
+.Fn getpeername
+returns 0; otherwise it returns -1 and sets
+.Va errno
+to indicate the error.
+.Sh ERRORS
+The call succeeds unless:
+.Bl -tag -width Er
+.It Bq Er EBADF
+The argument
+.Fa s
+is not a valid descriptor.
+.It Bq Er ENOMEM
+There was insufficient user memory for the operation to complete.
+.It Bq Er ENOSR
+There were insufficient STREAMS resources available for the operation to
+complete.
+.It Bq Er ENOTCONN
+The socket is not connected.
+.It Bq Er ENOTSOCK
+The argument
+.Fa s
+is not a socket.
+.El
+.Sh MT-LEVEL
+.Sy Safe
+.Sh SEE ALSO
+.Xr accept 3C ,
+.Xr bind 3C ,
+.Xr getsockname 3C ,
+.Xr sockaddr 3C ,
+.Xr socket 3C ,
+.Xr socket.h 3HEAD ,
+.Xr attributes 5
--- /dev/null	Sun Aug  5 23:41:09 2018
+++ new/usr/src/man/man3c/getsockname.3c	Sun Aug  5 23:41:09 2018
@@ -0,0 +1,80 @@
+.\"
+.\" 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]
+.\"
+.\"
+.\" Copyright 1989 AT&T
+.\" Copyright (c) 1997, Sun Microsystems, Inc.  All Rights Reserved
+.\" Copyright 2018 Nexenta Systems, Inc.
+.\"
+.Dd August 2, 2018
+.Dt GETSOCKNAME 3C
+.Os
+.Sh NAME
+.Nm getsockname
+.Nd get socket name
+.Sh LIBRARY
+.Lb libc
+.Sh SYNOPSIS
+.In sys/types.h
+.In sys/socket.h
+.Ft int
+.Fo getsockname
+.Fa "int s"
+.Fa "struct sockaddr *restrict name"
+.Fa "socklen_t *namelen"
+.Fc
+.Sh DESCRIPTION
+.Fn getsockname
+returns the current
+.Fa name
+for socket
+.Fa s .
+The
+.Fa namelen
+parameter should be initialized to indicate the amount of space pointed to by
+.Fa name .
+On return it contains the actual size in bytes of the name returned.
+.Sh RETURN VALUES
+If successful,
+.Fn getsockname
+returns 0; otherwise it returns -1 and sets
+.Va errno
+to indicate the error.
+.Sh ERRORS
+The call succeeds unless:
+.Bl -tag -width Er
+.It Bq Er EBADF
+The argument
+.Fa s
+is not a valid file descriptor.
+.It Bq Er ENOMEM
+There was insufficient memory available for the operation to complete.
+.It Bq Er ENOSR
+There were insufficient STREAMS resources available for the operation to
+complete.
+.It Bq Er ENOTSOCK
+The argument
+.Fa s
+is not a socket.
+.El
+.Sh MT-LEVEL
+.Sy Safe
+.Sh SEE ALSO
+.Xr bind 3C ,
+.Xr getpeername 3C ,
+.Xr sockaddr 3C ,
+.Xr socket 3C ,
+.Xr attributes 5
--- /dev/null	Sun Aug  5 23:41:09 2018
+++ new/usr/src/man/man3c/getsockopt.3c	Sun Aug  5 23:41:09 2018
@@ -0,0 +1,466 @@
+.\"
+.\" 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]
+.\"
+.\"
+.\" Copyright 1989 AT&T
+.\" Copyright (C) 2009, Sun Microsystems, Inc. All Rights Reserved
+.\" Copyright 2018 Nexenta Systems, Inc.
+.\"
+.Dd August 2, 2018
+.Dt GETSOCKOPT 3C
+.Os
+.Sh NAME
+.Nm getsockopt ,
+.Nm setsockopt
+.Nd get and set options on sockets
+.Sh LIBRARY
+.Lb libc
+.Sh SYNOPSIS
+.In sys/types.h
+.In sys/socket.h
+.Ft int
+.Fo getsockopt
+.Fa "int s"
+.Fa "int level"
+.Fa "int optname"
+.Fa "void *restrict optval"
+.Fa "socklen_t *optlen"
+.Fc
+.Ft int
+.Fo setsockopt
+.Fa "int s"
+.Fa "int level"
+.Fa "int optname"
+.Fa "const void *optval"
+.Fa "socklen_t optlen"
+.Fc
+.Sh DESCRIPTION
+The
+.Fn getsockopt
+and
+.Fn setsockopt
+functions manipulate options associated with a socket.
+Options may exist at multiple protocol levels; they are always present at the
+uppermost "socket" level.
+.Pp
+The
+.Fa level
+argument specifies the protocol level at which the option resides.
+To manipulate options at the socket level, specify the
+.Fa level
+argument as
+.Dv SOL_SOCKET .
+To manipulate options at the protocol level, supply the appropriate protocol
+number for the protocol controlling the option.
+For example, to indicate that an option will be interpreted by the TCP, set
+.Fa level
+to the protocol number of TCP, as defined in the
+.In netinet/in.h
+header, or as determined by using
+.Xr getprotobyname 3SOCKET .
+Some socket protocol families may also define additional levels, such as
+.Dv SOL_ROUTE .
+Only socket-level options are described here.
+.Pp
+The parameters
+.Fa optval
+and
+.Fa optlen
+are used to access option values for
+.Fn setsockopt .
+For
+.Fn getsockopt ,
+they identify a buffer in which the value(s) for the requested option(s) are to
+be returned.
+For
+.Fn getsockopt ,
+.Fa optlen
+is a value-result parameter, initially containing the size of the buffer pointed
+to by
+.Fa optval ,
+and modified on return to indicate the actual size of the value returned.
+Use a 0
+.Fa optval
+if no option value is to be supplied or returned.
+.Pp
+The
+.Fa optname
+and any specified options are passed uninterpreted to the appropriate protocol
+module for interpretation.
+The include file
+.In sys/socket.h
+contains definitions for the socket-level options described below.
+Options at other protocol levels vary in format and name.
+.Pp
+Most socket-level options take an
+.Vt int
+for
+.Fa optval .
+For
+.Fn setsockopt ,
+the
+.Fa optval
+parameter should be non-zero to enable a boolean option, or zero if the option
+is to be disabled.
+.Dv SO_LINGER
+uses a
+.Vt "struct linger"
+parameter that specifies the desired state of the option and the linger
+interval.
+.Vt "struct linger"
+is defined in
+.In sys/socket.h .
+.Vt "struct linger"
+contains the following members:
+.Bl -tag -width "l_linger"
+.It Va l_onoff
+on = 1/off = 0
+.It Va l_linger
+linger time, in seconds
+.El
+.Pp
+The following options are recognized at the socket level.
+Except as noted, each may be examined with
+.Fn getsockopt
+and set with
+.Fn setsockopt .
+.Bl -tag -width "SO_DGRAM_ERRIND"
+.It Dv SO_DEBUG
+enable/disable recording of debugging information
+.It Dv SO_REUSEADDR
+enable/disable local address reuse
+.It Dv SO_KEEPALIVE
+enable/disable keep connections alive
+.It Dv SO_DONTROUTE
+enable/disable routing bypass for outgoing messages
+.It Dv SO_LINGER
+linger on close if data is present
+.It Dv SO_BROADCAST
+enable/disable permission to transmit broadcast messages
+.It Dv SO_OOBINLINE
+enable/disable reception of out-of-band data in band
+.It Dv SO_SNDBUF
+set buffer size for output
+.It Dv SO_RCVBUF
+set buffer size for input
+.It Dv SO_DGRAM_ERRIND
+application wants delayed error
+.It Dv SO_TIMESTAMP
+enable/disable reception of timestamp with datagrams
+.It Dv SO_EXCLBIND
+enable/disable exclusive binding of the socket
+.It Dv SO_TYPE
+get the type of the socket (get only)
+.It Dv SO_ERROR
+get and clear error on the socket (get only)
+.It Dv SO_MAC_EXEMPT
+get or set mandatory access control on the socket.
+This option is available only when the system is configured with Trusted
+Extensions.
+.It Dv SO_ALLZONES
+bypass zone boundaries (privileged).
+.It Dv SO_DOMAIN
+get the domain used in the socket (get only)
+.It Dv SO_PROTOTYPE
+for socket in domains
+.Dv PF_INET
+and
+.Dv PF_INET6 ,
+get the underlying protocol number used in the socket.
+For socket in domain
+.Dv PF_ROUTE ,
+get the address family used in the socket.
+.El
+.Pp
+The
+.Dv SO_DEBUG
+option enables debugging in the underlying protocol modules.
+The
+.Dv SO_REUSEADDR
+option indicates that the rules used in validating addresses supplied in a
+.Xr bind 3C
+call should allow reuse of local addresses.
+The
+.Dv SO_KEEPALIVE
+option enables the periodic transmission of messages on a connected socket.
+If the connected party fails to respond to these messages, the connection is
+considered broken and threads using the socket are notified using a
+.Dv SIGPIPE
+signal.
+The
+.Dv SO_DONTROUTE
+option indicates that outgoing messages should bypass the standard routing
+facilities.
+Instead, messages are directed to the appropriate network interface according
+to the network portion of the destination address.
+.Pp
+The
+.Dv SO_LINGER
+option controls the action taken when unsent messages are queued on a socket and
+a
+.Xr close 2
+is performed.
+If the socket promises reliable delivery of data and
+.Dv SO_LINGER
+is set, the system will block the thread on the
+.Xr close 2
+attempt until it is able to transmit the data or until it decides it is unable
+to deliver the information (a timeout period, termed the linger interval, is
+specified in the
+.Fn setsockopt
+call when
+.Dv SO_LINGER
+is requested).
+If
+.Dv SO_LINGER
+is disabled and a
+.Xr close 2
+is issued, the system will process the
+.Xr close 2
+in a manner that allows the thread to continue as quickly as possible.
+.Pp
+The option
+.Dv SO_BROADCAST
+requests permission to send broadcast datagrams on the socket.
+With protocols that support out-of-band data, the
+.Dv SO_OOBINLINE
+option requests that out-of-band data be placed in the normal data input queue
+as received; it will then be accessible with
+.Xr recv 3C
+or
+.Xr read 2
+calls without the
+.Dv MSG_OOB
+flag.
+.Pp
+The
+.Dv SO_SNDBUF
+and
+.Dv SO_RCVBUF
+options adjust the normal buffer sizes allocated for output and input buffers,
+respectively.
+The buffer size may be increased for high-volume connections or may be decreased
+to limit the possible backlog of incoming data.
+The maximum buffer size for UDP is determined by the value of the
+.Xr ndd 1M
+variable
+.Cm udp_max_buf .
+The maximum buffer size for TCP is determined the value of the
+.Xr ndd 1M
+variable
+.Cm tcp_max_buf .
+Use the
+.Xr ndd 1M
+utility to determine the current default values.
+At present, lowering
+.Dv SO_RCVBUF
+on a TCP connection after it has been established has no effect.
+.Pp
+By default, delayed errors (such as ICMP
+.Dq Port Unreachable
+packets) are returned only for connected datagram sockets.
+The
+.Dv SO_DGRAM_ERRIND
+option makes it possible to receive errors for datagram sockets that are not
+connected.
+When this option is set, certain delayed errors received after completion of a
+.Xr sendto 3C
+or
+.Xr sendmsg 3C
+operation will cause a subsequent
+.Xr sendto 3C
+or
+.Xr sendmsg 3C
+operation using the same destination address
+.Po Fa to
+parameter
+.Pc
+to fail with the appropriate error.
+See
+.Xr send 3C .
+.Pp
+If the
+.Dv SO_TIMESTAMP
+option is enabled on a
+.Dv SO_DGRAM
+or a
+.Dv SO_RAW
+socket, the
+.Xr recvmsg 3XNET
+call will return a timestamp in the native data format, corresponding to when
+the datagram was received.
+.Pp
+The
+.Dv SO_EXCLBIND
+option is used to enable or disable the exclusive binding of a socket.
+It overrides the use of the
+.Dv SO_REUSEADDR
+option to reuse an address on
+.Xr bind 3C .
+The actual semantics of the
+.Dv SO_EXCLBIND
+option depend on the underlying protocol.
+See
+.Xr tcp 7P
+or
+.Xr udp 7P
+for more information.
+.Pp
+The
+.Dv SO_TYPE
+and
+.Dv SO_ERROR
+options are used only with
+.Fn getsockopt .
+The
+.Dv SO_TYPE
+option returns the type of the socket, for example,
+.Dv SOCK_STREAM .
+It is useful for servers that inherit sockets on startup.
+The
+.Dv SO_ERROR
+option returns any pending error on the socket and clears the error status.
+It may be used to check for asynchronous errors on connected datagram sockets or
+for other asynchronous errors.
+.Pp
+The
+.Dv SO_MAC_EXEMPT
+option is used to toggle socket behavior with unlabeled peers.
+A socket that has this option enabled can communicate with an unlabeled peer if
+it is in the global zone or has a label that dominates the default label of the
+peer.
+Otherwise, the socket must have a label that is equal to the default label of
+the unlabeled peer.
+Calling
+.Fn setsockopt
+with this option returns an
+.Er EACCES
+error if the process lacks the
+.Dv NET_MAC_AWARE
+privilege or if the socket is bound.
+The
+.Dv SO_MAC_EXEMPT
+option is available only when the system is configured with Trusted Extensions.
+.Pp
+The
+.Dv SO_ALLZONES
+option can be used to bypass zone boundaries between shared-IP zones.
+Normally, the system prevents a socket from being bound to an address that is
+not assigned to the current zone.
+It also prevents a socket that is bound to a wildcard address from receiving
+traffic for other zones.
+However, some daemons which run in the global zone might need to send and
+receive traffic using addresses that belong to other shared-IP zones.
+If set before a socket is bound,
+.Dv SO_ALLZONES
+causes the socket to ignore zone boundaries between shared-IP zones and permits
+the socket to be bound to any address assigned to the shared-IP zones.
+If the socket is bound to a wildcard address, it receives traffic intended for
+all shared-IP zones and behaves as if an equivalent socket were bound in each
+active shared-IP zone.
+Applications that use the
+.Dv SO_ALLZONES
+option to initiate connections or send datagram traffic should specify the
+source address for outbound traffic by binding to a specific address.
+There is no effect from setting this option in an exclusive-IP zone.
+Setting this option requires the
+.Em sys_net_config
+privilege.
+See
+.Xr zones 5 .
+.Sh RETURN VALUES
+If successful,
+.Fn getsockopt
+and
+.Fn setsockopt
+return 0.
+Otherwise, the functions return -1 and set
+.Va errno
+to indicate the error.
+.Sh ERRORS
+The
+.Fn getsockopt
+and
+.Fn setsockopt
+calls succeed unless:
+.Bl -tag -width Er
+.It Bq Er EBADF
+The argument
+.Fa s
+is not a valid file descriptor.
+.It Bq Er ENOMEM
+There was insufficient memory available for the operation to complete.
+.It Bq Er ENOPROTOOPT
+The option is unknown at the level indicated.
+.It Bq Er ENOSR
+There were insufficient STREAMS resources available for the operation to
+complete.
+.It Bq Er ENOTSOCK
+The argument
+.Fa s
+is not a socket.
+.It Bq Er ENOBUFS
+.Dv SO_SNDBUF
+or
+.Dv SO_RCVBUF
+exceeds a system limit.
+.It Bq Er EINVAL
+Invalid length for a given socket option.
+.It Bq Er EHOSTUNREACH
+Invalid address for
+.Dv IP_MULTICAST_IF .
+.It Bq Er EINVAL
+Not a multicast address for
+.Dv IP_ADD_MEMBERSHIP
+and
+.Dv IP_DROP_MEMBERSHIP .
+.It Bq Er EADDRNOTAVAIL
+Bad interface address for
+.Dv IP_ADD_MEMBERSHIP
+and
+.Dv IP_DROP_MEMBERSHIP .
+.It Bq Er EADDRINUSE
+Address already joined for
+.Dv IP_ADD_MEMBERSHIP .
+.It Bq Er ENOENT
+Address not joined for
+.Dv IP_DROP_MEMBERSHIP .
+.It Bq Er EPERM
+No permissions.
+.It Bq Er EACCES
+Permission denied.
+.It Bq Er EINVAL
+The specified option is invalid at the specified socket level, or the socket
+has been shut down.
+.El
+.Sh MT-LEVEL
+.Sy Safe
+.Sh SEE ALSO
+.Xr ndd 1M ,
+.Xr close 2 ,
+.Xr ioctl 2 ,
+.Xr read 2 ,
+.Xr bind 3C ,
+.Xr recv 3C ,
+.Xr send 3C ,
+.Xr socket 3C ,
+.Xr socket.h 3HEAD ,
+.Xr getprotobyname 3SOCKET ,
+.Xr recvmsg 3XNET ,
+.Xr attributes 5 ,
+.Xr zones 5 ,
+.Xr tcp 7P ,
+.Xr udp 7P
--- /dev/null	Sun Aug  5 23:41:09 2018
+++ new/usr/src/man/man3c/listen.3c	Sun Aug  5 23:41:09 2018
@@ -0,0 +1,102 @@
+.\"
+.\" 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]
+.\"
+.\"
+.\" Copyright 1989 AT&T
+.\" Copyright (C) 1999, Sun Microsystems, Inc. All Rights Reserved.
+.\" Copyright 2018 Nexenta Systems, Inc.
+.\"
+.Dd August 2, 2018
+.Dt LISTEN 3C
+.Os
+.Sh NAME
+.Nm listen
+.Nd listen for connections on a socket
+.Sh LIBRARY
+.Lb libc
+.Sh SYNOPSIS
+.In sys/types.h
+.In sys/socket.h
+.Ft int
+.Fo listen
+.Fa "int s"
+.Fa "int backlog"
+.Fc
+.Sh DESCRIPTION
+To accept connections, a socket is first created with
+.Xr socket 3C ,
+a backlog for incoming connections is specified with
+.Fn listen
+and then the connections are accepted with
+.Xr accept 3C .
+The
+.Fn listen
+call applies only to sockets of type
+.Dv SOCK_STREAM
+or
+.Dv SOCK_SEQPACKET .
+.Pp
+The
+.Fa backlog
+parameter defines the maximum length the queue of pending connections may grow
+to.
+.Pp
+If a connection request arrives with the queue full, the client will receive an
+error with an indication of
+.Er ECONNREFUSED
+for
+.Dv AF_UNIX
+sockets.
+If the underlying protocol supports retransmission, the connection request may
+be ignored so that retries may succeed.
+For
+.Dv AF_INET
+and
+.Dv AF_INET6
+sockets, the TCP will retry the connection.
+If the
+.Fa backlog
+is not cleared by the time the tcp times out, the connect will fail with
+.Er ETIMEDOUT .
+.Sh RETURN VALUES
+A 0 return value indicates success; -1 indicates an error.
+.Sh ERRORS
+The call fails if:
+.Bl -tag -width Er
+.It Bq Er EBADF
+The argument
+.Fa s
+is not a valid file descriptor.
+.It Bq Er ENOTSOCK
+The argument
+.Fa s
+is not a socket.
+.It Bq Er EOPNOTSUPP
+The socket is not of a type that supports the operation
+.Fn listen .
+.El
+.Sh MT-LEVEL
+.Sy Safe
+.Sh SEE ALSO
+.Xr accept 3C ,
+.Xr connect 3C ,
+.Xr socket 3C ,
+.Xr socket.h 3HEAD ,
+.Xr attributes 5
+.Sh NOTES
+There is currently no
+.Fa backlog
+limit.
--- /dev/null	Sun Aug  5 23:41:09 2018
+++ new/usr/src/man/man3c/recv.3c	Sun Aug  5 23:41:09 2018
@@ -0,0 +1,259 @@
+.\"
+.\" 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]
+.\"
+.\"
+.\" Copyright 1989 AT&T
+.\" Copyright (C) 2006, Sun Microsystems, Inc. All Rights Reserved
+.\" Copyright 2018 Nexenta Systems, Inc.
+.\"
+.Dd August 2, 2018
+.Dt RECV 3C
+.Os
+.Sh NAME
+.Nm recv ,
+.Nm recvfrom ,
+.Nm recvmsg
+.Nd receive a message from a socket
+.Sh LIBRARY
+.Lb libc
+.Sh SYNOPSIS
+.In sys/types.h
+.In sys/socket.h
+.In sys/uio.h
+.Ft ssize_t
+.Fo recv
+.Fa "int s"
+.Fa "void *buf"
+.Fa "size_t len"
+.Fa "int flags"
+.Fc
+.Ft ssize_t
+.Fo recvfrom
+.Fa "int s"
+.Fa "void *restrict buf"
+.Fa "size_t len"
+.Fa "int flags"
+.Fa "struct sockaddr *restrict from"
+.Fa "socklen_t *fromlen"
+.Fc
+.Ft ssize_t
+.Fo recvmsg
+.Fa "int s"
+.Fa "struct msghdr *msg"
+.Fa "int flags"
+.Fc
+.Sh DESCRIPTION
+The
+.Fn recv ,
+.Fn recvfrom ,
+and
+.Fn recvmsg
+functions are used to receive messages from another socket.
+The
+.Fa s
+socket is created with
+.Xr socket 3C .
+.Pp
+If
+.Fa from
+is a non-
+.Dv NULL
+pointer, the source address of the message is filled in.
+The value-result parameter
+.Fa fromlen
+is initialized to the size of the buffer associated with
+.Fa from
+and modified on return to indicate the actual size of the address stored in the
+buffer.
+The length of the message is returned.
+If a message is too long to fit in the supplied buffer, excess bytes may be
+discarded depending on the type of socket from which the message is received.
+See
+.Xr socket 3C .
+.Pp
+If no messages are available at the socket, the receive call waits for a message
+to arrive.
+If the socket is non-blocking, -1 is returned with the external variable
+.Va errno
+set to
+.Er EWOULDBLOCK .
+See
+.Xr fcntl 2 .
+.Pp
+For processes on the same host,
+.Fn recvmsg
+can be used to receive a file descriptor from another process, but it cannot
+receive ancillary data.
+See
+.Xr libxnet 3LIB .
+.Pp
+If a zero-length buffer is specified for a message, an EOF condition results
+that is indistinguishable from the successful transfer of a file descriptor.
+For that reason, one or more bytes of data should be provided when
+.Fn recvmsg
+passes a file descriptor.
+.Pp
+The
+.Xr select 3C
+call can be used to determine when more data arrives.
+.Pp
+The
+.Fa flags
+parameter is formed by an OR operation on one or more of the following:
+.Bl -tag -width Ds
+.It Dv MSG_OOB
+Read any out-of-band data present on the socket rather than the regular in-band
+data.
+.It Dv MSG_PEEK
+Peek at the data present on the socket.
+The data is returned, but not consumed to allow a subsequent receive operation
+to see the same data.
+.It Dv MSG_WAITALL
+Messages are blocked until the full amount of data requested is returned.
+The
+.Fn recv
+function can return a smaller amount of data if a signal is caught, the
+connection is terminated,
+.Dv MSG_PEEK
+is specified, or if an error is pending for the socket.
+.It Dv MSG_DONTWAIT
+Pending messages received on the connection are returned.
+If data is unavailable, the function does not block.
+This behavior is the equivalent to specifying
+.Dv O_NONBLOCK
+on the file descriptor of a socket, except that write requests are unaffected.
+.El
+.Pp
+The
+.Fn recvmsg
+function call uses a
+.Va msghdr
+structure defined in
+.In sys/socket.h
+to minimize the number of directly supplied parameters.
+.Sh RETURN VALUES
+Upon successful completion, these functions return the number of bytes
+received.
+Otherwise, they return -1 and set
+.Va errno
+to indicate the error.
+.Sh ERRORS
+The
+.Fn recv ,
+.Fn recvfrom ,
+and
+.Fn recvmsg
+functions return errors under the following conditions:
+.Bl -tag -width Er
+.It Bq Er EBADF
+The
+.Fa s
+file descriptor is invalid.
+.It Bq Er ECONNRESET
+The
+.Fa s
+argument refers to a connection oriented socket and the connection was forcibly
+closed by the peer and is no longer valid.
+I/O can no longer be performed to filedes.
+.It Bq Er EINVAL
+The
+.Dv MSG_OOB
+flag is set and no out-of-band data is available.
+.It Bq Er EINTR
+The operation is interrupted by the delivery of a signal before any data is
+available to be received.
+.It Bq Er EIO
+An I/O error occurs while reading from or writing to the file system.
+.It Bq Er ENOMEM
+Insufficient user memory is available to complete operation.
+.It Bq Er ENOSR
+Insufficient STREAMS resources are available for the operation to complete.
+.It Bq Er ENOTSOCK
+.Fa s
+is not a socket.
+.It Bq Er ESTALE
+A stale NFS file handle exists.
+.It Bq Er EWOULDBLOCK
+The socket is marked non-blocking and the requested operation would block.
+.It Bq Er ECONNREFUSED
+The requested connection was refused by the peer.
+For connected IPv4 and IPv6 datagram sockets, this indicates that the system
+received an ICMP
+.Dq Destination Port Unreachable
+message from the peer.
+.El
+.Pp
+The
+.Fn recv
+and
+.Fn recvfrom
+functions fail under the following conditions:
+.Bl -tag -width Er
+.It Bq Er EINVAL
+The
+.Fa len
+argument overflows a
+.Vt ssize_t .
+.El
+.Pp
+The
+.Fn recvmsg
+function returns errors under the following conditions:
+.Bl -tag -width Er
+.It Bq Er EINVAL
+The
+.Va msg_iovlen
+member of the
+.Va msghdr
+structure pointed to by
+.Fa msg
+is less than or equal to 0, or greater than
+.Dv [IOV_MAX} .
+See
+.Xr Intro 2
+for a definition of
+.Dv [IOV_MAX} .
+.Pp
+One of the
+.Va iov_len
+values in the
+.Va msg_iov
+array member of the
+.Va msghdr
+structure pointed to by
+.Fa msg
+is negative, or the sum of the
+.Va iov_len
+values in the
+.Va msg_iov
+array overflows a
+.Vt ssize_t .
+.El
+.Sh MT-LEVEL
+.Sy Safe
+.Sh SEE ALSO
+.Xr fcntl 2 ,
+.Xr ioctl 2 ,
+.Xr read 2 ,
+.Xr connect 3C ,
+.Xr getsockopt 3C ,
+.Xr select 3C ,
+.Xr send 3C ,
+.Xr sockaddr 3C ,
+.Xr socket 3C ,
+.Xr socket.h 3HEAD ,
+.Xr libxnet 3LIB ,
+.Xr attributes 5
--- /dev/null	Sun Aug  5 23:41:09 2018
+++ new/usr/src/man/man3c/send.3c	Sun Aug  5 23:41:09 2018
@@ -0,0 +1,291 @@
+.\"
+.\" 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]
+.\"
+.\"
+.\" Copyright 1989 AT&T
+.\" Copyright (C) 2009, Sun Microsystems, Inc. All Rights Reserved
+.\" Copyright 2018 Nexenta Systems, Inc.
+.\"
+.Dd August 2, 2018
+.Dt SEND 3C
+.Os
+.Sh NAME
+.Nm send ,
+.Nm sendto ,
+.Nm sendmsg
+.Nd send a message from a socket
+.Sh LIBRARY
+.Lb libc
+.Sh SYNOPSIS
+.In sys/types.h
+.In sys/socket.h
+.Ft ssize_t
+.Fo send
+.Fa "int s"
+.Fa "const void *msg"
+.Fa "size_t len"
+.Fa "int flags"
+.Fc
+.Ft ssize_t
+.Fo sendto
+.Fa "int s"
+.Fa "const void *msg"
+.Fa "size_t len"
+.Fa "int flags"
+.Fa "const struct sockaddr *to"
+.Fa "socklen_t tolen"
+.Fc
+.Ft ssize_t
+.Fo sendmsg
+.Fa "int s"
+.Fa "const struct msghdr *msg"
+.Fa "int flags"
+.Fc
+.Sh DESCRIPTION
+The
+.Fn send ,
+.Fn sendto ,
+and
+.Fn sendmsg
+functions are used to transmit a message to another transport end-point.
+The
+.Fn send
+function can be used only when the socket is in a connected state.
+See
+.Xr connect 3C .
+The
+.Fn sendto
+and
+.Fn sendmsg
+functions can be used at any time.
+The
+.Fa s
+socket is created with
+.Xr socket 3C .
+.Pp
+The address of the target is supplied by
+.Fa to
+with a
+.Fa tolen
+parameter used to specify the size.
+The length of the message is supplied by the
+.Fa len
+parameter.
+For socket types such as
+.Dv SOCK_DGRAM
+and
+.Dv SOCK_RAW
+that require atomic messages, the error
+.Er EMSGSIZE
+is returned and the message is not transmitted when it is too long to pass
+atomically through the underlying protocol.
+The same restrictions do not apply to
+.Dv SOCK_STREAM
+sockets.
+.Pp
+A return value -1 indicates locally detected errors.
+It does not imply a delivery failure.
+.Pp
+If the socket does not have enough buffer space available to hold a message,
+the
+.Fn send
+function blocks the message, unless the socket has been placed in non-blocking
+I/O mode
+.Po see
+.Xr fcntl 2
+.Pc .
+The
+.Xr select 3C
+or
+.Xr poll 2
+call can be used to determine when it is possible to send more data.
+.Pp
+The
+.Fa flags
+parameter is formed from the bitwise OR of zero or more of the following:
+.Bl -tag -width "MSG_DONTROUTE"
+.It Dv MSG_OOB
+Send out-of-band data on sockets that support this notion.
+The underlying protocol must also support out-of-band data.
+Only
+.Dv SOCK_STREAM
+sockets created in the
+.Dv AF_INET
+or the
+.Dv AF_INET6
+address family support out-of-band data.
+.It Dv MSG_DONTROUTE
+The
+.Dv SO_DONTROUTE
+option is turned on for the duration of the operation.
+It is used only by diagnostic or routing programs.
+.It Dv MSG_NOSIGNAL
+Don't generate the
+.Dv SIGPIPE
+signal when a stream-oriented socket is no longer connected.
+.El
+.Pp
+See
+.Xr recv 3C
+for a description of the
+.Va msghdr
+structure.
+.Sh RETURN VALUES
+Upon successful completion, these functions return the number of bytes sent.
+Otherwise, they return -1 and set
+.Va errno
+to indicate the error.
+.Sh ERRORS
+The
+.Fn send ,
+.Fn sendto ,
+and
+.Fn sendmsg
+functions return errors under the following conditions:
+.Bl -tag -width Er
+.It Bq Er EBADF
+.Fa s
+is not a valid file descriptor.
+.It Bq Er ECONNRESET
+The
+.Fa s
+argument refers to a connection oriented socket and the connection was forcibly
+closed by the peer and is no longer valid.
+I/O can no longer be performed to filedes.
+.It Bq Er EINTR
+The operation was interrupted by delivery of a signal before any data could be
+buffered to be sent.
+.It Bq Er EMSGSIZE
+The message is too large to be sent all at once (as the socket requires), or the
+.Va msg_iovlen
+member of the
+.Va msghdr
+structure pointed to by message is less than or equal to 0 or is greater than
+.Brq Dv IOV_MAX .
+.It Bq Er ENOMEM
+Insufficient memory is available to complete the operation.
+.It Bq Er ENOSR
+Insufficient STREAMS resources are available for the operation to complete.
+.It Bq Er ENOTSOCK
+.Fa s
+is not a socket.
+.It Bq Er EWOULDBLOCK
+The socket is marked non-blocking and the requested operation would block.
+.Er EWOULDBLOCK
+is also returned when sufficient memory is not immediately available to allocate
+a suitable buffer.
+In such a case, the operation can be retried later.
+.It Bq Er ECONNREFUSED
+The requested connection was refused by the peer.
+For connected IPv4 and IPv6 datagram sockets, this indicates that the system
+received an ICMP
+.Dq Destination Port Unreachable
+message from the peer in response to some prior transmission.
+.El
+.Pp
+The
+.Fn send
+and
+.Fn sendto
+functions return errors under the following conditions:
+.Bl -tag -width Er
+.It Bq Er EINVAL
+The
+.Fa len
+argument overflows a
+.Vt ssize_t .
+.Pp
+Inconsistent port attributes for system call.
+.El
+.Pp
+The
+.Fn sendto
+function returns errors under the following conditions:
+.Bl -tag -width Er
+.It Bq Er EINVAL
+The value specified for the
+.Fa tolen
+parameter is not the size of a valid address for the specified address family.
+.It Bq Er EISCON
+A destination address was specified and the socket is already connected.
+.El
+.Pp
+The
+.Fn sendmsg
+function returns errors under the following conditions:
+.Bl -tag -width Er
+.It Bq Er EINVAL
+The
+.Va msg_iovlen
+member of the
+.Va msghdr
+structure pointed to by
+.Fa msg
+is less than or equal to 0, or the sum of the
+.Va iov_len
+values in the
+.Va msg_iov
+array overflows a
+.Vt ssize_t .
+.Pp
+One of the
+.Va iov_len
+values in the
+.Va msg_iov
+array member of the
+.Va msghdr
+structure pointed to by
+.Fa msg
+is negative, or the sum of the
+.Va iov_len
+values in the
+.Va msg_iov
+array overflows a
+.Vt ssize_t .
+.Pp
+.Va msg_iov
+contents are inconsistent with port attributes.
+.El
+.Pp
+The
+.Fn send
+function returns errors under the following conditions:
+.Bl -tag -width Er
+.It Bq Er EPIPE
+The socket is shut down for writing, or the socket is connection-mode and is no
+longer connected.
+In the latter case, if the socket is of type
+.Dv SOCK_STREAM ,
+the
+.Dv SIGPIPE
+signal is generated to the calling thread unless the
+.Dv MSG_NOSIGNAL
+flag is set.
+.El
+.Sh MT-LEVEL
+.Sy Safe
+.Sh SEE ALSO
+.Xr fcntl 2 ,
+.Xr poll 2 ,
+.Xr write 2 ,
+.Xr connect 3C ,
+.Xr getsockopt 3C ,
+.Xr recv 3C ,
+.Xr select 3C ,
+.Xr sockaddr 3C ,
+.Xr socket 3C ,
+.Xr socket.h 3HEAD ,
+.Xr attributes 5
--- /dev/null	Sun Aug  5 23:41:10 2018
+++ new/usr/src/man/man3c/shutdown.3c	Sun Aug  5 23:41:10 2018
@@ -0,0 +1,89 @@
+.\"
+.\" 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]
+.\"
+.\"
+.\" Copyright 1989 AT&T
+.\" Copyright (c) 2005, Sun Microsystems, Inc.  All Rights Reserved.
+.\" Copyright 2018 Nexenta Systems, Inc.
+.\"
+.Dd August 2, 2018
+.Dt SHUTDOWN 3C
+.Os
+.Sh NAME
+.Nm shutdown
+.Nd shut down part of a full-duplex connection
+.Sh LIBRARY
+.Lb libc
+.Sh SYNOPSIS
+.In sys/socket.h
+.Ft int
+.Fo shutdown
+.Fa "int s"
+.Fa "int how"
+.Fc
+.Sh DESCRIPTION
+The
+.Fn shutdown
+call shuts down all or part of a full-duplex connection on the socket associated
+with
+.Fa s .
+If
+.Fa how
+is
+.Dv SHUT_RD ,
+further receives are disallowed.
+If
+.Fa how
+is
+.Dv SHUT_WR ,
+further sends are disallowed.
+If
+.Fa how
+is
+.Dv SHUT_RDWR ,
+further sends and receives are disallowed.
+.Pp
+The
+.Fa how
+values should be defined constants.
+.Sh RETURN VALUES
+0 is returned if the call succeeds.
+-1 is returned if the call fails.
+.Sh ERRORS
+The call succeeds unless one of the following conditions exists:
+.Bl -tag -width Er
+.It Bq Er EBADF
+The
+.Fa s
+value is not a valid file descriptor.
+.It Bq Er ENOMEM
+Insufficient user memory is available for the operation to complete.
+.It Bq Er ENOSR
+Insufficient STREAMS resources are available for the operation to complete.
+.It Bq Er ENOTCONN
+The specified socket is not connected.
+.It Bq Er ENOTSOCK
+The
+.Fa s
+value is not a socket.
+.El
+.Sh MT-LEVEL
+.Sy Safe
+.Sh SEE ALSO
+.Xr connect 3C ,
+.Xr socket 3C ,
+.Xr socket.h 3HEAD ,
+.Xr attributes 5
--- old/usr/src/man/man3socket/sockaddr.3socket	Sun Aug  5 23:41:10 2018
+++ /dev/null	Sun Aug  5 23:41:10 2018
@@ -1,587 +0,0 @@
-.\"
-.\" This file and its contents are supplied under the terms of the
-.\" Common Development and Distribution License ("CDDL"), version 1.0.
-.\" You may only use this file in accordance with the terms of version
-.\" 1.0 of the CDDL.
-.\"
-.\" A full copy of the text of the CDDL should have accompanied this
-.\" source.  A copy of the CDDL is also available via the Internet at
-.\" http://www.illumos.org/license/CDDL.
-.\"
-.\"
-.\" Copyright 2015, Joyent, Inc.
-.\"
-.Dd April 9, 2016
-.Dt SOCKADDR 3SOCKET
-.Os
-.Sh NAME
-.Nm sockaddr ,
-.Nm sockaddr_dl ,
-.Nm sockaddr_in ,
-.Nm sockaddr_in6 ,
-.Nm sockaddr_ll ,
-.Nm sockaddr_storage ,
-.Nm sockaddr_un
-.Nd Socket Address Structures
-.Sh SYNOPSIS
-.In sys/socket.h
-.Lp
-.Sy struct sockaddr
-.Em sock ;
-.Lp
-.In sys/socket.h
-.In net/if_dl.h
-.Lp
-.Sy struct sockaddr_dl
-.Em dl_sock ;
-.Lp
-.In sys/socket.h
-.In netinet/in.h
-.Lp
-.Sy struct sockaddr_in
-.Em in_sock ;
-.Lp
-.In sys/socket.h
-.In netinet/in.h
-.Lp
-.Sy struct sockaddr_in6
-.Em in6_sock ;
-.Lp
-.In sys/socket.h
-.Lp
-.Sy struct sockaddr_ll
-.Em ll_sock ;
-.Lp
-.In sys/socket.h
-.Lp
-.Sy struct sockaddr_storage
-.Em storage_sock ;
-.Lp
-.In sys/un.h
-.Lp
-.Sy struct sockaddr_un
-.Em un_sock ;
-.Sh DESCRIPTION
-The
-.Nm
-family of structures are designed to represent network addresses for
-different networking protocols.
-The structure
-.Sy struct sockaddr
-is a generic structure that is used across calls to various socket
-library routines
-.Po
-.Xr libsocket 3LIB
-.Pc
-such as
-.Xr accept 3SOCKET
-and
-.Xr bind 3SOCKET .
-Applications do not use the
-.Sy struct sockaddr
-directly, but instead cast the appropriate networking family specific
-.Nm
-structure to a
-.Sy struct sockaddr * .
-.Lp
-Every structure in the
-.Nm
-family begins with a member of the same type, the
-.Sy sa_family_t ,
-though the different structures all have different names for the member.
-For example, the structure
-.Sy struct sockaddr
-has the following members defined:
-.Bd -literal -offset indent
-sa_family_t	sa_family	/* address family */
-char		sa_data[]	/* socket address (variable-length data) */
-.Ed
-.Lp
-The member
-.Em sa_family
-corresponds to the socket family that's actually in use.
-The following table describes the mapping between the address family and the
-corresponding socket structure that's used.
-Note that both the generic
-.Sy struct sockaddr
-and the
-.Sy struct sockaddr_storage
-are not included, because these are both generic structures.
-More on the
-.Sy struct sockaddr_storage
-can be found in the next section.
-.Bl -column -offset indent ".Sy Socket Structure" ".Sy Address Family"
-.It Sy Socket Structure Ta Sy Address Family
-.It struct sockaddr_dl Ta AF_LINK
-.It struct sockaddr_in Ta AF_INET
-.It struct sockaddr_in6 Ta AF_INET6
-.It struct sockaddr_ll Ta AF_PACKET
-.It struct sockaddr_un Ta AF_UNIX
-.El
-.Ss struct sockaddr_storage
-The
-.Sy sockaddr_storage
-structure is a
-.Nm
-that is not associated with an address family.
-Instead, it is large enough to hold the contents of any of the other
-.Nm
-structures.
-It can be used to embed sufficient storage for a
-.Sy sockaddr
-of any type within a larger structure.
-.Lp
-The structure only has a single member defined.
-While there are other members that are used to pad out the size of the
-.Sy struct sockaddr_storage ,
-they are not defined and must not be consumed.
-The only valid member is:
-.Bd -literal -offset indent
-sa_family_t	ss_family	/* address family */
-.Ed
-.Lp
-For example,
-.Sy struct sockaddr_storage
-is useful when running a service that accepts traffic over both
-.Sy IPv4
-and
-.Sy IPv6
-where it is common to use a single socket for both address families.
-In that case, rather than guessing whether a
-.Sy struct sockaddr_in
-or a
-.Sy struct sockaddr_in6
-is more appropriate, one can simply use a
-.Sy struct sockaddr_storage
-and cast to the appropriate family-specific structure type based on the
-value of the member
-.Em ss_family .
-.Ss struct sockaddr_in
-The
-.Sy sockaddr_in
-is the socket type which is used for for the Internet Protocol version
-four (IPv4).
-It has the following members defined:
-.Bd -literal -offset indent
-sa_family_t	sin_family	/* address family */
-in_port_t	sin_port	/* IP port */
-struct in_addr	sin_addr	/* IP address */
-.Ed
-.Lp
-The member
-.Em sin_family
-must always have the value
-.Sy AF_INET
-for
-.Sy IPv4 .
-The members
-.Em sin_port
-and
-.Em sin_addr
-describe the IP address and IP port to use.
-In the case of a call to
-.Xr connect 3SOCKET
-these represent the remote IP address and port to which the connection
-is being made.
-In the case of
-.Xr bind 3SOCKET
-these represent the IP address and port on the local host to which the socket
-is to be bound.
-In the case of
-.Xr accept 3SOCKET
-these represent the remote IP address and port of the machine whose
-connection was accepted.
-.Lp
-The member
-.Em sin_port
-is always stored in
-.Sy Network Byte Order .
-On many systems, this differs from the native host byte order.
-Applications should read from the member with the function
-.Xr ntohs 3SOCKET
-and write to the member with the function
-.Xr htons 3SOCKET .
-The member
-.Em sin_addr
-is the four byte IPv4 address.
-It is also stored in network byte order.
-The common way to write out the address is to use the function
-.Xr inet_pton 3C
-which converts between a human readable IP address such as "10.1.2.3"
-and the corresponding representation.
-.Lp
-Example 1 shows how to prepare an IPv4 socket and deal with
-network byte-order.
-See
-.Xr inet 7P
-and
-.Xr ip 7P
-for more information on IPv4, socket options, etc.
-.Ss struct sockaddr_in6
-The
-.Sy sockaddr_in6
-structure is the
-.Nm
-for the Internet Protocol version six (IPv6).
-Unlike the
-.Sy struct sockaddr_in ,
-the
-.Sy struct sockaddr_in6
-has additional members beyond those shown here which are required to be
-initialized to zero through a function such as
-.Xr bzero 3C
-or
-.Xr memset 3C .
-If the entire
-.Sy struct sockaddr_in6
-is not zeroed before use, applications will experience undefined behavior.
-The
-.Sy struct sockaddr_in6
-has the following public members:
-.Bd -literal -offset indent
-sa_family_t	sin6_family	/* address family */
-in_port_t	sin6_port	/* IPv6 port */
-struct in6_addr	sin6_addr	/* IPv6 address */
-uint32_t	sin6_flowinfo;	/* traffic class and flow info */
-uint32_t	sin6_scope_id;	/* interface scope */
-.Ed
-.Lp
-The member
-.Em sin6_family
-must always have the value
-.Sy AF_INET6 .
-The members
-.Em sin6_port
-and
-.Em sin6_addr
-are the IPv6 equivalents of the
-.Sy struct sockaddr_in
-.Em sin_port
-and
-.Em sin_addr .
-Like their IPv4 counterparts, both of these members must be in network
-byte order.
-The member
-.Em sin6_port
-describes the IPv6 port and should be manipulated with the functions
-.Xr ntohs 3SOCKET
-and
-.Xr htons 3SOCKET .
-The member
-.Em sin6_addr
-describes the 16-byte IPv6 address.
-In addition to the function
-.Xr inet_pton 3C ,
-the header file
-.In netinet/in.h
-defines many macros for manipulating and testing IPv6 addresses.
-.Lp
-The member
-.Em sin6_flowinfo
-contains the traffic class and flow label associated with the IPv6
-header.
-The member
-.Em sin6_scope_id
-may contain an identifier which varies based on the scope of the address
-in
-.Em sin6_addr .
-Applications do not need to initialize
-.Em sin6_scope_id ;
-it will be populated by the operating system as a result of various library
-calls.
-.Lp
-Example 2 shows how to prepare an IPv6 socket.
-For more information on
-IPv6, please see
-.Xr inet6 7P
-and
-.Xr ip6 7P .
-.Ss struct sockaddr_un
-The
-.Sy sockaddr_un
-structure specifies the address of a socket used to communicate between
-processes running on a single system, commonly known as a
-.Em UNIX domain socket .
-Sockets of this type are identified by a path in the file system.
-The
-.Sy struct sockaddr_un
-has the following members:
-.Bd -literal -offset indent
-sa_family_t	sun_family	/* address family */
-char		sun_path[108]	/* path name */
-.Ed
-.Lp
-The member
-.Em sun_family
-must always have the value
-.Sy AF_UNIX .
-The member
-.Em sun_path
-is populated with a
-.Sy NUL
-terminated array of characters that specify a file system path.
-The maximum length of any such path, including the
-.Sy NUL
-terminator, is 108 bytes.
-.Ss struct sockaddr_dl
-The
-.Sy sockaddr_dl
-structure is used to describe a layer 2 link-level address.
-This is used as part of various socket ioctls, such as those for
-.Xr arp 7P .
-The structure has the following members:
-.Bd -literal -offset indent
-ushort_t	sdl_family;	/* address family */
-ushort_t	sdl_index;	/* if != 0, system interface index */
-uchar_t		sdl_type;	/* interface type */
-uchar_t		sdl_nlen;	/* interface name length */
-uchar_t		sdl_alen;	/* link level address length */
-uchar_t		sdl_slen;	/* link layer selector length */
-char		sdl_data[244];	/* contains both if name and ll address
-.Ed
-.Lp
-The member
-.Em sdl_family
-must always have the value
-.Sy AF_LINK .
-When the member
-.Em sdl_index
-is non-zero this refers to the interface identifier that corresponds to
-the
-.Sy struct sockaddr_dl .
-This identifier is the same identifier that's shown by tools like
-.Xr ifconfig 1M
-and used in the SIOC* set of socket ioctls.
-The member
-.Em sdl_type
-refers to the media that is used for the socket.
-The most common case is that the medium for the interface is Ethernet which has
-the value
-.Sy IFT_ETHER .
-The full set of types is derived from RFC1573 and recorded in the file
-.In net/if_types.h .
-The member
-.Em sdl_slen
-describes the length of a selector, if it exists, for the specified
-medium.
-This is used in protocols such as Trill.
-.Lp
-The
-.Em sdl_data ,
-.Em sdl_nlen
-and
-.Em sdl_alen
-members together describe a character string containing the interface name and
-the link-layer network address.
-The name starts at the beginning of
-.Em sdl_data ,
-i.e. at
-.Em sdl_data[0] .
-The name of the interface occupies the next
-.Em sdl_nlen
-bytes and is not
-.Sy NUL
-terminated.
-The link-layer network address begins immediately after the interface name,
-and is
-.Em sdl_alen
-bytes long.
-The macro
-.Sy LLADDR(struct sockaddr_dl *)
-returns the start of the link-layer network address.
-The interpretation of the link-layer address depends on the value of
-.Em sdl_type .
-For example, if the type is
-.Sy IFT_ETHER
-then the address is expressed as a 6-byte MAC address.
-.Ss struct sockaddr_ll
-The
-.Sy sockaddr_ll
-is used as part of a socket type which is responsible for packet
-capture:
-.Sy AF_PACKET
-sockets.
-It is generally designed for use with Ethernet networks.
-The members of the
-.Sy struct sockaddr_ll
-are:
-.Bd -literal -offset indent
-uint16_t        sll_family;	/* address family */
-uint16_t        sll_protocol;	/* link layer protocol */
-int32_t         sll_ifindex;	/* interface index */
-uint16_t        sll_hatype;	/* ARP hardware type */
-uint8_t         sll_pkttype;	/* packet type */
-uint8_t         sll_halen;	/* hardware address length */
-uint8_t         sll_addr[8];	/* hardware type */
-.Ed
-.Lp
-The member
-.Em sll_family
-must be
-.Sy AF_PACKET .
-The member
-.Em sll_protocol
-refers to a link-layer protocol.
-For example, when capturing Ethernet frames the value of
-.Em sll_protocol
-is the Ethertype.
-This member is written in network byte order and applications should use
-.Xr htons 3SOCKET
-and
-.Xr ntohs 3SOCKET
-to read and write the member.
-.Lp
-The member
-.Em sll_ifindex
-is the interface's index.
-It is used as an identifier in various ioctls and included in the output of
-.Xr ifconfig 1M .
-When calling
-.Xr bind 3SOCKET
-it should be filled in with the index that corresponds to the interface
-for which packets should be captured on.
-.Lp
-The member
-.Em sll_pkttype
-describes the type of the packet based on a list of types in the header
-file
-.In netpacket/packet.h .
-These types include:
-.Sy PACKET_OUTGOING ,
-a packet that was leaving the host and has been looped back for packet capture;
-.Sy PACKET_HOST ,
-a packet that was destined for this host;
-.Sy PACKET_BROADCAST ,
-a packet that was broadcast across the link-layer;
-.Sy PACKET_MULTICAST ,
-a packet that was sent to a link-layer multicast address; and
-.Sy PACKET_OTHERHOST ,
-a packet that was captured only because the device in question was in
-promiscuous mode.
-.Lp
-The member
-.Em sll_hatype
-contains the hardware type as defined by
-.Xr arp 7P .
-The list of types can be found in
-.In net/if_arp.h .
-The member
-.Em sll_halen
-contains the length, in bytes, of the hardware address, while the member
-.Em sll_addr
-contains the actual address in network byte order.
-.Sh EXAMPLES
-.Sy Example 1
-Preparing an IPv4
-.Sy sockaddr_in
-to connect to a remote host
-.Lp
-The following example shows how one would open a socket and prepare it
-to connect to the remote host whose address is the IP address 127.0.0.1
-on port 80.
-This program should be compiled with the C compiler
-.Sy cc
-and linked against the libraries libsocket and libnsl.
-If this example was named ip4.c, then the full link line would be
-.Ic cc ip4.c -lsocket -lnsl .
-.Bd -literal
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <stdio.h>
-#include <netinet/in.h>
-#include <inttypes.h>
-#include <strings.h>
-
-int
-main(void)
-{
-	int sock;
-	struct sockaddr_in in;
-
-	if ((sock = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
-		perror("socket");
-		return (1);
-	}
-
-	bzero(&in, sizeof (struct sockaddr_in));
-	in.sin_family = AF_INET;
-	in.sin_port = htons(80);
-	if (inet_pton(AF_INET, "127.0.0.1", &in.sin_addr) != 1) {
-		perror("inet_pton");
-		return (1);
-	}
-
-	if (connect(sock, (struct sockaddr *)&in,
-	    sizeof (struct sockaddr_in)) != 0) {
-		perror("connect");
-		return (1);
-	}
-
-	/* use socket */
-
-	return (0);
-}
-.Ed
-.Lp
-.Sy Example 2
-Preparing an IPv6
-.Sy sockaddr_in6
-to bind to a local address
-.Lp
-The following example shows how one would open a socket and prepare it
-to bind to the local IPv6 address ::1 port on port 12345.
-This program should be compiled with the C compiler
-.Sy cc
-and linked against the libraries libsocket and libnsl.
-If this example was named ip6.c, then the full compiler line would be
-.Ic cc ip6.c -lsocket -lnsl .
-.Bd -literal
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <stdio.h>
-#include <netinet/in.h>
-#include <inttypes.h>
-#include <strings.h>
-
-int
-main(void)
-{
-	int sock6;
-	struct sockaddr_in6 in6;
-
-	if ((sock6 = socket(AF_INET6, SOCK_STREAM, 0)) < 0) {
-		perror("socket");
-		return (1);
-	}
-
-	bzero(&in6, sizeof (struct sockaddr_in6));
-	in6.sin6_family = AF_INET6;
-	in6.sin6_port = htons(12345);
-	if (inet_pton(AF_INET6, "::1", &in6.sin6_addr) != 1) {
-		perror("inet_pton");
-		return (1);
-	}
-
-	if (bind(sock6, (struct sockaddr *)&in6,
-	    sizeof (struct sockaddr_in6)) != 0) {
-		perror("bind");
-		return (1);
-	}
-
-	/* use server socket */
-
-	return (0);
-}
-.Ed
-.Sh SEE ALSO
-.Xr socket 3HEAD ,
-.Xr un.h 3HEAD ,
-.Xr accept 3SOCKET ,
-.Xr bind 3SOCKET ,
-.Xr connect 3SOCKET ,
-.Xr socket 3SOCKET ,
-.Xr arp 7P ,
-.Xr inet 7P ,
-.Xr inet6 7P ,
-.Xr ip 7P ,
-.Xr ip6 7P
--- /dev/null	Sun Aug  5 23:41:10 2018
+++ new/usr/src/man/man3c/sockaddr.3c	Sun Aug  5 23:41:10 2018
@@ -0,0 +1,534 @@
+.\"
+.\" This file and its contents are supplied under the terms of the
+.\" Common Development and Distribution License ("CDDL"), version 1.0.
+.\" You may only use this file in accordance with the terms of version
+.\" 1.0 of the CDDL.
+.\"
+.\" A full copy of the text of the CDDL should have accompanied this
+.\" source.  A copy of the CDDL is also available via the Internet at
+.\" http://www.illumos.org/license/CDDL.
+.\"
+.\"
+.\" Copyright 2015, Joyent, Inc.
+.\" Copyright 2018 Nexenta Systems, Inc.
+.\"
+.Dd August 2, 2018
+.Dt SOCKADDR 3C
+.Os
+.Sh NAME
+.Nm sockaddr ,
+.Nm sockaddr_dl ,
+.Nm sockaddr_in ,
+.Nm sockaddr_in6 ,
+.Nm sockaddr_ll ,
+.Nm sockaddr_storage ,
+.Nm sockaddr_un
+.Nd Socket Address Structures
+.Sh LIBRARY
+.Lb libc
+.Sh SYNOPSIS
+.In sys/socket.h
+.Vt struct sockaddr sock;
+.In sys/socket.h
+.In net/if_dl.h
+.Vt struct sockaddr_dl dl_sock;
+.In sys/socket.h
+.In netinet/in.h
+.Vt struct sockaddr_in in_sock;
+.In sys/socket.h
+.In netinet/in.h
+.Vt struct sockaddr_in6 in6_sock;
+.In sys/socket.h
+.Vt struct sockaddr_ll ll_sock;
+.In sys/socket.h
+.Vt struct sockaddr_storage storage_sock;
+.In sys/un.h
+.Vt struct sockaddr_un un_sock;
+.Sh DESCRIPTION
+The
+.Nm
+family of structures are designed to represent network addresses for
+different networking protocols.
+The structure
+.Vt struct sockaddr
+is a generic structure that is used across calls to various socket routines such
+as
+.Xr accept 3C
+and
+.Xr bind 3C .
+Applications do not use the
+.Vt struct sockaddr
+directly, but instead cast the appropriate networking family specific
+.Nm
+structure to a
+.Vt struct sockaddr * .
+.Pp
+Every structure in the
+.Nm
+family begins with a member of the same type, the
+.Vt sa_family_t ,
+though the different structures all have different names for the member.
+For example, the structure
+.Vt struct sockaddr
+has the following members defined:
+.Bd -literal -offset indent
+sa_family_t	sa_family	/* address family */
+char		sa_data[]	/* socket address (variable-length data) */
+.Ed
+.Pp
+The member
+.Va sa_family
+corresponds to the socket family that's actually in use.
+The following table describes the mapping between the address family and the
+corresponding socket structure that's used.
+Note that both the generic
+.Vt struct sockaddr
+and the
+.Vt struct sockaddr_storage
+are not included, because these are both generic structures.
+More on the
+.Vt struct sockaddr_storage
+can be found in the next section.
+.Bl -column -offset indent ".Sy Socket Structure" ".Sy Address Family"
+.It Sy Socket Structure Ta Sy Address Family
+.It Vt struct sockaddr_dl Ta Dv AF_LINK
+.It Vt struct sockaddr_in Ta Dv AF_INET
+.It Vt struct sockaddr_in6 Ta Dv AF_INET6
+.It Vt struct sockaddr_ll Ta Dv AF_PACKET
+.It Vt struct sockaddr_un Ta Dv AF_UNIX
+.El
+.Ss struct sockaddr_storage
+The
+.Vt sockaddr_storage
+structure is a
+.Nm
+that is not associated with an address family.
+Instead, it is large enough to hold the contents of any of the other
+.Nm
+structures.
+It can be used to embed sufficient storage for a
+.Vt sockaddr
+of any type within a larger structure.
+.Pp
+The structure only has a single member defined.
+While there are other members that are used to pad out the size of the
+.Vt struct sockaddr_storage ,
+they are not defined and must not be consumed.
+The only valid member is:
+.Bd -literal -offset indent
+sa_family_t	ss_family	/* address family */
+.Ed
+.Pp
+For example,
+.Vt struct sockaddr_storage
+is useful when running a service that accepts traffic over both IPv4 and IPv6
+where it is common to use a single socket for both address families.
+In that case, rather than guessing whether a
+.Vt struct sockaddr_in
+or a
+.Vt struct sockaddr_in6
+is more appropriate, one can simply use a
+.Vt struct sockaddr_storage
+and cast to the appropriate family-specific structure type based on the
+value of the member
+.Va ss_family .
+.Ss struct sockaddr_in
+The
+.Vt sockaddr_in
+is the socket type which is used for for the Internet Protocol version
+four (IPv4).
+It has the following members defined:
+.Bd -literal -offset indent
+sa_family_t	sin_family	/* address family */
+in_port_t	sin_port	/* IP port */
+struct in_addr	sin_addr	/* IP address */
+.Ed
+.Pp
+The member
+.Va sin_family
+must always have the value
+.Dv AF_INET
+for IPv4 .
+The members
+.Va sin_port
+and
+.Va sin_addr
+describe the IP address and IP port to use.
+In the case of a call to
+.Xr connect 3C
+these represent the remote IP address and port to which the connection
+is being made.
+In the case of
+.Xr bind 3C
+these represent the IP address and port on the local host to which the socket
+is to be bound.
+In the case of
+.Xr accept 3C
+these represent the remote IP address and port of the machine whose connection
+was accepted.
+.Pp
+The member
+.Va sin_port
+is always stored in network byte order.
+On many systems, this differs from the native host byte order.
+Applications should read from the member with the function
+.Xr ntohs 3C
+and write to the member with the function
+.Xr htons 3C .
+The member
+.Va sin_addr
+is the four byte IPv4 address.
+It is also stored in network byte order.
+The common way to write out the address is to use the function
+.Xr inet_pton 3C
+which converts between a human readable IP address such as
+.Ql 10.1.2.3
+and the corresponding representation.
+.Pp
+Example 1 shows how to prepare an IPv4 socket and deal with
+network byte-order.
+See
+.Xr inet 7P
+and
+.Xr ip 7P
+for more information on IPv4, socket options, etc.
+.Ss struct sockaddr_in6
+The
+.Vt sockaddr_in6
+structure is the
+.Nm
+for the Internet Protocol version six (IPv6).
+Unlike the
+.Vt struct sockaddr_in ,
+the
+.Vt struct sockaddr_in6
+has additional members beyond those shown here which are required to be
+initialized to zero through a function such as
+.Xr bzero 3C
+or
+.Xr memset 3C .
+If the entire
+.Vt struct sockaddr_in6
+is not zeroed before use, applications will experience undefined behavior.
+The
+.Vt struct sockaddr_in6
+has the following public members:
+.Bd -literal -offset indent
+sa_family_t	sin6_family	/* address family */
+in_port_t	sin6_port	/* IPv6 port */
+struct in6_addr	sin6_addr	/* IPv6 address */
+uint32_t	sin6_flowinfo;	/* traffic class and flow info */
+uint32_t	sin6_scope_id;	/* interface scope */
+.Ed
+.Pp
+The member
+.Va sin6_family
+must always have the value
+.Dv AF_INET6 .
+The members
+.Va sin6_port
+and
+.Va sin6_addr
+are the IPv6 equivalents of the
+.Vt struct sockaddr_in
+.Va sin_port
+and
+.Va sin_addr .
+Like their IPv4 counterparts, both of these members must be in network
+byte order.
+The member
+.Va sin6_port
+describes the IPv6 port and should be manipulated with the functions
+.Xr ntohs 3C
+and
+.Xr htons 3C .
+The member
+.Va sin6_addr
+describes the 16-byte IPv6 address.
+In addition to the function
+.Xr inet_pton 3C ,
+the header file
+.In netinet/in.h
+defines many macros for manipulating and testing IPv6 addresses.
+.Pp
+The member
+.Va sin6_flowinfo
+contains the traffic class and flow label associated with the IPv6
+header.
+The member
+.Va sin6_scope_id
+may contain an identifier which varies based on the scope of the address in
+.Va sin6_addr .
+Applications do not need to initialize
+.Va sin6_scope_id ;
+it will be populated by the operating system as a result of various library
+calls.
+.Pp
+Example 2 shows how to prepare an IPv6 socket.
+For more information on IPv6, please see
+.Xr inet6 7P
+and
+.Xr ip6 7P .
+.Ss struct sockaddr_un
+The
+.Vt sockaddr_un
+structure specifies the address of a socket used to communicate between
+processes running on a single system, commonly known as a UNIX domain socket.
+Sockets of this type are identified by a path in the file system.
+The
+.Vt struct sockaddr_un
+has the following members:
+.Bd -literal -offset indent
+sa_family_t	sun_family	/* address family */
+char		sun_path[108]	/* path name */
+.Ed
+.Pp
+The member
+.Va sun_family
+must always have the value
+.Dv AF_UNIX .
+The member
+.Va sun_path
+is populated with a NUL terminated array of characters that specify a file
+system path.
+The maximum length of any such path, including the NUL terminator, is 108 bytes.
+.Ss struct sockaddr_dl
+The
+.Vt sockaddr_dl
+structure is used to describe a layer 2 link-level address.
+This is used as part of various socket ioctls, such as those for
+.Xr arp 7P .
+The structure has the following members:
+.Bd -literal -offset indent
+ushort_t	sdl_family;	/* address family */
+ushort_t	sdl_index;	/* if != 0, system interface index */
+uchar_t		sdl_type;	/* interface type */
+uchar_t		sdl_nlen;	/* interface name length */
+uchar_t		sdl_alen;	/* link level address length */
+uchar_t		sdl_slen;	/* link layer selector length */
+char		sdl_data[244];	/* contains both if name and ll address
+.Ed
+.Pp
+The member
+.Va sdl_family
+must always have the value
+.Dv AF_LINK .
+When the member
+.Va sdl_index
+is non-zero this refers to the interface identifier that corresponds to
+the
+.Vt struct sockaddr_dl .
+This identifier is the same identifier that's shown by tools like
+.Xr ifconfig 1M
+and used in the SIOC* set of socket ioctls.
+The member
+.Va sdl_type
+refers to the media that is used for the socket.
+The most common case is that the medium for the interface is Ethernet which has
+the value
+.Dv IFT_ETHER .
+The full set of types is derived from RFC1573 and recorded in the file
+.In net/if_types.h .
+The member
+.Va sdl_slen
+describes the length of a selector, if it exists, for the specified medium.
+This is used in protocols such as Trill.
+.Pp
+The
+.Va sdl_data ,
+.Va sdl_nlen ,
+and
+.Va sdl_alen
+members together describe a character string containing the interface name and
+the link-layer network address.
+The name starts at the beginning of
+.Va sdl_data ,
+i.e. at
+.Va sdl_data Ns Bq 0 .
+The name of the interface occupies the next
+.Va sdl_nlen
+bytes and is not NUL terminated.
+The link-layer network address begins immediately after the interface name,
+and is
+.Va sdl_alen
+bytes long.
+The macro
+.Dv LLADDR(struct sockaddr_dl *)
+returns the start of the link-layer network address.
+The interpretation of the link-layer address depends on the value of
+.Va sdl_type .
+For example, if the type is
+.Dv IFT_ETHER
+then the address is expressed as a 6-byte MAC address.
+.Ss struct sockaddr_ll
+The
+.Vt sockaddr_ll
+is used as part of a socket type which is responsible for packet capture:
+.Dv AF_PACKET
+sockets.
+It is generally designed for use with Ethernet networks.
+The members of the
+.Vt struct sockaddr_ll
+are:
+.Bd -literal -offset indent
+uint16_t        sll_family;	/* address family */
+uint16_t        sll_protocol;	/* link layer protocol */
+int32_t         sll_ifindex;	/* interface index */
+uint16_t        sll_hatype;	/* ARP hardware type */
+uint8_t         sll_pkttype;	/* packet type */
+uint8_t         sll_halen;	/* hardware address length */
+uint8_t         sll_addr[8];	/* hardware type */
+.Ed
+.Pp
+The member
+.Va sll_family
+must be
+.Dv AF_PACKET .
+The member
+.Va sll_protocol
+refers to a link-layer protocol.
+For example, when capturing Ethernet frames the value of
+.Va sll_protocol
+is the Ethertype.
+This member is written in network byte order and applications should use
+.Xr htons 3C
+and
+.Xr ntohs 3C
+to read and write the member.
+.Pp
+The member
+.Va sll_ifindex
+is the interface's index.
+It is used as an identifier in various ioctls and included in the output of
+.Xr ifconfig 1M .
+When calling
+.Xr bind 3C
+it should be filled in with the index that corresponds to the interface
+for which packets should be captured on.
+.Pp
+The member
+.Va sll_pkttype
+describes the type of the packet based on a list of types in the header file
+.In netpacket/packet.h .
+These types include:
+.Dv PACKET_OUTGOING ,
+a packet that was leaving the host and has been looped back for packet capture;
+.Dv PACKET_HOST ,
+a packet that was destined for this host;
+.Dv PACKET_BROADCAST ,
+a packet that was broadcast across the link-layer;
+.Dv PACKET_MULTICAST ,
+a packet that was sent to a link-layer multicast address; and
+.Dv PACKET_OTHERHOST ,
+a packet that was captured only because the device in question was in
+promiscuous mode.
+.Pp
+The member
+.Va sll_hatype
+contains the hardware type as defined by
+.Xr arp 7P .
+The list of types can be found in
+.In net/if_arp.h .
+The member
+.Va sll_halen
+contains the length, in bytes, of the hardware address, while the member
+.Va sll_addr
+contains the actual address in network byte order.
+.Sh EXAMPLES
+.Bl -tag -width Ds
+.It Sy Example 1 No Preparing an IPv4 sockaddr_in to connect to a remote host
+The following example shows how one would open a socket and prepare it
+to connect to the remote host whose address is the IP address 127.0.0.1
+on port 80.
+.Bd -literal
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <stdio.h>
+#include <netinet/in.h>
+#include <inttypes.h>
+#include <strings.h>
+
+int
+main(void)
+{
+	int sock;
+	struct sockaddr_in in;
+
+	if ((sock = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
+		perror("socket");
+		return (1);
+	}
+
+	bzero(&in, sizeof (struct sockaddr_in));
+	in.sin_family = AF_INET;
+	in.sin_port = htons(80);
+	if (inet_pton(AF_INET, "127.0.0.1", &in.sin_addr) != 1) {
+		perror("inet_pton");
+		return (1);
+	}
+
+	if (connect(sock, (struct sockaddr *)&in,
+	    sizeof (struct sockaddr_in)) != 0) {
+		perror("connect");
+		return (1);
+	}
+
+	/* use socket */
+
+	return (0);
+}
+.Ed
+.It Sy Example 2 No Preparing an IPv6 sockaddr_in6 to bind to a local address
+The following example shows how one would open a socket and prepare it
+to bind to the local IPv6 address ::1 port on port 12345.
+.Bd -literal
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <stdio.h>
+#include <netinet/in.h>
+#include <inttypes.h>
+#include <strings.h>
+
+int
+main(void)
+{
+	int sock6;
+	struct sockaddr_in6 in6;
+
+	if ((sock6 = socket(AF_INET6, SOCK_STREAM, 0)) < 0) {
+		perror("socket");
+		return (1);
+	}
+
+	bzero(&in6, sizeof (struct sockaddr_in6));
+	in6.sin6_family = AF_INET6;
+	in6.sin6_port = htons(12345);
+	if (inet_pton(AF_INET6, "::1", &in6.sin6_addr) != 1) {
+		perror("inet_pton");
+		return (1);
+	}
+
+	if (bind(sock6, (struct sockaddr *)&in6,
+	    sizeof (struct sockaddr_in6)) != 0) {
+		perror("bind");
+		return (1);
+	}
+
+	/* use server socket */
+
+	return (0);
+}
+.Ed
+.El
+.Sh SEE ALSO
+.Xr accept 3C ,
+.Xr bind 3C ,
+.Xr connect 3C ,
+.Xr socket 3C ,
+.Xr socket.h 3HEAD ,
+.Xr un.h 3HEAD ,
+.Xr arp 7P ,
+.Xr inet 7P ,
+.Xr inet6 7P ,
+.Xr ip 7P ,
+.Xr ip6 7P
--- /dev/null	Sun Aug  5 23:41:10 2018
+++ new/usr/src/man/man3c/socket.3c	Sun Aug  5 23:41:10 2018
@@ -0,0 +1,301 @@
+.\"
+.\" 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]
+.\"
+.\"
+.\" Copyright 1989 AT&T
+.\" Copyright (C) 2009, Sun Microsystems, Inc. All Rights Reserved.
+.\" Copyright (c) 2013, OmniTI Computer Consulting, Inc. All Rights Reserved.
+.\" Copyright 2018 Nexenta Systems, Inc.
+.\"
+.Dd August 2, 2018
+.Dt SOCKET 3C
+.Os
+.Sh NAME
+.Nm socket
+.Nd create an endpoint for communication
+.Sh LIBRARY
+.Lb libc
+.Sh SYNOPSIS
+.In sys/types.h
+.In sys/socket.h
+.Ft int
+.Fo socket
+.Fa "int domain"
+.Fa "int type"
+.Fa "int protocol"
+.Fc
+.Sh DESCRIPTION
+The
+.Fn socket
+function creates an endpoint for communication and returns a
+descriptor.
+.Pp
+The
+.Fa domain
+argument specifies the protocol family within which communication takes place.
+The protocol family is generally the same as the address family for the
+addresses supplied in later operations on the socket.
+These families are defined in
+.In sys/socket.h .
+.Pp
+The currently supported protocol families are:
+.Bl -tag -width "PF_INET6"
+.It Dv PF_UNIX
+UNIX system internal protocols
+.It Dv PF_INET
+Internet Protocol Version 4 (IPv4)
+.It Dv PF_INET6
+Internet Protocol Version 6 (IPv6)
+.It Dv PF_NCA
+Network Cache and Accelerator (NCA) protocols
+.El
+.Pp
+The socket has the indicated
+.Fa type ,
+which specifies the communication semantics.
+Currently defined types are:
+.Bl -tag -width Ds
+.It Dv SOCK_STREAM
+.It Dv SOCK_DGRAM
+.It Dv SOCK_RAW
+.It Dv SOCK_SEQPACKET
+.It Dv SOCK_RDM
+.El
+.Pp
+The
+.Fa type
+may be augmented by a bitwise-inclusive-OR of flags from the following list,
+defined in
+.In sys/socket.h :
+.Bl -tag -width Ds
+.It Dv SOCK_CLOEXEC
+Creates the socket with the
+.Dv FD_CLOEXEC
+flag set, causing the underlying file descriptor to be closed prior to any
+future calls to
+.Xr exec 2 .
+This is similar in purpose to the
+.Dv O_CLOEXEC
+flag to
+.Xr open 2 .
+.It Dv SOCK_NDELAY
+Creates the socket with the
+.Dv O_NDELAY
+flag set, causing the socket to provide nonblocking semantics as described for
+.Dv O_NDELAY
+in
+.Xr open 2 .
+.Dv SOCK_NONBLOCK
+should normally be used in preference to
+.Dv SOCK_NDELAY ,
+and takes precedence if both are set.
+See
+.Xr open 2
+for further details.
+.It Dv SOCK_NONBLOCK
+Creates the socket with the
+.Dv O_NONBLOCK
+flag set, causing the socket to provide nonblocking semantics as described for
+.Dv O_NONBLOCK
+in
+.Xr open 2 .
+.El
+.Pp
+There must be an entry in the
+.Xr netconfig 4
+file for at least each protocol family and type required.
+If a non-zero protocol has been specified but no exact match for the protocol
+family, type, and protocol is found, then the first entry containing the
+specified family and type with a
+.Fa protocol
+value of zero will be used.
+.Pp
+A
+.Dv SOCK_STREAM
+type provides sequenced, reliable, two-way connection-based byte streams.
+An out-of-band data transmission mechanism may be supported.
+A
+.Dv SOCK_DGRAM
+socket supports datagrams (connectionless, unreliable messages of a fixed
+(typically small) maximum length).
+A
+.Dv SOCK_SEQPACKET
+socket may provide a sequenced, reliable, two-way connection-based data
+transmission path for datagrams of fixed maximum length; a consumer may be
+required to read an entire packet with each read system call.
+This facility is protocol specific, and presently not implemented for any
+protocol family.
+.Dv SOCK_RAW
+sockets provide access to internal network interfaces.
+The types
+.Dv SOCK_RAW ,
+which is available only to a user with the
+.Em net_rawaccess
+privilege, and
+.Dv SOCK_RDM ,
+for which no implementation currently exists, are not described here.
+.Pp
+The
+.Fa protocol
+parameter is a protocol-family-specific value which specifies a particular
+protocol to be used with the socket.
+Normally this value is zero, as commonly only a single protocol exists to
+support a particular socket type within a given protocol family.
+However, multiple protocols may exist, in which case a particular protocol may
+be specified in this manner.
+.Pp
+Sockets of type
+.Dv SOCK_STREAM
+are full-duplex byte streams, similar to pipes.
+A stream socket must be in a "connected" state before any data may be sent or
+received on it.
+A connection to another socket is created with a
+.Xr connect 3C
+call.
+Once connected, data may be transferred using
+.Xr read 2
+and
+.Xr write 2
+calls or some variant of the
+.Xr send 3C
+and
+.Xr recv 3C
+calls.
+When a session has been completed, a
+.Xr close 2
+may be performed.
+Out-of-band data may also be transmitted as described on the
+.Xr send 3C
+manual page and received as described on the
+.Xr recv 3C
+manual page.
+.Pp
+The communications protocols used to implement a
+.Dv SOCK_STREAM
+insure that data is not lost or duplicated.
+If a piece of data for which the peer protocol has buffer space cannot be
+successfully transmitted within a reasonable length of time, then the connection
+is considered broken and calls will indicate an error with -1 returns and with
+.Er ETIMEDOUT
+as the specific code in the global variable
+.Va errno .
+The protocols optionally keep sockets "warm" by forcing transmissions roughly
+every minute in the absence of other activity.
+An error is then indicated if no response can be elicited on an otherwise idle
+connection for a extended period (for instance 5 minutes).
+A
+.Dv SIGPIPE
+signal is raised if a thread sends on a broken stream; this causes naive
+processes, which do not handle the signal, to exit.
+.Pp
+.Dv SOCK_SEQPACKET
+sockets employ the same system calls as
+.Dv SOCK_STREAM
+sockets.
+The only difference is that
+.Xr read 2
+calls will return only the amount of data requested, and any remaining in the
+arriving packet will be discarded.
+.Pp
+.Dv SOCK_DGRAM
+and
+.Dv SOCK_RAW
+sockets allow datagrams to be sent to correspondents named in
+.Xr sendto 3C
+calls.
+Datagrams are generally received with
+.Xr recvfrom 3C ,
+which returns the next datagram with its return address.
+.Pp
+An
+.Xr fcntl 2
+call can be used to specify a process group to receive a
+.Dv SIGURG
+signal when the out-of-band data arrives.
+It can also enable non-blocking I/O.
+.Pp
+The operation of sockets is controlled by socket level options.
+These options are defined in the file
+.In sys/socket.h .
+.Xr setsockopt 3C
+and
+.Xr getsockopt 3C
+are used to set and get options, respectively.
+.Sh RETURN VALUES
+Upon successful completion, a descriptor referencing the socket is returned.
+Otherwise, -1 is returned and
+.Va errno
+is set to indicate the error.
+.Sh ERRORS
+The
+.Fn socket
+function will fail if:
+.Bl -tag -width Er
+.It Bq Er EACCES
+Permission to create a socket of the specified type or protocol is denied.
+.It Bq Er EAGAIN
+There were insufficient resources available to complete the operation.
+.It Bq Er EAFNOSUPPORT
+The specified address family is not supported by the protocol family.
+.It Bq Er EMFILE
+The per-process descriptor table is full.
+.It Bq Er ENOMEM
+Insufficient user memory is available.
+.It Bq Er ENOSR
+There were insufficient STREAMS resources available to complete the operation.
+.It Bq Er EPFNOSUPPORT
+The specified protocol family is not supported.
+.It Bq Er EPROTONOSUPPORT
+The protocol type is not supported by the address family.
+.It Bq Er EPROTOTYPE
+The socket type is not supported by the protocol.
+.It Bq Er EINVAL
+One or more of the specified flags is not supported.
+.El
+.Sh MT-LEVEL
+.Sy Safe
+.Sh SEE ALSO
+.Xr nca 1 ,
+.Xr close 2 ,
+.Xr exec 2 ,
+.Xr fcntl 2 ,
+.Xr ioctl 2 ,
+.Xr open 2 ,
+.Xr read 2 ,
+.Xr write 2 ,
+.Xr accept 3C ,
+.Xr bind 3C ,
+.Xr connect 3C ,
+.Xr getsockname 3C ,
+.Xr getsockopt 3C ,
+.Xr listen 3C ,
+.Xr recv 3C ,
+.Xr send 3C ,
+.Xr setsockopt 3C ,
+.Xr shutdown 3C ,
+.Xr socketpair 3C ,
+.Xr in.h 3HEAD ,
+.Xr socket.h 3HEAD ,
+.Xr attributes 5
+.Sh NOTES
+Historically,
+.Dv AF_ Ns *
+was commonly used in places where
+.Dv PF_ Ns *
+was meant.
+New code should be careful to use
+.Dv PF_ Ns *
+as necessary.
--- /dev/null	Sun Aug  5 23:41:10 2018
+++ new/usr/src/man/man3c/socketpair.3c	Sun Aug  5 23:41:10 2018
@@ -0,0 +1,87 @@
+.\"
+.\" 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]
+.\"
+.\"
+.\" Copyright 1989 AT&T
+.\" Copyright (C) 2002, Sun Microsystems, Inc. All Rights Reserved
+.\" Copyright 2018 Nexenta Systems, Inc.
+.\"
+.Dd August 2, 2018
+.Dt SOCKETPAIR 3C
+.Os
+.Sh NAME
+.Nm socketpair
+.Nd create a pair of connected sockets
+.Sh LIBRARY
+.Lb libc
+.Sh SYNOPSIS
+.In sys/types.h
+.In sys/socket.h
+.Ft int
+.Fo socketpair
+.Fa "int domain"
+.Fa "int type"
+.Fa "int protocol"
+.Fa "int sv[2]"
+.Fc
+.Sh DESCRIPTION
+The
+.Fn socketpair
+library call creates an unnamed pair of connected sockets in the specified
+address family
+.Fa domain ,
+of the specified
+.Fa type ,
+that uses the optionally specified
+.Fa protocol .
+The descriptors that are used in referencing the new sockets are returned in
+.Fa sv Ns Bq 0
+and
+.Fa sv Ns Bq 1 .
+The two sockets are indistinguishable.
+.Sh RETURN VALUES
+.Fn socketpair
+returns -1 on failure and 0 on success.
+.Sh ERRORS
+The call succeeds unless:
+.Bl -tag -width Er
+.It Bq Er EAFNOSUPPORT
+The specified address family is not supported on this machine.
+.It Bq Er EMFILE
+Too many descriptors are in use by this process.
+.It Bq Er ENOMEM
+There was insufficient user memory for the operation to complete.
+.It Bq Er ENOSR
+There were insufficient STREAMS resources for the operation to complete.
+.It Bq Er EOPNOTSUPP
+The specified protocol does not support creation of socket pairs.
+.It Bq Er EPROTONOSUPPORT
+The specified protocol is not supported on this machine.
+.It Bq Er EACCES
+The process does not have appropriate privileges.
+.El
+.Sh MT-LEVEL
+.Sy Safe
+.Sh SEE ALSO
+.Xr pipe 2 ,
+.Xr read 2 ,
+.Xr write 2 ,
+.Xr socket.h 3HEAD ,
+.Xr attributes 5
+.Sh NOTES
+This call is currently implemented only for the
+.Dv AF_UNIX
+address family.
--- old/usr/src/man/man3socket/Makefile	Sun Aug  5 23:41:11 2018
+++ new/usr/src/man/man3socket/Makefile	Sun Aug  5 23:41:11 2018
@@ -19,28 +19,20 @@
 
 MANSECT=	3socket
 
-MANFILES=	accept.3socket		\
-		bind.3socket		\
-		byteorder.3socket	\
-		connect.3socket		\
+MANFILES=	byteorder.3socket	\
 		ethers.3socket		\
 		getaddrinfo.3socket	\
 		getifaddrs.3socket	\
 		getipnodebyname.3socket \
 		getnetbyname.3socket	\
-		getpeername.3socket	\
 		getprotobyname.3socket	\
 		getservbyname.3socket	\
-		getsockname.3socket	\
-		getsockopt.3socket	\
 		getsourcefilter.3socket \
 		icmp6_filter.3socket	\
 		if_nametoindex.3socket	\
 		inet6_opt.3socket	\
 		inet6_rth.3socket	\
-		listen.3socket		\
 		rcmd.3socket		\
-		recv.3socket		\
 		rexec.3socket		\
 		sctp_bindx.3socket	\
 		sctp_getladdrs.3socket	\
@@ -50,15 +42,9 @@
 		sctp_recvmsg.3socket	\
 		sctp_send.3socket	\
 		sctp_sendmsg.3socket	\
-		send.3socket		\
-		sockaddr.3socket	\
-		shutdown.3socket	\
-		socket.3socket		\
-		socketpair.3socket	\
 		spray.3socket
 
-MANLINKS=	accept4.3socket			\
-		endnetent.3socket		\
+MANLINKS=	endnetent.3socket		\
 		endprotoent.3socket		\
 		endservent.3socket		\
 		ether_aton.3socket		\
@@ -113,8 +99,6 @@
 		ntohll.3socket			\
 		ntohs.3socket			\
 		rcmd_af.3socket			\
-		recvfrom.3socket		\
-		recvmsg.3socket			\
 		rexec_af.3socket		\
 		rresvport.3socket		\
 		rresvport_af.3socket		\
@@ -121,23 +105,12 @@
 		ruserok.3socket			\
 		sctp_freeladdrs.3socket		\
 		sctp_freepaddrs.3socket		\
-		sendmsg.3socket			\
-		sendto.3socket			\
 		setipv4sourcefilter.3socket	\
 		setnetent.3socket		\
 		setprotoent.3socket		\
 		setservent.3socket		\
-		setsockopt.3socket		\
-		setsourcefilter.3socket		\
-		sockaddr_dl.3socket		\
-		sockaddr_in.3socket		\
-		sockaddr_in6.3socket		\
-		sockaddr_ll.3socket		\
-		sockaddr_storage.3socket	\
-		sockaddr_un.3socket
+		setsourcefilter.3socket
 
-accept4.3socket			:= LINKSRC = accept.3socket
-
 htonl.3socket			:= LINKSRC = byteorder.3socket
 htonll.3socket			:= LINKSRC = byteorder.3socket
 htons.3socket			:= LINKSRC = byteorder.3socket
@@ -186,8 +159,6 @@
 getservent_r.3socket		:= LINKSRC = getservbyname.3socket
 setservent.3socket		:= LINKSRC = getservbyname.3socket
 
-setsockopt.3socket		:= LINKSRC = getsockopt.3socket
-
 getipv4sourcefilter.3socket	:= LINKSRC = getsourcefilter.3socket
 setipv4sourcefilter.3socket	:= LINKSRC = getsourcefilter.3socket
 setsourcefilter.3socket		:= LINKSRC = getsourcefilter.3socket
@@ -216,9 +187,6 @@
 rresvport_af.3socket		:= LINKSRC = rcmd.3socket
 ruserok.3socket			:= LINKSRC = rcmd.3socket
 
-recvfrom.3socket		:= LINKSRC = recv.3socket
-recvmsg.3socket			:= LINKSRC = recv.3socket
-
 rexec_af.3socket		:= LINKSRC = rexec.3socket
 
 sctp_freeladdrs.3socket		:= LINKSRC = sctp_getladdrs.3socket
@@ -225,16 +193,6 @@
 
 sctp_freepaddrs.3socket		:= LINKSRC = sctp_getpaddrs.3socket
 
-sendmsg.3socket			:= LINKSRC = send.3socket
-sendto.3socket			:= LINKSRC = send.3socket
-
-sockaddr_dl.3socket		:= LINKSRC = sockaddr.3socket
-sockaddr_in.3socket		:= LINKSRC = sockaddr.3socket
-sockaddr_in6.3socket		:= LINKSRC = sockaddr.3socket
-sockaddr_ll.3socket		:= LINKSRC = sockaddr.3socket
-sockaddr_storage.3socket	:= LINKSRC = sockaddr.3socket
-sockaddr_un.3socket		:= LINKSRC = sockaddr.3socket
-
 .KEEP_STATE:
 
 include		$(SRC)/man/Makefile.man
--- old/usr/src/man/man3socket/accept.3socket	Sun Aug  5 23:41:11 2018
+++ /dev/null	Sun Aug  5 23:41:10 2018
@@ -1,258 +0,0 @@
-'\" te
-.\" Copyright 1989 AT&T
-.\" Copyright (C) 2002, Sun Microsystems, Inc. All Rights Reserved
-.\" Copyright (c) 2013, OmniTI Computer Consulting, Inc. All rights reserved.
-.\" 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 ACCEPT 3SOCKET "Apr 19, 2013"
-.SH NAME
-accept \- accept a connection on a socket
-.SH SYNOPSIS
-.LP
-.nf
-\fBcc\fR [ \fIflag\fR ... ] \fIfile\fR ... \fB-lsocket\fR \fB -lnsl \fR [ \fIlibrary\fR ... ]
-#include <sys/types.h>
-#include <sys/socket.h>
-
-\fBint\fR \fBaccept\fR(\fBint\fR \fIs\fR, \fBstruct sockaddr *\fR\fIaddr\fR, \fBsocklen_t *\fR\fIaddrlen\fR);
-
-\fBint\fR \fBaccept4\fR(\fBint\fR \fIs\fR, \fBstruct sockaddr *\fR\fIaddr\fR, \fBsocklen_t *\fR\fIaddrlen\fR,
-    \fBint\fR \fIflags\fR);
-.fi
-
-.SH DESCRIPTION
-.LP
-The argument \fIs\fR is a socket that has been created with
-\fBsocket\fR(3SOCKET) and bound to an address with \fBbind\fR(3SOCKET), and
-that is listening for connections after a call to \fBlisten\fR(3SOCKET). The
-\fBaccept()\fR function extracts the first connection on the queue of pending
-connections, creates a new socket with the properties of \fIs\fR, and allocates
-a new file descriptor, \fIns\fR, for the socket. If no pending connections are
-present on the queue and the socket is not marked as non-blocking,
-\fBaccept()\fR blocks the caller until a connection is present. If the socket
-is marked as non-blocking and no pending connections are present on the queue,
-\fBaccept()\fR returns an error as described below.  The \fBaccept()\fR
-function uses the \fBnetconfig\fR(4) file to determine the \fBSTREAMS\fR device
-file name associated with \fIs\fR.  This is the device on which the connect
-indication will be accepted. The accepted socket, \fIns\fR, is used to read and
-write data to and from the socket that connected to \fIns\fR. It is not used to
-accept more connections. The original socket (\fIs\fR) remains open for
-accepting further connections.
-.sp
-.LP
-The argument \fIaddr\fR is a result parameter that is filled in with the
-address of the connecting entity as it is known to the communications layer.
-The exact format of the \fIaddr\fR parameter is determined by the domain in
-which the communication occurs.
-.sp
-.LP
-The argument \fIaddrlen\fR is a value-result parameter. Initially, it contains
-the amount of space pointed to by \fIaddr\fR; on return it contains the length
-in bytes of the address returned.
-.sp
-.LP
-The \fBaccept()\fR function is used with connection-based socket types,
-currently with \fBSOCK_STREAM\fR.
-.sp
-.LP
-The \fBaccept4()\fR function allows flags that control the behavior of a
-successfully accepted socket.  If \fIflags\fR is 0, \fBaccept4()\fR acts
-identically to \fBaccept()\fR. Values for \fIflags\fR are constructed by
-a bitwise-inclusive-OR of flags from the following list, defined in
-<sys/socketvar.h>.
-.sp
-.ne 2
-.na
-\fB\fBSOCK_CLOEXEC\fR\fR
-.ad
-.RS 12n
-The accepted socket will have the FD_CLOEXEC flag set as if \fBfcntl()\fR
-was called on it.  This flag is set before the socket is passed to the
-caller thus avoiding the race condition between \fBaccept()\fR and
-\fBfcntl()\fR.  See, \fBO_CLOEXEC\fR in \fBopen(2)\fR for more details.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBSOCK_NDELAY\fR\fR
-.ad
-.RS 12n
-The accepted socket will have the \fBO_NDELAY\fR flag set as if \fBfcntl()\fR
-was called on it.  This sets the socket into non-blocking mode.  See
-\fBO_NDELAY\fR in \fBfcntl.h(3HEAD)\fR for more details.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBSOCK_NONBLOCK\fR\fR
-.ad
-.RS 12n
-The accepted socket will have the \fBO_NONBLOCK\fR flag set as if
-\fBfcntl()\fR was called on it.  This sets the socket into non-blocking mode
-(POSIX; see \fBstandards(5)\fR).  See \fBO_NONBLOCK\fR in \fBfcntl.h(3HEAD)\fR
-for more details.
-.RE
-.sp
-.LP
-It is possible to \fBselect\fR(3C) or \fBpoll\fR(2) a socket for the purpose of
-an \fBaccept()\fR by selecting or polling it for a read. However, this will
-only indicate when a connect indication is pending; it is still necessary to
-call \fBaccept()\fR.
-.SH RETURN VALUES
-.LP
-The \fBaccept()\fR function returns \fB\(mi1\fR on error. If it succeeds, it
-returns a non-negative integer that is a descriptor for the accepted socket.
-.SH ERRORS
-.LP
-\fBaccept()\fR and \fBaccept4()\fR will fail if:
-.sp
-.ne 2
-.na
-\fB\fBEBADF\fR\fR
-.ad
-.RS 16n
-The descriptor is invalid.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBECONNABORTED\fR\fR
-.ad
-.RS 16n
-The remote side aborted the connection before the \fBaccept()\fR operation
-completed.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBEFAULT\fR\fR
-.ad
-.RS 16n
-The \fIaddr\fR parameter or the \fIaddrlen\fR parameter is invalid.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBEINTR\fR\fR
-.ad
-.RS 16n
-The \fBaccept()\fR attempt was interrupted by the delivery of a signal.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBEMFILE\fR\fR
-.ad
-.RS 16n
-The per-process descriptor table is full.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBENODEV\fR\fR
-.ad
-.RS 16n
-The protocol family and type corresponding to  \fIs\fR could not be found in
-the \fBnetconfig\fR file.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBENOMEM\fR\fR
-.ad
-.RS 16n
-There was insufficient user memory available to complete the operation.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBENOSR\fR\fR
-.ad
-.RS 16n
-There were insufficient \fBSTREAMS\fR resources available to complete the
-operation.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBENOTSOCK\fR\fR
-.ad
-.RS 16n
-The descriptor does not reference a socket.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBEOPNOTSUPP\fR\fR
-.ad
-.RS 16n
-The referenced socket is not of type \fBSOCK_STREAM\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBEPROTO\fR\fR
-.ad
-.RS 16n
-A protocol error has occurred; for example, the \fBSTREAMS\fR protocol stack
-has not been initialized or the connection has already been released.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBEWOULDBLOCK\fR\fR
-.ad
-.RS 16n
-The socket is marked as non-blocking and no connections are present to be
-accepted.
-.RE
-
-.sp
-.LP
-Additionally, \fBaccept4()\fR will fail if:
-.sp
-.ne 2
-.na
-\fB\fBEINVAL\fR\fR
-.ad
-.RS 16n
-The \fIflags\fR value is invalid. The \fIflags\fR argument can only be the
-bitwise inclusive-OR of \fBSOCK_CLOEXEC\fR, \fBSOCK_NONBLOCK\fR, and
-\fBSOCK_NDELAY\fR.
-.RE
-
-.SH ATTRIBUTES
-.LP
-See \fBattributes\fR(5) for descriptions of the following attributes:
-.sp
-
-.sp
-.TS
-box;
-c | c
-l | l .
-ATTRIBUTE TYPE	ATTRIBUTE VALUE
-_
-MT-Level	Safe
-.TE
-
-.SH SEE ALSO
-.LP
-\fBpoll\fR(2), \fBbind\fR(3SOCKET), \fBconnect\fR(3SOCKET),
-\fBlisten\fR(3SOCKET), \fBsockaddr\fR(3SOCKET), \fBselect\fR(3C),
-\fBsocket.h\fR(3HEAD), \fBsocket\fR(3SOCKET), \fBnetconfig\fR(4),
-\fBattributes\fR(5), \fBfcntl.h(3HEAD)\fR, \fBfcntl(2)\fR, \fBstandards(5)\fR
--- old/usr/src/man/man3socket/bind.3socket	Sun Aug  5 23:41:11 2018
+++ /dev/null	Sun Aug  5 23:41:10 2018
@@ -1,198 +0,0 @@
-'\" te
-.\" Copyright (C) 2009, Sun Microsystems, Inc. All Rights Reserved
-.\" Copyright 1989 AT&T
-.\" 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 BIND 3SOCKET "May 11, 2009"
-.SH NAME
-bind \- bind a name to a socket
-.SH SYNOPSIS
-.LP
-.nf
-\fBcc\fR [ \fIflag\fR ... ] \fIfile\fR ... \fB-lsocket\fR \fB -lnsl \fR [ \fIlibrary\fR ... ]
-#include <sys/types.h>
-#include <sys/socket.h>
-
-
-
-\fBint\fR \fBbind\fR(\fBint\fR \fIs\fR, \fBconst struct sockaddr *\fR\fIname\fR, \fBint\fR \fInamelen\fR);
-.fi
-
-.SH DESCRIPTION
-.LP
-The \fBbind()\fR function assigns a name to an unnamed socket. When a socket is
-created with \fBsocket\fR(3SOCKET), it exists in a name space (address family)
-but has no name assigned. The \fBbind()\fR function requests that the name
-pointed to by \fIname\fR be assigned to the socket.
-.SH RETURN VALUES
-.LP
-Upon successful completion \fB0\fR is returned. Otherwise, \fB\(mi1\fR is
-returned and \fBerrno\fR is set to indicate the error.
-.SH ERRORS
-.LP
-The \fBbind()\fR function will fail if:
-.sp
-.ne 2
-.na
-\fB\fBEACCES\fR\fR
-.ad
-.RS 17n
-The requested address is protected, and \fB{PRIV_NET_PRIVADDR}\fR is not
-asserted in the effective set of the current process.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBEADDRINUSE\fR\fR
-.ad
-.RS 17n
-The specified address is already in use.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBEADDRNOTAVAIL\fR\fR
-.ad
-.RS 17n
-The specified address is not available on the local machine.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBEBADF\fR\fR
-.ad
-.RS 17n
-\fIs\fR is not a valid descriptor.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBEINVAL\fR\fR
-.ad
-.RS 17n
-\fInamelen\fR is not the size of a valid address for the specified address
-family.
-.sp
-The socket is already bound to an address.
-.sp
-Socket options are inconsistent with port attributes.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBENOSR\fR\fR
-.ad
-.RS 17n
-There were insufficient \fBSTREAMS\fR resources for the operation to complete.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBENOTSOCK\fR\fR
-.ad
-.RS 17n
-\fIs\fR is a descriptor for a file, not a socket.
-.RE
-
-.sp
-.LP
-The following errors are specific to binding names in the UNIX domain:
-.sp
-.ne 2
-.na
-\fB\fBEACCES\fR\fR
-.ad
-.RS 11n
-Search permission is denied for a component of the path prefix of the pathname
-in \fIname\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBEIO\fR\fR
-.ad
-.RS 11n
-An I/O error occurred while making the directory entry or allocating the inode.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBEISDIR\fR\fR
-.ad
-.RS 11n
-A null pathname was specified.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBELOOP\fR\fR
-.ad
-.RS 11n
-Too many symbolic links were encountered in translating the pathname in
-\fIname\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBENOENT\fR\fR
-.ad
-.RS 11n
-A component of the path prefix of the pathname in \fIname\fR does not exist.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBENOTDIR\fR\fR
-.ad
-.RS 11n
-A component of the path prefix of the pathname in \fIname\fR is not a
-directory.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBEROFS\fR\fR
-.ad
-.RS 11n
-The inode would reside on a read-only file system.
-.RE
-
-.SH ATTRIBUTES
-.LP
-See \fBattributes\fR(5) for descriptions of the following attributes:
-.sp
-
-.sp
-.TS
-box;
-c | c
-l | l .
-ATTRIBUTE TYPE	ATTRIBUTE VALUE
-_
-MT-Level	Safe
-.TE
-
-.SH SEE ALSO
-.LP
-\fBunlink\fR(2), \fBsocket\fR(3SOCKET), \fBsockaddr\fR(3SOCKET),
-\fBattributes\fR(5), \fBprivileges\fR(5), \fBsocket.h\fR(3HEAD)
-.SH NOTES
-.LP
-Binding a name in the UNIX domain creates a socket in the file system that must
-be deleted by the caller when it is no longer needed by using \fBunlink\fR(2).
-.sp
-.LP
-The rules used in name binding vary between communication domains.
--- old/usr/src/man/man3socket/connect.3socket	Sun Aug  5 23:41:11 2018
+++ /dev/null	Sun Aug  5 23:41:10 2018
@@ -1,473 +0,0 @@
-'\" te
-.\" Copyright (C) 2005, Sun Microsystems, Inc.
-.\" All Rights Reserved
-.\" Copyright (c) 2014, Joyent, Inc.
-.\" Copyright 1989 AT&T  All Rights Reserved
-.\" 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 CONNECT 3SOCKET "Nov 25, 2014"
-.SH NAME
-connect \- initiate a connection on a socket
-.SH SYNOPSIS
-.LP
-.nf
-\fBcc\fR [ \fIflag\fR ... ] \fIfile\fR ... \fB-lsocket\fR \fB -lnsl \fR [ \fIlibrary\fR ... ]
-#include <sys/types.h>
-#include <sys/socket.h>
-
-
-
-\fBint\fR \fBconnect\fR(\fBint\fR \fIs\fR, \fBconst struct sockaddr *\fR\fIname\fR, \fBint\fR \fInamelen\fR);
-.fi
-
-.SH DESCRIPTION
-.LP
-The parameter \fIs\fR is a socket. If it is of type \fBSOCK_DGRAM\fR,
-\fBconnect()\fR specifies the peer with which the socket is to be associated.
-This address is the address to which datagrams are to be sent if a receiver is
-not explicitly designated. This address is the only address from which
-datagrams are to be received. If the socket \fIs\fR is of type
-\fBSOCK_STREAM\fR, \fBconnect()\fR attempts to make a connection to another
-socket. The other socket is specified by \fIname\fR. \fIname\fR is an address
-in the communication space of the socket. Each communication space interprets
-the \fIname\fR parameter in its own way. If \fIs\fR is not bound, then \fIs\fR
-will be bound to an address selected by the underlying transport provider.
-Generally, stream sockets can successfully \fBconnect()\fR only once. Datagram
-sockets can use \fBconnect()\fR multiple times to change their association.
-Datagram sockets can dissolve the association by connecting to a null address.
-.SS Non-blocking Sockets
-When a socket is created, it is by default a \fBblocking\fR socket. A socket may
-be configured to be \fBnon-blocking\fR either at socket creation time or through
-the use of \fBfcntl\fR(2). When a socket is set to be \fBnon-blocking\fR, a call
-to connect initiates an asynchronous connection. If the connection cannot be
-completed without blocking, such as when making a TCP connection to a remote
-server, then  the connection attempt is made in the background and \fBconnect\fR
-returns -1 and errno is set to \fBEINPROGRESS\fR.
-.LP
-Applications can obtain the state of this connection attempt by polling the
-socket's file descriptor for \fBPOLLOUT\fR. The event ports facility is the
-preferred means of polling on the file descriptor, see \fBport_create\fR(3C) and
-\fBport_get\fR(3C) for more information on event ports; however, applications
-may also use traditional portable routines like \fBpoll\fR(2) and
-\fBselect\fR(3C).
-.LP
-When an asynchronous connection has completed, the application must call
-\fBgetsockopt\fR(3SOCKET) using the macro \fBSOL_SOCKET\fR as the \fIlevel\fR
-argument and the macro \fBSO_ERROR\fR as the value of the \fIoption\fR argument.
-If the value of the \fBSO_ERROR\fR socket option is zero, then the
-connect was successfully established. Otherwise, the connection could not be
-established and the value is the corresponding error code that would be commonly
-found in \fBerrno\fR.
-.LP
-Even when a socket is in \fBnon-blocking\fR mode, a call to \fBconnect\fR may
-fail synchronously. If any error other \fBEINPROGRESS\fR or \fBEINTR\fR occurs,
-then there is no need for the application to poll for asynchronous completion.
-Similarly, if a call to \fBconnect\fR returns successfully, then the socket
-connection will be established and there is no need to poll for completion.
-.SH EXAMPLES
-.LP
-\fBExample 1\fR  Performing an asynchronous connection
-.sp
-.LP
-The following sample C program shows how to create and connect to a remote host
-using TCP. The program should be compiled and linked against libnsl and
-libsocket. For example, if the contents of this example where in a file called
-example.c, one would run cc example.c -lnsl -lsocket.
-.sp
-.in +2
-.nf
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include <inttypes.h>
-#include <stdio.h>
-#include <strings.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <port.h>
-#include <unistd.h>
-#include <assert.h>
-
-int
-main(int argc, char *argv[])
-{
-	char *eptr;
-	long port;
-	int sock, ret, eport;
-	struct sockaddr_in6 sin6;
-
-	if (argc != 3) {
-		fprintf(stderr, "connect: <IP> <port>\\n");
-		return (1);
-	}
-
-	bzero(&sin6, sizeof (struct sockaddr_in6));
-	sin6.sin6_family = AF_INET6;
-
-	/*
-	 * Try to parse as an IPv6 address and then try v4.
-	 */
-	ret = inet_pton(AF_INET6, argv[1], &sin6.sin6_addr);
-	if (ret == -1) {
-		perror("inet_pton");
-		return (1);
-	} else if (ret == 0) {
-		struct in_addr v4;
-		ret = inet_pton(AF_INET, argv[1], &v4);
-		if (ret == -1) {
-			perror("inet_pton");
-			return (1);
-		} else if (ret == 0) {
-			fprintf(stderr, "connect: %s is not a valid "
-			    "IPv4 or IPv6 address\\n", argv[1]);
-			return (1);
-		}
-		/* N.B. Not a portable macro */
-		IN6_INADDR_TO_V4MAPPED(&v4, &sin6.sin6_addr);
-	}
-
-	errno = 0;
-	port = strtol(argv[2], &eptr, 10);
-	if (errno != 0 || *eptr != '\e0') {
-		fprintf(stderr, "failed to parse port %s\\n", argv[2]);
-		return (1);
-	}
-	if (port <= 0 || port > UINT16_MAX) {
-		fprintf(stderr, "invalid port: %ld\\n", port);
-		return (1);
-	}
-	sin6.sin6_port = htons(port);
-
-	sock = socket(AF_INET6, SOCK_STREAM | SOCK_NONBLOCK, 0);
-	if (sock < 0) {
-		perror("socket");
-		return (1);
-	}
-
-	eport = port_create();
-	if (eport < 0) {
-		perror("port_create");
-		(void) close(sock);
-		return (1);
-	}
-
-	ret = connect(sock, (struct sockaddr *)&sin6,
-	    sizeof (struct sockaddr_in6));
-	if (ret != 0 && errno != EINPROGRESS && errno != EINTR) {
-		perror("connect");
-		(void) close(sock);
-		(void) close(eport);
-		return (1);
-	}
-
-	if (ret != 0) {
-		port_event_t pe;
-		int err;
-		socklen_t sz = sizeof (err);
-		if (port_associate(eport, PORT_SOURCE_FD, sock, POLLOUT,
-		    NULL) != 0) {
-			perror("port_associate");
-			(void) close(sock);
-			(void) close(eport);
-			return (1);
-		}
-		if (port_get(eport, &pe, NULL) != 0) {
-			perror("port_get");
-			(void) close(sock);
-			(void) close(eport);
-			return (1);
-		}
-		assert(pe.portev_source == PORT_SOURCE_FD);
-		assert(pe.portev_object == (uintptr_t)sock);
-		if (getsockopt(sock, SOL_SOCKET, SO_ERROR, &err, &sz) != 0) {
-			perror("getsockopt");
-			(void) close(sock);
-			(void) close(eport);
-			return (1);
-		}
-		if (err != 0) {
-			/* Asynch connect failed */
-			fprintf(stderr, "asnchronous connect: %s\\n",
-			    strerror(err));
-			(void) close(sock);
-			(void) close(eport);
-			return (1);
-		}
-	}
-
-	/* Read and write to the socket and then clean up */
-
-	return (0);
-}
-.fi
-.in -2
-.SH RETURN VALUES
-.LP
-If the connection or binding succeeds, \fB0\fR is returned. Otherwise,
-\fB\(mi1\fR is returned and sets \fBerrno\fR to indicate the error.
-.SH ERRORS
-.LP
-The call fails if:
-.sp
-.ne 2
-.na
-\fB\fBEACCES\fR\fR
-.ad
-.RS 17n
-Search permission is denied for a component of the path prefix of the pathname
-in \fIname\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBEADDRINUSE\fR\fR
-.ad
-.RS 17n
-The address is already in use.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBEADDRNOTAVAIL\fR\fR
-.ad
-.RS 17n
-The specified address is not available on the remote machine.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBEAFNOSUPPORT\fR\fR
-.ad
-.RS 17n
-Addresses in the specified address family cannot be used with this socket.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBEALREADY\fR\fR
-.ad
-.RS 17n
-The socket is non-blocking,  and a previous connection attempt has not yet been
-completed.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBEBADF\fR\fR
-.ad
-.RS 17n
-\fIs\fR is not a valid descriptor.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBECONNREFUSED\fR\fR
-.ad
-.RS 17n
-The attempt to connect was forcefully rejected. The calling program should
-\fBclose\fR(2) the socket descriptor, and issue another \fBsocket\fR(3SOCKET)
-call to obtain a new descriptor before attempting another \fBconnect()\fR call.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBEINPROGRESS\fR\fR
-.ad
-.RS 17n
-The socket is non-blocking, and the connection cannot be completed immediately.
-See the section on \fBNon-blocking Sockets\fR for more information.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBEINTR\fR\fR
-.ad
-.RS 17n
-The connection attempt was interrupted before any data arrived by the delivery
-of a signal. The connection, however, will be established asynchronously.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBEINVAL\fR\fR
-.ad
-.RS 17n
-\fInamelen\fR is not the size of a valid address for the specified address
-family.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBEIO\fR\fR
-.ad
-.RS 17n
-An I/O error occurred while reading from or writing to the file system.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBEISCONN\fR\fR
-.ad
-.RS 17n
-The socket is already connected.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBELOOP\fR\fR
-.ad
-.RS 17n
-Too many symbolic links were encountered in translating the pathname in
-\fIname\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBENETUNREACH\fR\fR
-.ad
-.RS 17n
-The network is not reachable from this host.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBEHOSTUNREACH\fR\fR
-.ad
-.RS 17n
-The remote host is not reachable from this host.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBENOENT\fR\fR
-.ad
-.RS 17n
-A component of the path prefix of the pathname in \fIname\fR does not exist.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBENOENT\fR\fR
-.ad
-.RS 17n
-The socket referred to by the pathname in \fIname\fR does not exist.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBENOSR\fR\fR
-.ad
-.RS 17n
-There were insufficient \fBSTREAMS\fR resources available to complete the
-operation.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBENXIO\fR\fR
-.ad
-.RS 17n
-The server exited before the connection was complete.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBETIMEDOUT\fR\fR
-.ad
-.RS 17n
-Connection establishment timed out without establishing a connection.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBEWOULDBLOCK\fR\fR
-.ad
-.RS 17n
-The socket is marked as non-blocking, and the requested operation would block.
-.RE
-
-.sp
-.LP
-The following errors are specific to connecting names in the UNIX domain.
-These errors might not apply in future versions of the UNIX  \fBIPC\fR domain.
-.sp
-.ne 2
-.na
-\fB\fBENOTDIR\fR\fR
-.ad
-.RS 14n
-A component of the path prefix of the pathname in \fIname\fR is not a
-directory.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBENOTSOCK\fR\fR
-.ad
-.RS 14n
-\fIs\fR is not a socket.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBENOTSOCK\fR\fR
-.ad
-.RS 14n
-\fIname\fR is not a socket.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBEPROTOTYPE\fR\fR
-.ad
-.RS 14n
-The file that is referred to by \fIname\fR is a socket of a type other than
-type \fIs\fR. For example, \fIs\fR is a \fBSOCK_DGRAM\fR socket, while
-\fIname\fR refers to a \fBSOCK_STREAM\fR socket.
-.RE
-
-.SH ATTRIBUTES
-.LP
-See \fBattributes\fR(5) for descriptions of the following attributes:
-.sp
-
-.sp
-.TS
-box;
-c | c
-l | l .
-ATTRIBUTE TYPE	ATTRIBUTE VALUE
-_
-MT-Level	Safe
-.TE
-
-.SH SEE ALSO
-.LP
-\fBclose\fR(2), \fBaccept\fR(3SOCKET), \fBgetsockname\fR(3SOCKET),
-\fBselect\fR(3C), \fBsocket\fR(3SOCKET), \fBsockaddr\fR(3SOCKET),
-\fBsocket.h\fR(3HEAD), \fBattributes\fR(5)
--- old/usr/src/man/man3socket/getpeername.3socket	Sun Aug  5 23:41:11 2018
+++ /dev/null	Sun Aug  5 23:41:10 2018
@@ -1,98 +0,0 @@
-'\" te
-.\"  Copyright 1989 AT&T  Copyright (c) 1998, Sun Microsystems, Inc.  All Rights Reserved
-.\" 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 GETPEERNAME 3SOCKET "Mar 26, 1998"
-.SH NAME
-getpeername \- get name of connected peer
-.SH SYNOPSIS
-.LP
-.nf
-\fBcc\fR [ \fIflag\fR ... ] \fIfile\fR ... \fB-lsocket\fR \fB -lnsl \fR [ \fIlibrary\fR ... ]
-#include <sys/types.h>
-#include <sys/socket.h>
-
-\fBint\fR \fBgetpeername\fR(\fBint\fR \fIs\fR, \fBstruct sockaddr *\fR\fIname\fR, \fBsocklen_t *\fR\fInamelen\fR);
-.fi
-
-.SH DESCRIPTION
-.LP
-\fBgetpeername()\fR returns the name of the peer connected to socket \fIs\fR.
-The \fBint\fR pointed to by the \fInamelen\fR parameter should be initialized
-to indicate the amount of space pointed to by \fIname\fR. On return it contains
-the actual size of the name returned (in bytes), prior to any truncation. The
-name is truncated if the buffer provided is too small.
-.SH RETURN VALUES
-.LP
-If successful, \fBgetpeername()\fR returns  \fB0\fR; otherwise it returns
-\fB\(mi1\fR and sets \fBerrno\fR to indicate the error.
-.SH ERRORS
-.LP
-The call succeeds unless:
-.sp
-.ne 2
-.na
-\fB\fBEBADF\fR\fR
-.ad
-.RS 12n
-The argument \fIs\fR is not a valid descriptor.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBENOMEM\fR\fR
-.ad
-.RS 12n
-There was insufficient user memory for the operation to complete.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBENOSR\fR\fR
-.ad
-.RS 12n
-There were insufficient STREAMS resources available for the operation to
-complete.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBENOTCONN\fR\fR
-.ad
-.RS 12n
-The socket is not connected.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBENOTSOCK\fR\fR
-.ad
-.RS 12n
-The argument \fIs\fR is not a socket.
-.RE
-
-.SH ATTRIBUTES
-.LP
-See \fBattributes\fR(5) for descriptions of the following attributes:
-.sp
-
-.sp
-.TS
-box;
-c | c
-l | l .
-ATTRIBUTE TYPE	ATTRIBUTE VALUE
-_
-MT-Level	Safe
-.TE
-
-.SH SEE ALSO
-.LP
-\fBaccept\fR(3SOCKET), \fBbind\fR(3SOCKET), \fBgetsockname\fR(3SOCKET),
-\fBsockaddr\fR(3SOCKET),
-\fBsocket\fR(3SOCKET), \fBattributes\fR(5), \fBsocket.h\fR(3HEAD)
--- old/usr/src/man/man3socket/getsockname.3socket	Sun Aug  5 23:41:11 2018
+++ /dev/null	Sun Aug  5 23:41:10 2018
@@ -1,87 +0,0 @@
-'\" te
-.\"  Copyright 1989 AT&T  Copyright (c) 1997, Sun Microsystems, Inc.  All Rights Reserved
-.\" 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 GETSOCKNAME 3SOCKET "Dec 12, 1997"
-.SH NAME
-getsockname \- get socket name
-.SH SYNOPSIS
-.LP
-.nf
-\fBcc\fR [ \fIflag\fR ... ] \fIfile\fR ... \fB-lsocket\fR \fB -lnsl \fR [ \fIlibrary\fR ... ]
-#include <sys/types.h>
-#include <sys/socket.h>
-
-\fBint\fR \fBgetsockname\fR(\fBint\fR \fIs\fR, \fBstruct sockaddr *\fR\fIname\fR, \fBsocklen_t *\fR\fInamelen\fR);
-.fi
-
-.SH DESCRIPTION
-.LP
-\fBgetsockname()\fR returns the current \fIname\fR for socket \fIs\fR. The
-\fInamelen\fR parameter should be initialized to indicate the amount of space
-pointed to by \fIname\fR. On return it contains the actual size in bytes of the
-name returned.
-.SH RETURN VALUES
-.LP
-If successful, \fBgetsockname()\fR returns  \fB0\fR; otherwise it returns
-\fB\(mi1\fR and sets  \fIerrno\fR to indicate the error.
-.SH ERRORS
-.LP
-The call succeeds unless:
-.sp
-.ne 2
-.na
-\fB\fBEBADF\fR\fR
-.ad
-.RS 12n
-The argument \fIs\fR is not a valid file descriptor.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBENOMEM\fR\fR
-.ad
-.RS 12n
-There was insufficient memory available for the operation to complete.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBENOSR\fR\fR
-.ad
-.RS 12n
-There were insufficient STREAMS resources available for the operation to
-complete.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBENOTSOCK\fR\fR
-.ad
-.RS 12n
-The argument \fIs\fR is not a socket.
-.RE
-
-.SH ATTRIBUTES
-.LP
-See \fBattributes\fR(5) for descriptions of the following attributes:
-.sp
-
-.sp
-.TS
-box;
-c | c
-l | l .
-ATTRIBUTE TYPE	ATTRIBUTE VALUE
-_
-MT-Level	Safe
-.TE
-
-.SH SEE ALSO
-.LP
-\fBbind\fR(3SOCKET), \fBgetpeername\fR(3SOCKET), \fBsockaddr\fR(3SOCKET),
-\fBsocket\fR(3SOCKET), \fBattributes\fR(5)
--- old/usr/src/man/man3socket/getsockopt.3socket	Sun Aug  5 23:41:11 2018
+++ /dev/null	Sun Aug  5 23:41:10 2018
@@ -1,531 +0,0 @@
-'\" te
-.\" Copyright (C) 2009, Sun Microsystems, Inc. All Rights Reserved
-.\" Copyright 1989 AT&T
-.\" 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 GETSOCKOPT 3SOCKET "Jan 27, 2009"
-.SH NAME
-getsockopt, setsockopt \- get and set options on sockets
-.SH SYNOPSIS
-.LP
-.nf
-\fBcc\fR [ \fIflag\fR ... ] \fIfile\fR ... \fB-lsocket\fR \fB -lnsl \fR [ \fIlibrary\fR ... ]
-#include <sys/types.h>
-#include <sys/socket.h>
-
-\fBint\fR \fBgetsockopt\fR(\fBint\fR \fIs\fR, \fBint\fR \fIlevel\fR, \fBint\fR \fIoptname\fR, \fBvoid *\fR\fIoptval\fR,
-     \fBint *\fR\fIoptlen\fR);
-.fi
-
-.LP
-.nf
-\fBint\fR \fBsetsockopt\fR(\fBint\fR \fIs\fR, \fBint\fR \fIlevel\fR, \fBint\fR \fIoptname\fR, \fBconst void *\fR\fIoptval\fR,
-     \fBint\fR \fIoptlen\fR);
-.fi
-
-.SH DESCRIPTION
-.sp
-.LP
-The \fBgetsockopt()\fR and \fBsetsockopt()\fR functions manipulate options
-associated with a socket. Options may exist at multiple protocol levels; they
-are always present at the uppermost "socket" level.
-.sp
-.LP
-The \fIlevel\fR argument specifies the protocol level at which the option
-resides. To manipulate options at the socket level, specify the \fIlevel\fR
-argument as \fBSOL_SOCKET\fR. To manipulate options at the protocol level,
-supply the appropriate protocol number for the protocol controlling the option.
-For example, to indicate that an option will be interpreted by the \fBTCP\fR,
-set \fIlevel\fR to the protocol number of \fBTCP\fR, as defined in the
-\fB<netinet/in.h>\fR header, or as determined by using
-\fBgetprotobyname\fR(3SOCKET). Some socket protocol families may also define
-additional levels, such as \fBSOL_ROUTE\fR. Only socket-level options are
-described here.
-.sp
-.LP
-The parameters \fIoptval\fR and \fIoptlen\fR are used to access option values
-for \fBsetsockopt()\fR. For \fBgetsockopt()\fR, they identify a buffer in which
-the value(s) for the requested option(s) are to be returned. For
-\fBgetsockopt()\fR, \fIoptlen\fR is a value-result parameter, initially
-containing the size of the buffer pointed to by \fIoptval\fR, and modified on
-return to indicate the actual size of the value returned. Use a 0 \fIoptval\fR
-if no option value is to be supplied or returned.
-.sp
-.LP
-The \fIoptname\fR and any specified options are passed uninterpreted to the
-appropriate protocol module for interpretation. The include file
-<\fBsys/socket.h\fR> contains definitions for the socket-level options
-described below. Options at other protocol levels vary in format and name.
-.sp
-.LP
-Most socket-level options take an \fBint\fR for \fIoptval\fR. For
-\fBsetsockopt()\fR, the \fIoptval\fR parameter should be non-zero to enable a
-boolean option, or zero if the option is to be disabled. \fBSO_LINGER\fR uses a
-\fBstruct linger\fR parameter that specifies the desired state of the option
-and the linger interval. \fBstruct linger\fR is defined in
-<\fBsys/socket.h\fR>. \fBstruct\fR \fBlinger\fR contains the following members:
-.sp
-.ne 2
-.na
-\fB\fBl_onoff\fR\fR
-.ad
-.RS 12n
-on = 1/off = 0
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBl_linger\fR\fR
-.ad
-.RS 12n
-linger time, in seconds
-.RE
-
-.sp
-.LP
-The following options are recognized at the socket level. Except as noted, each
-may be examined with \fBgetsockopt()\fR and set with \fBsetsockopt()\fR.
-.sp
-.ne 2
-.na
-\fB\fBSO_DEBUG\fR\fR
-.ad
-.RS 19n
-enable/disable recording of debugging information
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBSO_REUSEADDR\fR\fR
-.ad
-.RS 19n
-enable/disable local address reuse
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBSO_KEEPALIVE\fR\fR
-.ad
-.RS 19n
-enable/disable keep connections alive
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBSO_DONTROUTE\fR\fR
-.ad
-.RS 19n
-enable/disable routing bypass for outgoing messages
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBSO_LINGER\fR\fR
-.ad
-.RS 19n
-linger on close if data is present
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBSO_BROADCAST\fR\fR
-.ad
-.RS 19n
-enable/disable permission to transmit broadcast messages
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBSO_OOBINLINE\fR\fR
-.ad
-.RS 19n
-enable/disable reception of out-of-band data in band
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBSO_SNDBUF\fR\fR
-.ad
-.RS 19n
-set buffer size for output
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBSO_RCVBUF\fR\fR
-.ad
-.RS 19n
-set buffer size for input
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBSO_DGRAM_ERRIND\fR\fR
-.ad
-.RS 19n
-application wants delayed error
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBSO_TIMESTAMP\fR\fR
-.ad
-.RS 19n
-enable/disable reception of timestamp with datagrams
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBSO_EXCLBIND\fR\fR
-.ad
-.RS 19n
-enable/disable exclusive binding of the socket
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBSO_TYPE\fR\fR
-.ad
-.RS 19n
-get the type of the socket (get only)
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBSO_ERROR\fR\fR
-.ad
-.RS 19n
-get and clear error on the socket (get only)
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBSO_MAC_EXEMPT\fR\fR
-.ad
-.RS 19n
-get or set mandatory access control on the socket. This option is available
-only when the system is configured with Trusted Extensions.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBSO_ALLZONES\fR\fR
-.ad
-.RS 19n
-bypass zone boundaries (privileged).
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBSO_DOMAIN\fR\fR
-.ad
-.RS 19n
-get the domain used in the socket (get only)
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBSO_PROTOTYPE\fR\fR
-.ad
-.RS 19n
-for socket in domains \fBPF_INET\fR and \fBPF_INET6\fR, get the underlying
-protocol number used in the socket. For socket in domain \fBPF_ROUTE\fR, get
-the address family used in the socket.
-.RE
-
-.sp
-.LP
-The \fBSO_DEBUG\fR option enables debugging in the underlying protocol modules.
-The \fBSO_REUSEADDR\fR option indicates that the rules used in validating
-addresses supplied in a \fBbind\fR(3SOCKET) call should allow reuse of local
-addresses. The \fBSO_KEEPALIVE\fR option enables the periodic transmission of
-messages on a connected socket. If the connected party fails to respond to
-these messages, the connection is considered broken and threads using the
-socket are notified using a \fBSIGPIPE\fR signal. The \fBSO_DONTROUTE\fR option
-indicates that outgoing messages should bypass the standard routing facilities.
-Instead, messages are directed to the appropriate network interface according
-to the network portion of the destination address.
-.sp
-.LP
-The \fBSO_LINGER\fR option controls the action taken when unsent messages are
-queued on a socket and a \fBclose\fR(2) is performed. If the socket promises
-reliable delivery of data and \fBSO_LINGER\fR is set, the system will block the
-thread on the \fBclose()\fR attempt until it is able to transmit the data or
-until it decides it is unable to deliver the information (a timeout period,
-termed the linger interval, is specified in the \fBsetsockopt()\fR call when
-\fBSO_LINGER\fR is requested). If \fBSO_LINGER\fR is disabled and a
-\fBclose()\fR is issued, the system will process the \fBclose()\fR in a manner
-that allows the thread to continue as quickly as possible.
-.sp
-.LP
-The option \fBSO_BROADCAST\fR requests permission to send broadcast datagrams
-on the socket. With protocols that support out-of-band data, the
-\fBSO_OOBINLINE\fR option requests that out-of-band data be placed in the
-normal data input queue as received; it will then be accessible with
-\fBrecv()\fR or \fBread()\fR calls without the \fBMSG_OOB\fR flag.
-.sp
-.LP
-The \fBSO_SNDBUF\fR and \fBSO_RCVBUF\fR options adjust the normal buffer sizes
-allocated for output and input buffers, respectively. The buffer size may be
-increased for high-volume connections or may be decreased to limit the possible
-backlog of incoming data. The maximum buffer size for \fBUDP\fR is determined
-by the value of the \fBndd\fR variable \fBudp_max_buf\fR. The maximum buffer
-size for \fBTCP\fR is determined the value of the \fBndd\fR variable
-\fBtcp_max_buf\fR. Use the \fBndd\fR(1M) utility to determine the current
-default values. See the \fISolaris Tunable Parameters Reference Manual\fR for
-information on setting the values of \fBudp_max_buf\fR and \fBtcp_max_buf\fR.
-At present, lowering \fBSO_RCVBUF\fR on a TCP connection after it has been
-established has no effect.
-.sp
-.LP
-By default, delayed errors (such as \fBICMP\fR port unreachable packets) are
-returned only for connected datagram sockets. The \fBSO_DGRAM_ERRIND\fR option
-makes it possible to receive errors for datagram sockets that are not
-connected. When this option is set, certain delayed errors received after
-completion of a \fBsendto()\fR or \fBsendmsg()\fR operation will cause a
-subsequent \fBsendto()\fR or \fBsendmsg()\fR operation using the same
-destination address (\fIto\fR parameter) to fail with the appropriate error.
-See \fBsend\fR(3SOCKET).
-.sp
-.LP
-If the \fBSO_TIMESTAMP\fR option is enabled on a \fBSO_DGRAM\fR or a
-\fBSO_RAW\fR socket, the \fBrecvmsg\fR(3XNET) call will return a timestamp in
-the native data format, corresponding to when the datagram was received.
-.sp
-.LP
-The \fBSO_EXCLBIND\fR option is used to enable or disable the exclusive binding
-of a socket. It overrides the use of the \fBSO_REUSEADDR\fR option to reuse an
-address on \fBbind\fR(3SOCKET). The actual semantics of the \fBSO_EXCLBIND\fR
-option depend on the underlying protocol. See \fBtcp\fR(7P) or \fBudp\fR(7P)
-for more information.
-.sp
-.LP
-The \fBSO_TYPE\fR and \fBSO_ERROR\fR options are used only with
-\fBgetsockopt()\fR. The \fBSO_TYPE\fR option returns the type of the socket,
-for example, \fBSOCK_STREAM\fR. It is useful for servers that inherit sockets
-on startup. The \fBSO_ERROR\fR option returns any pending error on the socket
-and clears the error status. It may be used to check for asynchronous errors on
-connected datagram sockets or for other asynchronous errors.
-.sp
-.LP
-The \fBSO_MAC_EXEMPT\fR option is used to toggle socket behavior with unlabeled
-peers. A socket that has this option enabled can communicate with an unlabeled
-peer if it is in the global zone or has a label that dominates the default
-label of the peer. Otherwise, the socket must have a label that is equal to the
-default label of the unlabeled peer. Calling \fBsetsockopt()\fR with this
-option returns an \fBEACCES\fR error if the process lacks the
-\fBNET_MAC_AWARE\fR privilege or if the socket is bound. The
-\fBSO_MAC_EXEMPT\fR option is available only when the system is configured with
-Trusted Extensions.
-.sp
-.LP
-The \fBSO_ALLZONES\fR option can be used to bypass zone boundaries between
-shared-IP zones. Normally, the system prevents a socket from being bound to an
-address that is not assigned to the current zone. It also prevents a socket
-that is bound to a wildcard address from receiving traffic for other zones.
-However, some daemons which run in the global zone might need to send and
-receive traffic using addresses that belong to other shared-IP zones. If set
-before a socket is bound, \fBSO_ALLZONES\fR causes the socket to ignore zone
-boundaries between shared-IP zones and permits the socket to be bound to any
-address assigned to the shared-IP zones. If the socket is bound to a wildcard
-address, it receives traffic intended for all shared-IP zones and behaves as if
-an equivalent socket were bound in each active shared-IP zone. Applications
-that use the \fBSO_ALLZONES\fR option to initiate connections or send datagram
-traffic should specify the source address for outbound traffic by binding to a
-specific address. There is no effect from setting this option in an
-exclusive-IP zone. Setting this option requires the \fBsys_net_config\fR
-privilege. See \fBzones\fR(5).
-.SH RETURN VALUES
-.sp
-.LP
-If successful, \fBgetsockopt()\fR and \fBsetsockopt()\fR return \fB0\fR.
-Otherwise, the functions return \fB\(mi1\fR and set \fBerrno\fR to indicate the
-error.
-.SH ERRORS
-.sp
-.LP
-The \fBgetsockopt()\fR and \fBsetsockopt()\fR calls succeed unless:
-.sp
-.ne 2
-.na
-\fB\fBEBADF\fR\fR
-.ad
-.RS 17n
-The argument \fIs\fR is not a valid file descriptor.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBENOMEM\fR\fR
-.ad
-.RS 17n
-There was insufficient memory available for the operation to complete.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBENOPROTOOPT\fR\fR
-.ad
-.RS 17n
-The option is unknown at the level indicated.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBENOSR\fR\fR
-.ad
-.RS 17n
-There were insufficient STREAMS resources available for the operation to
-complete.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBENOTSOCK\fR\fR
-.ad
-.RS 17n
-The argument \fIs\fR is not a socket.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBENOBUFS\fR\fR
-.ad
-.RS 17n
-\fBSO_SNDBUF\fR or \fBSO_RCVBUF\fR exceeds a system limit.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBEINVAL\fR\fR
-.ad
-.RS 17n
-Invalid length for a given socket option.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBEHOSTUNREACH\fR\fR
-.ad
-.RS 17n
-Invalid address for \fBIP_MULTICAST_IF\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBEINVAL\fR\fR
-.ad
-.RS 17n
-Not a multicast address for \fBIP_ADD_MEMBERSHIP\fR and
-\fBIP_DROP_MEMBERSHIP\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBEADDRNOTAVAIL\fR\fR
-.ad
-.RS 17n
-Bad interface address for \fBIP_ADD_MEMBERSHIP\fR and \fBIP_DROP_MEMBERSHIP\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBEADDRINUSE\fR\fR
-.ad
-.RS 17n
-Address already joined for \fBIP_ADD_MEMBERSHIP\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBENOENT\fR\fR
-.ad
-.RS 17n
-Address not joined for \fBIP_DROP_MEMBERSHIP\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBEPERM\fR\fR
-.ad
-.RS 17n
-No permissions.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBEACCES\fR\fR
-.ad
-.RS 17n
-Permission denied.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBEINVAL\fR\fR
-.ad
-.RS 17n
-The specified option is invalid at the specified socket level, or the socket
-has been shut down.
-.RE
-
-.SH ATTRIBUTES
-.sp
-.LP
-See \fBattributes\fR(5) for descriptions of the following attributes:
-.sp
-
-.sp
-.TS
-box;
-c | c
-l | l .
-ATTRIBUTE TYPE	ATTRIBUTE VALUE
-_
-MT-Level	Safe
-.TE
-
-.SH SEE ALSO
-.sp
-.LP
-\fBndd\fR(1M), \fBclose\fR(2), \fBioctl\fR(2), \fBread\fR(2),
-\fBbind\fR(3SOCKET), \fBgetprotobyname\fR(3SOCKET), \fBrecv\fR(3SOCKET),
-\fBrecvmsg\fR(3XNET), \fBsend\fR(3SOCKET), \fBsocket\fR(3SOCKET),
-\fBsocket.h\fR(3HEAD), \fBattributes\fR(5), \fBzones\fR(5), \fBtcp\fR(7P),
-\fBudp\fR(7P)
-.sp
-.LP
-\fISolaris Tunable Parameters Reference Manual\fR
--- old/usr/src/man/man3socket/listen.3socket	Sun Aug  5 23:41:12 2018
+++ /dev/null	Sun Aug  5 23:41:10 2018
@@ -1,100 +0,0 @@
-'\" te
-.\"  Copyright 1989 AT&T
-.\" Copyright (C) 1999, Sun Microsystems,
-.\" Inc. All Rights Reserved
-.\" 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 LISTEN 3SOCKET "Nov 8, 1999"
-.SH NAME
-listen \- listen for connections on a socket
-.SH SYNOPSIS
-.LP
-.nf
-\fBcc\fR [ \fIflag\fR ... ] \fIfile\fR ... \fB-lsocket\fR \fB -lnsl \fR [ \fIlibrary\fR ... ]
-#include <sys/types.h>
-#include <sys/socket.h>
-
-\fBint\fR \fBlisten\fR(\fBint\fR \fIs\fR, \fBint\fR \fIbacklog\fR);
-.fi
-
-.SH DESCRIPTION
-.sp
-.LP
-To accept connections, a socket is first created with  \fBsocket\fR(3SOCKET), a
-backlog for incoming connections is specified with \fBlisten()\fR and then the
-connections are accepted with  \fBaccept\fR(3SOCKET). The \fBlisten()\fR call
-applies only to sockets of type \fBSOCK_STREAM\fR or \fBSOCK_SEQPACKET\fR.
-.sp
-.LP
-The \fIbacklog\fR parameter defines the maximum length the queue of pending
-connections may grow to.
-.sp
-.LP
-If a connection request arrives with the queue full, the client will receive an
-error with an indication of \fBECONNREFUSED\fR for  \fBAF_UNIX\fR sockets. If
-the underlying protocol supports retransmission,  the connection request may be
-ignored so that retries may succeed. For \fBAF_INET\fR and
-\fBAF_INET6\fRsockets, the \fBTCP\fR will retry the connection. If the
-\fIbacklog\fR is not cleared by the time the tcp times out, the connect will
-fail with \fBETIMEDOUT\fR.
-.SH RETURN VALUES
-.sp
-.LP
-A \fB0\fR return value indicates success; \fB\(mi1\fR indicates an error.
-.SH ERRORS
-.sp
-.LP
-The call fails if:
-.sp
-.ne 2
-.na
-\fB\fBEBADF\fR\fR
-.ad
-.RS 14n
-The argument \fIs\fR is not a valid file descriptor.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBENOTSOCK\fR\fR
-.ad
-.RS 14n
-The argument \fIs\fR is not a socket.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBEOPNOTSUPP\fR\fR
-.ad
-.RS 14n
-The socket is not of a type that supports the operation \fBlisten()\fR.
-.RE
-
-.SH ATTRIBUTES
-.sp
-.LP
-See \fBattributes\fR(5) for descriptions of the following attributes:
-.sp
-
-.sp
-.TS
-box;
-c | c
-l | l .
-ATTRIBUTE TYPE	ATTRIBUTE VALUE
-_
-MT-Level	Safe
-.TE
-
-.SH SEE ALSO
-.sp
-.LP
-\fBaccept\fR(3SOCKET), \fBconnect\fR(3SOCKET), \fBsocket\fR(3SOCKET),
-\fBattributes\fR(5), \fBsocket.h\fR(3HEAD)
-.SH NOTES
-.sp
-.LP
-There is currently no \fIbacklog\fR limit.
--- old/usr/src/man/man3socket/recv.3socket	Sun Aug  5 23:41:12 2018
+++ /dev/null	Sun Aug  5 23:41:10 2018
@@ -1,291 +0,0 @@
-'\" te
-.\"  Copyright 1989 AT&T
-.\" Copyright (C) 2006, Sun Microsystems, Inc. All Rights Reserved
-.\" 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 RECV 3SOCKET "Dec 03, 2014"
-.SH NAME
-recv, recvfrom, recvmsg \- receive a message from a socket
-.SH SYNOPSIS
-.LP
-.nf
-\fBcc\fR [ \fIflag\fR... ] \fIfile\fR... \fB-lsocket\fR \fB -lnsl \fR [ \fIlibrary\fR... ]
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <sys/uio.h>
-
-\fBssize_t\fR \fBrecv\fR(\fBint\fR \fIs\fR, \fBvoid *\fR\fIbuf\fR, \fBsize_t\fR \fIlen\fR, \fBint\fR \fIflags\fR);
-.fi
-
-.LP
-.nf
-\fBssize_t\fR \fBrecvfrom\fR(\fBint\fR \fIs\fR, \fBvoid *\fR\fIbuf\fR, \fBsize_t\fR \fIlen\fR, \fBint\fR \fIflags\fR,
-     \fBstruct sockaddr *\fR\fIfrom\fR, \fBsocklen_t *\fR\fIfromlen\fR);
-.fi
-
-.LP
-.nf
-\fBssize_t\fR \fBrecvmsg\fR(\fBint\fR \fIs\fR, \fBstruct msghdr *\fR\fImsg\fR, \fBint\fR \fIflags\fR);
-.fi
-
-.SH DESCRIPTION
-.LP
-The \fBrecv()\fR, \fBrecvfrom()\fR, and \fBrecvmsg()\fR functions are used to
-receive messages from another socket. The \fIs\fR socket is created with
-\fBsocket\fR(3SOCKET).
-.sp
-.LP
-If \fIfrom\fR is a non-\fBNULL\fR pointer, the source address of the message is
-filled in. The value-result parameter \fIfromlen\fR is initialized to the size
-of the buffer associated with \fIfrom\fR and modified on return to indicate the
-actual size of the address stored in the buffer. The length of the message is
-returned. If a message is too long to fit in the supplied buffer, excess bytes
-may be discarded depending on the type of socket from which the message is
-received. See \fBsocket\fR(3SOCKET).
-.sp
-.LP
-If no messages are available at the socket, the receive call waits for a
-message to arrive. If the socket is non-blocking, \fB-1\fR is returned with the
-external variable \fBerrno\fR set to \fBEWOULDBLOCK\fR. See \fBfcntl\fR(2).
-.sp
-.LP
-For processes on the same host, \fBrecvmsg()\fR can be used to receive a file
-descriptor from another process, but it cannot receive ancillary data. See
-\fBlibxnet\fR(3LIB).
-.sp
-.LP
-If a zero-length buffer is specified for a message, an EOF condition results
-that is indistinguishable from the successful transfer of a file descriptor.
-For that reason, one or more bytes of data should be provided when
-\fBrecvmsg()\fR passes a file descriptor.
-.sp
-.LP
-The \fBselect\fR(3C) call can be used to determine when more data arrives.
-.sp
-.LP
-The \fIflags\fR parameter is formed by an \fBOR\fR operation on one or more of
-the following:
-.sp
-.ne 2
-.na
-\fB\fBMSG_OOB\fR\fR
-.ad
-.RS 16n
-Read any \fBout-of-band\fR data present on the socket rather than the regular
-\fBin-band\fR data.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBMSG_PEEK\fR\fR
-.ad
-.RS 16n
-Peek at the data present on the socket. The data is returned, but not consumed
-to allow a subsequent receive operation to see the same data.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBMSG_WAITALL\fR\fR
-.ad
-.RS 16n
-Messages are blocked until the full amount of data requested is returned. The
-\fBrecv()\fR function can return a smaller amount of data if a signal is
-caught, the connection is terminated, \fBMSG_PEEK\fR is specified, or if an
-error is pending for the socket.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBMSG_DONTWAIT\fR\fR
-.ad
-.RS 16n
-Pending messages received on the connection are returned. If data is
-unavailable, the function does not block. This behavior is the equivalent to
-specifying \fBO_NONBLOCK\fR on the file descriptor of a socket, except that
-write requests are unaffected.
-.RE
-
-.sp
-.LP
-The \fBrecvmsg()\fR function call uses a \fBmsghdr\fR structure defined in
-<\fBsys/socket.h\fR> to minimize the number of directly supplied parameters.
-.SH RETURN VALUES
-.LP
-Upon successful completion, these functions return the number of bytes
-received. Otherwise, they return \fB-1\fR and set \fBerrno\fR to indicate the
-error.
-.SH ERRORS
-.LP
-The \fBrecv()\fR, \fBrecvfrom()\fR, and \fBrecvmsg()\fR functions return errors
-under the following conditions:
-.sp
-.ne 2
-.na
-\fB\fBEBADF\fR\fR
-.ad
-.RS 16n
-The \fIs\fR file descriptor is invalid.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBECONNRESET\fR\fR
-.ad
-.RS 16n
-The \fIs\fR argument refers to a connection oriented socket and the connection
-was forcibly closed by the peer and is no longer valid. I/O can no longer be
-performed to \fIfiledes\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBEINVAL\fR\fR
-.ad
-.RS 16n
-The \fBMSG_OOB\fR flag is set and no out-of-band data is available.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBEINTR\fR\fR
-.ad
-.RS 16n
-The operation is interrupted by the delivery of a signal before any data is
-available to be received.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBEIO\fR\fR
-.ad
-.RS 16n
-An I/O error occurs while reading from or writing to the file system.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBENOMEM\fR\fR
-.ad
-.RS 16n
-Insufficient user memory is available to complete operation.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBENOSR\fR\fR
-.ad
-.RS 16n
-Insufficient \fBSTREAMS\fR resources are available for the operation to
-complete.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBENOTSOCK\fR\fR
-.ad
-.RS 16n
-\fIs\fR is not a socket.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBESTALE\fR\fR
-.ad
-.RS 16n
-A stale NFS file handle exists.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBEWOULDBLOCK\fR\fR
-.ad
-.RS 16n
-The socket is marked non-blocking and the requested operation would block.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBECONNREFUSED\fR\fR
-.ad
-.RS 16n
-The requested connection was refused by the peer. For connected IPv4 and IPv6
-datagram sockets, this indicates that the system received an \fBICMP
-Destination Port Unreachable\fR message from the peer.
-.RE
-
-.sp
-.LP
-The \fBrecv()\fR and \fBrecvfrom()\fR functions fail under the following
-conditions:
-.sp
-.ne 2
-.na
-\fB\fBEINVAL\fR\fR
-.ad
-.RS 10n
-The \fIlen\fR argument overflows a \fBssize_t\fR.
-.RE
-
-.sp
-.LP
-The \fBrecvmsg()\fR function returns errors under the following conditions:
-.sp
-.ne 2
-.na
-\fB\fBEINVAL\fR\fR
-.ad
-.RS 10n
-The \fBmsg_iovlen\fR member of the \fBmsghdr\fR structure pointed to by
-\fImsg\fR is less than or equal to \fB0\fR, or greater than \fB[IOV_MAX}\fR.
-See \fBIntro\fR(2) for a definition of \fB[IOV_MAX}\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBEINVAL\fR\fR
-.ad
-.RS 10n
-One of the \fIiov_len\fR values in the \fBmsg_iov\fR array member of the
-\fBmsghdr\fR structure pointed to by \fImsg\fR is negative, or the sum of the
-\fIiov_len\fR values in the \fBmsg_iov\fR array overflows a \fBssize_t\fR.
-.RE
-
-.SH ATTRIBUTES
-.LP
-See \fBattributes\fR(5) for descriptions of the following attributes:
-.sp
-
-.sp
-.TS
-box;
-c | c
-l | l .
-ATTRIBUTE TYPE	ATTRIBUTE VALUE
-_
-Interface Stability	Committed
-_
-MT-Level	Safe
-.TE
-
-.SH SEE ALSO
-.LP
-\fBfcntl\fR(2), \fBioctl\fR(2), \fBread\fR(2), \fBconnect\fR(3SOCKET),
-\fBgetsockopt\fR(3SOCKET), \fBlibxnet\fR(3LIB), \fBselect\fR(3C),
-\fBsend\fR(3SOCKET), \fBsockaddr\fR(3SOCKET), \fBsocket\fR(3SOCKET),
-\fBsocket.h\fR(3HEAD), \fBattributes\fR(5)
--- old/usr/src/man/man3socket/send.3socket	Sun Aug  5 23:41:12 2018
+++ /dev/null	Sun Aug  5 23:41:10 2018
@@ -1,291 +0,0 @@
-'\" te
-.\" Copyright (C) 2009, Sun Microsystems, Inc. All Rights Reserved
-.\" Copyright 1989 AT&T
-.\" 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 SEND 3SOCKET "Jun 18, 2017"
-.SH NAME
-send, sendto, sendmsg \- send a message from a socket
-.SH SYNOPSIS
-.LP
-.nf
-\fBcc\fR [ \fIflag\fR... ] \fIfile\fR... \fB-lsocket\fR \fB -lnsl \fR [ \fIlibrary\fR... ]
-#include <sys/types.h>
-#include <sys/socket.h>
-
-\fBssize_t\fR \fBsend\fR(\fBint\fR \fIs\fR, \fBconst void *\fR\fImsg\fR, \fBsize_t\fR \fIlen\fR, \fBint\fR \fIflags\fR);
-.fi
-
-.LP
-.nf
-\fBssize_t\fR \fBsendto\fR(\fBint\fR \fIs\fR, \fBconst void *\fR\fImsg\fR, \fBsize_t\fR \fIlen\fR, \fBint\fR \fIflags\fR,
-     \fBconst struct sockaddr *\fR\fIto\fR, \fBint\fR  \fItolen\fR);
-.fi
-
-.LP
-.nf
-\fBssize_t\fR \fBsendmsg\fR(\fBint\fR \fIs\fR, \fBconst struct msghdr *\fR\fImsg\fR, \fBint\fR \fIflags\fR);
-.fi
-
-.SH DESCRIPTION
-.LP
-The \fBsend()\fR, \fBsendto()\fR, and \fBsendmsg()\fR functions are used to
-transmit a message to another transport end-point. The \fBsend()\fR function
-can be used only when the socket is in a connected state. See
-\fBconnect\fR(3SOCKET). The \fBsendto()\fR and \fBsendmsg()\fR functions can be
-used at any time. The \fIs\fR socket is created with \fBsocket\fR(3SOCKET).
-.sp
-.LP
-The address of the target is supplied by \fIto\fR with a \fItolen\fR parameter
-used to specify the size. The length of the message is supplied by the
-\fIlen\fR parameter. For socket types such as \fBSOCK_DGRAM\fR and
-\fBSOCK_RAW\fR that require atomic messages, the error \fBEMSGSIZE\fR is
-returned and the message is not transmitted when it is too long to pass
-atomically through the underlying protocol. The same restrictions do not apply
-to \fBSOCK_STREAM\fR sockets.
-.sp
-.LP
-A return value \fB\(mi1\fR indicates locally detected errors. It does not imply
-a delivery failure.
-.sp
-.LP
-If the socket does not have enough buffer space available to hold a message,
-the \fBsend()\fR function blocks the message, unless the socket has been placed
-in non-blocking I/O mode (see \fBfcntl\fR(2)). The \fBselect\fR(3C) or
-\fBpoll\fR(2) call can be used to determine when it is possible to send more
-data.
-.sp
-.LP
-The \fIflags\fR parameter is formed from the bitwise OR of zero or more of the
-following:
-.sp
-.ne 2
-.na
-\fB\fBMSG_OOB\fR\fR
-.ad
-.RS 17n
-Send \fBout-of-band\fR data on sockets that support this notion. The underlying
-protocol must also support \fBout-of-band\fR data. Only \fBSOCK_STREAM\fR
-sockets created in the \fBAF_INET\fR or the \fBAF_INET6\fR address family
-support out-of-band data.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBMSG_DONTROUTE\fR\fR
-.ad
-.RS 17n
-The \fBSO_DONTROUTE\fR option is turned on for the duration of the operation.
-It is used only by diagnostic or routing programs.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBMSG_NOSIGNAL\fR\fR
-.ad
-.RS 17n
-Don't generate the \fBSIGPIPE\fR signal when a stream-oriented socket is no
-longer connected.
-.RE
-
-.sp
-.LP
-See \fBrecv\fR(3SOCKET) for a description of the \fBmsghdr\fR structure.
-.SH RETURN VALUES
-.LP
-Upon successful completion, these functions return the number of bytes sent.
-Otherwise, they return \fB-1\fR and set \fBerrno\fR to indicate the error.
-.SH ERRORS
-.LP
-The \fBsend()\fR, \fBsendto()\fR, and \fBsendmsg()\fR functions return errors
-under the following conditions:
-.sp
-.ne 2
-.na
-\fB\fBEBADF\fR\fR
-.ad
-.RS 16n
-\fIs\fR is not a valid file descriptor.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBECONNRESET\fR\fR
-.ad
-.RS 16n
-The \fIs\fR argument refers to a connection oriented socket and the connection
-was forcibly closed by the peer and is no longer valid. I/O can no longer be
-performed to \fIfiledes\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBEINTR\fR\fR
-.ad
-.RS 16n
-The operation was interrupted by delivery of a signal before any data could be
-buffered to be sent.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBEMSGSIZE\fR\fR
-.ad
-.RS 16n
-The message is too large to be sent all at once (as the socket requires), or
-the \fImsg_iovlen\fR member of the \fBmsghdr\fR structure pointed to by message
-is less than or equal to 0 or is greater than {\fBIOV_MAX\fR}.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBENOMEM\fR\fR
-.ad
-.RS 16n
-Insufficient memory is available to complete the operation.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBENOSR\fR\fR
-.ad
-.RS 16n
-Insufficient STREAMS resources are available for the operation to complete.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBENOTSOCK\fR\fR
-.ad
-.RS 16n
-\fIs\fR is not a socket.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBEWOULDBLOCK\fR\fR
-.ad
-.RS 16n
-The socket is marked non-blocking and the requested operation would block.
-\fBEWOULDBLOCK\fR is also returned when sufficient memory is not immediately
-available to allocate a suitable buffer. In such a case, the operation can be
-retried later.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBECONNREFUSED\fR\fR
-.ad
-.RS 16n
-The requested connection was refused by the peer. For connected IPv4 and IPv6
-datagram sockets, this indicates that the system received an \fBICMP
-Destination Port Unreachable\fR message from the peer in response to some prior
-transmission.
-.RE
-
-.sp
-.LP
-The \fBsend()\fR and \fBsendto()\fR functions return errors under the following
-conditions:
-.sp
-.ne 2
-.na
-\fB\fBEINVAL\fR\fR
-.ad
-.RS 10n
-The \fIlen\fR argument overflows a \fBssize_t\fR.
-.sp
-Inconsistent port attributes for system call.
-.RE
-
-.sp
-.LP
-The \fBsendto()\fR function returns errors under the following conditions:
-.sp
-.ne 2
-.na
-\fB\fBEINVAL\fR\fR
-.ad
-.RS 10n
-The value specified for the \fItolen\fR parameter is not the size of a valid
-address for the specified address family.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBEISCON\fR\fR
-.ad
-.RS 10n
-A destination address was specified and the socket is already connected.
-.RE
-
-.sp
-.LP
-The \fBsendmsg()\fR function returns errors under the following conditions:
-.sp
-.ne 2
-.na
-\fB\fBEINVAL\fR\fR
-.ad
-.RS 10n
-The \fBmsg_iovlen\fR member of the \fBmsghdr\fR structure pointed to by
-\fImsg\fR is less than or equal to \fB0\fR, or the sum of the \fIiov_len\fR
-values in the \fBmsg_iov\fR array overflows a \fBssize_t\fR.
-.sp
-One of the \fIiov_len\fR values in the \fBmsg_iov\fR array member of the
-\fBmsghdr\fR structure pointed to by \fImsg\fR is negative, or the sum of the
-\fIiov_len\fR values in the \fBmsg_iov\fR array overflows a \fBssize_t\fR.
-.sp
-\fBmsg_iov\fR contents are inconsistent with port attributes.
-.RE
-
-.sp
-.LP
-The \fBsend()\fR function returns errors under the following conditions:
-.sp
-.ne 2
-.na
-\fB\fBEPIPE\fR\fR
-.ad
-.RS 9n
-The socket is shut down for writing, or the socket is connection-mode and is no
-longer connected. In the latter case, if the socket is of type
-\fBSOCK_STREAM\fR, the \fBSIGPIPE\fR signal is generated to the calling thread
-unless the \fBMSG_NOSIGNAL\fR flag is set.
-.RE
-
-.SH ATTRIBUTES
-.LP
-See \fBattributes\fR(5) for descriptions of the following attributes:
-.sp
-
-.sp
-.TS
-box;
-c | c
-l | l .
-ATTRIBUTE TYPE	ATTRIBUTE VALUE
-_
-Interface Stability	Committed
-_
-MT-Level	Safe
-.TE
-
-.SH SEE ALSO
-.LP
-\fBfcntl\fR(2), \fBpoll\fR(2), \fBwrite\fR(2), \fBconnect\fR(3SOCKET),
-\fBgetsockopt\fR(3SOCKET), \fBrecv\fR(3SOCKET), \fBselect\fR(3C),
-\fBsockaddr\fR(3SOCKET), \fBsocket\fR(3SOCKET), \fBsocket.h\fR(3HEAD),
-\fBattributes\fR(5)
--- old/usr/src/man/man3socket/shutdown.3socket	Sun Aug  5 23:41:12 2018
+++ /dev/null	Sun Aug  5 23:41:10 2018
@@ -1,107 +0,0 @@
-'\" te
-.\"  Copyright 1989 AT&T  Copyright (c) 2005,
-.\" Sun Microsystems, Inc.  All Rights Reserved
-.\" 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 SHUTDOWN 3SOCKET "Jan 31, 2005"
-.SH NAME
-shutdown \- shut down part of a full-duplex connection
-.SH SYNOPSIS
-.LP
-.nf
-\fBcc\fR [ \fIflag\fR... ] \fIfile\fR... \fB-lsocket\fR \fB -lnsl \fR [ \fIlibrary\fR... ]
-#include <sys/socket.h>
-
-\fBint\fR \fBshutdown\fR(\fBint\fR \fIs\fR, \fBint\fR \fIhow\fR);
-.fi
-
-.SH DESCRIPTION
-.sp
-.LP
-The \fBshutdown()\fR call shuts down all or part of a full-duplex connection on
-the socket associated with \fIs\fR. If \fIhow\fR is \fBSHUT_RD\fR, further
-receives are disallowed. If \fIhow\fR is \fBSHUT_WR\fR, further sends are
-disallowed. If \fIhow\fR is \fBSHUT_RDWR\fR, further sends and receives are
-disallowed.
-.sp
-.LP
-The \fIhow\fR values should be defined constants.
-.SH RETURN VALUES
-.sp
-.LP
-\fB0\fR is returned if the call succeeds.
-.sp
-.LP
-\fB\(mi1\fR is returned if the call fails.
-.SH ERRORS
-.sp
-.LP
-The call succeeds unless one of the following conditions exists:
-.sp
-.ne 2
-.na
-\fB\fBEBADF\fR\fR
-.ad
-.RS 12n
-The \fIs\fR value is not a valid file descriptor.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBENOMEM\fR\fR
-.ad
-.RS 12n
-Insufficient user memory is available for the operation to complete.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBENOSR\fR\fR
-.ad
-.RS 12n
-Insufficient \fBSTREAMS\fR resources are available for the operation to
-complete.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBENOTCONN\fR\fR
-.ad
-.RS 12n
-The specified socket is not connected.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBENOTSOCK\fR\fR
-.ad
-.RS 12n
-The \fIs\fR value is not a socket.
-.RE
-
-.SH ATTRIBUTES
-.sp
-.LP
-See \fBattributes\fR(5) for descriptions of the following attributes:
-.sp
-
-.sp
-.TS
-box;
-c | c
-l | l .
-ATTRIBUTE TYPE	ATTRIBUTE VALUE
-_
-MT-Level	Safe
-.TE
-
-.SH SEE ALSO
-.sp
-.LP
-\fBconnect\fR(3SOCKET), \fBsocket\fR(3SOCKET), \fBsocket.h\fR(3HEAD),
-\fBattributes\fR(5)
--- old/usr/src/man/man3socket/socket.3socket	Sun Aug  5 23:41:12 2018
+++ /dev/null	Sun Aug  5 23:41:10 2018
@@ -1,327 +0,0 @@
-'\" te
-.\" Copyright (C) 2009, Sun Microsystems, Inc. All Rights Reserved.
-.\" Copyright 1989 AT&T
-.\" Copyright (c) 2013, OmniTI Computer Consulting, Inc. All Rights Reserved.
-.\" 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 SOCKET 3SOCKET "Jan 28, 2009"
-.SH NAME
-socket \- create an endpoint for communication
-.SH SYNOPSIS
-.LP
-.nf
-\fBcc\fR [ \fIflag\fR ... ] \fIfile\fR ... \fB-lsocket\fR \fB -lnsl \fR [ \fIlibrary\fR ... ]
-#include <sys/types.h>
-#include <sys/socket.h>
-
-\fBint\fR \fBsocket\fR(\fBint\fR \fIdomain\fR, \fBint\fR \fItype\fR, \fBint\fR \fIprotocol\fR);
-.fi
-
-.SH DESCRIPTION
-.sp
-.LP
-The \fBsocket()\fR function creates an endpoint for communication and returns a
-descriptor.
-.sp
-.LP
-The \fIdomain\fR argument specifies the protocol family within which
-communication takes place. The protocol family is generally the same as the
-address family for the addresses supplied in later operations on the socket.
-These families are defined in \fB<sys/socket.h>\fR.
-.sp
-.LP
-The currently supported protocol families are:
-.sp
-.ne 2
-.na
-\fB\fBPF_UNIX\fR\fR
-.ad
-.RS 12n
-\fBUNIX\fR system internal protocols
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBPF_INET\fR\fR
-.ad
-.RS 12n
-Internet Protocol Version 4 (IPv4)
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBPF_INET6\fR\fR
-.ad
-.RS 12n
-Internet Protocol Version 6 (IPv6)
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBPF_NCA\fR\fR
-.ad
-.RS 12n
-Network Cache and Accelerator (NCA) protocols
-.RE
-
-.sp
-.LP
-The socket has the indicated \fItype\fR, which specifies the communication
-semantics. Currently defined types are:
-.sp
-.in +2
-.nf
-SOCK_STREAM
-SOCK_DGRAM
-SOCK_RAW
-SOCK_SEQPACKET
-SOCK_RDM
-.fi
-.in -2
-
-.sp
-.LP
-The \fItype\fR may be augmented by a bitwise-inclusive-OR of flags from the
-following list, defined in <sys/socket.h>.
-
-.sp
-.ne 2
-.na
-\fB\fBSOCK_CLOEXEC\fR\fR
-.ad
-.RS 12n
-Creates the socket with the \fBFD_CLOEXEC\fR flag set, causing the underlying
-file descriptor to be closed prior to any future calls to \fBexec\fR(2). This
-is similar in purpose to the \fBO_CLOEXEC\fR flag to \fBopen\fR(2).
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBSOCK_NDELAY\fR\fR
-.ad
-.RS 12n
-Creates the socket with the \fBO_NDELAY\fR flag set, causing the socket to
-provide nonblocking semantics as described for \fBO_NDELAY\fR in \fBopen\fR(2).
-\fBSOCK_NONBLOCK\fR should normally be used in preference to \fBSOCK_NDELAY\fR,
-and takes precedence if both are set.  See \fBopen\fR(2) for further details.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBSOCK_NONBLOCK\fR\fR
-.ad
-.RS 12n
-Creates the socket with the \fBO_NONBLOCK\fR flag set, causing the socket to
-provide nonblocking semantics as described for \fBO_NONBLOCK\fR in \fBopen\fR(2).
-.RE
-
-.sp
-.LP
-There must be an entry in the \fBnetconfig\fR(4) file for at least each
-protocol family and type required. If  a non-zero protocol has been specified
-but no exact match for the protocol family, type, and protocol is found, then
-the first entry containing the specified family and type with a \fIprotocol\fR
-value of zero will be used.
-.sp
-.LP
-A \fBSOCK_STREAM\fR type provides sequenced, reliable, two-way connection-based
-byte streams. An out-of-band data transmission mechanism may be supported. A
-\fBSOCK_DGRAM\fR socket supports datagrams (connectionless, unreliable messages
-of a fixed (typically small) maximum length). A \fBSOCK_SEQPACKET\fR socket may
-provide a sequenced, reliable, two-way connection-based data transmission path
-for datagrams of fixed maximum length; a consumer may be required to read an
-entire packet with each read system call. This facility is protocol specific,
-and presently not implemented for any protocol family. \fBSOCK_RAW\fR sockets
-provide access to internal network interfaces. The types \fBSOCK_RAW\fR, which
-is available only to a user with the \fBnet_rawaccess\fR privilege, and
-\fBSOCK_RDM\fR, for which no implementation currently exists, are not described
-here.
-.sp
-.LP
-The \fIprotocol\fR parameter is a protocol-family-specific value which
-specifies a particular protocol to be used with the socket.  Normally this
-value is zero, as commonly only a single protocol exists to support a
-particular socket type within a given protocol family. However, multiple
-protocols may exist, in which case a particular protocol may be specified in
-this manner.
-.sp
-.LP
-Sockets of type \fBSOCK_STREAM\fR are full-duplex byte streams, similar to
-pipes. A stream socket must be in a \fIconnected\fR state before any data may
-be sent or received on it. A connection to another socket is created with a
-\fBconnect\fR(3SOCKET) call. Once connected, data may be transferred using
-\fBread\fR(2) and \fBwrite\fR(2) calls or some variant of the
-\fBsend\fR(3SOCKET) and \fBrecv\fR(3SOCKET) calls. When a session has been
-completed, a \fBclose\fR(2) may be performed. Out-of-band data may also be
-transmitted as described on the \fBsend\fR(3SOCKET) manual page and received as
-described on the \fBrecv\fR(3SOCKET) manual page.
-.sp
-.LP
-The communications protocols used to implement a \fBSOCK_STREAM\fR insure that
-data is not lost or duplicated.  If a piece of data for which the peer protocol
-has buffer space cannot be successfully transmitted within a reasonable length
-of time, then the connection is considered broken and calls will indicate an
-error with \(mi1 returns and with \fBETIMEDOUT\fR as the specific code in the
-global variable \fBerrno\fR. The protocols optionally keep sockets "warm" by
-forcing transmissions roughly every minute in the absence of other activity. An
-error is then indicated if no response can be elicited on an otherwise idle
-connection for a extended period (for instance 5 minutes). A \fBSIGPIPE\fR
-signal is raised if a thread sends on a broken stream; this causes naive
-processes, which do not handle the signal, to exit.
-.sp
-.LP
-\fBSOCK_SEQPACKET\fR sockets employ the same system calls as \fBSOCK_STREAM\fR
-sockets. The only difference is that  \fBread\fR(2) calls will return only the
-amount of data requested, and any remaining in the arriving packet will be
-discarded.
-.sp
-.LP
-\fBSOCK_DGRAM\fR and \fBSOCK_RAW\fR sockets allow datagrams to be sent to
-correspondents named in \fBsendto\fR(3SOCKET) calls. Datagrams are generally
-received with \fBrecvfrom\fR(3SOCKET), which returns the next datagram with its
-return address.
-.sp
-.LP
-An \fBfcntl\fR(2) call can be used to specify a process group to receive a
-\fBSIGURG\fR signal when the out-of-band data arrives. It can also enable
-non-blocking I/O.
-.sp
-.LP
-The operation of sockets is controlled by socket level \fIoptions\fR. These
-options are defined in the file <\fBsys/socket.h\fR>. \fBsetsockopt\fR(3SOCKET)
-and \fBgetsockopt\fR(3SOCKET) are used to set and get options, respectively.
-.SH RETURN VALUES
-.sp
-.LP
-Upon successful completion, a descriptor referencing the socket is returned.
-Otherwise, -1 is returned and \fBerrno\fR is set to indicate the error.
-.SH ERRORS
-.sp
-.LP
-The \fBsocket()\fR function will fail if:
-.sp
-.ne 2
-.na
-\fB\fBEACCES\fR\fR
-.ad
-.RS 19n
-Permission to create a socket of the specified type or protocol is denied.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBEAGAIN\fR\fR
-.ad
-.RS 19n
-There were insufficient resources available to complete the operation.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBEAFNOSUPPORT\fR\fR
-.ad
-.RS 19n
-The specified address family is not supported by the protocol family.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBEMFILE\fR\fR
-.ad
-.RS 19n
-The per-process descriptor table is full.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBENOMEM\fR\fR
-.ad
-.RS 19n
-Insufficient user memory is available.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBENOSR\fR\fR
-.ad
-.RS 19n
-There were insufficient STREAMS resources available to complete the operation.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBEPFNOSUPPORT\fR\fR
-.ad
-.RS 19n
-The specified protocol family is not supported.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBEPROTONOSUPPORT\fR\fR
-.ad
-.RS 19n
-The protocol type is not supported by the address family.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBEPROTOTYPE\fR\fR
-.ad
-.RS 19n
-The socket type is not supported by the protocol.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBEINVAL\fR\fR
-.ad
-.RS 19n
-One or more of the specified flags is not supported.
-.RE
-
-.SH ATTRIBUTES
-.sp
-.LP
-See \fBattributes\fR(5) for descriptions of the following attributes:
-.sp
-
-.sp
-.TS
-box;
-c | c
-l | l .
-ATTRIBUTE TYPE	ATTRIBUTE VALUE
-_
-MT-Level	Safe
-.TE
-
-.SH SEE ALSO
-.sp
-.LP
-\fBnca\fR(1), \fBclose\fR(2), \fBfcntl\fR(2), \fBioctl\fR(2), \fBread\fR(2),
-\fBwrite\fR(2), \fBaccept\fR(3SOCKET), \fBbind\fR(3SOCKET), \fBexec\fR(2),
-\fBconnect\fR(3SOCKET), \fBgetsockname\fR(3SOCKET), \fBgetsockopt\fR(3SOCKET),
-\fBin.h\fR(3HEAD), \fBlisten\fR(3SOCKET), \fBrecv\fR(3SOCKET), \fBopen\fR(2),
-\fBsetsockopt\fR(3SOCKET), \fBsend\fR(3SOCKET), \fBshutdown\fR(3SOCKET),
-\fBsocket.h\fR(3HEAD), \fBsocketpair\fR(3SOCKET), \fBattributes\fR(5)
-.SH NOTES
-.sp
-.LP
-Historically, \fBAF_\fR* was commonly used in places where \fBPF_\fR* was
-meant. New code should be careful to use \fBPF_\fR* as necessary.
--- old/usr/src/man/man3socket/socketpair.3socket	Sun Aug  5 23:41:12 2018
+++ /dev/null	Sun Aug  5 23:41:10 2018
@@ -1,123 +0,0 @@
-'\" te
-.\" Copyright 1989 AT&T
-.\" Copyright (C) 2002, Sun Microsystems, Inc. All Rights Reserved
-.\" 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 SOCKETPAIR 3SOCKET "Jan 10, 2001"
-.SH NAME
-socketpair \- create a pair of connected sockets
-.SH SYNOPSIS
-.LP
-.nf
-\fBcc\fR [ \fIflag\fR ... ] \fIfile\fR ... \fB-lsocket\fR \fB -lnsl \fR [ \fIlibrary\fR ... ]
-#include <sys/types.h>
-#include <sys/socket.h>
-
-\fBint\fR \fBsocketpair\fR(\fBint\fR \fIdomain\fR, \fBint\fR \fItype\fR, \fBint\fR \fIprotocol\fR, \fBint\fR \fIsv\fR[2]);
-.fi
-
-.SH DESCRIPTION
-.sp
-.LP
-The \fBsocketpair()\fR library call creates an unnamed pair of connected
-sockets in the specified address family \fIdomain\fR, of the specified
-\fItype\fR, that uses the optionally specified \fIprotocol\fR. The descriptors
-that are used in referencing the new sockets are returned in \fIsv\fR[0] and
-\fIsv\fR[1]. The two sockets are indistinguishable.
-.SH RETURN VALUES
-.sp
-.LP
-\fBsocketpair()\fR returns \fB\(mi1\fR on failure and \fB0\fR on success.
-.SH ERRORS
-.sp
-.LP
-The call succeeds unless:
-.sp
-.ne 2
-.na
-\fB\fBEAFNOSUPPORT\fR\fR
-.ad
-.RS 19n
-The specified address family is not supported on this machine.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBEMFILE\fR\fR
-.ad
-.RS 19n
-Too many descriptors are in use by this process.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBENOMEM\fR\fR
-.ad
-.RS 19n
-There was insufficient user memory for the operation to complete.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBENOSR\fR\fR
-.ad
-.RS 19n
-There were insufficient \fBSTREAMS\fR resources for the operation to complete.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBEOPNOTSUPP\fR\fR
-.ad
-.RS 19n
-The specified protocol does not support creation of socket pairs.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBEPROTONOSUPPORT\fR\fR
-.ad
-.RS 19n
-The specified protocol is not supported on this machine.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBEACCES\fR\fR
-.ad
-.RS 19n
-The process does not have appropriate privileges.
-.RE
-
-.SH ATTRIBUTES
-.sp
-.LP
-See \fBattributes\fR(5) for descriptions of the following attributes:
-.sp
-
-.sp
-.TS
-box;
-c | c
-l | l .
-ATTRIBUTE TYPE	ATTRIBUTE VALUE
-_
-MT-Level	Safe
-.TE
-
-.SH SEE ALSO
-.sp
-.LP
-\fBpipe\fR(2), \fBread\fR(2), \fBwrite\fR(2), \fBsocket.h\fR(3HEAD),
-\fBattributes\fR(5)
-.SH NOTES
-.sp
-.LP
-This call is currently implemented only for the \fBAF_UNIX\fR address family.
--- old/usr/src/pkg/manifests/system-library.man3c.inc	Sun Aug  5 23:41:12 2018
+++ new/usr/src/pkg/manifests/system-library.man3c.inc	Sun Aug  5 23:41:12 2018
@@ -22,6 +22,7 @@
 file path=usr/share/man/man3c/a64l.3c
 file path=usr/share/man/man3c/abort.3c
 file path=usr/share/man/man3c/abs.3c
+file path=usr/share/man/man3c/accept.3c
 file path=usr/share/man/man3c/addsev.3c
 file path=usr/share/man/man3c/addseverity.3c
 file path=usr/share/man/man3c/aio_cancel.3c
@@ -50,6 +51,7 @@
 file path=usr/share/man/man3c/atomic_swap.3c
 file path=usr/share/man/man3c/attropen.3c
 file path=usr/share/man/man3c/basename.3c
+file path=usr/share/man/man3c/bind.3c
 file path=usr/share/man/man3c/bsd_signal.3c
 file path=usr/share/man/man3c/bsearch.3c
 file path=usr/share/man/man3c/bstring.3c
@@ -68,6 +70,7 @@
 file path=usr/share/man/man3c/cnd.3c
 file path=usr/share/man/man3c/cond_init.3c
 file path=usr/share/man/man3c/confstr.3c
+file path=usr/share/man/man3c/connect.3c
 file path=usr/share/man/man3c/crypt.3c
 file path=usr/share/man/man3c/crypt_genhash_impl.3c
 file path=usr/share/man/man3c/crypt_gensalt.3c
@@ -174,6 +177,7 @@
 file path=usr/share/man/man3c/getpagesize.3c
 file path=usr/share/man/man3c/getpagesizes.3c
 file path=usr/share/man/man3c/getpass.3c
+file path=usr/share/man/man3c/getpeername.3c
 file path=usr/share/man/man3c/getpeerucred.3c
 file path=usr/share/man/man3c/getpriority.3c
 file path=usr/share/man/man3c/getprogname.3c
@@ -181,6 +185,8 @@
 file path=usr/share/man/man3c/getpwnam.3c
 file path=usr/share/man/man3c/getrusage.3c
 file path=usr/share/man/man3c/gets.3c
+file path=usr/share/man/man3c/getsockname.3c
+file path=usr/share/man/man3c/getsockopt.3c
 file path=usr/share/man/man3c/getspnam.3c
 file path=usr/share/man/man3c/getsubopt.3c
 file path=usr/share/man/man3c/gettext.3c
@@ -219,6 +225,7 @@
 file path=usr/share/man/man3c/lckpwdf.3c
 file path=usr/share/man/man3c/lfmt.3c
 file path=usr/share/man/man3c/lio_listio.3c
+file path=usr/share/man/man3c/listen.3c
 file path=usr/share/man/man3c/localeconv.3c
 file path=usr/share/man/man3c/lockf.3c
 file path=usr/share/man/man3c/lsearch.3c
@@ -376,6 +383,7 @@
 file path=usr/share/man/man3c/readdir.3c
 file path=usr/share/man/man3c/realpath.3c
 file path=usr/share/man/man3c/reboot.3c
+file path=usr/share/man/man3c/recv.3c
 file path=usr/share/man/man3c/regcmp.3c
 file path=usr/share/man/man3c/regcomp.3c
 file path=usr/share/man/man3c/remove.3c
@@ -404,6 +412,7 @@
 file path=usr/share/man/man3c/sem_unlink.3c
 file path=usr/share/man/man3c/sem_wait.3c
 file path=usr/share/man/man3c/semaphore.3c
+file path=usr/share/man/man3c/send.3c
 file path=usr/share/man/man3c/setbuf.3c
 file path=usr/share/man/man3c/setbuffer.3c
 file path=usr/share/man/man3c/setcat.3c
@@ -414,6 +423,7 @@
 file path=usr/share/man/man3c/setlocale.3c
 file path=usr/share/man/man3c/shm_open.3c
 file path=usr/share/man/man3c/shm_unlink.3c
+file path=usr/share/man/man3c/shutdown.3c
 file path=usr/share/man/man3c/sigfpe.3c
 file path=usr/share/man/man3c/siginterrupt.3c
 file path=usr/share/man/man3c/signal.3c
@@ -424,6 +434,9 @@
 file path=usr/share/man/man3c/sigwaitinfo.3c
 file path=usr/share/man/man3c/sleep.3c
 file path=usr/share/man/man3c/smt_pause.3c
+file path=usr/share/man/man3c/sockaddr.3c
+file path=usr/share/man/man3c/socket.3c
+file path=usr/share/man/man3c/socketpair.3c
 file path=usr/share/man/man3c/ssignal.3c
 file path=usr/share/man/man3c/stack_getbounds.3c
 file path=usr/share/man/man3c/stack_inbounds.3c
@@ -572,6 +585,7 @@
 link path=usr/share/man/man3c/_exithandle.3c target=exit.3c
 link path=usr/share/man/man3c/_flushlbf.3c target=__fbufsize.3c
 link path=usr/share/man/man3c/_setjmp.3c target=_longjmp.3c
+link path=usr/share/man/man3c/accept4.3c target=accept.3c
 link path=usr/share/man/man3c/addrtosymstr.3c target=walkcontext.3c
 link path=usr/share/man/man3c/aiowrite.3c target=aioread.3c
 link path=usr/share/man/man3c/alloca.3c target=malloc.3c
@@ -1218,6 +1232,8 @@
 link path=usr/share/man/man3c/realloc.3c target=malloc.3c
 link path=usr/share/man/man3c/reallocarray.3c target=malloc.3c
 link path=usr/share/man/man3c/recallocarray.3c target=malloc.3c
+link path=usr/share/man/man3c/recvfrom.3c target=recv.3c
+link path=usr/share/man/man3c/recvmsg.3c target=recv.3c
 link path=usr/share/man/man3c/regerror.3c target=regcomp.3c
 link path=usr/share/man/man3c/regex.3c target=regcmp.3c
 link path=usr/share/man/man3c/regexec.3c target=regcomp.3c
@@ -1247,6 +1263,8 @@
 link path=usr/share/man/man3c/sema_post.3c target=semaphore.3c
 link path=usr/share/man/man3c/sema_trywait.3c target=semaphore.3c
 link path=usr/share/man/man3c/sema_wait.3c target=semaphore.3c
+link path=usr/share/man/man3c/sendmsg.3c target=send.3c
+link path=usr/share/man/man3c/sendto.3c target=send.3c
 link path=usr/share/man/man3c/setattrat.3c target=fgetattr.3c
 link path=usr/share/man/man3c/setgrent.3c target=getgrnam.3c
 link path=usr/share/man/man3c/sethostname.3c target=gethostname.3c
@@ -1256,6 +1274,7 @@
 link path=usr/share/man/man3c/setpriority.3c target=getpriority.3c
 link path=usr/share/man/man3c/setprogname.3c target=getprogname.3c
 link path=usr/share/man/man3c/setpwent.3c target=getpwnam.3c
+link path=usr/share/man/man3c/setsockopt.3c target=getsockopt.3c
 link path=usr/share/man/man3c/setspent.3c target=getspnam.3c
 link path=usr/share/man/man3c/setstate.3c target=random.3c
 link path=usr/share/man/man3c/settimeofday.3c target=gettimeofday.3c
@@ -1282,6 +1301,12 @@
 link path=usr/share/man/man3c/single_to_decimal.3c \
     target=floating_to_decimal.3c
 link path=usr/share/man/man3c/snprintf.3c target=printf.3c
+link path=usr/share/man/man3c/sockaddr_dl.3c target=sockaddr.3c
+link path=usr/share/man/man3c/sockaddr_in.3c target=sockaddr.3c
+link path=usr/share/man/man3c/sockaddr_in6.3c target=sockaddr.3c
+link path=usr/share/man/man3c/sockaddr_ll.3c target=sockaddr.3c
+link path=usr/share/man/man3c/sockaddr_storage.3c target=sockaddr.3c
+link path=usr/share/man/man3c/sockaddr_un.3c target=sockaddr.3c
 link path=usr/share/man/man3c/sprintf.3c target=printf.3c
 link path=usr/share/man/man3c/srand.3c target=rand.3c
 link path=usr/share/man/man3c/srand48.3c target=drand48.3c
--- old/usr/src/pkg/manifests/system-library.man3socket.inc	Sun Aug  5 23:41:12 2018
+++ new/usr/src/pkg/manifests/system-library.man3socket.inc	Sun Aug  5 23:41:12 2018
@@ -15,28 +15,20 @@
 # Copyright 2013, OmniTI Computer Consulting, Inc.
 #
 
-file path=usr/share/man/man3socket/accept.3socket
-file path=usr/share/man/man3socket/bind.3socket
 file path=usr/share/man/man3socket/byteorder.3socket
-file path=usr/share/man/man3socket/connect.3socket
 file path=usr/share/man/man3socket/ethers.3socket
 file path=usr/share/man/man3socket/getaddrinfo.3socket
 file path=usr/share/man/man3socket/getifaddrs.3socket
 file path=usr/share/man/man3socket/getipnodebyname.3socket
 file path=usr/share/man/man3socket/getnetbyname.3socket
-file path=usr/share/man/man3socket/getpeername.3socket
 file path=usr/share/man/man3socket/getprotobyname.3socket
 file path=usr/share/man/man3socket/getservbyname.3socket
-file path=usr/share/man/man3socket/getsockname.3socket
-file path=usr/share/man/man3socket/getsockopt.3socket
 file path=usr/share/man/man3socket/getsourcefilter.3socket
 file path=usr/share/man/man3socket/icmp6_filter.3socket
 file path=usr/share/man/man3socket/if_nametoindex.3socket
 file path=usr/share/man/man3socket/inet6_opt.3socket
 file path=usr/share/man/man3socket/inet6_rth.3socket
-file path=usr/share/man/man3socket/listen.3socket
 file path=usr/share/man/man3socket/rcmd.3socket
-file path=usr/share/man/man3socket/recv.3socket
 file path=usr/share/man/man3socket/rexec.3socket
 file path=usr/share/man/man3socket/sctp_bindx.3socket
 file path=usr/share/man/man3socket/sctp_getladdrs.3socket
@@ -46,13 +38,7 @@
 file path=usr/share/man/man3socket/sctp_recvmsg.3socket
 file path=usr/share/man/man3socket/sctp_send.3socket
 file path=usr/share/man/man3socket/sctp_sendmsg.3socket
-file path=usr/share/man/man3socket/send.3socket
-file path=usr/share/man/man3socket/shutdown.3socket
-file path=usr/share/man/man3socket/sockaddr.3socket
-file path=usr/share/man/man3socket/socket.3socket
-file path=usr/share/man/man3socket/socketpair.3socket
 file path=usr/share/man/man3socket/spray.3socket
-link path=usr/share/man/man3socket/accept4.3socket target=accept.3socket
 link path=usr/share/man/man3socket/endnetent.3socket \
     target=getnetbyname.3socket
 link path=usr/share/man/man3socket/endprotoent.3socket \
@@ -149,8 +135,6 @@
 link path=usr/share/man/man3socket/ntohll.3socket target=byteorder.3socket
 link path=usr/share/man/man3socket/ntohs.3socket target=byteorder.3socket
 link path=usr/share/man/man3socket/rcmd_af.3socket target=rcmd.3socket
-link path=usr/share/man/man3socket/recvfrom.3socket target=recv.3socket
-link path=usr/share/man/man3socket/recvmsg.3socket target=recv.3socket
 link path=usr/share/man/man3socket/rexec_af.3socket target=rexec.3socket
 link path=usr/share/man/man3socket/rresvport.3socket target=rcmd.3socket
 link path=usr/share/man/man3socket/rresvport_af.3socket target=rcmd.3socket
@@ -159,8 +143,6 @@
     target=sctp_getladdrs.3socket
 link path=usr/share/man/man3socket/sctp_freepaddrs.3socket \
     target=sctp_getpaddrs.3socket
-link path=usr/share/man/man3socket/sendmsg.3socket target=send.3socket
-link path=usr/share/man/man3socket/sendto.3socket target=send.3socket
 link path=usr/share/man/man3socket/setipv4sourcefilter.3socket \
     target=getsourcefilter.3socket
 link path=usr/share/man/man3socket/setnetent.3socket \
@@ -169,15 +151,5 @@
     target=getprotobyname.3socket
 link path=usr/share/man/man3socket/setservent.3socket \
     target=getservbyname.3socket
-link path=usr/share/man/man3socket/setsockopt.3socket \
-    target=getsockopt.3socket
 link path=usr/share/man/man3socket/setsourcefilter.3socket \
     target=getsourcefilter.3socket
-link path=usr/share/man/man3socket/sockaddr_dl.3socket target=sockaddr.3socket
-link path=usr/share/man/man3socket/sockaddr_in.3socket target=sockaddr.3socket
-link path=usr/share/man/man3socket/sockaddr_in6.3socket \
-    target=sockaddr.3socket
-link path=usr/share/man/man3socket/sockaddr_ll.3socket target=sockaddr.3socket
-link path=usr/share/man/man3socket/sockaddr_storage.3socket \
-    target=sockaddr.3socket
-link path=usr/share/man/man3socket/sockaddr_un.3socket target=sockaddr.3socket
