1//! Definitions found commonly among almost all Unix derivatives 2//! 3//! More functions and definitions can be found in the more specific modules 4//! according to the platform in question. 5 6// PUB_TYPE 7 8pub type c_schar = i8; 9pub type c_uchar = u8; 10pub type c_short = i16; 11pub type c_ushort = u16; 12pub type c_int = i32; 13pub type c_uint = u32; 14pub type c_float = f32; 15pub type c_double = f64; 16pub type c_longlong = i64; 17pub type c_ulonglong = u64; 18pub type intmax_t = i64; 19pub type uintmax_t = u64; 20 21pub type locale_t = *mut ::c_void; 22 23pub type size_t = usize; 24pub type ptrdiff_t = isize; 25pub type intptr_t = isize; 26pub type uintptr_t = usize; 27pub type ssize_t = isize; 28 29pub type pid_t = i32; 30pub type uid_t = u32; 31pub type gid_t = u32; 32pub type in_addr_t = u32; 33pub type in_port_t = u16; 34pub type sighandler_t = ::size_t; 35pub type cc_t = ::c_uchar; 36pub type sa_family_t = u16; 37pub type pthread_key_t = ::c_uint; 38pub type speed_t = ::c_uint; 39pub type tcflag_t = ::c_uint; 40pub type clockid_t = ::c_int; 41pub type key_t = ::c_int; 42pub type id_t = ::c_uint; 43pub type useconds_t = u32; 44pub type dev_t = u64; 45pub type socklen_t = u32; 46pub type pthread_t = c_ulong; 47pub type mode_t = u32; 48pub type ino64_t = u64; 49pub type off64_t = i64; 50pub type blkcnt64_t = i64; 51pub type rlim64_t = u64; 52pub type mqd_t = ::c_int; 53pub type nfds_t = ::c_ulong; 54pub type nl_item = ::c_int; 55pub type idtype_t = ::c_uint; 56pub type loff_t = ::c_longlong; 57 58pub type __u8 = ::c_uchar; 59pub type __u16 = ::c_ushort; 60pub type __s16 = ::c_short; 61pub type __u32 = ::c_uint; 62pub type __s32 = ::c_int; 63 64pub type Elf32_Half = u16; 65pub type Elf32_Word = u32; 66pub type Elf32_Off = u32; 67pub type Elf32_Addr = u32; 68 69pub type Elf64_Half = u16; 70pub type Elf64_Word = u32; 71pub type Elf64_Off = u64; 72pub type Elf64_Addr = u64; 73pub type Elf64_Xword = u64; 74 75pub type clock_t = c_long; 76pub type time_t = c_long; 77pub type suseconds_t = c_long; 78pub type ino_t = u64; 79pub type off_t = i64; 80pub type blkcnt_t = i64; 81 82pub type shmatt_t = ::c_ulong; 83pub type msgqnum_t = ::c_ulong; 84pub type msglen_t = ::c_ulong; 85pub type fsblkcnt_t = ::c_ulonglong; 86pub type fsfilcnt_t = ::c_ulonglong; 87pub type rlim_t = ::c_ulonglong; 88 89pub type c_long = i64; 90pub type c_ulong = u64; 91 92// FIXME: why are these uninhabited types? that seems... wrong? 93// Presumably these should be `()` or an `extern type` (when that stabilizes). 94#[cfg_attr(feature = "extra_traits", derive(Debug))] 95pub enum timezone {} 96impl ::Copy for timezone {} 97impl ::Clone for timezone { 98 fn clone(&self) -> timezone { 99 *self 100 } 101} 102#[cfg_attr(feature = "extra_traits", derive(Debug))] 103pub enum DIR {} 104impl ::Copy for DIR {} 105impl ::Clone for DIR { 106 fn clone(&self) -> DIR { 107 *self 108 } 109} 110 111#[cfg_attr(feature = "extra_traits", derive(Debug))] 112pub enum fpos64_t {} // FIXME: fill this out with a struct 113impl ::Copy for fpos64_t {} 114impl ::Clone for fpos64_t { 115 fn clone(&self) -> fpos64_t { 116 *self 117 } 118} 119 120// PUB_STRUCT 121 122s! { 123 pub struct group { 124 pub gr_name: *mut ::c_char, 125 pub gr_passwd: *mut ::c_char, 126 pub gr_gid: ::gid_t, 127 pub gr_mem: *mut *mut ::c_char, 128 } 129 130 pub struct utimbuf { 131 pub actime: time_t, 132 pub modtime: time_t, 133 } 134 135 pub struct timeval { 136 pub tv_sec: time_t, 137 pub tv_usec: suseconds_t, 138 } 139 140 pub struct timespec { 141 pub tv_sec: time_t, 142 pub tv_nsec: ::c_long, 143 } 144 145 // FIXME: the rlimit and rusage related functions and types don't exist 146 // within zircon. Are there reasons for keeping them around? 147 pub struct rlimit { 148 pub rlim_cur: rlim_t, 149 pub rlim_max: rlim_t, 150 } 151 152 pub struct rusage { 153 pub ru_utime: timeval, 154 pub ru_stime: timeval, 155 pub ru_maxrss: c_long, 156 #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))] 157 __pad1: u32, 158 pub ru_ixrss: c_long, 159 #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))] 160 __pad2: u32, 161 pub ru_idrss: c_long, 162 #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))] 163 __pad3: u32, 164 pub ru_isrss: c_long, 165 #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))] 166 __pad4: u32, 167 pub ru_minflt: c_long, 168 #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))] 169 __pad5: u32, 170 pub ru_majflt: c_long, 171 #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))] 172 __pad6: u32, 173 pub ru_nswap: c_long, 174 #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))] 175 __pad7: u32, 176 pub ru_inblock: c_long, 177 #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))] 178 __pad8: u32, 179 pub ru_oublock: c_long, 180 #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))] 181 __pad9: u32, 182 pub ru_msgsnd: c_long, 183 #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))] 184 __pad10: u32, 185 pub ru_msgrcv: c_long, 186 #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))] 187 __pad11: u32, 188 pub ru_nsignals: c_long, 189 #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))] 190 __pad12: u32, 191 pub ru_nvcsw: c_long, 192 #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))] 193 __pad13: u32, 194 pub ru_nivcsw: c_long, 195 #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))] 196 __pad14: u32, 197 } 198 199 pub struct in_addr { 200 pub s_addr: in_addr_t, 201 } 202 203 pub struct in6_addr { 204 pub s6_addr: [u8; 16], 205 } 206 207 pub struct ip_mreq { 208 pub imr_multiaddr: in_addr, 209 pub imr_interface: in_addr, 210 } 211 212 pub struct ip_mreqn { 213 pub imr_multiaddr: in_addr, 214 pub imr_address: in_addr, 215 pub imr_ifindex: ::c_int, 216 } 217 218 pub struct ipv6_mreq { 219 pub ipv6mr_multiaddr: in6_addr, 220 pub ipv6mr_interface: ::c_uint, 221 } 222 223 pub struct hostent { 224 pub h_name: *mut ::c_char, 225 pub h_aliases: *mut *mut ::c_char, 226 pub h_addrtype: ::c_int, 227 pub h_length: ::c_int, 228 pub h_addr_list: *mut *mut ::c_char, 229 } 230 231 pub struct iovec { 232 pub iov_base: *mut ::c_void, 233 pub iov_len: ::size_t, 234 } 235 236 pub struct pollfd { 237 pub fd: ::c_int, 238 pub events: ::c_short, 239 pub revents: ::c_short, 240 } 241 242 pub struct winsize { 243 pub ws_row: ::c_ushort, 244 pub ws_col: ::c_ushort, 245 pub ws_xpixel: ::c_ushort, 246 pub ws_ypixel: ::c_ushort, 247 } 248 249 pub struct linger { 250 pub l_onoff: ::c_int, 251 pub l_linger: ::c_int, 252 } 253 254 pub struct sigval { 255 // Actually a union of an int and a void* 256 pub sival_ptr: *mut ::c_void 257 } 258 259 // <sys/time.h> 260 pub struct itimerval { 261 pub it_interval: ::timeval, 262 pub it_value: ::timeval, 263 } 264 265 // <sys/times.h> 266 pub struct tms { 267 pub tms_utime: ::clock_t, 268 pub tms_stime: ::clock_t, 269 pub tms_cutime: ::clock_t, 270 pub tms_cstime: ::clock_t, 271 } 272 273 pub struct servent { 274 pub s_name: *mut ::c_char, 275 pub s_aliases: *mut *mut ::c_char, 276 pub s_port: ::c_int, 277 pub s_proto: *mut ::c_char, 278 } 279 280 pub struct protoent { 281 pub p_name: *mut ::c_char, 282 pub p_aliases: *mut *mut ::c_char, 283 pub p_proto: ::c_int, 284 } 285 286 pub struct aiocb { 287 pub aio_fildes: ::c_int, 288 pub aio_lio_opcode: ::c_int, 289 pub aio_reqprio: ::c_int, 290 pub aio_buf: *mut ::c_void, 291 pub aio_nbytes: ::size_t, 292 pub aio_sigevent: ::sigevent, 293 __td: *mut ::c_void, 294 __lock: [::c_int; 2], 295 __err: ::c_int, 296 __ret: ::ssize_t, 297 pub aio_offset: off_t, 298 __next: *mut ::c_void, 299 __prev: *mut ::c_void, 300 #[cfg(target_pointer_width = "32")] 301 __dummy4: [::c_char; 24], 302 #[cfg(target_pointer_width = "64")] 303 __dummy4: [::c_char; 16], 304 } 305 306 pub struct sigaction { 307 pub sa_sigaction: ::sighandler_t, 308 pub sa_mask: ::sigset_t, 309 pub sa_flags: ::c_int, 310 pub sa_restorer: ::Option<extern fn()>, 311 } 312 313 pub struct termios { 314 pub c_iflag: ::tcflag_t, 315 pub c_oflag: ::tcflag_t, 316 pub c_cflag: ::tcflag_t, 317 pub c_lflag: ::tcflag_t, 318 pub c_line: ::cc_t, 319 pub c_cc: [::cc_t; ::NCCS], 320 pub __c_ispeed: ::speed_t, 321 pub __c_ospeed: ::speed_t, 322 } 323 324 pub struct flock { 325 pub l_type: ::c_short, 326 pub l_whence: ::c_short, 327 pub l_start: ::off_t, 328 pub l_len: ::off_t, 329 pub l_pid: ::pid_t, 330 } 331 332 pub struct ucred { 333 pub pid: ::pid_t, 334 pub uid: ::uid_t, 335 pub gid: ::gid_t, 336 } 337 338 pub struct sockaddr { 339 pub sa_family: sa_family_t, 340 pub sa_data: [::c_char; 14], 341 } 342 343 pub struct sockaddr_in { 344 pub sin_family: sa_family_t, 345 pub sin_port: ::in_port_t, 346 pub sin_addr: ::in_addr, 347 pub sin_zero: [u8; 8], 348 } 349 350 pub struct sockaddr_in6 { 351 pub sin6_family: sa_family_t, 352 pub sin6_port: ::in_port_t, 353 pub sin6_flowinfo: u32, 354 pub sin6_addr: ::in6_addr, 355 pub sin6_scope_id: u32, 356 } 357 358 pub struct addrinfo { 359 pub ai_flags: ::c_int, 360 pub ai_family: ::c_int, 361 pub ai_socktype: ::c_int, 362 pub ai_protocol: ::c_int, 363 pub ai_addrlen: socklen_t, 364 365 pub ai_addr: *mut ::sockaddr, 366 367 pub ai_canonname: *mut c_char, 368 369 pub ai_next: *mut addrinfo, 370 } 371 372 pub struct sockaddr_ll { 373 pub sll_family: ::c_ushort, 374 pub sll_protocol: ::c_ushort, 375 pub sll_ifindex: ::c_int, 376 pub sll_hatype: ::c_ushort, 377 pub sll_pkttype: ::c_uchar, 378 pub sll_halen: ::c_uchar, 379 pub sll_addr: [::c_uchar; 8] 380 } 381 382 pub struct fd_set { 383 fds_bits: [::c_ulong; FD_SETSIZE / ULONG_SIZE], 384 } 385 386 pub struct tm { 387 pub tm_sec: ::c_int, 388 pub tm_min: ::c_int, 389 pub tm_hour: ::c_int, 390 pub tm_mday: ::c_int, 391 pub tm_mon: ::c_int, 392 pub tm_year: ::c_int, 393 pub tm_wday: ::c_int, 394 pub tm_yday: ::c_int, 395 pub tm_isdst: ::c_int, 396 pub tm_gmtoff: ::c_long, 397 pub tm_zone: *const ::c_char, 398 } 399 400 pub struct sched_param { 401 pub sched_priority: ::c_int, 402 pub sched_ss_low_priority: ::c_int, 403 pub sched_ss_repl_period: ::timespec, 404 pub sched_ss_init_budget: ::timespec, 405 pub sched_ss_max_repl: ::c_int, 406 } 407 408 pub struct Dl_info { 409 pub dli_fname: *const ::c_char, 410 pub dli_fbase: *mut ::c_void, 411 pub dli_sname: *const ::c_char, 412 pub dli_saddr: *mut ::c_void, 413 } 414 415 pub struct epoll_event { 416 pub events: u32, 417 pub u64: u64, 418 } 419 420 pub struct lconv { 421 pub decimal_point: *mut ::c_char, 422 pub thousands_sep: *mut ::c_char, 423 pub grouping: *mut ::c_char, 424 pub int_curr_symbol: *mut ::c_char, 425 pub currency_symbol: *mut ::c_char, 426 pub mon_decimal_point: *mut ::c_char, 427 pub mon_thousands_sep: *mut ::c_char, 428 pub mon_grouping: *mut ::c_char, 429 pub positive_sign: *mut ::c_char, 430 pub negative_sign: *mut ::c_char, 431 pub int_frac_digits: ::c_char, 432 pub frac_digits: ::c_char, 433 pub p_cs_precedes: ::c_char, 434 pub p_sep_by_space: ::c_char, 435 pub n_cs_precedes: ::c_char, 436 pub n_sep_by_space: ::c_char, 437 pub p_sign_posn: ::c_char, 438 pub n_sign_posn: ::c_char, 439 pub int_p_cs_precedes: ::c_char, 440 pub int_p_sep_by_space: ::c_char, 441 pub int_n_cs_precedes: ::c_char, 442 pub int_n_sep_by_space: ::c_char, 443 pub int_p_sign_posn: ::c_char, 444 pub int_n_sign_posn: ::c_char, 445 } 446 447 pub struct rlimit64 { 448 pub rlim_cur: rlim64_t, 449 pub rlim_max: rlim64_t, 450 } 451 452 pub struct glob_t { 453 pub gl_pathc: ::size_t, 454 pub gl_pathv: *mut *mut c_char, 455 pub gl_offs: ::size_t, 456 pub gl_flags: ::c_int, 457 458 __unused1: *mut ::c_void, 459 __unused2: *mut ::c_void, 460 __unused3: *mut ::c_void, 461 __unused4: *mut ::c_void, 462 __unused5: *mut ::c_void, 463 } 464 465 pub struct ifaddrs { 466 pub ifa_next: *mut ifaddrs, 467 pub ifa_name: *mut c_char, 468 pub ifa_flags: ::c_uint, 469 pub ifa_addr: *mut ::sockaddr, 470 pub ifa_netmask: *mut ::sockaddr, 471 pub ifa_ifu: *mut ::sockaddr, // FIXME This should be a union 472 pub ifa_data: *mut ::c_void 473 } 474 475 pub struct passwd { 476 pub pw_name: *mut ::c_char, 477 pub pw_passwd: *mut ::c_char, 478 pub pw_uid: ::uid_t, 479 pub pw_gid: ::gid_t, 480 pub pw_gecos: *mut ::c_char, 481 pub pw_dir: *mut ::c_char, 482 pub pw_shell: *mut ::c_char, 483 } 484 485 pub struct spwd { 486 pub sp_namp: *mut ::c_char, 487 pub sp_pwdp: *mut ::c_char, 488 pub sp_lstchg: ::c_long, 489 pub sp_min: ::c_long, 490 pub sp_max: ::c_long, 491 pub sp_warn: ::c_long, 492 pub sp_inact: ::c_long, 493 pub sp_expire: ::c_long, 494 pub sp_flag: ::c_ulong, 495 } 496 497 pub struct statvfs { 498 pub f_bsize: ::c_ulong, 499 pub f_frsize: ::c_ulong, 500 pub f_blocks: ::fsblkcnt_t, 501 pub f_bfree: ::fsblkcnt_t, 502 pub f_bavail: ::fsblkcnt_t, 503 pub f_files: ::fsfilcnt_t, 504 pub f_ffree: ::fsfilcnt_t, 505 pub f_favail: ::fsfilcnt_t, 506 #[cfg(target_endian = "little")] 507 pub f_fsid: ::c_ulong, 508 #[cfg(all(target_pointer_width = "32", not(target_arch = "x86_64")))] 509 __f_unused: ::c_int, 510 #[cfg(target_endian = "big")] 511 pub f_fsid: ::c_ulong, 512 pub f_flag: ::c_ulong, 513 pub f_namemax: ::c_ulong, 514 __f_spare: [::c_int; 6], 515 } 516 517 pub struct dqblk { 518 pub dqb_bhardlimit: u64, 519 pub dqb_bsoftlimit: u64, 520 pub dqb_curspace: u64, 521 pub dqb_ihardlimit: u64, 522 pub dqb_isoftlimit: u64, 523 pub dqb_curinodes: u64, 524 pub dqb_btime: u64, 525 pub dqb_itime: u64, 526 pub dqb_valid: u32, 527 } 528 529 pub struct signalfd_siginfo { 530 pub ssi_signo: u32, 531 pub ssi_errno: i32, 532 pub ssi_code: i32, 533 pub ssi_pid: u32, 534 pub ssi_uid: u32, 535 pub ssi_fd: i32, 536 pub ssi_tid: u32, 537 pub ssi_band: u32, 538 pub ssi_overrun: u32, 539 pub ssi_trapno: u32, 540 pub ssi_status: i32, 541 pub ssi_int: i32, 542 pub ssi_ptr: u64, 543 pub ssi_utime: u64, 544 pub ssi_stime: u64, 545 pub ssi_addr: u64, 546 pub ssi_addr_lsb: u16, 547 _pad2: u16, 548 pub ssi_syscall: i32, 549 pub ssi_call_addr: u64, 550 pub ssi_arch: u32, 551 _pad: [u8; 28], 552 } 553 554 pub struct itimerspec { 555 pub it_interval: ::timespec, 556 pub it_value: ::timespec, 557 } 558 559 pub struct fsid_t { 560 __val: [::c_int; 2], 561 } 562 563 pub struct cpu_set_t { 564 #[cfg(all(target_pointer_width = "32", 565 not(target_arch = "x86_64")))] 566 bits: [u32; 32], 567 #[cfg(not(all(target_pointer_width = "32", 568 not(target_arch = "x86_64"))))] 569 bits: [u64; 16], 570 } 571 572 pub struct if_nameindex { 573 pub if_index: ::c_uint, 574 pub if_name: *mut ::c_char, 575 } 576 577 // System V IPC 578 pub struct msginfo { 579 pub msgpool: ::c_int, 580 pub msgmap: ::c_int, 581 pub msgmax: ::c_int, 582 pub msgmnb: ::c_int, 583 pub msgmni: ::c_int, 584 pub msgssz: ::c_int, 585 pub msgtql: ::c_int, 586 pub msgseg: ::c_ushort, 587 } 588 589 pub struct mmsghdr { 590 pub msg_hdr: ::msghdr, 591 pub msg_len: ::c_uint, 592 } 593 594 pub struct sembuf { 595 pub sem_num: ::c_ushort, 596 pub sem_op: ::c_short, 597 pub sem_flg: ::c_short, 598 } 599 600 pub struct input_event { 601 pub time: ::timeval, 602 pub type_: ::__u16, 603 pub code: ::__u16, 604 pub value: ::__s32, 605 } 606 607 pub struct input_id { 608 pub bustype: ::__u16, 609 pub vendor: ::__u16, 610 pub product: ::__u16, 611 pub version: ::__u16, 612 } 613 614 pub struct input_absinfo { 615 pub value: ::__s32, 616 pub minimum: ::__s32, 617 pub maximum: ::__s32, 618 pub fuzz: ::__s32, 619 pub flat: ::__s32, 620 pub resolution: ::__s32, 621 } 622 623 pub struct input_keymap_entry { 624 pub flags: ::__u8, 625 pub len: ::__u8, 626 pub index: ::__u16, 627 pub keycode: ::__u32, 628 pub scancode: [::__u8; 32], 629 } 630 631 pub struct input_mask { 632 pub type_: ::__u32, 633 pub codes_size: ::__u32, 634 pub codes_ptr: ::__u64, 635 } 636 637 pub struct ff_replay { 638 pub length: ::__u16, 639 pub delay: ::__u16, 640 } 641 642 pub struct ff_trigger { 643 pub button: ::__u16, 644 pub interval: ::__u16, 645 } 646 647 pub struct ff_envelope { 648 pub attack_length: ::__u16, 649 pub attack_level: ::__u16, 650 pub fade_length: ::__u16, 651 pub fade_level: ::__u16, 652 } 653 654 pub struct ff_constant_effect { 655 pub level: ::__s16, 656 pub envelope: ff_envelope, 657 } 658 659 pub struct ff_ramp_effect { 660 pub start_level: ::__s16, 661 pub end_level: ::__s16, 662 pub envelope: ff_envelope, 663 } 664 665 pub struct ff_condition_effect { 666 pub right_saturation: ::__u16, 667 pub left_saturation: ::__u16, 668 669 pub right_coeff: ::__s16, 670 pub left_coeff: ::__s16, 671 672 pub deadband: ::__u16, 673 pub center: ::__s16, 674 } 675 676 pub struct ff_periodic_effect { 677 pub waveform: ::__u16, 678 pub period: ::__u16, 679 pub magnitude: ::__s16, 680 pub offset: ::__s16, 681 pub phase: ::__u16, 682 683 pub envelope: ff_envelope, 684 685 pub custom_len: ::__u32, 686 pub custom_data: *mut ::__s16, 687 } 688 689 pub struct ff_rumble_effect { 690 pub strong_magnitude: ::__u16, 691 pub weak_magnitude: ::__u16, 692 } 693 694 pub struct ff_effect { 695 pub type_: ::__u16, 696 pub id: ::__s16, 697 pub direction: ::__u16, 698 pub trigger: ff_trigger, 699 pub replay: ff_replay, 700 // FIXME this is actually a union 701 #[cfg(target_pointer_width = "64")] 702 pub u: [u64; 4], 703 #[cfg(target_pointer_width = "32")] 704 pub u: [u32; 7], 705 } 706 707 pub struct dl_phdr_info { 708 #[cfg(target_pointer_width = "64")] 709 pub dlpi_addr: Elf64_Addr, 710 #[cfg(target_pointer_width = "32")] 711 pub dlpi_addr: Elf32_Addr, 712 713 pub dlpi_name: *const ::c_char, 714 715 #[cfg(target_pointer_width = "64")] 716 pub dlpi_phdr: *const Elf64_Phdr, 717 #[cfg(target_pointer_width = "32")] 718 pub dlpi_phdr: *const Elf32_Phdr, 719 720 #[cfg(target_pointer_width = "64")] 721 pub dlpi_phnum: Elf64_Half, 722 #[cfg(target_pointer_width = "32")] 723 pub dlpi_phnum: Elf32_Half, 724 725 pub dlpi_adds: ::c_ulonglong, 726 pub dlpi_subs: ::c_ulonglong, 727 pub dlpi_tls_modid: ::size_t, 728 pub dlpi_tls_data: *mut ::c_void, 729 } 730 731 pub struct Elf32_Phdr { 732 pub p_type: Elf32_Word, 733 pub p_offset: Elf32_Off, 734 pub p_vaddr: Elf32_Addr, 735 pub p_paddr: Elf32_Addr, 736 pub p_filesz: Elf32_Word, 737 pub p_memsz: Elf32_Word, 738 pub p_flags: Elf32_Word, 739 pub p_align: Elf32_Word, 740 } 741 742 pub struct Elf64_Phdr { 743 pub p_type: Elf64_Word, 744 pub p_flags: Elf64_Word, 745 pub p_offset: Elf64_Off, 746 pub p_vaddr: Elf64_Addr, 747 pub p_paddr: Elf64_Addr, 748 pub p_filesz: Elf64_Xword, 749 pub p_memsz: Elf64_Xword, 750 pub p_align: Elf64_Xword, 751 } 752 753 pub struct statfs64 { 754 pub f_type: ::c_ulong, 755 pub f_bsize: ::c_ulong, 756 pub f_blocks: ::fsblkcnt_t, 757 pub f_bfree: ::fsblkcnt_t, 758 pub f_bavail: ::fsblkcnt_t, 759 pub f_files: ::fsfilcnt_t, 760 pub f_ffree: ::fsfilcnt_t, 761 pub f_fsid: ::fsid_t, 762 pub f_namelen: ::c_ulong, 763 pub f_frsize: ::c_ulong, 764 pub f_flags: ::c_ulong, 765 pub f_spare: [::c_ulong; 4], 766 } 767 768 pub struct statvfs64 { 769 pub f_bsize: ::c_ulong, 770 pub f_frsize: ::c_ulong, 771 pub f_blocks: u64, 772 pub f_bfree: u64, 773 pub f_bavail: u64, 774 pub f_files: u64, 775 pub f_ffree: u64, 776 pub f_favail: u64, 777 pub f_fsid: ::c_ulong, 778 pub f_flag: ::c_ulong, 779 pub f_namemax: ::c_ulong, 780 __f_spare: [::c_int; 6], 781 } 782 783 pub struct stack_t { 784 pub ss_sp: *mut ::c_void, 785 pub ss_flags: ::c_int, 786 pub ss_size: ::size_t 787 } 788 789 pub struct pthread_attr_t { 790 __size: [u64; 7] 791 } 792 793 pub struct sigset_t { 794 __val: [::c_ulong; 16], 795 } 796 797 pub struct shmid_ds { 798 pub shm_perm: ::ipc_perm, 799 pub shm_segsz: ::size_t, 800 pub shm_atime: ::time_t, 801 pub shm_dtime: ::time_t, 802 pub shm_ctime: ::time_t, 803 pub shm_cpid: ::pid_t, 804 pub shm_lpid: ::pid_t, 805 pub shm_nattch: ::c_ulong, 806 __pad1: ::c_ulong, 807 __pad2: ::c_ulong, 808 } 809 810 pub struct msqid_ds { 811 pub msg_perm: ::ipc_perm, 812 pub msg_stime: ::time_t, 813 pub msg_rtime: ::time_t, 814 pub msg_ctime: ::time_t, 815 __msg_cbytes: ::c_ulong, 816 pub msg_qnum: ::msgqnum_t, 817 pub msg_qbytes: ::msglen_t, 818 pub msg_lspid: ::pid_t, 819 pub msg_lrpid: ::pid_t, 820 __pad1: ::c_ulong, 821 __pad2: ::c_ulong, 822 } 823 824 pub struct statfs { 825 pub f_type: ::c_ulong, 826 pub f_bsize: ::c_ulong, 827 pub f_blocks: ::fsblkcnt_t, 828 pub f_bfree: ::fsblkcnt_t, 829 pub f_bavail: ::fsblkcnt_t, 830 pub f_files: ::fsfilcnt_t, 831 pub f_ffree: ::fsfilcnt_t, 832 pub f_fsid: ::fsid_t, 833 pub f_namelen: ::c_ulong, 834 pub f_frsize: ::c_ulong, 835 pub f_flags: ::c_ulong, 836 pub f_spare: [::c_ulong; 4], 837 } 838 839 pub struct msghdr { 840 pub msg_name: *mut ::c_void, 841 pub msg_namelen: ::socklen_t, 842 pub msg_iov: *mut ::iovec, 843 pub msg_iovlen: ::c_int, 844 __pad1: ::c_int, 845 pub msg_control: *mut ::c_void, 846 pub msg_controllen: ::socklen_t, 847 __pad2: ::socklen_t, 848 pub msg_flags: ::c_int, 849 } 850 851 pub struct cmsghdr { 852 pub cmsg_len: ::socklen_t, 853 pub __pad1: ::c_int, 854 pub cmsg_level: ::c_int, 855 pub cmsg_type: ::c_int, 856 } 857 858 pub struct sem_t { 859 __val: [::c_int; 8], 860 } 861 862 pub struct siginfo_t { 863 pub si_signo: ::c_int, 864 pub si_errno: ::c_int, 865 pub si_code: ::c_int, 866 pub _pad: [::c_int; 29], 867 _align: [usize; 0], 868 } 869 870 pub struct termios2 { 871 pub c_iflag: ::tcflag_t, 872 pub c_oflag: ::tcflag_t, 873 pub c_cflag: ::tcflag_t, 874 pub c_lflag: ::tcflag_t, 875 pub c_line: ::cc_t, 876 pub c_cc: [::cc_t; 19], 877 pub c_ispeed: ::speed_t, 878 pub c_ospeed: ::speed_t, 879 } 880 881 pub struct in6_pktinfo { 882 pub ipi6_addr: ::in6_addr, 883 pub ipi6_ifindex: ::c_uint, 884 } 885} 886 887s_no_extra_traits! { 888 pub struct sysinfo { 889 pub uptime: ::c_ulong, 890 pub loads: [::c_ulong; 3], 891 pub totalram: ::c_ulong, 892 pub freeram: ::c_ulong, 893 pub sharedram: ::c_ulong, 894 pub bufferram: ::c_ulong, 895 pub totalswap: ::c_ulong, 896 pub freeswap: ::c_ulong, 897 pub procs: ::c_ushort, 898 pub pad: ::c_ushort, 899 pub totalhigh: ::c_ulong, 900 pub freehigh: ::c_ulong, 901 pub mem_unit: ::c_uint, 902 pub __reserved: [::c_char; 256], 903 } 904 905 pub struct sockaddr_un { 906 pub sun_family: sa_family_t, 907 pub sun_path: [::c_char; 108] 908 } 909 910 pub struct sockaddr_storage { 911 pub ss_family: sa_family_t, 912 __ss_pad2: [u8; 128 - 2 - 8], 913 __ss_align: ::size_t, 914 } 915 916 pub struct utsname { 917 pub sysname: [::c_char; 65], 918 pub nodename: [::c_char; 65], 919 pub release: [::c_char; 65], 920 pub version: [::c_char; 65], 921 pub machine: [::c_char; 65], 922 pub domainname: [::c_char; 65] 923 } 924 925 pub struct dirent { 926 pub d_ino: ::ino_t, 927 pub d_off: ::off_t, 928 pub d_reclen: ::c_ushort, 929 pub d_type: ::c_uchar, 930 pub d_name: [::c_char; 256], 931 } 932 933 pub struct dirent64 { 934 pub d_ino: ::ino64_t, 935 pub d_off: ::off64_t, 936 pub d_reclen: ::c_ushort, 937 pub d_type: ::c_uchar, 938 pub d_name: [::c_char; 256], 939 } 940 941 // x32 compatibility 942 // See https://sourceware.org/bugzilla/show_bug.cgi?id=21279 943 pub struct mq_attr { 944 #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))] 945 pub mq_flags: i64, 946 #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))] 947 pub mq_maxmsg: i64, 948 #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))] 949 pub mq_msgsize: i64, 950 #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))] 951 pub mq_curmsgs: i64, 952 #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))] 953 pad: [i64; 4], 954 955 #[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))] 956 pub mq_flags: ::c_long, 957 #[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))] 958 pub mq_maxmsg: ::c_long, 959 #[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))] 960 pub mq_msgsize: ::c_long, 961 #[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))] 962 pub mq_curmsgs: ::c_long, 963 #[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))] 964 pad: [::c_long; 4], 965 } 966 967 pub struct sockaddr_nl { 968 pub nl_family: ::sa_family_t, 969 nl_pad: ::c_ushort, 970 pub nl_pid: u32, 971 pub nl_groups: u32 972 } 973 974 pub struct sigevent { 975 pub sigev_value: ::sigval, 976 pub sigev_signo: ::c_int, 977 pub sigev_notify: ::c_int, 978 pub sigev_notify_function: fn(::sigval), 979 pub sigev_notify_attributes: *mut pthread_attr_t, 980 pub __pad: [::c_char; 56 - 3 * 8 /* 8 == sizeof(long) */], 981 } 982} 983 984cfg_if! { 985 if #[cfg(feature = "extra_traits")] { 986 impl PartialEq for sysinfo { 987 fn eq(&self, other: &sysinfo) -> bool { 988 self.uptime == other.uptime 989 && self.loads == other.loads 990 && self.totalram == other.totalram 991 && self.freeram == other.freeram 992 && self.sharedram == other.sharedram 993 && self.bufferram == other.bufferram 994 && self.totalswap == other.totalswap 995 && self.freeswap == other.freeswap 996 && self.procs == other.procs 997 && self.pad == other.pad 998 && self.totalhigh == other.totalhigh 999 && self.freehigh == other.freehigh 1000 && self.mem_unit == other.mem_unit 1001 && self 1002 .__reserved 1003 .iter() 1004 .zip(other.__reserved.iter()) 1005 .all(|(a,b)| a == b) 1006 } 1007 } 1008 impl Eq for sysinfo {} 1009 impl ::fmt::Debug for sysinfo { 1010 fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { 1011 f.debug_struct("sysinfo") 1012 .field("uptime", &self.uptime) 1013 .field("loads", &self.loads) 1014 .field("totalram", &self.totalram) 1015 .field("freeram", &self.freeram) 1016 .field("sharedram", &self.sharedram) 1017 .field("bufferram", &self.bufferram) 1018 .field("totalswap", &self.totalswap) 1019 .field("freeswap", &self.freeswap) 1020 .field("procs", &self.procs) 1021 .field("pad", &self.pad) 1022 .field("totalhigh", &self.totalhigh) 1023 .field("freehigh", &self.freehigh) 1024 .field("mem_unit", &self.mem_unit) 1025 // FIXME: .field("__reserved", &self.__reserved) 1026 .finish() 1027 } 1028 } 1029 impl ::hash::Hash for sysinfo { 1030 fn hash<H: ::hash::Hasher>(&self, state: &mut H) { 1031 self.uptime.hash(state); 1032 self.loads.hash(state); 1033 self.totalram.hash(state); 1034 self.freeram.hash(state); 1035 self.sharedram.hash(state); 1036 self.bufferram.hash(state); 1037 self.totalswap.hash(state); 1038 self.freeswap.hash(state); 1039 self.procs.hash(state); 1040 self.pad.hash(state); 1041 self.totalhigh.hash(state); 1042 self.freehigh.hash(state); 1043 self.mem_unit.hash(state); 1044 self.__reserved.hash(state); 1045 } 1046 } 1047 1048 impl PartialEq for sockaddr_un { 1049 fn eq(&self, other: &sockaddr_un) -> bool { 1050 self.sun_family == other.sun_family 1051 && self 1052 .sun_path 1053 .iter() 1054 .zip(other.sun_path.iter()) 1055 .all(|(a,b)| a == b) 1056 } 1057 } 1058 impl Eq for sockaddr_un {} 1059 impl ::fmt::Debug for sockaddr_un { 1060 fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { 1061 f.debug_struct("sockaddr_un") 1062 .field("sun_family", &self.sun_family) 1063 // FIXME: .field("sun_path", &self.sun_path) 1064 .finish() 1065 } 1066 } 1067 impl ::hash::Hash for sockaddr_un { 1068 fn hash<H: ::hash::Hasher>(&self, state: &mut H) { 1069 self.sun_family.hash(state); 1070 self.sun_path.hash(state); 1071 } 1072 } 1073 1074 impl PartialEq for sockaddr_storage { 1075 fn eq(&self, other: &sockaddr_storage) -> bool { 1076 self.ss_family == other.ss_family 1077 && self.__ss_align == other.__ss_align 1078 && self 1079 .__ss_pad2 1080 .iter() 1081 .zip(other.__ss_pad2.iter()) 1082 .all(|(a, b)| a == b) 1083 } 1084 } 1085 impl Eq for sockaddr_storage {} 1086 impl ::fmt::Debug for sockaddr_storage { 1087 fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { 1088 f.debug_struct("sockaddr_storage") 1089 .field("ss_family", &self.ss_family) 1090 .field("__ss_align", &self.__ss_align) 1091 // FIXME: .field("__ss_pad2", &self.__ss_pad2) 1092 .finish() 1093 } 1094 } 1095 impl ::hash::Hash for sockaddr_storage { 1096 fn hash<H: ::hash::Hasher>(&self, state: &mut H) { 1097 self.ss_family.hash(state); 1098 self.__ss_align.hash(state); 1099 self.__ss_pad2.hash(state); 1100 } 1101 } 1102 1103 impl PartialEq for utsname { 1104 fn eq(&self, other: &utsname) -> bool { 1105 self.sysname 1106 .iter() 1107 .zip(other.sysname.iter()) 1108 .all(|(a,b)| a == b) 1109 && self 1110 .nodename 1111 .iter() 1112 .zip(other.nodename.iter()) 1113 .all(|(a,b)| a == b) 1114 && self 1115 .release 1116 .iter() 1117 .zip(other.release.iter()) 1118 .all(|(a,b)| a == b) 1119 && self 1120 .version 1121 .iter() 1122 .zip(other.version.iter()) 1123 .all(|(a,b)| a == b) 1124 && self 1125 .machine 1126 .iter() 1127 .zip(other.machine.iter()) 1128 .all(|(a,b)| a == b) 1129 } 1130 } 1131 impl Eq for utsname {} 1132 impl ::fmt::Debug for utsname { 1133 fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { 1134 f.debug_struct("utsname") 1135 // FIXME: .field("sysname", &self.sysname) 1136 // FIXME: .field("nodename", &self.nodename) 1137 // FIXME: .field("release", &self.release) 1138 // FIXME: .field("version", &self.version) 1139 // FIXME: .field("machine", &self.machine) 1140 .finish() 1141 } 1142 } 1143 impl ::hash::Hash for utsname { 1144 fn hash<H: ::hash::Hasher>(&self, state: &mut H) { 1145 self.sysname.hash(state); 1146 self.nodename.hash(state); 1147 self.release.hash(state); 1148 self.version.hash(state); 1149 self.machine.hash(state); 1150 } 1151 } 1152 1153 impl PartialEq for dirent { 1154 fn eq(&self, other: &dirent) -> bool { 1155 self.d_ino == other.d_ino 1156 && self.d_off == other.d_off 1157 && self.d_reclen == other.d_reclen 1158 && self.d_type == other.d_type 1159 && self 1160 .d_name 1161 .iter() 1162 .zip(other.d_name.iter()) 1163 .all(|(a,b)| a == b) 1164 } 1165 } 1166 impl Eq for dirent {} 1167 impl ::fmt::Debug for dirent { 1168 fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { 1169 f.debug_struct("dirent") 1170 .field("d_ino", &self.d_ino) 1171 .field("d_off", &self.d_off) 1172 .field("d_reclen", &self.d_reclen) 1173 .field("d_type", &self.d_type) 1174 // FIXME: .field("d_name", &self.d_name) 1175 .finish() 1176 } 1177 } 1178 impl ::hash::Hash for dirent { 1179 fn hash<H: ::hash::Hasher>(&self, state: &mut H) { 1180 self.d_ino.hash(state); 1181 self.d_off.hash(state); 1182 self.d_reclen.hash(state); 1183 self.d_type.hash(state); 1184 self.d_name.hash(state); 1185 } 1186 } 1187 1188 impl PartialEq for dirent64 { 1189 fn eq(&self, other: &dirent64) -> bool { 1190 self.d_ino == other.d_ino 1191 && self.d_off == other.d_off 1192 && self.d_reclen == other.d_reclen 1193 && self.d_type == other.d_type 1194 && self 1195 .d_name 1196 .iter() 1197 .zip(other.d_name.iter()) 1198 .all(|(a,b)| a == b) 1199 } 1200 } 1201 impl Eq for dirent64 {} 1202 impl ::fmt::Debug for dirent64 { 1203 fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { 1204 f.debug_struct("dirent64") 1205 .field("d_ino", &self.d_ino) 1206 .field("d_off", &self.d_off) 1207 .field("d_reclen", &self.d_reclen) 1208 .field("d_type", &self.d_type) 1209 // FIXME: .field("d_name", &self.d_name) 1210 .finish() 1211 } 1212 } 1213 impl ::hash::Hash for dirent64 { 1214 fn hash<H: ::hash::Hasher>(&self, state: &mut H) { 1215 self.d_ino.hash(state); 1216 self.d_off.hash(state); 1217 self.d_reclen.hash(state); 1218 self.d_type.hash(state); 1219 self.d_name.hash(state); 1220 } 1221 } 1222 1223 impl PartialEq for mq_attr { 1224 fn eq(&self, other: &mq_attr) -> bool { 1225 self.mq_flags == other.mq_flags && 1226 self.mq_maxmsg == other.mq_maxmsg && 1227 self.mq_msgsize == other.mq_msgsize && 1228 self.mq_curmsgs == other.mq_curmsgs 1229 } 1230 } 1231 impl Eq for mq_attr {} 1232 impl ::fmt::Debug for mq_attr { 1233 fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { 1234 f.debug_struct("mq_attr") 1235 .field("mq_flags", &self.mq_flags) 1236 .field("mq_maxmsg", &self.mq_maxmsg) 1237 .field("mq_msgsize", &self.mq_msgsize) 1238 .field("mq_curmsgs", &self.mq_curmsgs) 1239 .finish() 1240 } 1241 } 1242 impl ::hash::Hash for mq_attr { 1243 fn hash<H: ::hash::Hasher>(&self, state: &mut H) { 1244 self.mq_flags.hash(state); 1245 self.mq_maxmsg.hash(state); 1246 self.mq_msgsize.hash(state); 1247 self.mq_curmsgs.hash(state); 1248 } 1249 } 1250 1251 impl PartialEq for sockaddr_nl { 1252 fn eq(&self, other: &sockaddr_nl) -> bool { 1253 self.nl_family == other.nl_family && 1254 self.nl_pid == other.nl_pid && 1255 self.nl_groups == other.nl_groups 1256 } 1257 } 1258 impl Eq for sockaddr_nl {} 1259 impl ::fmt::Debug for sockaddr_nl { 1260 fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { 1261 f.debug_struct("sockaddr_nl") 1262 .field("nl_family", &self.nl_family) 1263 .field("nl_pid", &self.nl_pid) 1264 .field("nl_groups", &self.nl_groups) 1265 .finish() 1266 } 1267 } 1268 impl ::hash::Hash for sockaddr_nl { 1269 fn hash<H: ::hash::Hasher>(&self, state: &mut H) { 1270 self.nl_family.hash(state); 1271 self.nl_pid.hash(state); 1272 self.nl_groups.hash(state); 1273 } 1274 } 1275 1276 impl PartialEq for sigevent { 1277 fn eq(&self, other: &sigevent) -> bool { 1278 self.sigev_value == other.sigev_value 1279 && self.sigev_signo == other.sigev_signo 1280 && self.sigev_notify == other.sigev_notify 1281 && self.sigev_notify_function 1282 == other.sigev_notify_function 1283 && self.sigev_notify_attributes 1284 == other.sigev_notify_attributes 1285 } 1286 } 1287 impl Eq for sigevent {} 1288 impl ::fmt::Debug for sigevent { 1289 fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { 1290 f.debug_struct("sigevent") 1291 .field("sigev_value", &self.sigev_value) 1292 .field("sigev_signo", &self.sigev_signo) 1293 .field("sigev_notify", &self.sigev_notify) 1294 .field("sigev_notify_function", &self.sigev_notify_function) 1295 .field("sigev_notify_attributes", 1296 &self.sigev_notify_attributes) 1297 .finish() 1298 } 1299 } 1300 impl ::hash::Hash for sigevent { 1301 fn hash<H: ::hash::Hasher>(&self, state: &mut H) { 1302 self.sigev_value.hash(state); 1303 self.sigev_signo.hash(state); 1304 self.sigev_notify.hash(state); 1305 self.sigev_notify_function.hash(state); 1306 self.sigev_notify_attributes.hash(state); 1307 } 1308 } 1309 } 1310} 1311 1312// PUB_CONST 1313 1314pub const INT_MIN: c_int = -2147483648; 1315pub const INT_MAX: c_int = 2147483647; 1316 1317pub const SIG_DFL: sighandler_t = 0 as sighandler_t; 1318pub const SIG_IGN: sighandler_t = 1 as sighandler_t; 1319pub const SIG_ERR: sighandler_t = !0 as sighandler_t; 1320 1321pub const DT_UNKNOWN: u8 = 0; 1322pub const DT_FIFO: u8 = 1; 1323pub const DT_CHR: u8 = 2; 1324pub const DT_DIR: u8 = 4; 1325pub const DT_BLK: u8 = 6; 1326pub const DT_REG: u8 = 8; 1327pub const DT_LNK: u8 = 10; 1328pub const DT_SOCK: u8 = 12; 1329 1330pub const FD_CLOEXEC: ::c_int = 0x1; 1331 1332pub const USRQUOTA: ::c_int = 0; 1333pub const GRPQUOTA: ::c_int = 1; 1334 1335pub const SIGIOT: ::c_int = 6; 1336 1337pub const S_ISUID: ::c_int = 0x800; 1338pub const S_ISGID: ::c_int = 0x400; 1339pub const S_ISVTX: ::c_int = 0x200; 1340 1341pub const IF_NAMESIZE: ::size_t = 16; 1342pub const IFNAMSIZ: ::size_t = IF_NAMESIZE; 1343 1344pub const LOG_EMERG: ::c_int = 0; 1345pub const LOG_ALERT: ::c_int = 1; 1346pub const LOG_CRIT: ::c_int = 2; 1347pub const LOG_ERR: ::c_int = 3; 1348pub const LOG_WARNING: ::c_int = 4; 1349pub const LOG_NOTICE: ::c_int = 5; 1350pub const LOG_INFO: ::c_int = 6; 1351pub const LOG_DEBUG: ::c_int = 7; 1352 1353pub const LOG_KERN: ::c_int = 0; 1354pub const LOG_USER: ::c_int = 1 << 3; 1355pub const LOG_MAIL: ::c_int = 2 << 3; 1356pub const LOG_DAEMON: ::c_int = 3 << 3; 1357pub const LOG_AUTH: ::c_int = 4 << 3; 1358pub const LOG_SYSLOG: ::c_int = 5 << 3; 1359pub const LOG_LPR: ::c_int = 6 << 3; 1360pub const LOG_NEWS: ::c_int = 7 << 3; 1361pub const LOG_UUCP: ::c_int = 8 << 3; 1362pub const LOG_LOCAL0: ::c_int = 16 << 3; 1363pub const LOG_LOCAL1: ::c_int = 17 << 3; 1364pub const LOG_LOCAL2: ::c_int = 18 << 3; 1365pub const LOG_LOCAL3: ::c_int = 19 << 3; 1366pub const LOG_LOCAL4: ::c_int = 20 << 3; 1367pub const LOG_LOCAL5: ::c_int = 21 << 3; 1368pub const LOG_LOCAL6: ::c_int = 22 << 3; 1369pub const LOG_LOCAL7: ::c_int = 23 << 3; 1370 1371pub const LOG_PID: ::c_int = 0x01; 1372pub const LOG_CONS: ::c_int = 0x02; 1373pub const LOG_ODELAY: ::c_int = 0x04; 1374pub const LOG_NDELAY: ::c_int = 0x08; 1375pub const LOG_NOWAIT: ::c_int = 0x10; 1376 1377pub const LOG_PRIMASK: ::c_int = 7; 1378pub const LOG_FACMASK: ::c_int = 0x3f8; 1379 1380pub const PRIO_PROCESS: ::c_int = 0; 1381pub const PRIO_PGRP: ::c_int = 1; 1382pub const PRIO_USER: ::c_int = 2; 1383 1384pub const PRIO_MIN: ::c_int = -20; 1385pub const PRIO_MAX: ::c_int = 20; 1386 1387pub const IPPROTO_ICMP: ::c_int = 1; 1388pub const IPPROTO_ICMPV6: ::c_int = 58; 1389pub const IPPROTO_TCP: ::c_int = 6; 1390pub const IPPROTO_UDP: ::c_int = 17; 1391pub const IPPROTO_IP: ::c_int = 0; 1392pub const IPPROTO_IPV6: ::c_int = 41; 1393 1394pub const INADDR_LOOPBACK: in_addr_t = 2130706433; 1395pub const INADDR_ANY: in_addr_t = 0; 1396pub const INADDR_BROADCAST: in_addr_t = 4294967295; 1397pub const INADDR_NONE: in_addr_t = 4294967295; 1398 1399pub const EXIT_FAILURE: ::c_int = 1; 1400pub const EXIT_SUCCESS: ::c_int = 0; 1401pub const RAND_MAX: ::c_int = 2147483647; 1402pub const EOF: ::c_int = -1; 1403pub const SEEK_SET: ::c_int = 0; 1404pub const SEEK_CUR: ::c_int = 1; 1405pub const SEEK_END: ::c_int = 2; 1406pub const _IOFBF: ::c_int = 0; 1407pub const _IONBF: ::c_int = 2; 1408pub const _IOLBF: ::c_int = 1; 1409 1410pub const F_DUPFD: ::c_int = 0; 1411pub const F_GETFD: ::c_int = 1; 1412pub const F_SETFD: ::c_int = 2; 1413pub const F_GETFL: ::c_int = 3; 1414pub const F_SETFL: ::c_int = 4; 1415 1416// Linux-specific fcntls 1417pub const F_SETLEASE: ::c_int = 1024; 1418pub const F_GETLEASE: ::c_int = 1025; 1419pub const F_NOTIFY: ::c_int = 1026; 1420pub const F_CANCELLK: ::c_int = 1029; 1421pub const F_DUPFD_CLOEXEC: ::c_int = 1030; 1422pub const F_SETPIPE_SZ: ::c_int = 1031; 1423pub const F_GETPIPE_SZ: ::c_int = 1032; 1424pub const F_ADD_SEALS: ::c_int = 1033; 1425pub const F_GET_SEALS: ::c_int = 1034; 1426 1427pub const F_SEAL_SEAL: ::c_int = 0x0001; 1428pub const F_SEAL_SHRINK: ::c_int = 0x0002; 1429pub const F_SEAL_GROW: ::c_int = 0x0004; 1430pub const F_SEAL_WRITE: ::c_int = 0x0008; 1431 1432// FIXME(#235): Include file sealing fcntls once we have a way to verify them. 1433 1434pub const SIGTRAP: ::c_int = 5; 1435 1436pub const PTHREAD_CREATE_JOINABLE: ::c_int = 0; 1437pub const PTHREAD_CREATE_DETACHED: ::c_int = 1; 1438 1439pub const CLOCK_REALTIME: ::clockid_t = 0; 1440pub const CLOCK_MONOTONIC: ::clockid_t = 1; 1441pub const CLOCK_PROCESS_CPUTIME_ID: ::clockid_t = 2; 1442pub const CLOCK_THREAD_CPUTIME_ID: ::clockid_t = 3; 1443pub const CLOCK_MONOTONIC_RAW: ::clockid_t = 4; 1444pub const CLOCK_REALTIME_COARSE: ::clockid_t = 5; 1445pub const CLOCK_MONOTONIC_COARSE: ::clockid_t = 6; 1446pub const CLOCK_BOOTTIME: ::clockid_t = 7; 1447pub const CLOCK_REALTIME_ALARM: ::clockid_t = 8; 1448pub const CLOCK_BOOTTIME_ALARM: ::clockid_t = 9; 1449pub const CLOCK_SGI_CYCLE: ::clockid_t = 10; 1450pub const CLOCK_TAI: ::clockid_t = 11; 1451pub const TIMER_ABSTIME: ::c_int = 1; 1452 1453pub const RLIMIT_CPU: ::c_int = 0; 1454pub const RLIMIT_FSIZE: ::c_int = 1; 1455pub const RLIMIT_DATA: ::c_int = 2; 1456pub const RLIMIT_STACK: ::c_int = 3; 1457pub const RLIMIT_CORE: ::c_int = 4; 1458pub const RLIMIT_LOCKS: ::c_int = 10; 1459pub const RLIMIT_SIGPENDING: ::c_int = 11; 1460pub const RLIMIT_MSGQUEUE: ::c_int = 12; 1461pub const RLIMIT_NICE: ::c_int = 13; 1462pub const RLIMIT_RTPRIO: ::c_int = 14; 1463 1464pub const RUSAGE_SELF: ::c_int = 0; 1465 1466pub const O_RDONLY: ::c_int = 0; 1467pub const O_WRONLY: ::c_int = 1; 1468pub const O_RDWR: ::c_int = 2; 1469 1470pub const S_IFIFO: ::mode_t = 4096; 1471pub const S_IFCHR: ::mode_t = 8192; 1472pub const S_IFBLK: ::mode_t = 24576; 1473pub const S_IFDIR: ::mode_t = 16384; 1474pub const S_IFREG: ::mode_t = 32768; 1475pub const S_IFLNK: ::mode_t = 40960; 1476pub const S_IFSOCK: ::mode_t = 49152; 1477pub const S_IFMT: ::mode_t = 61440; 1478pub const S_IRWXU: ::mode_t = 448; 1479pub const S_IXUSR: ::mode_t = 64; 1480pub const S_IWUSR: ::mode_t = 128; 1481pub const S_IRUSR: ::mode_t = 256; 1482pub const S_IRWXG: ::mode_t = 56; 1483pub const S_IXGRP: ::mode_t = 8; 1484pub const S_IWGRP: ::mode_t = 16; 1485pub const S_IRGRP: ::mode_t = 32; 1486pub const S_IRWXO: ::mode_t = 7; 1487pub const S_IXOTH: ::mode_t = 1; 1488pub const S_IWOTH: ::mode_t = 2; 1489pub const S_IROTH: ::mode_t = 4; 1490pub const F_OK: ::c_int = 0; 1491pub const R_OK: ::c_int = 4; 1492pub const W_OK: ::c_int = 2; 1493pub const X_OK: ::c_int = 1; 1494pub const STDIN_FILENO: ::c_int = 0; 1495pub const STDOUT_FILENO: ::c_int = 1; 1496pub const STDERR_FILENO: ::c_int = 2; 1497pub const SIGHUP: ::c_int = 1; 1498pub const SIGINT: ::c_int = 2; 1499pub const SIGQUIT: ::c_int = 3; 1500pub const SIGILL: ::c_int = 4; 1501pub const SIGABRT: ::c_int = 6; 1502pub const SIGFPE: ::c_int = 8; 1503pub const SIGKILL: ::c_int = 9; 1504pub const SIGSEGV: ::c_int = 11; 1505pub const SIGPIPE: ::c_int = 13; 1506pub const SIGALRM: ::c_int = 14; 1507pub const SIGTERM: ::c_int = 15; 1508 1509pub const PROT_NONE: ::c_int = 0; 1510pub const PROT_READ: ::c_int = 1; 1511pub const PROT_WRITE: ::c_int = 2; 1512pub const PROT_EXEC: ::c_int = 4; 1513 1514pub const LC_CTYPE: ::c_int = 0; 1515pub const LC_NUMERIC: ::c_int = 1; 1516pub const LC_TIME: ::c_int = 2; 1517pub const LC_COLLATE: ::c_int = 3; 1518pub const LC_MONETARY: ::c_int = 4; 1519pub const LC_MESSAGES: ::c_int = 5; 1520pub const LC_ALL: ::c_int = 6; 1521pub const LC_CTYPE_MASK: ::c_int = 1 << LC_CTYPE; 1522pub const LC_NUMERIC_MASK: ::c_int = 1 << LC_NUMERIC; 1523pub const LC_TIME_MASK: ::c_int = 1 << LC_TIME; 1524pub const LC_COLLATE_MASK: ::c_int = 1 << LC_COLLATE; 1525pub const LC_MONETARY_MASK: ::c_int = 1 << LC_MONETARY; 1526pub const LC_MESSAGES_MASK: ::c_int = 1 << LC_MESSAGES; 1527// LC_ALL_MASK defined per platform 1528 1529pub const MAP_FILE: ::c_int = 0x0000; 1530pub const MAP_SHARED: ::c_int = 0x0001; 1531pub const MAP_PRIVATE: ::c_int = 0x0002; 1532pub const MAP_FIXED: ::c_int = 0x0010; 1533 1534pub const MAP_FAILED: *mut ::c_void = !0 as *mut ::c_void; 1535 1536// MS_ flags for msync(2) 1537pub const MS_ASYNC: ::c_int = 0x0001; 1538pub const MS_INVALIDATE: ::c_int = 0x0002; 1539pub const MS_SYNC: ::c_int = 0x0004; 1540 1541// MS_ flags for mount(2) 1542pub const MS_RDONLY: ::c_ulong = 0x01; 1543pub const MS_NOSUID: ::c_ulong = 0x02; 1544pub const MS_NODEV: ::c_ulong = 0x04; 1545pub const MS_NOEXEC: ::c_ulong = 0x08; 1546pub const MS_SYNCHRONOUS: ::c_ulong = 0x10; 1547pub const MS_REMOUNT: ::c_ulong = 0x20; 1548pub const MS_MANDLOCK: ::c_ulong = 0x40; 1549pub const MS_DIRSYNC: ::c_ulong = 0x80; 1550pub const MS_NOATIME: ::c_ulong = 0x0400; 1551pub const MS_NODIRATIME: ::c_ulong = 0x0800; 1552pub const MS_BIND: ::c_ulong = 0x1000; 1553pub const MS_MOVE: ::c_ulong = 0x2000; 1554pub const MS_REC: ::c_ulong = 0x4000; 1555pub const MS_SILENT: ::c_ulong = 0x8000; 1556pub const MS_POSIXACL: ::c_ulong = 0x010000; 1557pub const MS_UNBINDABLE: ::c_ulong = 0x020000; 1558pub const MS_PRIVATE: ::c_ulong = 0x040000; 1559pub const MS_SLAVE: ::c_ulong = 0x080000; 1560pub const MS_SHARED: ::c_ulong = 0x100000; 1561pub const MS_RELATIME: ::c_ulong = 0x200000; 1562pub const MS_KERNMOUNT: ::c_ulong = 0x400000; 1563pub const MS_I_VERSION: ::c_ulong = 0x800000; 1564pub const MS_STRICTATIME: ::c_ulong = 0x1000000; 1565pub const MS_ACTIVE: ::c_ulong = 0x40000000; 1566pub const MS_NOUSER: ::c_ulong = 0x80000000; 1567pub const MS_MGC_VAL: ::c_ulong = 0xc0ed0000; 1568pub const MS_MGC_MSK: ::c_ulong = 0xffff0000; 1569pub const MS_RMT_MASK: ::c_ulong = 0x800051; 1570 1571pub const EPERM: ::c_int = 1; 1572pub const ENOENT: ::c_int = 2; 1573pub const ESRCH: ::c_int = 3; 1574pub const EINTR: ::c_int = 4; 1575pub const EIO: ::c_int = 5; 1576pub const ENXIO: ::c_int = 6; 1577pub const E2BIG: ::c_int = 7; 1578pub const ENOEXEC: ::c_int = 8; 1579pub const EBADF: ::c_int = 9; 1580pub const ECHILD: ::c_int = 10; 1581pub const EAGAIN: ::c_int = 11; 1582pub const ENOMEM: ::c_int = 12; 1583pub const EACCES: ::c_int = 13; 1584pub const EFAULT: ::c_int = 14; 1585pub const ENOTBLK: ::c_int = 15; 1586pub const EBUSY: ::c_int = 16; 1587pub const EEXIST: ::c_int = 17; 1588pub const EXDEV: ::c_int = 18; 1589pub const ENODEV: ::c_int = 19; 1590pub const ENOTDIR: ::c_int = 20; 1591pub const EISDIR: ::c_int = 21; 1592pub const EINVAL: ::c_int = 22; 1593pub const ENFILE: ::c_int = 23; 1594pub const EMFILE: ::c_int = 24; 1595pub const ENOTTY: ::c_int = 25; 1596pub const ETXTBSY: ::c_int = 26; 1597pub const EFBIG: ::c_int = 27; 1598pub const ENOSPC: ::c_int = 28; 1599pub const ESPIPE: ::c_int = 29; 1600pub const EROFS: ::c_int = 30; 1601pub const EMLINK: ::c_int = 31; 1602pub const EPIPE: ::c_int = 32; 1603pub const EDOM: ::c_int = 33; 1604pub const ERANGE: ::c_int = 34; 1605pub const EWOULDBLOCK: ::c_int = EAGAIN; 1606 1607pub const SCM_RIGHTS: ::c_int = 0x01; 1608pub const SCM_CREDENTIALS: ::c_int = 0x02; 1609 1610pub const PROT_GROWSDOWN: ::c_int = 0x1000000; 1611pub const PROT_GROWSUP: ::c_int = 0x2000000; 1612 1613pub const MAP_TYPE: ::c_int = 0x000f; 1614 1615pub const MADV_NORMAL: ::c_int = 0; 1616pub const MADV_RANDOM: ::c_int = 1; 1617pub const MADV_SEQUENTIAL: ::c_int = 2; 1618pub const MADV_WILLNEED: ::c_int = 3; 1619pub const MADV_DONTNEED: ::c_int = 4; 1620pub const MADV_FREE: ::c_int = 8; 1621pub const MADV_REMOVE: ::c_int = 9; 1622pub const MADV_DONTFORK: ::c_int = 10; 1623pub const MADV_DOFORK: ::c_int = 11; 1624pub const MADV_MERGEABLE: ::c_int = 12; 1625pub const MADV_UNMERGEABLE: ::c_int = 13; 1626pub const MADV_HUGEPAGE: ::c_int = 14; 1627pub const MADV_NOHUGEPAGE: ::c_int = 15; 1628pub const MADV_DONTDUMP: ::c_int = 16; 1629pub const MADV_DODUMP: ::c_int = 17; 1630pub const MADV_HWPOISON: ::c_int = 100; 1631pub const MADV_SOFT_OFFLINE: ::c_int = 101; 1632 1633pub const IFF_UP: ::c_int = 0x1; 1634pub const IFF_BROADCAST: ::c_int = 0x2; 1635pub const IFF_DEBUG: ::c_int = 0x4; 1636pub const IFF_LOOPBACK: ::c_int = 0x8; 1637pub const IFF_POINTOPOINT: ::c_int = 0x10; 1638pub const IFF_NOTRAILERS: ::c_int = 0x20; 1639pub const IFF_RUNNING: ::c_int = 0x40; 1640pub const IFF_NOARP: ::c_int = 0x80; 1641pub const IFF_PROMISC: ::c_int = 0x100; 1642pub const IFF_ALLMULTI: ::c_int = 0x200; 1643pub const IFF_MASTER: ::c_int = 0x400; 1644pub const IFF_SLAVE: ::c_int = 0x800; 1645pub const IFF_MULTICAST: ::c_int = 0x1000; 1646pub const IFF_PORTSEL: ::c_int = 0x2000; 1647pub const IFF_AUTOMEDIA: ::c_int = 0x4000; 1648pub const IFF_DYNAMIC: ::c_int = 0x8000; 1649pub const IFF_TUN: ::c_int = 0x0001; 1650pub const IFF_TAP: ::c_int = 0x0002; 1651pub const IFF_NO_PI: ::c_int = 0x1000; 1652 1653pub const SOL_IP: ::c_int = 0; 1654pub const SOL_TCP: ::c_int = 6; 1655pub const SOL_UDP: ::c_int = 17; 1656pub const SOL_IPV6: ::c_int = 41; 1657pub const SOL_ICMPV6: ::c_int = 58; 1658pub const SOL_RAW: ::c_int = 255; 1659pub const SOL_DECNET: ::c_int = 261; 1660pub const SOL_X25: ::c_int = 262; 1661pub const SOL_PACKET: ::c_int = 263; 1662pub const SOL_ATM: ::c_int = 264; 1663pub const SOL_AAL: ::c_int = 265; 1664pub const SOL_IRDA: ::c_int = 266; 1665pub const SOL_NETBEUI: ::c_int = 267; 1666pub const SOL_LLC: ::c_int = 268; 1667pub const SOL_DCCP: ::c_int = 269; 1668pub const SOL_NETLINK: ::c_int = 270; 1669pub const SOL_TIPC: ::c_int = 271; 1670 1671pub const AF_UNSPEC: ::c_int = 0; 1672pub const AF_UNIX: ::c_int = 1; 1673pub const AF_LOCAL: ::c_int = 1; 1674pub const AF_INET: ::c_int = 2; 1675pub const AF_AX25: ::c_int = 3; 1676pub const AF_IPX: ::c_int = 4; 1677pub const AF_APPLETALK: ::c_int = 5; 1678pub const AF_NETROM: ::c_int = 6; 1679pub const AF_BRIDGE: ::c_int = 7; 1680pub const AF_ATMPVC: ::c_int = 8; 1681pub const AF_X25: ::c_int = 9; 1682pub const AF_INET6: ::c_int = 10; 1683pub const AF_ROSE: ::c_int = 11; 1684pub const AF_DECnet: ::c_int = 12; 1685pub const AF_NETBEUI: ::c_int = 13; 1686pub const AF_SECURITY: ::c_int = 14; 1687pub const AF_KEY: ::c_int = 15; 1688pub const AF_NETLINK: ::c_int = 16; 1689pub const AF_ROUTE: ::c_int = AF_NETLINK; 1690pub const AF_PACKET: ::c_int = 17; 1691pub const AF_ASH: ::c_int = 18; 1692pub const AF_ECONET: ::c_int = 19; 1693pub const AF_ATMSVC: ::c_int = 20; 1694pub const AF_RDS: ::c_int = 21; 1695pub const AF_SNA: ::c_int = 22; 1696pub const AF_IRDA: ::c_int = 23; 1697pub const AF_PPPOX: ::c_int = 24; 1698pub const AF_WANPIPE: ::c_int = 25; 1699pub const AF_LLC: ::c_int = 26; 1700pub const AF_CAN: ::c_int = 29; 1701pub const AF_TIPC: ::c_int = 30; 1702pub const AF_BLUETOOTH: ::c_int = 31; 1703pub const AF_IUCV: ::c_int = 32; 1704pub const AF_RXRPC: ::c_int = 33; 1705pub const AF_ISDN: ::c_int = 34; 1706pub const AF_PHONET: ::c_int = 35; 1707pub const AF_IEEE802154: ::c_int = 36; 1708pub const AF_CAIF: ::c_int = 37; 1709pub const AF_ALG: ::c_int = 38; 1710 1711pub const PF_UNSPEC: ::c_int = AF_UNSPEC; 1712pub const PF_UNIX: ::c_int = AF_UNIX; 1713pub const PF_LOCAL: ::c_int = AF_LOCAL; 1714pub const PF_INET: ::c_int = AF_INET; 1715pub const PF_AX25: ::c_int = AF_AX25; 1716pub const PF_IPX: ::c_int = AF_IPX; 1717pub const PF_APPLETALK: ::c_int = AF_APPLETALK; 1718pub const PF_NETROM: ::c_int = AF_NETROM; 1719pub const PF_BRIDGE: ::c_int = AF_BRIDGE; 1720pub const PF_ATMPVC: ::c_int = AF_ATMPVC; 1721pub const PF_X25: ::c_int = AF_X25; 1722pub const PF_INET6: ::c_int = AF_INET6; 1723pub const PF_ROSE: ::c_int = AF_ROSE; 1724pub const PF_DECnet: ::c_int = AF_DECnet; 1725pub const PF_NETBEUI: ::c_int = AF_NETBEUI; 1726pub const PF_SECURITY: ::c_int = AF_SECURITY; 1727pub const PF_KEY: ::c_int = AF_KEY; 1728pub const PF_NETLINK: ::c_int = AF_NETLINK; 1729pub const PF_ROUTE: ::c_int = AF_ROUTE; 1730pub const PF_PACKET: ::c_int = AF_PACKET; 1731pub const PF_ASH: ::c_int = AF_ASH; 1732pub const PF_ECONET: ::c_int = AF_ECONET; 1733pub const PF_ATMSVC: ::c_int = AF_ATMSVC; 1734pub const PF_RDS: ::c_int = AF_RDS; 1735pub const PF_SNA: ::c_int = AF_SNA; 1736pub const PF_IRDA: ::c_int = AF_IRDA; 1737pub const PF_PPPOX: ::c_int = AF_PPPOX; 1738pub const PF_WANPIPE: ::c_int = AF_WANPIPE; 1739pub const PF_LLC: ::c_int = AF_LLC; 1740pub const PF_CAN: ::c_int = AF_CAN; 1741pub const PF_TIPC: ::c_int = AF_TIPC; 1742pub const PF_BLUETOOTH: ::c_int = AF_BLUETOOTH; 1743pub const PF_IUCV: ::c_int = AF_IUCV; 1744pub const PF_RXRPC: ::c_int = AF_RXRPC; 1745pub const PF_ISDN: ::c_int = AF_ISDN; 1746pub const PF_PHONET: ::c_int = AF_PHONET; 1747pub const PF_IEEE802154: ::c_int = AF_IEEE802154; 1748pub const PF_CAIF: ::c_int = AF_CAIF; 1749pub const PF_ALG: ::c_int = AF_ALG; 1750 1751pub const SOMAXCONN: ::c_int = 128; 1752 1753pub const MSG_OOB: ::c_int = 1; 1754pub const MSG_PEEK: ::c_int = 2; 1755pub const MSG_DONTROUTE: ::c_int = 4; 1756pub const MSG_CTRUNC: ::c_int = 8; 1757pub const MSG_TRUNC: ::c_int = 0x20; 1758pub const MSG_DONTWAIT: ::c_int = 0x40; 1759pub const MSG_EOR: ::c_int = 0x80; 1760pub const MSG_WAITALL: ::c_int = 0x100; 1761pub const MSG_FIN: ::c_int = 0x200; 1762pub const MSG_SYN: ::c_int = 0x400; 1763pub const MSG_CONFIRM: ::c_int = 0x800; 1764pub const MSG_RST: ::c_int = 0x1000; 1765pub const MSG_ERRQUEUE: ::c_int = 0x2000; 1766pub const MSG_NOSIGNAL: ::c_int = 0x4000; 1767pub const MSG_MORE: ::c_int = 0x8000; 1768pub const MSG_WAITFORONE: ::c_int = 0x10000; 1769pub const MSG_FASTOPEN: ::c_int = 0x20000000; 1770pub const MSG_CMSG_CLOEXEC: ::c_int = 0x40000000; 1771 1772pub const SCM_TIMESTAMP: ::c_int = SO_TIMESTAMP; 1773 1774pub const SOCK_RAW: ::c_int = 3; 1775pub const SOCK_RDM: ::c_int = 4; 1776 1777pub const IP_TOS: ::c_int = 1; 1778pub const IP_TTL: ::c_int = 2; 1779pub const IP_HDRINCL: ::c_int = 3; 1780pub const IP_RECVTOS: ::c_int = 13; 1781pub const IP_FREEBIND: ::c_int = 15; 1782pub const IP_TRANSPARENT: ::c_int = 19; 1783pub const IP_MULTICAST_IF: ::c_int = 32; 1784pub const IP_MULTICAST_TTL: ::c_int = 33; 1785pub const IP_MULTICAST_LOOP: ::c_int = 34; 1786pub const IP_ADD_MEMBERSHIP: ::c_int = 35; 1787pub const IP_DROP_MEMBERSHIP: ::c_int = 36; 1788 1789pub const IPV6_UNICAST_HOPS: ::c_int = 16; 1790pub const IPV6_MULTICAST_IF: ::c_int = 17; 1791pub const IPV6_MULTICAST_HOPS: ::c_int = 18; 1792pub const IPV6_MULTICAST_LOOP: ::c_int = 19; 1793pub const IPV6_ADD_MEMBERSHIP: ::c_int = 20; 1794pub const IPV6_DROP_MEMBERSHIP: ::c_int = 21; 1795pub const IPV6_V6ONLY: ::c_int = 26; 1796pub const IPV6_RECVPKTINFO: ::c_int = 49; 1797pub const IPV6_RECVTCLASS: ::c_int = 66; 1798pub const IPV6_TCLASS: ::c_int = 67; 1799 1800pub const TCP_NODELAY: ::c_int = 1; 1801pub const TCP_MAXSEG: ::c_int = 2; 1802pub const TCP_CORK: ::c_int = 3; 1803pub const TCP_KEEPIDLE: ::c_int = 4; 1804pub const TCP_KEEPINTVL: ::c_int = 5; 1805pub const TCP_KEEPCNT: ::c_int = 6; 1806pub const TCP_SYNCNT: ::c_int = 7; 1807pub const TCP_LINGER2: ::c_int = 8; 1808pub const TCP_DEFER_ACCEPT: ::c_int = 9; 1809pub const TCP_WINDOW_CLAMP: ::c_int = 10; 1810pub const TCP_INFO: ::c_int = 11; 1811pub const TCP_QUICKACK: ::c_int = 12; 1812pub const TCP_CONGESTION: ::c_int = 13; 1813 1814pub const SO_DEBUG: ::c_int = 1; 1815 1816pub const SHUT_RD: ::c_int = 0; 1817pub const SHUT_WR: ::c_int = 1; 1818pub const SHUT_RDWR: ::c_int = 2; 1819 1820pub const LOCK_SH: ::c_int = 1; 1821pub const LOCK_EX: ::c_int = 2; 1822pub const LOCK_NB: ::c_int = 4; 1823pub const LOCK_UN: ::c_int = 8; 1824 1825pub const SS_ONSTACK: ::c_int = 1; 1826pub const SS_DISABLE: ::c_int = 2; 1827 1828pub const PATH_MAX: ::c_int = 4096; 1829 1830pub const FD_SETSIZE: usize = 1024; 1831 1832pub const EPOLLIN: ::c_int = 0x1; 1833pub const EPOLLPRI: ::c_int = 0x2; 1834pub const EPOLLOUT: ::c_int = 0x4; 1835pub const EPOLLRDNORM: ::c_int = 0x40; 1836pub const EPOLLRDBAND: ::c_int = 0x80; 1837pub const EPOLLWRNORM: ::c_int = 0x100; 1838pub const EPOLLWRBAND: ::c_int = 0x200; 1839pub const EPOLLMSG: ::c_int = 0x400; 1840pub const EPOLLERR: ::c_int = 0x8; 1841pub const EPOLLHUP: ::c_int = 0x10; 1842pub const EPOLLET: ::c_int = 0x80000000; 1843 1844pub const EPOLL_CTL_ADD: ::c_int = 1; 1845pub const EPOLL_CTL_MOD: ::c_int = 3; 1846pub const EPOLL_CTL_DEL: ::c_int = 2; 1847 1848pub const MNT_DETACH: ::c_int = 0x2; 1849pub const MNT_EXPIRE: ::c_int = 0x4; 1850 1851pub const Q_GETFMT: ::c_int = 0x800004; 1852pub const Q_GETINFO: ::c_int = 0x800005; 1853pub const Q_SETINFO: ::c_int = 0x800006; 1854pub const QIF_BLIMITS: u32 = 1; 1855pub const QIF_SPACE: u32 = 2; 1856pub const QIF_ILIMITS: u32 = 4; 1857pub const QIF_INODES: u32 = 8; 1858pub const QIF_BTIME: u32 = 16; 1859pub const QIF_ITIME: u32 = 32; 1860pub const QIF_LIMITS: u32 = 5; 1861pub const QIF_USAGE: u32 = 10; 1862pub const QIF_TIMES: u32 = 48; 1863pub const QIF_ALL: u32 = 63; 1864 1865pub const MNT_FORCE: ::c_int = 0x1; 1866 1867pub const Q_SYNC: ::c_int = 0x800001; 1868pub const Q_QUOTAON: ::c_int = 0x800002; 1869pub const Q_QUOTAOFF: ::c_int = 0x800003; 1870pub const Q_GETQUOTA: ::c_int = 0x800007; 1871pub const Q_SETQUOTA: ::c_int = 0x800008; 1872 1873pub const TCIOFF: ::c_int = 2; 1874pub const TCION: ::c_int = 3; 1875pub const TCOOFF: ::c_int = 0; 1876pub const TCOON: ::c_int = 1; 1877pub const TCIFLUSH: ::c_int = 0; 1878pub const TCOFLUSH: ::c_int = 1; 1879pub const TCIOFLUSH: ::c_int = 2; 1880pub const NL0: ::c_int = 0x00000000; 1881pub const NL1: ::c_int = 0x00000100; 1882pub const TAB0: ::c_int = 0x00000000; 1883pub const CR0: ::c_int = 0x00000000; 1884pub const FF0: ::c_int = 0x00000000; 1885pub const BS0: ::c_int = 0x00000000; 1886pub const VT0: ::c_int = 0x00000000; 1887pub const VERASE: usize = 2; 1888pub const VKILL: usize = 3; 1889pub const VINTR: usize = 0; 1890pub const VQUIT: usize = 1; 1891pub const VLNEXT: usize = 15; 1892pub const IGNBRK: ::tcflag_t = 0x00000001; 1893pub const BRKINT: ::tcflag_t = 0x00000002; 1894pub const IGNPAR: ::tcflag_t = 0x00000004; 1895pub const PARMRK: ::tcflag_t = 0x00000008; 1896pub const INPCK: ::tcflag_t = 0x00000010; 1897pub const ISTRIP: ::tcflag_t = 0x00000020; 1898pub const INLCR: ::tcflag_t = 0x00000040; 1899pub const IGNCR: ::tcflag_t = 0x00000080; 1900pub const ICRNL: ::tcflag_t = 0x00000100; 1901pub const IXANY: ::tcflag_t = 0x00000800; 1902pub const IMAXBEL: ::tcflag_t = 0x00002000; 1903pub const OPOST: ::tcflag_t = 0x1; 1904pub const CS5: ::tcflag_t = 0x00000000; 1905pub const CRTSCTS: ::tcflag_t = 0x80000000; 1906pub const ECHO: ::tcflag_t = 0x00000008; 1907pub const OCRNL: ::tcflag_t = 0o000010; 1908pub const ONOCR: ::tcflag_t = 0o000020; 1909pub const ONLRET: ::tcflag_t = 0o000040; 1910pub const OFILL: ::tcflag_t = 0o000100; 1911pub const OFDEL: ::tcflag_t = 0o000200; 1912 1913pub const CLONE_VM: ::c_int = 0x100; 1914pub const CLONE_FS: ::c_int = 0x200; 1915pub const CLONE_FILES: ::c_int = 0x400; 1916pub const CLONE_SIGHAND: ::c_int = 0x800; 1917pub const CLONE_PTRACE: ::c_int = 0x2000; 1918pub const CLONE_VFORK: ::c_int = 0x4000; 1919pub const CLONE_PARENT: ::c_int = 0x8000; 1920pub const CLONE_THREAD: ::c_int = 0x10000; 1921pub const CLONE_NEWNS: ::c_int = 0x20000; 1922pub const CLONE_SYSVSEM: ::c_int = 0x40000; 1923pub const CLONE_SETTLS: ::c_int = 0x80000; 1924pub const CLONE_PARENT_SETTID: ::c_int = 0x100000; 1925pub const CLONE_CHILD_CLEARTID: ::c_int = 0x200000; 1926pub const CLONE_DETACHED: ::c_int = 0x400000; 1927pub const CLONE_UNTRACED: ::c_int = 0x800000; 1928pub const CLONE_CHILD_SETTID: ::c_int = 0x01000000; 1929pub const CLONE_NEWUTS: ::c_int = 0x04000000; 1930pub const CLONE_NEWIPC: ::c_int = 0x08000000; 1931pub const CLONE_NEWUSER: ::c_int = 0x10000000; 1932pub const CLONE_NEWPID: ::c_int = 0x20000000; 1933pub const CLONE_NEWNET: ::c_int = 0x40000000; 1934pub const CLONE_IO: ::c_int = 0x80000000; 1935pub const CLONE_NEWCGROUP: ::c_int = 0x02000000; 1936 1937pub const WNOHANG: ::c_int = 0x00000001; 1938pub const WUNTRACED: ::c_int = 0x00000002; 1939pub const WSTOPPED: ::c_int = WUNTRACED; 1940pub const WEXITED: ::c_int = 0x00000004; 1941pub const WCONTINUED: ::c_int = 0x00000008; 1942pub const WNOWAIT: ::c_int = 0x01000000; 1943 1944// ::Options set using PTRACE_SETOPTIONS. 1945pub const PTRACE_O_TRACESYSGOOD: ::c_int = 0x00000001; 1946pub const PTRACE_O_TRACEFORK: ::c_int = 0x00000002; 1947pub const PTRACE_O_TRACEVFORK: ::c_int = 0x00000004; 1948pub const PTRACE_O_TRACECLONE: ::c_int = 0x00000008; 1949pub const PTRACE_O_TRACEEXEC: ::c_int = 0x00000010; 1950pub const PTRACE_O_TRACEVFORKDONE: ::c_int = 0x00000020; 1951pub const PTRACE_O_TRACEEXIT: ::c_int = 0x00000040; 1952pub const PTRACE_O_TRACESECCOMP: ::c_int = 0x00000080; 1953pub const PTRACE_O_EXITKILL: ::c_int = 0x00100000; 1954pub const PTRACE_O_SUSPEND_SECCOMP: ::c_int = 0x00200000; 1955pub const PTRACE_O_MASK: ::c_int = 0x003000ff; 1956 1957// Wait extended result codes for the above trace options. 1958pub const PTRACE_EVENT_FORK: ::c_int = 1; 1959pub const PTRACE_EVENT_VFORK: ::c_int = 2; 1960pub const PTRACE_EVENT_CLONE: ::c_int = 3; 1961pub const PTRACE_EVENT_EXEC: ::c_int = 4; 1962pub const PTRACE_EVENT_VFORK_DONE: ::c_int = 5; 1963pub const PTRACE_EVENT_EXIT: ::c_int = 6; 1964pub const PTRACE_EVENT_SECCOMP: ::c_int = 7; 1965// PTRACE_EVENT_STOP was added to glibc in 2.26 1966// pub const PTRACE_EVENT_STOP: ::c_int = 128; 1967 1968pub const __WNOTHREAD: ::c_int = 0x20000000; 1969pub const __WALL: ::c_int = 0x40000000; 1970pub const __WCLONE: ::c_int = 0x80000000; 1971 1972pub const SPLICE_F_MOVE: ::c_uint = 0x01; 1973pub const SPLICE_F_NONBLOCK: ::c_uint = 0x02; 1974pub const SPLICE_F_MORE: ::c_uint = 0x04; 1975pub const SPLICE_F_GIFT: ::c_uint = 0x08; 1976 1977pub const RTLD_LOCAL: ::c_int = 0; 1978pub const RTLD_LAZY: ::c_int = 1; 1979 1980pub const POSIX_FADV_NORMAL: ::c_int = 0; 1981pub const POSIX_FADV_RANDOM: ::c_int = 1; 1982pub const POSIX_FADV_SEQUENTIAL: ::c_int = 2; 1983pub const POSIX_FADV_WILLNEED: ::c_int = 3; 1984 1985pub const AT_FDCWD: ::c_int = -100; 1986pub const AT_SYMLINK_NOFOLLOW: ::c_int = 0x100; 1987pub const AT_REMOVEDIR: ::c_int = 0x200; 1988pub const AT_EACCESS: ::c_int = 0x200; 1989pub const AT_SYMLINK_FOLLOW: ::c_int = 0x400; 1990pub const AT_NO_AUTOMOUNT: ::c_int = 0x800; 1991pub const AT_EMPTY_PATH: ::c_int = 0x1000; 1992 1993pub const LOG_CRON: ::c_int = 9 << 3; 1994pub const LOG_AUTHPRIV: ::c_int = 10 << 3; 1995pub const LOG_FTP: ::c_int = 11 << 3; 1996pub const LOG_PERROR: ::c_int = 0x20; 1997 1998pub const PIPE_BUF: usize = 4096; 1999 2000pub const SI_LOAD_SHIFT: ::c_uint = 16; 2001 2002pub const CLD_EXITED: ::c_int = 1; 2003pub const CLD_KILLED: ::c_int = 2; 2004pub const CLD_DUMPED: ::c_int = 3; 2005pub const CLD_TRAPPED: ::c_int = 4; 2006pub const CLD_STOPPED: ::c_int = 5; 2007pub const CLD_CONTINUED: ::c_int = 6; 2008 2009pub const SIGEV_SIGNAL: ::c_int = 0; 2010pub const SIGEV_NONE: ::c_int = 1; 2011pub const SIGEV_THREAD: ::c_int = 2; 2012 2013pub const P_ALL: idtype_t = 0; 2014pub const P_PID: idtype_t = 1; 2015pub const P_PGID: idtype_t = 2; 2016 2017pub const UTIME_OMIT: c_long = 1073741822; 2018pub const UTIME_NOW: c_long = 1073741823; 2019 2020pub const POLLIN: ::c_short = 0x1; 2021pub const POLLPRI: ::c_short = 0x2; 2022pub const POLLOUT: ::c_short = 0x4; 2023pub const POLLERR: ::c_short = 0x8; 2024pub const POLLHUP: ::c_short = 0x10; 2025pub const POLLNVAL: ::c_short = 0x20; 2026pub const POLLRDNORM: ::c_short = 0x040; 2027pub const POLLRDBAND: ::c_short = 0x080; 2028 2029pub const ABDAY_1: ::nl_item = 0x20000; 2030pub const ABDAY_2: ::nl_item = 0x20001; 2031pub const ABDAY_3: ::nl_item = 0x20002; 2032pub const ABDAY_4: ::nl_item = 0x20003; 2033pub const ABDAY_5: ::nl_item = 0x20004; 2034pub const ABDAY_6: ::nl_item = 0x20005; 2035pub const ABDAY_7: ::nl_item = 0x20006; 2036 2037pub const DAY_1: ::nl_item = 0x20007; 2038pub const DAY_2: ::nl_item = 0x20008; 2039pub const DAY_3: ::nl_item = 0x20009; 2040pub const DAY_4: ::nl_item = 0x2000A; 2041pub const DAY_5: ::nl_item = 0x2000B; 2042pub const DAY_6: ::nl_item = 0x2000C; 2043pub const DAY_7: ::nl_item = 0x2000D; 2044 2045pub const ABMON_1: ::nl_item = 0x2000E; 2046pub const ABMON_2: ::nl_item = 0x2000F; 2047pub const ABMON_3: ::nl_item = 0x20010; 2048pub const ABMON_4: ::nl_item = 0x20011; 2049pub const ABMON_5: ::nl_item = 0x20012; 2050pub const ABMON_6: ::nl_item = 0x20013; 2051pub const ABMON_7: ::nl_item = 0x20014; 2052pub const ABMON_8: ::nl_item = 0x20015; 2053pub const ABMON_9: ::nl_item = 0x20016; 2054pub const ABMON_10: ::nl_item = 0x20017; 2055pub const ABMON_11: ::nl_item = 0x20018; 2056pub const ABMON_12: ::nl_item = 0x20019; 2057 2058pub const MON_1: ::nl_item = 0x2001A; 2059pub const MON_2: ::nl_item = 0x2001B; 2060pub const MON_3: ::nl_item = 0x2001C; 2061pub const MON_4: ::nl_item = 0x2001D; 2062pub const MON_5: ::nl_item = 0x2001E; 2063pub const MON_6: ::nl_item = 0x2001F; 2064pub const MON_7: ::nl_item = 0x20020; 2065pub const MON_8: ::nl_item = 0x20021; 2066pub const MON_9: ::nl_item = 0x20022; 2067pub const MON_10: ::nl_item = 0x20023; 2068pub const MON_11: ::nl_item = 0x20024; 2069pub const MON_12: ::nl_item = 0x20025; 2070 2071pub const AM_STR: ::nl_item = 0x20026; 2072pub const PM_STR: ::nl_item = 0x20027; 2073 2074pub const D_T_FMT: ::nl_item = 0x20028; 2075pub const D_FMT: ::nl_item = 0x20029; 2076pub const T_FMT: ::nl_item = 0x2002A; 2077pub const T_FMT_AMPM: ::nl_item = 0x2002B; 2078 2079pub const ERA: ::nl_item = 0x2002C; 2080pub const ERA_D_FMT: ::nl_item = 0x2002E; 2081pub const ALT_DIGITS: ::nl_item = 0x2002F; 2082pub const ERA_D_T_FMT: ::nl_item = 0x20030; 2083pub const ERA_T_FMT: ::nl_item = 0x20031; 2084 2085pub const CODESET: ::nl_item = 14; 2086 2087pub const CRNCYSTR: ::nl_item = 0x4000F; 2088 2089pub const RUSAGE_THREAD: ::c_int = 1; 2090pub const RUSAGE_CHILDREN: ::c_int = -1; 2091 2092pub const RADIXCHAR: ::nl_item = 0x10000; 2093pub const THOUSEP: ::nl_item = 0x10001; 2094 2095pub const YESEXPR: ::nl_item = 0x50000; 2096pub const NOEXPR: ::nl_item = 0x50001; 2097pub const YESSTR: ::nl_item = 0x50002; 2098pub const NOSTR: ::nl_item = 0x50003; 2099 2100pub const FILENAME_MAX: ::c_uint = 4096; 2101pub const L_tmpnam: ::c_uint = 20; 2102pub const _PC_LINK_MAX: ::c_int = 0; 2103pub const _PC_MAX_CANON: ::c_int = 1; 2104pub const _PC_MAX_INPUT: ::c_int = 2; 2105pub const _PC_NAME_MAX: ::c_int = 3; 2106pub const _PC_PATH_MAX: ::c_int = 4; 2107pub const _PC_PIPE_BUF: ::c_int = 5; 2108pub const _PC_CHOWN_RESTRICTED: ::c_int = 6; 2109pub const _PC_NO_TRUNC: ::c_int = 7; 2110pub const _PC_VDISABLE: ::c_int = 8; 2111pub const _PC_SYNC_IO: ::c_int = 9; 2112pub const _PC_ASYNC_IO: ::c_int = 10; 2113pub const _PC_PRIO_IO: ::c_int = 11; 2114pub const _PC_SOCK_MAXBUF: ::c_int = 12; 2115pub const _PC_FILESIZEBITS: ::c_int = 13; 2116pub const _PC_REC_INCR_XFER_SIZE: ::c_int = 14; 2117pub const _PC_REC_MAX_XFER_SIZE: ::c_int = 15; 2118pub const _PC_REC_MIN_XFER_SIZE: ::c_int = 16; 2119pub const _PC_REC_XFER_ALIGN: ::c_int = 17; 2120pub const _PC_ALLOC_SIZE_MIN: ::c_int = 18; 2121pub const _PC_SYMLINK_MAX: ::c_int = 19; 2122pub const _PC_2_SYMLINKS: ::c_int = 20; 2123 2124pub const _SC_ARG_MAX: ::c_int = 0; 2125pub const _SC_CHILD_MAX: ::c_int = 1; 2126pub const _SC_CLK_TCK: ::c_int = 2; 2127pub const _SC_NGROUPS_MAX: ::c_int = 3; 2128pub const _SC_OPEN_MAX: ::c_int = 4; 2129pub const _SC_STREAM_MAX: ::c_int = 5; 2130pub const _SC_TZNAME_MAX: ::c_int = 6; 2131pub const _SC_JOB_CONTROL: ::c_int = 7; 2132pub const _SC_SAVED_IDS: ::c_int = 8; 2133pub const _SC_REALTIME_SIGNALS: ::c_int = 9; 2134pub const _SC_PRIORITY_SCHEDULING: ::c_int = 10; 2135pub const _SC_TIMERS: ::c_int = 11; 2136pub const _SC_ASYNCHRONOUS_IO: ::c_int = 12; 2137pub const _SC_PRIORITIZED_IO: ::c_int = 13; 2138pub const _SC_SYNCHRONIZED_IO: ::c_int = 14; 2139pub const _SC_FSYNC: ::c_int = 15; 2140pub const _SC_MAPPED_FILES: ::c_int = 16; 2141pub const _SC_MEMLOCK: ::c_int = 17; 2142pub const _SC_MEMLOCK_RANGE: ::c_int = 18; 2143pub const _SC_MEMORY_PROTECTION: ::c_int = 19; 2144pub const _SC_MESSAGE_PASSING: ::c_int = 20; 2145pub const _SC_SEMAPHORES: ::c_int = 21; 2146pub const _SC_SHARED_MEMORY_OBJECTS: ::c_int = 22; 2147pub const _SC_AIO_LISTIO_MAX: ::c_int = 23; 2148pub const _SC_AIO_MAX: ::c_int = 24; 2149pub const _SC_AIO_PRIO_DELTA_MAX: ::c_int = 25; 2150pub const _SC_DELAYTIMER_MAX: ::c_int = 26; 2151pub const _SC_MQ_OPEN_MAX: ::c_int = 27; 2152pub const _SC_MQ_PRIO_MAX: ::c_int = 28; 2153pub const _SC_VERSION: ::c_int = 29; 2154pub const _SC_PAGESIZE: ::c_int = 30; 2155pub const _SC_PAGE_SIZE: ::c_int = _SC_PAGESIZE; 2156pub const _SC_RTSIG_MAX: ::c_int = 31; 2157pub const _SC_SEM_NSEMS_MAX: ::c_int = 32; 2158pub const _SC_SEM_VALUE_MAX: ::c_int = 33; 2159pub const _SC_SIGQUEUE_MAX: ::c_int = 34; 2160pub const _SC_TIMER_MAX: ::c_int = 35; 2161pub const _SC_BC_BASE_MAX: ::c_int = 36; 2162pub const _SC_BC_DIM_MAX: ::c_int = 37; 2163pub const _SC_BC_SCALE_MAX: ::c_int = 38; 2164pub const _SC_BC_STRING_MAX: ::c_int = 39; 2165pub const _SC_COLL_WEIGHTS_MAX: ::c_int = 40; 2166pub const _SC_EXPR_NEST_MAX: ::c_int = 42; 2167pub const _SC_LINE_MAX: ::c_int = 43; 2168pub const _SC_RE_DUP_MAX: ::c_int = 44; 2169pub const _SC_2_VERSION: ::c_int = 46; 2170pub const _SC_2_C_BIND: ::c_int = 47; 2171pub const _SC_2_C_DEV: ::c_int = 48; 2172pub const _SC_2_FORT_DEV: ::c_int = 49; 2173pub const _SC_2_FORT_RUN: ::c_int = 50; 2174pub const _SC_2_SW_DEV: ::c_int = 51; 2175pub const _SC_2_LOCALEDEF: ::c_int = 52; 2176pub const _SC_UIO_MAXIOV: ::c_int = 60; 2177pub const _SC_IOV_MAX: ::c_int = 60; 2178pub const _SC_THREADS: ::c_int = 67; 2179pub const _SC_THREAD_SAFE_FUNCTIONS: ::c_int = 68; 2180pub const _SC_GETGR_R_SIZE_MAX: ::c_int = 69; 2181pub const _SC_GETPW_R_SIZE_MAX: ::c_int = 70; 2182pub const _SC_LOGIN_NAME_MAX: ::c_int = 71; 2183pub const _SC_TTY_NAME_MAX: ::c_int = 72; 2184pub const _SC_THREAD_DESTRUCTOR_ITERATIONS: ::c_int = 73; 2185pub const _SC_THREAD_KEYS_MAX: ::c_int = 74; 2186pub const _SC_THREAD_STACK_MIN: ::c_int = 75; 2187pub const _SC_THREAD_THREADS_MAX: ::c_int = 76; 2188pub const _SC_THREAD_ATTR_STACKADDR: ::c_int = 77; 2189pub const _SC_THREAD_ATTR_STACKSIZE: ::c_int = 78; 2190pub const _SC_THREAD_PRIORITY_SCHEDULING: ::c_int = 79; 2191pub const _SC_THREAD_PRIO_INHERIT: ::c_int = 80; 2192pub const _SC_THREAD_PRIO_PROTECT: ::c_int = 81; 2193pub const _SC_THREAD_PROCESS_SHARED: ::c_int = 82; 2194pub const _SC_NPROCESSORS_CONF: ::c_int = 83; 2195pub const _SC_NPROCESSORS_ONLN: ::c_int = 84; 2196pub const _SC_PHYS_PAGES: ::c_int = 85; 2197pub const _SC_AVPHYS_PAGES: ::c_int = 86; 2198pub const _SC_ATEXIT_MAX: ::c_int = 87; 2199pub const _SC_PASS_MAX: ::c_int = 88; 2200pub const _SC_XOPEN_VERSION: ::c_int = 89; 2201pub const _SC_XOPEN_XCU_VERSION: ::c_int = 90; 2202pub const _SC_XOPEN_UNIX: ::c_int = 91; 2203pub const _SC_XOPEN_CRYPT: ::c_int = 92; 2204pub const _SC_XOPEN_ENH_I18N: ::c_int = 93; 2205pub const _SC_XOPEN_SHM: ::c_int = 94; 2206pub const _SC_2_CHAR_TERM: ::c_int = 95; 2207pub const _SC_2_UPE: ::c_int = 97; 2208pub const _SC_XOPEN_XPG2: ::c_int = 98; 2209pub const _SC_XOPEN_XPG3: ::c_int = 99; 2210pub const _SC_XOPEN_XPG4: ::c_int = 100; 2211pub const _SC_NZERO: ::c_int = 109; 2212pub const _SC_XBS5_ILP32_OFF32: ::c_int = 125; 2213pub const _SC_XBS5_ILP32_OFFBIG: ::c_int = 126; 2214pub const _SC_XBS5_LP64_OFF64: ::c_int = 127; 2215pub const _SC_XBS5_LPBIG_OFFBIG: ::c_int = 128; 2216pub const _SC_XOPEN_LEGACY: ::c_int = 129; 2217pub const _SC_XOPEN_REALTIME: ::c_int = 130; 2218pub const _SC_XOPEN_REALTIME_THREADS: ::c_int = 131; 2219pub const _SC_ADVISORY_INFO: ::c_int = 132; 2220pub const _SC_BARRIERS: ::c_int = 133; 2221pub const _SC_CLOCK_SELECTION: ::c_int = 137; 2222pub const _SC_CPUTIME: ::c_int = 138; 2223pub const _SC_THREAD_CPUTIME: ::c_int = 139; 2224pub const _SC_MONOTONIC_CLOCK: ::c_int = 149; 2225pub const _SC_READER_WRITER_LOCKS: ::c_int = 153; 2226pub const _SC_SPIN_LOCKS: ::c_int = 154; 2227pub const _SC_REGEXP: ::c_int = 155; 2228pub const _SC_SHELL: ::c_int = 157; 2229pub const _SC_SPAWN: ::c_int = 159; 2230pub const _SC_SPORADIC_SERVER: ::c_int = 160; 2231pub const _SC_THREAD_SPORADIC_SERVER: ::c_int = 161; 2232pub const _SC_TIMEOUTS: ::c_int = 164; 2233pub const _SC_TYPED_MEMORY_OBJECTS: ::c_int = 165; 2234pub const _SC_2_PBS: ::c_int = 168; 2235pub const _SC_2_PBS_ACCOUNTING: ::c_int = 169; 2236pub const _SC_2_PBS_LOCATE: ::c_int = 170; 2237pub const _SC_2_PBS_MESSAGE: ::c_int = 171; 2238pub const _SC_2_PBS_TRACK: ::c_int = 172; 2239pub const _SC_SYMLOOP_MAX: ::c_int = 173; 2240pub const _SC_STREAMS: ::c_int = 174; 2241pub const _SC_2_PBS_CHECKPOINT: ::c_int = 175; 2242pub const _SC_V6_ILP32_OFF32: ::c_int = 176; 2243pub const _SC_V6_ILP32_OFFBIG: ::c_int = 177; 2244pub const _SC_V6_LP64_OFF64: ::c_int = 178; 2245pub const _SC_V6_LPBIG_OFFBIG: ::c_int = 179; 2246pub const _SC_HOST_NAME_MAX: ::c_int = 180; 2247pub const _SC_TRACE: ::c_int = 181; 2248pub const _SC_TRACE_EVENT_FILTER: ::c_int = 182; 2249pub const _SC_TRACE_INHERIT: ::c_int = 183; 2250pub const _SC_TRACE_LOG: ::c_int = 184; 2251pub const _SC_IPV6: ::c_int = 235; 2252pub const _SC_RAW_SOCKETS: ::c_int = 236; 2253pub const _SC_V7_ILP32_OFF32: ::c_int = 237; 2254pub const _SC_V7_ILP32_OFFBIG: ::c_int = 238; 2255pub const _SC_V7_LP64_OFF64: ::c_int = 239; 2256pub const _SC_V7_LPBIG_OFFBIG: ::c_int = 240; 2257pub const _SC_SS_REPL_MAX: ::c_int = 241; 2258pub const _SC_TRACE_EVENT_NAME_MAX: ::c_int = 242; 2259pub const _SC_TRACE_NAME_MAX: ::c_int = 243; 2260pub const _SC_TRACE_SYS_MAX: ::c_int = 244; 2261pub const _SC_TRACE_USER_EVENT_MAX: ::c_int = 245; 2262pub const _SC_XOPEN_STREAMS: ::c_int = 246; 2263pub const _SC_THREAD_ROBUST_PRIO_INHERIT: ::c_int = 247; 2264pub const _SC_THREAD_ROBUST_PRIO_PROTECT: ::c_int = 248; 2265 2266pub const RLIM_SAVED_MAX: ::rlim_t = RLIM_INFINITY; 2267pub const RLIM_SAVED_CUR: ::rlim_t = RLIM_INFINITY; 2268 2269pub const GLOB_ERR: ::c_int = 1 << 0; 2270pub const GLOB_MARK: ::c_int = 1 << 1; 2271pub const GLOB_NOSORT: ::c_int = 1 << 2; 2272pub const GLOB_DOOFFS: ::c_int = 1 << 3; 2273pub const GLOB_NOCHECK: ::c_int = 1 << 4; 2274pub const GLOB_APPEND: ::c_int = 1 << 5; 2275pub const GLOB_NOESCAPE: ::c_int = 1 << 6; 2276 2277pub const GLOB_NOSPACE: ::c_int = 1; 2278pub const GLOB_ABORTED: ::c_int = 2; 2279pub const GLOB_NOMATCH: ::c_int = 3; 2280 2281pub const POSIX_MADV_NORMAL: ::c_int = 0; 2282pub const POSIX_MADV_RANDOM: ::c_int = 1; 2283pub const POSIX_MADV_SEQUENTIAL: ::c_int = 2; 2284pub const POSIX_MADV_WILLNEED: ::c_int = 3; 2285 2286pub const S_IEXEC: mode_t = 64; 2287pub const S_IWRITE: mode_t = 128; 2288pub const S_IREAD: mode_t = 256; 2289 2290pub const F_LOCK: ::c_int = 1; 2291pub const F_TEST: ::c_int = 3; 2292pub const F_TLOCK: ::c_int = 2; 2293pub const F_ULOCK: ::c_int = 0; 2294 2295pub const IFF_LOWER_UP: ::c_int = 0x10000; 2296pub const IFF_DORMANT: ::c_int = 0x20000; 2297pub const IFF_ECHO: ::c_int = 0x40000; 2298 2299pub const ST_RDONLY: ::c_ulong = 1; 2300pub const ST_NOSUID: ::c_ulong = 2; 2301pub const ST_NODEV: ::c_ulong = 4; 2302pub const ST_NOEXEC: ::c_ulong = 8; 2303pub const ST_SYNCHRONOUS: ::c_ulong = 16; 2304pub const ST_MANDLOCK: ::c_ulong = 64; 2305pub const ST_WRITE: ::c_ulong = 128; 2306pub const ST_APPEND: ::c_ulong = 256; 2307pub const ST_IMMUTABLE: ::c_ulong = 512; 2308pub const ST_NOATIME: ::c_ulong = 1024; 2309pub const ST_NODIRATIME: ::c_ulong = 2048; 2310 2311pub const RTLD_NEXT: *mut ::c_void = -1i64 as *mut ::c_void; 2312pub const RTLD_DEFAULT: *mut ::c_void = 0i64 as *mut ::c_void; 2313pub const RTLD_NODELETE: ::c_int = 0x1000; 2314pub const RTLD_NOW: ::c_int = 0x2; 2315 2316pub const TCP_MD5SIG: ::c_int = 14; 2317 2318align_const! { 2319 pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = pthread_mutex_t { 2320 size: [0; __SIZEOF_PTHREAD_MUTEX_T], 2321 }; 2322 pub const PTHREAD_COND_INITIALIZER: pthread_cond_t = pthread_cond_t { 2323 size: [0; __SIZEOF_PTHREAD_COND_T], 2324 }; 2325 pub const PTHREAD_RWLOCK_INITIALIZER: pthread_rwlock_t = pthread_rwlock_t { 2326 size: [0; __SIZEOF_PTHREAD_RWLOCK_T], 2327 }; 2328} 2329pub const PTHREAD_MUTEX_NORMAL: ::c_int = 0; 2330pub const PTHREAD_MUTEX_RECURSIVE: ::c_int = 1; 2331pub const PTHREAD_MUTEX_ERRORCHECK: ::c_int = 2; 2332pub const PTHREAD_MUTEX_DEFAULT: ::c_int = PTHREAD_MUTEX_NORMAL; 2333pub const PTHREAD_PROCESS_PRIVATE: ::c_int = 0; 2334pub const PTHREAD_PROCESS_SHARED: ::c_int = 1; 2335pub const __SIZEOF_PTHREAD_COND_T: usize = 48; 2336 2337pub const RENAME_NOREPLACE: ::c_int = 1; 2338pub const RENAME_EXCHANGE: ::c_int = 2; 2339pub const RENAME_WHITEOUT: ::c_int = 4; 2340 2341pub const SCHED_OTHER: ::c_int = 0; 2342pub const SCHED_FIFO: ::c_int = 1; 2343pub const SCHED_RR: ::c_int = 2; 2344pub const SCHED_BATCH: ::c_int = 3; 2345pub const SCHED_IDLE: ::c_int = 5; 2346 2347// netinet/in.h 2348// NOTE: These are in addition to the constants defined in src/unix/mod.rs 2349 2350// IPPROTO_IP defined in src/unix/mod.rs 2351/// Hop-by-hop option header 2352pub const IPPROTO_HOPOPTS: ::c_int = 0; 2353// IPPROTO_ICMP defined in src/unix/mod.rs 2354/// group mgmt protocol 2355pub const IPPROTO_IGMP: ::c_int = 2; 2356/// for compatibility 2357pub const IPPROTO_IPIP: ::c_int = 4; 2358// IPPROTO_TCP defined in src/unix/mod.rs 2359/// exterior gateway protocol 2360pub const IPPROTO_EGP: ::c_int = 8; 2361/// pup 2362pub const IPPROTO_PUP: ::c_int = 12; 2363// IPPROTO_UDP defined in src/unix/mod.rs 2364/// xns idp 2365pub const IPPROTO_IDP: ::c_int = 22; 2366/// tp-4 w/ class negotiation 2367pub const IPPROTO_TP: ::c_int = 29; 2368/// DCCP 2369pub const IPPROTO_DCCP: ::c_int = 33; 2370// IPPROTO_IPV6 defined in src/unix/mod.rs 2371/// IP6 routing header 2372pub const IPPROTO_ROUTING: ::c_int = 43; 2373/// IP6 fragmentation header 2374pub const IPPROTO_FRAGMENT: ::c_int = 44; 2375/// resource reservation 2376pub const IPPROTO_RSVP: ::c_int = 46; 2377/// General Routing Encap. 2378pub const IPPROTO_GRE: ::c_int = 47; 2379/// IP6 Encap Sec. Payload 2380pub const IPPROTO_ESP: ::c_int = 50; 2381/// IP6 Auth Header 2382pub const IPPROTO_AH: ::c_int = 51; 2383// IPPROTO_ICMPV6 defined in src/unix/mod.rs 2384/// IP6 no next header 2385pub const IPPROTO_NONE: ::c_int = 59; 2386/// IP6 destination option 2387pub const IPPROTO_DSTOPTS: ::c_int = 60; 2388pub const IPPROTO_MTP: ::c_int = 92; 2389pub const IPPROTO_BEETPH: ::c_int = 94; 2390/// encapsulation header 2391pub const IPPROTO_ENCAP: ::c_int = 98; 2392/// Protocol indep. multicast 2393pub const IPPROTO_PIM: ::c_int = 103; 2394/// IP Payload Comp. Protocol 2395pub const IPPROTO_COMP: ::c_int = 108; 2396/// SCTP 2397pub const IPPROTO_SCTP: ::c_int = 132; 2398pub const IPPROTO_MH: ::c_int = 135; 2399pub const IPPROTO_UDPLITE: ::c_int = 136; 2400pub const IPPROTO_MPLS: ::c_int = 137; 2401/// raw IP packet 2402pub const IPPROTO_RAW: ::c_int = 255; 2403pub const IPPROTO_MAX: ::c_int = 256; 2404 2405pub const AF_IB: ::c_int = 27; 2406pub const AF_MPLS: ::c_int = 28; 2407pub const AF_NFC: ::c_int = 39; 2408pub const AF_VSOCK: ::c_int = 40; 2409pub const PF_IB: ::c_int = AF_IB; 2410pub const PF_MPLS: ::c_int = AF_MPLS; 2411pub const PF_NFC: ::c_int = AF_NFC; 2412pub const PF_VSOCK: ::c_int = AF_VSOCK; 2413 2414// System V IPC 2415pub const IPC_PRIVATE: ::key_t = 0; 2416 2417pub const IPC_CREAT: ::c_int = 0o1000; 2418pub const IPC_EXCL: ::c_int = 0o2000; 2419pub const IPC_NOWAIT: ::c_int = 0o4000; 2420 2421pub const IPC_RMID: ::c_int = 0; 2422pub const IPC_SET: ::c_int = 1; 2423pub const IPC_STAT: ::c_int = 2; 2424pub const IPC_INFO: ::c_int = 3; 2425pub const MSG_STAT: ::c_int = 11; 2426pub const MSG_INFO: ::c_int = 12; 2427 2428pub const MSG_NOERROR: ::c_int = 0o10000; 2429pub const MSG_EXCEPT: ::c_int = 0o20000; 2430pub const MSG_COPY: ::c_int = 0o40000; 2431 2432pub const SHM_R: ::c_int = 0o400; 2433pub const SHM_W: ::c_int = 0o200; 2434 2435pub const SHM_RDONLY: ::c_int = 0o10000; 2436pub const SHM_RND: ::c_int = 0o20000; 2437pub const SHM_REMAP: ::c_int = 0o40000; 2438pub const SHM_EXEC: ::c_int = 0o100000; 2439 2440pub const SHM_LOCK: ::c_int = 11; 2441pub const SHM_UNLOCK: ::c_int = 12; 2442 2443pub const SHM_HUGETLB: ::c_int = 0o4000; 2444pub const SHM_NORESERVE: ::c_int = 0o10000; 2445 2446pub const EPOLLRDHUP: ::c_int = 0x2000; 2447pub const EPOLLEXCLUSIVE: ::c_int = 0x10000000; 2448pub const EPOLLONESHOT: ::c_int = 0x40000000; 2449 2450pub const QFMT_VFS_OLD: ::c_int = 1; 2451pub const QFMT_VFS_V0: ::c_int = 2; 2452pub const QFMT_VFS_V1: ::c_int = 4; 2453 2454pub const EFD_SEMAPHORE: ::c_int = 0x1; 2455 2456pub const LOG_NFACILITIES: ::c_int = 24; 2457 2458pub const SEM_FAILED: *mut ::sem_t = 0 as *mut sem_t; 2459 2460pub const RB_AUTOBOOT: ::c_int = 0x01234567u32 as i32; 2461pub const RB_HALT_SYSTEM: ::c_int = 0xcdef0123u32 as i32; 2462pub const RB_ENABLE_CAD: ::c_int = 0x89abcdefu32 as i32; 2463pub const RB_DISABLE_CAD: ::c_int = 0x00000000u32 as i32; 2464pub const RB_POWER_OFF: ::c_int = 0x4321fedcu32 as i32; 2465pub const RB_SW_SUSPEND: ::c_int = 0xd000fce2u32 as i32; 2466pub const RB_KEXEC: ::c_int = 0x45584543u32 as i32; 2467 2468pub const AI_PASSIVE: ::c_int = 0x0001; 2469pub const AI_CANONNAME: ::c_int = 0x0002; 2470pub const AI_NUMERICHOST: ::c_int = 0x0004; 2471pub const AI_V4MAPPED: ::c_int = 0x0008; 2472pub const AI_ALL: ::c_int = 0x0010; 2473pub const AI_ADDRCONFIG: ::c_int = 0x0020; 2474 2475pub const AI_NUMERICSERV: ::c_int = 0x0400; 2476 2477pub const EAI_BADFLAGS: ::c_int = -1; 2478pub const EAI_NONAME: ::c_int = -2; 2479pub const EAI_AGAIN: ::c_int = -3; 2480pub const EAI_FAIL: ::c_int = -4; 2481pub const EAI_FAMILY: ::c_int = -6; 2482pub const EAI_SOCKTYPE: ::c_int = -7; 2483pub const EAI_SERVICE: ::c_int = -8; 2484pub const EAI_MEMORY: ::c_int = -10; 2485pub const EAI_OVERFLOW: ::c_int = -12; 2486 2487pub const NI_NUMERICHOST: ::c_int = 1; 2488pub const NI_NUMERICSERV: ::c_int = 2; 2489pub const NI_NOFQDN: ::c_int = 4; 2490pub const NI_NAMEREQD: ::c_int = 8; 2491pub const NI_DGRAM: ::c_int = 16; 2492 2493pub const SYNC_FILE_RANGE_WAIT_BEFORE: ::c_uint = 1; 2494pub const SYNC_FILE_RANGE_WRITE: ::c_uint = 2; 2495pub const SYNC_FILE_RANGE_WAIT_AFTER: ::c_uint = 4; 2496 2497pub const EAI_SYSTEM: ::c_int = -11; 2498 2499pub const AIO_CANCELED: ::c_int = 0; 2500pub const AIO_NOTCANCELED: ::c_int = 1; 2501pub const AIO_ALLDONE: ::c_int = 2; 2502pub const LIO_READ: ::c_int = 0; 2503pub const LIO_WRITE: ::c_int = 1; 2504pub const LIO_NOP: ::c_int = 2; 2505pub const LIO_WAIT: ::c_int = 0; 2506pub const LIO_NOWAIT: ::c_int = 1; 2507 2508pub const MREMAP_MAYMOVE: ::c_int = 1; 2509pub const MREMAP_FIXED: ::c_int = 2; 2510 2511pub const PR_SET_PDEATHSIG: ::c_int = 1; 2512pub const PR_GET_PDEATHSIG: ::c_int = 2; 2513 2514pub const PR_GET_DUMPABLE: ::c_int = 3; 2515pub const PR_SET_DUMPABLE: ::c_int = 4; 2516 2517pub const PR_GET_UNALIGN: ::c_int = 5; 2518pub const PR_SET_UNALIGN: ::c_int = 6; 2519pub const PR_UNALIGN_NOPRINT: ::c_int = 1; 2520pub const PR_UNALIGN_SIGBUS: ::c_int = 2; 2521 2522pub const PR_GET_KEEPCAPS: ::c_int = 7; 2523pub const PR_SET_KEEPCAPS: ::c_int = 8; 2524 2525pub const PR_GET_FPEMU: ::c_int = 9; 2526pub const PR_SET_FPEMU: ::c_int = 10; 2527pub const PR_FPEMU_NOPRINT: ::c_int = 1; 2528pub const PR_FPEMU_SIGFPE: ::c_int = 2; 2529 2530pub const PR_GET_FPEXC: ::c_int = 11; 2531pub const PR_SET_FPEXC: ::c_int = 12; 2532pub const PR_FP_EXC_SW_ENABLE: ::c_int = 0x80; 2533pub const PR_FP_EXC_DIV: ::c_int = 0x010000; 2534pub const PR_FP_EXC_OVF: ::c_int = 0x020000; 2535pub const PR_FP_EXC_UND: ::c_int = 0x040000; 2536pub const PR_FP_EXC_RES: ::c_int = 0x080000; 2537pub const PR_FP_EXC_INV: ::c_int = 0x100000; 2538pub const PR_FP_EXC_DISABLED: ::c_int = 0; 2539pub const PR_FP_EXC_NONRECOV: ::c_int = 1; 2540pub const PR_FP_EXC_ASYNC: ::c_int = 2; 2541pub const PR_FP_EXC_PRECISE: ::c_int = 3; 2542 2543pub const PR_GET_TIMING: ::c_int = 13; 2544pub const PR_SET_TIMING: ::c_int = 14; 2545pub const PR_TIMING_STATISTICAL: ::c_int = 0; 2546pub const PR_TIMING_TIMESTAMP: ::c_int = 1; 2547 2548pub const PR_SET_NAME: ::c_int = 15; 2549pub const PR_GET_NAME: ::c_int = 16; 2550 2551pub const PR_GET_ENDIAN: ::c_int = 19; 2552pub const PR_SET_ENDIAN: ::c_int = 20; 2553pub const PR_ENDIAN_BIG: ::c_int = 0; 2554pub const PR_ENDIAN_LITTLE: ::c_int = 1; 2555pub const PR_ENDIAN_PPC_LITTLE: ::c_int = 2; 2556 2557pub const PR_GET_SECCOMP: ::c_int = 21; 2558pub const PR_SET_SECCOMP: ::c_int = 22; 2559 2560pub const PR_CAPBSET_READ: ::c_int = 23; 2561pub const PR_CAPBSET_DROP: ::c_int = 24; 2562 2563pub const PR_GET_TSC: ::c_int = 25; 2564pub const PR_SET_TSC: ::c_int = 26; 2565pub const PR_TSC_ENABLE: ::c_int = 1; 2566pub const PR_TSC_SIGSEGV: ::c_int = 2; 2567 2568pub const PR_GET_SECUREBITS: ::c_int = 27; 2569pub const PR_SET_SECUREBITS: ::c_int = 28; 2570 2571pub const PR_SET_TIMERSLACK: ::c_int = 29; 2572pub const PR_GET_TIMERSLACK: ::c_int = 30; 2573 2574pub const PR_TASK_PERF_EVENTS_DISABLE: ::c_int = 31; 2575pub const PR_TASK_PERF_EVENTS_ENABLE: ::c_int = 32; 2576 2577pub const PR_MCE_KILL: ::c_int = 33; 2578pub const PR_MCE_KILL_CLEAR: ::c_int = 0; 2579pub const PR_MCE_KILL_SET: ::c_int = 1; 2580 2581pub const PR_MCE_KILL_LATE: ::c_int = 0; 2582pub const PR_MCE_KILL_EARLY: ::c_int = 1; 2583pub const PR_MCE_KILL_DEFAULT: ::c_int = 2; 2584 2585pub const PR_MCE_KILL_GET: ::c_int = 34; 2586 2587pub const PR_SET_MM: ::c_int = 35; 2588pub const PR_SET_MM_START_CODE: ::c_int = 1; 2589pub const PR_SET_MM_END_CODE: ::c_int = 2; 2590pub const PR_SET_MM_START_DATA: ::c_int = 3; 2591pub const PR_SET_MM_END_DATA: ::c_int = 4; 2592pub const PR_SET_MM_START_STACK: ::c_int = 5; 2593pub const PR_SET_MM_START_BRK: ::c_int = 6; 2594pub const PR_SET_MM_BRK: ::c_int = 7; 2595pub const PR_SET_MM_ARG_START: ::c_int = 8; 2596pub const PR_SET_MM_ARG_END: ::c_int = 9; 2597pub const PR_SET_MM_ENV_START: ::c_int = 10; 2598pub const PR_SET_MM_ENV_END: ::c_int = 11; 2599pub const PR_SET_MM_AUXV: ::c_int = 12; 2600pub const PR_SET_MM_EXE_FILE: ::c_int = 13; 2601pub const PR_SET_MM_MAP: ::c_int = 14; 2602pub const PR_SET_MM_MAP_SIZE: ::c_int = 15; 2603 2604pub const PR_SET_PTRACER: ::c_int = 0x59616d61; 2605 2606pub const PR_SET_CHILD_SUBREAPER: ::c_int = 36; 2607pub const PR_GET_CHILD_SUBREAPER: ::c_int = 37; 2608 2609pub const PR_SET_NO_NEW_PRIVS: ::c_int = 38; 2610pub const PR_GET_NO_NEW_PRIVS: ::c_int = 39; 2611 2612pub const PR_GET_TID_ADDRESS: ::c_int = 40; 2613 2614pub const PR_SET_THP_DISABLE: ::c_int = 41; 2615pub const PR_GET_THP_DISABLE: ::c_int = 42; 2616 2617pub const PR_MPX_ENABLE_MANAGEMENT: ::c_int = 43; 2618pub const PR_MPX_DISABLE_MANAGEMENT: ::c_int = 44; 2619 2620pub const PR_SET_FP_MODE: ::c_int = 45; 2621pub const PR_GET_FP_MODE: ::c_int = 46; 2622pub const PR_FP_MODE_FR: ::c_int = 1 << 0; 2623pub const PR_FP_MODE_FRE: ::c_int = 1 << 1; 2624 2625pub const PR_CAP_AMBIENT: ::c_int = 47; 2626pub const PR_CAP_AMBIENT_IS_SET: ::c_int = 1; 2627pub const PR_CAP_AMBIENT_RAISE: ::c_int = 2; 2628pub const PR_CAP_AMBIENT_LOWER: ::c_int = 3; 2629pub const PR_CAP_AMBIENT_CLEAR_ALL: ::c_int = 4; 2630 2631pub const ITIMER_REAL: ::c_int = 0; 2632pub const ITIMER_VIRTUAL: ::c_int = 1; 2633pub const ITIMER_PROF: ::c_int = 2; 2634 2635pub const TFD_CLOEXEC: ::c_int = O_CLOEXEC; 2636pub const TFD_NONBLOCK: ::c_int = O_NONBLOCK; 2637pub const TFD_TIMER_ABSTIME: ::c_int = 1; 2638 2639pub const XATTR_CREATE: ::c_int = 0x1; 2640pub const XATTR_REPLACE: ::c_int = 0x2; 2641 2642pub const _POSIX_VDISABLE: ::cc_t = 0; 2643 2644pub const FALLOC_FL_KEEP_SIZE: ::c_int = 0x01; 2645pub const FALLOC_FL_PUNCH_HOLE: ::c_int = 0x02; 2646pub const FALLOC_FL_COLLAPSE_RANGE: ::c_int = 0x08; 2647pub const FALLOC_FL_ZERO_RANGE: ::c_int = 0x10; 2648pub const FALLOC_FL_INSERT_RANGE: ::c_int = 0x20; 2649pub const FALLOC_FL_UNSHARE_RANGE: ::c_int = 0x40; 2650 2651// On Linux, libc doesn't define this constant, libattr does instead. 2652// We still define it for Linux as it's defined by libc on other platforms, 2653// and it's mentioned in the man pages for getxattr and setxattr. 2654pub const ENOATTR: ::c_int = ::ENODATA; 2655 2656pub const SO_ORIGINAL_DST: ::c_int = 80; 2657pub const IUTF8: ::tcflag_t = 0x00004000; 2658pub const CMSPAR: ::tcflag_t = 0o10000000000; 2659 2660pub const MFD_CLOEXEC: ::c_uint = 0x0001; 2661pub const MFD_ALLOW_SEALING: ::c_uint = 0x0002; 2662 2663// these are used in the p_type field of Elf32_Phdr and Elf64_Phdr, which has 2664// the type Elf32Word and Elf64Word respectively. Luckily, both of those are u32 2665// so we can use that type here to avoid having to cast. 2666pub const PT_NULL: u32 = 0; 2667pub const PT_LOAD: u32 = 1; 2668pub const PT_DYNAMIC: u32 = 2; 2669pub const PT_INTERP: u32 = 3; 2670pub const PT_NOTE: u32 = 4; 2671pub const PT_SHLIB: u32 = 5; 2672pub const PT_PHDR: u32 = 6; 2673pub const PT_TLS: u32 = 7; 2674pub const PT_NUM: u32 = 8; 2675pub const PT_LOOS: u32 = 0x60000000; 2676pub const PT_GNU_EH_FRAME: u32 = 0x6474e550; 2677pub const PT_GNU_STACK: u32 = 0x6474e551; 2678pub const PT_GNU_RELRO: u32 = 0x6474e552; 2679 2680// Ethernet protocol IDs. 2681pub const ETH_P_IP: ::c_int = 0x0800; 2682 2683pub const SFD_CLOEXEC: ::c_int = 0x080000; 2684 2685pub const NCCS: usize = 32; 2686 2687pub const O_TRUNC: ::c_int = 0x00040000; 2688pub const O_NOATIME: ::c_int = 0x00002000; 2689pub const O_CLOEXEC: ::c_int = 0x00000100; 2690pub const O_TMPFILE: ::c_int = 0x00004000; 2691 2692pub const EBFONT: ::c_int = 59; 2693pub const ENOSTR: ::c_int = 60; 2694pub const ENODATA: ::c_int = 61; 2695pub const ETIME: ::c_int = 62; 2696pub const ENOSR: ::c_int = 63; 2697pub const ENONET: ::c_int = 64; 2698pub const ENOPKG: ::c_int = 65; 2699pub const EREMOTE: ::c_int = 66; 2700pub const ENOLINK: ::c_int = 67; 2701pub const EADV: ::c_int = 68; 2702pub const ESRMNT: ::c_int = 69; 2703pub const ECOMM: ::c_int = 70; 2704pub const EPROTO: ::c_int = 71; 2705pub const EDOTDOT: ::c_int = 73; 2706 2707pub const SA_NODEFER: ::c_int = 0x40000000; 2708pub const SA_RESETHAND: ::c_int = 0x80000000; 2709pub const SA_RESTART: ::c_int = 0x10000000; 2710pub const SA_NOCLDSTOP: ::c_int = 0x00000001; 2711 2712pub const EPOLL_CLOEXEC: ::c_int = 0x80000; 2713 2714pub const EFD_CLOEXEC: ::c_int = 0x80000; 2715 2716pub const BUFSIZ: ::c_uint = 1024; 2717pub const TMP_MAX: ::c_uint = 10000; 2718pub const FOPEN_MAX: ::c_uint = 1000; 2719pub const O_PATH: ::c_int = 0x00400000; 2720pub const O_EXEC: ::c_int = O_PATH; 2721pub const O_SEARCH: ::c_int = O_PATH; 2722pub const O_ACCMODE: ::c_int = 03 | O_SEARCH; 2723pub const O_NDELAY: ::c_int = O_NONBLOCK; 2724pub const NI_MAXHOST: ::socklen_t = 255; 2725pub const PTHREAD_STACK_MIN: ::size_t = 2048; 2726pub const POSIX_FADV_DONTNEED: ::c_int = 4; 2727pub const POSIX_FADV_NOREUSE: ::c_int = 5; 2728 2729pub const POSIX_MADV_DONTNEED: ::c_int = 4; 2730 2731pub const RLIM_INFINITY: ::rlim_t = !0; 2732pub const RLIMIT_RTTIME: ::c_int = 15; 2733pub const RLIMIT_NLIMITS: ::c_int = 16; 2734pub const RLIM_NLIMITS: ::c_int = RLIMIT_NLIMITS; 2735 2736pub const MAP_ANONYMOUS: ::c_int = MAP_ANON; 2737 2738pub const SOCK_DCCP: ::c_int = 6; 2739pub const SOCK_PACKET: ::c_int = 10; 2740 2741pub const TCP_COOKIE_TRANSACTIONS: ::c_int = 15; 2742pub const TCP_THIN_LINEAR_TIMEOUTS: ::c_int = 16; 2743pub const TCP_THIN_DUPACK: ::c_int = 17; 2744pub const TCP_USER_TIMEOUT: ::c_int = 18; 2745pub const TCP_REPAIR: ::c_int = 19; 2746pub const TCP_REPAIR_QUEUE: ::c_int = 20; 2747pub const TCP_QUEUE_SEQ: ::c_int = 21; 2748pub const TCP_REPAIR_OPTIONS: ::c_int = 22; 2749pub const TCP_FASTOPEN: ::c_int = 23; 2750pub const TCP_TIMESTAMP: ::c_int = 24; 2751 2752pub const SIGUNUSED: ::c_int = ::SIGSYS; 2753 2754pub const __SIZEOF_PTHREAD_CONDATTR_T: usize = 4; 2755pub const __SIZEOF_PTHREAD_MUTEXATTR_T: usize = 4; 2756pub const __SIZEOF_PTHREAD_RWLOCKATTR_T: usize = 8; 2757 2758pub const CPU_SETSIZE: ::c_int = 128; 2759 2760pub const PTRACE_TRACEME: ::c_int = 0; 2761pub const PTRACE_PEEKTEXT: ::c_int = 1; 2762pub const PTRACE_PEEKDATA: ::c_int = 2; 2763pub const PTRACE_PEEKUSER: ::c_int = 3; 2764pub const PTRACE_POKETEXT: ::c_int = 4; 2765pub const PTRACE_POKEDATA: ::c_int = 5; 2766pub const PTRACE_POKEUSER: ::c_int = 6; 2767pub const PTRACE_CONT: ::c_int = 7; 2768pub const PTRACE_KILL: ::c_int = 8; 2769pub const PTRACE_SINGLESTEP: ::c_int = 9; 2770pub const PTRACE_GETREGS: ::c_int = 12; 2771pub const PTRACE_SETREGS: ::c_int = 13; 2772pub const PTRACE_GETFPREGS: ::c_int = 14; 2773pub const PTRACE_SETFPREGS: ::c_int = 15; 2774pub const PTRACE_ATTACH: ::c_int = 16; 2775pub const PTRACE_DETACH: ::c_int = 17; 2776pub const PTRACE_GETFPXREGS: ::c_int = 18; 2777pub const PTRACE_SETFPXREGS: ::c_int = 19; 2778pub const PTRACE_SYSCALL: ::c_int = 24; 2779pub const PTRACE_SETOPTIONS: ::c_int = 0x4200; 2780pub const PTRACE_GETEVENTMSG: ::c_int = 0x4201; 2781pub const PTRACE_GETSIGINFO: ::c_int = 0x4202; 2782pub const PTRACE_SETSIGINFO: ::c_int = 0x4203; 2783pub const PTRACE_GETREGSET: ::c_int = 0x4204; 2784pub const PTRACE_SETREGSET: ::c_int = 0x4205; 2785pub const PTRACE_SEIZE: ::c_int = 0x4206; 2786pub const PTRACE_INTERRUPT: ::c_int = 0x4207; 2787pub const PTRACE_LISTEN: ::c_int = 0x4208; 2788pub const PTRACE_PEEKSIGINFO: ::c_int = 0x4209; 2789 2790pub const EPOLLWAKEUP: ::c_int = 0x20000000; 2791 2792pub const EFD_NONBLOCK: ::c_int = ::O_NONBLOCK; 2793 2794pub const SFD_NONBLOCK: ::c_int = ::O_NONBLOCK; 2795 2796pub const TCSANOW: ::c_int = 0; 2797pub const TCSADRAIN: ::c_int = 1; 2798pub const TCSAFLUSH: ::c_int = 2; 2799 2800pub const TIOCINQ: ::c_int = ::FIONREAD; 2801 2802pub const RTLD_GLOBAL: ::c_int = 0x100; 2803pub const RTLD_NOLOAD: ::c_int = 0x4; 2804 2805pub const MCL_CURRENT: ::c_int = 0x0001; 2806pub const MCL_FUTURE: ::c_int = 0x0002; 2807 2808pub const CBAUD: ::tcflag_t = 0o0010017; 2809pub const TAB1: ::c_int = 0x00000800; 2810pub const TAB2: ::c_int = 0x00001000; 2811pub const TAB3: ::c_int = 0x00001800; 2812pub const CR1: ::c_int = 0x00000200; 2813pub const CR2: ::c_int = 0x00000400; 2814pub const CR3: ::c_int = 0x00000600; 2815pub const FF1: ::c_int = 0x00008000; 2816pub const BS1: ::c_int = 0x00002000; 2817pub const VT1: ::c_int = 0x00004000; 2818pub const VWERASE: usize = 14; 2819pub const VREPRINT: usize = 12; 2820pub const VSUSP: usize = 10; 2821pub const VSTART: usize = 8; 2822pub const VSTOP: usize = 9; 2823pub const VDISCARD: usize = 13; 2824pub const VTIME: usize = 5; 2825pub const IXON: ::tcflag_t = 0x00000400; 2826pub const IXOFF: ::tcflag_t = 0x00001000; 2827pub const ONLCR: ::tcflag_t = 0x4; 2828pub const CSIZE: ::tcflag_t = 0x00000030; 2829pub const CS6: ::tcflag_t = 0x00000010; 2830pub const CS7: ::tcflag_t = 0x00000020; 2831pub const CS8: ::tcflag_t = 0x00000030; 2832pub const CSTOPB: ::tcflag_t = 0x00000040; 2833pub const CREAD: ::tcflag_t = 0x00000080; 2834pub const PARENB: ::tcflag_t = 0x00000100; 2835pub const PARODD: ::tcflag_t = 0x00000200; 2836pub const HUPCL: ::tcflag_t = 0x00000400; 2837pub const CLOCAL: ::tcflag_t = 0x00000800; 2838pub const ECHOKE: ::tcflag_t = 0x00000800; 2839pub const ECHOE: ::tcflag_t = 0x00000010; 2840pub const ECHOK: ::tcflag_t = 0x00000020; 2841pub const ECHONL: ::tcflag_t = 0x00000040; 2842pub const ECHOPRT: ::tcflag_t = 0x00000400; 2843pub const ECHOCTL: ::tcflag_t = 0x00000200; 2844pub const ISIG: ::tcflag_t = 0x00000001; 2845pub const ICANON: ::tcflag_t = 0x00000002; 2846pub const PENDIN: ::tcflag_t = 0x00004000; 2847pub const NOFLSH: ::tcflag_t = 0x00000080; 2848pub const CIBAUD: ::tcflag_t = 0o02003600000; 2849pub const CBAUDEX: ::tcflag_t = 0o010000; 2850pub const VSWTC: usize = 7; 2851pub const OLCUC: ::tcflag_t = 0o000002; 2852pub const NLDLY: ::tcflag_t = 0o000400; 2853pub const CRDLY: ::tcflag_t = 0o003000; 2854pub const TABDLY: ::tcflag_t = 0o014000; 2855pub const BSDLY: ::tcflag_t = 0o020000; 2856pub const FFDLY: ::tcflag_t = 0o100000; 2857pub const VTDLY: ::tcflag_t = 0o040000; 2858pub const XTABS: ::tcflag_t = 0o014000; 2859 2860pub const B0: ::speed_t = 0o000000; 2861pub const B50: ::speed_t = 0o000001; 2862pub const B75: ::speed_t = 0o000002; 2863pub const B110: ::speed_t = 0o000003; 2864pub const B134: ::speed_t = 0o000004; 2865pub const B150: ::speed_t = 0o000005; 2866pub const B200: ::speed_t = 0o000006; 2867pub const B300: ::speed_t = 0o000007; 2868pub const B600: ::speed_t = 0o000010; 2869pub const B1200: ::speed_t = 0o000011; 2870pub const B1800: ::speed_t = 0o000012; 2871pub const B2400: ::speed_t = 0o000013; 2872pub const B4800: ::speed_t = 0o000014; 2873pub const B9600: ::speed_t = 0o000015; 2874pub const B19200: ::speed_t = 0o000016; 2875pub const B38400: ::speed_t = 0o000017; 2876pub const EXTA: ::speed_t = B19200; 2877pub const EXTB: ::speed_t = B38400; 2878pub const B57600: ::speed_t = 0o010001; 2879pub const B115200: ::speed_t = 0o010002; 2880pub const B230400: ::speed_t = 0o010003; 2881pub const B460800: ::speed_t = 0o010004; 2882pub const B500000: ::speed_t = 0o010005; 2883pub const B576000: ::speed_t = 0o010006; 2884pub const B921600: ::speed_t = 0o010007; 2885pub const B1000000: ::speed_t = 0o010010; 2886pub const B1152000: ::speed_t = 0o010011; 2887pub const B1500000: ::speed_t = 0o010012; 2888pub const B2000000: ::speed_t = 0o010013; 2889pub const B2500000: ::speed_t = 0o010014; 2890pub const B3000000: ::speed_t = 0o010015; 2891pub const B3500000: ::speed_t = 0o010016; 2892pub const B4000000: ::speed_t = 0o010017; 2893 2894pub const SO_BINDTODEVICE: ::c_int = 25; 2895pub const SO_TIMESTAMP: ::c_int = 29; 2896pub const SO_MARK: ::c_int = 36; 2897pub const SO_RXQ_OVFL: ::c_int = 40; 2898pub const SO_PEEK_OFF: ::c_int = 42; 2899pub const SO_BUSY_POLL: ::c_int = 46; 2900 2901pub const __SIZEOF_PTHREAD_RWLOCK_T: usize = 56; 2902pub const __SIZEOF_PTHREAD_MUTEX_T: usize = 40; 2903 2904pub const O_ASYNC: ::c_int = 0x00000400; 2905 2906pub const FIOCLEX: ::c_int = 0x5451; 2907pub const FIONBIO: ::c_int = 0x5421; 2908 2909pub const RLIMIT_RSS: ::c_int = 5; 2910pub const RLIMIT_NOFILE: ::c_int = 7; 2911pub const RLIMIT_AS: ::c_int = 9; 2912pub const RLIMIT_NPROC: ::c_int = 6; 2913pub const RLIMIT_MEMLOCK: ::c_int = 8; 2914 2915pub const O_APPEND: ::c_int = 0x00100000; 2916pub const O_CREAT: ::c_int = 0x00010000; 2917pub const O_EXCL: ::c_int = 0x00020000; 2918pub const O_NOCTTY: ::c_int = 0x00000200; 2919pub const O_NONBLOCK: ::c_int = 0x00000010; 2920pub const O_SYNC: ::c_int = 0x00000040 | O_DSYNC; 2921pub const O_RSYNC: ::c_int = O_SYNC; 2922pub const O_DSYNC: ::c_int = 0x00000020; 2923 2924pub const SOCK_CLOEXEC: ::c_int = 0o2000000; 2925pub const SOCK_NONBLOCK: ::c_int = 0o4000; 2926 2927pub const MAP_ANON: ::c_int = 0x0020; 2928pub const MAP_GROWSDOWN: ::c_int = 0x0100; 2929pub const MAP_DENYWRITE: ::c_int = 0x0800; 2930pub const MAP_EXECUTABLE: ::c_int = 0x01000; 2931pub const MAP_LOCKED: ::c_int = 0x02000; 2932pub const MAP_NORESERVE: ::c_int = 0x04000; 2933pub const MAP_POPULATE: ::c_int = 0x08000; 2934pub const MAP_NONBLOCK: ::c_int = 0x010000; 2935pub const MAP_STACK: ::c_int = 0x020000; 2936 2937pub const SOCK_STREAM: ::c_int = 1; 2938pub const SOCK_DGRAM: ::c_int = 2; 2939pub const SOCK_SEQPACKET: ::c_int = 5; 2940 2941pub const SOL_SOCKET: ::c_int = 1; 2942 2943pub const EDEADLK: ::c_int = 35; 2944pub const ENAMETOOLONG: ::c_int = 36; 2945pub const ENOLCK: ::c_int = 37; 2946pub const ENOSYS: ::c_int = 38; 2947pub const ENOTEMPTY: ::c_int = 39; 2948pub const ELOOP: ::c_int = 40; 2949pub const ENOMSG: ::c_int = 42; 2950pub const EIDRM: ::c_int = 43; 2951pub const ECHRNG: ::c_int = 44; 2952pub const EL2NSYNC: ::c_int = 45; 2953pub const EL3HLT: ::c_int = 46; 2954pub const EL3RST: ::c_int = 47; 2955pub const ELNRNG: ::c_int = 48; 2956pub const EUNATCH: ::c_int = 49; 2957pub const ENOCSI: ::c_int = 50; 2958pub const EL2HLT: ::c_int = 51; 2959pub const EBADE: ::c_int = 52; 2960pub const EBADR: ::c_int = 53; 2961pub const EXFULL: ::c_int = 54; 2962pub const ENOANO: ::c_int = 55; 2963pub const EBADRQC: ::c_int = 56; 2964pub const EBADSLT: ::c_int = 57; 2965pub const EDEADLOCK: ::c_int = EDEADLK; 2966pub const EMULTIHOP: ::c_int = 72; 2967pub const EBADMSG: ::c_int = 74; 2968pub const EOVERFLOW: ::c_int = 75; 2969pub const ENOTUNIQ: ::c_int = 76; 2970pub const EBADFD: ::c_int = 77; 2971pub const EREMCHG: ::c_int = 78; 2972pub const ELIBACC: ::c_int = 79; 2973pub const ELIBBAD: ::c_int = 80; 2974pub const ELIBSCN: ::c_int = 81; 2975pub const ELIBMAX: ::c_int = 82; 2976pub const ELIBEXEC: ::c_int = 83; 2977pub const EILSEQ: ::c_int = 84; 2978pub const ERESTART: ::c_int = 85; 2979pub const ESTRPIPE: ::c_int = 86; 2980pub const EUSERS: ::c_int = 87; 2981pub const ENOTSOCK: ::c_int = 88; 2982pub const EDESTADDRREQ: ::c_int = 89; 2983pub const EMSGSIZE: ::c_int = 90; 2984pub const EPROTOTYPE: ::c_int = 91; 2985pub const ENOPROTOOPT: ::c_int = 92; 2986pub const EPROTONOSUPPORT: ::c_int = 93; 2987pub const ESOCKTNOSUPPORT: ::c_int = 94; 2988pub const EOPNOTSUPP: ::c_int = 95; 2989pub const ENOTSUP: ::c_int = EOPNOTSUPP; 2990pub const EPFNOSUPPORT: ::c_int = 96; 2991pub const EAFNOSUPPORT: ::c_int = 97; 2992pub const EADDRINUSE: ::c_int = 98; 2993pub const EADDRNOTAVAIL: ::c_int = 99; 2994pub const ENETDOWN: ::c_int = 100; 2995pub const ENETUNREACH: ::c_int = 101; 2996pub const ENETRESET: ::c_int = 102; 2997pub const ECONNABORTED: ::c_int = 103; 2998pub const ECONNRESET: ::c_int = 104; 2999pub const ENOBUFS: ::c_int = 105; 3000pub const EISCONN: ::c_int = 106; 3001pub const ENOTCONN: ::c_int = 107; 3002pub const ESHUTDOWN: ::c_int = 108; 3003pub const ETOOMANYREFS: ::c_int = 109; 3004pub const ETIMEDOUT: ::c_int = 110; 3005pub const ECONNREFUSED: ::c_int = 111; 3006pub const EHOSTDOWN: ::c_int = 112; 3007pub const EHOSTUNREACH: ::c_int = 113; 3008pub const EALREADY: ::c_int = 114; 3009pub const EINPROGRESS: ::c_int = 115; 3010pub const ESTALE: ::c_int = 116; 3011pub const EUCLEAN: ::c_int = 117; 3012pub const ENOTNAM: ::c_int = 118; 3013pub const ENAVAIL: ::c_int = 119; 3014pub const EISNAM: ::c_int = 120; 3015pub const EREMOTEIO: ::c_int = 121; 3016pub const EDQUOT: ::c_int = 122; 3017pub const ENOMEDIUM: ::c_int = 123; 3018pub const EMEDIUMTYPE: ::c_int = 124; 3019pub const ECANCELED: ::c_int = 125; 3020pub const ENOKEY: ::c_int = 126; 3021pub const EKEYEXPIRED: ::c_int = 127; 3022pub const EKEYREVOKED: ::c_int = 128; 3023pub const EKEYREJECTED: ::c_int = 129; 3024pub const EOWNERDEAD: ::c_int = 130; 3025pub const ENOTRECOVERABLE: ::c_int = 131; 3026pub const ERFKILL: ::c_int = 132; 3027pub const EHWPOISON: ::c_int = 133; 3028 3029pub const SO_REUSEADDR: ::c_int = 2; 3030pub const SO_TYPE: ::c_int = 3; 3031pub const SO_ERROR: ::c_int = 4; 3032pub const SO_DONTROUTE: ::c_int = 5; 3033pub const SO_BROADCAST: ::c_int = 6; 3034pub const SO_SNDBUF: ::c_int = 7; 3035pub const SO_RCVBUF: ::c_int = 8; 3036pub const SO_KEEPALIVE: ::c_int = 9; 3037pub const SO_OOBINLINE: ::c_int = 10; 3038pub const SO_NO_CHECK: ::c_int = 11; 3039pub const SO_PRIORITY: ::c_int = 12; 3040pub const SO_LINGER: ::c_int = 13; 3041pub const SO_BSDCOMPAT: ::c_int = 14; 3042pub const SO_REUSEPORT: ::c_int = 15; 3043pub const SO_PASSCRED: ::c_int = 16; 3044pub const SO_PEERCRED: ::c_int = 17; 3045pub const SO_RCVLOWAT: ::c_int = 18; 3046pub const SO_SNDLOWAT: ::c_int = 19; 3047pub const SO_RCVTIMEO: ::c_int = 20; 3048pub const SO_SNDTIMEO: ::c_int = 21; 3049pub const SO_ACCEPTCONN: ::c_int = 30; 3050pub const SO_SNDBUFFORCE: ::c_int = 32; 3051pub const SO_RCVBUFFORCE: ::c_int = 33; 3052pub const SO_PROTOCOL: ::c_int = 38; 3053pub const SO_DOMAIN: ::c_int = 39; 3054 3055pub const SA_ONSTACK: ::c_int = 0x08000000; 3056pub const SA_SIGINFO: ::c_int = 0x00000004; 3057pub const SA_NOCLDWAIT: ::c_int = 0x00000002; 3058 3059pub const SIGCHLD: ::c_int = 17; 3060pub const SIGBUS: ::c_int = 7; 3061pub const SIGTTIN: ::c_int = 21; 3062pub const SIGTTOU: ::c_int = 22; 3063pub const SIGXCPU: ::c_int = 24; 3064pub const SIGXFSZ: ::c_int = 25; 3065pub const SIGVTALRM: ::c_int = 26; 3066pub const SIGPROF: ::c_int = 27; 3067pub const SIGWINCH: ::c_int = 28; 3068pub const SIGUSR1: ::c_int = 10; 3069pub const SIGUSR2: ::c_int = 12; 3070pub const SIGCONT: ::c_int = 18; 3071pub const SIGSTOP: ::c_int = 19; 3072pub const SIGTSTP: ::c_int = 20; 3073pub const SIGURG: ::c_int = 23; 3074pub const SIGIO: ::c_int = 29; 3075pub const SIGSYS: ::c_int = 31; 3076pub const SIGSTKFLT: ::c_int = 16; 3077pub const SIGPOLL: ::c_int = 29; 3078pub const SIGPWR: ::c_int = 30; 3079pub const SIG_SETMASK: ::c_int = 2; 3080pub const SIG_BLOCK: ::c_int = 0x000000; 3081pub const SIG_UNBLOCK: ::c_int = 0x01; 3082 3083pub const EXTPROC: ::tcflag_t = 0x00010000; 3084 3085pub const MAP_HUGETLB: ::c_int = 0x040000; 3086 3087pub const F_GETLK: ::c_int = 5; 3088pub const F_GETOWN: ::c_int = 9; 3089pub const F_SETLK: ::c_int = 6; 3090pub const F_SETLKW: ::c_int = 7; 3091pub const F_SETOWN: ::c_int = 8; 3092 3093pub const VEOF: usize = 4; 3094pub const VEOL: usize = 11; 3095pub const VEOL2: usize = 16; 3096pub const VMIN: usize = 6; 3097pub const IEXTEN: ::tcflag_t = 0x00008000; 3098pub const TOSTOP: ::tcflag_t = 0x00000100; 3099pub const FLUSHO: ::tcflag_t = 0x00001000; 3100 3101pub const TCGETS: ::c_int = 0x5401; 3102pub const TCSETS: ::c_int = 0x5402; 3103pub const TCSETSW: ::c_int = 0x5403; 3104pub const TCSETSF: ::c_int = 0x5404; 3105pub const TCGETA: ::c_int = 0x5405; 3106pub const TCSETA: ::c_int = 0x5406; 3107pub const TCSETAW: ::c_int = 0x5407; 3108pub const TCSETAF: ::c_int = 0x5408; 3109pub const TCSBRK: ::c_int = 0x5409; 3110pub const TCXONC: ::c_int = 0x540A; 3111pub const TCFLSH: ::c_int = 0x540B; 3112pub const TIOCGSOFTCAR: ::c_int = 0x5419; 3113pub const TIOCSSOFTCAR: ::c_int = 0x541A; 3114pub const TIOCLINUX: ::c_int = 0x541C; 3115pub const TIOCGSERIAL: ::c_int = 0x541E; 3116pub const TIOCEXCL: ::c_int = 0x540C; 3117pub const TIOCNXCL: ::c_int = 0x540D; 3118pub const TIOCSCTTY: ::c_int = 0x540E; 3119pub const TIOCGPGRP: ::c_int = 0x540F; 3120pub const TIOCSPGRP: ::c_int = 0x5410; 3121pub const TIOCOUTQ: ::c_int = 0x5411; 3122pub const TIOCSTI: ::c_int = 0x5412; 3123pub const TIOCGWINSZ: ::c_int = 0x5413; 3124pub const TIOCSWINSZ: ::c_int = 0x5414; 3125pub const TIOCMGET: ::c_int = 0x5415; 3126pub const TIOCMBIS: ::c_int = 0x5416; 3127pub const TIOCMBIC: ::c_int = 0x5417; 3128pub const TIOCMSET: ::c_int = 0x5418; 3129pub const FIONREAD: ::c_int = 0x541B; 3130pub const TIOCCONS: ::c_int = 0x541D; 3131 3132pub const POLLWRNORM: ::c_short = 0x100; 3133pub const POLLWRBAND: ::c_short = 0x200; 3134 3135pub const TIOCM_LE: ::c_int = 0x001; 3136pub const TIOCM_DTR: ::c_int = 0x002; 3137pub const TIOCM_RTS: ::c_int = 0x004; 3138pub const TIOCM_ST: ::c_int = 0x008; 3139pub const TIOCM_SR: ::c_int = 0x010; 3140pub const TIOCM_CTS: ::c_int = 0x020; 3141pub const TIOCM_CAR: ::c_int = 0x040; 3142pub const TIOCM_RNG: ::c_int = 0x080; 3143pub const TIOCM_DSR: ::c_int = 0x100; 3144pub const TIOCM_CD: ::c_int = TIOCM_CAR; 3145pub const TIOCM_RI: ::c_int = TIOCM_RNG; 3146 3147pub const O_DIRECTORY: ::c_int = 0x00080000; 3148pub const O_DIRECT: ::c_int = 0x00000800; 3149pub const O_LARGEFILE: ::c_int = 0x00001000; 3150pub const O_NOFOLLOW: ::c_int = 0x00000080; 3151 3152// intentionally not public, only used for fd_set 3153cfg_if! { 3154 if #[cfg(target_pointer_width = "32")] { 3155 const ULONG_SIZE: usize = 32; 3156 } else if #[cfg(target_pointer_width = "64")] { 3157 const ULONG_SIZE: usize = 64; 3158 } else { 3159 // Unknown target_pointer_width 3160 } 3161} 3162 3163// END_PUB_CONST 3164 3165f! { 3166 pub fn FD_CLR(fd: ::c_int, set: *mut fd_set) -> () { 3167 let fd = fd as usize; 3168 let size = ::mem::size_of_val(&(*set).fds_bits[0]) * 8; 3169 (*set).fds_bits[fd / size] &= !(1 << (fd % size)); 3170 return 3171 } 3172 3173 pub fn FD_ISSET(fd: ::c_int, set: *const fd_set) -> bool { 3174 let fd = fd as usize; 3175 let size = ::mem::size_of_val(&(*set).fds_bits[0]) * 8; 3176 return ((*set).fds_bits[fd / size] & (1 << (fd % size))) != 0 3177 } 3178 3179 pub fn FD_SET(fd: ::c_int, set: *mut fd_set) -> () { 3180 let fd = fd as usize; 3181 let size = ::mem::size_of_val(&(*set).fds_bits[0]) * 8; 3182 (*set).fds_bits[fd / size] |= 1 << (fd % size); 3183 return 3184 } 3185 3186 pub fn FD_ZERO(set: *mut fd_set) -> () { 3187 for slot in (*set).fds_bits.iter_mut() { 3188 *slot = 0; 3189 } 3190 } 3191 3192 pub fn CPU_ZERO(cpuset: &mut cpu_set_t) -> () { 3193 for slot in cpuset.bits.iter_mut() { 3194 *slot = 0; 3195 } 3196 } 3197 3198 pub fn CPU_SET(cpu: usize, cpuset: &mut cpu_set_t) -> () { 3199 let size_in_bits 3200 = 8 * ::mem::size_of_val(&cpuset.bits[0]); // 32, 64 etc 3201 let (idx, offset) = (cpu / size_in_bits, cpu % size_in_bits); 3202 cpuset.bits[idx] |= 1 << offset; 3203 () 3204 } 3205 3206 pub fn CPU_CLR(cpu: usize, cpuset: &mut cpu_set_t) -> () { 3207 let size_in_bits 3208 = 8 * ::mem::size_of_val(&cpuset.bits[0]); // 32, 64 etc 3209 let (idx, offset) = (cpu / size_in_bits, cpu % size_in_bits); 3210 cpuset.bits[idx] &= !(1 << offset); 3211 () 3212 } 3213 3214 pub fn CPU_ISSET(cpu: usize, cpuset: &cpu_set_t) -> bool { 3215 let size_in_bits = 8 * ::mem::size_of_val(&cpuset.bits[0]); 3216 let (idx, offset) = (cpu / size_in_bits, cpu % size_in_bits); 3217 0 != (cpuset.bits[idx] & (1 << offset)) 3218 } 3219 3220 pub fn CPU_EQUAL(set1: &cpu_set_t, set2: &cpu_set_t) -> bool { 3221 set1.bits == set2.bits 3222 } 3223 3224 pub fn major(dev: ::dev_t) -> ::c_uint { 3225 let mut major = 0; 3226 major |= (dev & 0x00000000000fff00) >> 8; 3227 major |= (dev & 0xfffff00000000000) >> 32; 3228 major as ::c_uint 3229 } 3230 3231 pub fn minor(dev: ::dev_t) -> ::c_uint { 3232 let mut minor = 0; 3233 minor |= (dev & 0x00000000000000ff) >> 0; 3234 minor |= (dev & 0x00000ffffff00000) >> 12; 3235 minor as ::c_uint 3236 } 3237 3238 pub fn CMSG_DATA(cmsg: *const cmsghdr) -> *mut c_uchar { 3239 cmsg.offset(1) as *mut c_uchar 3240 } 3241 3242 pub fn CMSG_NXTHDR(mhdr: *const msghdr, cmsg: *const cmsghdr) 3243 -> *mut cmsghdr 3244 { 3245 if ((*cmsg).cmsg_len as ::size_t) < ::mem::size_of::<cmsghdr>() { 3246 0 as *mut cmsghdr 3247 } else if __CMSG_NEXT(cmsg).add(::mem::size_of::<cmsghdr>()) 3248 >= __MHDR_END(mhdr) { 3249 0 as *mut cmsghdr 3250 } else { 3251 __CMSG_NEXT(cmsg).cast() 3252 } 3253 } 3254 3255 pub fn CMSG_FIRSTHDR(mhdr: *const msghdr) -> *mut cmsghdr { 3256 if (*mhdr).msg_controllen as ::size_t >= ::mem::size_of::<cmsghdr>() { 3257 (*mhdr).msg_control.cast() 3258 } else { 3259 0 as *mut cmsghdr 3260 } 3261 } 3262 3263 pub {const} fn CMSG_ALIGN(len: ::size_t) -> ::size_t { 3264 (len + ::mem::size_of::<::size_t>() - 1) 3265 & !(::mem::size_of::<::size_t>() - 1) 3266 } 3267 3268 pub {const} fn CMSG_SPACE(len: ::c_uint) -> ::c_uint { 3269 (CMSG_ALIGN(len as ::size_t) + CMSG_ALIGN(::mem::size_of::<cmsghdr>())) 3270 as ::c_uint 3271 } 3272 3273 pub fn CMSG_LEN(len: ::c_uint) -> ::c_uint { 3274 (CMSG_ALIGN(::mem::size_of::<cmsghdr>()) + len as ::size_t) as ::c_uint 3275 } 3276} 3277 3278safe_f! { 3279 pub {const} fn WIFSTOPPED(status: ::c_int) -> bool { 3280 (status & 0xff) == 0x7f 3281 } 3282 3283 pub {const} fn WSTOPSIG(status: ::c_int) -> ::c_int { 3284 (status >> 8) & 0xff 3285 } 3286 3287 pub {const} fn WIFCONTINUED(status: ::c_int) -> bool { 3288 status == 0xffff 3289 } 3290 3291 pub {const} fn WIFSIGNALED(status: ::c_int) -> bool { 3292 ((status & 0x7f) + 1) as i8 >= 2 3293 } 3294 3295 pub {const} fn WTERMSIG(status: ::c_int) -> ::c_int { 3296 status & 0x7f 3297 } 3298 3299 pub {const} fn WIFEXITED(status: ::c_int) -> bool { 3300 (status & 0x7f) == 0 3301 } 3302 3303 pub {const} fn WEXITSTATUS(status: ::c_int) -> ::c_int { 3304 (status >> 8) & 0xff 3305 } 3306 3307 pub {const} fn WCOREDUMP(status: ::c_int) -> bool { 3308 (status & 0x80) != 0 3309 } 3310 3311 pub {const} fn QCMD(cmd: ::c_int, type_: ::c_int) -> ::c_int { 3312 (cmd << 8) | (type_ & 0x00ff) 3313 } 3314 3315 pub {const} fn makedev(major: ::c_uint, minor: ::c_uint) -> ::dev_t { 3316 let major = major as ::dev_t; 3317 let minor = minor as ::dev_t; 3318 let mut dev = 0; 3319 dev |= (major & 0x00000fff) << 8; 3320 dev |= (major & 0xfffff000) << 32; 3321 dev |= (minor & 0x000000ff) << 0; 3322 dev |= (minor & 0xffffff00) << 12; 3323 dev 3324 } 3325} 3326 3327fn __CMSG_LEN(cmsg: *const cmsghdr) -> ::ssize_t { 3328 ((unsafe { (*cmsg).cmsg_len as ::size_t } + ::mem::size_of::<::c_long>() - 1) 3329 & !(::mem::size_of::<::c_long>() - 1)) as ::ssize_t 3330} 3331 3332fn __CMSG_NEXT(cmsg: *const cmsghdr) -> *mut c_uchar { 3333 (unsafe { cmsg.offset(__CMSG_LEN(cmsg)) }) as *mut c_uchar 3334} 3335 3336fn __MHDR_END(mhdr: *const msghdr) -> *mut c_uchar { 3337 unsafe { (*mhdr).msg_control.offset((*mhdr).msg_controllen as isize) }.cast() 3338} 3339 3340// EXTERN_FN 3341 3342#[link(name = "c")] 3343#[link(name = "fdio")] 3344extern "C" {} 3345 3346#[cfg_attr(feature = "extra_traits", derive(Debug))] 3347pub enum FILE {} 3348impl ::Copy for FILE {} 3349impl ::Clone for FILE { 3350 fn clone(&self) -> FILE { 3351 *self 3352 } 3353} 3354#[cfg_attr(feature = "extra_traits", derive(Debug))] 3355pub enum fpos_t {} // FIXME: fill this out with a struct 3356impl ::Copy for fpos_t {} 3357impl ::Clone for fpos_t { 3358 fn clone(&self) -> fpos_t { 3359 *self 3360 } 3361} 3362 3363extern "C" { 3364 pub fn isalnum(c: c_int) -> c_int; 3365 pub fn isalpha(c: c_int) -> c_int; 3366 pub fn iscntrl(c: c_int) -> c_int; 3367 pub fn isdigit(c: c_int) -> c_int; 3368 pub fn isgraph(c: c_int) -> c_int; 3369 pub fn islower(c: c_int) -> c_int; 3370 pub fn isprint(c: c_int) -> c_int; 3371 pub fn ispunct(c: c_int) -> c_int; 3372 pub fn isspace(c: c_int) -> c_int; 3373 pub fn isupper(c: c_int) -> c_int; 3374 pub fn isxdigit(c: c_int) -> c_int; 3375 pub fn isblank(c: c_int) -> c_int; 3376 pub fn tolower(c: c_int) -> c_int; 3377 pub fn toupper(c: c_int) -> c_int; 3378 pub fn fopen(filename: *const c_char, mode: *const c_char) -> *mut FILE; 3379 pub fn freopen(filename: *const c_char, mode: *const c_char, file: *mut FILE) -> *mut FILE; 3380 pub fn fflush(file: *mut FILE) -> c_int; 3381 pub fn fclose(file: *mut FILE) -> c_int; 3382 pub fn remove(filename: *const c_char) -> c_int; 3383 pub fn rename(oldname: *const c_char, newname: *const c_char) -> c_int; 3384 pub fn tmpfile() -> *mut FILE; 3385 pub fn setvbuf(stream: *mut FILE, buffer: *mut c_char, mode: c_int, size: size_t) -> c_int; 3386 pub fn setbuf(stream: *mut FILE, buf: *mut c_char); 3387 pub fn getchar() -> c_int; 3388 pub fn putchar(c: c_int) -> c_int; 3389 pub fn fgetc(stream: *mut FILE) -> c_int; 3390 pub fn fgets(buf: *mut c_char, n: c_int, stream: *mut FILE) -> *mut c_char; 3391 pub fn fputc(c: c_int, stream: *mut FILE) -> c_int; 3392 pub fn fputs(s: *const c_char, stream: *mut FILE) -> c_int; 3393 pub fn puts(s: *const c_char) -> c_int; 3394 pub fn ungetc(c: c_int, stream: *mut FILE) -> c_int; 3395 pub fn fread(ptr: *mut c_void, size: size_t, nobj: size_t, stream: *mut FILE) -> size_t; 3396 pub fn fwrite(ptr: *const c_void, size: size_t, nobj: size_t, stream: *mut FILE) -> size_t; 3397 pub fn fseek(stream: *mut FILE, offset: c_long, whence: c_int) -> c_int; 3398 pub fn ftell(stream: *mut FILE) -> c_long; 3399 pub fn rewind(stream: *mut FILE); 3400 pub fn fgetpos(stream: *mut FILE, ptr: *mut fpos_t) -> c_int; 3401 pub fn fsetpos(stream: *mut FILE, ptr: *const fpos_t) -> c_int; 3402 pub fn feof(stream: *mut FILE) -> c_int; 3403 pub fn ferror(stream: *mut FILE) -> c_int; 3404 pub fn perror(s: *const c_char); 3405 pub fn atof(s: *const c_char) -> c_double; 3406 pub fn atoi(s: *const c_char) -> c_int; 3407 pub fn atol(s: *const c_char) -> c_long; 3408 pub fn atoll(s: *const c_char) -> c_longlong; 3409 pub fn strtod(s: *const c_char, endp: *mut *mut c_char) -> c_double; 3410 pub fn strtof(s: *const c_char, endp: *mut *mut c_char) -> c_float; 3411 pub fn strtol(s: *const c_char, endp: *mut *mut c_char, base: c_int) -> c_long; 3412 pub fn strtoll(s: *const c_char, endp: *mut *mut c_char, base: c_int) -> c_longlong; 3413 pub fn strtoul(s: *const c_char, endp: *mut *mut c_char, base: c_int) -> c_ulong; 3414 pub fn strtoull(s: *const c_char, endp: *mut *mut c_char, base: c_int) -> c_ulonglong; 3415 pub fn calloc(nobj: size_t, size: size_t) -> *mut c_void; 3416 pub fn malloc(size: size_t) -> *mut c_void; 3417 pub fn realloc(p: *mut c_void, size: size_t) -> *mut c_void; 3418 pub fn free(p: *mut c_void); 3419 pub fn abort() -> !; 3420 pub fn exit(status: c_int) -> !; 3421 pub fn _exit(status: c_int) -> !; 3422 pub fn atexit(cb: extern "C" fn()) -> c_int; 3423 pub fn system(s: *const c_char) -> c_int; 3424 pub fn getenv(s: *const c_char) -> *mut c_char; 3425 3426 pub fn strcpy(dst: *mut c_char, src: *const c_char) -> *mut c_char; 3427 pub fn strncpy(dst: *mut c_char, src: *const c_char, n: size_t) -> *mut c_char; 3428 pub fn strcat(s: *mut c_char, ct: *const c_char) -> *mut c_char; 3429 pub fn strncat(s: *mut c_char, ct: *const c_char, n: size_t) -> *mut c_char; 3430 pub fn strcmp(cs: *const c_char, ct: *const c_char) -> c_int; 3431 pub fn strncmp(cs: *const c_char, ct: *const c_char, n: size_t) -> c_int; 3432 pub fn strcoll(cs: *const c_char, ct: *const c_char) -> c_int; 3433 pub fn strchr(cs: *const c_char, c: c_int) -> *mut c_char; 3434 pub fn strrchr(cs: *const c_char, c: c_int) -> *mut c_char; 3435 pub fn strspn(cs: *const c_char, ct: *const c_char) -> size_t; 3436 pub fn strcspn(cs: *const c_char, ct: *const c_char) -> size_t; 3437 pub fn strdup(cs: *const c_char) -> *mut c_char; 3438 pub fn strpbrk(cs: *const c_char, ct: *const c_char) -> *mut c_char; 3439 pub fn strstr(cs: *const c_char, ct: *const c_char) -> *mut c_char; 3440 pub fn strlen(cs: *const c_char) -> size_t; 3441 pub fn strnlen(cs: *const c_char, maxlen: size_t) -> size_t; 3442 pub fn strerror(n: c_int) -> *mut c_char; 3443 pub fn strtok(s: *mut c_char, t: *const c_char) -> *mut c_char; 3444 pub fn strxfrm(s: *mut c_char, ct: *const c_char, n: size_t) -> size_t; 3445 pub fn wcslen(buf: *const wchar_t) -> size_t; 3446 pub fn wcstombs(dest: *mut c_char, src: *const wchar_t, n: size_t) -> ::size_t; 3447 3448 pub fn memchr(cx: *const c_void, c: c_int, n: size_t) -> *mut c_void; 3449 pub fn wmemchr(cx: *const wchar_t, c: wchar_t, n: size_t) -> *mut wchar_t; 3450 pub fn memcmp(cx: *const c_void, ct: *const c_void, n: size_t) -> c_int; 3451 pub fn memcpy(dest: *mut c_void, src: *const c_void, n: size_t) -> *mut c_void; 3452 pub fn memmove(dest: *mut c_void, src: *const c_void, n: size_t) -> *mut c_void; 3453 pub fn memset(dest: *mut c_void, c: c_int, n: size_t) -> *mut c_void; 3454 3455 pub fn abs(i: c_int) -> c_int; 3456 pub fn labs(i: c_long) -> c_long; 3457 pub fn rand() -> c_int; 3458 pub fn srand(seed: c_uint); 3459 3460 pub fn getpwnam(name: *const ::c_char) -> *mut passwd; 3461 pub fn getpwuid(uid: ::uid_t) -> *mut passwd; 3462 3463 pub fn fprintf(stream: *mut ::FILE, format: *const ::c_char, ...) -> ::c_int; 3464 pub fn printf(format: *const ::c_char, ...) -> ::c_int; 3465 pub fn snprintf(s: *mut ::c_char, n: ::size_t, format: *const ::c_char, ...) -> ::c_int; 3466 pub fn sprintf(s: *mut ::c_char, format: *const ::c_char, ...) -> ::c_int; 3467 pub fn fscanf(stream: *mut ::FILE, format: *const ::c_char, ...) -> ::c_int; 3468 pub fn scanf(format: *const ::c_char, ...) -> ::c_int; 3469 pub fn sscanf(s: *const ::c_char, format: *const ::c_char, ...) -> ::c_int; 3470 pub fn getchar_unlocked() -> ::c_int; 3471 pub fn putchar_unlocked(c: ::c_int) -> ::c_int; 3472 3473 pub fn socket(domain: ::c_int, ty: ::c_int, protocol: ::c_int) -> ::c_int; 3474 pub fn connect(socket: ::c_int, address: *const sockaddr, len: socklen_t) -> ::c_int; 3475 pub fn listen(socket: ::c_int, backlog: ::c_int) -> ::c_int; 3476 pub fn accept(socket: ::c_int, address: *mut sockaddr, address_len: *mut socklen_t) -> ::c_int; 3477 pub fn getpeername( 3478 socket: ::c_int, 3479 address: *mut sockaddr, 3480 address_len: *mut socklen_t, 3481 ) -> ::c_int; 3482 pub fn getsockname( 3483 socket: ::c_int, 3484 address: *mut sockaddr, 3485 address_len: *mut socklen_t, 3486 ) -> ::c_int; 3487 pub fn setsockopt( 3488 socket: ::c_int, 3489 level: ::c_int, 3490 name: ::c_int, 3491 value: *const ::c_void, 3492 option_len: socklen_t, 3493 ) -> ::c_int; 3494 pub fn socketpair( 3495 domain: ::c_int, 3496 type_: ::c_int, 3497 protocol: ::c_int, 3498 socket_vector: *mut ::c_int, 3499 ) -> ::c_int; 3500 pub fn sendto( 3501 socket: ::c_int, 3502 buf: *const ::c_void, 3503 len: ::size_t, 3504 flags: ::c_int, 3505 addr: *const sockaddr, 3506 addrlen: socklen_t, 3507 ) -> ::ssize_t; 3508 pub fn shutdown(socket: ::c_int, how: ::c_int) -> ::c_int; 3509 3510 pub fn chmod(path: *const c_char, mode: mode_t) -> ::c_int; 3511 pub fn fchmod(fd: ::c_int, mode: mode_t) -> ::c_int; 3512 3513 pub fn fstat(fildes: ::c_int, buf: *mut stat) -> ::c_int; 3514 3515 pub fn mkdir(path: *const c_char, mode: mode_t) -> ::c_int; 3516 3517 pub fn stat(path: *const c_char, buf: *mut stat) -> ::c_int; 3518 3519 pub fn pclose(stream: *mut ::FILE) -> ::c_int; 3520 pub fn fdopen(fd: ::c_int, mode: *const c_char) -> *mut ::FILE; 3521 pub fn fileno(stream: *mut ::FILE) -> ::c_int; 3522 3523 pub fn open(path: *const c_char, oflag: ::c_int, ...) -> ::c_int; 3524 pub fn creat(path: *const c_char, mode: mode_t) -> ::c_int; 3525 pub fn fcntl(fd: ::c_int, cmd: ::c_int, ...) -> ::c_int; 3526 3527 pub fn opendir(dirname: *const c_char) -> *mut ::DIR; 3528 pub fn readdir(dirp: *mut ::DIR) -> *mut ::dirent; 3529 pub fn readdir_r(dirp: *mut ::DIR, entry: *mut ::dirent, result: *mut *mut ::dirent) 3530 -> ::c_int; 3531 pub fn closedir(dirp: *mut ::DIR) -> ::c_int; 3532 pub fn rewinddir(dirp: *mut ::DIR); 3533 3534 pub fn openat(dirfd: ::c_int, pathname: *const ::c_char, flags: ::c_int, ...) -> ::c_int; 3535 pub fn fchmodat( 3536 dirfd: ::c_int, 3537 pathname: *const ::c_char, 3538 mode: ::mode_t, 3539 flags: ::c_int, 3540 ) -> ::c_int; 3541 pub fn fchown(fd: ::c_int, owner: ::uid_t, group: ::gid_t) -> ::c_int; 3542 pub fn fchownat( 3543 dirfd: ::c_int, 3544 pathname: *const ::c_char, 3545 owner: ::uid_t, 3546 group: ::gid_t, 3547 flags: ::c_int, 3548 ) -> ::c_int; 3549 pub fn fstatat( 3550 dirfd: ::c_int, 3551 pathname: *const ::c_char, 3552 buf: *mut stat, 3553 flags: ::c_int, 3554 ) -> ::c_int; 3555 pub fn linkat( 3556 olddirfd: ::c_int, 3557 oldpath: *const ::c_char, 3558 newdirfd: ::c_int, 3559 newpath: *const ::c_char, 3560 flags: ::c_int, 3561 ) -> ::c_int; 3562 pub fn mkdirat(dirfd: ::c_int, pathname: *const ::c_char, mode: ::mode_t) -> ::c_int; 3563 pub fn readlinkat( 3564 dirfd: ::c_int, 3565 pathname: *const ::c_char, 3566 buf: *mut ::c_char, 3567 bufsiz: ::size_t, 3568 ) -> ::ssize_t; 3569 pub fn renameat( 3570 olddirfd: ::c_int, 3571 oldpath: *const ::c_char, 3572 newdirfd: ::c_int, 3573 newpath: *const ::c_char, 3574 ) -> ::c_int; 3575 pub fn symlinkat( 3576 target: *const ::c_char, 3577 newdirfd: ::c_int, 3578 linkpath: *const ::c_char, 3579 ) -> ::c_int; 3580 pub fn unlinkat(dirfd: ::c_int, pathname: *const ::c_char, flags: ::c_int) -> ::c_int; 3581 3582 pub fn access(path: *const c_char, amode: ::c_int) -> ::c_int; 3583 pub fn alarm(seconds: ::c_uint) -> ::c_uint; 3584 pub fn chdir(dir: *const c_char) -> ::c_int; 3585 pub fn chown(path: *const c_char, uid: uid_t, gid: gid_t) -> ::c_int; 3586 pub fn lchown(path: *const c_char, uid: uid_t, gid: gid_t) -> ::c_int; 3587 pub fn close(fd: ::c_int) -> ::c_int; 3588 pub fn dup(fd: ::c_int) -> ::c_int; 3589 pub fn dup2(src: ::c_int, dst: ::c_int) -> ::c_int; 3590 pub fn execl(path: *const c_char, arg0: *const c_char, ...) -> ::c_int; 3591 pub fn execle(path: *const ::c_char, arg0: *const ::c_char, ...) -> ::c_int; 3592 pub fn execlp(file: *const ::c_char, arg0: *const ::c_char, ...) -> ::c_int; 3593 pub fn execv(prog: *const c_char, argv: *const *const c_char) -> ::c_int; 3594 pub fn execve( 3595 prog: *const c_char, 3596 argv: *const *const c_char, 3597 envp: *const *const c_char, 3598 ) -> ::c_int; 3599 pub fn execvp(c: *const c_char, argv: *const *const c_char) -> ::c_int; 3600 pub fn fork() -> pid_t; 3601 pub fn fpathconf(filedes: ::c_int, name: ::c_int) -> c_long; 3602 pub fn getcwd(buf: *mut c_char, size: ::size_t) -> *mut c_char; 3603 pub fn getegid() -> gid_t; 3604 pub fn geteuid() -> uid_t; 3605 pub fn getgid() -> gid_t; 3606 pub fn getgroups(ngroups_max: ::c_int, groups: *mut gid_t) -> ::c_int; 3607 pub fn getlogin() -> *mut c_char; 3608 pub fn getopt(argc: ::c_int, argv: *const *mut c_char, optstr: *const c_char) -> ::c_int; 3609 pub fn getpgid(pid: pid_t) -> pid_t; 3610 pub fn getpgrp() -> pid_t; 3611 pub fn getpid() -> pid_t; 3612 pub fn getppid() -> pid_t; 3613 pub fn getuid() -> uid_t; 3614 pub fn isatty(fd: ::c_int) -> ::c_int; 3615 pub fn link(src: *const c_char, dst: *const c_char) -> ::c_int; 3616 pub fn lseek(fd: ::c_int, offset: off_t, whence: ::c_int) -> off_t; 3617 pub fn pathconf(path: *const c_char, name: ::c_int) -> c_long; 3618 pub fn pause() -> ::c_int; 3619 pub fn pipe(fds: *mut ::c_int) -> ::c_int; 3620 pub fn posix_memalign(memptr: *mut *mut ::c_void, align: ::size_t, size: ::size_t) -> ::c_int; 3621 pub fn read(fd: ::c_int, buf: *mut ::c_void, count: ::size_t) -> ::ssize_t; 3622 pub fn rmdir(path: *const c_char) -> ::c_int; 3623 pub fn seteuid(uid: uid_t) -> ::c_int; 3624 pub fn setegid(gid: gid_t) -> ::c_int; 3625 pub fn setgid(gid: gid_t) -> ::c_int; 3626 pub fn setpgid(pid: pid_t, pgid: pid_t) -> ::c_int; 3627 pub fn setsid() -> pid_t; 3628 pub fn setuid(uid: uid_t) -> ::c_int; 3629 pub fn sleep(secs: ::c_uint) -> ::c_uint; 3630 pub fn nanosleep(rqtp: *const timespec, rmtp: *mut timespec) -> ::c_int; 3631 pub fn tcgetpgrp(fd: ::c_int) -> pid_t; 3632 pub fn tcsetpgrp(fd: ::c_int, pgrp: ::pid_t) -> ::c_int; 3633 pub fn ttyname(fd: ::c_int) -> *mut c_char; 3634 pub fn unlink(c: *const c_char) -> ::c_int; 3635 pub fn wait(status: *mut ::c_int) -> pid_t; 3636 pub fn waitpid(pid: pid_t, status: *mut ::c_int, options: ::c_int) -> pid_t; 3637 pub fn write(fd: ::c_int, buf: *const ::c_void, count: ::size_t) -> ::ssize_t; 3638 pub fn pread(fd: ::c_int, buf: *mut ::c_void, count: ::size_t, offset: off_t) -> ::ssize_t; 3639 pub fn pwrite(fd: ::c_int, buf: *const ::c_void, count: ::size_t, offset: off_t) -> ::ssize_t; 3640 pub fn umask(mask: mode_t) -> mode_t; 3641 3642 pub fn utime(file: *const c_char, buf: *const utimbuf) -> ::c_int; 3643 3644 pub fn kill(pid: pid_t, sig: ::c_int) -> ::c_int; 3645 3646 pub fn mlock(addr: *const ::c_void, len: ::size_t) -> ::c_int; 3647 pub fn munlock(addr: *const ::c_void, len: ::size_t) -> ::c_int; 3648 pub fn mlockall(flags: ::c_int) -> ::c_int; 3649 pub fn munlockall() -> ::c_int; 3650 3651 pub fn mmap( 3652 addr: *mut ::c_void, 3653 len: ::size_t, 3654 prot: ::c_int, 3655 flags: ::c_int, 3656 fd: ::c_int, 3657 offset: off_t, 3658 ) -> *mut ::c_void; 3659 pub fn munmap(addr: *mut ::c_void, len: ::size_t) -> ::c_int; 3660 3661 pub fn if_nametoindex(ifname: *const c_char) -> ::c_uint; 3662 pub fn if_indextoname(ifindex: ::c_uint, ifname: *mut ::c_char) -> *mut ::c_char; 3663 3664 pub fn lstat(path: *const c_char, buf: *mut stat) -> ::c_int; 3665 3666 pub fn fsync(fd: ::c_int) -> ::c_int; 3667 3668 pub fn setenv(name: *const c_char, val: *const c_char, overwrite: ::c_int) -> ::c_int; 3669 pub fn unsetenv(name: *const c_char) -> ::c_int; 3670 3671 pub fn symlink(path1: *const c_char, path2: *const c_char) -> ::c_int; 3672 3673 pub fn ftruncate(fd: ::c_int, length: off_t) -> ::c_int; 3674 3675 pub fn signal(signum: ::c_int, handler: sighandler_t) -> sighandler_t; 3676 3677 pub fn realpath(pathname: *const ::c_char, resolved: *mut ::c_char) -> *mut ::c_char; 3678 3679 pub fn flock(fd: ::c_int, operation: ::c_int) -> ::c_int; 3680 3681 pub fn gettimeofday(tp: *mut ::timeval, tz: *mut ::c_void) -> ::c_int; 3682 pub fn times(buf: *mut ::tms) -> ::clock_t; 3683 3684 pub fn pthread_self() -> ::pthread_t; 3685 pub fn pthread_join(native: ::pthread_t, value: *mut *mut ::c_void) -> ::c_int; 3686 pub fn pthread_exit(value: *mut ::c_void) -> !; 3687 pub fn pthread_attr_init(attr: *mut ::pthread_attr_t) -> ::c_int; 3688 pub fn pthread_attr_destroy(attr: *mut ::pthread_attr_t) -> ::c_int; 3689 pub fn pthread_attr_setstacksize(attr: *mut ::pthread_attr_t, stack_size: ::size_t) -> ::c_int; 3690 pub fn pthread_attr_setdetachstate(attr: *mut ::pthread_attr_t, state: ::c_int) -> ::c_int; 3691 pub fn pthread_detach(thread: ::pthread_t) -> ::c_int; 3692 pub fn sched_yield() -> ::c_int; 3693 pub fn pthread_key_create( 3694 key: *mut pthread_key_t, 3695 dtor: ::Option<unsafe extern "C" fn(*mut ::c_void)>, 3696 ) -> ::c_int; 3697 pub fn pthread_key_delete(key: pthread_key_t) -> ::c_int; 3698 pub fn pthread_getspecific(key: pthread_key_t) -> *mut ::c_void; 3699 pub fn pthread_setspecific(key: pthread_key_t, value: *const ::c_void) -> ::c_int; 3700 pub fn pthread_mutex_init( 3701 lock: *mut pthread_mutex_t, 3702 attr: *const pthread_mutexattr_t, 3703 ) -> ::c_int; 3704 pub fn pthread_mutex_destroy(lock: *mut pthread_mutex_t) -> ::c_int; 3705 pub fn pthread_mutex_lock(lock: *mut pthread_mutex_t) -> ::c_int; 3706 pub fn pthread_mutex_trylock(lock: *mut pthread_mutex_t) -> ::c_int; 3707 pub fn pthread_mutex_unlock(lock: *mut pthread_mutex_t) -> ::c_int; 3708 3709 pub fn pthread_mutexattr_init(attr: *mut pthread_mutexattr_t) -> ::c_int; 3710 pub fn pthread_mutexattr_destroy(attr: *mut pthread_mutexattr_t) -> ::c_int; 3711 pub fn pthread_mutexattr_settype(attr: *mut pthread_mutexattr_t, _type: ::c_int) -> ::c_int; 3712 3713 pub fn pthread_cond_init(cond: *mut pthread_cond_t, attr: *const pthread_condattr_t) 3714 -> ::c_int; 3715 pub fn pthread_cond_wait(cond: *mut pthread_cond_t, lock: *mut pthread_mutex_t) -> ::c_int; 3716 pub fn pthread_cond_timedwait( 3717 cond: *mut pthread_cond_t, 3718 lock: *mut pthread_mutex_t, 3719 abstime: *const ::timespec, 3720 ) -> ::c_int; 3721 pub fn pthread_cond_signal(cond: *mut pthread_cond_t) -> ::c_int; 3722 pub fn pthread_cond_broadcast(cond: *mut pthread_cond_t) -> ::c_int; 3723 pub fn pthread_cond_destroy(cond: *mut pthread_cond_t) -> ::c_int; 3724 pub fn pthread_condattr_init(attr: *mut pthread_condattr_t) -> ::c_int; 3725 pub fn pthread_condattr_destroy(attr: *mut pthread_condattr_t) -> ::c_int; 3726 pub fn pthread_rwlock_init( 3727 lock: *mut pthread_rwlock_t, 3728 attr: *const pthread_rwlockattr_t, 3729 ) -> ::c_int; 3730 pub fn pthread_rwlock_destroy(lock: *mut pthread_rwlock_t) -> ::c_int; 3731 pub fn pthread_rwlock_rdlock(lock: *mut pthread_rwlock_t) -> ::c_int; 3732 pub fn pthread_rwlock_tryrdlock(lock: *mut pthread_rwlock_t) -> ::c_int; 3733 pub fn pthread_rwlock_wrlock(lock: *mut pthread_rwlock_t) -> ::c_int; 3734 pub fn pthread_rwlock_trywrlock(lock: *mut pthread_rwlock_t) -> ::c_int; 3735 pub fn pthread_rwlock_unlock(lock: *mut pthread_rwlock_t) -> ::c_int; 3736 pub fn pthread_rwlockattr_init(attr: *mut pthread_rwlockattr_t) -> ::c_int; 3737 pub fn pthread_rwlockattr_destroy(attr: *mut pthread_rwlockattr_t) -> ::c_int; 3738 pub fn strerror_r(errnum: ::c_int, buf: *mut c_char, buflen: ::size_t) -> ::c_int; 3739 3740 pub fn getsockopt( 3741 sockfd: ::c_int, 3742 level: ::c_int, 3743 optname: ::c_int, 3744 optval: *mut ::c_void, 3745 optlen: *mut ::socklen_t, 3746 ) -> ::c_int; 3747 pub fn raise(signum: ::c_int) -> ::c_int; 3748 pub fn sigaction(signum: ::c_int, act: *const sigaction, oldact: *mut sigaction) -> ::c_int; 3749 3750 pub fn utimes(filename: *const ::c_char, times: *const ::timeval) -> ::c_int; 3751 pub fn dlopen(filename: *const ::c_char, flag: ::c_int) -> *mut ::c_void; 3752 pub fn dlerror() -> *mut ::c_char; 3753 pub fn dlsym(handle: *mut ::c_void, symbol: *const ::c_char) -> *mut ::c_void; 3754 pub fn dlclose(handle: *mut ::c_void) -> ::c_int; 3755 pub fn dladdr(addr: *const ::c_void, info: *mut Dl_info) -> ::c_int; 3756 3757 pub fn getaddrinfo( 3758 node: *const c_char, 3759 service: *const c_char, 3760 hints: *const addrinfo, 3761 res: *mut *mut addrinfo, 3762 ) -> ::c_int; 3763 pub fn freeaddrinfo(res: *mut addrinfo); 3764 pub fn gai_strerror(errcode: ::c_int) -> *const ::c_char; 3765 pub fn res_init() -> ::c_int; 3766 3767 pub fn gmtime_r(time_p: *const time_t, result: *mut tm) -> *mut tm; 3768 pub fn localtime_r(time_p: *const time_t, result: *mut tm) -> *mut tm; 3769 pub fn mktime(tm: *mut tm) -> time_t; 3770 pub fn time(time: *mut time_t) -> time_t; 3771 pub fn gmtime(time_p: *const time_t) -> *mut tm; 3772 pub fn localtime(time_p: *const time_t) -> *mut tm; 3773 3774 pub fn mknod(pathname: *const ::c_char, mode: ::mode_t, dev: ::dev_t) -> ::c_int; 3775 pub fn uname(buf: *mut ::utsname) -> ::c_int; 3776 pub fn gethostname(name: *mut ::c_char, len: ::size_t) -> ::c_int; 3777 pub fn getservbyname(name: *const ::c_char, proto: *const ::c_char) -> *mut servent; 3778 pub fn getprotobyname(name: *const ::c_char) -> *mut protoent; 3779 pub fn getprotobynumber(proto: ::c_int) -> *mut protoent; 3780 pub fn usleep(secs: ::c_uint) -> ::c_int; 3781 pub fn send(socket: ::c_int, buf: *const ::c_void, len: ::size_t, flags: ::c_int) -> ::ssize_t; 3782 pub fn recv(socket: ::c_int, buf: *mut ::c_void, len: ::size_t, flags: ::c_int) -> ::ssize_t; 3783 pub fn putenv(string: *mut c_char) -> ::c_int; 3784 pub fn poll(fds: *mut pollfd, nfds: nfds_t, timeout: ::c_int) -> ::c_int; 3785 pub fn select( 3786 nfds: ::c_int, 3787 readfds: *mut fd_set, 3788 writefds: *mut fd_set, 3789 errorfds: *mut fd_set, 3790 timeout: *mut timeval, 3791 ) -> ::c_int; 3792 pub fn setlocale(category: ::c_int, locale: *const ::c_char) -> *mut ::c_char; 3793 pub fn localeconv() -> *mut lconv; 3794 3795 pub fn sem_destroy(sem: *mut sem_t) -> ::c_int; 3796 pub fn sem_wait(sem: *mut sem_t) -> ::c_int; 3797 pub fn sem_trywait(sem: *mut sem_t) -> ::c_int; 3798 pub fn sem_post(sem: *mut sem_t) -> ::c_int; 3799 pub fn sem_init(sem: *mut sem_t, pshared: ::c_int, value: ::c_uint) -> ::c_int; 3800 pub fn statvfs(path: *const c_char, buf: *mut statvfs) -> ::c_int; 3801 pub fn fstatvfs(fd: ::c_int, buf: *mut statvfs) -> ::c_int; 3802 3803 pub fn readlink(path: *const c_char, buf: *mut c_char, bufsz: ::size_t) -> ::ssize_t; 3804 3805 pub fn sigemptyset(set: *mut sigset_t) -> ::c_int; 3806 pub fn sigaddset(set: *mut sigset_t, signum: ::c_int) -> ::c_int; 3807 pub fn sigfillset(set: *mut sigset_t) -> ::c_int; 3808 pub fn sigdelset(set: *mut sigset_t, signum: ::c_int) -> ::c_int; 3809 pub fn sigismember(set: *const sigset_t, signum: ::c_int) -> ::c_int; 3810 3811 pub fn sigprocmask(how: ::c_int, set: *const sigset_t, oldset: *mut sigset_t) -> ::c_int; 3812 pub fn sigpending(set: *mut sigset_t) -> ::c_int; 3813 3814 pub fn timegm(tm: *mut ::tm) -> time_t; 3815 3816 pub fn getsid(pid: pid_t) -> pid_t; 3817 3818 pub fn sysconf(name: ::c_int) -> ::c_long; 3819 3820 pub fn mkfifo(path: *const c_char, mode: mode_t) -> ::c_int; 3821 3822 pub fn pselect( 3823 nfds: ::c_int, 3824 readfds: *mut fd_set, 3825 writefds: *mut fd_set, 3826 errorfds: *mut fd_set, 3827 timeout: *const timespec, 3828 sigmask: *const sigset_t, 3829 ) -> ::c_int; 3830 pub fn fseeko(stream: *mut ::FILE, offset: ::off_t, whence: ::c_int) -> ::c_int; 3831 pub fn ftello(stream: *mut ::FILE) -> ::off_t; 3832 pub fn tcdrain(fd: ::c_int) -> ::c_int; 3833 pub fn cfgetispeed(termios: *const ::termios) -> ::speed_t; 3834 pub fn cfgetospeed(termios: *const ::termios) -> ::speed_t; 3835 pub fn cfmakeraw(termios: *mut ::termios); 3836 pub fn cfsetispeed(termios: *mut ::termios, speed: ::speed_t) -> ::c_int; 3837 pub fn cfsetospeed(termios: *mut ::termios, speed: ::speed_t) -> ::c_int; 3838 pub fn cfsetspeed(termios: *mut ::termios, speed: ::speed_t) -> ::c_int; 3839 pub fn tcgetattr(fd: ::c_int, termios: *mut ::termios) -> ::c_int; 3840 pub fn tcsetattr(fd: ::c_int, optional_actions: ::c_int, termios: *const ::termios) -> ::c_int; 3841 pub fn tcflow(fd: ::c_int, action: ::c_int) -> ::c_int; 3842 pub fn tcflush(fd: ::c_int, action: ::c_int) -> ::c_int; 3843 pub fn tcgetsid(fd: ::c_int) -> ::pid_t; 3844 pub fn tcsendbreak(fd: ::c_int, duration: ::c_int) -> ::c_int; 3845 pub fn mkstemp(template: *mut ::c_char) -> ::c_int; 3846 pub fn mkdtemp(template: *mut ::c_char) -> *mut ::c_char; 3847 3848 pub fn tmpnam(ptr: *mut ::c_char) -> *mut ::c_char; 3849 3850 pub fn openlog(ident: *const ::c_char, logopt: ::c_int, facility: ::c_int); 3851 pub fn closelog(); 3852 pub fn setlogmask(maskpri: ::c_int) -> ::c_int; 3853 pub fn syslog(priority: ::c_int, message: *const ::c_char, ...); 3854 3855 pub fn grantpt(fd: ::c_int) -> ::c_int; 3856 pub fn posix_openpt(flags: ::c_int) -> ::c_int; 3857 pub fn ptsname(fd: ::c_int) -> *mut ::c_char; 3858 pub fn unlockpt(fd: ::c_int) -> ::c_int; 3859 3860 pub fn fdatasync(fd: ::c_int) -> ::c_int; 3861 pub fn clock_getres(clk_id: ::clockid_t, tp: *mut ::timespec) -> ::c_int; 3862 pub fn clock_gettime(clk_id: ::clockid_t, tp: *mut ::timespec) -> ::c_int; 3863 pub fn clock_settime(clk_id: ::clockid_t, tp: *const ::timespec) -> ::c_int; 3864 pub fn dirfd(dirp: *mut ::DIR) -> ::c_int; 3865 3866 pub fn pthread_getattr_np(native: ::pthread_t, attr: *mut ::pthread_attr_t) -> ::c_int; 3867 pub fn pthread_attr_getstack( 3868 attr: *const ::pthread_attr_t, 3869 stackaddr: *mut *mut ::c_void, 3870 stacksize: *mut ::size_t, 3871 ) -> ::c_int; 3872 pub fn memalign(align: ::size_t, size: ::size_t) -> *mut ::c_void; 3873 pub fn setgroups(ngroups: ::size_t, ptr: *const ::gid_t) -> ::c_int; 3874 pub fn pipe2(fds: *mut ::c_int, flags: ::c_int) -> ::c_int; 3875 pub fn statfs(path: *const ::c_char, buf: *mut statfs) -> ::c_int; 3876 pub fn fstatfs(fd: ::c_int, buf: *mut statfs) -> ::c_int; 3877 pub fn memrchr(cx: *const ::c_void, c: ::c_int, n: ::size_t) -> *mut ::c_void; 3878 3879 pub fn posix_fadvise(fd: ::c_int, offset: ::off_t, len: ::off_t, advise: ::c_int) -> ::c_int; 3880 pub fn futimens(fd: ::c_int, times: *const ::timespec) -> ::c_int; 3881 pub fn utimensat( 3882 dirfd: ::c_int, 3883 path: *const ::c_char, 3884 times: *const ::timespec, 3885 flag: ::c_int, 3886 ) -> ::c_int; 3887 pub fn duplocale(base: ::locale_t) -> ::locale_t; 3888 pub fn freelocale(loc: ::locale_t); 3889 pub fn newlocale(mask: ::c_int, locale: *const ::c_char, base: ::locale_t) -> ::locale_t; 3890 pub fn uselocale(loc: ::locale_t) -> ::locale_t; 3891 3892 pub fn fdopendir(fd: ::c_int) -> *mut ::DIR; 3893 3894 pub fn mknodat( 3895 dirfd: ::c_int, 3896 pathname: *const ::c_char, 3897 mode: ::mode_t, 3898 dev: dev_t, 3899 ) -> ::c_int; 3900 pub fn pthread_condattr_getclock( 3901 attr: *const pthread_condattr_t, 3902 clock_id: *mut clockid_t, 3903 ) -> ::c_int; 3904 pub fn pthread_condattr_setclock( 3905 attr: *mut pthread_condattr_t, 3906 clock_id: ::clockid_t, 3907 ) -> ::c_int; 3908 pub fn accept4( 3909 fd: ::c_int, 3910 addr: *mut ::sockaddr, 3911 len: *mut ::socklen_t, 3912 flg: ::c_int, 3913 ) -> ::c_int; 3914 pub fn ptsname_r(fd: ::c_int, buf: *mut ::c_char, buflen: ::size_t) -> ::c_int; 3915 pub fn clearenv() -> ::c_int; 3916 pub fn waitid(idtype: idtype_t, id: id_t, infop: *mut ::siginfo_t, options: ::c_int) 3917 -> ::c_int; 3918 pub fn setreuid(ruid: ::uid_t, euid: ::uid_t) -> ::c_int; 3919 pub fn setregid(rgid: ::gid_t, egid: ::gid_t) -> ::c_int; 3920 pub fn getresuid(ruid: *mut ::uid_t, euid: *mut ::uid_t, suid: *mut ::uid_t) -> ::c_int; 3921 pub fn getresgid(rgid: *mut ::gid_t, egid: *mut ::gid_t, sgid: *mut ::gid_t) -> ::c_int; 3922 pub fn acct(filename: *const ::c_char) -> ::c_int; 3923 pub fn brk(addr: *mut ::c_void) -> ::c_int; 3924 pub fn setresgid(rgid: ::gid_t, egid: ::gid_t, sgid: ::gid_t) -> ::c_int; 3925 pub fn setresuid(ruid: ::uid_t, euid: ::uid_t, suid: ::uid_t) -> ::c_int; 3926 pub fn openpty( 3927 amaster: *mut ::c_int, 3928 aslave: *mut ::c_int, 3929 name: *mut ::c_char, 3930 termp: *const termios, 3931 winp: *const ::winsize, 3932 ) -> ::c_int; 3933 pub fn execvpe( 3934 file: *const ::c_char, 3935 argv: *const *const ::c_char, 3936 envp: *const *const ::c_char, 3937 ) -> ::c_int; 3938 pub fn fexecve( 3939 fd: ::c_int, 3940 argv: *const *const ::c_char, 3941 envp: *const *const ::c_char, 3942 ) -> ::c_int; 3943 3944 pub fn ioctl(fd: ::c_int, request: ::c_int, ...) -> ::c_int; 3945 3946 pub fn lutimes(file: *const ::c_char, times: *const ::timeval) -> ::c_int; 3947 3948 pub fn setpwent(); 3949 pub fn endpwent(); 3950 pub fn getpwent() -> *mut passwd; 3951 3952 pub fn shm_open(name: *const c_char, oflag: ::c_int, mode: mode_t) -> ::c_int; 3953 3954 // System V IPC 3955 pub fn shmget(key: ::key_t, size: ::size_t, shmflg: ::c_int) -> ::c_int; 3956 pub fn shmat(shmid: ::c_int, shmaddr: *const ::c_void, shmflg: ::c_int) -> *mut ::c_void; 3957 pub fn shmdt(shmaddr: *const ::c_void) -> ::c_int; 3958 pub fn shmctl(shmid: ::c_int, cmd: ::c_int, buf: *mut ::shmid_ds) -> ::c_int; 3959 pub fn ftok(pathname: *const ::c_char, proj_id: ::c_int) -> ::key_t; 3960 pub fn semget(key: ::key_t, nsems: ::c_int, semflag: ::c_int) -> ::c_int; 3961 pub fn semop(semid: ::c_int, sops: *mut ::sembuf, nsops: ::size_t) -> ::c_int; 3962 pub fn semctl(semid: ::c_int, semnum: ::c_int, cmd: ::c_int, ...) -> ::c_int; 3963 pub fn msgctl(msqid: ::c_int, cmd: ::c_int, buf: *mut msqid_ds) -> ::c_int; 3964 pub fn msgget(key: ::key_t, msgflg: ::c_int) -> ::c_int; 3965 pub fn msgrcv( 3966 msqid: ::c_int, 3967 msgp: *mut ::c_void, 3968 msgsz: ::size_t, 3969 msgtyp: ::c_long, 3970 msgflg: ::c_int, 3971 ) -> ::ssize_t; 3972 pub fn msgsnd( 3973 msqid: ::c_int, 3974 msgp: *const ::c_void, 3975 msgsz: ::size_t, 3976 msgflg: ::c_int, 3977 ) -> ::c_int; 3978 3979 pub fn mprotect(addr: *mut ::c_void, len: ::size_t, prot: ::c_int) -> ::c_int; 3980 pub fn __errno_location() -> *mut ::c_int; 3981 3982 pub fn fallocate(fd: ::c_int, mode: ::c_int, offset: ::off_t, len: ::off_t) -> ::c_int; 3983 pub fn posix_fallocate(fd: ::c_int, offset: ::off_t, len: ::off_t) -> ::c_int; 3984 pub fn readahead(fd: ::c_int, offset: ::off64_t, count: ::size_t) -> ::ssize_t; 3985 pub fn signalfd(fd: ::c_int, mask: *const ::sigset_t, flags: ::c_int) -> ::c_int; 3986 pub fn timerfd_create(clockid: ::c_int, flags: ::c_int) -> ::c_int; 3987 pub fn timerfd_gettime(fd: ::c_int, curr_value: *mut itimerspec) -> ::c_int; 3988 pub fn timerfd_settime( 3989 fd: ::c_int, 3990 flags: ::c_int, 3991 new_value: *const itimerspec, 3992 old_value: *mut itimerspec, 3993 ) -> ::c_int; 3994 pub fn pwritev(fd: ::c_int, iov: *const ::iovec, iovcnt: ::c_int, offset: ::off_t) 3995 -> ::ssize_t; 3996 pub fn preadv(fd: ::c_int, iov: *const ::iovec, iovcnt: ::c_int, offset: ::off_t) -> ::ssize_t; 3997 pub fn quotactl( 3998 cmd: ::c_int, 3999 special: *const ::c_char, 4000 id: ::c_int, 4001 data: *mut ::c_char, 4002 ) -> ::c_int; 4003 pub fn dup3(oldfd: ::c_int, newfd: ::c_int, flags: ::c_int) -> ::c_int; 4004 pub fn mkostemp(template: *mut ::c_char, flags: ::c_int) -> ::c_int; 4005 pub fn mkostemps(template: *mut ::c_char, suffixlen: ::c_int, flags: ::c_int) -> ::c_int; 4006 pub fn sigtimedwait( 4007 set: *const sigset_t, 4008 info: *mut siginfo_t, 4009 timeout: *const ::timespec, 4010 ) -> ::c_int; 4011 pub fn sigwaitinfo(set: *const sigset_t, info: *mut siginfo_t) -> ::c_int; 4012 pub fn nl_langinfo_l(item: ::nl_item, locale: ::locale_t) -> *mut ::c_char; 4013 pub fn getnameinfo( 4014 sa: *const ::sockaddr, 4015 salen: ::socklen_t, 4016 host: *mut ::c_char, 4017 hostlen: ::socklen_t, 4018 serv: *mut ::c_char, 4019 sevlen: ::socklen_t, 4020 flags: ::c_int, 4021 ) -> ::c_int; 4022 pub fn reboot(how_to: ::c_int) -> ::c_int; 4023 pub fn setfsgid(gid: ::gid_t) -> ::c_int; 4024 pub fn setfsuid(uid: ::uid_t) -> ::c_int; 4025 4026 // Not available now on Android 4027 pub fn mkfifoat(dirfd: ::c_int, pathname: *const ::c_char, mode: ::mode_t) -> ::c_int; 4028 pub fn if_nameindex() -> *mut if_nameindex; 4029 pub fn if_freenameindex(ptr: *mut if_nameindex); 4030 pub fn sync_file_range( 4031 fd: ::c_int, 4032 offset: ::off64_t, 4033 nbytes: ::off64_t, 4034 flags: ::c_uint, 4035 ) -> ::c_int; 4036 pub fn getifaddrs(ifap: *mut *mut ::ifaddrs) -> ::c_int; 4037 pub fn freeifaddrs(ifa: *mut ::ifaddrs); 4038 4039 pub fn glob( 4040 pattern: *const c_char, 4041 flags: ::c_int, 4042 errfunc: ::Option<extern "C" fn(epath: *const c_char, errno: ::c_int) -> ::c_int>, 4043 pglob: *mut ::glob_t, 4044 ) -> ::c_int; 4045 pub fn globfree(pglob: *mut ::glob_t); 4046 4047 pub fn posix_madvise(addr: *mut ::c_void, len: ::size_t, advice: ::c_int) -> ::c_int; 4048 4049 pub fn shm_unlink(name: *const ::c_char) -> ::c_int; 4050 4051 pub fn seekdir(dirp: *mut ::DIR, loc: ::c_long); 4052 4053 pub fn telldir(dirp: *mut ::DIR) -> ::c_long; 4054 pub fn madvise(addr: *mut ::c_void, len: ::size_t, advice: ::c_int) -> ::c_int; 4055 4056 pub fn msync(addr: *mut ::c_void, len: ::size_t, flags: ::c_int) -> ::c_int; 4057 4058 pub fn recvfrom( 4059 socket: ::c_int, 4060 buf: *mut ::c_void, 4061 len: ::size_t, 4062 flags: ::c_int, 4063 addr: *mut ::sockaddr, 4064 addrlen: *mut ::socklen_t, 4065 ) -> ::ssize_t; 4066 pub fn mkstemps(template: *mut ::c_char, suffixlen: ::c_int) -> ::c_int; 4067 pub fn futimes(fd: ::c_int, times: *const ::timeval) -> ::c_int; 4068 pub fn nl_langinfo(item: ::nl_item) -> *mut ::c_char; 4069 4070 pub fn bind(socket: ::c_int, address: *const ::sockaddr, address_len: ::socklen_t) -> ::c_int; 4071 4072 pub fn writev(fd: ::c_int, iov: *const ::iovec, iovcnt: ::c_int) -> ::ssize_t; 4073 pub fn readv(fd: ::c_int, iov: *const ::iovec, iovcnt: ::c_int) -> ::ssize_t; 4074 4075 pub fn sendmsg(fd: ::c_int, msg: *const ::msghdr, flags: ::c_int) -> ::ssize_t; 4076 pub fn recvmsg(fd: ::c_int, msg: *mut ::msghdr, flags: ::c_int) -> ::ssize_t; 4077 pub fn getdomainname(name: *mut ::c_char, len: ::size_t) -> ::c_int; 4078 pub fn setdomainname(name: *const ::c_char, len: ::size_t) -> ::c_int; 4079 pub fn vhangup() -> ::c_int; 4080 pub fn sendmmsg( 4081 sockfd: ::c_int, 4082 msgvec: *mut mmsghdr, 4083 vlen: ::c_uint, 4084 flags: ::c_int, 4085 ) -> ::c_int; 4086 pub fn recvmmsg( 4087 sockfd: ::c_int, 4088 msgvec: *mut mmsghdr, 4089 vlen: ::c_uint, 4090 flags: ::c_int, 4091 timeout: *mut ::timespec, 4092 ) -> ::c_int; 4093 pub fn sync(); 4094 pub fn syscall(num: ::c_long, ...) -> ::c_long; 4095 pub fn sched_getaffinity(pid: ::pid_t, cpusetsize: ::size_t, cpuset: *mut cpu_set_t) 4096 -> ::c_int; 4097 pub fn sched_setaffinity( 4098 pid: ::pid_t, 4099 cpusetsize: ::size_t, 4100 cpuset: *const cpu_set_t, 4101 ) -> ::c_int; 4102 pub fn umount(target: *const ::c_char) -> ::c_int; 4103 pub fn sched_get_priority_max(policy: ::c_int) -> ::c_int; 4104 pub fn tee(fd_in: ::c_int, fd_out: ::c_int, len: ::size_t, flags: ::c_uint) -> ::ssize_t; 4105 pub fn settimeofday(tv: *const ::timeval, tz: *const ::timezone) -> ::c_int; 4106 pub fn splice( 4107 fd_in: ::c_int, 4108 off_in: *mut ::loff_t, 4109 fd_out: ::c_int, 4110 off_out: *mut ::loff_t, 4111 len: ::size_t, 4112 flags: ::c_uint, 4113 ) -> ::ssize_t; 4114 pub fn eventfd(init: ::c_uint, flags: ::c_int) -> ::c_int; 4115 pub fn sched_rr_get_interval(pid: ::pid_t, tp: *mut ::timespec) -> ::c_int; 4116 pub fn sem_timedwait(sem: *mut sem_t, abstime: *const ::timespec) -> ::c_int; 4117 pub fn sem_getvalue(sem: *mut sem_t, sval: *mut ::c_int) -> ::c_int; 4118 pub fn sched_setparam(pid: ::pid_t, param: *const ::sched_param) -> ::c_int; 4119 pub fn swapoff(puath: *const ::c_char) -> ::c_int; 4120 pub fn vmsplice( 4121 fd: ::c_int, 4122 iov: *const ::iovec, 4123 nr_segs: ::size_t, 4124 flags: ::c_uint, 4125 ) -> ::ssize_t; 4126 pub fn mount( 4127 src: *const ::c_char, 4128 target: *const ::c_char, 4129 fstype: *const ::c_char, 4130 flags: ::c_ulong, 4131 data: *const ::c_void, 4132 ) -> ::c_int; 4133 pub fn personality(persona: ::c_ulong) -> ::c_int; 4134 pub fn sched_getparam(pid: ::pid_t, param: *mut ::sched_param) -> ::c_int; 4135 pub fn ppoll( 4136 fds: *mut ::pollfd, 4137 nfds: nfds_t, 4138 timeout: *const ::timespec, 4139 sigmask: *const sigset_t, 4140 ) -> ::c_int; 4141 pub fn pthread_mutex_timedlock( 4142 lock: *mut pthread_mutex_t, 4143 abstime: *const ::timespec, 4144 ) -> ::c_int; 4145 pub fn clone( 4146 cb: extern "C" fn(*mut ::c_void) -> ::c_int, 4147 child_stack: *mut ::c_void, 4148 flags: ::c_int, 4149 arg: *mut ::c_void, 4150 ... 4151 ) -> ::c_int; 4152 pub fn sched_getscheduler(pid: ::pid_t) -> ::c_int; 4153 pub fn clock_nanosleep( 4154 clk_id: ::clockid_t, 4155 flags: ::c_int, 4156 rqtp: *const ::timespec, 4157 rmtp: *mut ::timespec, 4158 ) -> ::c_int; 4159 pub fn pthread_attr_getguardsize( 4160 attr: *const ::pthread_attr_t, 4161 guardsize: *mut ::size_t, 4162 ) -> ::c_int; 4163 pub fn sethostname(name: *const ::c_char, len: ::size_t) -> ::c_int; 4164 pub fn sched_get_priority_min(policy: ::c_int) -> ::c_int; 4165 pub fn umount2(target: *const ::c_char, flags: ::c_int) -> ::c_int; 4166 pub fn swapon(path: *const ::c_char, swapflags: ::c_int) -> ::c_int; 4167 pub fn sched_setscheduler( 4168 pid: ::pid_t, 4169 policy: ::c_int, 4170 param: *const ::sched_param, 4171 ) -> ::c_int; 4172 pub fn sigsuspend(mask: *const ::sigset_t) -> ::c_int; 4173 pub fn getgrgid_r( 4174 gid: ::gid_t, 4175 grp: *mut ::group, 4176 buf: *mut ::c_char, 4177 buflen: ::size_t, 4178 result: *mut *mut ::group, 4179 ) -> ::c_int; 4180 pub fn sigaltstack(ss: *const stack_t, oss: *mut stack_t) -> ::c_int; 4181 pub fn sem_close(sem: *mut sem_t) -> ::c_int; 4182 pub fn getdtablesize() -> ::c_int; 4183 pub fn getgrnam_r( 4184 name: *const ::c_char, 4185 grp: *mut ::group, 4186 buf: *mut ::c_char, 4187 buflen: ::size_t, 4188 result: *mut *mut ::group, 4189 ) -> ::c_int; 4190 pub fn initgroups(user: *const ::c_char, group: ::gid_t) -> ::c_int; 4191 pub fn pthread_sigmask(how: ::c_int, set: *const sigset_t, oldset: *mut sigset_t) -> ::c_int; 4192 pub fn sem_open(name: *const ::c_char, oflag: ::c_int, ...) -> *mut sem_t; 4193 pub fn getgrnam(name: *const ::c_char) -> *mut ::group; 4194 pub fn pthread_cancel(thread: ::pthread_t) -> ::c_int; 4195 pub fn pthread_kill(thread: ::pthread_t, sig: ::c_int) -> ::c_int; 4196 pub fn sem_unlink(name: *const ::c_char) -> ::c_int; 4197 pub fn daemon(nochdir: ::c_int, noclose: ::c_int) -> ::c_int; 4198 pub fn getpwnam_r( 4199 name: *const ::c_char, 4200 pwd: *mut passwd, 4201 buf: *mut ::c_char, 4202 buflen: ::size_t, 4203 result: *mut *mut passwd, 4204 ) -> ::c_int; 4205 pub fn getpwuid_r( 4206 uid: ::uid_t, 4207 pwd: *mut passwd, 4208 buf: *mut ::c_char, 4209 buflen: ::size_t, 4210 result: *mut *mut passwd, 4211 ) -> ::c_int; 4212 pub fn sigwait(set: *const sigset_t, sig: *mut ::c_int) -> ::c_int; 4213 pub fn pthread_atfork( 4214 prepare: ::Option<unsafe extern "C" fn()>, 4215 parent: ::Option<unsafe extern "C" fn()>, 4216 child: ::Option<unsafe extern "C" fn()>, 4217 ) -> ::c_int; 4218 pub fn getgrgid(gid: ::gid_t) -> *mut ::group; 4219 4220 pub fn setgrent(); 4221 pub fn endgrent(); 4222 pub fn getgrent() -> *mut ::group; 4223 4224 pub fn getgrouplist( 4225 user: *const ::c_char, 4226 group: ::gid_t, 4227 groups: *mut ::gid_t, 4228 ngroups: *mut ::c_int, 4229 ) -> ::c_int; 4230 pub fn popen(command: *const c_char, mode: *const c_char) -> *mut ::FILE; 4231 pub fn faccessat( 4232 dirfd: ::c_int, 4233 pathname: *const ::c_char, 4234 mode: ::c_int, 4235 flags: ::c_int, 4236 ) -> ::c_int; 4237 pub fn pthread_create( 4238 native: *mut ::pthread_t, 4239 attr: *const ::pthread_attr_t, 4240 f: extern "C" fn(*mut ::c_void) -> *mut ::c_void, 4241 value: *mut ::c_void, 4242 ) -> ::c_int; 4243 pub fn dl_iterate_phdr( 4244 callback: ::Option< 4245 unsafe extern "C" fn( 4246 info: *mut ::dl_phdr_info, 4247 size: ::size_t, 4248 data: *mut ::c_void, 4249 ) -> ::c_int, 4250 >, 4251 data: *mut ::c_void, 4252 ) -> ::c_int; 4253} 4254 4255cfg_if! { 4256 if #[cfg(target_arch = "aarch64")] { 4257 mod aarch64; 4258 pub use self::aarch64::*; 4259 } else if #[cfg(any(target_arch = "x86_64"))] { 4260 mod x86_64; 4261 pub use self::x86_64::*; 4262 } else { 4263 // Unknown target_arch 4264 } 4265} 4266 4267cfg_if! { 4268 if #[cfg(libc_align)] { 4269 #[macro_use] 4270 mod align; 4271 } else { 4272 #[macro_use] 4273 mod no_align; 4274 } 4275} 4276expand_align!(); 4277 4278cfg_if! { 4279 if #[cfg(libc_core_cvoid)] { 4280 pub use ::ffi::c_void; 4281 } else { 4282 // Use repr(u8) as LLVM expects `void*` to be the same as `i8*` to help 4283 // enable more optimization opportunities around it recognizing things 4284 // like malloc/free. 4285 #[repr(u8)] 4286 #[allow(missing_copy_implementations)] 4287 #[allow(missing_debug_implementations)] 4288 pub enum c_void { 4289 // Two dummy variants so the #[repr] attribute can be used. 4290 #[doc(hidden)] 4291 __variant1, 4292 #[doc(hidden)] 4293 __variant2, 4294 } 4295 } 4296} 4297