send.2: Add details on various 'msghdr' fields

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
This commit is contained in:
Michael Kerrisk 2014-05-03 11:19:01 +02:00
parent 85b1cf3cdc
commit 7784c37d7c
1 changed files with 25 additions and 6 deletions

View File

@ -239,10 +239,9 @@ data.
.SS sendmsg()
The definition of the
.I msghdr
structure follows.
See
.BR recv (2)
and below for an exact description of its fields.
structure employed by
.BR sendmsg ()
is as follows:
.in +4n
.nf
@ -253,11 +252,28 @@ struct msghdr {
size_t msg_iovlen; /* # elements in msg_iov */
void *msg_control; /* ancillary data, see below */
size_t msg_controllen; /* ancillary data buffer len */
int msg_flags; /* flags on received message */
int msg_flags; /* flags (unused) */
};
.fi
.in
.PP
The
.I msg_name
field is used on an unconnected socket to specify the target
address for a datagram.
It points to a buffer containing the address; the
.I msg_name
field should be set to the size of the address.
For a connected socket, these fields should be specified as NULL and 0,
respectively.
The
.I msg_iov
and
.I msg_iovlen
fields specify scatter-gather locations, as for
.BR writev (2).
You may send control information using the
.I msg_control
and
@ -268,10 +284,13 @@ per socket by the value in
.IR /proc/sys/net/core/optmem_max ;
see
.BR socket (7).
The
.I msg_flags
field is ignored.
.\" Still to be documented:
.\" Send file descriptors and user credentials using the
.\" msg_control* fields.
.\" The flags returned in msg_flags.
.SH RETURN VALUE
On success, these calls return the number of bytes sent.
On error, \-1 is returned, and