Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/aienux/blob/main/vendor/libc/src/unix/cygwin/mod.rs # aienux Aienux, the AienOS kernel: boot, scheduling, IPC and capability boundaries. Pre-alpha; host, emulator and physical evidence are labelled separately. Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `aienux / vendor / libc / src / unix / cygwin / mod.rs` 2393 lines ยท 78459 bytes Raw Blame History 1 use crate::prelude::*; 2 use crate::*; 3 4 pub type wchar_t = c_ushort; 5 6 pub type blkcnt_t = i64; 7 pub type blksize_t = i32; 8 pub type dev_t = u32; 9 pub type fsblkcnt_t = c_ulong; 10 pub type fsfilcnt_t = c_ulong; 11 pub type ino_t = u64; 12 pub type key_t = c_longlong; 13 pub type sa_family_t = u16; 14 pub type socklen_t = c_int; 15 16 pub type off_t = c_long; 17 pub type id_t = u32; 18 pub type mode_t = u32; 19 pub type _off64_t = c_longlong; 20 pub type loff_t = _off64_t; 21 pub type iconv_t = *mut c_void; 22 pub type clock_t = c_ulong; 23 pub type time_t = c_long; 24 pub type clockid_t = c_ulong; 25 pub type timer_t = c_ulong; 26 pub type nl_item = c_int; 27 pub type nlink_t = c_ushort; 28 pub type suseconds_t = c_long; 29 pub type useconds_t = c_ulong; 30 31 extern_ty! { 32 pub type timezone; 33 } 34 35 pub type sigset_t = c_ulong; 36 37 pub type fd_mask = c_ulong; 38 39 pub type pthread_t = *mut c_void; 40 pub type pthread_mutex_t = *mut c_void; 41 42 // Must be usize due to libstd/sys_common/thread_local.rs, 43 // should technically be *mut c_void 44 pub type pthread_key_t = usize; 45 46 pub type pthread_attr_t = *mut c_void; 47 pub type pthread_mutexattr_t = *mut c_void; 48 pub type pthread_condattr_t = *mut c_void; 49 pub type pthread_cond_t = *mut c_void; 50 51 // The following ones should be *mut c_void 52 pub type pthread_barrierattr_t = usize; 53 pub type pthread_barrier_t = usize; 54 pub type pthread_spinlock_t = usize; 55 56 pub type pthread_rwlock_t = *mut c_void; 57 pub type pthread_rwlockattr_t = *mut c_void; 58 59 pub type register_t = intptr_t; 60 pub type u_char = c_uchar; 61 pub type u_short = c_ushort; 62 pub type u_long = c_ulong; 63 pub type u_int = c_uint; 64 pub type caddr_t = *mut c_char; 65 pub type vm_size_t = c_ulong; 66 67 pub type rlim_t = c_ulong; 68 69 pub type nfds_t = c_uint; 70 71 pub type sem_t = *mut sem; 72 73 extern_ty! { 74 pub type sem; 75 } 76 77 pub type tcflag_t = c_uint; 78 pub type speed_t = c_uint; 79 80 pub type vm_offset_t = c_ulong; 81 82 pub type posix_spawn_file_actions_t = *mut c_void; 83 pub type posix_spawnattr_t = *mut c_void; 84 85 s! { 86 pub struct itimerspec { 87 pub it_interval: timespec, 88 pub it_value: timespec, 89 } 90 91 pub struct cpu_set_t { 92 bits: [u64; 16], 93 } 94 95 pub struct sigaction { 96 pub sa_sigaction: sighandler_t, 97 pub sa_mask: sigset_t, 98 pub sa_flags: c_int, 99 } 100 101 pub struct stack_t { 102 pub ss_sp: *mut c_void, 103 pub ss_flags: c_int, 104 pub ss_size: size_t, 105 } 106 107 pub struct tm { 108 pub tm_sec: c_int, 109 pub tm_min: c_int, 110 pub tm_hour: c_int, 111 pub tm_mday: c_int, 112 pub tm_mon: c_int, 113 pub tm_year: c_int, 114 pub tm_wday: c_int, 115 pub tm_yday: c_int, 116 pub tm_isdst: c_int, 117 pub tm_gmtoff: c_long, 118 pub tm_zone: *const c_char, 119 } 120 121 pub struct bintime { 122 pub sec: time_t, 123 pub frac: u64, 124 } 125 126 pub struct passwd { 127 pub pw_name: *mut c_char, 128 pub pw_passwd: *mut c_char, 129 pub pw_uid: uid_t, 130 pub pw_gid: gid_t, 131 pub pw_comment: *mut c_char, 132 pub pw_gecos: *mut c_char, 133 pub pw_dir: *mut c_char, 134 pub pw_shell: *mut c_char, 135 } 136 137 pub struct if_nameindex { 138 pub if_index: c_uint, 139 pub if_name: *mut c_char, 140 } 141 142 pub struct ucred { 143 pub pid: pid_t, 144 pub uid: uid_t, 145 pub gid: gid_t, 146 } 147 148 pub struct msghdr { 149 pub msg_name: *mut c_void, 150 pub msg_namelen: socklen_t, 151 pub msg_iov: *mut iovec, 152 pub msg_iovlen: c_int, 153 pub msg_control: *mut c_void, 154 pub msg_controllen: socklen_t, 155 pub msg_flags: c_int, 156 } 157 158 pub struct cmsghdr { 159 pub cmsg_len: size_t, 160 pub cmsg_level: c_int, 161 pub cmsg_type: c_int, 162 } 163 164 pub struct Dl_info { 165 pub dli_fname: [c_char; PATH_MAX as usize], 166 pub dli_fbase: *mut c_void, 167 pub dli_sname: *const c_char, 168 pub dli_saddr: *mut c_void, 169 } 170 171 pub struct in6_pktinfo { 172 pub ipi6_addr: in6_addr, 173 pub ipi6_ifindex: u32, 174 } 175 176 pub struct sockaddr_in6 { 177 pub sin6_family: sa_family_t, 178 pub sin6_port: in_port_t, 179 pub sin6_flowinfo: u32, 180 pub sin6_addr: in6_addr, 181 pub sin6_scope_id: u32, 182 } 183 184 pub struct ip_mreq_source { 185 pub imr_multiaddr: in_addr, 186 pub imr_sourceaddr: in_addr, 187 pub imr_interface: in_addr, 188 } 189 190 pub struct addrinfo { 191 pub ai_flags: c_int, 192 pub ai_family: c_int, 193 pub ai_socktype: c_int, 194 pub ai_protocol: c_int, 195 pub ai_addrlen: socklen_t, 196 pub ai_canonname: *mut c_char, 197 pub ai_addr: *mut sockaddr, 198 pub ai_next: *mut addrinfo, 199 } 200 201 pub struct lconv { 202 pub decimal_point: *mut c_char, 203 pub thousands_sep: *mut c_char, 204 pub grouping: *mut c_char, 205 pub int_curr_symbol: *mut c_char, 206 pub currency_symbol: *mut c_char, 207 pub mon_decimal_point: *mut c_char, 208 pub mon_thousands_sep: *mut c_char, 209 pub mon_grouping: *mut c_char, 210 pub positive_sign: *mut c_char, 211 pub negative_sign: *mut c_char, 212 pub int_frac_digits: c_char, 213 pub frac_digits: c_char, 214 pub p_cs_precedes: c_char, 215 pub p_sep_by_space: c_char, 216 pub n_cs_precedes: c_char, 217 pub n_sep_by_space: c_char, 218 pub p_sign_posn: c_char, 219 pub n_sign_posn: c_char, 220 pub int_n_cs_precedes: c_char, 221 pub int_n_sep_by_space: c_char, 222 pub int_n_sign_posn: c_char, 223 pub int_p_cs_precedes: c_char, 224 pub int_p_sep_by_space: c_char, 225 pub int_p_sign_posn: c_char, 226 } 227 228 pub struct termios { 229 pub c_iflag: tcflag_t, 230 pub c_oflag: tcflag_t, 231 pub c_cflag: tcflag_t, 232 pub c_lflag: tcflag_t, 233 pub c_line: c_char, 234 pub c_cc: [cc_t; NCCS], 235 pub c_ispeed: speed_t, 236 pub c_ospeed: speed_t, 237 } 238 239 pub struct sched_param { 240 pub sched_priority: c_int, 241 } 242 243 pub struct flock { 244 pub l_type: c_short, 245 pub l_whence: c_short, 246 pub l_start: off_t, 247 pub l_len: off_t, 248 pub l_pid: pid_t, 249 } 250 251 pub struct hostent { 252 pub h_name: *const c_char, 253 pub h_aliases: *mut *mut c_char, 254 pub h_addrtype: c_short, 255 pub h_length: c_short, 256 pub h_addr_list: *mut *mut c_char, 257 } 258 259 pub struct linger { 260 pub l_onoff: c_ushort, 261 pub l_linger: c_ushort, 262 } 263 264 pub struct fd_set { 265 fds_bits: [fd_mask; FD_SETSIZE / size_of::() / 8], 266 } 267 268 pub struct _uc_fpxreg { 269 pub significand: [u16; 4], 270 pub exponent: u16, 271 padding: Padding<[u16; 3]>, 272 } 273 274 pub struct _uc_xmmreg { 275 pub element: [u32; 4], 276 } 277 278 pub struct _fpstate { 279 pub cwd: u16, 280 pub swd: u16, 281 pub ftw: u16, 282 pub fop: u16, 283 pub rip: u64, 284 pub rdp: u64, 285 pub mxcsr: u32, 286 pub mxcr_mask: u32, 287 pub st: [_uc_fpxreg; 8], 288 pub xmm: [_uc_xmmreg; 16], 289 padding: Padding<[u32; 24]>, 290 } 291 292 #[repr(align(16))] 293 pub struct mcontext_t { 294 pub p1home: u64, 295 pub p2home: u64, 296 pub p3home: u64, 297 pub p4home: u64, 298 pub p5home: u64, 299 pub p6home: u64, 300 pub ctxflags: u32, 301 pub mxcsr: u32, 302 pub cs: u16, 303 pub ds: u16, 304 pub es: u16, 305 pub fs: u16, 306 pub gs: u16, 307 pub ss: u16, 308 pub eflags: u32, 309 pub dr0: u64, 310 pub dr1: u64, 311 pub dr2: u64, 312 pub dr3: u64, 313 pub dr6: u64, 314 pub dr7: u64, 315 pub rax: u64, 316 pub rcx: u64, 317 pub rdx: u64, 318 pub rbx: u64, 319 pub rsp: u64, 320 pub rbp: u64, 321 pub rsi: u64, 322 pub rdi: u64, 323 pub r8: u64, 324 pub r9: u64, 325 pub r10: u64, 326 pub r11: u64, 327 pub r12: u64, 328 pub r13: u64, 329 pub r14: u64, 330 pub r15: u64, 331 pub rip: u64, 332 pub fpregs: _fpstate, 333 pub vregs: [u64; 52], 334 pub vcx: u64, 335 pub dbc: u64, 336 pub btr: u64, 337 pub bfr: u64, 338 pub etr: u64, 339 pub efr: u64, 340 pub oldmask: u64, 341 pub cr2: u64, 342 } 343 344 // FIXME(1.0): This should not implement `PartialEq` 345 #[allow(unpredictable_function_pointer_comparisons)] 346 pub struct sigevent { 347 pub sigev_value: sigval, 348 pub sigev_signo: c_int, 349 pub sigev_notify: c_int, 350 pub sigev_notify_function: Option, 351 pub sigev_notify_attributes: *mut pthread_attr_t, 352 } 353 354 #[repr(align(8))] 355 pub struct ucontext_t { 356 pub uc_mcontext: mcontext_t, 357 pub uc_link: *mut ucontext_t, 358 pub uc_sigmask: sigset_t, 359 pub uc_stack: stack_t, 360 pub uc_flags: c_ulong, 361 } 362 363 pub struct sockaddr { 364 pub sa_family: sa_family_t, 365 pub sa_data: [c_char; 14], 366 } 367 368 pub struct sockaddr_storage { 369 pub ss_family: sa_family_t, 370 __ss_pad1: Padding<[c_char; 6]>, 371 __ss_align: i64, 372 __ss_pad2: Padding<[c_char; 112]>, 373 } 374 375 pub struct stat { 376 pub st_dev: dev_t, 377 pub st_ino: ino_t, 378 pub st_mode: mode_t, 379 pub st_nlink: nlink_t, 380 pub st_uid: uid_t, 381 pub st_gid: gid_t, 382 pub st_rdev: dev_t, 383 pub st_size: off_t, 384 pub st_atime: time_t, 385 pub st_atime_nsec: c_long, 386 pub st_mtime: time_t, 387 pub st_mtime_nsec: c_long, 388 pub st_ctime: time_t, 389 pub st_ctime_nsec: c_long, 390 pub st_blksize: blksize_t, 391 pub st_blocks: blkcnt_t, 392 pub st_birthtime: time_t, 393 pub st_birthtime_nsec: c_long, 394 } 395 396 pub struct in_addr { 397 pub s_addr: in_addr_t, 398 } 399 400 pub struct ip_mreq { 401 pub imr_multiaddr: in_addr, 402 pub imr_interface: in_addr, 403 } 404 405 pub struct in_pktinfo { 406 pub ipi_addr: in_addr, 407 pub ipi_ifindex: u32, 408 } 409 410 pub struct sockaddr_in { 411 pub sin_family: sa_family_t, 412 pub sin_port: in_port_t, 413 pub sin_addr: in_addr, 414 pub sin_zero: [u8; 8], 415 } 416 417 pub struct statvfs { 418 pub f_bsize: c_ulong, 419 pub f_frsize: c_ulong, 420 pub f_blocks: fsblkcnt_t, 421 pub f_bfree: fsblkcnt_t, 422 pub f_bavail: fsblkcnt_t, 423 pub f_files: fsfilcnt_t, 424 pub f_ffree: fsfilcnt_t, 425 pub f_favail: fsfilcnt_t, 426 pub f_fsid: c_ulong, 427 pub f_flag: c_ulong, 428 pub f_namemax: c_ulong, 429 } 430 431 pub struct statfs { 432 pub f_type: c_long, 433 pub f_bsize: c_long, 434 pub f_blocks: c_long, 435 pub f_bfree: c_long, 436 pub f_bavail: c_long, 437 pub f_files: c_long, 438 pub f_ffree: c_long, 439 pub f_fsid: c_long, 440 pub f_namelen: c_long, 441 pub f_spare: [c_long; 6], 442 } 443 444 pub struct sockaddr_un { 445 pub sun_family: sa_family_t, 446 pub sun_path: [c_char; 108], 447 } 448 449 pub struct utsname { 450 pub sysname: [c_char; 66], 451 pub nodename: [c_char; 65], 452 pub release: [c_char; 65], 453 pub version: [c_char; 65], 454 pub machine: [c_char; 65], 455 pub domainname: [c_char; 65], 456 } 457 458 pub struct siginfo_t { 459 pub si_signo: c_int, 460 pub si_code: c_int, 461 pub si_pid: pid_t, 462 pub si_uid: uid_t, 463 pub si_errno: c_int, 464 __pad: Padding<[u32; 32]>, 465 } 466 467 pub struct dirent { 468 __d_version: u32, 469 pub d_ino: ino_t, 470 pub d_type: c_uchar, 471 __d_unused1: Padding<[c_uchar; 3]>, 472 __d_internal1: u32, 473 pub d_name: [c_char; 256], 474 } 475 } 476 477 s_no_extra_traits! { 478 #[repr(align(16))] 479 pub struct max_align_t { 480 priv_: [f64; 4], 481 } 482 483 pub union __c_anonymous_ifr_ifru { 484 pub ifru_addr: sockaddr, 485 pub ifru_broadaddr: sockaddr, 486 pub ifru_dstaddr: sockaddr, 487 pub ifru_netmask: sockaddr, 488 pub ifru_hwaddr: sockaddr, 489 pub ifru_flags: c_int, 490 pub ifru_metric: c_int, 491 pub ifru_mtu: c_int, 492 pub ifru_ifindex: c_int, 493 pub ifru_data: *mut c_char, 494 __ifru_pad: Padding<[c_char; 28]>, 495 } 496 497 pub struct ifreq { 498 /// if name, e.g. "en0" 499 pub ifr_name: [c_char; IFNAMSIZ], 500 pub ifr_ifru: __c_anonymous_ifr_ifru, 501 } 502 503 pub union __c_anonymous_ifc_ifcu { 504 pub ifcu_buf: caddr_t, 505 pub ifcu_req: *mut ifreq, 506 } 507 508 pub struct ifconf { 509 pub ifc_len: c_int, 510 pub ifc_ifcu: __c_anonymous_ifc_ifcu, 511 } 512 513 pub struct utmpx { 514 pub ut_type: c_short, 515 pub ut_pid: pid_t, 516 pub ut_line: [c_char; UT_LINESIZE], 517 pub ut_id: [c_char; UT_IDLEN], 518 pub ut_time: time_t, 519 pub ut_user: [c_char; UT_NAMESIZE], 520 pub ut_host: [c_char; UT_HOSTSIZE], 521 pub ut_addr: c_long, 522 pub ut_tv: timeval, 523 } 524 } 525 526 impl siginfo_t { 527 pub unsafe fn si_addr(&self) -> *mut c_void { 528 #[repr(C)] 529 struct siginfo_si_addr { 530 _si_signo: c_int, 531 _si_code: c_int, 532 _si_pid: pid_t, 533 _si_uid: uid_t, 534 _si_errno: c_int, 535 si_addr: *mut c_void, 536 } 537 (*(self as *const siginfo_t).cast::()).si_addr 538 } 539 540 pub unsafe fn si_status(&self) -> c_int { 541 #[repr(C)] 542 struct siginfo_sigchld { 543 _si_signo: c_int, 544 _si_code: c_int, 545 _si_pid: pid_t, 546 _si_uid: uid_t, 547 _si_errno: c_int, 548 si_status: c_int, 549 } 550 (*(self as *const siginfo_t).cast::()).si_status 551 } 552 553 pub unsafe fn si_pid(&self) -> pid_t { 554 self.si_pid 555 } 556 557 pub unsafe fn si_uid(&self) -> uid_t { 558 self.si_uid 559 } 560 561 pub unsafe fn si_value(&self) -> sigval { 562 #[repr(C)] 563 struct siginfo_si_value { 564 _si_signo: c_int, 565 _si_code: c_int, 566 _si_pid: pid_t, 567 _si_uid: uid_t, 568 _si_errno: c_int, 569 si_value: sigval, 570 } 571 (*(self as *const siginfo_t).cast::()).si_value 572 } 573 } 574 575 pub const FD_SETSIZE: usize = 1024; 576 577 pub const CPU_SETSIZE: c_int = 0x400; 578 579 // si_code values for SIGBUS signal 580 pub const BUS_ADRALN: c_int = 25; 581 pub const BUS_ADRERR: c_int = 26; 582 pub const BUS_OBJERR: c_int = 27; 583 584 // si_code values for SIGCHLD signal 585 pub const CLD_EXITED: c_int = 28; 586 pub const CLD_KILLED: c_int = 29; 587 pub const CLD_DUMPED: c_int = 30; 588 pub const CLD_TRAPPED: c_int = 31; 589 pub const CLD_STOPPED: c_int = 32; 590 pub const CLD_CONTINUED: c_int = 33; 591 592 pub const SIGEV_SIGNAL: c_int = 0; 593 pub const SIGEV_NONE: c_int = 1; 594 pub const SIGEV_THREAD: c_int = 2; 595 596 pub const SA_NOCLDSTOP: c_int = 0x00000001; 597 pub const SA_NOCLDWAIT: c_int = 0; // FIXME: does not exist on Cygwin! 598 pub const SA_SIGINFO: c_int = 0x00000002; 599 pub const SA_RESTART: c_int = 0x10000000; 600 pub const SA_ONSTACK: c_int = 0x20000000; 601 pub const SA_NODEFER: c_int = 0x40000000; 602 pub const SA_RESETHAND: c_int = u32_cast_int(0x80000000); 603 pub const MINSIGSTKSZ: size_t = 8192; 604 pub const SIGSTKSZ: size_t = 32768; 605 pub const SIGHUP: c_int = 1; 606 pub const SIGINT: c_int = 2; 607 pub const SIGQUIT: c_int = 3; 608 pub const SIGILL: c_int = 4; 609 pub const SIGTRAP: c_int = 5; 610 pub const SIGABRT: c_int = 6; 611 pub const SIGEMT: c_int = 7; 612 pub const SIGFPE: c_int = 8; 613 pub const SIGKILL: c_int = 9; 614 pub const SIGBUS: c_int = 10; 615 pub const SIGSEGV: c_int = 11; 616 pub const SIGSYS: c_int = 12; 617 pub const SIGPIPE: c_int = 13; 618 pub const SIGALRM: c_int = 14; 619 pub const SIGTERM: c_int = 15; 620 pub const SIGURG: c_int = 16; 621 pub const SIGSTOP: c_int = 17; 622 pub const SIGTSTP: c_int = 18; 623 pub const SIGCONT: c_int = 19; 624 pub const SIGCHLD: c_int = 20; 625 pub const SIGTTIN: c_int = 21; 626 pub const SIGTTOU: c_int = 22; 627 pub const SIGIO: c_int = 23; 628 pub const SIGPOLL: c_int = 23; 629 pub const SIGXCPU: c_int = 24; 630 pub const SIGXFSZ: c_int = 25; 631 pub const SIGVTALRM: c_int = 26; 632 pub const SIGPROF: c_int = 27; 633 pub const SIGWINCH: c_int = 28; 634 pub const SIGPWR: c_int = 29; 635 pub const SIGUSR1: c_int = 30; 636 pub const SIGUSR2: c_int = 31; 637 638 pub const SS_ONSTACK: c_int = 0x1; 639 pub const SS_DISABLE: c_int = 0x2; 640 641 pub const SIG_SETMASK: c_int = 0; 642 pub const SIG_BLOCK: c_int = 1; 643 pub const SIG_UNBLOCK: c_int = 2; 644 645 pub const TIMER_ABSTIME: c_int = 4; 646 pub const CLOCK_REALTIME_COARSE: clockid_t = 0; 647 pub const CLOCK_REALTIME: clockid_t = 1; 648 pub const CLOCK_PROCESS_CPUTIME_ID: clockid_t = 2; 649 pub const CLOCK_THREAD_CPUTIME_ID: clockid_t = 3; 650 pub const CLOCK_MONOTONIC: clockid_t = 4; 651 pub const CLOCK_MONOTONIC_RAW: clockid_t = 5; 652 pub const CLOCK_MONOTONIC_COARSE: clockid_t = 6; 653 pub const CLOCK_BOOTTIME: clockid_t = 7; 654 pub const CLOCK_REALTIME_ALARM: clockid_t = 8; 655 pub const CLOCK_BOOTTIME_ALARM: clockid_t = 9; 656 657 pub const ITIMER_REAL: c_int = 0; 658 pub const ITIMER_VIRTUAL: c_int = 1; 659 pub const ITIMER_PROF: c_int = 2; 660 661 pub const PRIO_PROCESS: c_int = 0; 662 pub const PRIO_PGRP: c_int = 1; 663 pub const PRIO_USER: c_int = 2; 664 pub const RLIMIT_CPU: c_int = 0; 665 pub const RLIMIT_FSIZE: c_int = 1; 666 pub const RLIMIT_DATA: c_int = 2; 667 pub const RLIMIT_STACK: c_int = 3; 668 pub const RLIMIT_CORE: c_int = 4; 669 pub const RLIMIT_NOFILE: c_int = 5; 670 pub const RLIMIT_AS: c_int = 6; 671 pub const RLIM_NLIMITS: c_int = 7; 672 pub const RLIMIT_NLIMITS: c_int = RLIM_NLIMITS; 673 pub const RLIM_INFINITY: rlim_t = !0; 674 pub const RLIM_SAVED_MAX: rlim_t = RLIM_INFINITY; 675 pub const RLIM_SAVED_CUR: rlim_t = RLIM_INFINITY; 676 677 pub const RUSAGE_SELF: c_int = 0; 678 pub const RUSAGE_CHILDREN: c_int = -1; 679 680 pub const IFF_UP: c_int = 0x1; // interface is up 681 pub const IFF_BROADCAST: c_int = 0x2; // broadcast address valid 682 pub const IFF_LOOPBACK: c_int = 0x8; // is a loopback net 683 pub const IFF_POINTOPOINT: c_int = 0x10; // interface is point-to-point link 684 pub const IFF_NOTRAILERS: c_int = 0x20; // avoid use of trailers 685 pub const IFF_RUNNING: c_int = 0x40; // resources allocated 686 pub const IFF_NOARP: c_int = 0x80; // no address resolution protocol 687 pub const IFF_PROMISC: c_int = 0x100; // receive all packets 688 pub const IFF_MULTICAST: c_int = 0x1000; // supports multicast 689 pub const IFF_LOWER_UP: c_int = 0x10000; // driver signals L1 up 690 pub const IFF_DORMANT: c_int = 0x20000; // driver signals dormant 691 692 pub const IF_NAMESIZE: size_t = 44; 693 pub const IFNAMSIZ: size_t = IF_NAMESIZE; 694 695 pub const FIONREAD: c_int = 0x4008667f; 696 pub const FIONBIO: c_int = u32_cast_int(0x8004667e); 697 pub const FIOASYNC: c_int = u32_cast_int(0x8008667d); 698 pub const FIOCLEX: c_int = 0; // FIXME: does not exist on Cygwin! 699 pub const SIOCGIFCONF: c_ulong = 0x80107364; 700 pub const SIOCGIFFLAGS: c_ulong = 0x80507365; 701 pub const SIOCGIFADDR: c_ulong = 0x80507366; 702 pub const SIOCGIFBRDADDR: c_ulong = 0x80507367; 703 pub const SIOCGIFNETMASK: c_ulong = 0x80507368; 704 pub const SIOCGIFHWADDR: c_ulong = 0x80507369; 705 pub const SIOCGIFMETRIC: c_ulong = 0x8050736a; 706 pub const SIOCGIFMTU: c_ulong = 0x8050736b; 707 pub const SIOCGIFINDEX: c_ulong = 0x8050736c; 708 pub const SIOGIFINDEX: c_ulong = SIOCGIFINDEX; 709 pub const SIOCGIFDSTADDR: c_ulong = 0x8050736e; 710 pub const SOL_SOCKET: c_int = 0xffff; 711 pub const SO_DEBUG: c_int = 1; 712 pub const SO_ACCEPTCONN: c_int = 0x0002; 713 pub const SO_REUSEADDR: c_int = 0x0004; 714 pub const SO_KEEPALIVE: c_int = 0x0008; 715 pub const SO_DONTROUTE: c_int = 0x0010; 716 pub const SO_BROADCAST: c_int = 0x0020; 717 pub const SO_USELOOPBACK: c_int = 0x0040; 718 pub const SO_LINGER: c_int = 0x0080; 719 pub const SO_OOBINLINE: c_int = 0x0100; 720 pub const SO_PEERCRED: c_int = 0x0200; 721 pub const SO_PASSCRED: c_int = 0x0400; 722 pub const SO_SNDBUF: c_int = 0x1001; 723 pub const SO_RCVBUF: c_int = 0x1002; 724 pub const SO_SNDLOWAT: c_int = 0x1003; 725 pub const SO_RCVLOWAT: c_int = 0x1004; 726 pub const SO_SNDTIMEO: c_int = 0x1005; 727 pub const SO_RCVTIMEO: c_int = 0x1006; 728 pub const SO_ERROR: c_int = 0x1007; 729 pub const SO_TYPE: c_int = 0x1008; 730 731 pub const SCM_RIGHTS: c_int = 0x01; 732 pub const SCM_CREDENTIALS: c_int = 0x02; 733 pub const SOCK_STREAM: c_int = 1; 734 pub const SOCK_DGRAM: c_int = 2; 735 pub const SOCK_RAW: c_int = 3; 736 pub const SOCK_RDM: c_int = 4; 737 pub const SOCK_SEQPACKET: c_int = 5; 738 pub const SOCK_NONBLOCK: c_int = 0x01000000; 739 pub const SOCK_CLOEXEC: c_int = 0x02000000; 740 pub const AF_UNSPEC: c_int = 0; 741 pub const AF_LOCAL: c_int = 1; 742 pub const AF_UNIX: c_int = AF_LOCAL; 743 pub const AF_INET: c_int = 2; 744 pub const AF_IMPLINK: c_int = 3; 745 pub const AF_PUP: c_int = 4; 746 pub const AF_CHAOS: c_int = 5; 747 pub const AF_NS: c_int = 6; 748 pub const AF_ISO: c_int = 7; 749 pub const AF_OSI: c_int = AF_ISO; 750 pub const AF_ECMA: c_int = 8; 751 pub const AF_DATAKIT: c_int = 9; 752 pub const AF_CCITT: c_int = 10; 753 pub const AF_SNA: c_int = 11; 754 pub const AF_DECnet: c_int = 12; 755 pub const AF_DLI: c_int = 13; 756 pub const AF_LAT: c_int = 14; 757 pub const AF_HYLINK: c_int = 15; 758 pub const AF_APPLETALK: c_int = 16; 759 pub const AF_NETBIOS: c_int = 17; 760 pub const AF_INET6: c_int = 23; 761 pub const PF_UNSPEC: c_int = AF_UNSPEC; 762 pub const PF_LOCAL: c_int = AF_LOCAL; 763 pub const PF_UNIX: c_int = PF_LOCAL; 764 pub const PF_INET: c_int = AF_INET; 765 pub const PF_IMPLINK: c_int = AF_IMPLINK; 766 pub const PF_PUP: c_int = AF_PUP; 767 pub const PF_CHAOS: c_int = AF_CHAOS; 768 pub const PF_NS: c_int = AF_NS; 769 pub const PF_ISO: c_int = AF_ISO; 770 pub const PF_OSI: c_int = AF_ISO; 771 pub const PF_DATAKIT: c_int = AF_DATAKIT; 772 pub const PF_CCITT: c_int = AF_CCITT; 773 pub const PF_SNA: c_int = AF_SNA; 774 pub const PF_DECnet: c_int = AF_DECnet; 775 pub const PF_DLI: c_int = AF_DLI; 776 pub const PF_LAT: c_int = AF_LAT; 777 pub const PF_HYLINK: c_int = AF_HYLINK; 778 pub const PF_APPLETALK: c_int = AF_APPLETALK; 779 pub const PF_NETBIOS: c_int = AF_NETBIOS; 780 pub const PF_INET6: c_int = AF_INET6; 781 pub const SOMAXCONN: c_int = 0x7fffffff; 782 pub const MSG_OOB: c_int = 0x1; 783 pub const MSG_PEEK: c_int = 0x2; 784 pub const MSG_DONTROUTE: c_int = 0x4; 785 pub const MSG_WAITALL: c_int = 0x8; 786 pub const MSG_DONTWAIT: c_int = 0x10; 787 pub const MSG_NOSIGNAL: c_int = 0x20; 788 pub const MSG_TRUNC: c_int = 0x0100; 789 pub const MSG_CTRUNC: c_int = 0x0200; 790 pub const MSG_BCAST: c_int = 0x0400; 791 pub const MSG_MCAST: c_int = 0x0800; 792 pub const MSG_CMSG_CLOEXEC: c_int = 0x1000; 793 pub const MSG_EOR: c_int = 0x8000; 794 pub const SOL_IP: c_int = 0; 795 pub const SOL_IPV6: c_int = 41; 796 pub const SOL_TCP: c_int = 6; 797 pub const SOL_UDP: c_int = 17; 798 pub const IPTOS_LOWDELAY: u8 = 0x10; 799 pub const IPTOS_THROUGHPUT: u8 = 0x08; 800 pub const IPTOS_RELIABILITY: u8 = 0x04; 801 pub const IPTOS_LOWCOST: u8 = 0x02; 802 pub const IPTOS_MINCOST: u8 = IPTOS_LOWCOST; 803 pub const IP_DEFAULT_MULTICAST_TTL: c_int = 1; 804 pub const IP_DEFAULT_MULTICAST_LOOP: c_int = 1; 805 pub const IP_OPTIONS: c_int = 1; 806 pub const IP_HDRINCL: c_int = 2; 807 pub const IP_TOS: c_int = 3; 808 pub const IP_TTL: c_int = 4; 809 pub const IP_MULTICAST_IF: c_int = 9; 810 pub const IP_MULTICAST_TTL: c_int = 10; 811 pub const IP_MULTICAST_LOOP: c_int = 11; 812 pub const IP_ADD_MEMBERSHIP: c_int = 12; 813 pub const IP_DROP_MEMBERSHIP: c_int = 13; 814 pub const IP_ADD_SOURCE_MEMBERSHIP: c_int = 15; 815 pub const IP_DROP_SOURCE_MEMBERSHIP: c_int = 16; 816 pub const IP_BLOCK_SOURCE: c_int = 17; 817 pub const IP_UNBLOCK_SOURCE: c_int = 18; 818 pub const IP_PKTINFO: c_int = 19; 819 pub const IP_RECVTTL: c_int = 21; 820 pub const IP_UNICAST_IF: c_int = 31; 821 pub const IP_RECVTOS: c_int = 40; 822 pub const IP_MTU_DISCOVER: c_int = 71; 823 pub const IP_MTU: c_int = 73; 824 pub const IP_RECVERR: c_int = 75; 825 pub const IP_PMTUDISC_WANT: c_int = 0; 826 pub const IP_PMTUDISC_DO: c_int = 1; 827 pub const IP_PMTUDISC_DONT: c_int = 2; 828 pub const IP_PMTUDISC_PROBE: c_int = 3; 829 pub const IPV6_HOPOPTS: c_int = 1; 830 pub const IPV6_HDRINCL: c_int = 2; 831 pub const IPV6_UNICAST_HOPS: c_int = 4; 832 pub const IPV6_MULTICAST_IF: c_int = 9; 833 pub const IPV6_MULTICAST_HOPS: c_int = 10; 834 pub const IPV6_MULTICAST_LOOP: c_int = 11; 835 pub const IPV6_ADD_MEMBERSHIP: c_int = 12; 836 pub const IPV6_DROP_MEMBERSHIP: c_int = 13; 837 pub const IPV6_JOIN_GROUP: c_int = 12; 838 pub const IPV6_LEAVE_GROUP: c_int = 13; 839 pub const IPV6_DONTFRAG: c_int = 14; 840 pub const IPV6_PKTINFO: c_int = 19; 841 pub const IPV6_HOPLIMIT: c_int = 21; 842 pub const IPV6_CHECKSUM: c_int = 26; 843 pub const IPV6_V6ONLY: c_int = 27; 844 pub const IPV6_UNICAST_IF: c_int = 31; 845 pub const IPV6_RTHDR: c_int = 32; 846 pub const IPV6_RECVRTHDR: c_int = 38; 847 pub const IPV6_TCLASS: c_int = 39; 848 pub const IPV6_RECVTCLASS: c_int = 40; 849 pub const IPV6_MTU_DISCOVER: c_int = 71; 850 pub const IPV6_MTU: c_int = 72; 851 pub const IPV6_RECVERR: c_int = 75; 852 pub const IPV6_PMTUDISC_WANT: c_int = 0; 853 pub const IPV6_PMTUDISC_DO: c_int = 1; 854 pub const IPV6_PMTUDISC_DONT: c_int = 2; 855 pub const IPV6_PMTUDISC_PROBE: c_int = 3; 856 pub const MCAST_JOIN_GROUP: c_int = 41; 857 pub const MCAST_LEAVE_GROUP: c_int = 42; 858 pub const MCAST_BLOCK_SOURCE: c_int = 43; 859 pub const MCAST_UNBLOCK_SOURCE: c_int = 44; 860 pub const MCAST_JOIN_SOURCE_GROUP: c_int = 45; 861 pub const MCAST_LEAVE_SOURCE_GROUP: c_int = 46; 862 pub const MCAST_INCLUDE: c_int = 0; 863 pub const MCAST_EXCLUDE: c_int = 1; 864 pub const SHUT_RD: c_int = 0; 865 pub const SHUT_WR: c_int = 1; 866 pub const SHUT_RDWR: c_int = 2; 867 868 pub const S_BLKSIZE: mode_t = 1024; 869 pub const S_IREAD: mode_t = 256; 870 pub const S_IWRITE: mode_t = 128; 871 pub const S_IEXEC: mode_t = 64; 872 pub const S_ENFMT: mode_t = 1024; 873 pub const S_IFMT: mode_t = 61440; 874 pub const S_IFDIR: mode_t = 16384; 875 pub const S_IFCHR: mode_t = 8192; 876 pub const S_IFBLK: mode_t = 24576; 877 pub const S_IFREG: mode_t = 32768; 878 pub const S_IFLNK: mode_t = 40960; 879 pub const S_IFSOCK: mode_t = 49152; 880 pub const S_IFIFO: mode_t = 4096; 881 pub const S_IRWXU: mode_t = 448; 882 pub const S_IRUSR: mode_t = 256; 883 pub const S_IWUSR: mode_t = 128; 884 pub const S_IXUSR: mode_t = 64; 885 pub const S_IRWXG: mode_t = 56; 886 pub const S_IRGRP: mode_t = 32; 887 pub const S_IWGRP: mode_t = 16; 888 pub const S_IXGRP: mode_t = 8; 889 pub const S_IRWXO: mode_t = 7; 890 pub const S_IROTH: mode_t = 4; 891 pub const S_IWOTH: mode_t = 2; 892 pub const S_IXOTH: mode_t = 1; 893 pub const UTIME_NOW: c_long = -2; 894 pub const UTIME_OMIT: c_long = -1; 895 896 pub const ARG_MAX: c_int = 32000; 897 pub const CHILD_MAX: c_int = 256; 898 pub const IOV_MAX: c_int = 1024; 899 pub const PTHREAD_STACK_MIN: size_t = 65536; 900 901 /// Constants may change across releases. See the [usage guidelines](crate#usage-guidelines) 902 /// for details. 903 pub const PATH_MAX: c_int = 4096; 904 905 pub const PIPE_BUF: usize = 4096; 906 907 /// Constants may change across releases. See the [usage guidelines](crate#usage-guidelines) 908 /// for details. 909 pub const NGROUPS_MAX: c_int = 1024; 910 911 pub const FILENAME_MAX: c_int = 4096; 912 913 pub const FORK_RELOAD: c_int = 1; 914 pub const FORK_NO_RELOAD: c_int = 0; 915 916 pub const RTLD_DEFAULT: *mut c_void = ptr::null_mut(); 917 pub const RTLD_LOCAL: c_int = 0; 918 pub const RTLD_LAZY: c_int = 1; 919 pub const RTLD_NOW: c_int = 2; 920 pub const RTLD_GLOBAL: c_int = 4; 921 pub const RTLD_NODELETE: c_int = 8; 922 pub const RTLD_NOLOAD: c_int = 16; 923 pub const RTLD_DEEPBIND: c_int = 32; 924 925 /// IP6 hop-by-hop options 926 pub const IPPROTO_HOPOPTS: c_int = 0; 927 928 /// gateway mgmt protocol 929 pub const IPPROTO_IGMP: c_int = 2; 930 931 /// IPIP tunnels (older KA9Q tunnels use 94) 932 pub const IPPROTO_IPIP: c_int = 4; 933 934 /// exterior gateway protocol 935 pub const IPPROTO_EGP: c_int = 8; 936 937 /// pup 938 pub const IPPROTO_PUP: c_int = 12; 939 940 /// xns idp 941 pub const IPPROTO_IDP: c_int = 22; 942 943 /// IP6 routing header 944 pub const IPPROTO_ROUTING: c_int = 43; 945 946 /// IP6 fragmentation header 947 pub const IPPROTO_FRAGMENT: c_int = 44; 948 949 /// IP6 Encap Sec. Payload 950 pub const IPPROTO_ESP: c_int = 50; 951 952 /// IP6 Auth Header 953 pub const IPPROTO_AH: c_int = 51; 954 955 /// IP6 no next header 956 pub const IPPROTO_NONE: c_int = 59; 957 958 /// IP6 destination option 959 pub const IPPROTO_DSTOPTS: c_int = 60; 960 961 pub const IPPROTO_RAW: c_int = 255; 962 pub const IPPROTO_MAX: c_int = 256; 963 964 pub const AI_PASSIVE: c_int = 0x1; 965 pub const AI_CANONNAME: c_int = 0x2; 966 pub const AI_NUMERICHOST: c_int = 0x4; 967 pub const AI_NUMERICSERV: c_int = 0x8; 968 pub const AI_ALL: c_int = 0x100; 969 pub const AI_ADDRCONFIG: c_int = 0x400; 970 pub const AI_V4MAPPED: c_int = 0x800; 971 pub const NI_NOFQDN: c_int = 0x1; 972 pub const NI_NUMERICHOST: c_int = 0x2; 973 pub const NI_NAMEREQD: c_int = 0x4; 974 pub const NI_NUMERICSERV: c_int = 0x8; 975 pub const NI_DGRAM: c_int = 0x10; 976 pub const NI_MAXHOST: c_int = 1025; 977 pub const NI_MAXSERV: c_int = 32; 978 pub const EAI_AGAIN: c_int = 2; 979 pub const EAI_BADFLAGS: c_int = 3; 980 pub const EAI_FAIL: c_int = 4; 981 pub const EAI_FAMILY: c_int = 5; 982 pub const EAI_MEMORY: c_int = 6; 983 pub const EAI_NODATA: c_int = 7; 984 pub const EAI_NONAME: c_int = 8; 985 pub const EAI_SERVICE: c_int = 9; 986 pub const EAI_SOCKTYPE: c_int = 10; 987 pub const EAI_SYSTEM: c_int = 11; 988 pub const EAI_OVERFLOW: c_int = 14; 989 990 pub const UT_LINESIZE: usize = 16; 991 pub const UT_NAMESIZE: usize = 16; 992 pub const UT_HOSTSIZE: usize = 256; 993 pub const UT_IDLEN: usize = 2; 994 pub const RUN_LVL: c_short = 1; 995 pub const BOOT_TIME: c_short = 2; 996 pub const NEW_TIME: c_short = 3; 997 pub const OLD_TIME: c_short = 4; 998 pub const INIT_PROCESS: c_short = 5; 999 pub const LOGIN_PROCESS: c_short = 6; 1000 pub const USER_PROCESS: c_short = 7; 1001 pub const DEAD_PROCESS: c_short = 8; 1002 1003 pub const POLLIN: c_short = 0x1; 1004 pub const POLLPRI: c_short = 0x2; 1005 pub const POLLOUT: c_short = 0x4; 1006 pub const POLLERR: c_short = 0x8; 1007 pub const POLLHUP: c_short = 0x10; 1008 pub const POLLNVAL: c_short = 0x20; 1009 pub const POLLRDNORM: c_short = 0x1; 1010 pub const POLLRDBAND: c_short = 0x2; 1011 pub const POLLWRNORM: c_short = 0x4; 1012 pub const POLLWRBAND: c_short = 0x4; 1013 1014 pub const LC_ALL: c_int = 0; 1015 pub const LC_COLLATE: c_int = 1; 1016 pub const LC_CTYPE: c_int = 2; 1017 pub const LC_MONETARY: c_int = 3; 1018 pub const LC_NUMERIC: c_int = 4; 1019 pub const LC_TIME: c_int = 5; 1020 pub const LC_MESSAGES: c_int = 6; 1021 pub const LC_ALL_MASK: c_int = 1 << 0; 1022 pub const LC_COLLATE_MASK: c_int = 1 << 1; 1023 pub const LC_CTYPE_MASK: c_int = 1 << 2; 1024 pub const LC_MONETARY_MASK: c_int = 1 << 3; 1025 pub const LC_NUMERIC_MASK: c_int = 1 << 4; 1026 pub const LC_TIME_MASK: c_int = 1 << 5; 1027 pub const LC_MESSAGES_MASK: c_int = 1 << 6; 1028 pub const LC_GLOBAL_LOCALE: locale_t = -1isize as locale_t; 1029 1030 pub const SEM_FAILED: *mut sem_t = ptr::null_mut(); 1031 1032 pub const ST_RDONLY: c_ulong = 0x80000; 1033 pub const ST_NOSUID: c_ulong = 0; 1034 1035 pub const TIOCMGET: c_int = 0x5415; 1036 pub const TIOCMBIS: c_int = 0x5416; 1037 pub const TIOCMBIC: c_int = 0x5417; 1038 pub const TIOCMSET: c_int = 0x5418; 1039 pub const TIOCINQ: c_int = 0x541B; 1040 pub const TIOCSCTTY: c_int = 0x540E; 1041 pub const TIOCSBRK: c_int = 0x5427; 1042 pub const TIOCCBRK: c_int = 0x5428; 1043 pub const TIOCM_DTR: c_int = 0x002; 1044 pub const TIOCM_RTS: c_int = 0x004; 1045 pub const TIOCM_CTS: c_int = 0x020; 1046 pub const TIOCM_CAR: c_int = 0x040; 1047 pub const TIOCM_RNG: c_int = 0x080; 1048 pub const TIOCM_DSR: c_int = 0x100; 1049 pub const TIOCM_CD: c_int = TIOCM_CAR; 1050 pub const TIOCM_RI: c_int = TIOCM_RNG; 1051 pub const TCOOFF: c_int = 0; 1052 pub const TCOON: c_int = 1; 1053 pub const TCIOFF: c_int = 2; 1054 pub const TCION: c_int = 3; 1055 pub const TCGETA: c_int = 5; 1056 pub const TCSETA: c_int = 6; 1057 pub const TCSETAW: c_int = 7; 1058 pub const TCSETAF: c_int = 8; 1059 pub const TCIFLUSH: c_int = 0; 1060 pub const TCOFLUSH: c_int = 1; 1061 pub const TCIOFLUSH: c_int = 2; 1062 pub const TCFLSH: c_int = 3; 1063 pub const TCSAFLUSH: c_int = 1; 1064 pub const TCSANOW: c_int = 2; 1065 pub const TCSADRAIN: c_int = 3; 1066 pub const TIOCPKT: c_int = 6; 1067 pub const TIOCPKT_DATA: c_int = 0x0; 1068 pub const TIOCPKT_FLUSHREAD: c_int = 0x1; 1069 pub const TIOCPKT_FLUSHWRITE: c_int = 0x2; 1070 pub const TIOCPKT_STOP: c_int = 0x4; 1071 pub const TIOCPKT_START: c_int = 0x8; 1072 pub const TIOCPKT_NOSTOP: c_int = 0x10; 1073 pub const TIOCPKT_DOSTOP: c_int = 0x20; 1074 pub const IGNBRK: tcflag_t = 0x00001; 1075 pub const BRKINT: tcflag_t = 0x00002; 1076 pub const IGNPAR: tcflag_t = 0x00004; 1077 pub const IMAXBEL: tcflag_t = 0x00008; 1078 pub const INPCK: tcflag_t = 0x00010; 1079 pub const ISTRIP: tcflag_t = 0x00020; 1080 pub const INLCR: tcflag_t = 0x00040; 1081 pub const IGNCR: tcflag_t = 0x00080; 1082 pub const ICRNL: tcflag_t = 0x00100; 1083 pub const IXON: tcflag_t = 0x00400; 1084 pub const IXOFF: tcflag_t = 0x01000; 1085 pub const IUCLC: tcflag_t = 0x04000; 1086 pub const IXANY: tcflag_t = 0x08000; 1087 pub const PARMRK: tcflag_t = 0x10000; 1088 pub const IUTF8: tcflag_t = 0x20000; 1089 pub const OPOST: tcflag_t = 0x00001; 1090 pub const OLCUC: tcflag_t = 0x00002; 1091 pub const OCRNL: tcflag_t = 0x00004; 1092 pub const ONLCR: tcflag_t = 0x00008; 1093 pub const ONOCR: tcflag_t = 0x00010; 1094 pub const ONLRET: tcflag_t = 0x00020; 1095 pub const OFILL: tcflag_t = 0x00040; 1096 pub const CRDLY: tcflag_t = 0x00180; 1097 pub const CR0: tcflag_t = 0x00000; 1098 pub const CR1: tcflag_t = 0x00080; 1099 pub const CR2: tcflag_t = 0x00100; 1100 pub const CR3: tcflag_t = 0x00180; 1101 pub const NLDLY: tcflag_t = 0x00200; 1102 pub const NL0: tcflag_t = 0x00000; 1103 pub const NL1: tcflag_t = 0x00200; 1104 pub const BSDLY: tcflag_t = 0x00400; 1105 pub const BS0: tcflag_t = 0x00000; 1106 pub const BS1: tcflag_t = 0x00400; 1107 pub const TABDLY: tcflag_t = 0x01800; 1108 pub const TAB0: tcflag_t = 0x00000; 1109 pub const TAB1: tcflag_t = 0x00800; 1110 pub const TAB2: tcflag_t = 0x01000; 1111 pub const TAB3: tcflag_t = 0x01800; 1112 pub const XTABS: tcflag_t = 0x01800; 1113 pub const VTDLY: tcflag_t = 0x02000; 1114 pub const VT0: tcflag_t = 0x00000; 1115 pub const VT1: tcflag_t = 0x02000; 1116 pub const FFDLY: tcflag_t = 0x04000; 1117 pub const FF0: tcflag_t = 0x00000; 1118 pub const FF1: tcflag_t = 0x04000; 1119 pub const OFDEL: tcflag_t = 0x08000; 1120 pub const CBAUD: tcflag_t = 0x0100f; 1121 pub const B0: speed_t = 0x00000; 1122 pub const B50: speed_t = 0x00001; 1123 pub const B75: speed_t = 0x00002; 1124 pub const B110: speed_t = 0x00003; 1125 pub const B134: speed_t = 0x00004; 1126 pub const B150: speed_t = 0x00005; 1127 pub const B200: speed_t = 0x00006; 1128 pub const B300: speed_t = 0x00007; 1129 pub const B600: speed_t = 0x00008; 1130 pub const B1200: speed_t = 0x00009; 1131 pub const B1800: speed_t = 0x0000a; 1132 pub const B2400: speed_t = 0x0000b; 1133 pub const B4800: speed_t = 0x0000c; 1134 pub const B9600: speed_t = 0x0000d; 1135 pub const B19200: speed_t = 0x0000e; 1136 pub const B38400: speed_t = 0x0000f; 1137 pub const CSIZE: tcflag_t = 0x00030; 1138 pub const CS5: tcflag_t = 0x00000; 1139 pub const CS6: tcflag_t = 0x00010; 1140 pub const CS7: tcflag_t = 0x00020; 1141 pub const CS8: tcflag_t = 0x00030; 1142 pub const CSTOPB: tcflag_t = 0x00040; 1143 pub const CREAD: tcflag_t = 0x00080; 1144 pub const PARENB: tcflag_t = 0x00100; 1145 pub const PARODD: tcflag_t = 0x00200; 1146 pub const HUPCL: tcflag_t = 0x00400; 1147 pub const CLOCAL: tcflag_t = 0x00800; 1148 pub const CBAUDEX: tcflag_t = 0x0100f; 1149 pub const B57600: speed_t = 0x01001; 1150 pub const B115200: speed_t = 0x01002; 1151 pub const B230400: speed_t = 0x01004; 1152 pub const B460800: speed_t = 0x01006; 1153 pub const B500000: speed_t = 0x01007; 1154 pub const B576000: speed_t = 0x01008; 1155 pub const B921600: speed_t = 0x01009; 1156 pub const B1000000: speed_t = 0x0100a; 1157 pub const B1152000: speed_t = 0x0100b; 1158 pub const B1500000: speed_t = 0x0100c; 1159 pub const B2000000: speed_t = 0x0100d; 1160 pub const B2500000: speed_t = 0x0100e; 1161 pub const B3000000: speed_t = 0x0100f; 1162 pub const CRTSCTS: tcflag_t = 0x08000; 1163 pub const CMSPAR: tcflag_t = 0x40000000; 1164 pub const ISIG: tcflag_t = 0x0001; 1165 pub const ICANON: tcflag_t = 0x0002; 1166 pub const ECHO: tcflag_t = 0x0004; 1167 pub const ECHOE: tcflag_t = 0x0008; 1168 pub const ECHOK: tcflag_t = 0x0010; 1169 pub const ECHONL: tcflag_t = 0x0020; 1170 pub const NOFLSH: tcflag_t = 0x0040; 1171 pub const TOSTOP: tcflag_t = 0x0080; 1172 pub const IEXTEN: tcflag_t = 0x0100; 1173 pub const FLUSHO: tcflag_t = 0x0200; 1174 pub const ECHOKE: tcflag_t = 0x0400; 1175 pub const ECHOCTL: tcflag_t = 0x0800; 1176 pub const VDISCARD: usize = 1; 1177 pub const VEOL: usize = 2; 1178 pub const VEOL2: usize = 3; 1179 pub const VEOF: usize = 4; 1180 pub const VERASE: usize = 5; 1181 pub const VINTR: usize = 6; 1182 pub const VKILL: usize = 7; 1183 pub const VLNEXT: usize = 8; 1184 pub const VMIN: usize = 9; 1185 pub const VQUIT: usize = 10; 1186 pub const VREPRINT: usize = 11; 1187 pub const VSTART: usize = 12; 1188 pub const VSTOP: usize = 13; 1189 pub const VSUSP: usize = 14; 1190 pub const VSWTC: usize = 15; 1191 pub const VTIME: usize = 16; 1192 pub const VWERASE: usize = 17; 1193 pub const NCCS: usize = 18; 1194 1195 pub const TIOCGWINSZ: c_int = 0x5401; 1196 pub const TIOCSWINSZ: c_int = 0x5402; 1197 pub const TIOCLINUX: c_int = 0x5403; 1198 pub const TIOCGPGRP: c_int = 0x540f; 1199 pub const TIOCSPGRP: c_int = 0x5410; 1200 1201 pub const WNOHANG: c_int = 1; 1202 pub const WUNTRACED: c_int = 2; 1203 pub const WCONTINUED: c_int = 8; 1204 1205 pub const EXIT_FAILURE: c_int = 1; 1206 pub const EXIT_SUCCESS: c_int = 0; 1207 1208 pub const PROT_NONE: c_int = 0; 1209 pub const PROT_READ: c_int = 1; 1210 pub const PROT_WRITE: c_int = 2; 1211 pub const PROT_EXEC: c_int = 4; 1212 pub const MAP_FILE: c_int = 0; 1213 pub const MAP_SHARED: c_int = 1; 1214 pub const MAP_PRIVATE: c_int = 2; 1215 pub const MAP_TYPE: c_int = 0xf; 1216 pub const MAP_FIXED: c_int = 0x10; 1217 pub const MAP_ANON: c_int = 0x20; 1218 pub const MAP_ANONYMOUS: c_int = MAP_ANON; 1219 pub const MAP_NORESERVE: c_int = 0x4000; 1220 pub const MAP_FAILED: *mut c_void = !0 as *mut c_void; 1221 pub const MS_ASYNC: c_int = 1; 1222 pub const MS_SYNC: c_int = 2; 1223 pub const MS_INVALIDATE: c_int = 4; 1224 pub const POSIX_MADV_NORMAL: c_int = 0; 1225 pub const POSIX_MADV_SEQUENTIAL: c_int = 1; 1226 pub const POSIX_MADV_RANDOM: c_int = 2; 1227 pub const POSIX_MADV_WILLNEED: c_int = 3; 1228 pub const POSIX_MADV_DONTNEED: c_int = 4; 1229 pub const MADV_NORMAL: c_int = 0; 1230 pub const MADV_SEQUENTIAL: c_int = 1; 1231 pub const MADV_RANDOM: c_int = 2; 1232 pub const MADV_WILLNEED: c_int = 3; 1233 pub const MADV_DONTNEED: c_int = 4; 1234 1235 pub const F_ULOCK: c_int = 0; 1236 pub const F_LOCK: c_int = 1; 1237 pub const F_TLOCK: c_int = 2; 1238 pub const F_TEST: c_int = 3; 1239 1240 pub const F_OK: c_int = 0; 1241 pub const R_OK: c_int = 4; 1242 pub const W_OK: c_int = 2; 1243 pub const X_OK: c_int = 1; 1244 pub const SEEK_SET: c_int = 0; 1245 pub const SEEK_CUR: c_int = 1; 1246 pub const SEEK_END: c_int = 2; 1247 pub const _SC_ARG_MAX: c_int = 0; 1248 pub const _SC_CHILD_MAX: c_int = 1; 1249 pub const _SC_CLK_TCK: c_int = 2; 1250 pub const _SC_NGROUPS_MAX: c_int = 3; 1251 pub const _SC_OPEN_MAX: c_int = 4; 1252 pub const _SC_JOB_CONTROL: c_int = 5; 1253 pub const _SC_SAVED_IDS: c_int = 6; 1254 pub const _SC_VERSION: c_int = 7; 1255 pub const _SC_PAGESIZE: c_int = 8; 1256 pub const _SC_PAGE_SIZE: c_int = _SC_PAGESIZE; 1257 pub const _SC_NPROCESSORS_CONF: c_int = 9; 1258 pub const _SC_NPROCESSORS_ONLN: c_int = 10; 1259 pub const _SC_PHYS_PAGES: c_int = 11; 1260 pub const _SC_AVPHYS_PAGES: c_int = 12; 1261 pub const _SC_MQ_OPEN_MAX: c_int = 13; 1262 pub const _SC_MQ_PRIO_MAX: c_int = 14; 1263 pub const _SC_RTSIG_MAX: c_int = 15; 1264 pub const _SC_SEM_NSEMS_MAX: c_int = 16; 1265 pub const _SC_SEM_VALUE_MAX: c_int = 17; 1266 pub const _SC_SIGQUEUE_MAX: c_int = 18; 1267 pub const _SC_TIMER_MAX: c_int = 19; 1268 pub const _SC_TZNAME_MAX: c_int = 20; 1269 pub const _SC_ASYNCHRONOUS_IO: c_int = 21; 1270 pub const _SC_FSYNC: c_int = 22; 1271 pub const _SC_MAPPED_FILES: c_int = 23; 1272 pub const _SC_MEMLOCK: c_int = 24; 1273 pub const _SC_MEMLOCK_RANGE: c_int = 25; 1274 pub const _SC_MEMORY_PROTECTION: c_int = 26; 1275 pub const _SC_MESSAGE_PASSING: c_int = 27; 1276 pub const _SC_PRIORITIZED_IO: c_int = 28; 1277 pub const _SC_REALTIME_SIGNALS: c_int = 29; 1278 pub const _SC_SEMAPHORES: c_int = 30; 1279 pub const _SC_SHARED_MEMORY_OBJECTS: c_int = 31; 1280 pub const _SC_SYNCHRONIZED_IO: c_int = 32; 1281 pub const _SC_TIMERS: c_int = 33; 1282 pub const _SC_AIO_LISTIO_MAX: c_int = 34; 1283 pub const _SC_AIO_MAX: c_int = 35; 1284 pub const _SC_AIO_PRIO_DELTA_MAX: c_int = 36; 1285 pub const _SC_DELAYTIMER_MAX: c_int = 37; 1286 pub const _SC_THREAD_KEYS_MAX: c_int = 38; 1287 pub const _SC_THREAD_STACK_MIN: c_int = 39; 1288 pub const _SC_THREAD_THREADS_MAX: c_int = 40; 1289 pub const _SC_TTY_NAME_MAX: c_int = 41; 1290 pub const _SC_THREADS: c_int = 42; 1291 pub const _SC_THREAD_ATTR_STACKADDR: c_int = 43; 1292 pub const _SC_THREAD_ATTR_STACKSIZE: c_int = 44; 1293 pub const _SC_THREAD_PRIORITY_SCHEDULING: c_int = 45; 1294 pub const _SC_THREAD_PRIO_INHERIT: c_int = 46; 1295 pub const _SC_THREAD_PRIO_PROTECT: c_int = 47; 1296 pub const _SC_THREAD_PRIO_CEILING: c_int = _SC_THREAD_PRIO_PROTECT; 1297 pub const _SC_THREAD_PROCESS_SHARED: c_int = 48; 1298 pub const _SC_THREAD_SAFE_FUNCTIONS: c_int = 49; 1299 pub const _SC_GETGR_R_SIZE_MAX: c_int = 50; 1300 pub const _SC_GETPW_R_SIZE_MAX: c_int = 51; 1301 pub const _SC_LOGIN_NAME_MAX: c_int = 52; 1302 pub const _SC_THREAD_DESTRUCTOR_ITERATIONS: c_int = 53; 1303 pub const _SC_ADVISORY_INFO: c_int = 54; 1304 pub const _SC_ATEXIT_MAX: c_int = 55; 1305 pub const _SC_BARRIERS: c_int = 56; 1306 pub const _SC_BC_BASE_MAX: c_int = 57; 1307 pub const _SC_BC_DIM_MAX: c_int = 58; 1308 pub const _SC_BC_SCALE_MAX: c_int = 59; 1309 pub const _SC_BC_STRING_MAX: c_int = 60; 1310 pub const _SC_CLOCK_SELECTION: c_int = 61; 1311 pub const _SC_COLL_WEIGHTS_MAX: c_int = 62; 1312 pub const _SC_CPUTIME: c_int = 63; 1313 pub const _SC_EXPR_NEST_MAX: c_int = 64; 1314 pub const _SC_HOST_NAME_MAX: c_int = 65; 1315 pub const _SC_IOV_MAX: c_int = 66; 1316 pub const _SC_IPV6: c_int = 67; 1317 pub const _SC_LINE_MAX: c_int = 68; 1318 pub const _SC_MONOTONIC_CLOCK: c_int = 69; 1319 pub const _SC_RAW_SOCKETS: c_int = 70; 1320 pub const _SC_READER_WRITER_LOCKS: c_int = 71; 1321 pub const _SC_REGEXP: c_int = 72; 1322 pub const _SC_RE_DUP_MAX: c_int = 73; 1323 pub const _SC_SHELL: c_int = 74; 1324 pub const _SC_SPAWN: c_int = 75; 1325 pub const _SC_SPIN_LOCKS: c_int = 76; 1326 pub const _SC_SPORADIC_SERVER: c_int = 77; 1327 pub const _SC_SS_REPL_MAX: c_int = 78; 1328 pub const _SC_SYMLOOP_MAX: c_int = 79; 1329 pub const _SC_THREAD_CPUTIME: c_int = 80; 1330 pub const _SC_THREAD_SPORADIC_SERVER: c_int = 81; 1331 pub const _SC_TIMEOUTS: c_int = 82; 1332 pub const _SC_TRACE: c_int = 83; 1333 pub const _SC_TRACE_EVENT_FILTER: c_int = 84; 1334 pub const _SC_TRACE_EVENT_NAME_MAX: c_int = 85; 1335 pub const _SC_TRACE_INHERIT: c_int = 86; 1336 pub const _SC_TRACE_LOG: c_int = 87; 1337 pub const _SC_TRACE_NAME_MAX: c_int = 88; 1338 pub const _SC_TRACE_SYS_MAX: c_int = 89; 1339 pub const _SC_TRACE_USER_EVENT_MAX: c_int = 90; 1340 pub const _SC_TYPED_MEMORY_OBJECTS: c_int = 91; 1341 pub const _SC_V7_ILP32_OFF32: c_int = 92; 1342 pub const _SC_V6_ILP32_OFF32: c_int = _SC_V7_ILP32_OFF32; 1343 pub const _SC_XBS5_ILP32_OFF32: c_int = _SC_V7_ILP32_OFF32; 1344 pub const _SC_V7_ILP32_OFFBIG: c_int = 93; 1345 pub const _SC_V6_ILP32_OFFBIG: c_int = _SC_V7_ILP32_OFFBIG; 1346 pub const _SC_XBS5_ILP32_OFFBIG: c_int = _SC_V7_ILP32_OFFBIG; 1347 pub const _SC_V7_LP64_OFF64: c_int = 94; 1348 pub const _SC_V6_LP64_OFF64: c_int = _SC_V7_LP64_OFF64; 1349 pub const _SC_XBS5_LP64_OFF64: c_int = _SC_V7_LP64_OFF64; 1350 pub const _SC_V7_LPBIG_OFFBIG: c_int = 95; 1351 pub const _SC_V6_LPBIG_OFFBIG: c_int = _SC_V7_LPBIG_OFFBIG; 1352 pub const _SC_XBS5_LPBIG_OFFBIG: c_int = _SC_V7_LPBIG_OFFBIG; 1353 pub const _SC_XOPEN_CRYPT: c_int = 96; 1354 pub const _SC_XOPEN_ENH_I18N: c_int = 97; 1355 pub const _SC_XOPEN_LEGACY: c_int = 98; 1356 pub const _SC_XOPEN_REALTIME: c_int = 99; 1357 pub const _SC_STREAM_MAX: c_int = 100; 1358 pub const _SC_PRIORITY_SCHEDULING: c_int = 101; 1359 pub const _SC_XOPEN_REALTIME_THREADS: c_int = 102; 1360 pub const _SC_XOPEN_SHM: c_int = 103; 1361 pub const _SC_XOPEN_STREAMS: c_int = 104; 1362 pub const _SC_XOPEN_UNIX: c_int = 105; 1363 pub const _SC_XOPEN_VERSION: c_int = 106; 1364 pub const _SC_2_CHAR_TERM: c_int = 107; 1365 pub const _SC_2_C_BIND: c_int = 108; 1366 pub const _SC_2_C_DEV: c_int = 109; 1367 pub const _SC_2_FORT_DEV: c_int = 110; 1368 pub const _SC_2_FORT_RUN: c_int = 111; 1369 pub const _SC_2_LOCALEDEF: c_int = 112; 1370 pub const _SC_2_PBS: c_int = 113; 1371 pub const _SC_2_PBS_ACCOUNTING: c_int = 114; 1372 pub const _SC_2_PBS_CHECKPOINT: c_int = 115; 1373 pub const _SC_2_PBS_LOCATE: c_int = 116; 1374 pub const _SC_2_PBS_MESSAGE: c_int = 117; 1375 pub const _SC_2_PBS_TRACK: c_int = 118; 1376 pub const _SC_2_SW_DEV: c_int = 119; 1377 pub const _SC_2_UPE: c_int = 120; 1378 pub const _SC_2_VERSION: c_int = 121; 1379 pub const _SC_THREAD_ROBUST_PRIO_INHERIT: c_int = 122; 1380 pub const _SC_THREAD_ROBUST_PRIO_PROTECT: c_int = 123; 1381 pub const _SC_XOPEN_UUCP: c_int = 124; 1382 pub const _SC_LEVEL1_ICACHE_SIZE: c_int = 125; 1383 pub const _SC_LEVEL1_ICACHE_ASSOC: c_int = 126; 1384 pub const _SC_LEVEL1_ICACHE_LINESIZE: c_int = 127; 1385 pub const _SC_LEVEL1_DCACHE_SIZE: c_int = 128; 1386 pub const _SC_LEVEL1_DCACHE_ASSOC: c_int = 129; 1387 pub const _SC_LEVEL1_DCACHE_LINESIZE: c_int = 130; 1388 pub const _SC_LEVEL2_CACHE_SIZE: c_int = 131; 1389 pub const _SC_LEVEL2_CACHE_ASSOC: c_int = 132; 1390 pub const _SC_LEVEL2_CACHE_LINESIZE: c_int = 133; 1391 pub const _SC_LEVEL3_CACHE_SIZE: c_int = 134; 1392 pub const _SC_LEVEL3_CACHE_ASSOC: c_int = 135; 1393 pub const _SC_LEVEL3_CACHE_LINESIZE: c_int = 136; 1394 pub const _SC_LEVEL4_CACHE_SIZE: c_int = 137; 1395 pub const _SC_LEVEL4_CACHE_ASSOC: c_int = 138; 1396 pub const _SC_LEVEL4_CACHE_LINESIZE: c_int = 139; 1397 pub const _PC_LINK_MAX: c_int = 0; 1398 pub const _PC_MAX_CANON: c_int = 1; 1399 pub const _PC_MAX_INPUT: c_int = 2; 1400 pub const _PC_NAME_MAX: c_int = 3; 1401 pub const _PC_PATH_MAX: c_int = 4; 1402 pub const _PC_PIPE_BUF: c_int = 5; 1403 pub const _PC_CHOWN_RESTRICTED: c_int = 6; 1404 pub const _PC_NO_TRUNC: c_int = 7; 1405 pub const _PC_VDISABLE: c_int = 8; 1406 pub const _PC_ASYNC_IO: c_int = 9; 1407 pub const _PC_PRIO_IO: c_int = 10; 1408 pub const _PC_SYNC_IO: c_int = 11; 1409 pub const _PC_FILESIZEBITS: c_int = 12; 1410 pub const _PC_2_SYMLINKS: c_int = 13; 1411 pub const _PC_SYMLINK_MAX: c_int = 14; 1412 pub const _PC_ALLOC_SIZE_MIN: c_int = 15; 1413 pub const _PC_REC_INCR_XFER_SIZE: c_int = 16; 1414 pub const _PC_REC_MAX_XFER_SIZE: c_int = 17; 1415 pub const _PC_REC_MIN_XFER_SIZE: c_int = 18; 1416 pub const _PC_REC_XFER_ALIGN: c_int = 19; 1417 pub const _PC_TIMESTAMP_RESOLUTION: c_int = 20; 1418 pub const _CS_PATH: c_int = 0; 1419 1420 pub const O_ACCMODE: c_int = 0x3; 1421 pub const O_RDONLY: c_int = 0; 1422 pub const O_WRONLY: c_int = 1; 1423 pub const O_RDWR: c_int = 2; 1424 pub const O_APPEND: c_int = 0x0008; 1425 pub const O_CREAT: c_int = 0x0200; 1426 pub const O_TRUNC: c_int = 0x0400; 1427 pub const O_EXCL: c_int = 0x0800; 1428 pub const O_SYNC: c_int = 0x2000; 1429 pub const O_NONBLOCK: c_int = 0x4000; 1430 pub const O_NOCTTY: c_int = 0x8000; 1431 pub const O_CLOEXEC: c_int = 0x40000; 1432 pub const O_NOFOLLOW: c_int = 0x100000; 1433 pub const O_DIRECTORY: c_int = 0x200000; 1434 pub const O_EXEC: c_int = 0x400000; 1435 pub const O_SEARCH: c_int = 0x400000; 1436 pub const O_DIRECT: c_int = 0x80000; 1437 pub const O_DSYNC: c_int = 0x2000; 1438 pub const O_RSYNC: c_int = 0x2000; 1439 pub const O_TMPFILE: c_int = 0x800000; 1440 pub const O_NOATIME: c_int = 0x1000000; 1441 pub const O_PATH: c_int = 0x2000000; 1442 pub const F_DUPFD: c_int = 0; 1443 pub const F_GETFD: c_int = 1; 1444 pub const F_SETFD: c_int = 2; 1445 pub const F_GETFL: c_int = 3; 1446 pub const F_SETFL: c_int = 4; 1447 pub const F_GETOWN: c_int = 5; 1448 pub const F_SETOWN: c_int = 6; 1449 pub const F_GETLK: c_int = 7; 1450 pub const F_SETLK: c_int = 8; 1451 pub const F_SETLKW: c_int = 9; 1452 pub const F_RGETLK: c_int = 10; 1453 pub const F_RSETLK: c_int = 11; 1454 pub const F_CNVT: c_int = 12; 1455 pub const F_RSETLKW: c_int = 13; 1456 pub const F_DUPFD_CLOEXEC: c_int = 14; 1457 pub const F_RDLCK: c_int = 1; 1458 pub const F_WRLCK: c_int = 2; 1459 pub const F_UNLCK: c_int = 3; 1460 pub const AT_FDCWD: c_int = -2; 1461 pub const AT_EACCESS: c_int = 1; 1462 pub const AT_SYMLINK_NOFOLLOW: c_int = 2; 1463 pub const AT_SYMLINK_FOLLOW: c_int = 4; 1464 pub const AT_REMOVEDIR: c_int = 8; 1465 pub const AT_EMPTY_PATH: c_int = 16; 1466 pub const LOCK_SH: c_int = 1; 1467 pub const LOCK_EX: c_int = 2; 1468 pub const LOCK_NB: c_int = 4; 1469 pub const LOCK_UN: c_int = 8; 1470 1471 pub const EPERM: c_int = 1; 1472 pub const ENOENT: c_int = 2; 1473 pub const ESRCH: c_int = 3; 1474 pub const EINTR: c_int = 4; 1475 pub const EIO: c_int = 5; 1476 pub const ENXIO: c_int = 6; 1477 pub const E2BIG: c_int = 7; 1478 pub const ENOEXEC: c_int = 8; 1479 pub const EBADF: c_int = 9; 1480 pub const ECHILD: c_int = 10; 1481 pub const EAGAIN: c_int = 11; 1482 pub const ENOMEM: c_int = 12; 1483 pub const EACCES: c_int = 13; 1484 pub const EFAULT: c_int = 14; 1485 pub const ENOTBLK: c_int = 15; 1486 pub const EBUSY: c_int = 16; 1487 pub const EEXIST: c_int = 17; 1488 pub const EXDEV: c_int = 18; 1489 pub const ENODEV: c_int = 19; 1490 pub const ENOTDIR: c_int = 20; 1491 pub const EISDIR: c_int = 21; 1492 pub const EINVAL: c_int = 22; 1493 pub const ENFILE: c_int = 23; 1494 pub const EMFILE: c_int = 24; 1495 pub const ENOTTY: c_int = 25; 1496 pub const ETXTBSY: c_int = 26; 1497 pub const EFBIG: c_int = 27; 1498 pub const ENOSPC: c_int = 28; 1499 pub const ESPIPE: c_int = 29; 1500 pub const EROFS: c_int = 30; 1501 pub const EMLINK: c_int = 31; 1502 pub const EPIPE: c_int = 32; 1503 pub const EDOM: c_int = 33; 1504 pub const ERANGE: c_int = 34; 1505 pub const ENOMSG: c_int = 35; 1506 pub const EIDRM: c_int = 36; 1507 pub const ECHRNG: c_int = 37; 1508 pub const EL2NSYNC: c_int = 38; 1509 pub const EL3HLT: c_int = 39; 1510 pub const EL3RST: c_int = 40; 1511 pub const ELNRNG: c_int = 41; 1512 pub const EUNATCH: c_int = 42; 1513 pub const ENOCSI: c_int = 43; 1514 pub const EL2HLT: c_int = 44; 1515 pub const EDEADLK: c_int = 45; 1516 pub const ENOLCK: c_int = 46; 1517 pub const EBADE: c_int = 50; 1518 pub const EBADR: c_int = 51; 1519 pub const EXFULL: c_int = 52; 1520 pub const ENOANO: c_int = 53; 1521 pub const EBADRQC: c_int = 54; 1522 pub const EBADSLT: c_int = 55; 1523 pub const EDEADLOCK: c_int = 56; 1524 pub const EBFONT: c_int = 57; 1525 pub const ENOSTR: c_int = 60; 1526 pub const ENODATA: c_int = 61; 1527 pub const ETIME: c_int = 62; 1528 pub const ENOSR: c_int = 63; 1529 pub const ENONET: c_int = 64; 1530 pub const ENOPKG: c_int = 65; 1531 pub const EREMOTE: c_int = 66; 1532 pub const ENOLINK: c_int = 67; 1533 pub const EADV: c_int = 68; 1534 pub const ESRMNT: c_int = 69; 1535 pub const ECOMM: c_int = 70; 1536 pub const EPROTO: c_int = 71; 1537 pub const EMULTIHOP: c_int = 74; 1538 pub const EDOTDOT: c_int = 76; 1539 pub const EBADMSG: c_int = 77; 1540 pub const EFTYPE: c_int = 79; 1541 pub const ENOTUNIQ: c_int = 80; 1542 pub const EBADFD: c_int = 81; 1543 pub const EREMCHG: c_int = 82; 1544 pub const ELIBACC: c_int = 83; 1545 pub const ELIBBAD: c_int = 84; 1546 pub const ELIBSCN: c_int = 85; 1547 pub const ELIBMAX: c_int = 86; 1548 pub const ELIBEXEC: c_int = 87; 1549 pub const ENOSYS: c_int = 88; 1550 pub const ENOTEMPTY: c_int = 90; 1551 pub const ENAMETOOLONG: c_int = 91; 1552 pub const ELOOP: c_int = 92; 1553 pub const EOPNOTSUPP: c_int = 95; 1554 pub const EPFNOSUPPORT: c_int = 96; 1555 pub const ECONNRESET: c_int = 104; 1556 pub const ENOBUFS: c_int = 105; 1557 pub const EAFNOSUPPORT: c_int = 106; 1558 pub const EPROTOTYPE: c_int = 107; 1559 pub const ENOTSOCK: c_int = 108; 1560 pub const ENOPROTOOPT: c_int = 109; 1561 pub const ESHUTDOWN: c_int = 110; 1562 pub const ECONNREFUSED: c_int = 111; 1563 pub const EADDRINUSE: c_int = 112; 1564 pub const ECONNABORTED: c_int = 113; 1565 pub const ENETUNREACH: c_int = 114; 1566 pub const ENETDOWN: c_int = 115; 1567 pub const ETIMEDOUT: c_int = 116; 1568 pub const EHOSTDOWN: c_int = 117; 1569 pub const EHOSTUNREACH: c_int = 118; 1570 pub const EINPROGRESS: c_int = 119; 1571 pub const EALREADY: c_int = 120; 1572 pub const EDESTADDRREQ: c_int = 121; 1573 pub const EMSGSIZE: c_int = 122; 1574 pub const EPROTONOSUPPORT: c_int = 123; 1575 pub const ESOCKTNOSUPPORT: c_int = 124; 1576 pub const EADDRNOTAVAIL: c_int = 125; 1577 pub const ENETRESET: c_int = 126; 1578 pub const EISCONN: c_int = 127; 1579 pub const ENOTCONN: c_int = 128; 1580 pub const ETOOMANYREFS: c_int = 129; 1581 pub const EPROCLIM: c_int = 130; 1582 pub const EUSERS: c_int = 131; 1583 pub const EDQUOT: c_int = 132; 1584 pub const ESTALE: c_int = 133; 1585 pub const ENOTSUP: c_int = 134; 1586 pub const ENOMEDIUM: c_int = 135; 1587 pub const EILSEQ: c_int = 138; 1588 pub const EOVERFLOW: c_int = 139; 1589 pub const ECANCELED: c_int = 140; 1590 pub const ENOTRECOVERABLE: c_int = 141; 1591 pub const EOWNERDEAD: c_int = 142; 1592 pub const ESTRPIPE: c_int = 143; 1593 pub const EWOULDBLOCK: c_int = EAGAIN; /* Operation would block */ 1594 1595 pub const SCHED_OTHER: c_int = 3; 1596 pub const SCHED_FIFO: c_int = 1; 1597 pub const SCHED_RR: c_int = 2; 1598 1599 pub const PTHREAD_COND_INITIALIZER: pthread_cond_t = 21 as *mut _; 1600 pub const PTHREAD_CREATE_DETACHED: c_int = 1; 1601 pub const PTHREAD_CREATE_JOINABLE: c_int = 0; 1602 pub const PTHREAD_MUTEX_RECURSIVE: c_int = 0; 1603 pub const PTHREAD_MUTEX_ERRORCHECK: c_int = 1; 1604 pub const PTHREAD_MUTEX_NORMAL: c_int = 2; 1605 pub const PTHREAD_MUTEX_DEFAULT: c_int = PTHREAD_MUTEX_NORMAL; 1606 pub const PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP: pthread_mutex_t = 18 as *mut _; 1607 pub const PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP: pthread_mutex_t = 20 as *mut _; 1608 pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = 19 as *mut _; 1609 pub const PTHREAD_PROCESS_SHARED: c_int = 1; 1610 pub const PTHREAD_PROCESS_PRIVATE: c_int = 0; 1611 pub const PTHREAD_RWLOCK_INITIALIZER: pthread_rwlock_t = 22 as *mut _; 1612 1613 pub const LITTLE_ENDIAN: c_int = 1234; 1614 pub const BIG_ENDIAN: c_int = 4321; 1615 1616 pub const TCP_NODELAY: c_int = 1; 1617 pub const TCP_KEEPIDLE: c_int = 3; 1618 pub const TCP_MAXSEG: c_int = 4; 1619 pub const TCP_QUICKACK: c_int = 12; 1620 pub const TCP_USER_TIMEOUT: c_int = 14; 1621 pub const TCP_FASTOPEN: c_int = 15; 1622 pub const TCP_KEEPCNT: c_int = 16; 1623 pub const TCP_KEEPINTVL: c_int = 17; 1624 1625 pub const WINDOWS_POST: c_int = 0; 1626 pub const WINDOWS_SEND: c_int = 1; 1627 pub const WINDOWS_HWND: c_int = 2; 1628 1629 pub const MOUNT_TEXT: c_uint = 0x01; 1630 pub const MOUNT_SYSTEM: c_uint = 0x08; 1631 pub const MOUNT_EXEC: c_uint = 0x10; 1632 pub const MOUNT_CYGDRIVE: c_uint = 0x20; 1633 pub const MOUNT_CYGWIN_EXEC: c_uint = 0x40; 1634 pub const MOUNT_SPARSE: c_uint = 0x80; 1635 pub const MOUNT_NOTEXEC: c_uint = 0x100; 1636 pub const MOUNT_DEVFS: c_uint = 0x200; 1637 pub const MOUNT_PROC: c_uint = 0x400; 1638 pub const MOUNT_RO: c_uint = 0x1000; 1639 pub const MOUNT_NOACL: c_uint = 0x2000; 1640 pub const MOUNT_NOPOSIX: c_uint = 0x4000; 1641 pub const MOUNT_OVERRIDE: c_uint = 0x8000; 1642 pub const MOUNT_IMMUTABLE: c_uint = 0x10000; 1643 pub const MOUNT_AUTOMATIC: c_uint = 0x20000; 1644 pub const MOUNT_DOS: c_uint = 0x40000; 1645 pub const MOUNT_IHASH: c_uint = 0x80000; 1646 pub const MOUNT_BIND: c_uint = 0x100000; 1647 pub const MOUNT_USER_TEMP: c_uint = 0x200000; 1648 pub const MOUNT_DONT_USE: c_uint = 0x80000000; 1649 1650 pub const _POSIX_VDISABLE: cc_t = 0; 1651 1652 pub const GRND_NONBLOCK: c_uint = 0x1; 1653 pub const GRND_RANDOM: c_uint = 0x2; 1654 1655 pub const _IOFBF: c_int = 0; 1656 pub const _IOLBF: c_int = 1; 1657 pub const _IONBF: c_int = 2; 1658 pub const BUFSIZ: c_int = 1024; 1659 1660 pub const POSIX_SPAWN_RESETIDS: c_int = 0x01; 1661 pub const POSIX_SPAWN_SETPGROUP: c_int = 0x02; 1662 pub const POSIX_SPAWN_SETSCHEDPARAM: c_int = 0x04; 1663 pub const POSIX_SPAWN_SETSCHEDULER: c_int = 0x08; 1664 pub const POSIX_SPAWN_SETSIGDEF: c_int = 0x10; 1665 pub const POSIX_SPAWN_SETSIGMASK: c_int = 0x20; 1666 1667 pub const POSIX_FADV_NORMAL: c_int = 0; 1668 pub const POSIX_FADV_SEQUENTIAL: c_int = 1; 1669 pub const POSIX_FADV_RANDOM: c_int = 2; 1670 pub const POSIX_FADV_WILLNEED: c_int = 3; 1671 pub const POSIX_FADV_DONTNEED: c_int = 4; 1672 pub const POSIX_FADV_NOREUSE: c_int = 5; 1673 1674 pub const FALLOC_FL_PUNCH_HOLE: c_int = 0x0001; 1675 pub const FALLOC_FL_ZERO_RANGE: c_int = 0x0002; 1676 pub const FALLOC_FL_UNSHARE_RANGE: c_int = 0x0004; 1677 pub const FALLOC_FL_COLLAPSE_RANGE: c_int = 0x0008; 1678 pub const FALLOC_FL_INSERT_RANGE: c_int = 0x0010; 1679 pub const FALLOC_FL_KEEP_SIZE: c_int = 0x1000; 1680 1681 f! { 1682 pub unsafe fn FD_CLR(fd: c_int, set: *mut fd_set) -> () { 1683 let fd = fd as usize; 1684 let size = size_of_val(&(*set).fds_bits[0]) * 8; 1685 (*set).fds_bits[fd / size] &= !(1 << (fd % size)); 1686 } 1687 1688 pub unsafe fn FD_ISSET(fd: c_int, set: *const fd_set) -> bool { 1689 let fd = fd as usize; 1690 let size = size_of_val(&(*set).fds_bits[0]) * 8; 1691 ((*set).fds_bits[fd / size] & (1 << (fd % size))) != 0 1692 } 1693 1694 pub unsafe fn FD_SET(fd: c_int, set: *mut fd_set) -> () { 1695 let fd = fd as usize; 1696 let size = size_of_val(&(*set).fds_bits[0]) * 8; 1697 (*set).fds_bits[fd / size] |= 1 << (fd % size); 1698 } 1699 1700 pub unsafe fn FD_ZERO(set: *mut fd_set) -> () { 1701 (*set).fds_bits.fill(0); 1702 } 1703 1704 pub unsafe fn CPU_ALLOC_SIZE(count: c_int) -> size_t { 1705 let _dummy: cpu_set_t = cpu_set_t { bits: [0; 16] }; 1706 let size_in_bits = 8 * size_of_val(&_dummy.bits[0]); 1707 ((count as size_t + size_in_bits - 1) / 8) as size_t 1708 } 1709 1710 pub unsafe fn CPU_COUNT_S(size: usize, cpuset: &cpu_set_t) -> c_int { 1711 let mut s: u32 = 0; 1712 let size_of_mask = size_of_val(&cpuset.bits[0]); 1713 for i in cpuset.bits[..(size / size_of_mask)].iter() { 1714 s += i.count_ones(); 1715 } 1716 s as c_int 1717 } 1718 1719 pub unsafe fn CPU_ZERO(cpuset: &mut cpu_set_t) -> () { 1720 cpuset.bits.fill(0); 1721 } 1722 1723 pub unsafe fn CPU_SET(cpu: usize, cpuset: &mut cpu_set_t) -> () { 1724 let size_in_bits = 8 * size_of_val(&cpuset.bits[0]); 1725 if cpu < size_in_bits { 1726 let (idx, offset) = (cpu / size_in_bits, cpu % size_in_bits); 1727 cpuset.bits[idx] |= 1 << offset; 1728 } 1729 } 1730 1731 pub unsafe fn CPU_CLR(cpu: usize, cpuset: &mut cpu_set_t) -> () { 1732 let size_in_bits = 8 * size_of_val(&cpuset.bits[0]); 1733 if cpu < size_in_bits { 1734 let (idx, offset) = (cpu / size_in_bits, cpu % size_in_bits); 1735 cpuset.bits[idx] &= !(1 << offset); 1736 } 1737 } 1738 1739 pub unsafe fn CPU_ISSET(cpu: usize, cpuset: &cpu_set_t) -> bool { 1740 let size_in_bits = 8 * size_of_val(&cpuset.bits[0]); 1741 if cpu < size_in_bits { 1742 let (idx, offset) = (cpu / size_in_bits, cpu % size_in_bits); 1743 0 != (cpuset.bits[idx] & (1 << offset)) 1744 } else { 1745 false 1746 } 1747 } 1748 1749 pub unsafe fn CPU_COUNT(cpuset: &cpu_set_t) -> c_int { 1750 CPU_COUNT_S(size_of::(), cpuset) 1751 } 1752 1753 pub unsafe fn CPU_EQUAL(set1: &cpu_set_t, set2: &cpu_set_t) -> bool { 1754 set1.bits == set2.bits 1755 } 1756 1757 pub unsafe fn CMSG_LEN(length: c_uint) -> c_uint { 1758 CMSG_ALIGN(size_of::()) as c_uint + length 1759 } 1760 1761 pub const unsafe fn CMSG_SPACE(length: c_uint) -> c_uint { 1762 (CMSG_ALIGN(length as usize) + CMSG_ALIGN(size_of::())) as c_uint 1763 } 1764 1765 pub unsafe fn CMSG_FIRSTHDR(mhdr: *const msghdr) -> *mut cmsghdr { 1766 if (*mhdr).msg_controllen as usize >= size_of::() { 1767 (*mhdr).msg_control.cast() 1768 } else { 1769 ptr::null_mut() 1770 } 1771 } 1772 1773 pub unsafe fn CMSG_NXTHDR(mhdr: *const msghdr, cmsg: *const cmsghdr) -> *mut cmsghdr { 1774 let next = (cmsg as usize + CMSG_ALIGN((*cmsg).cmsg_len as usize)) as *mut cmsghdr; 1775 let max = (*mhdr).msg_control as usize + (*mhdr).msg_controllen as usize; 1776 if next as usize + CMSG_ALIGN(size_of::()) as usize > max { 1777 ptr::null_mut() 1778 } else { 1779 next 1780 } 1781 } 1782 1783 pub unsafe fn CMSG_DATA(cmsg: *const cmsghdr) -> *mut c_uchar { 1784 cmsg.offset(1).cast_mut().cast() 1785 } 1786 } 1787 1788 safe_f! { 1789 pub const safe fn makedev(ma: c_uint, mi: c_uint) -> dev_t { 1790 let ma = ma as dev_t; 1791 let mi = mi as dev_t; 1792 (ma << 16) | (mi & 0xffff) 1793 } 1794 1795 pub const safe fn major(dev: dev_t) -> c_uint { 1796 ((dev >> 16) & 0xffff) as c_uint 1797 } 1798 1799 pub const safe fn minor(dev: dev_t) -> c_uint { 1800 (dev & 0xffff) as c_uint 1801 } 1802 1803 pub const safe fn WIFEXITED(status: c_int) -> bool { 1804 (status & 0xff) == 0 1805 } 1806 1807 pub const safe fn WIFSIGNALED(status: c_int) -> bool { 1808 (status & 0o177) != 0o177 && (status & 0o177) != 0 1809 } 1810 1811 pub const safe fn WIFSTOPPED(status: c_int) -> bool { 1812 (status & 0xff) == 0o177 1813 } 1814 1815 pub const safe fn WIFCONTINUED(status: c_int) -> bool { 1816 (status & 0o177777) == 0o177777 1817 } 1818 1819 pub const safe fn WEXITSTATUS(status: c_int) -> c_int { 1820 (status >> 8) & 0xff 1821 } 1822 1823 pub const safe fn WTERMSIG(status: c_int) -> c_int { 1824 status & 0o177 1825 } 1826 1827 pub const safe fn WSTOPSIG(status: c_int) -> c_int { 1828 (status >> 8) & 0xff 1829 } 1830 1831 pub const safe fn WCOREDUMP(status: c_int) -> bool { 1832 WIFSIGNALED(status) && (status & 0x80) != 0 1833 } 1834 } 1835 1836 const fn CMSG_ALIGN(len: usize) -> usize { 1837 len + size_of::() - 1 & !(size_of::() - 1) 1838 } 1839 1840 extern "C" { 1841 pub fn sigwait(set: *const sigset_t, sig: *mut c_int) -> c_int; 1842 pub fn sigwaitinfo(set: *const sigset_t, info: *mut siginfo_t) -> c_int; 1843 1844 pub fn pthread_sigmask(how: c_int, set: *const sigset_t, oldset: *mut sigset_t) -> c_int; 1845 pub fn sigsuspend(mask: *const sigset_t) -> c_int; 1846 pub fn sigaltstack(ss: *const stack_t, oss: *mut stack_t) -> c_int; 1847 pub fn pthread_kill(thread: pthread_t, sig: c_int) -> c_int; 1848 1849 pub fn sigtimedwait( 1850 set: *const sigset_t, 1851 info: *mut siginfo_t, 1852 timeout: *const timespec, 1853 ) -> c_int; 1854 1855 pub fn strftime(s: *mut c_char, max: size_t, format: *const c_char, tm: *const tm) -> size_t; 1856 1857 pub fn asctime_r(tm: *const tm, buf: *mut c_char) -> *mut c_char; 1858 pub fn ctime_r(timep: *const time_t, buf: *mut c_char) -> *mut c_char; 1859 pub fn strptime(s: *const c_char, format: *const c_char, tm: *mut tm) -> *mut c_char; 1860 pub fn clock_settime(clk_id: clockid_t, tp: *const timespec) -> c_int; 1861 pub fn clock_gettime(clk_id: clockid_t, tp: *mut timespec) -> c_int; 1862 pub fn clock_getres(clk_id: clockid_t, tp: *mut timespec) -> c_int; 1863 1864 pub fn timer_create(clockid: clockid_t, sevp: *mut sigevent, timerid: *mut timer_t) -> c_int; 1865 1866 pub fn timer_delete(timerid: timer_t) -> c_int; 1867 1868 pub fn timer_settime( 1869 timerid: timer_t, 1870 flags: c_int, 1871 new_value: *const itimerspec, 1872 old_value: *mut itimerspec, 1873 ) -> c_int; 1874 1875 pub fn timer_gettime(timerid: timer_t, curr_value: *mut itimerspec) -> c_int; 1876 pub fn timer_getoverrun(timerid: timer_t) -> c_int; 1877 1878 pub fn clock_nanosleep( 1879 clk_id: clockid_t, 1880 flags: c_int, 1881 rqtp: *const timespec, 1882 rmtp: *mut timespec, 1883 ) -> c_int; 1884 1885 pub fn clock_getcpuclockid(pid: pid_t, clk_id: *mut clockid_t) -> c_int; 1886 1887 pub fn futimes(fd: c_int, times: *const timeval) -> c_int; 1888 pub fn lutimes(file: *const c_char, times: *const timeval) -> c_int; 1889 pub fn settimeofday(tv: *const timeval, tz: *const timezone) -> c_int; 1890 pub fn getitimer(which: c_int, curr_value: *mut itimerval) -> c_int; 1891 1892 pub fn setitimer(which: c_int, new_value: *const itimerval, old_value: *mut itimerval) 1893 -> c_int; 1894 1895 pub fn gettimeofday(tp: *mut timeval, tz: *mut c_void) -> c_int; 1896 pub fn futimesat(fd: c_int, path: *const c_char, times: *const timeval) -> c_int; 1897 1898 pub fn getrlimit(resource: c_int, rlim: *mut rlimit) -> c_int; 1899 pub fn setrlimit(resource: c_int, rlim: *const rlimit) -> c_int; 1900 pub fn getpriority(which: c_int, who: id_t) -> c_int; 1901 pub fn setpriority(which: c_int, who: id_t, prio: c_int) -> c_int; 1902 1903 pub fn getpwnam_r( 1904 name: *const c_char, 1905 pwd: *mut passwd, 1906 buf: *mut c_char, 1907 buflen: size_t, 1908 result: *mut *mut passwd, 1909 ) -> c_int; 1910 1911 pub fn getpwuid_r( 1912 uid: uid_t, 1913 pwd: *mut passwd, 1914 buf: *mut c_char, 1915 buflen: size_t, 1916 result: *mut *mut passwd, 1917 ) -> c_int; 1918 1919 pub fn getpwent() -> *mut passwd; 1920 pub fn setpwent(); 1921 pub fn endpwent(); 1922 1923 pub fn if_nameindex() -> *mut if_nameindex; 1924 pub fn if_freenameindex(ptr: *mut if_nameindex); 1925 1926 pub fn readv(fd: c_int, iov: *const iovec, iovcnt: c_int) -> ssize_t; 1927 pub fn writev(fd: c_int, iov: *const iovec, iovcnt: c_int) -> ssize_t; 1928 1929 pub fn mkfifoat(dirfd: c_int, pathname: *const c_char, mode: mode_t) -> c_int; 1930 1931 pub fn mknodat(dirfd: c_int, pathname: *const c_char, mode: mode_t, dev: dev_t) -> c_int; 1932 1933 pub fn utimensat( 1934 dirfd: c_int, 1935 path: *const c_char, 1936 times: *const timespec, 1937 flag: c_int, 1938 ) -> c_int; 1939 1940 pub fn futimens(fd: c_int, times: *const timespec) -> c_int; 1941 1942 pub fn dlfork(val: c_int); 1943 1944 pub fn accept4(s: c_int, addr: *mut sockaddr, addrlen: *mut socklen_t, flags: c_int) -> c_int; 1945 1946 pub fn bind(socket: c_int, address: *const sockaddr, address_len: socklen_t) -> c_int; 1947 1948 pub fn recvfrom( 1949 socket: c_int, 1950 buf: *mut c_void, 1951 len: size_t, 1952 flags: c_int, 1953 addr: *mut sockaddr, 1954 addrlen: *mut socklen_t, 1955 ) -> ssize_t; 1956 1957 pub fn recvmsg(fd: c_int, msg: *mut msghdr, flags: c_int) -> ssize_t; 1958 pub fn sendmsg(fd: c_int, msg: *const msghdr, flags: c_int) -> ssize_t; 1959 1960 pub fn getnameinfo( 1961 sa: *const sockaddr, 1962 salen: socklen_t, 1963 host: *mut c_char, 1964 hostlen: socklen_t, 1965 serv: *mut c_char, 1966 sevlen: socklen_t, 1967 flags: c_int, 1968 ) -> c_int; 1969 1970 pub fn ppoll( 1971 fds: *mut pollfd, 1972 nfds: nfds_t, 1973 timeout: *const timespec, 1974 sigmask: *const sigset_t, 1975 ) -> c_int; 1976 1977 pub fn newlocale(mask: c_int, locale: *const c_char, base: locale_t) -> locale_t; 1978 pub fn freelocale(loc: locale_t); 1979 pub fn duplocale(base: locale_t) -> locale_t; 1980 pub fn uselocale(loc: locale_t) -> locale_t; 1981 1982 pub fn sem_init(sem: *mut sem_t, pshared: c_int, value: c_uint) -> c_int; 1983 pub fn sem_destroy(sem: *mut sem_t) -> c_int; 1984 pub fn sem_open(name: *const c_char, oflag: c_int, ...) -> *mut sem_t; 1985 pub fn sem_close(sem: *mut sem_t) -> c_int; 1986 pub fn sem_unlink(name: *const c_char) -> c_int; 1987 pub fn sem_timedwait(sem: *mut sem_t, abstime: *const timespec) -> c_int; 1988 pub fn sem_getvalue(sem: *mut sem_t, sval: *mut c_int) -> c_int; 1989 1990 pub fn clearenv() -> c_int; 1991 pub fn ptsname_r(fd: c_int, buf: *mut c_char, buflen: size_t) -> c_int; 1992 pub fn getpt() -> c_int; 1993 pub fn memalign(align: size_t, size: size_t) -> *mut c_void; 1994 pub fn getloadavg(loadavg: *mut c_double, nelem: c_int) -> c_int; 1995 1996 pub fn abs(i: c_int) -> c_int; 1997 pub fn arc4random() -> u32; 1998 pub fn arc4random_uniform(l: u32) -> u32; 1999 pub fn arc4random_buf(buf: *mut c_void, size: size_t); 2000 pub fn labs(i: c_long) -> c_long; 2001 pub fn mkostemp(template: *mut c_char, flags: c_int) -> c_int; 2002 pub fn mkostemps(template: *mut c_char, suffixlen: c_int, flags: c_int) -> c_int; 2003 pub fn mkstemps(template: *mut c_char, suffixlen: c_int) -> c_int; 2004 pub fn rand() -> c_int; 2005 pub fn reallocarray(ptr: *mut c_void, nmemb: size_t, size: size_t) -> *mut c_void; 2006 pub fn reallocf(ptr: *mut c_void, size: size_t) -> *mut c_void; 2007 pub fn srand(seed: c_uint); 2008 pub fn drand48() -> c_double; 2009 pub fn erand48(xseed: *mut c_ushort) -> c_double; 2010 pub fn jrand48(xseed: *mut c_ushort) -> c_long; 2011 pub fn lcong48(p: *mut c_ushort); 2012 pub fn lrand48() -> c_long; 2013 pub fn mrand48() -> c_long; 2014 pub fn nrand48(xseed: *mut c_ushort) -> c_long; 2015 pub fn seed48(xseed: *mut c_ushort) -> *mut c_ushort; 2016 pub fn srand48(seed: c_long); 2017 2018 pub fn qsort_r( 2019 base: *mut c_void, 2020 num: size_t, 2021 size: size_t, 2022 compar: Option c_int>, 2023 arg: *mut c_void, 2024 ); 2025 2026 pub fn mprotect(addr: *mut c_void, len: size_t, prot: c_int) -> c_int; 2027 pub fn msync(addr: *mut c_void, len: size_t, flags: c_int) -> c_int; 2028 pub fn posix_madvise(addr: *mut c_void, len: size_t, advice: c_int) -> c_int; 2029 pub fn madvise(addr: *mut c_void, len: size_t, advice: c_int) -> c_int; 2030 pub fn shm_open(name: *const c_char, oflag: c_int, mode: mode_t) -> c_int; 2031 pub fn shm_unlink(name: *const c_char) -> c_int; 2032 2033 pub fn explicit_bzero(s: *mut c_void, len: size_t); 2034 pub fn ffs(value: c_int) -> c_int; 2035 pub fn ffsl(value: c_long) -> c_int; 2036 pub fn ffsll(value: c_longlong) -> c_int; 2037 pub fn fls(value: c_int) -> c_int; 2038 pub fn flsl(value: c_long) -> c_int; 2039 pub fn flsll(value: c_longlong) -> c_int; 2040 pub fn strcasecmp_l(s1: *const c_char, s2: *const c_char, loc: locale_t) -> c_int; 2041 2042 pub fn strncasecmp_l(s1: *const c_char, s2: *const c_char, n: size_t, loc: locale_t) -> c_int; 2043 2044 pub fn timingsafe_bcmp(a: *const c_void, b: *const c_void, len: size_t) -> c_int; 2045 pub fn timingsafe_memcmp(a: *const c_void, b: *const c_void, len: size_t) -> c_int; 2046 2047 pub fn memmem( 2048 haystack: *const c_void, 2049 haystacklen: size_t, 2050 needle: *const c_void, 2051 needlelen: size_t, 2052 ) -> *mut c_void; 2053 2054 pub fn memrchr(cx: *const c_void, c: c_int, n: size_t) -> *mut c_void; 2055 #[link_name = "__xpg_strerror_r"] 2056 pub fn strerror_r(errnum: c_int, buf: *mut c_char, buflen: size_t) -> c_int; 2057 pub fn strsep(string: *mut *mut c_char, delim: *const c_char) -> *mut c_char; 2058 2059 #[link_name = "__gnu_basename"] 2060 pub fn basename(path: *const c_char) -> *mut c_char; 2061 2062 pub fn daemon(nochdir: c_int, noclose: c_int) -> c_int; 2063 pub fn dup3(src: c_int, dst: c_int, flags: c_int) -> c_int; 2064 pub fn eaccess(pathname: *const c_char, mode: c_int) -> c_int; 2065 pub fn euidaccess(pathname: *const c_char, mode: c_int) -> c_int; 2066 2067 pub fn execvpe( 2068 file: *const c_char, 2069 argv: *const *mut c_char, 2070 envp: *const *mut c_char, 2071 ) -> c_int; 2072 2073 pub fn faccessat(dirfd: c_int, pathname: *const c_char, mode: c_int, flags: c_int) -> c_int; 2074 2075 pub fn fexecve(fd: c_int, argv: *const *mut c_char, envp: *const *mut c_char) -> c_int; 2076 2077 pub fn fdatasync(fd: c_int) -> c_int; 2078 pub fn getdomainname(name: *mut c_char, len: size_t) -> c_int; 2079 pub fn getentropy(buf: *mut c_void, buflen: size_t) -> c_int; 2080 pub fn gethostid() -> c_long; 2081 pub fn getpagesize() -> c_int; 2082 pub fn getpeereid(socket: c_int, euid: *mut uid_t, egid: *mut gid_t) -> c_int; 2083 2084 pub fn pthread_atfork( 2085 prepare: Option, 2086 parent: Option, 2087 child: Option, 2088 ) -> c_int; 2089 2090 pub fn pipe2(fds: *mut c_int, flags: c_int) -> c_int; 2091 pub fn sbrk(increment: intptr_t) -> *mut c_void; 2092 pub fn setgroups(ngroups: c_int, ptr: *const gid_t) -> c_int; 2093 pub fn sethostname(name: *const c_char, len: size_t) -> c_int; 2094 pub fn vhangup() -> c_int; 2095 pub fn getdtablesize() -> c_int; 2096 pub fn sync(); 2097 2098 pub fn __errno() -> *mut c_int; 2099 2100 pub fn sched_setparam(pid: pid_t, param: *const sched_param) -> c_int; 2101 pub fn sched_getparam(pid: pid_t, param: *mut sched_param) -> c_int; 2102 2103 pub fn sched_setscheduler(pid: pid_t, policy: c_int, param: *const sched_param) -> c_int; 2104 2105 pub fn sched_getscheduler(pid: pid_t) -> c_int; 2106 pub fn sched_get_priority_max(policy: c_int) -> c_int; 2107 pub fn sched_get_priority_min(policy: c_int) -> c_int; 2108 pub fn sched_rr_get_interval(pid: pid_t, t: *mut timespec) -> c_int; 2109 pub fn sched_getcpu() -> c_int; 2110 pub fn sched_getaffinity(pid: pid_t, cpusetsize: size_t, mask: *mut cpu_set_t) -> c_int; 2111 2112 pub fn sched_setaffinity(pid: pid_t, cpusetsize: size_t, cpuset: *const cpu_set_t) -> c_int; 2113 2114 pub fn pthread_attr_getguardsize(attr: *const pthread_attr_t, guardsize: *mut size_t) -> c_int; 2115 2116 pub fn pthread_attr_getschedparam( 2117 attr: *const pthread_attr_t, 2118 param: *mut sched_param, 2119 ) -> c_int; 2120 2121 pub fn pthread_attr_setschedparam( 2122 attr: *mut pthread_attr_t, 2123 param: *const sched_param, 2124 ) -> c_int; 2125 2126 pub fn pthread_attr_getstack( 2127 attr: *const pthread_attr_t, 2128 stackaddr: *mut *mut c_void, 2129 stacksize: *mut size_t, 2130 ) -> c_int; 2131 2132 pub fn pthread_cancel(thread: pthread_t) -> c_int; 2133 2134 pub fn pthread_condattr_getclock( 2135 attr: *const pthread_condattr_t, 2136 clock_id: *mut clockid_t, 2137 ) -> c_int; 2138 2139 pub fn pthread_condattr_getpshared( 2140 attr: *const pthread_condattr_t, 2141 pshared: *mut c_int, 2142 ) -> c_int; 2143 2144 pub fn pthread_condattr_setclock(attr: *mut pthread_condattr_t, clock_id: clockid_t) -> c_int; 2145 2146 pub fn pthread_condattr_setpshared(attr: *mut pthread_condattr_t, pshared: c_int) -> c_int; 2147 pub fn pthread_barrierattr_init(attr: *mut pthread_barrierattr_t) -> c_int; 2148 2149 pub fn pthread_barrierattr_setpshared(attr: *mut pthread_barrierattr_t, shared: c_int) 2150 -> c_int; 2151 2152 pub fn pthread_barrierattr_getpshared( 2153 attr: *const pthread_barrierattr_t, 2154 shared: *mut c_int, 2155 ) -> c_int; 2156 2157 pub fn pthread_barrierattr_destroy(attr: *mut pthread_barrierattr_t) -> c_int; 2158 2159 pub fn pthread_barrier_init( 2160 barrier: *mut pthread_barrier_t, 2161 attr: *const pthread_barrierattr_t, 2162 count: c_uint, 2163 ) -> c_int; 2164 2165 pub fn pthread_barrier_destroy(barrier: *mut pthread_barrier_t) -> c_int; 2166 pub fn pthread_barrier_wait(barrier: *mut pthread_barrier_t) -> c_int; 2167 2168 pub fn pthread_create( 2169 native: *mut pthread_t, 2170 attr: *const pthread_attr_t, 2171 f: extern "C" fn(*mut c_void) -> *mut c_void, 2172 value: *mut c_void, 2173 ) -> c_int; 2174 2175 pub fn pthread_getcpuclockid(thread: pthread_t, clk_id: *mut clockid_t) -> c_int; 2176 2177 pub fn pthread_getschedparam( 2178 native: pthread_t, 2179 policy: *mut c_int, 2180 param: *mut sched_param, 2181 ) -> c_int; 2182 2183 pub fn pthread_mutex_timedlock(lock: *mut pthread_mutex_t, abstime: *const timespec) -> c_int; 2184 2185 pub fn pthread_mutexattr_getprotocol( 2186 attr: *const pthread_mutexattr_t, 2187 protocol: *mut c_int, 2188 ) -> c_int; 2189 2190 pub fn pthread_mutexattr_getpshared( 2191 attr: *const pthread_mutexattr_t, 2192 pshared: *mut c_int, 2193 ) -> c_int; 2194 2195 pub fn pthread_mutexattr_setprotocol(attr: *mut pthread_mutexattr_t, protocol: c_int) -> c_int; 2196 2197 pub fn pthread_mutexattr_setpshared(attr: *mut pthread_mutexattr_t, pshared: c_int) -> c_int; 2198 2199 pub fn pthread_spin_destroy(lock: *mut pthread_spinlock_t) -> c_int; 2200 pub fn pthread_spin_init(lock: *mut pthread_spinlock_t, pshared: c_int) -> c_int; 2201 pub fn pthread_spin_lock(lock: *mut pthread_spinlock_t) -> c_int; 2202 pub fn pthread_spin_trylock(lock: *mut pthread_spinlock_t) -> c_int; 2203 pub fn pthread_spin_unlock(lock: *mut pthread_spinlock_t) -> c_int; 2204 2205 pub fn pthread_rwlockattr_getpshared( 2206 attr: *const pthread_rwlockattr_t, 2207 val: *mut c_int, 2208 ) -> c_int; 2209 2210 pub fn pthread_rwlockattr_setpshared(attr: *mut pthread_rwlockattr_t, val: c_int) -> c_int; 2211 2212 pub fn pthread_setschedparam( 2213 native: pthread_t, 2214 policy: c_int, 2215 param: *const sched_param, 2216 ) -> c_int; 2217 2218 pub fn pthread_setschedprio(native: pthread_t, priority: c_int) -> c_int; 2219 2220 pub fn pthread_getaffinity_np( 2221 thread: pthread_t, 2222 cpusetsize: size_t, 2223 cpuset: *mut cpu_set_t, 2224 ) -> c_int; 2225 2226 pub fn pthread_getattr_np(native: pthread_t, attr: *mut pthread_attr_t) -> c_int; 2227 pub fn pthread_getname_np(thread: pthread_t, name: *mut c_char, len: size_t) -> c_int; 2228 2229 pub fn pthread_setaffinity_np( 2230 thread: pthread_t, 2231 cpusetsize: size_t, 2232 cpuset: *const cpu_set_t, 2233 ) -> c_int; 2234 2235 pub fn pthread_setname_np(thread: pthread_t, name: *const c_char) -> c_int; 2236 pub fn pthread_sigqueue(thread: pthread_t, sig: c_int, value: sigval) -> c_int; 2237 2238 pub fn ioctl(fd: c_int, request: c_int, ...) -> c_int; 2239 2240 pub fn getrandom(buf: *mut c_void, buflen: size_t, flags: c_uint) -> ssize_t; 2241 2242 pub fn mount(src: *const c_char, target: *const c_char, flags: c_uint) -> c_int; 2243 2244 pub fn umount(target: *const c_char) -> c_int; 2245 pub fn cygwin_umount(target: *const c_char, flags: c_uint) -> c_int; 2246 2247 pub fn dirfd(dirp: *mut DIR) -> c_int; 2248 pub fn seekdir(dirp: *mut DIR, loc: c_long); 2249 pub fn telldir(dirp: *mut DIR) -> c_long; 2250 2251 pub fn uname(buf: *mut utsname) -> c_int; 2252 2253 pub fn posix_spawn( 2254 pid: *mut pid_t, 2255 path: *const c_char, 2256 file_actions: *const posix_spawn_file_actions_t, 2257 attrp: *const posix_spawnattr_t, 2258 argv: *const *mut c_char, 2259 envp: *const *mut c_char, 2260 ) -> c_int; 2261 pub fn posix_spawnp( 2262 pid: *mut pid_t, 2263 file: *const c_char, 2264 file_actions: *const posix_spawn_file_actions_t, 2265 attrp: *const posix_spawnattr_t, 2266 argv: *const *mut c_char, 2267 envp: *const *mut c_char, 2268 ) -> c_int; 2269 pub fn posix_spawnattr_init(attr: *mut posix_spawnattr_t) -> c_int; 2270 pub fn posix_spawnattr_destroy(attr: *mut posix_spawnattr_t) -> c_int; 2271 pub fn posix_spawnattr_getsigdefault( 2272 attr: *const posix_spawnattr_t, 2273 default: *mut sigset_t, 2274 ) -> c_int; 2275 pub fn posix_spawnattr_setsigdefault( 2276 attr: *mut posix_spawnattr_t, 2277 default: *const sigset_t, 2278 ) -> c_int; 2279 pub fn posix_spawnattr_getsigmask( 2280 attr: *const posix_spawnattr_t, 2281 default: *mut sigset_t, 2282 ) -> c_int; 2283 pub fn posix_spawnattr_setsigmask( 2284 attr: *mut posix_spawnattr_t, 2285 default: *const sigset_t, 2286 ) -> c_int; 2287 pub fn posix_spawnattr_getflags(attr: *const posix_spawnattr_t, flags: *mut c_short) -> c_int; 2288 pub fn posix_spawnattr_setflags(attr: *mut posix_spawnattr_t, flags: c_short) -> c_int; 2289 pub fn posix_spawnattr_getpgroup(attr: *const posix_spawnattr_t, flags: *mut pid_t) -> c_int; 2290 pub fn posix_spawnattr_setpgroup(attr: *mut posix_spawnattr_t, flags: pid_t) -> c_int; 2291 pub fn posix_spawnattr_getschedpolicy( 2292 attr: *const posix_spawnattr_t, 2293 flags: *mut c_int, 2294 ) -> c_int; 2295 pub fn posix_spawnattr_setschedpolicy(attr: *mut posix_spawnattr_t, flags: c_int) -> c_int; 2296 pub fn posix_spawnattr_getschedparam( 2297 attr: *const posix_spawnattr_t, 2298 param: *mut sched_param, 2299 ) -> c_int; 2300 pub fn posix_spawnattr_setschedparam( 2301 attr: *mut posix_spawnattr_t, 2302 param: *const sched_param, 2303 ) -> c_int; 2304 2305 pub fn posix_spawn_file_actions_init(actions: *mut posix_spawn_file_actions_t) -> c_int; 2306 pub fn posix_spawn_file_actions_destroy(actions: *mut posix_spawn_file_actions_t) -> c_int; 2307 pub fn posix_spawn_file_actions_addopen( 2308 actions: *mut posix_spawn_file_actions_t, 2309 fd: c_int, 2310 path: *const c_char, 2311 oflag: c_int, 2312 mode: mode_t, 2313 ) -> c_int; 2314 pub fn posix_spawn_file_actions_addclose( 2315 actions: *mut posix_spawn_file_actions_t, 2316 fd: c_int, 2317 ) -> c_int; 2318 pub fn posix_spawn_file_actions_adddup2( 2319 actions: *mut posix_spawn_file_actions_t, 2320 fd: c_int, 2321 newfd: c_int, 2322 ) -> c_int; 2323 pub fn posix_spawn_file_actions_addchdir( 2324 actions: *mut crate::posix_spawn_file_actions_t, 2325 path: *const c_char, 2326 ) -> c_int; 2327 pub fn posix_spawn_file_actions_addfchdir( 2328 actions: *mut crate::posix_spawn_file_actions_t, 2329 fd: c_int, 2330 ) -> c_int; 2331 pub fn posix_spawn_file_actions_addchdir_np( 2332 actions: *mut crate::posix_spawn_file_actions_t, 2333 path: *const c_char, 2334 ) -> c_int; 2335 pub fn posix_spawn_file_actions_addfchdir_np( 2336 actions: *mut crate::posix_spawn_file_actions_t, 2337 fd: c_int, 2338 ) -> c_int; 2339 2340 pub fn forkpty( 2341 amaster: *mut c_int, 2342 name: *mut c_char, 2343 termp: *const termios, 2344 winp: *const crate::winsize, 2345 ) -> crate::pid_t; 2346 pub fn openpty( 2347 amaster: *mut c_int, 2348 aslave: *mut c_int, 2349 name: *mut c_char, 2350 termp: *const termios, 2351 winp: *const crate::winsize, 2352 ) -> c_int; 2353 2354 pub fn getgrgid(gid: crate::gid_t) -> *mut crate::group; 2355 pub fn getgrgid_r( 2356 gid: crate::gid_t, 2357 grp: *mut crate::group, 2358 buf: *mut c_char, 2359 buflen: size_t, 2360 result: *mut *mut crate::group, 2361 ) -> c_int; 2362 pub fn getgrouplist( 2363 user: *const c_char, 2364 group: crate::gid_t, 2365 groups: *mut crate::gid_t, 2366 ngroups: *mut c_int, 2367 ) -> c_int; 2368 pub fn getgrnam(name: *const c_char) -> *mut crate::group; 2369 pub fn getgrnam_r( 2370 name: *const c_char, 2371 grp: *mut crate::group, 2372 buf: *mut c_char, 2373 buflen: size_t, 2374 result: *mut *mut crate::group, 2375 ) -> c_int; 2376 pub fn initgroups(user: *const c_char, group: crate::gid_t) -> c_int; 2377 2378 pub fn statfs(path: *const c_char, buf: *mut statfs) -> c_int; 2379 pub fn fstatfs(fd: c_int, buf: *mut statfs) -> c_int; 2380 2381 pub fn posix_fadvise(fd: c_int, offset: off_t, len: off_t, advise: c_int) -> c_int; 2382 pub fn posix_fallocate(fd: c_int, offset: off_t, len: off_t) -> c_int; 2383 pub fn fallocate(fd: c_int, mode: c_int, offset: off_t, len: off_t) -> c_int; 2384 2385 pub fn endutxent(); 2386 pub fn getutxent() -> *mut utmpx; 2387 pub fn getutxid(id: *const utmpx) -> *mut utmpx; 2388 pub fn getutxline(line: *const utmpx) -> *mut utmpx; 2389 pub fn pututxline(utmpx: *const utmpx) -> *mut utmpx; 2390 pub fn setutxent(); 2391 pub fn utmpxname(file: *const c_char) -> c_int; 2392 pub fn updwtmpx(file: *const c_char, utmpx: *const utmpx); 2393 }