@@ -60,25 +60,62 @@ pub enum SockType {
60
60
Rdm = libc:: SOCK_RDM ,
61
61
}
62
62
63
- // Extra flags - Supported by Linux 2.6.27, normalized on other platforms
64
63
bitflags ! (
64
+ /// Extra flags - Supported by Linux 2.6.27, normalized on other platforms
65
65
pub struct SockFlag : c_int {
66
66
const SOCK_NONBLOCK = 0o0004000 ;
67
67
const SOCK_CLOEXEC = 0o2000000 ;
68
68
}
69
69
) ;
70
70
71
- // Flags for send/recv and their relatives
72
71
libc_bitflags ! {
72
+ /// Flags for send/recv and their relatives
73
73
pub flags MsgFlags : libc:: c_int {
74
+ /// Sends or requests out-of-band data on sockets that support this notion
75
+ /// (e.g., of type [`Stream`](enum.SockType.html)); the underlying protocol must also
76
+ /// support out-of-band data.
74
77
MSG_OOB ,
78
+ /// Peeks at an incoming message. The data is treated as unread and the next
79
+ /// [`recv()`](fn.recv.html)
80
+ /// or similar function shall still return this data.
75
81
MSG_PEEK ,
82
+ /// Enables nonblocking operation; if the operation would block,
83
+ /// `EAGAIN` or `EWOULDBLOCK` is returned. This provides similar
84
+ /// behavior to setting the `O_NONBLOCK` flag
85
+ /// (via the [`fcntl`](../../fcntl/fn.fcntl.html)
86
+ /// `F_SETFL` operation), but differs in that `MSG_DONTWAIT` is a per-
87
+ /// call option, whereas `O_NONBLOCK` is a setting on the open file
88
+ /// description (see [open(2)](http://man7.org/linux/man-pages/man2/open.2.html)),
89
+ /// which will affect all threads in
90
+ /// the calling process and as well as other processes that hold
91
+ /// file descriptors referring to the same open file description.
76
92
MSG_DONTWAIT ,
93
+ /// Receive flags: Control Data was discarded (buffer too small)
77
94
MSG_CTRUNC ,
95
+ /// For raw ([`Packet`](addr/enum.AddressFamily.html)), Internet datagram
96
+ /// (since Linux 2.4.27/2.6.8),
97
+ /// netlink (since Linux 2.6.22) and UNIX datagram (since Linux 3.4)
98
+ /// sockets: return the real length of the packet or datagram, even
99
+ /// when it was longer than the passed buffer. Not implemented for UNIX
100
+ /// domain ([unix(7)](https://linux.die.net/man/7/unix)) sockets.
101
+ ///
102
+ /// For use with Internet stream sockets, see [tcp(7)](https://linux.die.net/man/7/tcp).
78
103
MSG_TRUNC ,
104
+ /// Terminates a record (when this notion is supported, as for
105
+ /// sockets of type [`SeqPacket`](enum.SockType.html)).
79
106
MSG_EOR ,
107
+ /// This flag specifies that queued errors should be received from
108
+ /// the socket error queue. (For more details, see
109
+ /// [recvfrom(2)](https://linux.die.net/man/2/recvfrom))
80
110
#[ cfg( any( target_os = "linux" , target_os = "android" ) ) ]
81
111
MSG_ERRQUEUE ,
112
+ /// Set the `close-on-exec` flag for the file descriptor received via a UNIX domain
113
+ /// file descriptor using the `SCM_RIGHTS` operation (described in
114
+ /// [unix(7)](https://linux.die.net/man/7/unix)).
115
+ /// This flag is useful for the same reasons as the `O_CLOEXEC` flag of
116
+ /// [open(2)](https://linux.die.net/man/2/open).
117
+ ///
118
+ /// Only used in [`recvmsg`](fn.recvmsg.html) function.
82
119
#[ cfg( any( target_os = "linux" , target_os = "android" ) ) ]
83
120
MSG_CMSG_CLOEXEC ,
84
121
}
0 commit comments