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