Skip to content

Commit 5b0b047

Browse files
committed
Document MsgFlags constants
1 parent 5680f1b commit 5b0b047

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

src/sys/socket/mod.rs

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,14 +72,51 @@ bitflags!(
7272
// Flags for send/recv and their relatives
7373
libc_bitflags!{
7474
pub flags MsgFlags: libc::c_int {
75+
/// Sends or requests out-of-band data on sockets that support this notion
76+
/// (e.g., of type [`Stream`](enum.SockType.html)); the underlying protocol must also
77+
/// support out-of-band data.
7578
MSG_OOB,
79+
/// Peeks at an incoming message. The data is treated as unread and the next
80+
/// [`recv()`](fn.recv.html)
81+
/// or similar function shall still return this data.
7682
MSG_PEEK,
83+
/// Enables nonblocking operation; if the operation would block,
84+
/// `EAGAIN` or `EWOULDBLOCK` is returned. This provides similar
85+
/// behavior to setting the `O_NONBLOCK` flag
86+
/// (via the [`fcntl`](../../fcntl/fn.fcntl.html)
87+
/// `F_SETFL` operation), but differs in that `MSG_DONTWAIT` is a per-
88+
/// call option, whereas `O_NONBLOCK` is a setting on the open file
89+
/// description (see [open(2)](http://man7.org/linux/man-pages/man2/open.2.html)),
90+
/// which will affect all threads in
91+
/// the calling process and as well as other processes that hold
92+
/// file descriptors referring to the same open file description.
7793
MSG_DONTWAIT,
94+
/// Receive flags: Control Data was discarded (buffer too small)
7895
MSG_CTRUNC,
96+
/// For raw ([`Packet`](addr/enum.AddressFamily.html)), Internet datagram
97+
/// (since Linux 2.4.27/2.6.8),
98+
/// netlink (since Linux 2.6.22) and UNIX datagram (since Linux 3.4)
99+
/// sockets: return the real length of the packet or datagram, even
100+
/// when it was longer than the passed buffer. Not implemented for UNIX
101+
/// domain ([unix(7)](https://linux.die.net/man/7/unix)) sockets.
102+
///
103+
/// For use with Internet stream sockets, see [tcp(7)](https://linux.die.net/man/7/tcp).
79104
MSG_TRUNC,
105+
/// Terminates a record (when this notion is supported, as for
106+
/// sockets of type [`SeqPacket`](enum.SockType.html)).
80107
MSG_EOR,
108+
/// This flag specifies that queued errors should be received from
109+
/// the socket error queue. (For more details, see
110+
/// [recvfrom(2)](https://linux.die.net/man/2/recvfrom))
81111
#[cfg(any(target_os = "linux", target_os = "android"))]
82112
MSG_ERRQUEUE,
113+
/// Set the `close-on-exec` flag for the file descriptor received via a UNIX domain
114+
/// file descriptor using the `SCM_RIGHTS` operation (described in
115+
/// [unix(7)](https://linux.die.net/man/7/unix)).
116+
/// This flag is useful for the same reasons as the `O_CLOEXEC` flag of
117+
/// [open(2)](https://linux.die.net/man/2/open).
118+
///
119+
/// Only used in [`recvmsg`](fn.recvmsg.html) function.
83120
#[cfg(any(target_os = "linux", target_os = "android"))]
84121
MSG_CMSG_CLOEXEC,
85122
}

0 commit comments

Comments
 (0)