1 pub type clock_t = ::c_ulong;
2 pub type c_char = i8;
3 pub type wchar_t = u32;
4 
5 pub type c_long = i32;
6 pub type c_ulong = u32;
7 
8 s! {
9     pub struct cmsghdr {
10         pub cmsg_len: ::socklen_t,
11         pub cmsg_level: ::c_int,
12         pub cmsg_type: ::c_int,
13     }
14 
15     pub struct msghdr {
16         pub msg_name: *mut ::c_void,
17         pub msg_namelen: ::socklen_t,
18         pub msg_iov: *mut ::iovec,
19         pub msg_iovlen: ::c_int,
20         pub msg_control: *mut ::c_void,
21         pub msg_controllen: ::socklen_t,
22         pub msg_flags: ::c_int,
23     }
24 
25     pub struct sockaddr_un {
26         pub sun_family: ::sa_family_t,
27         pub sun_path: [::c_char; 108],
28     }
29 
30     pub struct sockaddr {
31         pub sa_len: u8,
32         pub sa_family: ::sa_family_t,
33         pub sa_data: [::c_char; 14],
34     }
35 
36     pub struct sockaddr_in6 {
37         pub sin6_len: u8,
38         pub sin6_family: ::sa_family_t,
39         pub sin6_port: ::in_port_t,
40         pub sin6_flowinfo: u32,
41         pub sin6_addr: ::in6_addr,
42         pub sin6_scope_id: u32,
43     }
44 
45     pub struct sockaddr_in {
46         pub sin_len: u8,
47         pub sin_family: ::sa_family_t,
48         pub sin_port: ::in_port_t,
49         pub sin_addr: ::in_addr,
50         pub sin_zero: [::c_char; 8],
51     }
52 
53     pub struct sockaddr_storage {
54         pub s2_len: u8,
55         pub ss_family: ::sa_family_t,
56         pub s2_data1: [::c_char; 2],
57         pub s2_data2: [u32; 3],
58         pub s2_data3: [u32; 3],
59     }
60 }
61 
62 pub const AF_UNIX: ::c_int = 1;
63 pub const AF_INET6: ::c_int = 10;
64 
65 pub const FIONBIO: ::c_ulong = 2147772030;
66 
67 pub const POLLIN: ::c_short = 1 << 0;
68 pub const POLLRDNORM: ::c_short = 1 << 1;
69 pub const POLLRDBAND: ::c_short = 1 << 2;
70 pub const POLLPRI: ::c_short = POLLRDBAND;
71 pub const POLLOUT: ::c_short = 1 << 3;
72 pub const POLLWRNORM: ::c_short = POLLOUT;
73 pub const POLLWRBAND: ::c_short = 1 << 4;
74 pub const POLLERR: ::c_short = 1 << 5;
75 pub const POLLHUP: ::c_short = 1 << 6;
76 
77 pub const SOL_SOCKET: ::c_int = 0xfff;
78 
79 pub const MSG_OOB: ::c_int = 0x04;
80 pub const MSG_PEEK: ::c_int = 0x01;
81 pub const MSG_DONTWAIT: ::c_int = 0x08;
82 pub const MSG_DONTROUTE: ::c_int = 0x4;
83 pub const MSG_WAITALL: ::c_int = 0x02;
84 pub const MSG_MORE: ::c_int = 0x10;
85 pub const MSG_NOSIGNAL: ::c_int = 0x20;
86 
87 extern "C" {
sendmsg( s: ::c_int, msg: *const ::msghdr, flags: ::c_int, ) -> ::ssize_t88     pub fn sendmsg(
89         s: ::c_int,
90         msg: *const ::msghdr,
91         flags: ::c_int,
92     ) -> ::ssize_t;
recvmsg( s: ::c_int, msg: *mut ::msghdr, flags: ::c_int, ) -> ::ssize_t93     pub fn recvmsg(
94         s: ::c_int,
95         msg: *mut ::msghdr,
96         flags: ::c_int,
97     ) -> ::ssize_t;
98 
writev(s: ::c_int, iov: *const ::iovec, iovcnt: ::c_int) -> ::c_int99     pub fn writev(s: ::c_int, iov: *const ::iovec, iovcnt: ::c_int)
100         -> ::c_int;
readv( fd: ::c_int, iov: *const ::iovec, iovcnt: ::c_int, ) -> ::ssize_t101     pub fn readv(
102         fd: ::c_int,
103         iov: *const ::iovec,
104         iovcnt: ::c_int,
105     ) -> ::ssize_t;
106 }
107