diff --git a/man7/unix.7 b/man7/unix.7 index 905d5bc2f..38e00c6c8 100644 --- a/man7/unix.7 +++ b/man7/unix.7 @@ -455,6 +455,33 @@ 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 +When receiving from a stream socket, +ancillary data forms a kind of barrier for the received data. +For example, suppose that the sender transmits as follows: +.PP +.RS +.PD 0 +.IP 1. 3 +.BR sendmsg (2) +of four bytes, with no ancillary data. +.IP 2. +.BR sendmsg (2) +of one byte, with ancillary data. +.IP 3. +.BR sendmsg (2) +of four bytes, with no ancillary data. +.PD +.RE +.PP +Suppose that the receiver now performs +.BR recvmsg (2) +calls each with a buffer size of 20 bytes. +The first call will receive five bytes of data, +along with the ancillary data sent by the second +.BR sendmsg (2) +call. +The next call will receive the remaining five bytes of data. +.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