1pub type clock_t = ::c_ulong;
2pub type c_char = i8;
3pub type wchar_t = u32;
4
5pub type c_long = i32;
6pub type c_ulong = u32;
7
8s! {
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
62pub const AF_UNIX: ::c_int = 1;
63pub const AF_INET6: ::c_int = 10;
64
65pub const FIONBIO: ::c_ulong = 2147772030;
66
67pub const POLLIN: ::c_short = 1 << 0;
68pub const POLLRDNORM: ::c_short = 1 << 1;
69pub const POLLRDBAND: ::c_short = 1 << 2;
70pub const POLLPRI: ::c_short = POLLRDBAND;
71pub const POLLOUT: ::c_short = 1 << 3;
72pub const POLLWRNORM: ::c_short = POLLOUT;
73pub const POLLWRBAND: ::c_short = 1 << 4;
74pub const POLLERR: ::c_short = 1 << 5;
75pub const POLLHUP: ::c_short = 1 << 6;
76
77pub const SOL_SOCKET: ::c_int = 0xfff;
78
79pub const MSG_OOB: ::c_int = 0x04;
80pub const MSG_PEEK: ::c_int = 0x01;
81pub const MSG_DONTWAIT: ::c_int = 0x08;
82pub const MSG_DONTROUTE: ::c_int = 0x4;
83pub const MSG_WAITALL: ::c_int = 0x02;
84pub const MSG_MORE: ::c_int = 0x10;
85pub const MSG_NOSIGNAL: ::c_int = 0x20;
86pub const MSG_TRUNC: ::c_int = 0x04;
87pub const MSG_CTRUNC: ::c_int = 0x08;
88pub const MSG_EOR: ::c_int = 0x08;
89
90pub const PTHREAD_STACK_MIN: ::size_t = 768;
91
92extern "C" {
93    pub fn pthread_create(
94        native: *mut ::pthread_t,
95        attr: *const ::pthread_attr_t,
96        f: extern "C" fn(_: *mut ::c_void) -> *mut ::c_void,
97        value: *mut ::c_void,
98    ) -> ::c_int;
99
100    pub fn getrandom(buf: *mut ::c_void, buflen: ::size_t, flags: ::c_uint) -> ::ssize_t;
101
102    #[link_name = "lwip_sendmsg"]
103    pub fn sendmsg(s: ::c_int, msg: *const ::msghdr, flags: ::c_int) -> ::ssize_t;
104    #[link_name = "lwip_recvmsg"]
105    pub fn recvmsg(s: ::c_int, msg: *mut ::msghdr, flags: ::c_int) -> ::ssize_t;
106
107    pub fn eventfd(initval: ::c_uint, flags: ::c_int) -> ::c_int;
108}
109
110pub use crate::unix::newlib::generic::{sigset_t, stat};
111