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 pub const MSG_TRUNC: ::c_int = 0x04; 87 pub const MSG_CTRUNC: ::c_int = 0x08; 88 pub const MSG_EOR: ::c_int = 0x08; 89 90 pub const PTHREAD_STACK_MIN: ::size_t = 768; 91 92 extern "C" { pthread_create( native: *mut ::pthread_t, attr: *const ::pthread_attr_t, f: extern "C" fn(_: *mut ::c_void) -> *mut ::c_void, value: *mut ::c_void, ) -> ::c_int93 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 getrandom(buf: *mut ::c_void, buflen: ::size_t, flags: ::c_uint) -> ::ssize_t100 pub fn getrandom(buf: *mut ::c_void, buflen: ::size_t, flags: ::c_uint) -> ::ssize_t; 101 102 #[link_name = "lwip_sendmsg"] sendmsg(s: ::c_int, msg: *const ::msghdr, flags: ::c_int) -> ::ssize_t103 pub fn sendmsg(s: ::c_int, msg: *const ::msghdr, flags: ::c_int) -> ::ssize_t; 104 #[link_name = "lwip_recvmsg"] recvmsg(s: ::c_int, msg: *mut ::msghdr, flags: ::c_int) -> ::ssize_t105 pub fn recvmsg(s: ::c_int, msg: *mut ::msghdr, flags: ::c_int) -> ::ssize_t; 106 eventfd(initval: ::c_uint, flags: ::c_int) -> ::c_int107 pub fn eventfd(initval: ::c_uint, flags: ::c_int) -> ::c_int; 108 } 109 110 pub use crate::unix::newlib::generic::{sigset_t, stat}; 111