Open System Services System Calls Reference Manual (G06.25+, H06.03+)
sendmsg(2) OSS System Calls Reference Manual
fails and sets errno to [EWOULDBLOCK].
In the msghdr structure, the msg_control and msg_controllen members specify the ancillary
data buffer that can be used only by sockets in the AF_UNIX domain to pass file descriptors to
another process on the same node. The msg_control member can be a null pointer if ancillary
data is not desired or required. If the msg_control member is nonnull, it points to an ancillary
data buffer consisting of a cmsghdr structure followed by one to sixteen file descriptors. The
msg_controllen member specifies the size of the ancillary data buffer.
If sendmsg() is called with an ancillary data buffer, the members of the cmsghdr structure must
be set as follows:
• The cmsg_level member must be set to SOL_SOCKET.
• The cmsg_type member must be set to SCM_RIGHTS.
• The value of the cmsg_len member must be equal to the value of the msg_controllen
member of the msghdr structure.
NOTES
When data can be sent, a call to the select() function indicates that the file descriptor for the
socket is ready for writing.
RETURN VALUES
Upon successful completion, the sendmsg() function returns the number of normal bytes sent.
Ancillary data, if present, is not counted in the total number of bytes sent.
If the sendmsg() function call fails, the value -1 is returned, and errno is set to indicate the error.
ERRORS
If any of these conditions occurs, the sendmsg() function sets errno to the corresponding value:
[EACCES] The socket is in the AF_UNIX domain and either search permission is denied for
a component of the pathname in the msghdr structure or write access to the
specified socket is denied.
[EAFNOSUPPORT]
Addresses in the specified address family cannot be used with this socket.
[EBADF] One of these conditions exists:
• The socket parameter is not a valid file descriptor.
• The socket is in the AF_UNIX domain, and one or more of the file
descriptors being passed is invalid.
[ECONNRESET]
One of these conditions occurred:
• The transport-provider process for this socket is no longer available.
• The TCP/IP subsystem for this socket is no longer available.
• The connection was forcibly closed by the peer socket.
The socket can only be closed.
7−26 Hewlett-Packard Company 527186-003