|
| 1 | +//! Header: `sys/socket.h` |
| 2 | +//! |
| 3 | +//! <https://github.com/kraj/musl/blob/kraj/master/include/sys/socket.h> |
| 4 | +
|
| 5 | +use crate::prelude::*; |
| 6 | + |
| 7 | +s! { |
| 8 | + pub struct msghdr { |
| 9 | + pub msg_name: *mut c_void, |
| 10 | + pub msg_namelen: crate::socklen_t, |
| 11 | + pub msg_iov: *mut crate::iovec, |
| 12 | + #[cfg(all(target_pointer_width = "64", target_endian = "big"))] |
| 13 | + __pad1: c_int, |
| 14 | + pub msg_iovlen: c_int, |
| 15 | + #[cfg(all(target_pointer_width = "64", target_endian = "little"))] |
| 16 | + __pad1: c_int, |
| 17 | + pub msg_control: *mut c_void, |
| 18 | + #[cfg(all(target_pointer_width = "64", target_endian = "big"))] |
| 19 | + __pad2: c_int, |
| 20 | + pub msg_controllen: crate::socklen_t, |
| 21 | + #[cfg(all(target_pointer_width = "64", target_endian = "little"))] |
| 22 | + __pad2: c_int, |
| 23 | + pub msg_flags: c_int, |
| 24 | + } |
| 25 | + |
| 26 | + pub struct cmsghdr { |
| 27 | + #[cfg(all(target_pointer_width = "64", target_endian = "big"))] |
| 28 | + pub __pad1: c_int, |
| 29 | + pub cmsg_len: crate::socklen_t, |
| 30 | + #[cfg(all(target_pointer_width = "64", target_endian = "little"))] |
| 31 | + pub __pad1: c_int, |
| 32 | + pub cmsg_level: c_int, |
| 33 | + pub cmsg_type: c_int, |
| 34 | + } |
| 35 | +} |
| 36 | + |
| 37 | +extern "C" { |
| 38 | + pub fn sendmmsg( |
| 39 | + sockfd: c_int, |
| 40 | + msgvec: *mut crate::mmsghdr, |
| 41 | + vlen: c_uint, |
| 42 | + flags: c_uint, |
| 43 | + ) -> c_int; |
| 44 | + pub fn recvmmsg( |
| 45 | + sockfd: c_int, |
| 46 | + msgvec: *mut crate::mmsghdr, |
| 47 | + vlen: c_uint, |
| 48 | + flags: c_uint, |
| 49 | + timeout: *mut crate::timespec, |
| 50 | + ) -> c_int; |
| 51 | +} |
| 52 | + |
| 53 | +cfg_if! { |
| 54 | + if #[cfg(any(target_arch = "mips", target_arch = "mips64"))] { |
| 55 | + pub use crate::bits::socket::{ |
| 56 | + SOCK_DGRAM, |
| 57 | + SOCK_STREAM, |
| 58 | + }; |
| 59 | + } else { |
| 60 | + pub const SOCK_STREAM: c_int = 1; |
| 61 | + pub const SOCK_DGRAM: c_int = 2; |
| 62 | + } |
| 63 | +} |
0 commit comments