| 1 |
pub type c_char = i8; |
| 2 |
pub type wchar_t = i32; |
| 3 |
|
| 4 |
cfg_if! { |
| 5 |
if #[cfg(target_pointer_width = "32")] { |
| 6 |
pub type c_long = i32; |
| 7 |
pub type c_ulong = u32; |
| 8 |
} |
| 9 |
} |
| 10 |
|
| 11 |
cfg_if! { |
| 12 |
if #[cfg(target_pointer_width = "64")] { |
| 13 |
pub type c_long = i64; |
| 14 |
pub type c_ulong = u64; |
| 15 |
} |
| 16 |
} |
| 17 |
|
| 18 |
pub type blkcnt_t = ::c_ulong; |
| 19 |
pub type blksize_t = ::c_long; |
| 20 |
pub type clock_t = ::c_long; |
| 21 |
pub type clockid_t = ::c_int; |
| 22 |
pub type dev_t = ::c_long; |
| 23 |
pub type fsblkcnt_t = ::c_ulong; |
| 24 |
pub type fsfilcnt_t = ::c_ulong; |
| 25 |
pub type ino_t = ::c_ulong; |
| 26 |
pub type mode_t = ::c_int; |
| 27 |
pub type nfds_t = ::c_ulong; |
| 28 |
pub type nlink_t = ::c_ulong; |
| 29 |
pub type off_t = ::c_longlong; |
| 30 |
pub type pthread_t = *mut ::c_void; |
| 31 |
// Must be usize due to library/std/sys_common/thread_local.rs, |
| 32 |
// should technically be *mut ::c_void |
| 33 |
pub type pthread_key_t = usize; |
| 34 |
pub type rlim_t = ::c_ulonglong; |
| 35 |
pub type sa_family_t = u16; |
| 36 |
pub type sem_t = *mut ::c_void; |
| 37 |
pub type sigset_t = ::c_ulonglong; |
| 38 |
pub type socklen_t = u32; |
| 39 |
pub type speed_t = u32; |
| 40 |
pub type suseconds_t = ::c_int; |
| 41 |
pub type tcflag_t = u32; |
| 42 |
pub type time_t = ::c_longlong; |
| 43 |
pub type id_t = ::c_uint; |
| 44 |
pub type pid_t = usize; |
| 45 |
pub type uid_t = u32; |
| 46 |
pub type gid_t = u32; |
| 47 |
|
| 48 |
#[cfg_attr(feature = "extra_traits", derive(Debug))] |
| 49 |
pub enum timezone {} |
| 50 |
impl ::Copy for timezone {} |
| 51 |
impl ::Clone for timezone { |
| 52 |
fn clone(&self) -> timezone { |
| 53 |
*self |
| 54 |
} |
| 55 |
} |
| 56 |
|
| 57 |
s_no_extra_traits! { |
| 58 |
#[repr(C)] |
| 59 |
pub struct utsname { |
| 60 |
pub sysname: [::c_char; UTSLENGTH], |
| 61 |
pub nodename: [::c_char; UTSLENGTH], |
| 62 |
pub release: [::c_char; UTSLENGTH], |
| 63 |
pub version: [::c_char; UTSLENGTH], |
| 64 |
pub machine: [::c_char; UTSLENGTH], |
| 65 |
pub domainname: [::c_char; UTSLENGTH], |
| 66 |
} |
| 67 |
|
| 68 |
pub struct dirent { |
| 69 |
pub d_ino: ::ino_t, |
| 70 |
pub d_off: ::off_t, |
| 71 |
pub d_reclen: ::c_ushort, |
| 72 |
pub d_type: ::c_uchar, |
| 73 |
pub d_name: [::c_char; 256], |
| 74 |
} |
| 75 |
|
| 76 |
pub struct sockaddr_un { |
| 77 |
pub sun_family: ::sa_family_t, |
| 78 |
pub sun_path: [::c_char; 108] |
| 79 |
} |
| 80 |
|
| 81 |
pub struct sockaddr_storage { |
| 82 |
pub ss_family: ::sa_family_t, |
| 83 |
__ss_padding: [ |
| 84 |
u8; |
| 85 |
128 - |
| 86 |
::core::mem::size_of::<sa_family_t>() - |
| 87 |
::core::mem::size_of::<c_ulong>() |
| 88 |
], |
| 89 |
__ss_align: ::c_ulong, |
| 90 |
} |
| 91 |
} |
| 92 |
|
| 93 |
s! { |
| 94 |
pub struct addrinfo { |
| 95 |
pub ai_flags: ::c_int, |
| 96 |
pub ai_family: ::c_int, |
| 97 |
pub ai_socktype: ::c_int, |
| 98 |
pub ai_protocol: ::c_int, |
| 99 |
pub ai_addrlen: ::size_t, |
| 100 |
pub ai_canonname: *mut ::c_char, |
| 101 |
pub ai_addr: *mut ::sockaddr, |
| 102 |
pub ai_next: *mut ::addrinfo, |
| 103 |
} |
| 104 |
|
| 105 |
pub struct Dl_info { |
| 106 |
pub dli_fname: *const ::c_char, |
| 107 |
pub dli_fbase: *mut ::c_void, |
| 108 |
pub dli_sname: *const ::c_char, |
| 109 |
pub dli_saddr: *mut ::c_void, |
| 110 |
} |
| 111 |
|
| 112 |
pub struct epoll_event { |
| 113 |
pub events: u32, |
| 114 |
pub u64: u64, |
| 115 |
pub _pad: u64, |
| 116 |
} |
| 117 |
|
| 118 |
pub struct fd_set { |
| 119 |
fds_bits: [::c_ulong; ::FD_SETSIZE / ULONG_SIZE], |
| 120 |
} |
| 121 |
|
| 122 |
pub struct in_addr { |
| 123 |
pub s_addr: ::in_addr_t, |
| 124 |
} |
| 125 |
|
| 126 |
pub struct ip_mreq { |
| 127 |
pub imr_multiaddr: ::in_addr, |
| 128 |
pub imr_interface: ::in_addr, |
| 129 |
} |
| 130 |
|
| 131 |
pub struct lconv { |
| 132 |
pub currency_symbol: *const ::c_char, |
| 133 |
pub decimal_point: *const ::c_char, |
| 134 |
pub frac_digits: ::c_char, |
| 135 |
pub grouping: *const ::c_char, |
| 136 |
pub int_curr_symbol: *const ::c_char, |
| 137 |
pub int_frac_digits: ::c_char, |
| 138 |
pub mon_decimal_point: *const ::c_char, |
| 139 |
pub mon_grouping: *const ::c_char, |
| 140 |
pub mon_thousands_sep: *const ::c_char, |
| 141 |
pub negative_sign: *const ::c_char, |
| 142 |
pub n_cs_precedes: ::c_char, |
| 143 |
pub n_sep_by_space: ::c_char, |
| 144 |
pub n_sign_posn: ::c_char, |
| 145 |
pub positive_sign: *const ::c_char, |
| 146 |
pub p_cs_precedes: ::c_char, |
| 147 |
pub p_sep_by_space: ::c_char, |
| 148 |
pub p_sign_posn: ::c_char, |
| 149 |
pub thousands_sep: *const ::c_char, |
| 150 |
} |
| 151 |
|
| 152 |
pub struct passwd { |
| 153 |
pub pw_name: *mut ::c_char, |
| 154 |
pub pw_passwd: *mut ::c_char, |
| 155 |
pub pw_uid: ::uid_t, |
| 156 |
pub pw_gid: ::gid_t, |
| 157 |
pub pw_gecos: *mut ::c_char, |
| 158 |
pub pw_dir: *mut ::c_char, |
| 159 |
pub pw_shell: *mut ::c_char, |
| 160 |
} |
| 161 |
|
| 162 |
pub struct sigaction { |
| 163 |
pub sa_sigaction: ::sighandler_t, |
| 164 |
pub sa_flags: ::c_ulong, |
| 165 |
pub sa_restorer: ::Option<extern fn()>, |
| 166 |
pub sa_mask: ::sigset_t, |
| 167 |
} |
| 168 |
|
| 169 |
pub struct siginfo_t { |
| 170 |
pub si_signo: ::c_int, |
| 171 |
pub si_errno: ::c_int, |
| 172 |
pub si_code: ::c_int, |
| 173 |
_pad: [::c_int; 29], |
| 174 |
_align: [usize; 0], |
| 175 |
} |
| 176 |
|
| 177 |
pub struct sockaddr { |
| 178 |
pub sa_family: ::sa_family_t, |
| 179 |
pub sa_data: [::c_char; 14], |
| 180 |
} |
| 181 |
|
| 182 |
pub struct sockaddr_in { |
| 183 |
pub sin_family: ::sa_family_t, |
| 184 |
pub sin_port: ::in_port_t, |
| 185 |
pub sin_addr: ::in_addr, |
| 186 |
pub sin_zero: [::c_char; 8], |
| 187 |
} |
| 188 |
|
| 189 |
pub struct sockaddr_in6 { |
| 190 |
pub sin6_family: ::sa_family_t, |
| 191 |
pub sin6_port: ::in_port_t, |
| 192 |
pub sin6_flowinfo: u32, |
| 193 |
pub sin6_addr: ::in6_addr, |
| 194 |
pub sin6_scope_id: u32, |
| 195 |
} |
| 196 |
|
| 197 |
pub struct stat { |
| 198 |
pub st_dev: ::dev_t, |
| 199 |
pub st_ino: ::ino_t, |
| 200 |
pub st_nlink: ::nlink_t, |
| 201 |
pub st_mode: ::mode_t, |
| 202 |
pub st_uid: ::uid_t, |
| 203 |
pub st_gid: ::gid_t, |
| 204 |
pub st_rdev: ::dev_t, |
| 205 |
pub st_size: ::off_t, |
| 206 |
pub st_blksize: ::blksize_t, |
| 207 |
pub st_blocks: ::blkcnt_t, |
| 208 |
pub st_atime: ::time_t, |
| 209 |
pub st_atime_nsec: ::c_long, |
| 210 |
pub st_mtime: ::time_t, |
| 211 |
pub st_mtime_nsec: ::c_long, |
| 212 |
pub st_ctime: ::time_t, |
| 213 |
pub st_ctime_nsec: ::c_long, |
| 214 |
_pad: [::c_char; 24], |
| 215 |
} |
| 216 |
|
| 217 |
pub struct statvfs { |
| 218 |
pub f_bsize: ::c_ulong, |
| 219 |
pub f_frsize: ::c_ulong, |
| 220 |
pub f_blocks: ::fsblkcnt_t, |
| 221 |
pub f_bfree: ::fsblkcnt_t, |
| 222 |
pub f_bavail: ::fsblkcnt_t, |
| 223 |
pub f_files: ::fsfilcnt_t, |
| 224 |
pub f_ffree: ::fsfilcnt_t, |
| 225 |
pub f_favail: ::fsfilcnt_t, |
| 226 |
pub f_fsid: ::c_ulong, |
| 227 |
pub f_flag: ::c_ulong, |
| 228 |
pub f_namemax: ::c_ulong, |
| 229 |
} |
| 230 |
|
| 231 |
pub struct termios { |
| 232 |
pub c_iflag: ::tcflag_t, |
| 233 |
pub c_oflag: ::tcflag_t, |
| 234 |
pub c_cflag: ::tcflag_t, |
| 235 |
pub c_lflag: ::tcflag_t, |
| 236 |
pub c_line: ::cc_t, |
| 237 |
pub c_cc: [::cc_t; ::NCCS], |
| 238 |
pub c_ispeed: ::speed_t, |
| 239 |
pub c_ospeed: ::speed_t, |
| 240 |
} |
| 241 |
|
| 242 |
pub struct tm { |
| 243 |
pub tm_sec: ::c_int, |
| 244 |
pub tm_min: ::c_int, |
| 245 |
pub tm_hour: ::c_int, |
| 246 |
pub tm_mday: ::c_int, |
| 247 |
pub tm_mon: ::c_int, |
| 248 |
pub tm_year: ::c_int, |
| 249 |
pub tm_wday: ::c_int, |
| 250 |
pub tm_yday: ::c_int, |
| 251 |
pub tm_isdst: ::c_int, |
| 252 |
pub tm_gmtoff: ::c_long, |
| 253 |
pub tm_zone: *const ::c_char, |
| 254 |
} |
| 255 |
|
| 256 |
pub struct ucred { |
| 257 |
pub pid: pid_t, |
| 258 |
pub uid: uid_t, |
| 259 |
pub gid: gid_t, |
| 260 |
} |
| 261 |
|
| 262 |
#[cfg_attr(target_pointer_width = "32", repr(C, align(4)))] |
| 263 |
#[cfg_attr(target_pointer_width = "64", repr(C, align(8)))] |
| 264 |
pub struct pthread_attr_t { |
| 265 |
bytes: [u8; _PTHREAD_ATTR_SIZE], |
| 266 |
} |
| 267 |
#[repr(C)] |
| 268 |
#[repr(align(4))] |
| 269 |
pub struct pthread_barrier_t { |
| 270 |
bytes: [u8; _PTHREAD_BARRIER_SIZE], |
| 271 |
} |
| 272 |
#[repr(C)] |
| 273 |
#[repr(align(4))] |
| 274 |
pub struct pthread_barrierattr_t { |
| 275 |
bytes: [u8; _PTHREAD_BARRIERATTR_SIZE], |
| 276 |
} |
| 277 |
#[repr(C)] |
| 278 |
#[repr(align(4))] |
| 279 |
pub struct pthread_mutex_t { |
| 280 |
bytes: [u8; _PTHREAD_MUTEX_SIZE], |
| 281 |
} |
| 282 |
#[repr(C)] |
| 283 |
#[repr(align(4))] |
| 284 |
pub struct pthread_rwlock_t { |
| 285 |
bytes: [u8; _PTHREAD_RWLOCK_SIZE], |
| 286 |
} |
| 287 |
#[repr(C)] |
| 288 |
#[repr(align(4))] |
| 289 |
pub struct pthread_mutexattr_t { |
| 290 |
bytes: [u8; _PTHREAD_MUTEXATTR_SIZE], |
| 291 |
} |
| 292 |
#[repr(C)] |
| 293 |
#[repr(align(1))] |
| 294 |
pub struct pthread_rwlockattr_t { |
| 295 |
bytes: [u8; _PTHREAD_RWLOCKATTR_SIZE], |
| 296 |
} |
| 297 |
#[repr(C)] |
| 298 |
#[repr(align(4))] |
| 299 |
pub struct pthread_cond_t { |
| 300 |
bytes: [u8; _PTHREAD_COND_SIZE], |
| 301 |
} |
| 302 |
#[repr(C)] |
| 303 |
#[repr(align(4))] |
| 304 |
pub struct pthread_condattr_t { |
| 305 |
bytes: [u8; _PTHREAD_CONDATTR_SIZE], |
| 306 |
} |
| 307 |
#[repr(C)] |
| 308 |
#[repr(align(4))] |
| 309 |
pub struct pthread_once_t { |
| 310 |
bytes: [u8; _PTHREAD_ONCE_SIZE], |
| 311 |
} |
| 312 |
#[repr(C)] |
| 313 |
#[repr(align(4))] |
| 314 |
pub struct pthread_spinlock_t { |
| 315 |
bytes: [u8; _PTHREAD_SPINLOCK_SIZE], |
| 316 |
} |
| 317 |
} |
| 318 |
const _PTHREAD_ATTR_SIZE: usize = 32; |
| 319 |
const _PTHREAD_RWLOCKATTR_SIZE: usize = 1; |
| 320 |
const _PTHREAD_RWLOCK_SIZE: usize = 4; |
| 321 |
const _PTHREAD_BARRIER_SIZE: usize = 24; |
| 322 |
const _PTHREAD_BARRIERATTR_SIZE: usize = 4; |
| 323 |
const _PTHREAD_CONDATTR_SIZE: usize = 8; |
| 324 |
const _PTHREAD_COND_SIZE: usize = 8; |
| 325 |
const _PTHREAD_MUTEX_SIZE: usize = 12; |
| 326 |
const _PTHREAD_MUTEXATTR_SIZE: usize = 20; |
| 327 |
const _PTHREAD_ONCE_SIZE: usize = 4; |
| 328 |
const _PTHREAD_SPINLOCK_SIZE: usize = 4; |
| 329 |
|
| 330 |
pub const UTSLENGTH: usize = 65; |
| 331 |
|
| 332 |
// intentionally not public, only used for fd_set |
| 333 |
cfg_if! { |
| 334 |
if #[cfg(target_pointer_width = "32")] { |
| 335 |
const ULONG_SIZE: usize = 32; |
| 336 |
} else if #[cfg(target_pointer_width = "64")] { |
| 337 |
const ULONG_SIZE: usize = 64; |
| 338 |
} else { |
| 339 |
// Unknown target_pointer_width |
| 340 |
} |
| 341 |
} |
| 342 |
|
| 343 |
// limits.h |
| 344 |
pub const PATH_MAX: ::c_int = 4096; |
| 345 |
|
| 346 |
// fcntl.h |
| 347 |
pub const F_GETLK: ::c_int = 5; |
| 348 |
pub const F_SETLK: ::c_int = 6; |
| 349 |
pub const F_SETLKW: ::c_int = 7; |
| 350 |
pub const F_ULOCK: ::c_int = 0; |
| 351 |
pub const F_LOCK: ::c_int = 1; |
| 352 |
pub const F_TLOCK: ::c_int = 2; |
| 353 |
pub const F_TEST: ::c_int = 3; |
| 354 |
|
| 355 |
// FIXME: relibc { |
| 356 |
pub const RTLD_DEFAULT: *mut ::c_void = 0i64 as *mut ::c_void; |
| 357 |
// } |
| 358 |
|
| 359 |
// dlfcn.h |
| 360 |
pub const RTLD_LAZY: ::c_int = 0x0001; |
| 361 |
pub const RTLD_NOW: ::c_int = 0x0002; |
| 362 |
pub const RTLD_GLOBAL: ::c_int = 0x0100; |
| 363 |
pub const RTLD_LOCAL: ::c_int = 0x0000; |
| 364 |
|
| 365 |
// errno.h |
| 366 |
pub const EPERM: ::c_int = 1; /* Operation not permitted */ |
| 367 |
pub const ENOENT: ::c_int = 2; /* No such file or directory */ |
| 368 |
pub const ESRCH: ::c_int = 3; /* No such process */ |
| 369 |
pub const EINTR: ::c_int = 4; /* Interrupted system call */ |
| 370 |
pub const EIO: ::c_int = 5; /* I/O error */ |
| 371 |
pub const ENXIO: ::c_int = 6; /* No such device or address */ |
| 372 |
pub const E2BIG: ::c_int = 7; /* Argument list too long */ |
| 373 |
pub const ENOEXEC: ::c_int = 8; /* Exec format error */ |
| 374 |
pub const EBADF: ::c_int = 9; /* Bad file number */ |
| 375 |
pub const ECHILD: ::c_int = 10; /* No child processes */ |
| 376 |
pub const EAGAIN: ::c_int = 11; /* Try again */ |
| 377 |
pub const ENOMEM: ::c_int = 12; /* Out of memory */ |
| 378 |
pub const EACCES: ::c_int = 13; /* Permission denied */ |
| 379 |
pub const EFAULT: ::c_int = 14; /* Bad address */ |
| 380 |
pub const ENOTBLK: ::c_int = 15; /* Block device required */ |
| 381 |
pub const EBUSY: ::c_int = 16; /* Device or resource busy */ |
| 382 |
pub const EEXIST: ::c_int = 17; /* File exists */ |
| 383 |
pub const EXDEV: ::c_int = 18; /* Cross-device link */ |
| 384 |
pub const ENODEV: ::c_int = 19; /* No such device */ |
| 385 |
pub const ENOTDIR: ::c_int = 20; /* Not a directory */ |
| 386 |
pub const EISDIR: ::c_int = 21; /* Is a directory */ |
| 387 |
pub const EINVAL: ::c_int = 22; /* Invalid argument */ |
| 388 |
pub const ENFILE: ::c_int = 23; /* File table overflow */ |
| 389 |
pub const EMFILE: ::c_int = 24; /* Too many open files */ |
| 390 |
pub const ENOTTY: ::c_int = 25; /* Not a typewriter */ |
| 391 |
pub const ETXTBSY: ::c_int = 26; /* Text file busy */ |
| 392 |
pub const EFBIG: ::c_int = 27; /* File too large */ |
| 393 |
pub const ENOSPC: ::c_int = 28; /* No space left on device */ |
| 394 |
pub const ESPIPE: ::c_int = 29; /* Illegal seek */ |
| 395 |
pub const EROFS: ::c_int = 30; /* Read-only file system */ |
| 396 |
pub const EMLINK: ::c_int = 31; /* Too many links */ |
| 397 |
pub const EPIPE: ::c_int = 32; /* Broken pipe */ |
| 398 |
pub const EDOM: ::c_int = 33; /* Math argument out of domain of func */ |
| 399 |
pub const ERANGE: ::c_int = 34; /* Math result not representable */ |
| 400 |
pub const EDEADLK: ::c_int = 35; /* Resource deadlock would occur */ |
| 401 |
pub const ENAMETOOLONG: ::c_int = 36; /* File name too long */ |
| 402 |
pub const ENOLCK: ::c_int = 37; /* No record locks available */ |
| 403 |
pub const ENOSYS: ::c_int = 38; /* Function not implemented */ |
| 404 |
pub const ENOTEMPTY: ::c_int = 39; /* Directory not empty */ |
| 405 |
pub const ELOOP: ::c_int = 40; /* Too many symbolic links encountered */ |
| 406 |
pub const EWOULDBLOCK: ::c_int = 41; /* Operation would block */ |
| 407 |
pub const ENOMSG: ::c_int = 42; /* No message of desired type */ |
| 408 |
pub const EIDRM: ::c_int = 43; /* Identifier removed */ |
| 409 |
pub const ECHRNG: ::c_int = 44; /* Channel number out of range */ |
| 410 |
pub const EL2NSYNC: ::c_int = 45; /* Level 2 not synchronized */ |
| 411 |
pub const EL3HLT: ::c_int = 46; /* Level 3 halted */ |
| 412 |
pub const EL3RST: ::c_int = 47; /* Level 3 reset */ |
| 413 |
pub const ELNRNG: ::c_int = 48; /* Link number out of range */ |
| 414 |
pub const EUNATCH: ::c_int = 49; /* Protocol driver not attached */ |
| 415 |
pub const ENOCSI: ::c_int = 50; /* No CSI structure available */ |
| 416 |
pub const EL2HLT: ::c_int = 51; /* Level 2 halted */ |
| 417 |
pub const EBADE: ::c_int = 52; /* Invalid exchange */ |
| 418 |
pub const EBADR: ::c_int = 53; /* Invalid request descriptor */ |
| 419 |
pub const EXFULL: ::c_int = 54; /* Exchange full */ |
| 420 |
pub const ENOANO: ::c_int = 55; /* No anode */ |
| 421 |
pub const EBADRQC: ::c_int = 56; /* Invalid request code */ |
| 422 |
pub const EBADSLT: ::c_int = 57; /* Invalid slot */ |
| 423 |
pub const EDEADLOCK: ::c_int = 58; /* Resource deadlock would occur */ |
| 424 |
pub const EBFONT: ::c_int = 59; /* Bad font file format */ |
| 425 |
pub const ENOSTR: ::c_int = 60; /* Device not a stream */ |
| 426 |
pub const ENODATA: ::c_int = 61; /* No data available */ |
| 427 |
pub const ETIME: ::c_int = 62; /* Timer expired */ |
| 428 |
pub const ENOSR: ::c_int = 63; /* Out of streams resources */ |
| 429 |
pub const ENONET: ::c_int = 64; /* Machine is not on the network */ |
| 430 |
pub const ENOPKG: ::c_int = 65; /* Package not installed */ |
| 431 |
pub const EREMOTE: ::c_int = 66; /* Object is remote */ |
| 432 |
pub const ENOLINK: ::c_int = 67; /* Link has been severed */ |
| 433 |
pub const EADV: ::c_int = 68; /* Advertise error */ |
| 434 |
pub const ESRMNT: ::c_int = 69; /* Srmount error */ |
| 435 |
pub const ECOMM: ::c_int = 70; /* Communication error on send */ |
| 436 |
pub const EPROTO: ::c_int = 71; /* Protocol error */ |
| 437 |
pub const EMULTIHOP: ::c_int = 72; /* Multihop attempted */ |
| 438 |
pub const EDOTDOT: ::c_int = 73; /* RFS specific error */ |
| 439 |
pub const EBADMSG: ::c_int = 74; /* Not a data message */ |
| 440 |
pub const EOVERFLOW: ::c_int = 75; /* Value too large for defined data type */ |
| 441 |
pub const ENOTUNIQ: ::c_int = 76; /* Name not unique on network */ |
| 442 |
pub const EBADFD: ::c_int = 77; /* File descriptor in bad state */ |
| 443 |
pub const EREMCHG: ::c_int = 78; /* Remote address changed */ |
| 444 |
pub const ELIBACC: ::c_int = 79; /* Can not access a needed shared library */ |
| 445 |
pub const ELIBBAD: ::c_int = 80; /* Accessing a corrupted shared library */ |
| 446 |
pub const ELIBSCN: ::c_int = 81; /* .lib section in a.out corrupted */ |
| 447 |
/* Attempting to link in too many shared libraries */ |
| 448 |
pub const ELIBMAX: ::c_int = 82; |
| 449 |
pub const ELIBEXEC: ::c_int = 83; /* Cannot exec a shared library directly */ |
| 450 |
pub const EILSEQ: ::c_int = 84; /* Illegal byte sequence */ |
| 451 |
/* Interrupted system call should be restarted */ |
| 452 |
pub const ERESTART: ::c_int = 85; |
| 453 |
pub const ESTRPIPE: ::c_int = 86; /* Streams pipe error */ |
| 454 |
pub const EUSERS: ::c_int = 87; /* Too many users */ |
| 455 |
pub const ENOTSOCK: ::c_int = 88; /* Socket operation on non-socket */ |
| 456 |
pub const EDESTADDRREQ: ::c_int = 89; /* Destination address required */ |
| 457 |
pub const EMSGSIZE: ::c_int = 90; /* Message too long */ |
| 458 |
pub const EPROTOTYPE: ::c_int = 91; /* Protocol wrong type for socket */ |
| 459 |
pub const ENOPROTOOPT: ::c_int = 92; /* Protocol not available */ |
| 460 |
pub const EPROTONOSUPPORT: ::c_int = 93; /* Protocol not supported */ |
| 461 |
pub const ESOCKTNOSUPPORT: ::c_int = 94; /* Socket type not supported */ |
| 462 |
/* Operation not supported on transport endpoint */ |
| 463 |
pub const EOPNOTSUPP: ::c_int = 95; |
| 464 |
pub const ENOTSUP: ::c_int = EOPNOTSUPP; |
| 465 |
pub const EPFNOSUPPORT: ::c_int = 96; /* Protocol family not supported */ |
| 466 |
/* Address family not supported by protocol */ |
| 467 |
pub const EAFNOSUPPORT: ::c_int = 97; |
| 468 |
pub const EADDRINUSE: ::c_int = 98; /* Address already in use */ |
| 469 |
pub const EADDRNOTAVAIL: ::c_int = 99; /* Cannot assign requested address */ |
| 470 |
pub const ENETDOWN: ::c_int = 100; /* Network is down */ |
| 471 |
pub const ENETUNREACH: ::c_int = 101; /* Network is unreachable */ |
| 472 |
/* Network dropped connection because of reset */ |
| 473 |
pub const ENETRESET: ::c_int = 102; |
| 474 |
pub const ECONNABORTED: ::c_int = 103; /* Software caused connection abort */ |
| 475 |
pub const ECONNRESET: ::c_int = 104; /* Connection reset by peer */ |
| 476 |
pub const ENOBUFS: ::c_int = 105; /* No buffer space available */ |
| 477 |
pub const EISCONN: ::c_int = 106; /* Transport endpoint is already connected */ |
| 478 |
pub const ENOTCONN: ::c_int = 107; /* Transport endpoint is not connected */ |
| 479 |
/* Cannot send after transport endpoint shutdown */ |
| 480 |
pub const ESHUTDOWN: ::c_int = 108; |
| 481 |
pub const ETOOMANYREFS: ::c_int = 109; /* Too many references: cannot splice */ |
| 482 |
pub const ETIMEDOUT: ::c_int = 110; /* Connection timed out */ |
| 483 |
pub const ECONNREFUSED: ::c_int = 111; /* Connection refused */ |
| 484 |
pub const EHOSTDOWN: ::c_int = 112; /* Host is down */ |
| 485 |
pub const EHOSTUNREACH: ::c_int = 113; /* No route to host */ |
| 486 |
pub const EALREADY: ::c_int = 114; /* Operation already in progress */ |
| 487 |
pub const EINPROGRESS: ::c_int = 115; /* Operation now in progress */ |
| 488 |
pub const ESTALE: ::c_int = 116; /* Stale NFS file handle */ |
| 489 |
pub const EUCLEAN: ::c_int = 117; /* Structure needs cleaning */ |
| 490 |
pub const ENOTNAM: ::c_int = 118; /* Not a XENIX named type file */ |
| 491 |
pub const ENAVAIL: ::c_int = 119; /* No XENIX semaphores available */ |
| 492 |
pub const EISNAM: ::c_int = 120; /* Is a named type file */ |
| 493 |
pub const EREMOTEIO: ::c_int = 121; /* Remote I/O error */ |
| 494 |
pub const EDQUOT: ::c_int = 122; /* Quota exceeded */ |
| 495 |
pub const ENOMEDIUM: ::c_int = 123; /* No medium found */ |
| 496 |
pub const EMEDIUMTYPE: ::c_int = 124; /* Wrong medium type */ |
| 497 |
pub const ECANCELED: ::c_int = 125; /* Operation Canceled */ |
| 498 |
pub const ENOKEY: ::c_int = 126; /* Required key not available */ |
| 499 |
pub const EKEYEXPIRED: ::c_int = 127; /* Key has expired */ |
| 500 |
pub const EKEYREVOKED: ::c_int = 128; /* Key has been revoked */ |
| 501 |
pub const EKEYREJECTED: ::c_int = 129; /* Key was rejected by service */ |
| 502 |
pub const EOWNERDEAD: ::c_int = 130; /* Owner died */ |
| 503 |
pub const ENOTRECOVERABLE: ::c_int = 131; /* State not recoverable */ |
| 504 |
|
| 505 |
// fcntl.h |
| 506 |
pub const F_DUPFD: ::c_int = 0; |
| 507 |
pub const F_GETFD: ::c_int = 1; |
| 508 |
pub const F_SETFD: ::c_int = 2; |
| 509 |
pub const F_GETFL: ::c_int = 3; |
| 510 |
pub const F_SETFL: ::c_int = 4; |
| 511 |
// FIXME: relibc { |
| 512 |
pub const F_DUPFD_CLOEXEC: ::c_int = ::F_DUPFD; |
| 513 |
// } |
| 514 |
pub const FD_CLOEXEC: ::c_int = 0x0100_0000; |
| 515 |
pub const O_RDONLY: ::c_int = 0x0001_0000; |
| 516 |
pub const O_WRONLY: ::c_int = 0x0002_0000; |
| 517 |
pub const O_RDWR: ::c_int = 0x0003_0000; |
| 518 |
pub const O_ACCMODE: ::c_int = 0x0003_0000; |
| 519 |
pub const O_NONBLOCK: ::c_int = 0x0004_0000; |
| 520 |
pub const O_APPEND: ::c_int = 0x0008_0000; |
| 521 |
pub const O_SHLOCK: ::c_int = 0x0010_0000; |
| 522 |
pub const O_EXLOCK: ::c_int = 0x0020_0000; |
| 523 |
pub const O_ASYNC: ::c_int = 0x0040_0000; |
| 524 |
pub const O_FSYNC: ::c_int = 0x0080_0000; |
| 525 |
pub const O_CLOEXEC: ::c_int = 0x0100_0000; |
| 526 |
pub const O_CREAT: ::c_int = 0x0200_0000; |
| 527 |
pub const O_TRUNC: ::c_int = 0x0400_0000; |
| 528 |
pub const O_EXCL: ::c_int = 0x0800_0000; |
| 529 |
pub const O_DIRECTORY: ::c_int = 0x1000_0000; |
| 530 |
pub const O_PATH: ::c_int = 0x2000_0000; |
| 531 |
pub const O_SYMLINK: ::c_int = 0x4000_0000; |
| 532 |
// Negative to allow it to be used as int |
| 533 |
// FIXME: Fix negative values missing from includes |
| 534 |
pub const O_NOFOLLOW: ::c_int = -0x8000_0000; |
| 535 |
|
| 536 |
// locale.h |
| 537 |
pub const LC_ALL: ::c_int = 0; |
| 538 |
pub const LC_COLLATE: ::c_int = 1; |
| 539 |
pub const LC_CTYPE: ::c_int = 2; |
| 540 |
pub const LC_MESSAGES: ::c_int = 3; |
| 541 |
pub const LC_MONETARY: ::c_int = 4; |
| 542 |
pub const LC_NUMERIC: ::c_int = 5; |
| 543 |
pub const LC_TIME: ::c_int = 6; |
| 544 |
|
| 545 |
// netdb.h |
| 546 |
pub const AI_PASSIVE: ::c_int = 0x0001; |
| 547 |
pub const AI_CANONNAME: ::c_int = 0x0002; |
| 548 |
pub const AI_NUMERICHOST: ::c_int = 0x0004; |
| 549 |
pub const AI_V4MAPPED: ::c_int = 0x0008; |
| 550 |
pub const AI_ALL: ::c_int = 0x0010; |
| 551 |
pub const AI_ADDRCONFIG: ::c_int = 0x0020; |
| 552 |
pub const AI_NUMERICSERV: ::c_int = 0x0400; |
| 553 |
pub const EAI_BADFLAGS: ::c_int = -1; |
| 554 |
pub const EAI_NONAME: ::c_int = -2; |
| 555 |
pub const EAI_AGAIN: ::c_int = -3; |
| 556 |
pub const EAI_FAIL: ::c_int = -4; |
| 557 |
pub const EAI_NODATA: ::c_int = -5; |
| 558 |
pub const EAI_FAMILY: ::c_int = -6; |
| 559 |
pub const EAI_SOCKTYPE: ::c_int = -7; |
| 560 |
pub const EAI_SERVICE: ::c_int = -8; |
| 561 |
pub const EAI_ADDRFAMILY: ::c_int = -9; |
| 562 |
pub const EAI_MEMORY: ::c_int = -10; |
| 563 |
pub const EAI_SYSTEM: ::c_int = -11; |
| 564 |
pub const EAI_OVERFLOW: ::c_int = -12; |
| 565 |
pub const NI_MAXHOST: ::c_int = 1025; |
| 566 |
pub const NI_MAXSERV: ::c_int = 32; |
| 567 |
pub const NI_NUMERICHOST: ::c_int = 0x0001; |
| 568 |
pub const NI_NUMERICSERV: ::c_int = 0x0002; |
| 569 |
pub const NI_NOFQDN: ::c_int = 0x0004; |
| 570 |
pub const NI_NAMEREQD: ::c_int = 0x0008; |
| 571 |
pub const NI_DGRAM: ::c_int = 0x0010; |
| 572 |
|
| 573 |
// netinet/in.h |
| 574 |
// FIXME: relibc { |
| 575 |
pub const IP_TTL: ::c_int = 2; |
| 576 |
pub const IPV6_UNICAST_HOPS: ::c_int = 16; |
| 577 |
pub const IPV6_MULTICAST_IF: ::c_int = 17; |
| 578 |
pub const IPV6_MULTICAST_HOPS: ::c_int = 18; |
| 579 |
pub const IPV6_MULTICAST_LOOP: ::c_int = 19; |
| 580 |
pub const IPV6_ADD_MEMBERSHIP: ::c_int = 20; |
| 581 |
pub const IPV6_DROP_MEMBERSHIP: ::c_int = 21; |
| 582 |
pub const IPV6_V6ONLY: ::c_int = 26; |
| 583 |
pub const IP_MULTICAST_IF: ::c_int = 32; |
| 584 |
pub const IP_MULTICAST_TTL: ::c_int = 33; |
| 585 |
pub const IP_MULTICAST_LOOP: ::c_int = 34; |
| 586 |
pub const IP_ADD_MEMBERSHIP: ::c_int = 35; |
| 587 |
pub const IP_DROP_MEMBERSHIP: ::c_int = 36; |
| 588 |
pub const IPPROTO_RAW: ::c_int = 255; |
| 589 |
// } |
| 590 |
|
| 591 |
// netinet/tcp.h |
| 592 |
pub const TCP_NODELAY: ::c_int = 1; |
| 593 |
// FIXME: relibc { |
| 594 |
pub const TCP_KEEPIDLE: ::c_int = 1; |
| 595 |
// } |
| 596 |
|
| 597 |
// poll.h |
| 598 |
pub const POLLIN: ::c_short = 0x001; |
| 599 |
pub const POLLPRI: ::c_short = 0x002; |
| 600 |
pub const POLLOUT: ::c_short = 0x004; |
| 601 |
pub const POLLERR: ::c_short = 0x008; |
| 602 |
pub const POLLHUP: ::c_short = 0x010; |
| 603 |
pub const POLLNVAL: ::c_short = 0x020; |
| 604 |
pub const POLLRDNORM: ::c_short = 0x040; |
| 605 |
pub const POLLRDBAND: ::c_short = 0x080; |
| 606 |
pub const POLLWRNORM: ::c_short = 0x100; |
| 607 |
pub const POLLWRBAND: ::c_short = 0x200; |
| 608 |
|
| 609 |
// pthread.h |
| 610 |
pub const PTHREAD_MUTEX_NORMAL: ::c_int = 0; |
| 611 |
pub const PTHREAD_MUTEX_RECURSIVE: ::c_int = 1; |
| 612 |
pub const PTHREAD_MUTEX_INITIALIZER: ::pthread_mutex_t = ::pthread_mutex_t { |
| 613 |
bytes: [0; _PTHREAD_MUTEX_SIZE], |
| 614 |
}; |
| 615 |
pub const PTHREAD_COND_INITIALIZER: ::pthread_cond_t = ::pthread_cond_t { |
| 616 |
bytes: [0; _PTHREAD_COND_SIZE], |
| 617 |
}; |
| 618 |
pub const PTHREAD_RWLOCK_INITIALIZER: ::pthread_rwlock_t = ::pthread_rwlock_t { |
| 619 |
bytes: [0; _PTHREAD_RWLOCK_SIZE], |
| 620 |
}; |
| 621 |
pub const PTHREAD_STACK_MIN: ::size_t = 4096; |
| 622 |
|
| 623 |
// signal.h |
| 624 |
pub const SIG_BLOCK: ::c_int = 0; |
| 625 |
pub const SIG_UNBLOCK: ::c_int = 1; |
| 626 |
pub const SIG_SETMASK: ::c_int = 2; |
| 627 |
pub const SIGHUP: ::c_int = 1; |
| 628 |
pub const SIGINT: ::c_int = 2; |
| 629 |
pub const SIGQUIT: ::c_int = 3; |
| 630 |
pub const SIGILL: ::c_int = 4; |
| 631 |
pub const SIGTRAP: ::c_int = 5; |
| 632 |
pub const SIGABRT: ::c_int = 6; |
| 633 |
pub const SIGBUS: ::c_int = 7; |
| 634 |
pub const SIGFPE: ::c_int = 8; |
| 635 |
pub const SIGKILL: ::c_int = 9; |
| 636 |
pub const SIGUSR1: ::c_int = 10; |
| 637 |
pub const SIGSEGV: ::c_int = 11; |
| 638 |
pub const SIGUSR2: ::c_int = 12; |
| 639 |
pub const SIGPIPE: ::c_int = 13; |
| 640 |
pub const SIGALRM: ::c_int = 14; |
| 641 |
pub const SIGTERM: ::c_int = 15; |
| 642 |
pub const SIGSTKFLT: ::c_int = 16; |
| 643 |
pub const SIGCHLD: ::c_int = 17; |
| 644 |
pub const SIGCONT: ::c_int = 18; |
| 645 |
pub const SIGSTOP: ::c_int = 19; |
| 646 |
pub const SIGTSTP: ::c_int = 20; |
| 647 |
pub const SIGTTIN: ::c_int = 21; |
| 648 |
pub const SIGTTOU: ::c_int = 22; |
| 649 |
pub const SIGURG: ::c_int = 23; |
| 650 |
pub const SIGXCPU: ::c_int = 24; |
| 651 |
pub const SIGXFSZ: ::c_int = 25; |
| 652 |
pub const SIGVTALRM: ::c_int = 26; |
| 653 |
pub const SIGPROF: ::c_int = 27; |
| 654 |
pub const SIGWINCH: ::c_int = 28; |
| 655 |
pub const SIGIO: ::c_int = 29; |
| 656 |
pub const SIGPWR: ::c_int = 30; |
| 657 |
pub const SIGSYS: ::c_int = 31; |
| 658 |
pub const NSIG: ::c_int = 32; |
| 659 |
|
| 660 |
pub const SA_NOCLDSTOP: ::c_ulong = 0x00000001; |
| 661 |
pub const SA_NOCLDWAIT: ::c_ulong = 0x00000002; |
| 662 |
pub const SA_SIGINFO: ::c_ulong = 0x00000004; |
| 663 |
pub const SA_RESTORER: ::c_ulong = 0x04000000; |
| 664 |
pub const SA_ONSTACK: ::c_ulong = 0x08000000; |
| 665 |
pub const SA_RESTART: ::c_ulong = 0x10000000; |
| 666 |
pub const SA_NODEFER: ::c_ulong = 0x40000000; |
| 667 |
pub const SA_RESETHAND: ::c_ulong = 0x80000000; |
| 668 |
|
| 669 |
// sys/file.h |
| 670 |
pub const LOCK_SH: ::c_int = 1; |
| 671 |
pub const LOCK_EX: ::c_int = 2; |
| 672 |
pub const LOCK_NB: ::c_int = 4; |
| 673 |
pub const LOCK_UN: ::c_int = 8; |
| 674 |
|
| 675 |
// sys/epoll.h |
| 676 |
pub const EPOLL_CLOEXEC: ::c_int = 0x0100_0000; |
| 677 |
pub const EPOLL_CTL_ADD: ::c_int = 1; |
| 678 |
pub const EPOLL_CTL_DEL: ::c_int = 2; |
| 679 |
pub const EPOLL_CTL_MOD: ::c_int = 3; |
| 680 |
pub const EPOLLIN: ::c_int = 1; |
| 681 |
pub const EPOLLPRI: ::c_int = 0; |
| 682 |
pub const EPOLLOUT: ::c_int = 2; |
| 683 |
pub const EPOLLRDNORM: ::c_int = 0; |
| 684 |
pub const EPOLLNVAL: ::c_int = 0; |
| 685 |
pub const EPOLLRDBAND: ::c_int = 0; |
| 686 |
pub const EPOLLWRNORM: ::c_int = 0; |
| 687 |
pub const EPOLLWRBAND: ::c_int = 0; |
| 688 |
pub const EPOLLMSG: ::c_int = 0; |
| 689 |
pub const EPOLLERR: ::c_int = 0; |
| 690 |
pub const EPOLLHUP: ::c_int = 0; |
| 691 |
pub const EPOLLRDHUP: ::c_int = 0; |
| 692 |
pub const EPOLLEXCLUSIVE: ::c_int = 0; |
| 693 |
pub const EPOLLWAKEUP: ::c_int = 0; |
| 694 |
pub const EPOLLONESHOT: ::c_int = 0; |
| 695 |
pub const EPOLLET: ::c_int = 0; |
| 696 |
|
| 697 |
// sys/stat.h |
| 698 |
pub const S_IFMT: ::c_int = 0o0_170_000; |
| 699 |
pub const S_IFDIR: ::c_int = 0o040_000; |
| 700 |
pub const S_IFCHR: ::c_int = 0o020_000; |
| 701 |
pub const S_IFBLK: ::c_int = 0o060_000; |
| 702 |
pub const S_IFREG: ::c_int = 0o100_000; |
| 703 |
pub const S_IFIFO: ::c_int = 0o010_000; |
| 704 |
pub const S_IFLNK: ::c_int = 0o120_000; |
| 705 |
pub const S_IFSOCK: ::c_int = 0o140_000; |
| 706 |
pub const S_IRWXU: ::c_int = 0o0_700; |
| 707 |
pub const S_IRUSR: ::c_int = 0o0_400; |
| 708 |
pub const S_IWUSR: ::c_int = 0o0_200; |
| 709 |
pub const S_IXUSR: ::c_int = 0o0_100; |
| 710 |
pub const S_IRWXG: ::c_int = 0o0_070; |
| 711 |
pub const S_IRGRP: ::c_int = 0o0_040; |
| 712 |
pub const S_IWGRP: ::c_int = 0o0_020; |
| 713 |
pub const S_IXGRP: ::c_int = 0o0_010; |
| 714 |
pub const S_IRWXO: ::c_int = 0o0_007; |
| 715 |
pub const S_IROTH: ::c_int = 0o0_004; |
| 716 |
pub const S_IWOTH: ::c_int = 0o0_002; |
| 717 |
pub const S_IXOTH: ::c_int = 0o0_001; |
| 718 |
|
| 719 |
// stdlib.h |
| 720 |
pub const EXIT_SUCCESS: ::c_int = 0; |
| 721 |
pub const EXIT_FAILURE: ::c_int = 1; |
| 722 |
|
| 723 |
// sys/ioctl.h |
| 724 |
// FIXME: relibc { |
| 725 |
pub const FIONREAD: ::c_ulong = 0x541B; |
| 726 |
pub const FIONBIO: ::c_ulong = 0x5421; |
| 727 |
pub const FIOCLEX: ::c_ulong = 0x5451; |
| 728 |
// } |
| 729 |
pub const TCGETS: ::c_ulong = 0x5401; |
| 730 |
pub const TCSETS: ::c_ulong = 0x5402; |
| 731 |
pub const TCFLSH: ::c_ulong = 0x540B; |
| 732 |
pub const TIOCSCTTY: ::c_ulong = 0x540E; |
| 733 |
pub const TIOCGPGRP: ::c_ulong = 0x540F; |
| 734 |
pub const TIOCSPGRP: ::c_ulong = 0x5410; |
| 735 |
pub const TIOCGWINSZ: ::c_ulong = 0x5413; |
| 736 |
pub const TIOCSWINSZ: ::c_ulong = 0x5414; |
| 737 |
|
| 738 |
// sys/mman.h |
| 739 |
pub const PROT_NONE: ::c_int = 0x0000; |
| 740 |
pub const PROT_READ: ::c_int = 0x0004; |
| 741 |
pub const PROT_WRITE: ::c_int = 0x0002; |
| 742 |
pub const PROT_EXEC: ::c_int = 0x0001; |
| 743 |
|
| 744 |
pub const MADV_NORMAL: ::c_int = 0; |
| 745 |
pub const MADV_RANDOM: ::c_int = 1; |
| 746 |
pub const MADV_SEQUENTIAL: ::c_int = 2; |
| 747 |
pub const MADV_WILLNEED: ::c_int = 3; |
| 748 |
pub const MADV_DONTNEED: ::c_int = 4; |
| 749 |
|
| 750 |
pub const MAP_SHARED: ::c_int = 0x0001; |
| 751 |
pub const MAP_PRIVATE: ::c_int = 0x0002; |
| 752 |
pub const MAP_ANON: ::c_int = 0x0020; |
| 753 |
pub const MAP_ANONYMOUS: ::c_int = MAP_ANON; |
| 754 |
pub const MAP_FIXED: ::c_int = 0x0010; |
| 755 |
pub const MAP_FAILED: *mut ::c_void = !0 as _; |
| 756 |
|
| 757 |
pub const MS_ASYNC: ::c_int = 0x0001; |
| 758 |
pub const MS_INVALIDATE: ::c_int = 0x0002; |
| 759 |
pub const MS_SYNC: ::c_int = 0x0004; |
| 760 |
|
| 761 |
// sys/select.h |
| 762 |
pub const FD_SETSIZE: usize = 1024; |
| 763 |
|
| 764 |
// sys/socket.h |
| 765 |
pub const AF_INET: ::c_int = 2; |
| 766 |
pub const AF_INET6: ::c_int = 10; |
| 767 |
pub const AF_UNIX: ::c_int = 1; |
| 768 |
pub const AF_UNSPEC: ::c_int = 0; |
| 769 |
pub const PF_INET: ::c_int = 2; |
| 770 |
pub const PF_INET6: ::c_int = 10; |
| 771 |
pub const PF_UNIX: ::c_int = 1; |
| 772 |
pub const PF_UNSPEC: ::c_int = 0; |
| 773 |
pub const MSG_CTRUNC: ::c_int = 8; |
| 774 |
pub const MSG_DONTROUTE: ::c_int = 4; |
| 775 |
pub const MSG_EOR: ::c_int = 128; |
| 776 |
pub const MSG_OOB: ::c_int = 1; |
| 777 |
pub const MSG_PEEK: ::c_int = 2; |
| 778 |
pub const MSG_TRUNC: ::c_int = 32; |
| 779 |
pub const MSG_DONTWAIT: ::c_int = 64; |
| 780 |
pub const MSG_WAITALL: ::c_int = 256; |
| 781 |
pub const SHUT_RD: ::c_int = 0; |
| 782 |
pub const SHUT_WR: ::c_int = 1; |
| 783 |
pub const SHUT_RDWR: ::c_int = 2; |
| 784 |
pub const SO_DEBUG: ::c_int = 1; |
| 785 |
pub const SO_REUSEADDR: ::c_int = 2; |
| 786 |
pub const SO_TYPE: ::c_int = 3; |
| 787 |
pub const SO_ERROR: ::c_int = 4; |
| 788 |
pub const SO_DONTROUTE: ::c_int = 5; |
| 789 |
pub const SO_BROADCAST: ::c_int = 6; |
| 790 |
pub const SO_SNDBUF: ::c_int = 7; |
| 791 |
pub const SO_RCVBUF: ::c_int = 8; |
| 792 |
pub const SO_KEEPALIVE: ::c_int = 9; |
| 793 |
pub const SO_OOBINLINE: ::c_int = 10; |
| 794 |
pub const SO_NO_CHECK: ::c_int = 11; |
| 795 |
pub const SO_PRIORITY: ::c_int = 12; |
| 796 |
pub const SO_LINGER: ::c_int = 13; |
| 797 |
pub const SO_BSDCOMPAT: ::c_int = 14; |
| 798 |
pub const SO_REUSEPORT: ::c_int = 15; |
| 799 |
pub const SO_PASSCRED: ::c_int = 16; |
| 800 |
pub const SO_PEERCRED: ::c_int = 17; |
| 801 |
pub const SO_RCVLOWAT: ::c_int = 18; |
| 802 |
pub const SO_SNDLOWAT: ::c_int = 19; |
| 803 |
pub const SO_RCVTIMEO: ::c_int = 20; |
| 804 |
pub const SO_SNDTIMEO: ::c_int = 21; |
| 805 |
pub const SO_ACCEPTCONN: ::c_int = 30; |
| 806 |
pub const SO_PEERSEC: ::c_int = 31; |
| 807 |
pub const SO_SNDBUFFORCE: ::c_int = 32; |
| 808 |
pub const SO_RCVBUFFORCE: ::c_int = 33; |
| 809 |
pub const SO_PROTOCOL: ::c_int = 38; |
| 810 |
pub const SO_DOMAIN: ::c_int = 39; |
| 811 |
pub const SOCK_STREAM: ::c_int = 1; |
| 812 |
pub const SOCK_DGRAM: ::c_int = 2; |
| 813 |
pub const SOCK_NONBLOCK: ::c_int = 0o4_000; |
| 814 |
pub const SOCK_CLOEXEC: ::c_int = 0o2_000_000; |
| 815 |
pub const SOCK_SEQPACKET: ::c_int = 5; |
| 816 |
pub const SOL_SOCKET: ::c_int = 1; |
| 817 |
pub const SOMAXCONN: ::c_int = 128; |
| 818 |
|
| 819 |
// sys/termios.h |
| 820 |
pub const VEOF: usize = 0; |
| 821 |
pub const VEOL: usize = 1; |
| 822 |
pub const VEOL2: usize = 2; |
| 823 |
pub const VERASE: usize = 3; |
| 824 |
pub const VWERASE: usize = 4; |
| 825 |
pub const VKILL: usize = 5; |
| 826 |
pub const VREPRINT: usize = 6; |
| 827 |
pub const VSWTC: usize = 7; |
| 828 |
pub const VINTR: usize = 8; |
| 829 |
pub const VQUIT: usize = 9; |
| 830 |
pub const VSUSP: usize = 10; |
| 831 |
pub const VSTART: usize = 12; |
| 832 |
pub const VSTOP: usize = 13; |
| 833 |
pub const VLNEXT: usize = 14; |
| 834 |
pub const VDISCARD: usize = 15; |
| 835 |
pub const VMIN: usize = 16; |
| 836 |
pub const VTIME: usize = 17; |
| 837 |
pub const NCCS: usize = 32; |
| 838 |
|
| 839 |
pub const IGNBRK: ::tcflag_t = 0o000_001; |
| 840 |
pub const BRKINT: ::tcflag_t = 0o000_002; |
| 841 |
pub const IGNPAR: ::tcflag_t = 0o000_004; |
| 842 |
pub const PARMRK: ::tcflag_t = 0o000_010; |
| 843 |
pub const INPCK: ::tcflag_t = 0o000_020; |
| 844 |
pub const ISTRIP: ::tcflag_t = 0o000_040; |
| 845 |
pub const INLCR: ::tcflag_t = 0o000_100; |
| 846 |
pub const IGNCR: ::tcflag_t = 0o000_200; |
| 847 |
pub const ICRNL: ::tcflag_t = 0o000_400; |
| 848 |
pub const IXON: ::tcflag_t = 0o001_000; |
| 849 |
pub const IXOFF: ::tcflag_t = 0o002_000; |
| 850 |
|
| 851 |
pub const OPOST: ::tcflag_t = 0o000_001; |
| 852 |
pub const ONLCR: ::tcflag_t = 0o000_002; |
| 853 |
pub const OLCUC: ::tcflag_t = 0o000_004; |
| 854 |
pub const OCRNL: ::tcflag_t = 0o000_010; |
| 855 |
pub const ONOCR: ::tcflag_t = 0o000_020; |
| 856 |
pub const ONLRET: ::tcflag_t = 0o000_040; |
| 857 |
pub const OFILL: ::tcflag_t = 0o0000_100; |
| 858 |
pub const OFDEL: ::tcflag_t = 0o0000_200; |
| 859 |
|
| 860 |
pub const B0: speed_t = 0o000_000; |
| 861 |
pub const B50: speed_t = 0o000_001; |
| 862 |
pub const B75: speed_t = 0o000_002; |
| 863 |
pub const B110: speed_t = 0o000_003; |
| 864 |
pub const B134: speed_t = 0o000_004; |
| 865 |
pub const B150: speed_t = 0o000_005; |
| 866 |
pub const B200: speed_t = 0o000_006; |
| 867 |
pub const B300: speed_t = 0o000_007; |
| 868 |
pub const B600: speed_t = 0o000_010; |
| 869 |
pub const B1200: speed_t = 0o000_011; |
| 870 |
pub const B1800: speed_t = 0o000_012; |
| 871 |
pub const B2400: speed_t = 0o000_013; |
| 872 |
pub const B4800: speed_t = 0o000_014; |
| 873 |
pub const B9600: speed_t = 0o000_015; |
| 874 |
pub const B19200: speed_t = 0o000_016; |
| 875 |
pub const B38400: speed_t = 0o000_017; |
| 876 |
|
| 877 |
pub const B57600: speed_t = 0o0_020; |
| 878 |
pub const B115200: speed_t = 0o0_021; |
| 879 |
pub const B230400: speed_t = 0o0_022; |
| 880 |
pub const B460800: speed_t = 0o0_023; |
| 881 |
pub const B500000: speed_t = 0o0_024; |
| 882 |
pub const B576000: speed_t = 0o0_025; |
| 883 |
pub const B921600: speed_t = 0o0_026; |
| 884 |
pub const B1000000: speed_t = 0o0_027; |
| 885 |
pub const B1152000: speed_t = 0o0_030; |
| 886 |
pub const B1500000: speed_t = 0o0_031; |
| 887 |
pub const B2000000: speed_t = 0o0_032; |
| 888 |
pub const B2500000: speed_t = 0o0_033; |
| 889 |
pub const B3000000: speed_t = 0o0_034; |
| 890 |
pub const B3500000: speed_t = 0o0_035; |
| 891 |
pub const B4000000: speed_t = 0o0_036; |
| 892 |
|
| 893 |
pub const CSIZE: ::tcflag_t = 0o001_400; |
| 894 |
pub const CS5: ::tcflag_t = 0o000_000; |
| 895 |
pub const CS6: ::tcflag_t = 0o000_400; |
| 896 |
pub const CS7: ::tcflag_t = 0o001_000; |
| 897 |
pub const CS8: ::tcflag_t = 0o001_400; |
| 898 |
|
| 899 |
pub const CSTOPB: ::tcflag_t = 0o002_000; |
| 900 |
pub const CREAD: ::tcflag_t = 0o004_000; |
| 901 |
pub const PARENB: ::tcflag_t = 0o010_000; |
| 902 |
pub const PARODD: ::tcflag_t = 0o020_000; |
| 903 |
pub const HUPCL: ::tcflag_t = 0o040_000; |
| 904 |
|
| 905 |
pub const CLOCAL: ::tcflag_t = 0o0100000; |
| 906 |
|
| 907 |
pub const ISIG: ::tcflag_t = 0x0000_0080; |
| 908 |
pub const ICANON: ::tcflag_t = 0x0000_0100; |
| 909 |
pub const ECHO: ::tcflag_t = 0x0000_0008; |
| 910 |
pub const ECHOE: ::tcflag_t = 0x0000_0002; |
| 911 |
pub const ECHOK: ::tcflag_t = 0x0000_0004; |
| 912 |
pub const ECHONL: ::tcflag_t = 0x0000_0010; |
| 913 |
pub const NOFLSH: ::tcflag_t = 0x8000_0000; |
| 914 |
pub const TOSTOP: ::tcflag_t = 0x0040_0000; |
| 915 |
pub const IEXTEN: ::tcflag_t = 0x0000_0400; |
| 916 |
|
| 917 |
pub const TCOOFF: ::c_int = 0; |
| 918 |
pub const TCOON: ::c_int = 1; |
| 919 |
pub const TCIOFF: ::c_int = 2; |
| 920 |
pub const TCION: ::c_int = 3; |
| 921 |
|
| 922 |
pub const TCIFLUSH: ::c_int = 0; |
| 923 |
pub const TCOFLUSH: ::c_int = 1; |
| 924 |
pub const TCIOFLUSH: ::c_int = 2; |
| 925 |
|
| 926 |
pub const TCSANOW: ::c_int = 0; |
| 927 |
pub const TCSADRAIN: ::c_int = 1; |
| 928 |
pub const TCSAFLUSH: ::c_int = 2; |
| 929 |
|
| 930 |
// sys/wait.h |
| 931 |
pub const WNOHANG: ::c_int = 1; |
| 932 |
pub const WUNTRACED: ::c_int = 2; |
| 933 |
|
| 934 |
pub const WSTOPPED: ::c_int = 2; |
| 935 |
pub const WEXITED: ::c_int = 4; |
| 936 |
pub const WCONTINUED: ::c_int = 8; |
| 937 |
pub const WNOWAIT: ::c_int = 0x0100_0000; |
| 938 |
|
| 939 |
pub const __WNOTHREAD: ::c_int = 0x2000_0000; |
| 940 |
pub const __WALL: ::c_int = 0x4000_0000; |
| 941 |
#[allow(overflowing_literals)] |
| 942 |
pub const __WCLONE: ::c_int = 0x8000_0000; |
| 943 |
|
| 944 |
// time.h |
| 945 |
pub const CLOCK_REALTIME: ::c_int = 1; |
| 946 |
pub const CLOCK_MONOTONIC: ::c_int = 4; |
| 947 |
pub const CLOCK_PROCESS_CPUTIME_ID: ::clockid_t = 2; |
| 948 |
pub const CLOCKS_PER_SEC: ::clock_t = 1_000_000; |
| 949 |
|
| 950 |
// unistd.h |
| 951 |
// POSIX.1 { |
| 952 |
pub const _SC_ARG_MAX: ::c_int = 0; |
| 953 |
pub const _SC_CHILD_MAX: ::c_int = 1; |
| 954 |
pub const _SC_CLK_TCK: ::c_int = 2; |
| 955 |
pub const _SC_NGROUPS_MAX: ::c_int = 3; |
| 956 |
pub const _SC_OPEN_MAX: ::c_int = 4; |
| 957 |
pub const _SC_STREAM_MAX: ::c_int = 5; |
| 958 |
pub const _SC_TZNAME_MAX: ::c_int = 6; |
| 959 |
// ... |
| 960 |
pub const _SC_VERSION: ::c_int = 29; |
| 961 |
pub const _SC_PAGESIZE: ::c_int = 30; |
| 962 |
pub const _SC_PAGE_SIZE: ::c_int = 30; |
| 963 |
// ... |
| 964 |
pub const _SC_RE_DUP_MAX: ::c_int = 44; |
| 965 |
// ... |
| 966 |
pub const _SC_LOGIN_NAME_MAX: ::c_int = 71; |
| 967 |
pub const _SC_TTY_NAME_MAX: ::c_int = 72; |
| 968 |
// ... |
| 969 |
pub const _SC_SYMLOOP_MAX: ::c_int = 173; |
| 970 |
// ... |
| 971 |
pub const _SC_HOST_NAME_MAX: ::c_int = 180; |
| 972 |
// } POSIX.1 |
| 973 |
|
| 974 |
pub const F_OK: ::c_int = 0; |
| 975 |
pub const R_OK: ::c_int = 4; |
| 976 |
pub const W_OK: ::c_int = 2; |
| 977 |
pub const X_OK: ::c_int = 1; |
| 978 |
|
| 979 |
pub const SEEK_SET: ::c_int = 0; |
| 980 |
pub const SEEK_CUR: ::c_int = 1; |
| 981 |
pub const SEEK_END: ::c_int = 2; |
| 982 |
pub const STDIN_FILENO: ::c_int = 0; |
| 983 |
pub const STDOUT_FILENO: ::c_int = 1; |
| 984 |
pub const STDERR_FILENO: ::c_int = 2; |
| 985 |
|
| 986 |
pub const _PC_LINK_MAX: ::c_int = 0; |
| 987 |
pub const _PC_MAX_CANON: ::c_int = 1; |
| 988 |
pub const _PC_MAX_INPUT: ::c_int = 2; |
| 989 |
pub const _PC_NAME_MAX: ::c_int = 3; |
| 990 |
pub const _PC_PATH_MAX: ::c_int = 4; |
| 991 |
pub const _PC_PIPE_BUF: ::c_int = 5; |
| 992 |
pub const _PC_CHOWN_RESTRICTED: ::c_int = 6; |
| 993 |
pub const _PC_NO_TRUNC: ::c_int = 7; |
| 994 |
pub const _PC_VDISABLE: ::c_int = 8; |
| 995 |
pub const _PC_SYNC_IO: ::c_int = 9; |
| 996 |
pub const _PC_ASYNC_IO: ::c_int = 10; |
| 997 |
pub const _PC_PRIO_IO: ::c_int = 11; |
| 998 |
pub const _PC_SOCK_MAXBUF: ::c_int = 12; |
| 999 |
pub const _PC_FILESIZEBITS: ::c_int = 13; |
| 1000 |
pub const _PC_REC_INCR_XFER_SIZE: ::c_int = 14; |
| 1001 |
pub const _PC_REC_MAX_XFER_SIZE: ::c_int = 15; |
| 1002 |
pub const _PC_REC_MIN_XFER_SIZE: ::c_int = 16; |
| 1003 |
pub const _PC_REC_XFER_ALIGN: ::c_int = 17; |
| 1004 |
pub const _PC_ALLOC_SIZE_MIN: ::c_int = 18; |
| 1005 |
pub const _PC_SYMLINK_MAX: ::c_int = 19; |
| 1006 |
pub const _PC_2_SYMLINKS: ::c_int = 20; |
| 1007 |
|
| 1008 |
pub const PRIO_PROCESS: ::c_int = 0; |
| 1009 |
pub const PRIO_PGRP: ::c_int = 1; |
| 1010 |
pub const PRIO_USER: ::c_int = 2; |
| 1011 |
|
| 1012 |
// wait.h |
| 1013 |
f! { |
| 1014 |
pub fn FD_CLR(fd: ::c_int, set: *mut fd_set) -> () { |
| 1015 |
let fd = fd as usize; |
| 1016 |
let size = ::mem::size_of_val(&(*set).fds_bits[0]) * 8; |
| 1017 |
(*set).fds_bits[fd / size] &= !(1 << (fd % size)); |
| 1018 |
return |
| 1019 |
} |
| 1020 |
|
| 1021 |
pub fn FD_ISSET(fd: ::c_int, set: *const fd_set) -> bool { |
| 1022 |
let fd = fd as usize; |
| 1023 |
let size = ::mem::size_of_val(&(*set).fds_bits[0]) * 8; |
| 1024 |
return ((*set).fds_bits[fd / size] & (1 << (fd % size))) != 0 |
| 1025 |
} |
| 1026 |
|
| 1027 |
pub fn FD_SET(fd: ::c_int, set: *mut fd_set) -> () { |
| 1028 |
let fd = fd as usize; |
| 1029 |
let size = ::mem::size_of_val(&(*set).fds_bits[0]) * 8; |
| 1030 |
(*set).fds_bits[fd / size] |= 1 << (fd % size); |
| 1031 |
return |
| 1032 |
} |
| 1033 |
|
| 1034 |
pub fn FD_ZERO(set: *mut fd_set) -> () { |
| 1035 |
for slot in (*set).fds_bits.iter_mut() { |
| 1036 |
*slot = 0; |
| 1037 |
} |
| 1038 |
} |
| 1039 |
} |
| 1040 |
|
| 1041 |
safe_f! { |
| 1042 |
pub {const} fn WIFSTOPPED(status: ::c_int) -> bool { |
| 1043 |
(status & 0xff) == 0x7f |
| 1044 |
} |
| 1045 |
|
| 1046 |
pub {const} fn WSTOPSIG(status: ::c_int) -> ::c_int { |
| 1047 |
(status >> 8) & 0xff |
| 1048 |
} |
| 1049 |
|
| 1050 |
pub {const} fn WIFCONTINUED(status: ::c_int) -> bool { |
| 1051 |
status == 0xffff |
| 1052 |
} |
| 1053 |
|
| 1054 |
pub {const} fn WIFSIGNALED(status: ::c_int) -> bool { |
| 1055 |
((status & 0x7f) + 1) as i8 >= 2 |
| 1056 |
} |
| 1057 |
|
| 1058 |
pub {const} fn WTERMSIG(status: ::c_int) -> ::c_int { |
| 1059 |
status & 0x7f |
| 1060 |
} |
| 1061 |
|
| 1062 |
pub {const} fn WIFEXITED(status: ::c_int) -> bool { |
| 1063 |
(status & 0x7f) == 0 |
| 1064 |
} |
| 1065 |
|
| 1066 |
pub {const} fn WEXITSTATUS(status: ::c_int) -> ::c_int { |
| 1067 |
(status >> 8) & 0xff |
| 1068 |
} |
| 1069 |
|
| 1070 |
pub {const} fn WCOREDUMP(status: ::c_int) -> bool { |
| 1071 |
(status & 0x80) != 0 |
| 1072 |
} |
| 1073 |
} |
| 1074 |
|
| 1075 |
extern "C" { |
| 1076 |
// errno.h |
| 1077 |
pub fn __errno_location() -> *mut ::c_int; |
| 1078 |
pub fn strerror_r(errnum: ::c_int, buf: *mut c_char, buflen: ::size_t) -> ::c_int; |
| 1079 |
|
| 1080 |
// unistd.h |
| 1081 |
pub fn pipe2(fds: *mut ::c_int, flags: ::c_int) -> ::c_int; |
| 1082 |
pub fn getdtablesize() -> ::c_int; |
| 1083 |
|
| 1084 |
// grp.h |
| 1085 |
pub fn getgrent() -> *mut ::group; |
| 1086 |
pub fn setgrent(); |
| 1087 |
pub fn endgrent(); |
| 1088 |
pub fn getgrgid(gid: ::gid_t) -> *mut ::group; |
| 1089 |
pub fn getgrgid_r( |
| 1090 |
gid: ::gid_t, |
| 1091 |
grp: *mut ::group, |
| 1092 |
buf: *mut ::c_char, |
| 1093 |
buflen: ::size_t, |
| 1094 |
result: *mut *mut ::group, |
| 1095 |
) -> ::c_int; |
| 1096 |
pub fn getgrnam(name: *const ::c_char) -> *mut ::group; |
| 1097 |
pub fn getgrnam_r( |
| 1098 |
name: *const ::c_char, |
| 1099 |
grp: *mut ::group, |
| 1100 |
buf: *mut ::c_char, |
| 1101 |
buflen: ::size_t, |
| 1102 |
result: *mut *mut ::group, |
| 1103 |
) -> ::c_int; |
| 1104 |
pub fn getgrouplist( |
| 1105 |
user: *const ::c_char, |
| 1106 |
group: ::gid_t, |
| 1107 |
groups: *mut ::gid_t, |
| 1108 |
ngroups: *mut ::c_int, |
| 1109 |
) -> ::c_int; |
| 1110 |
|
| 1111 |
// malloc.h |
| 1112 |
pub fn memalign(align: ::size_t, size: ::size_t) -> *mut ::c_void; |
| 1113 |
|
| 1114 |
// netdb.h |
| 1115 |
pub fn getnameinfo( |
| 1116 |
addr: *const ::sockaddr, |
| 1117 |
addrlen: ::socklen_t, |
| 1118 |
host: *mut ::c_char, |
| 1119 |
hostlen: ::socklen_t, |
| 1120 |
serv: *mut ::c_char, |
| 1121 |
servlen: ::socklen_t, |
| 1122 |
flags: ::c_int, |
| 1123 |
) -> ::c_int; |
| 1124 |
|
| 1125 |
// pthread.h |
| 1126 |
pub fn pthread_atfork( |
| 1127 |
prepare: ::Option<unsafe extern "C" fn()>, |
| 1128 |
parent: ::Option<unsafe extern "C" fn()>, |
| 1129 |
child: ::Option<unsafe extern "C" fn()>, |
| 1130 |
) -> ::c_int; |
| 1131 |
pub fn pthread_create( |
| 1132 |
tid: *mut ::pthread_t, |
| 1133 |
attr: *const ::pthread_attr_t, |
| 1134 |
start: extern "C" fn(*mut ::c_void) -> *mut ::c_void, |
| 1135 |
arg: *mut ::c_void, |
| 1136 |
) -> ::c_int; |
| 1137 |
pub fn pthread_condattr_setclock( |
| 1138 |
attr: *mut pthread_condattr_t, |
| 1139 |
clock_id: ::clockid_t, |
| 1140 |
) -> ::c_int; |
| 1141 |
|
| 1142 |
//pty.h |
| 1143 |
pub fn openpty( |
| 1144 |
amaster: *mut ::c_int, |
| 1145 |
aslave: *mut ::c_int, |
| 1146 |
name: *mut ::c_char, |
| 1147 |
termp: *const termios, |
| 1148 |
winp: *const ::winsize, |
| 1149 |
) -> ::c_int; |
| 1150 |
|
| 1151 |
// pwd.h |
| 1152 |
pub fn getpwent() -> *mut passwd; |
| 1153 |
pub fn setpwent(); |
| 1154 |
pub fn endpwent(); |
| 1155 |
pub fn getpwnam_r( |
| 1156 |
name: *const ::c_char, |
| 1157 |
pwd: *mut passwd, |
| 1158 |
buf: *mut ::c_char, |
| 1159 |
buflen: ::size_t, |
| 1160 |
result: *mut *mut passwd, |
| 1161 |
) -> ::c_int; |
| 1162 |
pub fn getpwuid_r( |
| 1163 |
uid: ::uid_t, |
| 1164 |
pwd: *mut passwd, |
| 1165 |
buf: *mut ::c_char, |
| 1166 |
buflen: ::size_t, |
| 1167 |
result: *mut *mut passwd, |
| 1168 |
) -> ::c_int; |
| 1169 |
|
| 1170 |
// signal.h |
| 1171 |
pub fn pthread_sigmask( |
| 1172 |
how: ::c_int, |
| 1173 |
set: *const ::sigset_t, |
| 1174 |
oldset: *mut ::sigset_t, |
| 1175 |
) -> ::c_int; |
| 1176 |
pub fn pthread_cancel(thread: ::pthread_t) -> ::c_int; |
| 1177 |
pub fn pthread_kill(thread: ::pthread_t, sig: ::c_int) -> ::c_int; |
| 1178 |
pub fn sigtimedwait( |
| 1179 |
set: *const sigset_t, |
| 1180 |
sig: *mut siginfo_t, |
| 1181 |
timeout: *const ::timespec, |
| 1182 |
) -> ::c_int; |
| 1183 |
pub fn sigwait(set: *const sigset_t, sig: *mut ::c_int) -> ::c_int; |
| 1184 |
|
| 1185 |
// stdlib.h |
| 1186 |
pub fn getsubopt( |
| 1187 |
optionp: *mut *mut c_char, |
| 1188 |
tokens: *const *mut c_char, |
| 1189 |
valuep: *mut *mut c_char, |
| 1190 |
) -> ::c_int; |
| 1191 |
pub fn reallocarray(ptr: *mut ::c_void, nmemb: ::size_t, size: ::size_t) -> *mut ::c_void; |
| 1192 |
|
| 1193 |
// string.h |
| 1194 |
pub fn explicit_bzero(p: *mut ::c_void, len: ::size_t); |
| 1195 |
pub fn strlcat(dst: *mut ::c_char, src: *const ::c_char, siz: ::size_t) -> ::size_t; |
| 1196 |
pub fn strlcpy(dst: *mut ::c_char, src: *const ::c_char, siz: ::size_t) -> ::size_t; |
| 1197 |
|
| 1198 |
// sys/epoll.h |
| 1199 |
pub fn epoll_create(size: ::c_int) -> ::c_int; |
| 1200 |
pub fn epoll_create1(flags: ::c_int) -> ::c_int; |
| 1201 |
pub fn epoll_wait( |
| 1202 |
epfd: ::c_int, |
| 1203 |
events: *mut ::epoll_event, |
| 1204 |
maxevents: ::c_int, |
| 1205 |
timeout: ::c_int, |
| 1206 |
) -> ::c_int; |
| 1207 |
pub fn epoll_ctl(epfd: ::c_int, op: ::c_int, fd: ::c_int, event: *mut ::epoll_event) |
| 1208 |
-> ::c_int; |
| 1209 |
|
| 1210 |
// sys/ioctl.h |
| 1211 |
pub fn ioctl(fd: ::c_int, request: ::c_ulong, ...) -> ::c_int; |
| 1212 |
|
| 1213 |
// sys/mman.h |
| 1214 |
pub fn madvise(addr: *mut ::c_void, len: ::size_t, advice: ::c_int) -> ::c_int; |
| 1215 |
pub fn msync(addr: *mut ::c_void, len: ::size_t, flags: ::c_int) -> ::c_int; |
| 1216 |
pub fn mprotect(addr: *mut ::c_void, len: ::size_t, prot: ::c_int) -> ::c_int; |
| 1217 |
pub fn shm_open(name: *const c_char, oflag: ::c_int, mode: mode_t) -> ::c_int; |
| 1218 |
pub fn shm_unlink(name: *const ::c_char) -> ::c_int; |
| 1219 |
|
| 1220 |
// sys/resource.h |
| 1221 |
pub fn getpriority(which: ::c_int, who: ::id_t) -> ::c_int; |
| 1222 |
pub fn setpriority(which: ::c_int, who: ::id_t, prio: ::c_int) -> ::c_int; |
| 1223 |
pub fn getrlimit(resource: ::c_int, rlim: *mut ::rlimit) -> ::c_int; |
| 1224 |
pub fn setrlimit(resource: ::c_int, rlim: *const ::rlimit) -> ::c_int; |
| 1225 |
|
| 1226 |
// sys/socket.h |
| 1227 |
pub fn bind(socket: ::c_int, address: *const ::sockaddr, address_len: ::socklen_t) -> ::c_int; |
| 1228 |
pub fn recvfrom( |
| 1229 |
socket: ::c_int, |
| 1230 |
buf: *mut ::c_void, |
| 1231 |
len: ::size_t, |
| 1232 |
flags: ::c_int, |
| 1233 |
addr: *mut ::sockaddr, |
| 1234 |
addrlen: *mut ::socklen_t, |
| 1235 |
) -> ::ssize_t; |
| 1236 |
|
| 1237 |
// sys/stat.h |
| 1238 |
pub fn futimens(fd: ::c_int, times: *const ::timespec) -> ::c_int; |
| 1239 |
|
| 1240 |
// sys/uio.h |
| 1241 |
pub fn readv(fd: ::c_int, iov: *const ::iovec, iovcnt: ::c_int) -> ::ssize_t; |
| 1242 |
pub fn writev(fd: ::c_int, iov: *const ::iovec, iovcnt: ::c_int) -> ::ssize_t; |
| 1243 |
|
| 1244 |
// sys/utsname.h |
| 1245 |
pub fn uname(utsname: *mut utsname) -> ::c_int; |
| 1246 |
|
| 1247 |
// time.h |
| 1248 |
pub fn gettimeofday(tp: *mut ::timeval, tz: *mut ::timezone) -> ::c_int; |
| 1249 |
pub fn clock_gettime(clk_id: ::clockid_t, tp: *mut ::timespec) -> ::c_int; |
| 1250 |
|
| 1251 |
// utmp.h |
| 1252 |
pub fn login_tty(fd: ::c_int) -> ::c_int; |
| 1253 |
} |
| 1254 |
|
| 1255 |
cfg_if! { |
| 1256 |
if #[cfg(feature = "extra_traits")] { |
| 1257 |
impl PartialEq for dirent { |
| 1258 |
fn eq(&self, other: &dirent) -> bool { |
| 1259 |
self.d_ino == other.d_ino |
| 1260 |
&& self.d_off == other.d_off |
| 1261 |
&& self.d_reclen == other.d_reclen |
| 1262 |
&& self.d_type == other.d_type |
| 1263 |
&& self |
| 1264 |
.d_name |
| 1265 |
.iter() |
| 1266 |
.zip(other.d_name.iter()) |
| 1267 |
.all(|(a,b)| a == b) |
| 1268 |
} |
| 1269 |
} |
| 1270 |
|
| 1271 |
impl Eq for dirent {} |
| 1272 |
|
| 1273 |
impl ::fmt::Debug for dirent { |
| 1274 |
fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { |
| 1275 |
f.debug_struct("dirent") |
| 1276 |
.field("d_ino", &self.d_ino) |
| 1277 |
.field("d_off", &self.d_off) |
| 1278 |
.field("d_reclen", &self.d_reclen) |
| 1279 |
.field("d_type", &self.d_type) |
| 1280 |
// FIXME: .field("d_name", &self.d_name) |
| 1281 |
.finish() |
| 1282 |
} |
| 1283 |
} |
| 1284 |
|
| 1285 |
impl ::hash::Hash for dirent { |
| 1286 |
fn hash<H: ::hash::Hasher>(&self, state: &mut H) { |
| 1287 |
self.d_ino.hash(state); |
| 1288 |
self.d_off.hash(state); |
| 1289 |
self.d_reclen.hash(state); |
| 1290 |
self.d_type.hash(state); |
| 1291 |
self.d_name.hash(state); |
| 1292 |
} |
| 1293 |
} |
| 1294 |
|
| 1295 |
impl PartialEq for sockaddr_un { |
| 1296 |
fn eq(&self, other: &sockaddr_un) -> bool { |
| 1297 |
self.sun_family == other.sun_family |
| 1298 |
&& self |
| 1299 |
.sun_path |
| 1300 |
.iter() |
| 1301 |
.zip(other.sun_path.iter()) |
| 1302 |
.all(|(a,b)| a == b) |
| 1303 |
} |
| 1304 |
} |
| 1305 |
|
| 1306 |
impl Eq for sockaddr_un {} |
| 1307 |
|
| 1308 |
impl ::fmt::Debug for sockaddr_un { |
| 1309 |
fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { |
| 1310 |
f.debug_struct("sockaddr_un") |
| 1311 |
.field("sun_family", &self.sun_family) |
| 1312 |
// FIXME: .field("sun_path", &self.sun_path) |
| 1313 |
.finish() |
| 1314 |
} |
| 1315 |
} |
| 1316 |
|
| 1317 |
impl ::hash::Hash for sockaddr_un { |
| 1318 |
fn hash<H: ::hash::Hasher>(&self, state: &mut H) { |
| 1319 |
self.sun_family.hash(state); |
| 1320 |
self.sun_path.hash(state); |
| 1321 |
} |
| 1322 |
} |
| 1323 |
|
| 1324 |
impl PartialEq for sockaddr_storage { |
| 1325 |
fn eq(&self, other: &sockaddr_storage) -> bool { |
| 1326 |
self.ss_family == other.ss_family |
| 1327 |
&& self.__ss_align == self.__ss_align |
| 1328 |
&& self |
| 1329 |
.__ss_padding |
| 1330 |
.iter() |
| 1331 |
.zip(other.__ss_padding.iter()) |
| 1332 |
.all(|(a,b)| a == b) |
| 1333 |
} |
| 1334 |
} |
| 1335 |
|
| 1336 |
impl Eq for sockaddr_storage {} |
| 1337 |
|
| 1338 |
impl ::fmt::Debug for sockaddr_storage { |
| 1339 |
fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { |
| 1340 |
f.debug_struct("sockaddr_storage") |
| 1341 |
.field("ss_family", &self.ss_family) |
| 1342 |
.field("__ss_align", &self.__ss_align) |
| 1343 |
// FIXME: .field("__ss_padding", &self.__ss_padding) |
| 1344 |
.finish() |
| 1345 |
} |
| 1346 |
} |
| 1347 |
|
| 1348 |
impl ::hash::Hash for sockaddr_storage { |
| 1349 |
fn hash<H: ::hash::Hasher>(&self, state: &mut H) { |
| 1350 |
self.ss_family.hash(state); |
| 1351 |
self.__ss_padding.hash(state); |
| 1352 |
self.__ss_align.hash(state); |
| 1353 |
} |
| 1354 |
} |
| 1355 |
|
| 1356 |
impl PartialEq for utsname { |
| 1357 |
fn eq(&self, other: &utsname) -> bool { |
| 1358 |
self.sysname |
| 1359 |
.iter() |
| 1360 |
.zip(other.sysname.iter()) |
| 1361 |
.all(|(a, b)| a == b) |
| 1362 |
&& self |
| 1363 |
.nodename |
| 1364 |
.iter() |
| 1365 |
.zip(other.nodename.iter()) |
| 1366 |
.all(|(a, b)| a == b) |
| 1367 |
&& self |
| 1368 |
.release |
| 1369 |
.iter() |
| 1370 |
.zip(other.release.iter()) |
| 1371 |
.all(|(a, b)| a == b) |
| 1372 |
&& self |
| 1373 |
.version |
| 1374 |
.iter() |
| 1375 |
.zip(other.version.iter()) |
| 1376 |
.all(|(a, b)| a == b) |
| 1377 |
&& self |
| 1378 |
.machine |
| 1379 |
.iter() |
| 1380 |
.zip(other.machine.iter()) |
| 1381 |
.all(|(a, b)| a == b) |
| 1382 |
&& self |
| 1383 |
.domainname |
| 1384 |
.iter() |
| 1385 |
.zip(other.domainname.iter()) |
| 1386 |
.all(|(a, b)| a == b) |
| 1387 |
} |
| 1388 |
} |
| 1389 |
|
| 1390 |
impl Eq for utsname {} |
| 1391 |
|
| 1392 |
impl ::fmt::Debug for utsname { |
| 1393 |
fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { |
| 1394 |
f.debug_struct("utsname") |
| 1395 |
// FIXME: .field("sysname", &self.sysname) |
| 1396 |
// FIXME: .field("nodename", &self.nodename) |
| 1397 |
// FIXME: .field("release", &self.release) |
| 1398 |
// FIXME: .field("version", &self.version) |
| 1399 |
// FIXME: .field("machine", &self.machine) |
| 1400 |
// FIXME: .field("domainname", &self.domainname) |
| 1401 |
.finish() |
| 1402 |
} |
| 1403 |
} |
| 1404 |
|
| 1405 |
impl ::hash::Hash for utsname { |
| 1406 |
fn hash<H: ::hash::Hasher>(&self, state: &mut H) { |
| 1407 |
self.sysname.hash(state); |
| 1408 |
self.nodename.hash(state); |
| 1409 |
self.release.hash(state); |
| 1410 |
self.version.hash(state); |
| 1411 |
self.machine.hash(state); |
| 1412 |
self.domainname.hash(state); |
| 1413 |
} |
| 1414 |
} |
| 1415 |
} |
| 1416 |
} |