1 use crate::off_t; 2 use crate::prelude::*; 3 4 pub type clock_t = c_long; 5 6 pub type wchar_t = u32; 7 8 pub type sigset_t = c_ulong; 9 10 s! { 11 pub struct msghdr { 12 pub msg_name: *mut c_void, 13 pub msg_namelen: crate::socklen_t, 14 pub msg_iov: *mut crate::iovec, 15 pub msg_iovlen: c_int, 16 pub msg_control: *mut c_void, 17 pub msg_controllen: crate::socklen_t, 18 pub msg_flags: c_int, 19 } 20 21 pub struct sockaddr { 22 pub sa_len: u8, 23 pub sa_family: crate::sa_family_t, 24 pub sa_data: [c_char; 14], 25 } 26 27 pub struct sockaddr_in6 { 28 pub sin6_len: u8, 29 pub sin6_family: crate::sa_family_t, 30 pub sin6_port: crate::in_port_t, 31 pub sin6_flowinfo: u32, 32 pub sin6_addr: crate::in6_addr, 33 pub sin6_vport: crate::in_port_t, 34 pub sin6_scope_id: u32, 35 } 36 37 pub struct sockaddr_in { 38 pub sin_len: u8, 39 pub sin_family: crate::sa_family_t, 40 pub sin_port: crate::in_port_t, 41 pub sin_addr: crate::in_addr, 42 pub sin_vport: crate::in_port_t, 43 pub sin_zero: [u8; 6], 44 } 45 46 pub struct sockaddr_un { 47 pub ss_len: u8, 48 pub sun_family: crate::sa_family_t, 49 pub sun_path: [c_char; 108usize], 50 } 51 52 pub struct sockaddr_storage { 53 pub ss_len: u8, 54 pub ss_family: crate::sa_family_t, 55 pub __ss_pad1: [u8; 2], 56 pub __ss_align: i64, 57 pub __ss_pad2: [u8; 116], 58 } 59 60 pub struct sched_param { 61 pub sched_priority: c_int, 62 } 63 64 pub struct stat { 65 pub st_dev: crate::dev_t, 66 pub st_ino: crate::ino_t, 67 pub st_mode: crate::mode_t, 68 pub st_nlink: crate::nlink_t, 69 pub st_uid: crate::uid_t, 70 pub st_gid: crate::gid_t, 71 pub st_rdev: crate::dev_t, 72 pub st_size: off_t, 73 pub st_atime: crate::time_t, 74 pub st_mtime: crate::time_t, 75 pub st_ctime: crate::time_t, 76 pub st_blksize: crate::blksize_t, 77 pub st_blocks: crate::blkcnt_t, 78 pub st_spare4: [c_long; 2usize], 79 } 80 81 #[repr(align(8))] 82 pub struct dirent { 83 __offset: [u8; 88], 84 pub d_name: [c_char; 256usize], 85 __pad: [u8; 8], 86 } 87 } 88 89 pub const AF_UNIX: c_int = 1; 90 pub const AF_INET6: c_int = 24; 91 92 pub const SOCK_RAW: c_int = 3; 93 pub const SOCK_RDM: c_int = 4; 94 pub const SOCK_SEQPACKET: c_int = 5; 95 96 pub const SOMAXCONN: c_int = 128; 97 98 pub const FIONBIO: c_ulong = 1; 99 100 pub const POLLIN: c_short = 0x0001; 101 pub const POLLPRI: c_short = POLLIN; 102 pub const POLLOUT: c_short = 0x0004; 103 pub const POLLRDNORM: c_short = POLLIN; 104 pub const POLLRDBAND: c_short = POLLIN; 105 pub const POLLWRNORM: c_short = POLLOUT; 106 pub const POLLWRBAND: c_short = POLLOUT; 107 pub const POLLERR: c_short = 0x0008; 108 pub const POLLHUP: c_short = 0x0010; 109 pub const POLLNVAL: c_short = 0x0020; 110 111 pub const RTLD_DEFAULT: *mut c_void = 0 as *mut c_void; 112 113 pub const SOL_SOCKET: c_int = 0xffff; 114 pub const SO_NONBLOCK: c_int = 0x1100; 115 116 pub const MSG_OOB: c_int = 0x1; 117 pub const MSG_PEEK: c_int = 0x2; 118 pub const MSG_DONTROUTE: c_int = 0x4; 119 pub const MSG_EOR: c_int = 0x8; 120 pub const MSG_TRUNC: c_int = 0x10; 121 pub const MSG_CTRUNC: c_int = 0x20; 122 pub const MSG_WAITALL: c_int = 0x40; 123 pub const MSG_DONTWAIT: c_int = 0x80; 124 pub const MSG_BCAST: c_int = 0x100; 125 pub const MSG_MCAST: c_int = 0x200; 126 127 pub const UTIME_OMIT: c_long = -1; 128 pub const AT_FDCWD: c_int = -2; 129 130 pub const O_DIRECTORY: c_int = 0x200000; 131 pub const O_NOFOLLOW: c_int = 0x100000; 132 133 pub const AT_EACCESS: c_int = 1; 134 pub const AT_SYMLINK_NOFOLLOW: c_int = 2; 135 pub const AT_SYMLINK_FOLLOW: c_int = 4; 136 pub const AT_REMOVEDIR: c_int = 8; 137 138 pub const SIGHUP: c_int = 1; 139 pub const SIGINT: c_int = 2; 140 pub const SIGQUIT: c_int = 3; 141 pub const SIGILL: c_int = 4; 142 pub const SIGTRAP: c_int = 5; 143 pub const SIGABRT: c_int = 6; 144 pub const SIGEMT: c_int = 7; 145 pub const SIGFPE: c_int = 8; 146 pub const SIGKILL: c_int = 9; 147 pub const SIGBUS: c_int = 10; 148 pub const SIGSEGV: c_int = 11; 149 pub const SIGSYS: c_int = 12; 150 pub const SIGPIPE: c_int = 13; 151 pub const SIGALRM: c_int = 14; 152 pub const SIGTERM: c_int = 15; 153 154 pub const EAI_BADFLAGS: c_int = -1; 155 pub const EAI_NONAME: c_int = -2; 156 pub const EAI_AGAIN: c_int = -3; 157 pub const EAI_FAIL: c_int = -4; 158 pub const EAI_NODATA: c_int = -5; 159 pub const EAI_FAMILY: c_int = -6; 160 pub const EAI_SOCKTYPE: c_int = -7; 161 pub const EAI_SERVICE: c_int = -8; 162 pub const EAI_ADDRFAMILY: c_int = -9; 163 pub const EAI_MEMORY: c_int = -10; 164 pub const EAI_SYSTEM: c_int = -11; 165 pub const EAI_OVERFLOW: c_int = -12; 166 167 pub const _SC_PAGESIZE: c_int = 8; 168 pub const _SC_GETPW_R_SIZE_MAX: c_int = 51; 169 pub const PTHREAD_STACK_MIN: size_t = 32 * 1024; 170 171 pub const IP_HDRINCL: c_int = 2; 172 173 extern "C" { futimens(fd: c_int, times: *const crate::timespec) -> c_int174 pub fn futimens(fd: c_int, times: *const crate::timespec) -> c_int; writev(fd: c_int, iov: *const crate::iovec, iovcnt: c_int) -> ssize_t175 pub fn writev(fd: c_int, iov: *const crate::iovec, iovcnt: c_int) -> ssize_t; readv(fd: c_int, iov: *const crate::iovec, iovcnt: c_int) -> ssize_t176 pub fn readv(fd: c_int, iov: *const crate::iovec, iovcnt: c_int) -> ssize_t; 177 sendmsg(s: c_int, msg: *const crate::msghdr, flags: c_int) -> ssize_t178 pub fn sendmsg(s: c_int, msg: *const crate::msghdr, flags: c_int) -> ssize_t; recvmsg(s: c_int, msg: *mut crate::msghdr, flags: c_int) -> ssize_t179 pub fn recvmsg(s: c_int, msg: *mut crate::msghdr, flags: c_int) -> ssize_t; 180 pthread_create( native: *mut crate::pthread_t, attr: *const crate::pthread_attr_t, f: extern "C" fn(_: *mut c_void) -> *mut c_void, value: *mut c_void, ) -> c_int181 pub fn pthread_create( 182 native: *mut crate::pthread_t, 183 attr: *const crate::pthread_attr_t, 184 f: extern "C" fn(_: *mut c_void) -> *mut c_void, 185 value: *mut c_void, 186 ) -> c_int; 187 pthread_attr_getschedparam( attr: *const crate::pthread_attr_t, param: *mut sched_param, ) -> c_int188 pub fn pthread_attr_getschedparam( 189 attr: *const crate::pthread_attr_t, 190 param: *mut sched_param, 191 ) -> c_int; 192 pthread_attr_setschedparam( attr: *mut crate::pthread_attr_t, param: *const sched_param, ) -> c_int193 pub fn pthread_attr_setschedparam( 194 attr: *mut crate::pthread_attr_t, 195 param: *const sched_param, 196 ) -> c_int; 197 pthread_attr_getprocessorid_np( attr: *const crate::pthread_attr_t, processor_id: *mut c_int, ) -> c_int198 pub fn pthread_attr_getprocessorid_np( 199 attr: *const crate::pthread_attr_t, 200 processor_id: *mut c_int, 201 ) -> c_int; 202 pthread_attr_setprocessorid_np( attr: *mut crate::pthread_attr_t, processor_id: c_int, ) -> c_int203 pub fn pthread_attr_setprocessorid_np( 204 attr: *mut crate::pthread_attr_t, 205 processor_id: c_int, 206 ) -> c_int; 207 pthread_getschedparam( native: crate::pthread_t, policy: *mut c_int, param: *mut crate::sched_param, ) -> c_int208 pub fn pthread_getschedparam( 209 native: crate::pthread_t, 210 policy: *mut c_int, 211 param: *mut crate::sched_param, 212 ) -> c_int; 213 pthread_setschedparam( native: crate::pthread_t, policy: c_int, param: *const crate::sched_param, ) -> c_int214 pub fn pthread_setschedparam( 215 native: crate::pthread_t, 216 policy: c_int, 217 param: *const crate::sched_param, 218 ) -> c_int; 219 pthread_condattr_getclock( attr: *const crate::pthread_condattr_t, clock_id: *mut crate::clockid_t, ) -> c_int220 pub fn pthread_condattr_getclock( 221 attr: *const crate::pthread_condattr_t, 222 clock_id: *mut crate::clockid_t, 223 ) -> c_int; 224 pthread_condattr_setclock( attr: *mut crate::pthread_condattr_t, clock_id: crate::clockid_t, ) -> c_int225 pub fn pthread_condattr_setclock( 226 attr: *mut crate::pthread_condattr_t, 227 clock_id: crate::clockid_t, 228 ) -> c_int; 229 pthread_getprocessorid_np() -> c_int230 pub fn pthread_getprocessorid_np() -> c_int; 231 getentropy(buf: *mut c_void, buflen: size_t) -> c_int232 pub fn getentropy(buf: *mut c_void, buflen: size_t) -> c_int; 233 pipe2(fds: *mut c_int, flags: c_int) -> c_int234 pub fn pipe2(fds: *mut c_int, flags: c_int) -> c_int; 235 } 236