recv.2, send.2: Explain some subtleties of MSG_DONTWAIT versus O_NONBLOCK

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
This commit is contained in:
Michael Kerrisk 2015-05-13 09:15:25 +02:00
parent b6c261c4db
commit 630b4cac33
2 changed files with 26 additions and 7 deletions

View File

@ -109,12 +109,21 @@ flag of
.BR MSG_DONTWAIT " (since Linux 2.2)"
Enables nonblocking operation; if the operation would block,
the call fails with the error
.BR EAGAIN " or " EWOULDBLOCK
(this can also be enabled using the
.BR EAGAIN " or " EWOULDBLOCK .
This provides similar behavior to setting the
.B O_NONBLOCK
flag with the
flag (via the
.BR fcntl (2)
.B F_SETFL
.BR fcntl (2)).
operation), but differs in that
.B MSG_DONTWAIT
is a per-call option, whereas
.B O_NONBLOCK
is a setting on the open file description (see
.BR open (2)),
which will affect all threads in the calling process
and as well as other processes that hold file descriptors
referring to the same open file description.
.TP
.BR MSG_ERRQUEUE " (since Linux 2.2)"
This flag

View File

@ -191,11 +191,21 @@ Enables nonblocking operation; if the operation would block,
.B EAGAIN
or
.B EWOULDBLOCK
is returned (this can also be enabled using the
is returned.
This provides similar behavior to setting the
.B O_NONBLOCK
flag with the
flag (via the
.BR fcntl (2)
.B F_SETFL
.BR fcntl (2)).
operation), but differs in that
.B MSG_DONTWAIT
is a per-call option, whereas
.B O_NONBLOCK
is a setting on the open file description (see
.BR open (2)),
which will affect all threads in the calling process
and as well as other processes that hold file descriptors
referring to the same open file description.
.TP
.BR MSG_EOR " (since Linux 2.2)"
Terminates a record (when this notion is supported, as for sockets of type