1 pub type rlim_t = ::uintptr_t; 2 pub type sa_family_t = u8; 3 pub type pthread_key_t = ::c_int; 4 pub type nfds_t = ::c_ulong; 5 pub type tcflag_t = ::c_uint; 6 pub type speed_t = ::c_uchar; 7 pub type c_char = i8; 8 pub type clock_t = i32; 9 pub type clockid_t = i32; 10 pub type suseconds_t = i32; 11 pub type wchar_t = i32; 12 pub type off_t = i64; 13 pub type ino_t = i64; 14 pub type blkcnt_t = i64; 15 pub type blksize_t = i32; 16 pub type dev_t = i32; 17 pub type mode_t = u32; 18 pub type nlink_t = i32; 19 pub type useconds_t = u32; 20 pub type socklen_t = u32; 21 pub type pthread_t = ::uintptr_t; 22 pub type pthread_condattr_t = ::uintptr_t; 23 pub type pthread_mutexattr_t = ::uintptr_t; 24 pub type pthread_rwlockattr_t = ::uintptr_t; 25 pub type sigset_t = u64; 26 pub type fsblkcnt_t = i64; 27 pub type fsfilcnt_t = i64; 28 pub type pthread_attr_t = *mut ::c_void; 29 pub type nl_item = ::c_int; 30 pub type id_t = i32; 31 pub type idtype_t = ::c_uint; 32 pub type fd_mask = u32; 33 34 pub type Elf32_Addr = u32; 35 pub type Elf32_Half = u16; 36 pub type Elf32_Lword = u64; 37 pub type Elf32_Off = u32; 38 pub type Elf32_Sword = i32; 39 pub type Elf32_Word = u32; 40 41 pub type Elf64_Addr = u64; 42 pub type Elf64_Half = u16; 43 pub type Elf64_Lword = u64; 44 pub type Elf64_Off = u64; 45 pub type Elf64_Sword = i32; 46 pub type Elf64_Sxword = i64; 47 pub type Elf64_Word = u32; 48 pub type Elf64_Xword = u64; 49 50 #[cfg_attr(feature = "extra_traits", derive(Debug))] 51 pub enum timezone {} 52 impl ::Copy for timezone {} 53 impl ::Clone for timezone { clone(&self) -> timezone54 fn clone(&self) -> timezone { 55 *self 56 } 57 } 58 59 impl siginfo_t { si_addr(&self) -> *mut ::c_void60 pub unsafe fn si_addr(&self) -> *mut ::c_void { 61 self.si_addr 62 } 63 si_pid(&self) -> ::pid_t64 pub unsafe fn si_pid(&self) -> ::pid_t { 65 self.si_pid 66 } 67 si_uid(&self) -> ::uid_t68 pub unsafe fn si_uid(&self) -> ::uid_t { 69 self.si_uid 70 } 71 si_status(&self) -> ::c_int72 pub unsafe fn si_status(&self) -> ::c_int { 73 self.si_status 74 } 75 } 76 77 s! { 78 pub struct in_addr { 79 pub s_addr: ::in_addr_t, 80 } 81 82 pub struct ip_mreq { 83 pub imr_multiaddr: in_addr, 84 pub imr_interface: in_addr, 85 } 86 87 pub struct sockaddr { 88 pub sa_len: u8, 89 pub sa_family: sa_family_t, 90 pub sa_data: [u8; 30], 91 } 92 93 pub struct sockaddr_in { 94 pub sin_len: u8, 95 pub sin_family: sa_family_t, 96 pub sin_port: ::in_port_t, 97 pub sin_addr: ::in_addr, 98 pub sin_zero: [i8; 24], 99 } 100 101 pub struct sockaddr_in6 { 102 pub sin6_len: u8, 103 pub sin6_family: u8, 104 pub sin6_port: u16, 105 pub sin6_flowinfo: u32, 106 pub sin6_addr: ::in6_addr, 107 pub sin6_scope_id: u32, 108 } 109 110 pub struct addrinfo { 111 pub ai_flags: ::c_int, 112 pub ai_family: ::c_int, 113 pub ai_socktype: ::c_int, 114 pub ai_protocol: ::c_int, 115 pub ai_addrlen: socklen_t, 116 pub ai_canonname: *mut c_char, 117 pub ai_addr: *mut ::sockaddr, 118 pub ai_next: *mut addrinfo, 119 } 120 121 pub struct ifaddrs { 122 pub ifa_next: *mut ifaddrs, 123 pub ifa_name: *mut ::c_char, 124 pub ifa_flags: ::c_uint, 125 pub ifa_addr: *mut ::sockaddr, 126 pub ifa_netmask: *mut ::sockaddr, 127 pub ifa_dstaddr: *mut ::sockaddr, 128 pub ida_data: *mut ::c_void, 129 } 130 131 pub struct fd_set { 132 // size for 1024 bits, and a fd_mask with size u32 133 fds_bits: [fd_mask; 32], 134 } 135 136 pub struct tm { 137 pub tm_sec: ::c_int, 138 pub tm_min: ::c_int, 139 pub tm_hour: ::c_int, 140 pub tm_mday: ::c_int, 141 pub tm_mon: ::c_int, 142 pub tm_year: ::c_int, 143 pub tm_wday: ::c_int, 144 pub tm_yday: ::c_int, 145 pub tm_isdst: ::c_int, 146 pub tm_gmtoff: ::c_int, 147 pub tm_zone: *mut ::c_char, 148 } 149 150 pub struct utsname { 151 pub sysname: [::c_char; 32], 152 pub nodename: [::c_char; 32], 153 pub release: [::c_char; 32], 154 pub version: [::c_char; 32], 155 pub machine: [::c_char; 32], 156 } 157 158 pub struct lconv { 159 pub decimal_point: *mut ::c_char, 160 pub thousands_sep: *mut ::c_char, 161 pub grouping: *mut ::c_char, 162 pub int_curr_symbol: *mut ::c_char, 163 pub currency_symbol: *mut ::c_char, 164 pub mon_decimal_point: *mut ::c_char, 165 pub mon_thousands_sep: *mut ::c_char, 166 pub mon_grouping: *mut ::c_char, 167 pub positive_sign: *mut ::c_char, 168 pub negative_sign: *mut ::c_char, 169 pub int_frac_digits: ::c_char, 170 pub frac_digits: ::c_char, 171 pub p_cs_precedes: ::c_char, 172 pub p_sep_by_space: ::c_char, 173 pub n_cs_precedes: ::c_char, 174 pub n_sep_by_space: ::c_char, 175 pub p_sign_posn: ::c_char, 176 pub n_sign_posn: ::c_char, 177 pub int_p_cs_precedes: ::c_char, 178 pub int_p_sep_by_space: ::c_char, 179 pub int_n_cs_precedes: ::c_char, 180 pub int_n_sep_by_space: ::c_char, 181 pub int_p_sign_posn: ::c_char, 182 pub int_n_sign_posn: ::c_char, 183 } 184 185 pub struct msghdr { 186 pub msg_name: *mut ::c_void, 187 pub msg_namelen: socklen_t, 188 pub msg_iov: *mut ::iovec, 189 pub msg_iovlen: ::c_int, 190 pub msg_control: *mut ::c_void, 191 pub msg_controllen: socklen_t, 192 pub msg_flags: ::c_int, 193 } 194 195 pub struct cmsghdr { 196 pub cmsg_len: ::socklen_t, 197 pub cmsg_level: ::c_int, 198 pub cmsg_type: ::c_int, 199 } 200 201 pub struct Dl_info { 202 pub dli_fname: *const ::c_char, 203 pub dli_fbase: *mut ::c_void, 204 pub dli_sname: *const ::c_char, 205 pub dli_saddr: *mut ::c_void, 206 } 207 208 pub struct termios { 209 pub c_iflag: ::tcflag_t, 210 pub c_oflag: ::tcflag_t, 211 pub c_cflag: ::tcflag_t, 212 pub c_lflag: ::tcflag_t, 213 pub c_line: ::c_char, 214 pub c_ispeed: ::speed_t, 215 pub c_ospeed: ::speed_t, 216 pub c_cc: [::cc_t; ::NCCS], 217 } 218 219 pub struct flock { 220 pub l_type: ::c_short, 221 pub l_whence: ::c_short, 222 pub l_start: ::off_t, 223 pub l_len: ::off_t, 224 pub l_pid: ::pid_t, 225 } 226 227 pub struct stat { 228 pub st_dev: dev_t, 229 pub st_ino: ino_t, 230 pub st_mode: mode_t, 231 pub st_nlink: nlink_t, 232 pub st_uid: ::uid_t, 233 pub st_gid: ::gid_t, 234 pub st_size: off_t, 235 pub st_rdev: dev_t, 236 pub st_blksize: blksize_t, 237 pub st_atime: time_t, 238 pub st_atime_nsec: c_long, 239 pub st_mtime: time_t, 240 pub st_mtime_nsec: c_long, 241 pub st_ctime: time_t, 242 pub st_ctime_nsec: c_long, 243 pub st_crtime: time_t, 244 pub st_crtime_nsec: c_long, 245 pub st_type: u32, 246 pub st_blocks: blkcnt_t, 247 } 248 249 pub struct glob_t { 250 pub gl_pathc: ::size_t, 251 __unused1: ::size_t, 252 pub gl_offs: ::size_t, 253 __unused2: ::size_t, 254 pub gl_pathv: *mut *mut c_char, 255 256 __unused3: *mut ::c_void, 257 __unused4: *mut ::c_void, 258 __unused5: *mut ::c_void, 259 __unused6: *mut ::c_void, 260 __unused7: *mut ::c_void, 261 __unused8: *mut ::c_void, 262 } 263 264 pub struct pthread_mutex_t { 265 flags: u32, 266 lock: i32, 267 unused: i32, 268 owner: i32, 269 owner_count: i32, 270 } 271 272 pub struct pthread_cond_t { 273 flags: u32, 274 unused: i32, 275 mutex: *mut ::c_void, 276 waiter_count: i32, 277 lock: i32, 278 } 279 280 pub struct pthread_rwlock_t { 281 flags: u32, 282 owner: i32, 283 lock_sem: i32, // this is actually a union 284 lock_count: i32, 285 reader_count: i32, 286 writer_count: i32, 287 waiters: [*mut ::c_void; 2], 288 } 289 290 pub struct passwd { 291 pub pw_name: *mut ::c_char, 292 pub pw_passwd: *mut ::c_char, 293 pub pw_uid: ::uid_t, 294 pub pw_gid: ::gid_t, 295 pub pw_dir: *mut ::c_char, 296 pub pw_shell: *mut ::c_char, 297 pub pw_gecos: *mut ::c_char, 298 } 299 300 pub struct statvfs { 301 pub f_bsize: ::c_ulong, 302 pub f_frsize: ::c_ulong, 303 pub f_blocks: ::fsblkcnt_t, 304 pub f_bfree: ::fsblkcnt_t, 305 pub f_bavail: ::fsblkcnt_t, 306 pub f_files: ::fsfilcnt_t, 307 pub f_ffree: ::fsfilcnt_t, 308 pub f_favail: ::fsfilcnt_t, 309 pub f_fsid: ::c_ulong, 310 pub f_flag: ::c_ulong, 311 pub f_namemax: ::c_ulong, 312 } 313 314 pub struct stack_t { 315 pub ss_sp: *mut ::c_void, 316 pub ss_size: ::size_t, 317 pub ss_flags: ::c_int, 318 } 319 320 pub struct siginfo_t { 321 pub si_signo: ::c_int, 322 pub si_code: ::c_int, 323 pub si_errno: ::c_int, 324 pub si_pid: ::pid_t, 325 pub si_uid: ::uid_t, 326 pub si_addr: *mut ::c_void, 327 pub si_status: ::c_int, 328 pub si_band: c_long, 329 pub sigval: *mut ::c_void, 330 } 331 332 pub struct sigaction { 333 pub sa_sigaction: ::sighandler_t, //actually a union with sa_handler 334 pub sa_mask: ::sigset_t, 335 pub sa_flags: ::c_int, 336 sa_userdata: *mut ::c_void, 337 } 338 339 pub struct sem_t { 340 pub type_: i32, 341 pub named_sem_id: i32, // actually a union with unnamed_sem (i32) 342 pub padding: [i32; 2], 343 } 344 345 pub struct ucred { 346 pub pid: ::pid_t, 347 pub uid: ::uid_t, 348 pub gid: ::gid_t, 349 } 350 351 pub struct sockaddr_dl { 352 pub sdl_len: u8, 353 pub sdl_family: u8, 354 pub sdl_e_type: u16, 355 pub sdl_index: u32, 356 pub sdl_type: u8, 357 pub sdl_nlen: u8, 358 pub sdl_alen: u8, 359 pub sdl_slen: u8, 360 pub sdl_data: [u8; 46], 361 } 362 363 pub struct dl_phdr_info { 364 pub dlpi_addr: Elf_Addr, 365 pub dlpi_name: *const ::c_char, 366 pub dlpi_phdr: *const Elf_Phdr, 367 pub dlpi_phnum: Elf_Half, 368 pub dlpi_adds: ::c_ulonglong, 369 pub dlpi_subs: ::c_ulonglong, 370 pub dlpi_tls_modid: usize, 371 pub dlpi_tls_data: *mut ::c_void, 372 } 373 } 374 375 s_no_extra_traits! { 376 pub struct sockaddr_un { 377 pub sun_len: u8, 378 pub sun_family: sa_family_t, 379 pub sun_path: [::c_char; 126] 380 } 381 pub struct sockaddr_storage { 382 pub ss_len: u8, 383 pub ss_family: sa_family_t, 384 __ss_pad1: [u8; 6], 385 __ss_pad2: u64, 386 __ss_pad3: [u8; 112], 387 } 388 pub struct dirent { 389 pub d_dev: dev_t, 390 pub d_pdev: dev_t, 391 pub d_ino: ino_t, 392 pub d_pino: i64, 393 pub d_reclen: ::c_ushort, 394 pub d_name: [::c_char; 1024], // Max length is _POSIX_PATH_MAX 395 } 396 397 pub struct sigevent { 398 pub sigev_notify: ::c_int, 399 pub sigev_signo: ::c_int, 400 pub sigev_value: ::sigval, 401 __unused1: *mut ::c_void, // actually a function pointer 402 pub sigev_notify_attributes: *mut ::pthread_attr_t, 403 } 404 405 pub struct utmpx { 406 pub ut_type: ::c_short, 407 pub ut_tv: ::timeval, 408 pub ut_id: [::c_char; 8], 409 pub ut_pid: ::pid_t, 410 pub ut_user: [::c_char; 32], 411 pub ut_line: [::c_char; 16], 412 pub ut_host: [::c_char; 128], 413 __ut_reserved: [::c_char; 64], 414 } 415 } 416 417 cfg_if! { 418 if #[cfg(feature = "extra_traits")] { 419 impl PartialEq for utmpx { 420 fn eq(&self, other: &utmpx) -> bool { 421 self.ut_type == other.ut_type 422 && self.ut_tv == other.ut_tv 423 && self.ut_id == other.ut_id 424 && self.ut_pid == other.ut_pid 425 && self.ut_user == other.ut_user 426 && self.ut_line == other.ut_line 427 && self.ut_host.iter().zip(other.ut_host.iter()).all(|(a,b)| a == b) 428 && self.__ut_reserved == other.__ut_reserved 429 } 430 } 431 432 impl Eq for utmpx {} 433 434 impl ::fmt::Debug for utmpx { 435 fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { 436 f.debug_struct("utmpx") 437 .field("ut_type", &self.ut_type) 438 .field("ut_tv", &self.ut_tv) 439 .field("ut_id", &self.ut_id) 440 .field("ut_pid", &self.ut_pid) 441 .field("ut_user", &self.ut_user) 442 .field("ut_line", &self.ut_line) 443 .field("ut_host", &self.ut_host) 444 .field("__ut_reserved", &self.__ut_reserved) 445 .finish() 446 } 447 } 448 449 impl ::hash::Hash for utmpx { 450 fn hash<H: ::hash::Hasher>(&self, state: &mut H) { 451 self.ut_type.hash(state); 452 self.ut_tv.hash(state); 453 self.ut_id.hash(state); 454 self.ut_pid.hash(state); 455 self.ut_user.hash(state); 456 self.ut_line.hash(state); 457 self.ut_host.hash(state); 458 self.__ut_reserved.hash(state); 459 } 460 } 461 impl PartialEq for sockaddr_un { 462 fn eq(&self, other: &sockaddr_un) -> bool { 463 self.sun_len == other.sun_len 464 && self.sun_family == other.sun_family 465 && self 466 .sun_path 467 .iter() 468 .zip(other.sun_path.iter()) 469 .all(|(a,b)| a == b) 470 } 471 } 472 impl Eq for sockaddr_un {} 473 impl ::fmt::Debug for sockaddr_un { 474 fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { 475 f.debug_struct("sockaddr_un") 476 .field("sun_len", &self.sun_len) 477 .field("sun_family", &self.sun_family) 478 // FIXME: .field("sun_path", &self.sun_path) 479 .finish() 480 } 481 } 482 impl ::hash::Hash for sockaddr_un { 483 fn hash<H: ::hash::Hasher>(&self, state: &mut H) { 484 self.sun_len.hash(state); 485 self.sun_family.hash(state); 486 self.sun_path.hash(state); 487 } 488 } 489 490 impl PartialEq for sockaddr_storage { 491 fn eq(&self, other: &sockaddr_storage) -> bool { 492 self.ss_len == other.ss_len 493 && self.ss_family == other.ss_family 494 && self 495 .__ss_pad1 496 .iter() 497 .zip(other.__ss_pad1.iter()) 498 .all(|(a, b)| a == b) 499 && self.__ss_pad2 == other.__ss_pad2 500 && self 501 .__ss_pad3 502 .iter() 503 .zip(other.__ss_pad3.iter()) 504 .all(|(a, b)| a == b) 505 } 506 } 507 impl Eq for sockaddr_storage {} 508 impl ::fmt::Debug for sockaddr_storage { 509 fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { 510 f.debug_struct("sockaddr_storage") 511 .field("ss_len", &self.ss_len) 512 .field("ss_family", &self.ss_family) 513 .field("__ss_pad1", &self.__ss_pad1) 514 .field("__ss_pad2", &self.__ss_pad2) 515 // FIXME: .field("__ss_pad3", &self.__ss_pad3) 516 .finish() 517 } 518 } 519 impl ::hash::Hash for sockaddr_storage { 520 fn hash<H: ::hash::Hasher>(&self, state: &mut H) { 521 self.ss_len.hash(state); 522 self.ss_family.hash(state); 523 self.__ss_pad1.hash(state); 524 self.__ss_pad2.hash(state); 525 self.__ss_pad3.hash(state); 526 } 527 } 528 529 impl PartialEq for dirent { 530 fn eq(&self, other: &dirent) -> bool { 531 self.d_dev == other.d_dev 532 && self.d_pdev == other.d_pdev 533 && self.d_ino == other.d_ino 534 && self.d_pino == other.d_pino 535 && self.d_reclen == other.d_reclen 536 && self 537 .d_name 538 .iter() 539 .zip(other.d_name.iter()) 540 .all(|(a,b)| a == b) 541 } 542 } 543 impl Eq for dirent {} 544 impl ::fmt::Debug for dirent { 545 fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { 546 f.debug_struct("dirent") 547 .field("d_dev", &self.d_dev) 548 .field("d_pdev", &self.d_pdev) 549 .field("d_ino", &self.d_ino) 550 .field("d_pino", &self.d_pino) 551 .field("d_reclen", &self.d_reclen) 552 // FIXME: .field("d_name", &self.d_name) 553 .finish() 554 } 555 } 556 impl ::hash::Hash for dirent { 557 fn hash<H: ::hash::Hasher>(&self, state: &mut H) { 558 self.d_dev.hash(state); 559 self.d_pdev.hash(state); 560 self.d_ino.hash(state); 561 self.d_pino.hash(state); 562 self.d_reclen.hash(state); 563 self.d_name.hash(state); 564 } 565 } 566 567 impl PartialEq for sigevent { 568 fn eq(&self, other: &sigevent) -> bool { 569 self.sigev_notify == other.sigev_notify 570 && self.sigev_signo == other.sigev_signo 571 && self.sigev_value == other.sigev_value 572 && self.sigev_notify_attributes 573 == other.sigev_notify_attributes 574 } 575 } 576 impl Eq for sigevent {} 577 impl ::fmt::Debug for sigevent { 578 fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { 579 f.debug_struct("sigevent") 580 .field("sigev_notify", &self.sigev_notify) 581 .field("sigev_signo", &self.sigev_signo) 582 .field("sigev_value", &self.sigev_value) 583 .field("sigev_notify_attributes", 584 &self.sigev_notify_attributes) 585 .finish() 586 } 587 } 588 impl ::hash::Hash for sigevent { 589 fn hash<H: ::hash::Hasher>(&self, state: &mut H) { 590 self.sigev_notify.hash(state); 591 self.sigev_signo.hash(state); 592 self.sigev_value.hash(state); 593 self.sigev_notify_attributes.hash(state); 594 } 595 } 596 } 597 } 598 599 pub const EXIT_FAILURE: ::c_int = 1; 600 pub const EXIT_SUCCESS: ::c_int = 0; 601 pub const RAND_MAX: ::c_int = 2147483647; 602 pub const EOF: ::c_int = -1; 603 pub const SEEK_SET: ::c_int = 0; 604 pub const SEEK_CUR: ::c_int = 1; 605 pub const SEEK_END: ::c_int = 2; 606 pub const _IOFBF: ::c_int = 0; 607 pub const _IONBF: ::c_int = 2; 608 pub const _IOLBF: ::c_int = 1; 609 610 pub const F_DUPFD: ::c_int = 0x0001; 611 pub const F_GETFD: ::c_int = 0x0002; 612 pub const F_SETFD: ::c_int = 0x0004; 613 pub const F_GETFL: ::c_int = 0x0008; 614 pub const F_SETFL: ::c_int = 0x0010; 615 pub const F_GETLK: ::c_int = 0x0020; 616 pub const F_SETLK: ::c_int = 0x0080; 617 pub const F_SETLKW: ::c_int = 0x0100; 618 pub const F_DUPFD_CLOEXEC: ::c_int = 0x0200; 619 620 pub const F_RDLCK: ::c_int = 0x0040; 621 pub const F_UNLCK: ::c_int = 0x0200; 622 pub const F_WRLCK: ::c_int = 0x0400; 623 624 pub const AT_FDCWD: ::c_int = -1; 625 pub const AT_SYMLINK_NOFOLLOW: ::c_int = 0x01; 626 pub const AT_SYMLINK_FOLLOW: ::c_int = 0x02; 627 pub const AT_REMOVEDIR: ::c_int = 0x04; 628 pub const AT_EACCESS: ::c_int = 0x08; 629 630 pub const POLLIN: ::c_short = 0x0001; 631 pub const POLLOUT: ::c_short = 0x0002; 632 pub const POLLRDNORM: ::c_short = POLLIN; 633 pub const POLLWRNORM: ::c_short = POLLOUT; 634 pub const POLLRDBAND: ::c_short = 0x0008; 635 pub const POLLWRBAND: ::c_short = 0x0010; 636 pub const POLLPRI: ::c_short = 0x0020; 637 pub const POLLERR: ::c_short = 0x0004; 638 pub const POLLHUP: ::c_short = 0x0080; 639 pub const POLLNVAL: ::c_short = 0x1000; 640 641 pub const PTHREAD_CREATE_JOINABLE: ::c_int = 0; 642 pub const PTHREAD_CREATE_DETACHED: ::c_int = 1; 643 644 pub const CLOCK_REALTIME: ::c_int = -1; 645 pub const CLOCK_MONOTONIC: ::c_int = 0; 646 647 pub const RLIMIT_CORE: ::c_int = 0; 648 pub const RLIMIT_CPU: ::c_int = 1; 649 pub const RLIMIT_DATA: ::c_int = 2; 650 pub const RLIMIT_FSIZE: ::c_int = 3; 651 pub const RLIMIT_NOFILE: ::c_int = 4; 652 pub const RLIMIT_STACK: ::c_int = 5; 653 pub const RLIMIT_AS: ::c_int = 6; 654 pub const RLIM_INFINITY: ::c_ulong = 0xffffffff; 655 // Haiku specific 656 pub const RLIMIT_NOVMON: ::c_int = 7; 657 pub const RLIM_NLIMITS: ::c_int = 8; 658 659 pub const RUSAGE_SELF: ::c_int = 0; 660 661 pub const RTLD_LAZY: ::c_int = 0; 662 663 pub const NCCS: usize = 11; 664 665 pub const O_RDONLY: ::c_int = 0x0000; 666 pub const O_WRONLY: ::c_int = 0x0001; 667 pub const O_RDWR: ::c_int = 0x0002; 668 pub const O_ACCMODE: ::c_int = 0x0003; 669 670 pub const O_EXCL: ::c_int = 0x0100; 671 pub const O_CREAT: ::c_int = 0x0200; 672 pub const O_TRUNC: ::c_int = 0x0400; 673 pub const O_NOCTTY: ::c_int = 0x1000; 674 pub const O_NOTRAVERSE: ::c_int = 0x2000; 675 676 pub const O_CLOEXEC: ::c_int = 0x00000040; 677 pub const O_NONBLOCK: ::c_int = 0x00000080; 678 pub const O_APPEND: ::c_int = 0x00000800; 679 pub const O_SYNC: ::c_int = 0x00010000; 680 pub const O_RSYNC: ::c_int = 0x00020000; 681 pub const O_DSYNC: ::c_int = 0x00040000; 682 pub const O_NOFOLLOW: ::c_int = 0x00080000; 683 pub const O_NOCACHE: ::c_int = 0x00100000; 684 pub const O_DIRECTORY: ::c_int = 0x00200000; 685 686 pub const S_IFIFO: ::mode_t = 4096; 687 pub const S_IFCHR: ::mode_t = 8192; 688 pub const S_IFBLK: ::mode_t = 24576; 689 pub const S_IFDIR: ::mode_t = 16384; 690 pub const S_IFREG: ::mode_t = 32768; 691 pub const S_IFLNK: ::mode_t = 40960; 692 pub const S_IFSOCK: ::mode_t = 49152; 693 pub const S_IFMT: ::mode_t = 61440; 694 695 pub const S_IRWXU: ::mode_t = 0o00700; 696 pub const S_IRUSR: ::mode_t = 0o00400; 697 pub const S_IWUSR: ::mode_t = 0o00200; 698 pub const S_IXUSR: ::mode_t = 0o00100; 699 pub const S_IRWXG: ::mode_t = 0o00070; 700 pub const S_IRGRP: ::mode_t = 0o00040; 701 pub const S_IWGRP: ::mode_t = 0o00020; 702 pub const S_IXGRP: ::mode_t = 0o00010; 703 pub const S_IRWXO: ::mode_t = 0o00007; 704 pub const S_IROTH: ::mode_t = 0o00004; 705 pub const S_IWOTH: ::mode_t = 0o00002; 706 pub const S_IXOTH: ::mode_t = 0o00001; 707 708 pub const F_OK: ::c_int = 0; 709 pub const R_OK: ::c_int = 4; 710 pub const W_OK: ::c_int = 2; 711 pub const X_OK: ::c_int = 1; 712 pub const STDIN_FILENO: ::c_int = 0; 713 pub const STDOUT_FILENO: ::c_int = 1; 714 pub const STDERR_FILENO: ::c_int = 2; 715 716 pub const SIGHUP: ::c_int = 1; 717 pub const SIGINT: ::c_int = 2; 718 pub const SIGQUIT: ::c_int = 3; 719 pub const SIGILL: ::c_int = 4; 720 pub const SIGCHLD: ::c_int = 5; 721 pub const SIGABRT: ::c_int = 6; 722 pub const SIGPIPE: ::c_int = 7; 723 pub const SIGFPE: ::c_int = 8; 724 pub const SIGKILL: ::c_int = 9; 725 pub const SIGSTOP: ::c_int = 10; 726 pub const SIGSEGV: ::c_int = 11; 727 pub const SIGCONT: ::c_int = 12; 728 pub const SIGTSTP: ::c_int = 13; 729 pub const SIGALRM: ::c_int = 14; 730 pub const SIGTERM: ::c_int = 15; 731 pub const SIGTTIN: ::c_int = 16; 732 pub const SIGTTOU: ::c_int = 17; 733 pub const SIGUSR1: ::c_int = 18; 734 pub const SIGUSR2: ::c_int = 19; 735 pub const SIGWINCH: ::c_int = 20; 736 pub const SIGKILLTHR: ::c_int = 21; 737 pub const SIGTRAP: ::c_int = 22; 738 pub const SIGPOLL: ::c_int = 23; 739 pub const SIGPROF: ::c_int = 24; 740 pub const SIGSYS: ::c_int = 25; 741 pub const SIGURG: ::c_int = 26; 742 pub const SIGVTALRM: ::c_int = 27; 743 pub const SIGXCPU: ::c_int = 28; 744 pub const SIGXFSZ: ::c_int = 29; 745 pub const SIGBUS: ::c_int = 30; 746 747 pub const SIG_BLOCK: ::c_int = 1; 748 pub const SIG_UNBLOCK: ::c_int = 2; 749 pub const SIG_SETMASK: ::c_int = 3; 750 751 pub const SIGEV_NONE: ::c_int = 0; 752 pub const SIGEV_SIGNAL: ::c_int = 1; 753 pub const SIGEV_THREAD: ::c_int = 2; 754 755 pub const EAI_AGAIN: ::c_int = 2; 756 pub const EAI_BADFLAGS: ::c_int = 3; 757 pub const EAI_FAIL: ::c_int = 4; 758 pub const EAI_FAMILY: ::c_int = 5; 759 pub const EAI_MEMORY: ::c_int = 6; 760 pub const EAI_NODATA: ::c_int = 7; 761 pub const EAI_NONAME: ::c_int = 8; 762 pub const EAI_SERVICE: ::c_int = 9; 763 pub const EAI_SOCKTYPE: ::c_int = 10; 764 pub const EAI_SYSTEM: ::c_int = 11; 765 pub const EAI_OVERFLOW: ::c_int = 14; 766 767 pub const PROT_NONE: ::c_int = 0; 768 pub const PROT_READ: ::c_int = 1; 769 pub const PROT_WRITE: ::c_int = 2; 770 pub const PROT_EXEC: ::c_int = 4; 771 772 pub const LC_ALL: ::c_int = 0; 773 pub const LC_COLLATE: ::c_int = 1; 774 pub const LC_CTYPE: ::c_int = 2; 775 pub const LC_MONETARY: ::c_int = 3; 776 pub const LC_NUMERIC: ::c_int = 4; 777 pub const LC_TIME: ::c_int = 5; 778 pub const LC_MESSAGES: ::c_int = 6; 779 780 // FIXME: Haiku does not have MAP_FILE, but libstd/os.rs requires it 781 pub const MAP_FILE: ::c_int = 0x00; 782 pub const MAP_SHARED: ::c_int = 0x01; 783 pub const MAP_PRIVATE: ::c_int = 0x02; 784 pub const MAP_FIXED: ::c_int = 0x04; 785 pub const MAP_ANONYMOUS: ::c_int = 0x08; 786 pub const MAP_NORESERVE: ::c_int = 0x10; 787 pub const MAP_ANON: ::c_int = MAP_ANONYMOUS; 788 789 pub const MAP_FAILED: *mut ::c_void = !0 as *mut ::c_void; 790 791 pub const MS_ASYNC: ::c_int = 0x01; 792 pub const MS_INVALIDATE: ::c_int = 0x04; 793 pub const MS_SYNC: ::c_int = 0x02; 794 795 pub const E2BIG: ::c_int = -2147454975; 796 pub const ECHILD: ::c_int = -2147454974; 797 pub const EDEADLK: ::c_int = -2147454973; 798 pub const EFBIG: ::c_int = -2147454972; 799 pub const EMLINK: ::c_int = -2147454971; 800 pub const ENFILE: ::c_int = -2147454970; 801 pub const ENODEV: ::c_int = -2147454969; 802 pub const ENOLCK: ::c_int = -2147454968; 803 pub const ENOSYS: ::c_int = -2147454967; 804 pub const ENOTTY: ::c_int = -2147454966; 805 pub const ENXIO: ::c_int = -2147454965; 806 pub const ESPIPE: ::c_int = -2147454964; 807 pub const ESRCH: ::c_int = -2147454963; 808 pub const EFPOS: ::c_int = -2147454962; 809 pub const ESIGPARM: ::c_int = -2147454961; 810 pub const EDOM: ::c_int = -2147454960; 811 pub const ERANGE: ::c_int = -2147454959; 812 pub const EPROTOTYPE: ::c_int = -2147454958; 813 pub const EPROTONOSUPPORT: ::c_int = -2147454957; 814 pub const EPFNOSUPPORT: ::c_int = -2147454956; 815 pub const EAFNOSUPPORT: ::c_int = -2147454955; 816 pub const EADDRINUSE: ::c_int = -2147454954; 817 pub const EADDRNOTAVAIL: ::c_int = -2147454953; 818 pub const ENETDOWN: ::c_int = -2147454952; 819 pub const ENETUNREACH: ::c_int = -2147454951; 820 pub const ENETRESET: ::c_int = -2147454950; 821 pub const ECONNABORTED: ::c_int = -2147454949; 822 pub const ECONNRESET: ::c_int = -2147454948; 823 pub const EISCONN: ::c_int = -2147454947; 824 pub const ENOTCONN: ::c_int = -2147454946; 825 pub const ESHUTDOWN: ::c_int = -2147454945; 826 pub const ECONNREFUSED: ::c_int = -2147454944; 827 pub const EHOSTUNREACH: ::c_int = -2147454943; 828 pub const ENOPROTOOPT: ::c_int = -2147454942; 829 pub const ENOBUFS: ::c_int = -2147454941; 830 pub const EINPROGRESS: ::c_int = -2147454940; 831 pub const EALREADY: ::c_int = -2147454939; 832 pub const EILSEQ: ::c_int = -2147454938; 833 pub const ENOMSG: ::c_int = -2147454937; 834 pub const ESTALE: ::c_int = -2147454936; 835 pub const EOVERFLOW: ::c_int = -2147454935; 836 pub const EMSGSIZE: ::c_int = -2147454934; 837 pub const EOPNOTSUPP: ::c_int = -2147454933; 838 pub const ENOTSOCK: ::c_int = -2147454932; 839 pub const EHOSTDOWN: ::c_int = -2147454931; 840 pub const EBADMSG: ::c_int = -2147454930; 841 pub const ECANCELED: ::c_int = -2147454929; 842 pub const EDESTADDRREQ: ::c_int = -2147454928; 843 pub const EDQUOT: ::c_int = -2147454927; 844 pub const EIDRM: ::c_int = -2147454926; 845 pub const EMULTIHOP: ::c_int = -2147454925; 846 pub const ENODATA: ::c_int = -2147454924; 847 pub const ENOLINK: ::c_int = -2147454923; 848 pub const ENOSR: ::c_int = -2147454922; 849 pub const ENOSTR: ::c_int = -2147454921; 850 pub const ENOTSUP: ::c_int = -2147454920; 851 pub const EPROTO: ::c_int = -2147454919; 852 pub const ETIME: ::c_int = -2147454918; 853 pub const ETXTBSY: ::c_int = -2147454917; 854 pub const ENOATTR: ::c_int = -2147454916; 855 856 // INT_MIN 857 pub const ENOMEM: ::c_int = -2147483648; 858 859 // POSIX errors that can be mapped to BeOS error codes 860 pub const EACCES: ::c_int = -2147483646; 861 pub const EINTR: ::c_int = -2147483638; 862 pub const EIO: ::c_int = -2147483647; 863 pub const EBUSY: ::c_int = -2147483634; 864 pub const EFAULT: ::c_int = -2147478783; 865 pub const ETIMEDOUT: ::c_int = -2147483639; 866 pub const EAGAIN: ::c_int = -2147483637; 867 pub const EWOULDBLOCK: ::c_int = -2147483637; 868 pub const EBADF: ::c_int = -2147459072; 869 pub const EEXIST: ::c_int = -2147459070; 870 pub const EINVAL: ::c_int = -2147483643; 871 pub const ENAMETOOLONG: ::c_int = -2147459068; 872 pub const ENOENT: ::c_int = -2147459069; 873 pub const EPERM: ::c_int = -2147483633; 874 pub const ENOTDIR: ::c_int = -2147459067; 875 pub const EISDIR: ::c_int = -2147459063; 876 pub const ENOTEMPTY: ::c_int = -2147459066; 877 pub const ENOSPC: ::c_int = -2147459065; 878 pub const EROFS: ::c_int = -2147459064; 879 pub const EMFILE: ::c_int = -2147459062; 880 pub const EXDEV: ::c_int = -2147459061; 881 pub const ELOOP: ::c_int = -2147459060; 882 pub const ENOEXEC: ::c_int = -2147478782; 883 pub const EPIPE: ::c_int = -2147459059; 884 885 pub const IPPROTO_RAW: ::c_int = 255; 886 887 // These are prefixed with POSIX_ on Haiku 888 pub const MADV_NORMAL: ::c_int = 1; 889 pub const MADV_SEQUENTIAL: ::c_int = 2; 890 pub const MADV_RANDOM: ::c_int = 3; 891 pub const MADV_WILLNEED: ::c_int = 4; 892 pub const MADV_DONTNEED: ::c_int = 5; 893 pub const MADV_FREE: ::c_int = 6; 894 895 // https://github.com/haiku/haiku/blob/master/headers/posix/net/if.h#L80 896 pub const IFF_UP: ::c_int = 0x0001; 897 pub const IFF_BROADCAST: ::c_int = 0x0002; // valid broadcast address 898 pub const IFF_LOOPBACK: ::c_int = 0x0008; 899 pub const IFF_POINTOPOINT: ::c_int = 0x0010; // point-to-point link 900 pub const IFF_NOARP: ::c_int = 0x0040; // no address resolution 901 pub const IFF_AUTOUP: ::c_int = 0x0080; // auto dial 902 pub const IFF_PROMISC: ::c_int = 0x0100; // receive all packets 903 pub const IFF_ALLMULTI: ::c_int = 0x0200; // receive all multicast packets 904 pub const IFF_SIMPLEX: ::c_int = 0x0800; // doesn't receive own transmissions 905 pub const IFF_LINK: ::c_int = 0x1000; // has link 906 pub const IFF_AUTO_CONFIGURED: ::c_int = 0x2000; 907 pub const IFF_CONFIGURING: ::c_int = 0x4000; 908 pub const IFF_MULTICAST: ::c_int = 0x8000; // supports multicast 909 910 pub const AF_UNSPEC: ::c_int = 0; 911 pub const AF_INET: ::c_int = 1; 912 pub const AF_APPLETALK: ::c_int = 2; 913 pub const AF_ROUTE: ::c_int = 3; 914 pub const AF_LINK: ::c_int = 4; 915 pub const AF_INET6: ::c_int = 5; 916 pub const AF_DLI: ::c_int = 6; 917 pub const AF_IPX: ::c_int = 7; 918 pub const AF_NOTIFY: ::c_int = 8; 919 pub const AF_LOCAL: ::c_int = 9; 920 pub const AF_UNIX: ::c_int = AF_LOCAL; 921 pub const AF_BLUETOOTH: ::c_int = 10; 922 923 pub const PF_UNSPEC: ::c_int = AF_UNSPEC; 924 pub const PF_INET: ::c_int = AF_INET; 925 pub const PF_ROUTE: ::c_int = AF_ROUTE; 926 pub const PF_LINK: ::c_int = AF_LINK; 927 pub const PF_INET6: ::c_int = AF_INET6; 928 pub const PF_LOCAL: ::c_int = AF_LOCAL; 929 pub const PF_UNIX: ::c_int = AF_UNIX; 930 pub const PF_BLUETOOTH: ::c_int = AF_BLUETOOTH; 931 932 pub const IP_OPTIONS: ::c_int = 1; 933 pub const IP_HDRINCL: ::c_int = 2; 934 pub const IP_TOS: ::c_int = 3; 935 pub const IP_TTL: ::c_int = 4; 936 pub const IP_RECVOPTS: ::c_int = 5; 937 pub const IP_RECVRETOPTS: ::c_int = 6; 938 pub const IP_RECVDSTADDR: ::c_int = 7; 939 pub const IP_RETOPTS: ::c_int = 8; 940 pub const IP_MULTICAST_IF: ::c_int = 9; 941 pub const IP_MULTICAST_TTL: ::c_int = 10; 942 pub const IP_MULTICAST_LOOP: ::c_int = 11; 943 pub const IP_ADD_MEMBERSHIP: ::c_int = 12; 944 pub const IP_DROP_MEMBERSHIP: ::c_int = 13; 945 pub const IP_BLOCK_SOURCE: ::c_int = 14; 946 pub const IP_UNBLOCK_SOURCE: ::c_int = 15; 947 pub const IP_ADD_SOURCE_MEMBERSHIP: ::c_int = 16; 948 pub const IP_DROP_SOURCE_MEMBERSHIP: ::c_int = 17; 949 950 pub const TCP_NODELAY: ::c_int = 0x01; 951 pub const TCP_MAXSEG: ::c_int = 0x02; 952 pub const TCP_NOPUSH: ::c_int = 0x04; 953 pub const TCP_NOOPT: ::c_int = 0x08; 954 955 pub const IF_NAMESIZE: ::size_t = 32; 956 pub const IFNAMSIZ: ::size_t = IF_NAMESIZE; 957 958 pub const IPV6_MULTICAST_IF: ::c_int = 24; 959 pub const IPV6_MULTICAST_HOPS: ::c_int = 25; 960 pub const IPV6_MULTICAST_LOOP: ::c_int = 26; 961 pub const IPV6_UNICAST_HOPS: ::c_int = 27; 962 pub const IPV6_JOIN_GROUP: ::c_int = 28; 963 pub const IPV6_LEAVE_GROUP: ::c_int = 29; 964 pub const IPV6_V6ONLY: ::c_int = 30; 965 pub const IPV6_PKTINFO: ::c_int = 31; 966 pub const IPV6_RECVPKTINFO: ::c_int = 32; 967 pub const IPV6_HOPLIMIT: ::c_int = 33; 968 pub const IPV6_RECVHOPLIMIT: ::c_int = 34; 969 pub const IPV6_HOPOPTS: ::c_int = 35; 970 pub const IPV6_DSTOPTS: ::c_int = 36; 971 pub const IPV6_RTHDR: ::c_int = 37; 972 973 pub const MSG_OOB: ::c_int = 0x0001; 974 pub const MSG_PEEK: ::c_int = 0x0002; 975 pub const MSG_DONTROUTE: ::c_int = 0x0004; 976 pub const MSG_EOR: ::c_int = 0x0008; 977 pub const MSG_TRUNC: ::c_int = 0x0010; 978 pub const MSG_CTRUNC: ::c_int = 0x0020; 979 pub const MSG_WAITALL: ::c_int = 0x0040; 980 pub const MSG_DONTWAIT: ::c_int = 0x0080; 981 pub const MSG_BCAST: ::c_int = 0x0100; 982 pub const MSG_MCAST: ::c_int = 0x0200; 983 pub const MSG_EOF: ::c_int = 0x0400; 984 pub const MSG_NOSIGNAL: ::c_int = 0x0800; 985 986 pub const SHUT_RD: ::c_int = 0; 987 pub const SHUT_WR: ::c_int = 1; 988 pub const SHUT_RDWR: ::c_int = 2; 989 990 pub const LOCK_SH: ::c_int = 0x01; 991 pub const LOCK_EX: ::c_int = 0x02; 992 pub const LOCK_NB: ::c_int = 0x04; 993 pub const LOCK_UN: ::c_int = 0x08; 994 995 pub const SIGSTKSZ: ::size_t = 16384; 996 997 pub const IOV_MAX: ::c_int = 1024; 998 pub const PATH_MAX: ::c_int = 1024; 999 1000 pub const SA_NOCLDSTOP: ::c_int = 0x01; 1001 pub const SA_NOCLDWAIT: ::c_int = 0x02; 1002 pub const SA_RESETHAND: ::c_int = 0x04; 1003 pub const SA_NODEFER: ::c_int = 0x08; 1004 pub const SA_RESTART: ::c_int = 0x10; 1005 pub const SA_ONSTACK: ::c_int = 0x20; 1006 pub const SA_SIGINFO: ::c_int = 0x40; 1007 pub const SA_NOMASK: ::c_int = SA_NODEFER; 1008 pub const SA_STACK: ::c_int = SA_ONSTACK; 1009 pub const SA_ONESHOT: ::c_int = SA_RESETHAND; 1010 1011 pub const FD_SETSIZE: usize = 1024; 1012 1013 pub const RTLD_LOCAL: ::c_int = 0x0; 1014 pub const RTLD_NOW: ::c_int = 0x1; 1015 pub const RTLD_GLOBAL: ::c_int = 0x2; 1016 pub const RTLD_DEFAULT: *mut ::c_void = 0isize as *mut ::c_void; 1017 1018 pub const BUFSIZ: ::c_uint = 8192; 1019 pub const FILENAME_MAX: ::c_uint = 256; 1020 pub const FOPEN_MAX: ::c_uint = 128; 1021 pub const L_tmpnam: ::c_uint = 512; 1022 pub const TMP_MAX: ::c_uint = 32768; 1023 1024 pub const _PC_CHOWN_RESTRICTED: ::c_int = 1; 1025 pub const _PC_MAX_CANON: ::c_int = 2; 1026 pub const _PC_MAX_INPUT: ::c_int = 3; 1027 pub const _PC_NAME_MAX: ::c_int = 4; 1028 pub const _PC_NO_TRUNC: ::c_int = 5; 1029 pub const _PC_PATH_MAX: ::c_int = 6; 1030 pub const _PC_PIPE_BUF: ::c_int = 7; 1031 pub const _PC_VDISABLE: ::c_int = 8; 1032 pub const _PC_LINK_MAX: ::c_int = 25; 1033 pub const _PC_SYNC_IO: ::c_int = 26; 1034 pub const _PC_ASYNC_IO: ::c_int = 27; 1035 pub const _PC_PRIO_IO: ::c_int = 28; 1036 pub const _PC_SOCK_MAXBUF: ::c_int = 29; 1037 pub const _PC_FILESIZEBITS: ::c_int = 30; 1038 pub const _PC_REC_INCR_XFER_SIZE: ::c_int = 31; 1039 pub const _PC_REC_MAX_XFER_SIZE: ::c_int = 32; 1040 pub const _PC_REC_MIN_XFER_SIZE: ::c_int = 33; 1041 pub const _PC_REC_XFER_ALIGN: ::c_int = 34; 1042 pub const _PC_ALLOC_SIZE_MIN: ::c_int = 35; 1043 pub const _PC_SYMLINK_MAX: ::c_int = 36; 1044 pub const _PC_2_SYMLINKS: ::c_int = 37; 1045 pub const _PC_XATTR_EXISTS: ::c_int = 38; 1046 pub const _PC_XATTR_ENABLED: ::c_int = 39; 1047 1048 pub const FIONBIO: ::c_ulong = 0xbe000000; 1049 pub const FIONREAD: ::c_ulong = 0xbe000001; 1050 pub const FIOSEEKDATA: ::c_ulong = 0xbe000002; 1051 pub const FIOSEEKHOLE: ::c_ulong = 0xbe000003; 1052 1053 pub const _SC_ARG_MAX: ::c_int = 15; 1054 pub const _SC_CHILD_MAX: ::c_int = 16; 1055 pub const _SC_CLK_TCK: ::c_int = 17; 1056 pub const _SC_JOB_CONTROL: ::c_int = 18; 1057 pub const _SC_NGROUPS_MAX: ::c_int = 19; 1058 pub const _SC_OPEN_MAX: ::c_int = 20; 1059 pub const _SC_SAVED_IDS: ::c_int = 21; 1060 pub const _SC_STREAM_MAX: ::c_int = 22; 1061 pub const _SC_TZNAME_MAX: ::c_int = 23; 1062 pub const _SC_VERSION: ::c_int = 24; 1063 pub const _SC_GETGR_R_SIZE_MAX: ::c_int = 25; 1064 pub const _SC_GETPW_R_SIZE_MAX: ::c_int = 26; 1065 pub const _SC_PAGESIZE: ::c_int = 27; 1066 pub const _SC_PAGE_SIZE: ::c_int = 27; 1067 pub const _SC_SEM_NSEMS_MAX: ::c_int = 28; 1068 pub const _SC_SEM_VALUE_MAX: ::c_int = 29; 1069 pub const _SC_SEMAPHORES: ::c_int = 30; 1070 pub const _SC_THREADS: ::c_int = 31; 1071 pub const _SC_IOV_MAX: ::c_int = 32; 1072 pub const _SC_UIO_MAXIOV: ::c_int = 32; 1073 pub const _SC_NPROCESSORS_CONF: ::c_int = 34; 1074 pub const _SC_NPROCESSORS_ONLN: ::c_int = 35; 1075 pub const _SC_ATEXIT_MAX: ::c_int = 37; 1076 pub const _SC_PASS_MAX: ::c_int = 39; 1077 pub const _SC_PHYS_PAGES: ::c_int = 40; 1078 pub const _SC_AVPHYS_PAGES: ::c_int = 41; 1079 pub const _SC_PIPE: ::c_int = 42; 1080 pub const _SC_SELECT: ::c_int = 43; 1081 pub const _SC_POLL: ::c_int = 44; 1082 pub const _SC_MAPPED_FILES: ::c_int = 45; 1083 pub const _SC_THREAD_PROCESS_SHARED: ::c_int = 46; 1084 pub const _SC_THREAD_STACK_MIN: ::c_int = 47; 1085 pub const _SC_THREAD_ATTR_STACKADDR: ::c_int = 48; 1086 pub const _SC_THREAD_ATTR_STACKSIZE: ::c_int = 49; 1087 pub const _SC_THREAD_PRIORITY_SCHEDULING: ::c_int = 50; 1088 pub const _SC_REALTIME_SIGNALS: ::c_int = 51; 1089 pub const _SC_MEMORY_PROTECTION: ::c_int = 52; 1090 pub const _SC_SIGQUEUE_MAX: ::c_int = 53; 1091 pub const _SC_RTSIG_MAX: ::c_int = 54; 1092 pub const _SC_MONOTONIC_CLOCK: ::c_int = 55; 1093 pub const _SC_DELAYTIMER_MAX: ::c_int = 56; 1094 pub const _SC_TIMER_MAX: ::c_int = 57; 1095 pub const _SC_TIMERS: ::c_int = 58; 1096 pub const _SC_CPUTIME: ::c_int = 59; 1097 pub const _SC_THREAD_CPUTIME: ::c_int = 60; 1098 pub const _SC_HOST_NAME_MAX: ::c_int = 61; 1099 pub const _SC_REGEXP: ::c_int = 62; 1100 pub const _SC_SYMLOOP_MAX: ::c_int = 63; 1101 pub const _SC_SHELL: ::c_int = 64; 1102 pub const _SC_TTY_NAME_MAX: ::c_int = 65; 1103 1104 pub const PTHREAD_STACK_MIN: ::size_t = 8192; 1105 1106 pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = pthread_mutex_t { 1107 flags: 0, 1108 lock: 0, 1109 unused: -42, 1110 owner: -1, 1111 owner_count: 0, 1112 }; 1113 pub const PTHREAD_COND_INITIALIZER: pthread_cond_t = pthread_cond_t { 1114 flags: 0, 1115 unused: -42, 1116 mutex: 0 as *mut _, 1117 waiter_count: 0, 1118 lock: 0, 1119 }; 1120 pub const PTHREAD_RWLOCK_INITIALIZER: pthread_rwlock_t = pthread_rwlock_t { 1121 flags: 0, 1122 owner: -1, 1123 lock_sem: 0, 1124 lock_count: 0, 1125 reader_count: 0, 1126 writer_count: 0, 1127 waiters: [0 as *mut _; 2], 1128 }; 1129 1130 pub const PTHREAD_MUTEX_DEFAULT: ::c_int = 0; 1131 pub const PTHREAD_MUTEX_NORMAL: ::c_int = 1; 1132 pub const PTHREAD_MUTEX_ERRORCHECK: ::c_int = 2; 1133 pub const PTHREAD_MUTEX_RECURSIVE: ::c_int = 3; 1134 1135 pub const FIOCLEX: c_ulong = 0; // FIXME: does not exist on Haiku! 1136 1137 pub const RUSAGE_CHILDREN: ::c_int = -1; 1138 1139 pub const SOCK_STREAM: ::c_int = 1; 1140 pub const SOCK_DGRAM: ::c_int = 2; 1141 pub const SOCK_RAW: ::c_int = 3; 1142 pub const SOCK_SEQPACKET: ::c_int = 5; 1143 1144 pub const SOL_SOCKET: ::c_int = -1; 1145 pub const SO_ACCEPTCONN: ::c_int = 0x00000001; 1146 pub const SO_BROADCAST: ::c_int = 0x00000002; 1147 pub const SO_DEBUG: ::c_int = 0x00000004; 1148 pub const SO_DONTROUTE: ::c_int = 0x00000008; 1149 pub const SO_KEEPALIVE: ::c_int = 0x00000010; 1150 pub const SO_OOBINLINE: ::c_int = 0x00000020; 1151 pub const SO_REUSEADDR: ::c_int = 0x00000040; 1152 pub const SO_REUSEPORT: ::c_int = 0x00000080; 1153 pub const SO_USELOOPBACK: ::c_int = 0x00000100; 1154 pub const SO_LINGER: ::c_int = 0x00000200; 1155 pub const SO_SNDBUF: ::c_int = 0x40000001; 1156 pub const SO_SNDLOWAT: ::c_int = 0x40000002; 1157 pub const SO_SNDTIMEO: ::c_int = 0x40000003; 1158 pub const SO_RCVBUF: ::c_int = 0x40000004; 1159 pub const SO_RCVLOWAT: ::c_int = 0x40000005; 1160 pub const SO_RCVTIMEO: ::c_int = 0x40000006; 1161 pub const SO_ERROR: ::c_int = 0x40000007; 1162 pub const SO_TYPE: ::c_int = 0x40000008; 1163 pub const SO_NONBLOCK: ::c_int = 0x40000009; 1164 pub const SO_BINDTODEVICE: ::c_int = 0x4000000a; 1165 pub const SO_PEERCRED: ::c_int = 0x4000000b; 1166 1167 pub const SCM_RIGHTS: ::c_int = 0x01; 1168 1169 pub const NI_MAXHOST: ::size_t = 1025; 1170 1171 pub const WNOHANG: ::c_int = 0x01; 1172 pub const WUNTRACED: ::c_int = 0x02; 1173 pub const WCONTINUED: ::c_int = 0x04; 1174 pub const WEXITED: ::c_int = 0x08; 1175 pub const WSTOPPED: ::c_int = 0x10; 1176 pub const WNOWAIT: ::c_int = 0x20; 1177 1178 pub const CLD_EXITED: ::c_int = 60; 1179 pub const CLD_KILLED: ::c_int = 61; 1180 pub const CLD_DUMPED: ::c_int = 62; 1181 pub const CLD_TRAPPED: ::c_int = 63; 1182 pub const CLD_STOPPED: ::c_int = 64; 1183 pub const CLD_CONTINUED: ::c_int = 65; 1184 1185 pub const P_ALL: idtype_t = 0; 1186 pub const P_PID: idtype_t = 1; 1187 pub const P_PGID: idtype_t = 2; 1188 1189 pub const UTIME_OMIT: c_long = 1000000001; 1190 pub const UTIME_NOW: c_long = 1000000000; 1191 1192 pub const VINTR: usize = 0; 1193 pub const VQUIT: usize = 1; 1194 pub const VERASE: usize = 2; 1195 pub const VKILL: usize = 3; 1196 pub const VEOF: usize = 4; 1197 pub const VEOL: usize = 5; 1198 pub const VMIN: usize = 4; 1199 pub const VTIME: usize = 5; 1200 pub const VEOL2: usize = 6; 1201 pub const VSWTCH: usize = 7; 1202 pub const VSTART: usize = 8; 1203 pub const VSTOP: usize = 9; 1204 pub const VSUSP: usize = 10; 1205 1206 pub const IGNBRK: ::tcflag_t = 0x01; 1207 pub const BRKINT: ::tcflag_t = 0x02; 1208 pub const IGNPAR: ::tcflag_t = 0x04; 1209 pub const PARMRK: ::tcflag_t = 0x08; 1210 pub const INPCK: ::tcflag_t = 0x10; 1211 pub const ISTRIP: ::tcflag_t = 0x20; 1212 pub const INLCR: ::tcflag_t = 0x40; 1213 pub const IGNCR: ::tcflag_t = 0x80; 1214 pub const ICRNL: ::tcflag_t = 0x100; 1215 pub const IUCLC: ::tcflag_t = 0x200; 1216 pub const IXON: ::tcflag_t = 0x400; 1217 pub const IXANY: ::tcflag_t = 0x800; 1218 pub const IXOFF: ::tcflag_t = 0x1000; 1219 1220 pub const OPOST: ::tcflag_t = 0x00000001; 1221 pub const OLCUC: ::tcflag_t = 0x00000002; 1222 pub const ONLCR: ::tcflag_t = 0x00000004; 1223 pub const OCRNL: ::tcflag_t = 0x00000008; 1224 pub const ONOCR: ::tcflag_t = 0x00000010; 1225 pub const ONLRET: ::tcflag_t = 0x00000020; 1226 pub const OFILL: ::tcflag_t = 0x00000040; 1227 pub const OFDEL: ::tcflag_t = 0x00000080; 1228 pub const NLDLY: ::tcflag_t = 0x00000100; 1229 pub const NL0: ::tcflag_t = 0x00000000; 1230 pub const NL1: ::tcflag_t = 0x00000100; 1231 pub const CRDLY: ::tcflag_t = 0x00000600; 1232 pub const CR0: ::tcflag_t = 0x00000000; 1233 pub const CR1: ::tcflag_t = 0x00000200; 1234 pub const CR2: ::tcflag_t = 0x00000400; 1235 pub const CR3: ::tcflag_t = 0x00000600; 1236 pub const TABDLY: ::tcflag_t = 0x00001800; 1237 pub const TAB0: ::tcflag_t = 0x00000000; 1238 pub const TAB1: ::tcflag_t = 0x00000800; 1239 pub const TAB2: ::tcflag_t = 0x00001000; 1240 pub const TAB3: ::tcflag_t = 0x00001800; 1241 pub const BSDLY: ::tcflag_t = 0x00002000; 1242 pub const BS0: ::tcflag_t = 0x00000000; 1243 pub const BS1: ::tcflag_t = 0x00002000; 1244 pub const VTDLY: ::tcflag_t = 0x00004000; 1245 pub const VT0: ::tcflag_t = 0x00000000; 1246 pub const VT1: ::tcflag_t = 0x00004000; 1247 pub const FFDLY: ::tcflag_t = 0x00008000; 1248 pub const FF0: ::tcflag_t = 0x00000000; 1249 pub const FF1: ::tcflag_t = 0x00008000; 1250 1251 pub const CSIZE: ::tcflag_t = 0x00000020; 1252 pub const CS5: ::tcflag_t = 0x00000000; 1253 pub const CS6: ::tcflag_t = 0x00000000; 1254 pub const CS7: ::tcflag_t = 0x00000000; 1255 pub const CS8: ::tcflag_t = 0x00000020; 1256 pub const CSTOPB: ::tcflag_t = 0x00000040; 1257 pub const CREAD: ::tcflag_t = 0x00000080; 1258 pub const PARENB: ::tcflag_t = 0x00000100; 1259 pub const PARODD: ::tcflag_t = 0x00000200; 1260 pub const HUPCL: ::tcflag_t = 0x00000400; 1261 pub const CLOCAL: ::tcflag_t = 0x00000800; 1262 pub const XLOBLK: ::tcflag_t = 0x00001000; 1263 pub const CTSFLOW: ::tcflag_t = 0x00002000; 1264 pub const RTSFLOW: ::tcflag_t = 0x00004000; 1265 pub const CRTSCTS: ::tcflag_t = RTSFLOW | CTSFLOW; 1266 1267 pub const ISIG: ::tcflag_t = 0x00000001; 1268 pub const ICANON: ::tcflag_t = 0x00000002; 1269 pub const XCASE: ::tcflag_t = 0x00000004; 1270 pub const ECHO: ::tcflag_t = 0x00000008; 1271 pub const ECHOE: ::tcflag_t = 0x00000010; 1272 pub const ECHOK: ::tcflag_t = 0x00000020; 1273 pub const ECHONL: ::tcflag_t = 0x00000040; 1274 pub const NOFLSH: ::tcflag_t = 0x00000080; 1275 pub const TOSTOP: ::tcflag_t = 0x00000100; 1276 pub const IEXTEN: ::tcflag_t = 0x00000200; 1277 pub const ECHOCTL: ::tcflag_t = 0x00000400; 1278 pub const ECHOPRT: ::tcflag_t = 0x00000800; 1279 pub const ECHOKE: ::tcflag_t = 0x00001000; 1280 pub const FLUSHO: ::tcflag_t = 0x00002000; 1281 pub const PENDIN: ::tcflag_t = 0x00004000; 1282 1283 pub const TCGB_CTS: ::c_int = 0x01; 1284 pub const TCGB_DSR: ::c_int = 0x02; 1285 pub const TCGB_RI: ::c_int = 0x04; 1286 pub const TCGB_DCD: ::c_int = 0x08; 1287 pub const TIOCM_CTS: ::c_int = TCGB_CTS; 1288 pub const TIOCM_CD: ::c_int = TCGB_DCD; 1289 pub const TIOCM_CAR: ::c_int = TIOCM_CD; 1290 pub const TIOCM_RI: ::c_int = TCGB_RI; 1291 pub const TIOCM_DSR: ::c_int = TCGB_DSR; 1292 pub const TIOCM_DTR: ::c_int = 0x10; 1293 pub const TIOCM_RTS: ::c_int = 0x20; 1294 1295 pub const B0: speed_t = 0x00; 1296 pub const B50: speed_t = 0x01; 1297 pub const B75: speed_t = 0x02; 1298 pub const B110: speed_t = 0x03; 1299 pub const B134: speed_t = 0x04; 1300 pub const B150: speed_t = 0x05; 1301 pub const B200: speed_t = 0x06; 1302 pub const B300: speed_t = 0x07; 1303 pub const B600: speed_t = 0x08; 1304 pub const B1200: speed_t = 0x09; 1305 pub const B1800: speed_t = 0x0A; 1306 pub const B2400: speed_t = 0x0B; 1307 pub const B4800: speed_t = 0x0C; 1308 pub const B9600: speed_t = 0x0D; 1309 pub const B19200: speed_t = 0x0E; 1310 pub const B38400: speed_t = 0x0F; 1311 pub const B57600: speed_t = 0x10; 1312 pub const B115200: speed_t = 0x11; 1313 pub const B230400: speed_t = 0x12; 1314 pub const B31250: speed_t = 0x13; 1315 1316 pub const TCSANOW: ::c_int = 0x01; 1317 pub const TCSADRAIN: ::c_int = 0x02; 1318 pub const TCSAFLUSH: ::c_int = 0x04; 1319 1320 pub const TCOOFF: ::c_int = 0x01; 1321 pub const TCOON: ::c_int = 0x02; 1322 pub const TCIOFF: ::c_int = 0x04; 1323 pub const TCION: ::c_int = 0x08; 1324 1325 pub const TCIFLUSH: ::c_int = 0x01; 1326 pub const TCOFLUSH: ::c_int = 0x02; 1327 pub const TCIOFLUSH: ::c_int = 0x03; 1328 1329 pub const TCGETA: ::c_ulong = 0x8000; 1330 pub const TCSETA: ::c_ulong = TCGETA + 1; 1331 pub const TCSETAF: ::c_ulong = TCGETA + 2; 1332 pub const TCSETAW: ::c_ulong = TCGETA + 3; 1333 pub const TCWAITEVENT: ::c_ulong = TCGETA + 4; 1334 pub const TCSBRK: ::c_ulong = TCGETA + 5; 1335 pub const TCFLSH: ::c_ulong = TCGETA + 6; 1336 pub const TCXONC: ::c_ulong = TCGETA + 7; 1337 pub const TCQUERYCONNECTED: ::c_ulong = TCGETA + 8; 1338 pub const TCGETBITS: ::c_ulong = TCGETA + 9; 1339 pub const TCSETDTR: ::c_ulong = TCGETA + 10; 1340 pub const TCSETRTS: ::c_ulong = TCGETA + 11; 1341 pub const TIOCGWINSZ: ::c_ulong = TCGETA + 12; 1342 pub const TIOCSWINSZ: ::c_ulong = TCGETA + 13; 1343 pub const TCVTIME: ::c_ulong = TCGETA + 14; 1344 pub const TIOCGPGRP: ::c_ulong = TCGETA + 15; 1345 pub const TIOCSPGRP: ::c_ulong = TCGETA + 16; 1346 pub const TIOCSCTTY: ::c_ulong = TCGETA + 17; 1347 pub const TIOCMGET: ::c_ulong = TCGETA + 18; 1348 pub const TIOCMSET: ::c_ulong = TCGETA + 19; 1349 pub const TIOCSBRK: ::c_ulong = TCGETA + 20; 1350 pub const TIOCCBRK: ::c_ulong = TCGETA + 21; 1351 pub const TIOCMBIS: ::c_ulong = TCGETA + 22; 1352 pub const TIOCMBIC: ::c_ulong = TCGETA + 23; 1353 1354 pub const PRIO_PROCESS: ::c_int = 0; 1355 pub const PRIO_PGRP: ::c_int = 1; 1356 pub const PRIO_USER: ::c_int = 2; 1357 1358 // utmpx entry types 1359 pub const EMPTY: ::c_short = 0; 1360 pub const BOOT_TIME: ::c_short = 1; 1361 pub const OLD_TIME: ::c_short = 2; 1362 pub const NEW_TIME: ::c_short = 3; 1363 pub const USER_PROCESS: ::c_short = 4; 1364 pub const INIT_PROCESS: ::c_short = 5; 1365 pub const LOGIN_PROCESS: ::c_short = 6; 1366 pub const DEAD_PROCESS: ::c_short = 7; 1367 1368 pub const LOG_PID: ::c_int = 1 << 12; 1369 pub const LOG_CONS: ::c_int = 2 << 12; 1370 pub const LOG_ODELAY: ::c_int = 4 << 12; 1371 pub const LOG_NDELAY: ::c_int = 8 << 12; 1372 pub const LOG_SERIAL: ::c_int = 16 << 12; 1373 pub const LOG_PERROR: ::c_int = 32 << 12; 1374 pub const LOG_NOWAIT: ::c_int = 64 << 12; 1375 1376 const_fn! { 1377 {const} fn CMSG_ALIGN(len: usize) -> usize { 1378 len + ::mem::size_of::<usize>() - 1 & !(::mem::size_of::<usize>() - 1) 1379 } 1380 } 1381 1382 f! { 1383 pub fn CMSG_FIRSTHDR(mhdr: *const msghdr) -> *mut cmsghdr { 1384 if (*mhdr).msg_controllen as usize >= ::mem::size_of::<cmsghdr>() { 1385 (*mhdr).msg_control as *mut cmsghdr 1386 } else { 1387 0 as *mut cmsghdr 1388 } 1389 } 1390 1391 pub fn CMSG_DATA(cmsg: *const ::cmsghdr) -> *mut ::c_uchar { 1392 (cmsg as *mut ::c_uchar) 1393 .offset(CMSG_ALIGN(::mem::size_of::<::cmsghdr>()) as isize) 1394 } 1395 1396 pub {const} fn CMSG_SPACE(length: ::c_uint) -> ::c_uint { 1397 (CMSG_ALIGN(length as usize) + CMSG_ALIGN(::mem::size_of::<cmsghdr>())) 1398 as ::c_uint 1399 } 1400 1401 pub fn CMSG_LEN(length: ::c_uint) -> ::c_uint { 1402 CMSG_ALIGN(::mem::size_of::<cmsghdr>()) as ::c_uint + length 1403 } 1404 1405 pub fn CMSG_NXTHDR(mhdr: *const msghdr, 1406 cmsg: *const cmsghdr) -> *mut cmsghdr { 1407 if cmsg.is_null() { 1408 return ::CMSG_FIRSTHDR(mhdr); 1409 }; 1410 let next = cmsg as usize + CMSG_ALIGN((*cmsg).cmsg_len as usize) 1411 + CMSG_ALIGN(::mem::size_of::<::cmsghdr>()); 1412 let max = (*mhdr).msg_control as usize 1413 + (*mhdr).msg_controllen as usize; 1414 if next > max { 1415 0 as *mut ::cmsghdr 1416 } else { 1417 (cmsg as usize + CMSG_ALIGN((*cmsg).cmsg_len as usize)) 1418 as *mut ::cmsghdr 1419 } 1420 } 1421 1422 pub fn FD_CLR(fd: ::c_int, set: *mut fd_set) -> () { 1423 let fd = fd as usize; 1424 let size = ::mem::size_of_val(&(*set).fds_bits[0]) * 8; 1425 (*set).fds_bits[fd / size] &= !(1 << (fd % size)); 1426 return 1427 } 1428 1429 pub fn FD_ISSET(fd: ::c_int, set: *const fd_set) -> bool { 1430 let fd = fd as usize; 1431 let size = ::mem::size_of_val(&(*set).fds_bits[0]) * 8; 1432 return ((*set).fds_bits[fd / size] & (1 << (fd % size))) != 0 1433 } 1434 1435 pub fn FD_SET(fd: ::c_int, set: *mut fd_set) -> () { 1436 let fd = fd as usize; 1437 let size = ::mem::size_of_val(&(*set).fds_bits[0]) * 8; 1438 (*set).fds_bits[fd / size] |= 1 << (fd % size); 1439 return 1440 } 1441 1442 pub fn FD_ZERO(set: *mut fd_set) -> () { 1443 for slot in (*set).fds_bits.iter_mut() { 1444 *slot = 0; 1445 } 1446 } 1447 } 1448 1449 safe_f! { 1450 pub {const} fn WIFEXITED(status: ::c_int) -> bool { 1451 (status & !0xff) == 0 1452 } 1453 1454 pub {const} fn WEXITSTATUS(status: ::c_int) -> ::c_int { 1455 status & 0xff 1456 } 1457 1458 pub {const} fn WIFSIGNALED(status: ::c_int) -> bool { 1459 ((status >> 8) & 0xff) != 0 1460 } 1461 1462 pub {const} fn WTERMSIG(status: ::c_int) -> ::c_int { 1463 (status >> 8) & 0xff 1464 } 1465 1466 pub {const} fn WIFSTOPPED(status: ::c_int) -> bool { 1467 ((status >> 16) & 0xff) != 0 1468 } 1469 1470 pub {const} fn WSTOPSIG(status: ::c_int) -> ::c_int { 1471 (status >> 16) & 0xff 1472 } 1473 1474 // actually WIFCORED, but this is used everywhere else 1475 pub {const} fn WCOREDUMP(status: ::c_int) -> bool { 1476 (status & 0x10000) != 0 1477 } 1478 1479 pub {const} fn WIFCONTINUED(status: ::c_int) -> bool { 1480 (status & 0x20000) != 0 1481 } 1482 } 1483 1484 extern "C" { getrlimit(resource: ::c_int, rlim: *mut ::rlimit) -> ::c_int1485 pub fn getrlimit(resource: ::c_int, rlim: *mut ::rlimit) -> ::c_int; setrlimit(resource: ::c_int, rlim: *const ::rlimit) -> ::c_int1486 pub fn setrlimit(resource: ::c_int, rlim: *const ::rlimit) -> ::c_int; getpriority(which: ::c_int, who: id_t) -> ::c_int1487 pub fn getpriority(which: ::c_int, who: id_t) -> ::c_int; setpriority(which: ::c_int, who: id_t, priority: ::c_int) -> ::c_int1488 pub fn setpriority(which: ::c_int, who: id_t, priority: ::c_int) -> ::c_int; 1489 utimensat( fd: ::c_int, path: *const ::c_char, times: *const ::timespec, flag: ::c_int, ) -> ::c_int1490 pub fn utimensat( 1491 fd: ::c_int, 1492 path: *const ::c_char, 1493 times: *const ::timespec, 1494 flag: ::c_int, 1495 ) -> ::c_int; futimens(fd: ::c_int, times: *const ::timespec) -> ::c_int1496 pub fn futimens(fd: ::c_int, times: *const ::timespec) -> ::c_int; strerror_r(errnum: ::c_int, buf: *mut c_char, buflen: ::size_t) -> ::c_int1497 pub fn strerror_r(errnum: ::c_int, buf: *mut c_char, buflen: ::size_t) -> ::c_int; _errnop() -> *mut ::c_int1498 pub fn _errnop() -> *mut ::c_int; 1499 abs(i: ::c_int) -> ::c_int1500 pub fn abs(i: ::c_int) -> ::c_int; atof(s: *const ::c_char) -> ::c_double1501 pub fn atof(s: *const ::c_char) -> ::c_double; labs(i: ::c_long) -> ::c_long1502 pub fn labs(i: ::c_long) -> ::c_long; rand() -> ::c_int1503 pub fn rand() -> ::c_int; srand(seed: ::c_uint)1504 pub fn srand(seed: ::c_uint); getifaddrs(ifap: *mut *mut ::ifaddrs) -> ::c_int1505 pub fn getifaddrs(ifap: *mut *mut ::ifaddrs) -> ::c_int; freeifaddrs(ifa: *mut ::ifaddrs)1506 pub fn freeifaddrs(ifa: *mut ::ifaddrs); 1507 } 1508 1509 #[link(name = "bsd")] 1510 extern "C" { sem_destroy(sem: *mut sem_t) -> ::c_int1511 pub fn sem_destroy(sem: *mut sem_t) -> ::c_int; sem_init(sem: *mut sem_t, pshared: ::c_int, value: ::c_uint) -> ::c_int1512 pub fn sem_init(sem: *mut sem_t, pshared: ::c_int, value: ::c_uint) -> ::c_int; 1513 clock_gettime(clk_id: ::c_int, tp: *mut ::timespec) -> ::c_int1514 pub fn clock_gettime(clk_id: ::c_int, tp: *mut ::timespec) -> ::c_int; clock_settime(clk_id: ::c_int, tp: *const ::timespec) -> ::c_int1515 pub fn clock_settime(clk_id: ::c_int, tp: *const ::timespec) -> ::c_int; pthread_create( thread: *mut ::pthread_t, attr: *const ::pthread_attr_t, f: extern "C" fn(*mut ::c_void) -> *mut ::c_void, value: *mut ::c_void, ) -> ::c_int1516 pub fn pthread_create( 1517 thread: *mut ::pthread_t, 1518 attr: *const ::pthread_attr_t, 1519 f: extern "C" fn(*mut ::c_void) -> *mut ::c_void, 1520 value: *mut ::c_void, 1521 ) -> ::c_int; pthread_attr_getguardsize( attr: *const ::pthread_attr_t, guardsize: *mut ::size_t, ) -> ::c_int1522 pub fn pthread_attr_getguardsize( 1523 attr: *const ::pthread_attr_t, 1524 guardsize: *mut ::size_t, 1525 ) -> ::c_int; pthread_attr_getstack( attr: *const ::pthread_attr_t, stackaddr: *mut *mut ::c_void, stacksize: *mut ::size_t, ) -> ::c_int1526 pub fn pthread_attr_getstack( 1527 attr: *const ::pthread_attr_t, 1528 stackaddr: *mut *mut ::c_void, 1529 stacksize: *mut ::size_t, 1530 ) -> ::c_int; pthread_condattr_getclock( attr: *const pthread_condattr_t, clock_id: *mut clockid_t, ) -> ::c_int1531 pub fn pthread_condattr_getclock( 1532 attr: *const pthread_condattr_t, 1533 clock_id: *mut clockid_t, 1534 ) -> ::c_int; pthread_condattr_setclock( attr: *mut pthread_condattr_t, clock_id: ::clockid_t, ) -> ::c_int1535 pub fn pthread_condattr_setclock( 1536 attr: *mut pthread_condattr_t, 1537 clock_id: ::clockid_t, 1538 ) -> ::c_int; valloc(numBytes: ::size_t) -> *mut ::c_void1539 pub fn valloc(numBytes: ::size_t) -> *mut ::c_void; malloc_usable_size(ptr: *mut ::c_void) -> ::size_t1540 pub fn malloc_usable_size(ptr: *mut ::c_void) -> ::size_t; memalign(align: ::size_t, size: ::size_t) -> *mut ::c_void1541 pub fn memalign(align: ::size_t, size: ::size_t) -> *mut ::c_void; setgroups(ngroups: ::c_int, ptr: *const ::gid_t) -> ::c_int1542 pub fn setgroups(ngroups: ::c_int, ptr: *const ::gid_t) -> ::c_int; ioctl(fd: ::c_int, request: ::c_ulong, ...) -> ::c_int1543 pub fn ioctl(fd: ::c_int, request: ::c_ulong, ...) -> ::c_int; mprotect(addr: *mut ::c_void, len: ::size_t, prot: ::c_int) -> ::c_int1544 pub fn mprotect(addr: *mut ::c_void, len: ::size_t, prot: ::c_int) -> ::c_int; dirfd(dirp: *mut ::DIR) -> ::c_int1545 pub fn dirfd(dirp: *mut ::DIR) -> ::c_int; getnameinfo( sa: *const ::sockaddr, salen: ::socklen_t, host: *mut ::c_char, hostlen: ::socklen_t, serv: *mut ::c_char, sevlen: ::socklen_t, flags: ::c_int, ) -> ::c_int1546 pub fn getnameinfo( 1547 sa: *const ::sockaddr, 1548 salen: ::socklen_t, 1549 host: *mut ::c_char, 1550 hostlen: ::socklen_t, 1551 serv: *mut ::c_char, 1552 sevlen: ::socklen_t, 1553 flags: ::c_int, 1554 ) -> ::c_int; pthread_mutex_timedlock( lock: *mut pthread_mutex_t, abstime: *const ::timespec, ) -> ::c_int1555 pub fn pthread_mutex_timedlock( 1556 lock: *mut pthread_mutex_t, 1557 abstime: *const ::timespec, 1558 ) -> ::c_int; waitid(idtype: idtype_t, id: id_t, infop: *mut ::siginfo_t, options: ::c_int) -> ::c_int1559 pub fn waitid(idtype: idtype_t, id: id_t, infop: *mut ::siginfo_t, options: ::c_int) 1560 -> ::c_int; 1561 glob( pattern: *const ::c_char, flags: ::c_int, errfunc: ::Option<extern "C" fn(epath: *const ::c_char, errno: ::c_int) -> ::c_int>, pglob: *mut ::glob_t, ) -> ::c_int1562 pub fn glob( 1563 pattern: *const ::c_char, 1564 flags: ::c_int, 1565 errfunc: ::Option<extern "C" fn(epath: *const ::c_char, errno: ::c_int) -> ::c_int>, 1566 pglob: *mut ::glob_t, 1567 ) -> ::c_int; globfree(pglob: *mut ::glob_t)1568 pub fn globfree(pglob: *mut ::glob_t); gettimeofday(tp: *mut ::timeval, tz: *mut ::c_void) -> ::c_int1569 pub fn gettimeofday(tp: *mut ::timeval, tz: *mut ::c_void) -> ::c_int; posix_madvise(addr: *mut ::c_void, len: ::size_t, advice: ::c_int) -> ::c_int1570 pub fn posix_madvise(addr: *mut ::c_void, len: ::size_t, advice: ::c_int) -> ::c_int; posix_fadvise(fd: ::c_int, offset: ::off_t, len: ::off_t, advice: ::c_int) -> ::c_int1571 pub fn posix_fadvise(fd: ::c_int, offset: ::off_t, len: ::off_t, advice: ::c_int) -> ::c_int; posix_fallocate(fd: ::c_int, offset: ::off_t, len: ::off_t) -> ::c_int1572 pub fn posix_fallocate(fd: ::c_int, offset: ::off_t, len: ::off_t) -> ::c_int; 1573 shm_open(name: *const ::c_char, oflag: ::c_int, mode: ::mode_t) -> ::c_int1574 pub fn shm_open(name: *const ::c_char, oflag: ::c_int, mode: ::mode_t) -> ::c_int; shm_unlink(name: *const ::c_char) -> ::c_int1575 pub fn shm_unlink(name: *const ::c_char) -> ::c_int; 1576 seekdir(dirp: *mut ::DIR, loc: ::c_long)1577 pub fn seekdir(dirp: *mut ::DIR, loc: ::c_long); 1578 telldir(dirp: *mut ::DIR) -> ::c_long1579 pub fn telldir(dirp: *mut ::DIR) -> ::c_long; madvise(addr: *mut ::c_void, len: ::size_t, advice: ::c_int) -> ::c_int1580 pub fn madvise(addr: *mut ::c_void, len: ::size_t, advice: ::c_int) -> ::c_int; 1581 msync(addr: *mut ::c_void, len: ::size_t, flags: ::c_int) -> ::c_int1582 pub fn msync(addr: *mut ::c_void, len: ::size_t, flags: ::c_int) -> ::c_int; 1583 recvfrom( socket: ::c_int, buf: *mut ::c_void, len: ::size_t, flags: ::c_int, addr: *mut ::sockaddr, addrlen: *mut ::socklen_t, ) -> ::ssize_t1584 pub fn recvfrom( 1585 socket: ::c_int, 1586 buf: *mut ::c_void, 1587 len: ::size_t, 1588 flags: ::c_int, 1589 addr: *mut ::sockaddr, 1590 addrlen: *mut ::socklen_t, 1591 ) -> ::ssize_t; mkstemps(template: *mut ::c_char, suffixlen: ::c_int) -> ::c_int1592 pub fn mkstemps(template: *mut ::c_char, suffixlen: ::c_int) -> ::c_int; lutimes(file: *const ::c_char, times: *const ::timeval) -> ::c_int1593 pub fn lutimes(file: *const ::c_char, times: *const ::timeval) -> ::c_int; nl_langinfo(item: ::nl_item) -> *mut ::c_char1594 pub fn nl_langinfo(item: ::nl_item) -> *mut ::c_char; 1595 bind(socket: ::c_int, address: *const ::sockaddr, address_len: ::socklen_t) -> ::c_int1596 pub fn bind(socket: ::c_int, address: *const ::sockaddr, address_len: ::socklen_t) -> ::c_int; 1597 writev(fd: ::c_int, iov: *const ::iovec, count: ::c_int) -> ::ssize_t1598 pub fn writev(fd: ::c_int, iov: *const ::iovec, count: ::c_int) -> ::ssize_t; readv(fd: ::c_int, iov: *const ::iovec, count: ::c_int) -> ::ssize_t1599 pub fn readv(fd: ::c_int, iov: *const ::iovec, count: ::c_int) -> ::ssize_t; 1600 sendmsg(fd: ::c_int, msg: *const ::msghdr, flags: ::c_int) -> ::ssize_t1601 pub fn sendmsg(fd: ::c_int, msg: *const ::msghdr, flags: ::c_int) -> ::ssize_t; recvmsg(fd: ::c_int, msg: *mut ::msghdr, flags: ::c_int) -> ::ssize_t1602 pub fn recvmsg(fd: ::c_int, msg: *mut ::msghdr, flags: ::c_int) -> ::ssize_t; execvpe( file: *const ::c_char, argv: *const *const ::c_char, environment: *const *const ::c_char, ) -> ::c_int1603 pub fn execvpe( 1604 file: *const ::c_char, 1605 argv: *const *const ::c_char, 1606 environment: *const *const ::c_char, 1607 ) -> ::c_int; getgrgid_r( gid: ::gid_t, grp: *mut ::group, buf: *mut ::c_char, buflen: ::size_t, result: *mut *mut ::group, ) -> ::c_int1608 pub fn getgrgid_r( 1609 gid: ::gid_t, 1610 grp: *mut ::group, 1611 buf: *mut ::c_char, 1612 buflen: ::size_t, 1613 result: *mut *mut ::group, 1614 ) -> ::c_int; getgrouplist( user: *const ::c_char, basegroup: ::gid_t, grouplist: *mut ::gid_t, groupcount: *mut ::c_int, ) -> ::c_int1615 pub fn getgrouplist( 1616 user: *const ::c_char, 1617 basegroup: ::gid_t, 1618 grouplist: *mut ::gid_t, 1619 groupcount: *mut ::c_int, 1620 ) -> ::c_int; sigaltstack(ss: *const stack_t, oss: *mut stack_t) -> ::c_int1621 pub fn sigaltstack(ss: *const stack_t, oss: *mut stack_t) -> ::c_int; sem_close(sem: *mut sem_t) -> ::c_int1622 pub fn sem_close(sem: *mut sem_t) -> ::c_int; getdtablesize() -> ::c_int1623 pub fn getdtablesize() -> ::c_int; getgrnam_r( name: *const ::c_char, grp: *mut ::group, buf: *mut ::c_char, buflen: ::size_t, result: *mut *mut ::group, ) -> ::c_int1624 pub fn getgrnam_r( 1625 name: *const ::c_char, 1626 grp: *mut ::group, 1627 buf: *mut ::c_char, 1628 buflen: ::size_t, 1629 result: *mut *mut ::group, 1630 ) -> ::c_int; pthread_sigmask(how: ::c_int, set: *const sigset_t, oldset: *mut sigset_t) -> ::c_int1631 pub fn pthread_sigmask(how: ::c_int, set: *const sigset_t, oldset: *mut sigset_t) -> ::c_int; sem_open(name: *const ::c_char, oflag: ::c_int, ...) -> *mut sem_t1632 pub fn sem_open(name: *const ::c_char, oflag: ::c_int, ...) -> *mut sem_t; getgrnam(name: *const ::c_char) -> *mut ::group1633 pub fn getgrnam(name: *const ::c_char) -> *mut ::group; pthread_kill(thread: ::pthread_t, sig: ::c_int) -> ::c_int1634 pub fn pthread_kill(thread: ::pthread_t, sig: ::c_int) -> ::c_int; sem_unlink(name: *const ::c_char) -> ::c_int1635 pub fn sem_unlink(name: *const ::c_char) -> ::c_int; daemon(nochdir: ::c_int, noclose: ::c_int) -> ::c_int1636 pub fn daemon(nochdir: ::c_int, noclose: ::c_int) -> ::c_int; getpwnam_r( name: *const ::c_char, pwd: *mut passwd, buf: *mut ::c_char, buflen: ::size_t, result: *mut *mut passwd, ) -> ::c_int1637 pub fn getpwnam_r( 1638 name: *const ::c_char, 1639 pwd: *mut passwd, 1640 buf: *mut ::c_char, 1641 buflen: ::size_t, 1642 result: *mut *mut passwd, 1643 ) -> ::c_int; getpwuid_r( uid: ::uid_t, pwd: *mut passwd, buf: *mut ::c_char, buflen: ::size_t, result: *mut *mut passwd, ) -> ::c_int1644 pub fn getpwuid_r( 1645 uid: ::uid_t, 1646 pwd: *mut passwd, 1647 buf: *mut ::c_char, 1648 buflen: ::size_t, 1649 result: *mut *mut passwd, 1650 ) -> ::c_int; sigwait(set: *const sigset_t, sig: *mut ::c_int) -> ::c_int1651 pub fn sigwait(set: *const sigset_t, sig: *mut ::c_int) -> ::c_int; pthread_atfork( prepare: ::Option<unsafe extern "C" fn()>, parent: ::Option<unsafe extern "C" fn()>, child: ::Option<unsafe extern "C" fn()>, ) -> ::c_int1652 pub fn pthread_atfork( 1653 prepare: ::Option<unsafe extern "C" fn()>, 1654 parent: ::Option<unsafe extern "C" fn()>, 1655 child: ::Option<unsafe extern "C" fn()>, 1656 ) -> ::c_int; getgrgid(gid: ::gid_t) -> *mut ::group1657 pub fn getgrgid(gid: ::gid_t) -> *mut ::group; popen(command: *const c_char, mode: *const c_char) -> *mut ::FILE1658 pub fn popen(command: *const c_char, mode: *const c_char) -> *mut ::FILE; openpty( amaster: *mut ::c_int, aslave: *mut ::c_int, name: *mut ::c_char, termp: *mut termios, winp: *mut ::winsize, ) -> ::c_int1659 pub fn openpty( 1660 amaster: *mut ::c_int, 1661 aslave: *mut ::c_int, 1662 name: *mut ::c_char, 1663 termp: *mut termios, 1664 winp: *mut ::winsize, 1665 ) -> ::c_int; forkpty( amaster: *mut ::c_int, name: *mut ::c_char, termp: *mut termios, winp: *mut ::winsize, ) -> ::pid_t1666 pub fn forkpty( 1667 amaster: *mut ::c_int, 1668 name: *mut ::c_char, 1669 termp: *mut termios, 1670 winp: *mut ::winsize, 1671 ) -> ::pid_t; sethostname(name: *const ::c_char, len: ::size_t) -> ::c_int1672 pub fn sethostname(name: *const ::c_char, len: ::size_t) -> ::c_int; uname(buf: *mut ::utsname) -> ::c_int1673 pub fn uname(buf: *mut ::utsname) -> ::c_int; getutxent() -> *mut utmpx1674 pub fn getutxent() -> *mut utmpx; getutxid(ut: *const utmpx) -> *mut utmpx1675 pub fn getutxid(ut: *const utmpx) -> *mut utmpx; getutxline(ut: *const utmpx) -> *mut utmpx1676 pub fn getutxline(ut: *const utmpx) -> *mut utmpx; pututxline(ut: *const utmpx) -> *mut utmpx1677 pub fn pututxline(ut: *const utmpx) -> *mut utmpx; setutxent()1678 pub fn setutxent(); endutxent()1679 pub fn endutxent(); 1680 dl_iterate_phdr( callback: ::Option< unsafe extern "C" fn( info: *mut dl_phdr_info, size: usize, data: *mut ::c_void, ) -> ::c_int, >, data: *mut ::c_void, ) -> ::c_int1681 pub fn dl_iterate_phdr( 1682 callback: ::Option< 1683 unsafe extern "C" fn( 1684 info: *mut dl_phdr_info, 1685 size: usize, 1686 data: *mut ::c_void, 1687 ) -> ::c_int, 1688 >, 1689 data: *mut ::c_void, 1690 ) -> ::c_int; 1691 } 1692 1693 cfg_if! { 1694 if #[cfg(target_pointer_width = "64")] { 1695 mod b64; 1696 pub use self::b64::*; 1697 } else { 1698 mod b32; 1699 pub use self::b32::*; 1700 } 1701 } 1702 1703 cfg_if! { 1704 if #[cfg(target_arch = "x86")] { 1705 // TODO 1706 // mod x86; 1707 // pub use self::x86::*; 1708 } else if #[cfg(target_arch = "x86_64")] { 1709 mod x86_64; 1710 pub use self::x86_64::*; 1711 } else if #[cfg(target_arch = "aarch64")] { 1712 // TODO 1713 // mod aarch64; 1714 // pub use self::aarch64::*; 1715 } 1716 } 1717 1718 mod native; 1719 pub use self::native::*; 1720