--- /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
