unix.7: One must send at least one byte of real data with ancillary data

When sending ancillary data, at least one byte of real data should
also be sent.  This is strictly necessary for stream sockets
(verified by experiment). It is not required for datagram sockets
on Linux (verified by experiment), but portable applications
should do so.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
This commit is contained in:
Michael Kerrisk 2018-07-15 10:30:11 +02:00
parent c0e56ed687
commit 5219daec26
1 changed files with 8 additions and 0 deletions

View File

@ -447,6 +447,14 @@ When sending ancillary data with
.BR sendmsg (2),
only one item of each of the above types may be included in the sent message.
.PP
At least one byte of real data should be sent when sending ancillary data.
On Linux, this is required to successfully send ancillary data over
a UNIX domain stream socket.
When sending ancillary data over a UNIX domain datagram socket,
it is not necessary on Linux to send any accompanying real data.
However, portable applications should also include at least one byte
of real data when sending ancillary data over a datagram socket.
.PP
If the space allocated for receiving incoming ancillary data is too small
then the ancillary data is truncated to the number of headers
that will fit in the supplied buffer (or, in the case of an