1 pub type sa_family_t = u16; 2 pub type speed_t = ::c_uint; 3 pub type tcflag_t = ::c_uint; 4 pub type clockid_t = ::c_int; 5 pub type timer_t = *mut ::c_void; 6 pub type key_t = ::c_int; 7 pub type id_t = ::c_uint; 8 9 missing! { 10 #[cfg_attr(feature = "extra_traits", derive(Debug))] 11 pub enum timezone {} 12 } 13 14 s! { 15 pub struct in_addr { 16 pub s_addr: ::in_addr_t, 17 } 18 19 pub struct ip_mreq { 20 pub imr_multiaddr: in_addr, 21 pub imr_interface: in_addr, 22 } 23 24 pub struct ip_mreqn { 25 pub imr_multiaddr: in_addr, 26 pub imr_address: in_addr, 27 pub imr_ifindex: ::c_int, 28 } 29 30 pub struct ip_mreq_source { 31 pub imr_multiaddr: in_addr, 32 pub imr_interface: in_addr, 33 pub imr_sourceaddr: in_addr, 34 } 35 36 pub struct sockaddr { 37 pub sa_family: sa_family_t, 38 pub sa_data: [::c_char; 14], 39 } 40 41 pub struct sockaddr_in { 42 pub sin_family: sa_family_t, 43 pub sin_port: ::in_port_t, 44 pub sin_addr: ::in_addr, 45 pub sin_zero: [u8; 8], 46 } 47 48 pub struct sockaddr_in6 { 49 pub sin6_family: sa_family_t, 50 pub sin6_port: ::in_port_t, 51 pub sin6_flowinfo: u32, 52 pub sin6_addr: ::in6_addr, 53 pub sin6_scope_id: u32, 54 } 55 56 // The order of the `ai_addr` field in this struct is crucial 57 // for converting between the Rust and C types. 58 pub struct addrinfo { 59 pub ai_flags: ::c_int, 60 pub ai_family: ::c_int, 61 pub ai_socktype: ::c_int, 62 pub ai_protocol: ::c_int, 63 pub ai_addrlen: socklen_t, 64 65 #[cfg(any(target_os = "linux", target_os = "emscripten"))] 66 pub ai_addr: *mut ::sockaddr, 67 68 pub ai_canonname: *mut c_char, 69 70 #[cfg(target_os = "android")] 71 pub ai_addr: *mut ::sockaddr, 72 73 pub ai_next: *mut addrinfo, 74 } 75 76 pub struct sockaddr_ll { 77 pub sll_family: ::c_ushort, 78 pub sll_protocol: ::c_ushort, 79 pub sll_ifindex: ::c_int, 80 pub sll_hatype: ::c_ushort, 81 pub sll_pkttype: ::c_uchar, 82 pub sll_halen: ::c_uchar, 83 pub sll_addr: [::c_uchar; 8], 84 } 85 86 pub struct fd_set { 87 fds_bits: [::c_ulong; FD_SETSIZE as usize / ULONG_SIZE], 88 } 89 90 pub struct tm { 91 pub tm_sec: ::c_int, 92 pub tm_min: ::c_int, 93 pub tm_hour: ::c_int, 94 pub tm_mday: ::c_int, 95 pub tm_mon: ::c_int, 96 pub tm_year: ::c_int, 97 pub tm_wday: ::c_int, 98 pub tm_yday: ::c_int, 99 pub tm_isdst: ::c_int, 100 pub tm_gmtoff: ::c_long, 101 pub tm_zone: *const ::c_char, 102 } 103 104 pub struct sched_param { 105 pub sched_priority: ::c_int, 106 #[cfg(any(target_env = "musl", target_os = "emscripten", target_env = "ohos"))] 107 pub sched_ss_low_priority: ::c_int, 108 #[cfg(any(target_env = "musl", target_os = "emscripten", target_env = "ohos"))] 109 pub sched_ss_repl_period: ::timespec, 110 #[cfg(any(target_env = "musl", target_os = "emscripten", target_env = "ohos"))] 111 pub sched_ss_init_budget: ::timespec, 112 #[cfg(any(target_env = "musl", target_os = "emscripten", target_env = "ohos"))] 113 pub sched_ss_max_repl: ::c_int, 114 } 115 116 pub struct Dl_info { 117 pub dli_fname: *const ::c_char, 118 pub dli_fbase: *mut ::c_void, 119 pub dli_sname: *const ::c_char, 120 pub dli_saddr: *mut ::c_void, 121 } 122 123 pub struct lconv { 124 pub decimal_point: *mut ::c_char, 125 pub thousands_sep: *mut ::c_char, 126 pub grouping: *mut ::c_char, 127 pub int_curr_symbol: *mut ::c_char, 128 pub currency_symbol: *mut ::c_char, 129 pub mon_decimal_point: *mut ::c_char, 130 pub mon_thousands_sep: *mut ::c_char, 131 pub mon_grouping: *mut ::c_char, 132 pub positive_sign: *mut ::c_char, 133 pub negative_sign: *mut ::c_char, 134 pub int_frac_digits: ::c_char, 135 pub frac_digits: ::c_char, 136 pub p_cs_precedes: ::c_char, 137 pub p_sep_by_space: ::c_char, 138 pub n_cs_precedes: ::c_char, 139 pub n_sep_by_space: ::c_char, 140 pub p_sign_posn: ::c_char, 141 pub n_sign_posn: ::c_char, 142 pub int_p_cs_precedes: ::c_char, 143 pub int_p_sep_by_space: ::c_char, 144 pub int_n_cs_precedes: ::c_char, 145 pub int_n_sep_by_space: ::c_char, 146 pub int_p_sign_posn: ::c_char, 147 pub int_n_sign_posn: ::c_char, 148 } 149 150 pub struct in_pktinfo { 151 pub ipi_ifindex: ::c_int, 152 pub ipi_spec_dst: ::in_addr, 153 pub ipi_addr: ::in_addr, 154 } 155 156 pub struct ifaddrs { 157 pub ifa_next: *mut ifaddrs, 158 pub ifa_name: *mut c_char, 159 pub ifa_flags: ::c_uint, 160 pub ifa_addr: *mut ::sockaddr, 161 pub ifa_netmask: *mut ::sockaddr, 162 pub ifa_ifu: *mut ::sockaddr, // FIXME This should be a union 163 pub ifa_data: *mut ::c_void, 164 } 165 166 pub struct in6_rtmsg { 167 rtmsg_dst: ::in6_addr, 168 rtmsg_src: ::in6_addr, 169 rtmsg_gateway: ::in6_addr, 170 rtmsg_type: u32, 171 rtmsg_dst_len: u16, 172 rtmsg_src_len: u16, 173 rtmsg_metric: u32, 174 rtmsg_info: ::c_ulong, 175 rtmsg_flags: u32, 176 rtmsg_ifindex: ::c_int, 177 } 178 179 pub struct arpreq { 180 pub arp_pa: ::sockaddr, 181 pub arp_ha: ::sockaddr, 182 pub arp_flags: ::c_int, 183 pub arp_netmask: ::sockaddr, 184 pub arp_dev: [::c_char; 16], 185 } 186 187 pub struct arpreq_old { 188 pub arp_pa: ::sockaddr, 189 pub arp_ha: ::sockaddr, 190 pub arp_flags: ::c_int, 191 pub arp_netmask: ::sockaddr, 192 } 193 194 pub struct arphdr { 195 pub ar_hrd: u16, 196 pub ar_pro: u16, 197 pub ar_hln: u8, 198 pub ar_pln: u8, 199 pub ar_op: u16, 200 } 201 202 pub struct mmsghdr { 203 pub msg_hdr: ::msghdr, 204 pub msg_len: ::c_uint, 205 } 206 } 207 208 s_no_extra_traits! { 209 #[cfg_attr( 210 any( 211 all( 212 target_arch = "x86", 213 not(target_env = "musl"), 214 not(target_os = "android") 215 ), 216 target_arch = "x86_64" 217 ), 218 repr(packed) 219 )] 220 pub struct epoll_event { 221 pub events: u32, 222 pub u64: u64, 223 } 224 225 pub struct sockaddr_un { 226 pub sun_family: sa_family_t, 227 pub sun_path: [::c_char; 108], 228 } 229 230 pub struct sockaddr_storage { 231 pub ss_family: sa_family_t, 232 #[cfg(target_pointer_width = "32")] 233 __ss_pad2: [u8; 128 - 2 - 4], 234 #[cfg(target_pointer_width = "64")] 235 __ss_pad2: [u8; 128 - 2 - 8], 236 __ss_align: ::size_t, 237 } 238 239 pub struct utsname { 240 pub sysname: [::c_char; 65], 241 pub nodename: [::c_char; 65], 242 pub release: [::c_char; 65], 243 pub version: [::c_char; 65], 244 pub machine: [::c_char; 65], 245 pub domainname: [::c_char; 65], 246 } 247 248 pub struct sigevent { 249 pub sigev_value: ::sigval, 250 pub sigev_signo: ::c_int, 251 pub sigev_notify: ::c_int, 252 // Actually a union. We only expose sigev_notify_thread_id because it's 253 // the most useful member 254 pub sigev_notify_thread_id: ::c_int, 255 #[cfg(target_pointer_width = "64")] 256 __unused1: [::c_int; 11], 257 #[cfg(target_pointer_width = "32")] 258 __unused1: [::c_int; 12], 259 } 260 } 261 262 cfg_if! { 263 if #[cfg(feature = "extra_traits")] { 264 impl PartialEq for epoll_event { 265 fn eq(&self, other: &epoll_event) -> bool { 266 self.events == other.events && self.u64 == other.u64 267 } 268 } 269 impl Eq for epoll_event {} 270 impl ::fmt::Debug for epoll_event { 271 fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { 272 let events = self.events; 273 let u64 = self.u64; 274 f.debug_struct("epoll_event") 275 .field("events", &events) 276 .field("u64", &u64) 277 .finish() 278 } 279 } 280 impl ::hash::Hash for epoll_event { 281 fn hash<H: ::hash::Hasher>(&self, state: &mut H) { 282 let events = self.events; 283 let u64 = self.u64; 284 events.hash(state); 285 u64.hash(state); 286 } 287 } 288 289 impl PartialEq for sockaddr_un { 290 fn eq(&self, other: &sockaddr_un) -> bool { 291 self.sun_family == other.sun_family 292 && self 293 .sun_path 294 .iter() 295 .zip(other.sun_path.iter()) 296 .all(|(a, b)| a == b) 297 } 298 } 299 impl Eq for sockaddr_un {} 300 impl ::fmt::Debug for sockaddr_un { 301 fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { 302 f.debug_struct("sockaddr_un") 303 .field("sun_family", &self.sun_family) 304 // FIXME: .field("sun_path", &self.sun_path) 305 .finish() 306 } 307 } 308 impl ::hash::Hash for sockaddr_un { 309 fn hash<H: ::hash::Hasher>(&self, state: &mut H) { 310 self.sun_family.hash(state); 311 self.sun_path.hash(state); 312 } 313 } 314 315 impl PartialEq for sockaddr_storage { 316 fn eq(&self, other: &sockaddr_storage) -> bool { 317 self.ss_family == other.ss_family 318 && self 319 .__ss_pad2 320 .iter() 321 .zip(other.__ss_pad2.iter()) 322 .all(|(a, b)| a == b) 323 } 324 } 325 326 impl Eq for sockaddr_storage {} 327 328 impl ::fmt::Debug for sockaddr_storage { 329 fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { 330 f.debug_struct("sockaddr_storage") 331 .field("ss_family", &self.ss_family) 332 .field("__ss_align", &self.__ss_align) 333 // FIXME: .field("__ss_pad2", &self.__ss_pad2) 334 .finish() 335 } 336 } 337 338 impl ::hash::Hash for sockaddr_storage { 339 fn hash<H: ::hash::Hasher>(&self, state: &mut H) { 340 self.ss_family.hash(state); 341 self.__ss_pad2.hash(state); 342 } 343 } 344 345 impl PartialEq for utsname { 346 fn eq(&self, other: &utsname) -> bool { 347 self.sysname 348 .iter() 349 .zip(other.sysname.iter()) 350 .all(|(a, b)| a == b) 351 && self 352 .nodename 353 .iter() 354 .zip(other.nodename.iter()) 355 .all(|(a, b)| a == b) 356 && self 357 .release 358 .iter() 359 .zip(other.release.iter()) 360 .all(|(a, b)| a == b) 361 && self 362 .version 363 .iter() 364 .zip(other.version.iter()) 365 .all(|(a, b)| a == b) 366 && self 367 .machine 368 .iter() 369 .zip(other.machine.iter()) 370 .all(|(a, b)| a == b) 371 && self 372 .domainname 373 .iter() 374 .zip(other.domainname.iter()) 375 .all(|(a, b)| a == b) 376 } 377 } 378 379 impl Eq for utsname {} 380 381 impl ::fmt::Debug for utsname { 382 fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { 383 f.debug_struct("utsname") 384 // FIXME: .field("sysname", &self.sysname) 385 // FIXME: .field("nodename", &self.nodename) 386 // FIXME: .field("release", &self.release) 387 // FIXME: .field("version", &self.version) 388 // FIXME: .field("machine", &self.machine) 389 // FIXME: .field("domainname", &self.domainname) 390 .finish() 391 } 392 } 393 394 impl ::hash::Hash for utsname { 395 fn hash<H: ::hash::Hasher>(&self, state: &mut H) { 396 self.sysname.hash(state); 397 self.nodename.hash(state); 398 self.release.hash(state); 399 self.version.hash(state); 400 self.machine.hash(state); 401 self.domainname.hash(state); 402 } 403 } 404 405 impl PartialEq for sigevent { 406 fn eq(&self, other: &sigevent) -> bool { 407 self.sigev_value == other.sigev_value 408 && self.sigev_signo == other.sigev_signo 409 && self.sigev_notify == other.sigev_notify 410 && self.sigev_notify_thread_id == other.sigev_notify_thread_id 411 } 412 } 413 impl Eq for sigevent {} 414 impl ::fmt::Debug for sigevent { 415 fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { 416 f.debug_struct("sigevent") 417 .field("sigev_value", &self.sigev_value) 418 .field("sigev_signo", &self.sigev_signo) 419 .field("sigev_notify", &self.sigev_notify) 420 .field("sigev_notify_thread_id", &self.sigev_notify_thread_id) 421 .finish() 422 } 423 } 424 impl ::hash::Hash for sigevent { 425 fn hash<H: ::hash::Hasher>(&self, state: &mut H) { 426 self.sigev_value.hash(state); 427 self.sigev_signo.hash(state); 428 self.sigev_notify.hash(state); 429 self.sigev_notify_thread_id.hash(state); 430 } 431 } 432 } 433 } 434 435 // intentionally not public, only used for fd_set 436 cfg_if! { 437 if #[cfg(target_pointer_width = "32")] { 438 const ULONG_SIZE: usize = 32; 439 } else if #[cfg(target_pointer_width = "64")] { 440 const ULONG_SIZE: usize = 64; 441 } else { 442 // Unknown target_pointer_width 443 } 444 } 445 446 pub const EXIT_FAILURE: ::c_int = 1; 447 pub const EXIT_SUCCESS: ::c_int = 0; 448 pub const RAND_MAX: ::c_int = 2147483647; 449 pub const EOF: ::c_int = -1; 450 pub const SEEK_SET: ::c_int = 0; 451 pub const SEEK_CUR: ::c_int = 1; 452 pub const SEEK_END: ::c_int = 2; 453 pub const _IOFBF: ::c_int = 0; 454 pub const _IONBF: ::c_int = 2; 455 pub const _IOLBF: ::c_int = 1; 456 457 pub const F_DUPFD: ::c_int = 0; 458 pub const F_GETFD: ::c_int = 1; 459 pub const F_SETFD: ::c_int = 2; 460 pub const F_GETFL: ::c_int = 3; 461 pub const F_SETFL: ::c_int = 4; 462 463 // Linux-specific fcntls 464 pub const F_SETLEASE: ::c_int = 1024; 465 pub const F_GETLEASE: ::c_int = 1025; 466 pub const F_NOTIFY: ::c_int = 1026; 467 pub const F_CANCELLK: ::c_int = 1029; 468 pub const F_DUPFD_CLOEXEC: ::c_int = 1030; 469 pub const F_SETPIPE_SZ: ::c_int = 1031; 470 pub const F_GETPIPE_SZ: ::c_int = 1032; 471 pub const F_ADD_SEALS: ::c_int = 1033; 472 pub const F_GET_SEALS: ::c_int = 1034; 473 474 pub const F_SEAL_SEAL: ::c_int = 0x0001; 475 pub const F_SEAL_SHRINK: ::c_int = 0x0002; 476 pub const F_SEAL_GROW: ::c_int = 0x0004; 477 pub const F_SEAL_WRITE: ::c_int = 0x0008; 478 479 // FIXME(#235): Include file sealing fcntls once we have a way to verify them. 480 481 pub const SIGTRAP: ::c_int = 5; 482 483 pub const PTHREAD_CREATE_JOINABLE: ::c_int = 0; 484 pub const PTHREAD_CREATE_DETACHED: ::c_int = 1; 485 486 pub const CLOCK_REALTIME: ::clockid_t = 0; 487 pub const CLOCK_MONOTONIC: ::clockid_t = 1; 488 pub const CLOCK_PROCESS_CPUTIME_ID: ::clockid_t = 2; 489 pub const CLOCK_THREAD_CPUTIME_ID: ::clockid_t = 3; 490 pub const CLOCK_MONOTONIC_RAW: ::clockid_t = 4; 491 pub const CLOCK_REALTIME_COARSE: ::clockid_t = 5; 492 pub const CLOCK_MONOTONIC_COARSE: ::clockid_t = 6; 493 pub const CLOCK_BOOTTIME: ::clockid_t = 7; 494 pub const CLOCK_REALTIME_ALARM: ::clockid_t = 8; 495 pub const CLOCK_BOOTTIME_ALARM: ::clockid_t = 9; 496 pub const CLOCK_TAI: ::clockid_t = 11; 497 pub const TIMER_ABSTIME: ::c_int = 1; 498 499 pub const RUSAGE_SELF: ::c_int = 0; 500 501 pub const O_RDONLY: ::c_int = 0; 502 pub const O_WRONLY: ::c_int = 1; 503 pub const O_RDWR: ::c_int = 2; 504 505 pub const SOCK_CLOEXEC: ::c_int = O_CLOEXEC; 506 507 pub const S_IFIFO: ::mode_t = 0o1_0000; 508 pub const S_IFCHR: ::mode_t = 0o2_0000; 509 pub const S_IFBLK: ::mode_t = 0o6_0000; 510 pub const S_IFDIR: ::mode_t = 0o4_0000; 511 pub const S_IFREG: ::mode_t = 0o10_0000; 512 pub const S_IFLNK: ::mode_t = 0o12_0000; 513 pub const S_IFSOCK: ::mode_t = 0o14_0000; 514 pub const S_IFMT: ::mode_t = 0o17_0000; 515 pub const S_IRWXU: ::mode_t = 0o0700; 516 pub const S_IXUSR: ::mode_t = 0o0100; 517 pub const S_IWUSR: ::mode_t = 0o0200; 518 pub const S_IRUSR: ::mode_t = 0o0400; 519 pub const S_IRWXG: ::mode_t = 0o0070; 520 pub const S_IXGRP: ::mode_t = 0o0010; 521 pub const S_IWGRP: ::mode_t = 0o0020; 522 pub const S_IRGRP: ::mode_t = 0o0040; 523 pub const S_IRWXO: ::mode_t = 0o0007; 524 pub const S_IXOTH: ::mode_t = 0o0001; 525 pub const S_IWOTH: ::mode_t = 0o0002; 526 pub const S_IROTH: ::mode_t = 0o0004; 527 pub const F_OK: ::c_int = 0; 528 pub const R_OK: ::c_int = 4; 529 pub const W_OK: ::c_int = 2; 530 pub const X_OK: ::c_int = 1; 531 pub const STDIN_FILENO: ::c_int = 0; 532 pub const STDOUT_FILENO: ::c_int = 1; 533 pub const STDERR_FILENO: ::c_int = 2; 534 pub const SIGHUP: ::c_int = 1; 535 pub const SIGINT: ::c_int = 2; 536 pub const SIGQUIT: ::c_int = 3; 537 pub const SIGILL: ::c_int = 4; 538 pub const SIGABRT: ::c_int = 6; 539 pub const SIGFPE: ::c_int = 8; 540 pub const SIGKILL: ::c_int = 9; 541 pub const SIGSEGV: ::c_int = 11; 542 pub const SIGPIPE: ::c_int = 13; 543 pub const SIGALRM: ::c_int = 14; 544 pub const SIGTERM: ::c_int = 15; 545 546 pub const PROT_NONE: ::c_int = 0; 547 pub const PROT_READ: ::c_int = 1; 548 pub const PROT_WRITE: ::c_int = 2; 549 pub const PROT_EXEC: ::c_int = 4; 550 551 pub const XATTR_CREATE: ::c_int = 0x1; 552 pub const XATTR_REPLACE: ::c_int = 0x2; 553 554 cfg_if! { 555 if #[cfg(target_os = "android")] { 556 pub const RLIM64_INFINITY: ::c_ulonglong = !0; 557 } else { 558 pub const RLIM64_INFINITY: ::rlim64_t = !0; 559 } 560 } 561 562 cfg_if! { 563 if #[cfg(target_env = "ohos")] { 564 pub const LC_CTYPE: ::c_int = 0; 565 pub const LC_NUMERIC: ::c_int = 1; 566 pub const LC_TIME: ::c_int = 2; 567 pub const LC_COLLATE: ::c_int = 3; 568 pub const LC_MONETARY: ::c_int = 4; 569 pub const LC_MESSAGES: ::c_int = 5; 570 pub const LC_PAPER: ::c_int = 6; 571 pub const LC_NAME: ::c_int = 7; 572 pub const LC_ADDRESS: ::c_int = 8; 573 pub const LC_TELEPHONE: ::c_int = 9; 574 pub const LC_MEASUREMENT: ::c_int = 10; 575 pub const LC_IDENTIFICATION: ::c_int = 11; 576 pub const LC_ALL: ::c_int = 12; 577 } else if #[cfg(not(target_env = "uclibc"))] { 578 pub const LC_CTYPE: ::c_int = 0; 579 pub const LC_NUMERIC: ::c_int = 1; 580 pub const LC_TIME: ::c_int = 2; 581 pub const LC_COLLATE: ::c_int = 3; 582 pub const LC_MONETARY: ::c_int = 4; 583 pub const LC_MESSAGES: ::c_int = 5; 584 pub const LC_ALL: ::c_int = 6; 585 } 586 } 587 588 pub const LC_CTYPE_MASK: ::c_int = 1 << LC_CTYPE; 589 pub const LC_NUMERIC_MASK: ::c_int = 1 << LC_NUMERIC; 590 pub const LC_TIME_MASK: ::c_int = 1 << LC_TIME; 591 pub const LC_COLLATE_MASK: ::c_int = 1 << LC_COLLATE; 592 pub const LC_MONETARY_MASK: ::c_int = 1 << LC_MONETARY; 593 pub const LC_MESSAGES_MASK: ::c_int = 1 << LC_MESSAGES; 594 // LC_ALL_MASK defined per platform 595 596 pub const MAP_FILE: ::c_int = 0x0000; 597 pub const MAP_SHARED: ::c_int = 0x0001; 598 pub const MAP_PRIVATE: ::c_int = 0x0002; 599 pub const MAP_FIXED: ::c_int = 0x0010; 600 601 pub const MAP_FAILED: *mut ::c_void = !0 as *mut ::c_void; 602 603 // MS_ flags for msync(2) 604 pub const MS_ASYNC: ::c_int = 0x0001; 605 pub const MS_INVALIDATE: ::c_int = 0x0002; 606 pub const MS_SYNC: ::c_int = 0x0004; 607 608 // MS_ flags for mount(2) 609 pub const MS_RDONLY: ::c_ulong = 0x01; 610 pub const MS_NOSUID: ::c_ulong = 0x02; 611 pub const MS_NODEV: ::c_ulong = 0x04; 612 pub const MS_NOEXEC: ::c_ulong = 0x08; 613 pub const MS_SYNCHRONOUS: ::c_ulong = 0x10; 614 pub const MS_REMOUNT: ::c_ulong = 0x20; 615 pub const MS_MANDLOCK: ::c_ulong = 0x40; 616 pub const MS_DIRSYNC: ::c_ulong = 0x80; 617 pub const MS_NOATIME: ::c_ulong = 0x0400; 618 pub const MS_NODIRATIME: ::c_ulong = 0x0800; 619 pub const MS_BIND: ::c_ulong = 0x1000; 620 pub const MS_MOVE: ::c_ulong = 0x2000; 621 pub const MS_REC: ::c_ulong = 0x4000; 622 pub const MS_SILENT: ::c_ulong = 0x8000; 623 pub const MS_POSIXACL: ::c_ulong = 0x010000; 624 pub const MS_UNBINDABLE: ::c_ulong = 0x020000; 625 pub const MS_PRIVATE: ::c_ulong = 0x040000; 626 pub const MS_SLAVE: ::c_ulong = 0x080000; 627 pub const MS_SHARED: ::c_ulong = 0x100000; 628 pub const MS_RELATIME: ::c_ulong = 0x200000; 629 pub const MS_KERNMOUNT: ::c_ulong = 0x400000; 630 pub const MS_I_VERSION: ::c_ulong = 0x800000; 631 pub const MS_STRICTATIME: ::c_ulong = 0x1000000; 632 pub const MS_LAZYTIME: ::c_ulong = 0x2000000; 633 pub const MS_ACTIVE: ::c_ulong = 0x40000000; 634 pub const MS_MGC_VAL: ::c_ulong = 0xc0ed0000; 635 pub const MS_MGC_MSK: ::c_ulong = 0xffff0000; 636 637 pub const SCM_RIGHTS: ::c_int = 0x01; 638 pub const SCM_CREDENTIALS: ::c_int = 0x02; 639 640 pub const PROT_GROWSDOWN: ::c_int = 0x1000000; 641 pub const PROT_GROWSUP: ::c_int = 0x2000000; 642 643 pub const MAP_TYPE: ::c_int = 0x000f; 644 645 pub const MADV_NORMAL: ::c_int = 0; 646 pub const MADV_RANDOM: ::c_int = 1; 647 pub const MADV_SEQUENTIAL: ::c_int = 2; 648 pub const MADV_WILLNEED: ::c_int = 3; 649 pub const MADV_DONTNEED: ::c_int = 4; 650 pub const MADV_FREE: ::c_int = 8; 651 pub const MADV_REMOVE: ::c_int = 9; 652 pub const MADV_DONTFORK: ::c_int = 10; 653 pub const MADV_DOFORK: ::c_int = 11; 654 pub const MADV_MERGEABLE: ::c_int = 12; 655 pub const MADV_UNMERGEABLE: ::c_int = 13; 656 pub const MADV_HUGEPAGE: ::c_int = 14; 657 pub const MADV_NOHUGEPAGE: ::c_int = 15; 658 pub const MADV_DONTDUMP: ::c_int = 16; 659 pub const MADV_DODUMP: ::c_int = 17; 660 pub const MADV_WIPEONFORK: ::c_int = 18; 661 pub const MADV_KEEPONFORK: ::c_int = 19; 662 pub const MADV_COLD: ::c_int = 20; 663 pub const MADV_PAGEOUT: ::c_int = 21; 664 pub const MADV_HWPOISON: ::c_int = 100; 665 cfg_if! { 666 if #[cfg(not(target_os = "emscripten"))] { 667 pub const MADV_POPULATE_READ: ::c_int = 22; 668 pub const MADV_POPULATE_WRITE: ::c_int = 23; 669 pub const MADV_DONTNEED_LOCKED: ::c_int = 24; 670 } 671 } 672 673 pub const IFF_UP: ::c_int = 0x1; 674 pub const IFF_BROADCAST: ::c_int = 0x2; 675 pub const IFF_DEBUG: ::c_int = 0x4; 676 pub const IFF_LOOPBACK: ::c_int = 0x8; 677 pub const IFF_POINTOPOINT: ::c_int = 0x10; 678 pub const IFF_NOTRAILERS: ::c_int = 0x20; 679 pub const IFF_RUNNING: ::c_int = 0x40; 680 pub const IFF_NOARP: ::c_int = 0x80; 681 pub const IFF_PROMISC: ::c_int = 0x100; 682 pub const IFF_ALLMULTI: ::c_int = 0x200; 683 pub const IFF_MASTER: ::c_int = 0x400; 684 pub const IFF_SLAVE: ::c_int = 0x800; 685 pub const IFF_MULTICAST: ::c_int = 0x1000; 686 pub const IFF_PORTSEL: ::c_int = 0x2000; 687 pub const IFF_AUTOMEDIA: ::c_int = 0x4000; 688 pub const IFF_DYNAMIC: ::c_int = 0x8000; 689 690 pub const SOL_IP: ::c_int = 0; 691 pub const SOL_TCP: ::c_int = 6; 692 pub const SOL_UDP: ::c_int = 17; 693 pub const SOL_IPV6: ::c_int = 41; 694 pub const SOL_ICMPV6: ::c_int = 58; 695 pub const SOL_RAW: ::c_int = 255; 696 pub const SOL_DECNET: ::c_int = 261; 697 pub const SOL_X25: ::c_int = 262; 698 pub const SOL_PACKET: ::c_int = 263; 699 pub const SOL_ATM: ::c_int = 264; 700 pub const SOL_AAL: ::c_int = 265; 701 pub const SOL_IRDA: ::c_int = 266; 702 pub const SOL_NETBEUI: ::c_int = 267; 703 pub const SOL_LLC: ::c_int = 268; 704 pub const SOL_DCCP: ::c_int = 269; 705 pub const SOL_NETLINK: ::c_int = 270; 706 pub const SOL_TIPC: ::c_int = 271; 707 pub const SOL_BLUETOOTH: ::c_int = 274; 708 pub const SOL_ALG: ::c_int = 279; 709 710 pub const AF_UNSPEC: ::c_int = 0; 711 pub const AF_UNIX: ::c_int = 1; 712 pub const AF_LOCAL: ::c_int = 1; 713 pub const AF_INET: ::c_int = 2; 714 pub const AF_AX25: ::c_int = 3; 715 pub const AF_IPX: ::c_int = 4; 716 pub const AF_APPLETALK: ::c_int = 5; 717 pub const AF_NETROM: ::c_int = 6; 718 pub const AF_BRIDGE: ::c_int = 7; 719 pub const AF_ATMPVC: ::c_int = 8; 720 pub const AF_X25: ::c_int = 9; 721 pub const AF_INET6: ::c_int = 10; 722 pub const AF_ROSE: ::c_int = 11; 723 pub const AF_DECnet: ::c_int = 12; 724 pub const AF_NETBEUI: ::c_int = 13; 725 pub const AF_SECURITY: ::c_int = 14; 726 pub const AF_KEY: ::c_int = 15; 727 pub const AF_NETLINK: ::c_int = 16; 728 pub const AF_ROUTE: ::c_int = AF_NETLINK; 729 pub const AF_PACKET: ::c_int = 17; 730 pub const AF_ASH: ::c_int = 18; 731 pub const AF_ECONET: ::c_int = 19; 732 pub const AF_ATMSVC: ::c_int = 20; 733 pub const AF_RDS: ::c_int = 21; 734 pub const AF_SNA: ::c_int = 22; 735 pub const AF_IRDA: ::c_int = 23; 736 pub const AF_PPPOX: ::c_int = 24; 737 pub const AF_WANPIPE: ::c_int = 25; 738 pub const AF_LLC: ::c_int = 26; 739 pub const AF_CAN: ::c_int = 29; 740 pub const AF_TIPC: ::c_int = 30; 741 pub const AF_BLUETOOTH: ::c_int = 31; 742 pub const AF_IUCV: ::c_int = 32; 743 pub const AF_RXRPC: ::c_int = 33; 744 pub const AF_ISDN: ::c_int = 34; 745 pub const AF_PHONET: ::c_int = 35; 746 pub const AF_IEEE802154: ::c_int = 36; 747 pub const AF_CAIF: ::c_int = 37; 748 pub const AF_ALG: ::c_int = 38; 749 750 pub const PF_UNSPEC: ::c_int = AF_UNSPEC; 751 pub const PF_UNIX: ::c_int = AF_UNIX; 752 pub const PF_LOCAL: ::c_int = AF_LOCAL; 753 pub const PF_INET: ::c_int = AF_INET; 754 pub const PF_AX25: ::c_int = AF_AX25; 755 pub const PF_IPX: ::c_int = AF_IPX; 756 pub const PF_APPLETALK: ::c_int = AF_APPLETALK; 757 pub const PF_NETROM: ::c_int = AF_NETROM; 758 pub const PF_BRIDGE: ::c_int = AF_BRIDGE; 759 pub const PF_ATMPVC: ::c_int = AF_ATMPVC; 760 pub const PF_X25: ::c_int = AF_X25; 761 pub const PF_INET6: ::c_int = AF_INET6; 762 pub const PF_ROSE: ::c_int = AF_ROSE; 763 pub const PF_DECnet: ::c_int = AF_DECnet; 764 pub const PF_NETBEUI: ::c_int = AF_NETBEUI; 765 pub const PF_SECURITY: ::c_int = AF_SECURITY; 766 pub const PF_KEY: ::c_int = AF_KEY; 767 pub const PF_NETLINK: ::c_int = AF_NETLINK; 768 pub const PF_ROUTE: ::c_int = AF_ROUTE; 769 pub const PF_PACKET: ::c_int = AF_PACKET; 770 pub const PF_ASH: ::c_int = AF_ASH; 771 pub const PF_ECONET: ::c_int = AF_ECONET; 772 pub const PF_ATMSVC: ::c_int = AF_ATMSVC; 773 pub const PF_RDS: ::c_int = AF_RDS; 774 pub const PF_SNA: ::c_int = AF_SNA; 775 pub const PF_IRDA: ::c_int = AF_IRDA; 776 pub const PF_PPPOX: ::c_int = AF_PPPOX; 777 pub const PF_WANPIPE: ::c_int = AF_WANPIPE; 778 pub const PF_LLC: ::c_int = AF_LLC; 779 pub const PF_CAN: ::c_int = AF_CAN; 780 pub const PF_TIPC: ::c_int = AF_TIPC; 781 pub const PF_BLUETOOTH: ::c_int = AF_BLUETOOTH; 782 pub const PF_IUCV: ::c_int = AF_IUCV; 783 pub const PF_RXRPC: ::c_int = AF_RXRPC; 784 pub const PF_ISDN: ::c_int = AF_ISDN; 785 pub const PF_PHONET: ::c_int = AF_PHONET; 786 pub const PF_IEEE802154: ::c_int = AF_IEEE802154; 787 pub const PF_CAIF: ::c_int = AF_CAIF; 788 pub const PF_ALG: ::c_int = AF_ALG; 789 790 pub const MSG_OOB: ::c_int = 1; 791 pub const MSG_PEEK: ::c_int = 2; 792 pub const MSG_DONTROUTE: ::c_int = 4; 793 pub const MSG_CTRUNC: ::c_int = 8; 794 pub const MSG_TRUNC: ::c_int = 0x20; 795 pub const MSG_DONTWAIT: ::c_int = 0x40; 796 pub const MSG_EOR: ::c_int = 0x80; 797 pub const MSG_WAITALL: ::c_int = 0x100; 798 pub const MSG_FIN: ::c_int = 0x200; 799 pub const MSG_SYN: ::c_int = 0x400; 800 pub const MSG_CONFIRM: ::c_int = 0x800; 801 pub const MSG_RST: ::c_int = 0x1000; 802 pub const MSG_ERRQUEUE: ::c_int = 0x2000; 803 pub const MSG_NOSIGNAL: ::c_int = 0x4000; 804 pub const MSG_MORE: ::c_int = 0x8000; 805 pub const MSG_WAITFORONE: ::c_int = 0x10000; 806 pub const MSG_FASTOPEN: ::c_int = 0x20000000; 807 pub const MSG_CMSG_CLOEXEC: ::c_int = 0x40000000; 808 809 pub const SCM_TIMESTAMP: ::c_int = SO_TIMESTAMP; 810 811 pub const SOCK_RAW: ::c_int = 3; 812 pub const SOCK_RDM: ::c_int = 4; 813 pub const IP_TOS: ::c_int = 1; 814 pub const IP_TTL: ::c_int = 2; 815 pub const IP_HDRINCL: ::c_int = 3; 816 pub const IP_OPTIONS: ::c_int = 4; 817 pub const IP_ROUTER_ALERT: ::c_int = 5; 818 pub const IP_RECVOPTS: ::c_int = 6; 819 pub const IP_RETOPTS: ::c_int = 7; 820 pub const IP_PKTINFO: ::c_int = 8; 821 pub const IP_PKTOPTIONS: ::c_int = 9; 822 pub const IP_MTU_DISCOVER: ::c_int = 10; 823 pub const IP_RECVERR: ::c_int = 11; 824 pub const IP_RECVTTL: ::c_int = 12; 825 pub const IP_RECVTOS: ::c_int = 13; 826 pub const IP_MTU: ::c_int = 14; 827 pub const IP_FREEBIND: ::c_int = 15; 828 pub const IP_IPSEC_POLICY: ::c_int = 16; 829 pub const IP_XFRM_POLICY: ::c_int = 17; 830 pub const IP_PASSSEC: ::c_int = 18; 831 pub const IP_TRANSPARENT: ::c_int = 19; 832 pub const IP_ORIGDSTADDR: ::c_int = 20; 833 pub const IP_RECVORIGDSTADDR: ::c_int = IP_ORIGDSTADDR; 834 pub const IP_MINTTL: ::c_int = 21; 835 pub const IP_NODEFRAG: ::c_int = 22; 836 pub const IP_CHECKSUM: ::c_int = 23; 837 pub const IP_BIND_ADDRESS_NO_PORT: ::c_int = 24; 838 pub const IP_MULTICAST_IF: ::c_int = 32; 839 pub const IP_MULTICAST_TTL: ::c_int = 33; 840 pub const IP_MULTICAST_LOOP: ::c_int = 34; 841 pub const IP_ADD_MEMBERSHIP: ::c_int = 35; 842 pub const IP_DROP_MEMBERSHIP: ::c_int = 36; 843 pub const IP_UNBLOCK_SOURCE: ::c_int = 37; 844 pub const IP_BLOCK_SOURCE: ::c_int = 38; 845 pub const IP_ADD_SOURCE_MEMBERSHIP: ::c_int = 39; 846 pub const IP_DROP_SOURCE_MEMBERSHIP: ::c_int = 40; 847 pub const IP_MSFILTER: ::c_int = 41; 848 pub const IP_MULTICAST_ALL: ::c_int = 49; 849 pub const IP_UNICAST_IF: ::c_int = 50; 850 851 pub const IP_DEFAULT_MULTICAST_TTL: ::c_int = 1; 852 pub const IP_DEFAULT_MULTICAST_LOOP: ::c_int = 1; 853 854 pub const IP_PMTUDISC_DONT: ::c_int = 0; 855 pub const IP_PMTUDISC_WANT: ::c_int = 1; 856 pub const IP_PMTUDISC_DO: ::c_int = 2; 857 pub const IP_PMTUDISC_PROBE: ::c_int = 3; 858 pub const IP_PMTUDISC_INTERFACE: ::c_int = 4; 859 pub const IP_PMTUDISC_OMIT: ::c_int = 5; 860 861 // IPPROTO_IP defined in src/unix/mod.rs 862 /// Hop-by-hop option header 863 pub const IPPROTO_HOPOPTS: ::c_int = 0; 864 // IPPROTO_ICMP defined in src/unix/mod.rs 865 /// group mgmt protocol 866 pub const IPPROTO_IGMP: ::c_int = 2; 867 /// for compatibility 868 pub const IPPROTO_IPIP: ::c_int = 4; 869 // IPPROTO_TCP defined in src/unix/mod.rs 870 /// exterior gateway protocol 871 pub const IPPROTO_EGP: ::c_int = 8; 872 /// pup 873 pub const IPPROTO_PUP: ::c_int = 12; 874 // IPPROTO_UDP defined in src/unix/mod.rs 875 /// xns idp 876 pub const IPPROTO_IDP: ::c_int = 22; 877 /// tp-4 w/ class negotiation 878 pub const IPPROTO_TP: ::c_int = 29; 879 /// DCCP 880 pub const IPPROTO_DCCP: ::c_int = 33; 881 // IPPROTO_IPV6 defined in src/unix/mod.rs 882 /// IP6 routing header 883 pub const IPPROTO_ROUTING: ::c_int = 43; 884 /// IP6 fragmentation header 885 pub const IPPROTO_FRAGMENT: ::c_int = 44; 886 /// resource reservation 887 pub const IPPROTO_RSVP: ::c_int = 46; 888 /// General Routing Encap. 889 pub const IPPROTO_GRE: ::c_int = 47; 890 /// IP6 Encap Sec. Payload 891 pub const IPPROTO_ESP: ::c_int = 50; 892 /// IP6 Auth Header 893 pub const IPPROTO_AH: ::c_int = 51; 894 // IPPROTO_ICMPV6 defined in src/unix/mod.rs 895 /// IP6 no next header 896 pub const IPPROTO_NONE: ::c_int = 59; 897 /// IP6 destination option 898 pub const IPPROTO_DSTOPTS: ::c_int = 60; 899 pub const IPPROTO_MTP: ::c_int = 92; 900 /// encapsulation header 901 pub const IPPROTO_ENCAP: ::c_int = 98; 902 /// Protocol indep. multicast 903 pub const IPPROTO_PIM: ::c_int = 103; 904 /// IP Payload Comp. Protocol 905 pub const IPPROTO_COMP: ::c_int = 108; 906 /// SCTP 907 pub const IPPROTO_SCTP: ::c_int = 132; 908 pub const IPPROTO_MH: ::c_int = 135; 909 pub const IPPROTO_UDPLITE: ::c_int = 136; 910 /// raw IP packet 911 pub const IPPROTO_RAW: ::c_int = 255; 912 pub const IPPROTO_BEETPH: ::c_int = 94; 913 pub const IPPROTO_MPLS: ::c_int = 137; 914 /// Multipath TCP 915 pub const IPPROTO_MPTCP: ::c_int = 262; 916 /// Ethernet-within-IPv6 encapsulation. 917 pub const IPPROTO_ETHERNET: ::c_int = 143; 918 919 pub const MCAST_EXCLUDE: ::c_int = 0; 920 pub const MCAST_INCLUDE: ::c_int = 1; 921 pub const MCAST_JOIN_GROUP: ::c_int = 42; 922 pub const MCAST_BLOCK_SOURCE: ::c_int = 43; 923 pub const MCAST_UNBLOCK_SOURCE: ::c_int = 44; 924 pub const MCAST_LEAVE_GROUP: ::c_int = 45; 925 pub const MCAST_JOIN_SOURCE_GROUP: ::c_int = 46; 926 pub const MCAST_LEAVE_SOURCE_GROUP: ::c_int = 47; 927 pub const MCAST_MSFILTER: ::c_int = 48; 928 929 pub const IPV6_ADDRFORM: ::c_int = 1; 930 pub const IPV6_2292PKTINFO: ::c_int = 2; 931 pub const IPV6_2292HOPOPTS: ::c_int = 3; 932 pub const IPV6_2292DSTOPTS: ::c_int = 4; 933 pub const IPV6_2292RTHDR: ::c_int = 5; 934 pub const IPV6_2292PKTOPTIONS: ::c_int = 6; 935 pub const IPV6_CHECKSUM: ::c_int = 7; 936 pub const IPV6_2292HOPLIMIT: ::c_int = 8; 937 pub const IPV6_NEXTHOP: ::c_int = 9; 938 pub const IPV6_AUTHHDR: ::c_int = 10; 939 pub const IPV6_UNICAST_HOPS: ::c_int = 16; 940 pub const IPV6_MULTICAST_IF: ::c_int = 17; 941 pub const IPV6_MULTICAST_HOPS: ::c_int = 18; 942 pub const IPV6_MULTICAST_LOOP: ::c_int = 19; 943 pub const IPV6_ADD_MEMBERSHIP: ::c_int = 20; 944 pub const IPV6_DROP_MEMBERSHIP: ::c_int = 21; 945 pub const IPV6_ROUTER_ALERT: ::c_int = 22; 946 pub const IPV6_MTU_DISCOVER: ::c_int = 23; 947 pub const IPV6_MTU: ::c_int = 24; 948 pub const IPV6_RECVERR: ::c_int = 25; 949 pub const IPV6_V6ONLY: ::c_int = 26; 950 pub const IPV6_JOIN_ANYCAST: ::c_int = 27; 951 pub const IPV6_LEAVE_ANYCAST: ::c_int = 28; 952 pub const IPV6_IPSEC_POLICY: ::c_int = 34; 953 pub const IPV6_XFRM_POLICY: ::c_int = 35; 954 pub const IPV6_HDRINCL: ::c_int = 36; 955 pub const IPV6_RECVPKTINFO: ::c_int = 49; 956 pub const IPV6_PKTINFO: ::c_int = 50; 957 pub const IPV6_RECVHOPLIMIT: ::c_int = 51; 958 pub const IPV6_HOPLIMIT: ::c_int = 52; 959 pub const IPV6_RECVHOPOPTS: ::c_int = 53; 960 pub const IPV6_HOPOPTS: ::c_int = 54; 961 pub const IPV6_RTHDRDSTOPTS: ::c_int = 55; 962 pub const IPV6_RECVRTHDR: ::c_int = 56; 963 pub const IPV6_RTHDR: ::c_int = 57; 964 pub const IPV6_RECVDSTOPTS: ::c_int = 58; 965 pub const IPV6_DSTOPTS: ::c_int = 59; 966 pub const IPV6_RECVPATHMTU: ::c_int = 60; 967 pub const IPV6_PATHMTU: ::c_int = 61; 968 pub const IPV6_DONTFRAG: ::c_int = 62; 969 pub const IPV6_RECVTCLASS: ::c_int = 66; 970 pub const IPV6_TCLASS: ::c_int = 67; 971 pub const IPV6_AUTOFLOWLABEL: ::c_int = 70; 972 pub const IPV6_ADDR_PREFERENCES: ::c_int = 72; 973 pub const IPV6_MINHOPCOUNT: ::c_int = 73; 974 pub const IPV6_ORIGDSTADDR: ::c_int = 74; 975 pub const IPV6_RECVORIGDSTADDR: ::c_int = IPV6_ORIGDSTADDR; 976 pub const IPV6_TRANSPARENT: ::c_int = 75; 977 pub const IPV6_UNICAST_IF: ::c_int = 76; 978 pub const IPV6_PREFER_SRC_TMP: ::c_int = 0x0001; 979 pub const IPV6_PREFER_SRC_PUBLIC: ::c_int = 0x0002; 980 pub const IPV6_PREFER_SRC_PUBTMP_DEFAULT: ::c_int = 0x0100; 981 pub const IPV6_PREFER_SRC_COA: ::c_int = 0x0004; 982 pub const IPV6_PREFER_SRC_HOME: ::c_int = 0x0400; 983 pub const IPV6_PREFER_SRC_CGA: ::c_int = 0x0008; 984 pub const IPV6_PREFER_SRC_NONCGA: ::c_int = 0x0800; 985 986 pub const IPV6_PMTUDISC_DONT: ::c_int = 0; 987 pub const IPV6_PMTUDISC_WANT: ::c_int = 1; 988 pub const IPV6_PMTUDISC_DO: ::c_int = 2; 989 pub const IPV6_PMTUDISC_PROBE: ::c_int = 3; 990 pub const IPV6_PMTUDISC_INTERFACE: ::c_int = 4; 991 pub const IPV6_PMTUDISC_OMIT: ::c_int = 5; 992 993 pub const TCP_NODELAY: ::c_int = 1; 994 pub const TCP_MAXSEG: ::c_int = 2; 995 pub const TCP_CORK: ::c_int = 3; 996 pub const TCP_KEEPIDLE: ::c_int = 4; 997 pub const TCP_KEEPINTVL: ::c_int = 5; 998 pub const TCP_KEEPCNT: ::c_int = 6; 999 pub const TCP_SYNCNT: ::c_int = 7; 1000 pub const TCP_LINGER2: ::c_int = 8; 1001 pub const TCP_DEFER_ACCEPT: ::c_int = 9; 1002 pub const TCP_WINDOW_CLAMP: ::c_int = 10; 1003 pub const TCP_INFO: ::c_int = 11; 1004 pub const TCP_QUICKACK: ::c_int = 12; 1005 pub const TCP_CONGESTION: ::c_int = 13; 1006 pub const TCP_MD5SIG: ::c_int = 14; 1007 cfg_if! { 1008 if #[cfg(all( 1009 target_os = "linux", 1010 any(target_env = "gnu", target_env = "musl", target_env = "ohos") 1011 ))] { 1012 // WARN: deprecated 1013 pub const TCP_COOKIE_TRANSACTIONS: ::c_int = 15; 1014 } 1015 } 1016 pub const TCP_THIN_LINEAR_TIMEOUTS: ::c_int = 16; 1017 pub const TCP_THIN_DUPACK: ::c_int = 17; 1018 pub const TCP_USER_TIMEOUT: ::c_int = 18; 1019 pub const TCP_REPAIR: ::c_int = 19; 1020 pub const TCP_REPAIR_QUEUE: ::c_int = 20; 1021 pub const TCP_QUEUE_SEQ: ::c_int = 21; 1022 pub const TCP_REPAIR_OPTIONS: ::c_int = 22; 1023 pub const TCP_FASTOPEN: ::c_int = 23; 1024 pub const TCP_TIMESTAMP: ::c_int = 24; 1025 pub const TCP_NOTSENT_LOWAT: ::c_int = 25; 1026 pub const TCP_CC_INFO: ::c_int = 26; 1027 pub const TCP_SAVE_SYN: ::c_int = 27; 1028 pub const TCP_SAVED_SYN: ::c_int = 28; 1029 cfg_if! { 1030 if #[cfg(not(target_os = "emscripten"))] { 1031 // NOTE: emscripten doesn't support these options yet. 1032 1033 pub const TCP_REPAIR_WINDOW: ::c_int = 29; 1034 pub const TCP_FASTOPEN_CONNECT: ::c_int = 30; 1035 pub const TCP_ULP: ::c_int = 31; 1036 pub const TCP_MD5SIG_EXT: ::c_int = 32; 1037 pub const TCP_FASTOPEN_KEY: ::c_int = 33; 1038 pub const TCP_FASTOPEN_NO_COOKIE: ::c_int = 34; 1039 pub const TCP_ZEROCOPY_RECEIVE: ::c_int = 35; 1040 pub const TCP_INQ: ::c_int = 36; 1041 pub const TCP_CM_INQ: ::c_int = TCP_INQ; 1042 // NOTE: Some CI images doesn't have this option yet. 1043 // pub const TCP_TX_DELAY: ::c_int = 37; 1044 pub const TCP_MD5SIG_MAXKEYLEN: usize = 80; 1045 } 1046 } 1047 1048 pub const SO_DEBUG: ::c_int = 1; 1049 1050 pub const SHUT_RD: ::c_int = 0; 1051 pub const SHUT_WR: ::c_int = 1; 1052 pub const SHUT_RDWR: ::c_int = 2; 1053 1054 pub const LOCK_SH: ::c_int = 1; 1055 pub const LOCK_EX: ::c_int = 2; 1056 pub const LOCK_NB: ::c_int = 4; 1057 pub const LOCK_UN: ::c_int = 8; 1058 1059 pub const SS_ONSTACK: ::c_int = 1; 1060 pub const SS_DISABLE: ::c_int = 2; 1061 1062 pub const PATH_MAX: ::c_int = 4096; 1063 1064 pub const UIO_MAXIOV: ::c_int = 1024; 1065 1066 pub const FD_SETSIZE: usize = 1024; 1067 1068 pub const EPOLLIN: ::c_int = 0x1; 1069 pub const EPOLLPRI: ::c_int = 0x2; 1070 pub const EPOLLOUT: ::c_int = 0x4; 1071 pub const EPOLLERR: ::c_int = 0x8; 1072 pub const EPOLLHUP: ::c_int = 0x10; 1073 pub const EPOLLRDNORM: ::c_int = 0x40; 1074 pub const EPOLLRDBAND: ::c_int = 0x80; 1075 pub const EPOLLWRNORM: ::c_int = 0x100; 1076 pub const EPOLLWRBAND: ::c_int = 0x200; 1077 pub const EPOLLMSG: ::c_int = 0x400; 1078 pub const EPOLLRDHUP: ::c_int = 0x2000; 1079 pub const EPOLLEXCLUSIVE: ::c_int = 0x10000000; 1080 pub const EPOLLWAKEUP: ::c_int = 0x20000000; 1081 pub const EPOLLONESHOT: ::c_int = 0x40000000; 1082 pub const EPOLLET: ::c_int = 0x80000000; 1083 1084 pub const EPOLL_CTL_ADD: ::c_int = 1; 1085 pub const EPOLL_CTL_MOD: ::c_int = 3; 1086 pub const EPOLL_CTL_DEL: ::c_int = 2; 1087 1088 pub const MNT_FORCE: ::c_int = 0x1; 1089 pub const MNT_DETACH: ::c_int = 0x2; 1090 pub const MNT_EXPIRE: ::c_int = 0x4; 1091 pub const UMOUNT_NOFOLLOW: ::c_int = 0x8; 1092 1093 pub const Q_GETFMT: ::c_int = 0x800004; 1094 pub const Q_GETINFO: ::c_int = 0x800005; 1095 pub const Q_SETINFO: ::c_int = 0x800006; 1096 pub const QIF_BLIMITS: u32 = 1; 1097 pub const QIF_SPACE: u32 = 2; 1098 pub const QIF_ILIMITS: u32 = 4; 1099 pub const QIF_INODES: u32 = 8; 1100 pub const QIF_BTIME: u32 = 16; 1101 pub const QIF_ITIME: u32 = 32; 1102 pub const QIF_LIMITS: u32 = 5; 1103 pub const QIF_USAGE: u32 = 10; 1104 pub const QIF_TIMES: u32 = 48; 1105 pub const QIF_ALL: u32 = 63; 1106 1107 pub const Q_SYNC: ::c_int = 0x800001; 1108 pub const Q_QUOTAON: ::c_int = 0x800002; 1109 pub const Q_QUOTAOFF: ::c_int = 0x800003; 1110 pub const Q_GETQUOTA: ::c_int = 0x800007; 1111 pub const Q_SETQUOTA: ::c_int = 0x800008; 1112 1113 pub const TCIOFF: ::c_int = 2; 1114 pub const TCION: ::c_int = 3; 1115 pub const TCOOFF: ::c_int = 0; 1116 pub const TCOON: ::c_int = 1; 1117 pub const TCIFLUSH: ::c_int = 0; 1118 pub const TCOFLUSH: ::c_int = 1; 1119 pub const TCIOFLUSH: ::c_int = 2; 1120 pub const NL0: ::tcflag_t = 0x00000000; 1121 pub const NL1: ::tcflag_t = 0x00000100; 1122 pub const TAB0: ::tcflag_t = 0x00000000; 1123 pub const CR0: ::tcflag_t = 0x00000000; 1124 pub const FF0: ::tcflag_t = 0x00000000; 1125 pub const BS0: ::tcflag_t = 0x00000000; 1126 pub const VT0: ::tcflag_t = 0x00000000; 1127 pub const VERASE: usize = 2; 1128 pub const VKILL: usize = 3; 1129 pub const VINTR: usize = 0; 1130 pub const VQUIT: usize = 1; 1131 pub const VLNEXT: usize = 15; 1132 pub const IGNBRK: ::tcflag_t = 0x00000001; 1133 pub const BRKINT: ::tcflag_t = 0x00000002; 1134 pub const IGNPAR: ::tcflag_t = 0x00000004; 1135 pub const PARMRK: ::tcflag_t = 0x00000008; 1136 pub const INPCK: ::tcflag_t = 0x00000010; 1137 pub const ISTRIP: ::tcflag_t = 0x00000020; 1138 pub const INLCR: ::tcflag_t = 0x00000040; 1139 pub const IGNCR: ::tcflag_t = 0x00000080; 1140 pub const ICRNL: ::tcflag_t = 0x00000100; 1141 pub const IXANY: ::tcflag_t = 0x00000800; 1142 pub const IMAXBEL: ::tcflag_t = 0x00002000; 1143 pub const OPOST: ::tcflag_t = 0x1; 1144 pub const CS5: ::tcflag_t = 0x00000000; 1145 pub const CRTSCTS: ::tcflag_t = 0x80000000; 1146 pub const ECHO: ::tcflag_t = 0x00000008; 1147 pub const OCRNL: ::tcflag_t = 0o000010; 1148 pub const ONOCR: ::tcflag_t = 0o000020; 1149 pub const ONLRET: ::tcflag_t = 0o000040; 1150 pub const OFILL: ::tcflag_t = 0o000100; 1151 pub const OFDEL: ::tcflag_t = 0o000200; 1152 1153 pub const CLONE_VM: ::c_int = 0x100; 1154 pub const CLONE_FS: ::c_int = 0x200; 1155 pub const CLONE_FILES: ::c_int = 0x400; 1156 pub const CLONE_SIGHAND: ::c_int = 0x800; 1157 pub const CLONE_PTRACE: ::c_int = 0x2000; 1158 pub const CLONE_VFORK: ::c_int = 0x4000; 1159 pub const CLONE_PARENT: ::c_int = 0x8000; 1160 pub const CLONE_THREAD: ::c_int = 0x10000; 1161 pub const CLONE_NEWNS: ::c_int = 0x20000; 1162 pub const CLONE_SYSVSEM: ::c_int = 0x40000; 1163 pub const CLONE_SETTLS: ::c_int = 0x80000; 1164 pub const CLONE_PARENT_SETTID: ::c_int = 0x100000; 1165 pub const CLONE_CHILD_CLEARTID: ::c_int = 0x200000; 1166 pub const CLONE_DETACHED: ::c_int = 0x400000; 1167 pub const CLONE_UNTRACED: ::c_int = 0x800000; 1168 pub const CLONE_CHILD_SETTID: ::c_int = 0x01000000; 1169 pub const CLONE_NEWCGROUP: ::c_int = 0x02000000; 1170 pub const CLONE_NEWUTS: ::c_int = 0x04000000; 1171 pub const CLONE_NEWIPC: ::c_int = 0x08000000; 1172 pub const CLONE_NEWUSER: ::c_int = 0x10000000; 1173 pub const CLONE_NEWPID: ::c_int = 0x20000000; 1174 pub const CLONE_NEWNET: ::c_int = 0x40000000; 1175 pub const CLONE_IO: ::c_int = 0x80000000; 1176 1177 pub const WNOHANG: ::c_int = 0x00000001; 1178 pub const WUNTRACED: ::c_int = 0x00000002; 1179 pub const WSTOPPED: ::c_int = WUNTRACED; 1180 pub const WEXITED: ::c_int = 0x00000004; 1181 pub const WCONTINUED: ::c_int = 0x00000008; 1182 pub const WNOWAIT: ::c_int = 0x01000000; 1183 1184 // Options for personality(2). 1185 pub const ADDR_NO_RANDOMIZE: ::c_int = 0x0040000; 1186 pub const MMAP_PAGE_ZERO: ::c_int = 0x0100000; 1187 pub const ADDR_COMPAT_LAYOUT: ::c_int = 0x0200000; 1188 pub const READ_IMPLIES_EXEC: ::c_int = 0x0400000; 1189 pub const ADDR_LIMIT_32BIT: ::c_int = 0x0800000; 1190 pub const SHORT_INODE: ::c_int = 0x1000000; 1191 pub const WHOLE_SECONDS: ::c_int = 0x2000000; 1192 pub const STICKY_TIMEOUTS: ::c_int = 0x4000000; 1193 pub const ADDR_LIMIT_3GB: ::c_int = 0x8000000; 1194 1195 // Options set using PTRACE_SETOPTIONS. 1196 pub const PTRACE_O_TRACESYSGOOD: ::c_int = 0x00000001; 1197 pub const PTRACE_O_TRACEFORK: ::c_int = 0x00000002; 1198 pub const PTRACE_O_TRACEVFORK: ::c_int = 0x00000004; 1199 pub const PTRACE_O_TRACECLONE: ::c_int = 0x00000008; 1200 pub const PTRACE_O_TRACEEXEC: ::c_int = 0x00000010; 1201 pub const PTRACE_O_TRACEVFORKDONE: ::c_int = 0x00000020; 1202 pub const PTRACE_O_TRACEEXIT: ::c_int = 0x00000040; 1203 pub const PTRACE_O_TRACESECCOMP: ::c_int = 0x00000080; 1204 pub const PTRACE_O_SUSPEND_SECCOMP: ::c_int = 0x00200000; 1205 pub const PTRACE_O_EXITKILL: ::c_int = 0x00100000; 1206 pub const PTRACE_O_MASK: ::c_int = 0x003000ff; 1207 1208 // Wait extended result codes for the above trace options. 1209 pub const PTRACE_EVENT_FORK: ::c_int = 1; 1210 pub const PTRACE_EVENT_VFORK: ::c_int = 2; 1211 pub const PTRACE_EVENT_CLONE: ::c_int = 3; 1212 pub const PTRACE_EVENT_EXEC: ::c_int = 4; 1213 pub const PTRACE_EVENT_VFORK_DONE: ::c_int = 5; 1214 pub const PTRACE_EVENT_EXIT: ::c_int = 6; 1215 pub const PTRACE_EVENT_SECCOMP: ::c_int = 7; 1216 1217 pub const __WNOTHREAD: ::c_int = 0x20000000; 1218 pub const __WALL: ::c_int = 0x40000000; 1219 pub const __WCLONE: ::c_int = 0x80000000; 1220 1221 pub const SPLICE_F_MOVE: ::c_uint = 0x01; 1222 pub const SPLICE_F_NONBLOCK: ::c_uint = 0x02; 1223 pub const SPLICE_F_MORE: ::c_uint = 0x04; 1224 pub const SPLICE_F_GIFT: ::c_uint = 0x08; 1225 1226 pub const RTLD_LOCAL: ::c_int = 0; 1227 pub const RTLD_LAZY: ::c_int = 1; 1228 1229 pub const POSIX_FADV_NORMAL: ::c_int = 0; 1230 pub const POSIX_FADV_RANDOM: ::c_int = 1; 1231 pub const POSIX_FADV_SEQUENTIAL: ::c_int = 2; 1232 pub const POSIX_FADV_WILLNEED: ::c_int = 3; 1233 1234 pub const AT_FDCWD: ::c_int = -100; 1235 pub const AT_SYMLINK_NOFOLLOW: ::c_int = 0x100; 1236 pub const AT_REMOVEDIR: ::c_int = 0x200; 1237 pub const AT_SYMLINK_FOLLOW: ::c_int = 0x400; 1238 pub const AT_NO_AUTOMOUNT: ::c_int = 0x800; 1239 pub const AT_EMPTY_PATH: ::c_int = 0x1000; 1240 pub const AT_RECURSIVE: ::c_int = 0x8000; 1241 1242 pub const LOG_CRON: ::c_int = 9 << 3; 1243 pub const LOG_AUTHPRIV: ::c_int = 10 << 3; 1244 pub const LOG_FTP: ::c_int = 11 << 3; 1245 pub const LOG_PERROR: ::c_int = 0x20; 1246 1247 pub const PIPE_BUF: usize = 4096; 1248 1249 pub const SI_LOAD_SHIFT: ::c_uint = 16; 1250 1251 // si_code values for SIGBUS signal 1252 pub const BUS_ADRALN: ::c_int = 1; 1253 pub const BUS_ADRERR: ::c_int = 2; 1254 pub const BUS_OBJERR: ::c_int = 3; 1255 // Linux-specific si_code values for SIGBUS signal 1256 pub const BUS_MCEERR_AR: ::c_int = 4; 1257 pub const BUS_MCEERR_AO: ::c_int = 5; 1258 1259 // si_code values for SIGCHLD signal 1260 pub const CLD_EXITED: ::c_int = 1; 1261 pub const CLD_KILLED: ::c_int = 2; 1262 pub const CLD_DUMPED: ::c_int = 3; 1263 pub const CLD_TRAPPED: ::c_int = 4; 1264 pub const CLD_STOPPED: ::c_int = 5; 1265 pub const CLD_CONTINUED: ::c_int = 6; 1266 1267 pub const SIGEV_SIGNAL: ::c_int = 0; 1268 pub const SIGEV_NONE: ::c_int = 1; 1269 pub const SIGEV_THREAD: ::c_int = 2; 1270 1271 pub const P_ALL: idtype_t = 0; 1272 pub const P_PID: idtype_t = 1; 1273 pub const P_PGID: idtype_t = 2; 1274 cfg_if! { 1275 if #[cfg(not(target_os = "emscripten"))] { 1276 pub const P_PIDFD: idtype_t = 3; 1277 } 1278 } 1279 1280 pub const UTIME_OMIT: c_long = 1073741822; 1281 pub const UTIME_NOW: c_long = 1073741823; 1282 1283 pub const POLLIN: ::c_short = 0x1; 1284 pub const POLLPRI: ::c_short = 0x2; 1285 pub const POLLOUT: ::c_short = 0x4; 1286 pub const POLLERR: ::c_short = 0x8; 1287 pub const POLLHUP: ::c_short = 0x10; 1288 pub const POLLNVAL: ::c_short = 0x20; 1289 pub const POLLRDNORM: ::c_short = 0x040; 1290 pub const POLLRDBAND: ::c_short = 0x080; 1291 #[cfg(not(any(target_arch = "sparc", target_arch = "sparc64")))] 1292 pub const POLLRDHUP: ::c_short = 0x2000; 1293 #[cfg(any(target_arch = "sparc", target_arch = "sparc64"))] 1294 pub const POLLRDHUP: ::c_short = 0x800; 1295 1296 pub const IPTOS_LOWDELAY: u8 = 0x10; 1297 pub const IPTOS_THROUGHPUT: u8 = 0x08; 1298 pub const IPTOS_RELIABILITY: u8 = 0x04; 1299 pub const IPTOS_MINCOST: u8 = 0x02; 1300 1301 pub const IPTOS_PREC_NETCONTROL: u8 = 0xe0; 1302 pub const IPTOS_PREC_INTERNETCONTROL: u8 = 0xc0; 1303 pub const IPTOS_PREC_CRITIC_ECP: u8 = 0xa0; 1304 pub const IPTOS_PREC_FLASHOVERRIDE: u8 = 0x80; 1305 pub const IPTOS_PREC_FLASH: u8 = 0x60; 1306 pub const IPTOS_PREC_IMMEDIATE: u8 = 0x40; 1307 pub const IPTOS_PREC_PRIORITY: u8 = 0x20; 1308 pub const IPTOS_PREC_ROUTINE: u8 = 0x00; 1309 1310 pub const IPTOS_ECN_MASK: u8 = 0x03; 1311 pub const IPTOS_ECN_ECT1: u8 = 0x01; 1312 pub const IPTOS_ECN_ECT0: u8 = 0x02; 1313 pub const IPTOS_ECN_CE: u8 = 0x03; 1314 1315 pub const IPOPT_COPY: u8 = 0x80; 1316 pub const IPOPT_CLASS_MASK: u8 = 0x60; 1317 pub const IPOPT_NUMBER_MASK: u8 = 0x1f; 1318 1319 pub const IPOPT_CONTROL: u8 = 0x00; 1320 pub const IPOPT_RESERVED1: u8 = 0x20; 1321 pub const IPOPT_MEASUREMENT: u8 = 0x40; 1322 pub const IPOPT_RESERVED2: u8 = 0x60; 1323 pub const IPOPT_END: u8 = 0 | IPOPT_CONTROL; 1324 pub const IPOPT_NOOP: u8 = 1 | IPOPT_CONTROL; 1325 pub const IPOPT_SEC: u8 = 2 | IPOPT_CONTROL | IPOPT_COPY; 1326 pub const IPOPT_LSRR: u8 = 3 | IPOPT_CONTROL | IPOPT_COPY; 1327 pub const IPOPT_TIMESTAMP: u8 = 4 | IPOPT_MEASUREMENT; 1328 pub const IPOPT_RR: u8 = 7 | IPOPT_CONTROL; 1329 pub const IPOPT_SID: u8 = 8 | IPOPT_CONTROL | IPOPT_COPY; 1330 pub const IPOPT_SSRR: u8 = 9 | IPOPT_CONTROL | IPOPT_COPY; 1331 pub const IPOPT_RA: u8 = 20 | IPOPT_CONTROL | IPOPT_COPY; 1332 pub const IPVERSION: u8 = 4; 1333 pub const MAXTTL: u8 = 255; 1334 pub const IPDEFTTL: u8 = 64; 1335 pub const IPOPT_OPTVAL: u8 = 0; 1336 pub const IPOPT_OLEN: u8 = 1; 1337 pub const IPOPT_OFFSET: u8 = 2; 1338 pub const IPOPT_MINOFF: u8 = 4; 1339 pub const MAX_IPOPTLEN: u8 = 40; 1340 pub const IPOPT_NOP: u8 = IPOPT_NOOP; 1341 pub const IPOPT_EOL: u8 = IPOPT_END; 1342 pub const IPOPT_TS: u8 = IPOPT_TIMESTAMP; 1343 pub const IPOPT_TS_TSONLY: u8 = 0; 1344 pub const IPOPT_TS_TSANDADDR: u8 = 1; 1345 pub const IPOPT_TS_PRESPEC: u8 = 3; 1346 1347 pub const ARPOP_RREQUEST: u16 = 3; 1348 pub const ARPOP_RREPLY: u16 = 4; 1349 pub const ARPOP_InREQUEST: u16 = 8; 1350 pub const ARPOP_InREPLY: u16 = 9; 1351 pub const ARPOP_NAK: u16 = 10; 1352 1353 pub const ATF_NETMASK: ::c_int = 0x20; 1354 pub const ATF_DONTPUB: ::c_int = 0x40; 1355 1356 pub const ARPHRD_NETROM: u16 = 0; 1357 pub const ARPHRD_ETHER: u16 = 1; 1358 pub const ARPHRD_EETHER: u16 = 2; 1359 pub const ARPHRD_AX25: u16 = 3; 1360 pub const ARPHRD_PRONET: u16 = 4; 1361 pub const ARPHRD_CHAOS: u16 = 5; 1362 pub const ARPHRD_IEEE802: u16 = 6; 1363 pub const ARPHRD_ARCNET: u16 = 7; 1364 pub const ARPHRD_APPLETLK: u16 = 8; 1365 pub const ARPHRD_DLCI: u16 = 15; 1366 pub const ARPHRD_ATM: u16 = 19; 1367 pub const ARPHRD_METRICOM: u16 = 23; 1368 pub const ARPHRD_IEEE1394: u16 = 24; 1369 pub const ARPHRD_EUI64: u16 = 27; 1370 pub const ARPHRD_INFINIBAND: u16 = 32; 1371 1372 pub const ARPHRD_SLIP: u16 = 256; 1373 pub const ARPHRD_CSLIP: u16 = 257; 1374 pub const ARPHRD_SLIP6: u16 = 258; 1375 pub const ARPHRD_CSLIP6: u16 = 259; 1376 pub const ARPHRD_RSRVD: u16 = 260; 1377 pub const ARPHRD_ADAPT: u16 = 264; 1378 pub const ARPHRD_ROSE: u16 = 270; 1379 pub const ARPHRD_X25: u16 = 271; 1380 pub const ARPHRD_HWX25: u16 = 272; 1381 pub const ARPHRD_CAN: u16 = 280; 1382 pub const ARPHRD_PPP: u16 = 512; 1383 pub const ARPHRD_CISCO: u16 = 513; 1384 pub const ARPHRD_HDLC: u16 = ARPHRD_CISCO; 1385 pub const ARPHRD_LAPB: u16 = 516; 1386 pub const ARPHRD_DDCMP: u16 = 517; 1387 pub const ARPHRD_RAWHDLC: u16 = 518; 1388 1389 pub const ARPHRD_TUNNEL: u16 = 768; 1390 pub const ARPHRD_TUNNEL6: u16 = 769; 1391 pub const ARPHRD_FRAD: u16 = 770; 1392 pub const ARPHRD_SKIP: u16 = 771; 1393 pub const ARPHRD_LOOPBACK: u16 = 772; 1394 pub const ARPHRD_LOCALTLK: u16 = 773; 1395 pub const ARPHRD_FDDI: u16 = 774; 1396 pub const ARPHRD_BIF: u16 = 775; 1397 pub const ARPHRD_SIT: u16 = 776; 1398 pub const ARPHRD_IPDDP: u16 = 777; 1399 pub const ARPHRD_IPGRE: u16 = 778; 1400 pub const ARPHRD_PIMREG: u16 = 779; 1401 pub const ARPHRD_HIPPI: u16 = 780; 1402 pub const ARPHRD_ASH: u16 = 781; 1403 pub const ARPHRD_ECONET: u16 = 782; 1404 pub const ARPHRD_IRDA: u16 = 783; 1405 pub const ARPHRD_FCPP: u16 = 784; 1406 pub const ARPHRD_FCAL: u16 = 785; 1407 pub const ARPHRD_FCPL: u16 = 786; 1408 pub const ARPHRD_FCFABRIC: u16 = 787; 1409 pub const ARPHRD_IEEE802_TR: u16 = 800; 1410 pub const ARPHRD_IEEE80211: u16 = 801; 1411 pub const ARPHRD_IEEE80211_PRISM: u16 = 802; 1412 pub const ARPHRD_IEEE80211_RADIOTAP: u16 = 803; 1413 pub const ARPHRD_IEEE802154: u16 = 804; 1414 1415 pub const ARPHRD_VOID: u16 = 0xFFFF; 1416 pub const ARPHRD_NONE: u16 = 0xFFFE; 1417 1418 cfg_if! { 1419 if #[cfg(target_os = "emscripten")] { 1420 // Emscripten does not define any `*_SUPER_MAGIC` constants. 1421 } else if #[cfg(not(target_arch = "s390x"))] { 1422 pub const ADFS_SUPER_MAGIC: ::c_long = 0x0000adf5; 1423 pub const AFFS_SUPER_MAGIC: ::c_long = 0x0000adff; 1424 pub const AFS_SUPER_MAGIC: ::c_long = 0x5346414f; 1425 pub const AUTOFS_SUPER_MAGIC: ::c_long = 0x0187; 1426 pub const BPF_FS_MAGIC: ::c_long = 0xcafe4a11; 1427 pub const BTRFS_SUPER_MAGIC: ::c_long = 0x9123683e; 1428 pub const CGROUP2_SUPER_MAGIC: ::c_long = 0x63677270; 1429 pub const CGROUP_SUPER_MAGIC: ::c_long = 0x27e0eb; 1430 pub const CODA_SUPER_MAGIC: ::c_long = 0x73757245; 1431 pub const CRAMFS_MAGIC: ::c_long = 0x28cd3d45; 1432 pub const DEBUGFS_MAGIC: ::c_long = 0x64626720; 1433 pub const DEVPTS_SUPER_MAGIC: ::c_long = 0x1cd1; 1434 pub const ECRYPTFS_SUPER_MAGIC: ::c_long = 0xf15f; 1435 pub const EFS_SUPER_MAGIC: ::c_long = 0x00414a53; 1436 pub const EXT2_SUPER_MAGIC: ::c_long = 0x0000ef53; 1437 pub const EXT3_SUPER_MAGIC: ::c_long = 0x0000ef53; 1438 pub const EXT4_SUPER_MAGIC: ::c_long = 0x0000ef53; 1439 pub const F2FS_SUPER_MAGIC: ::c_long = 0xf2f52010; 1440 pub const FUSE_SUPER_MAGIC: ::c_long = 0x65735546; 1441 pub const FUTEXFS_SUPER_MAGIC: ::c_long = 0xbad1dea; 1442 pub const HOSTFS_SUPER_MAGIC: ::c_long = 0x00c0ffee; 1443 pub const HPFS_SUPER_MAGIC: ::c_long = 0xf995e849; 1444 pub const HUGETLBFS_MAGIC: ::c_long = 0x958458f6; 1445 pub const ISOFS_SUPER_MAGIC: ::c_long = 0x00009660; 1446 pub const JFFS2_SUPER_MAGIC: ::c_long = 0x000072b6; 1447 pub const MINIX2_SUPER_MAGIC2: ::c_long = 0x00002478; 1448 pub const MINIX2_SUPER_MAGIC: ::c_long = 0x00002468; 1449 pub const MINIX3_SUPER_MAGIC: ::c_long = 0x4d5a; 1450 pub const MINIX_SUPER_MAGIC2: ::c_long = 0x0000138f; 1451 pub const MINIX_SUPER_MAGIC: ::c_long = 0x0000137f; 1452 pub const MSDOS_SUPER_MAGIC: ::c_long = 0x00004d44; 1453 pub const NCP_SUPER_MAGIC: ::c_long = 0x0000564c; 1454 pub const NFS_SUPER_MAGIC: ::c_long = 0x00006969; 1455 pub const NILFS_SUPER_MAGIC: ::c_long = 0x3434; 1456 pub const OCFS2_SUPER_MAGIC: ::c_long = 0x7461636f; 1457 pub const OPENPROM_SUPER_MAGIC: ::c_long = 0x00009fa1; 1458 pub const OVERLAYFS_SUPER_MAGIC: ::c_long = 0x794c7630; 1459 pub const PROC_SUPER_MAGIC: ::c_long = 0x00009fa0; 1460 pub const QNX4_SUPER_MAGIC: ::c_long = 0x0000002f; 1461 pub const QNX6_SUPER_MAGIC: ::c_long = 0x68191122; 1462 pub const RDTGROUP_SUPER_MAGIC: ::c_long = 0x7655821; 1463 pub const REISERFS_SUPER_MAGIC: ::c_long = 0x52654973; 1464 pub const SECURITYFS_MAGIC: ::c_long = 0x73636673; 1465 pub const SELINUX_MAGIC: ::c_long = 0xf97cff8c; 1466 pub const SMACK_MAGIC: ::c_long = 0x43415d53; 1467 pub const SMB_SUPER_MAGIC: ::c_long = 0x0000517b; 1468 pub const SYSFS_MAGIC: ::c_long = 0x62656572; 1469 pub const TMPFS_MAGIC: ::c_long = 0x01021994; 1470 pub const TRACEFS_MAGIC: ::c_long = 0x74726163; 1471 pub const UDF_SUPER_MAGIC: ::c_long = 0x15013346; 1472 pub const USBDEVICE_SUPER_MAGIC: ::c_long = 0x00009fa2; 1473 pub const XENFS_SUPER_MAGIC: ::c_long = 0xabba1974; 1474 pub const NSFS_MAGIC: ::c_long = 0x6e736673; 1475 } else if #[cfg(target_arch = "s390x")] { 1476 pub const ADFS_SUPER_MAGIC: ::c_uint = 0x0000adf5; 1477 pub const AFFS_SUPER_MAGIC: ::c_uint = 0x0000adff; 1478 pub const AFS_SUPER_MAGIC: ::c_uint = 0x5346414f; 1479 pub const AUTOFS_SUPER_MAGIC: ::c_uint = 0x0187; 1480 pub const BPF_FS_MAGIC: ::c_uint = 0xcafe4a11; 1481 pub const BTRFS_SUPER_MAGIC: ::c_uint = 0x9123683e; 1482 pub const CGROUP2_SUPER_MAGIC: ::c_uint = 0x63677270; 1483 pub const CGROUP_SUPER_MAGIC: ::c_uint = 0x27e0eb; 1484 pub const CODA_SUPER_MAGIC: ::c_uint = 0x73757245; 1485 pub const CRAMFS_MAGIC: ::c_uint = 0x28cd3d45; 1486 pub const DEBUGFS_MAGIC: ::c_uint = 0x64626720; 1487 pub const DEVPTS_SUPER_MAGIC: ::c_uint = 0x1cd1; 1488 pub const ECRYPTFS_SUPER_MAGIC: ::c_uint = 0xf15f; 1489 pub const EFS_SUPER_MAGIC: ::c_uint = 0x00414a53; 1490 pub const EXT2_SUPER_MAGIC: ::c_uint = 0x0000ef53; 1491 pub const EXT3_SUPER_MAGIC: ::c_uint = 0x0000ef53; 1492 pub const EXT4_SUPER_MAGIC: ::c_uint = 0x0000ef53; 1493 pub const F2FS_SUPER_MAGIC: ::c_uint = 0xf2f52010; 1494 pub const FUSE_SUPER_MAGIC: ::c_uint = 0x65735546; 1495 pub const FUTEXFS_SUPER_MAGIC: ::c_uint = 0xbad1dea; 1496 pub const HOSTFS_SUPER_MAGIC: ::c_uint = 0x00c0ffee; 1497 pub const HPFS_SUPER_MAGIC: ::c_uint = 0xf995e849; 1498 pub const HUGETLBFS_MAGIC: ::c_uint = 0x958458f6; 1499 pub const ISOFS_SUPER_MAGIC: ::c_uint = 0x00009660; 1500 pub const JFFS2_SUPER_MAGIC: ::c_uint = 0x000072b6; 1501 pub const MINIX2_SUPER_MAGIC2: ::c_uint = 0x00002478; 1502 pub const MINIX2_SUPER_MAGIC: ::c_uint = 0x00002468; 1503 pub const MINIX3_SUPER_MAGIC: ::c_uint = 0x4d5a; 1504 pub const MINIX_SUPER_MAGIC2: ::c_uint = 0x0000138f; 1505 pub const MINIX_SUPER_MAGIC: ::c_uint = 0x0000137f; 1506 pub const MSDOS_SUPER_MAGIC: ::c_uint = 0x00004d44; 1507 pub const NCP_SUPER_MAGIC: ::c_uint = 0x0000564c; 1508 pub const NFS_SUPER_MAGIC: ::c_uint = 0x00006969; 1509 pub const NILFS_SUPER_MAGIC: ::c_uint = 0x3434; 1510 pub const OCFS2_SUPER_MAGIC: ::c_uint = 0x7461636f; 1511 pub const OPENPROM_SUPER_MAGIC: ::c_uint = 0x00009fa1; 1512 pub const OVERLAYFS_SUPER_MAGIC: ::c_uint = 0x794c7630; 1513 pub const PROC_SUPER_MAGIC: ::c_uint = 0x00009fa0; 1514 pub const QNX4_SUPER_MAGIC: ::c_uint = 0x0000002f; 1515 pub const QNX6_SUPER_MAGIC: ::c_uint = 0x68191122; 1516 pub const RDTGROUP_SUPER_MAGIC: ::c_uint = 0x7655821; 1517 pub const REISERFS_SUPER_MAGIC: ::c_uint = 0x52654973; 1518 pub const SECURITYFS_MAGIC: ::c_uint = 0x73636673; 1519 pub const SELINUX_MAGIC: ::c_uint = 0xf97cff8c; 1520 pub const SMACK_MAGIC: ::c_uint = 0x43415d53; 1521 pub const SMB_SUPER_MAGIC: ::c_uint = 0x0000517b; 1522 pub const SYSFS_MAGIC: ::c_uint = 0x62656572; 1523 pub const TMPFS_MAGIC: ::c_uint = 0x01021994; 1524 pub const TRACEFS_MAGIC: ::c_uint = 0x74726163; 1525 pub const UDF_SUPER_MAGIC: ::c_uint = 0x15013346; 1526 pub const USBDEVICE_SUPER_MAGIC: ::c_uint = 0x00009fa2; 1527 pub const XENFS_SUPER_MAGIC: ::c_uint = 0xabba1974; 1528 pub const NSFS_MAGIC: ::c_uint = 0x6e736673; 1529 } 1530 } 1531 1532 const_fn! { 1533 {const} fn CMSG_ALIGN(len: usize) -> usize { 1534 len + ::mem::size_of::<usize>() - 1 & !(::mem::size_of::<usize>() - 1) 1535 } 1536 } 1537 1538 f! { 1539 pub fn CMSG_FIRSTHDR(mhdr: *const msghdr) -> *mut cmsghdr { 1540 if (*mhdr).msg_controllen as usize >= ::mem::size_of::<cmsghdr>() { 1541 (*mhdr).msg_control as *mut cmsghdr 1542 } else { 1543 0 as *mut cmsghdr 1544 } 1545 } 1546 1547 pub fn CMSG_DATA(cmsg: *const cmsghdr) -> *mut ::c_uchar { 1548 cmsg.offset(1) as *mut ::c_uchar 1549 } 1550 1551 pub {const} fn CMSG_SPACE(length: ::c_uint) -> ::c_uint { 1552 (CMSG_ALIGN(length as usize) + CMSG_ALIGN(::mem::size_of::<cmsghdr>())) as ::c_uint 1553 } 1554 1555 pub {const} fn CMSG_LEN(length: ::c_uint) -> ::c_uint { 1556 CMSG_ALIGN(::mem::size_of::<cmsghdr>()) as ::c_uint + length 1557 } 1558 1559 pub fn FD_CLR(fd: ::c_int, set: *mut fd_set) -> () { 1560 let fd = fd as usize; 1561 let size = ::mem::size_of_val(&(*set).fds_bits[0]) * 8; 1562 (*set).fds_bits[fd / size] &= !(1 << (fd % size)); 1563 return; 1564 } 1565 1566 pub fn FD_ISSET(fd: ::c_int, set: *const fd_set) -> bool { 1567 let fd = fd as usize; 1568 let size = ::mem::size_of_val(&(*set).fds_bits[0]) * 8; 1569 return ((*set).fds_bits[fd / size] & (1 << (fd % size))) != 0; 1570 } 1571 1572 pub fn FD_SET(fd: ::c_int, set: *mut fd_set) -> () { 1573 let fd = fd as usize; 1574 let size = ::mem::size_of_val(&(*set).fds_bits[0]) * 8; 1575 (*set).fds_bits[fd / size] |= 1 << (fd % size); 1576 return; 1577 } 1578 1579 pub fn FD_ZERO(set: *mut fd_set) -> () { 1580 for slot in (*set).fds_bits.iter_mut() { 1581 *slot = 0; 1582 } 1583 } 1584 } 1585 1586 safe_f! { 1587 pub fn SIGRTMAX() -> ::c_int { 1588 unsafe { __libc_current_sigrtmax() } 1589 } 1590 1591 pub fn SIGRTMIN() -> ::c_int { 1592 unsafe { __libc_current_sigrtmin() } 1593 } 1594 1595 pub {const} fn WIFSTOPPED(status: ::c_int) -> bool { 1596 (status & 0xff) == 0x7f 1597 } 1598 1599 pub {const} fn WSTOPSIG(status: ::c_int) -> ::c_int { 1600 (status >> 8) & 0xff 1601 } 1602 1603 pub {const} fn WIFCONTINUED(status: ::c_int) -> bool { 1604 status == 0xffff 1605 } 1606 1607 pub {const} fn WIFSIGNALED(status: ::c_int) -> bool { 1608 ((status & 0x7f) + 1) as i8 >= 2 1609 } 1610 1611 pub {const} fn WTERMSIG(status: ::c_int) -> ::c_int { 1612 status & 0x7f 1613 } 1614 1615 pub {const} fn WIFEXITED(status: ::c_int) -> bool { 1616 (status & 0x7f) == 0 1617 } 1618 1619 pub {const} fn WEXITSTATUS(status: ::c_int) -> ::c_int { 1620 (status >> 8) & 0xff 1621 } 1622 1623 pub {const} fn WCOREDUMP(status: ::c_int) -> bool { 1624 (status & 0x80) != 0 1625 } 1626 1627 pub {const} fn W_EXITCODE(ret: ::c_int, sig: ::c_int) -> ::c_int { 1628 (ret << 8) | sig 1629 } 1630 1631 pub {const} fn W_STOPCODE(sig: ::c_int) -> ::c_int { 1632 (sig << 8) | 0x7f 1633 } 1634 1635 pub {const} fn QCMD(cmd: ::c_int, type_: ::c_int) -> ::c_int { 1636 (cmd << 8) | (type_ & 0x00ff) 1637 } 1638 1639 pub {const} fn IPOPT_COPIED(o: u8) -> u8 { 1640 o & IPOPT_COPY 1641 } 1642 1643 pub {const} fn IPOPT_CLASS(o: u8) -> u8 { 1644 o & IPOPT_CLASS_MASK 1645 } 1646 1647 pub {const} fn IPOPT_NUMBER(o: u8) -> u8 { 1648 o & IPOPT_NUMBER_MASK 1649 } 1650 1651 pub {const} fn IPTOS_ECN(x: u8) -> u8 { 1652 x & ::IPTOS_ECN_MASK 1653 } 1654 1655 #[allow(ellipsis_inclusive_range_patterns)] 1656 pub {const} fn KERNEL_VERSION(a: u32, b: u32, c: u32) -> u32 { 1657 ((a << 16) + (b << 8)) 1658 + match c { 1659 0...255 => c, 1660 _ => 255, 1661 } 1662 } 1663 } 1664 1665 extern "C" { 1666 #[doc(hidden)] 1667 pub fn __libc_current_sigrtmax() -> ::c_int; 1668 #[doc(hidden)] 1669 pub fn __libc_current_sigrtmin() -> ::c_int; 1670 1671 pub fn sem_destroy(sem: *mut sem_t) -> ::c_int; 1672 pub fn sem_init(sem: *mut sem_t, pshared: ::c_int, value: ::c_uint) -> ::c_int; 1673 pub fn fdatasync(fd: ::c_int) -> ::c_int; 1674 pub fn mincore(addr: *mut ::c_void, len: ::size_t, vec: *mut ::c_uchar) -> ::c_int; 1675 1676 pub fn clock_getres(clk_id: ::clockid_t, tp: *mut ::timespec) -> ::c_int; 1677 pub fn clock_gettime(clk_id: ::clockid_t, tp: *mut ::timespec) -> ::c_int; 1678 pub fn clock_settime(clk_id: ::clockid_t, tp: *const ::timespec) -> ::c_int; 1679 pub fn clock_getcpuclockid(pid: ::pid_t, clk_id: *mut ::clockid_t) -> ::c_int; 1680 1681 pub fn dirfd(dirp: *mut ::DIR) -> ::c_int; 1682 1683 pub fn pthread_getattr_np(native: ::pthread_t, attr: *mut ::pthread_attr_t) -> ::c_int; 1684 pub fn pthread_attr_getstack( 1685 attr: *const ::pthread_attr_t, 1686 stackaddr: *mut *mut ::c_void, 1687 stacksize: *mut ::size_t, 1688 ) -> ::c_int; 1689 pub fn memalign(align: ::size_t, size: ::size_t) -> *mut ::c_void; 1690 pub fn setgroups(ngroups: ::size_t, ptr: *const ::gid_t) -> ::c_int; 1691 pub fn pipe2(fds: *mut ::c_int, flags: ::c_int) -> ::c_int; 1692 pub fn statfs(path: *const ::c_char, buf: *mut statfs) -> ::c_int; 1693 pub fn fstatfs(fd: ::c_int, buf: *mut statfs) -> ::c_int; 1694 pub fn memrchr(cx: *const ::c_void, c: ::c_int, n: ::size_t) -> *mut ::c_void; 1695 pub fn posix_fadvise(fd: ::c_int, offset: ::off_t, len: ::off_t, advise: ::c_int) -> ::c_int; 1696 pub fn futimens(fd: ::c_int, times: *const ::timespec) -> ::c_int; 1697 pub fn utimensat( 1698 dirfd: ::c_int, 1699 path: *const ::c_char, 1700 times: *const ::timespec, 1701 flag: ::c_int, 1702 ) -> ::c_int; 1703 pub fn duplocale(base: ::locale_t) -> ::locale_t; 1704 pub fn freelocale(loc: ::locale_t); 1705 pub fn newlocale(mask: ::c_int, locale: *const ::c_char, base: ::locale_t) -> ::locale_t; 1706 pub fn uselocale(loc: ::locale_t) -> ::locale_t; 1707 pub fn mknodat( 1708 dirfd: ::c_int, 1709 pathname: *const ::c_char, 1710 mode: ::mode_t, 1711 dev: dev_t, 1712 ) -> ::c_int; 1713 pub fn pthread_condattr_getclock( 1714 attr: *const pthread_condattr_t, 1715 clock_id: *mut clockid_t, 1716 ) -> ::c_int; 1717 pub fn pthread_condattr_setclock( 1718 attr: *mut pthread_condattr_t, 1719 clock_id: ::clockid_t, 1720 ) -> ::c_int; 1721 pub fn pthread_condattr_setpshared(attr: *mut pthread_condattr_t, pshared: ::c_int) -> ::c_int; 1722 pub fn pthread_mutexattr_setpshared( 1723 attr: *mut pthread_mutexattr_t, 1724 pshared: ::c_int, 1725 ) -> ::c_int; 1726 pub fn pthread_rwlockattr_getpshared( 1727 attr: *const pthread_rwlockattr_t, 1728 val: *mut ::c_int, 1729 ) -> ::c_int; 1730 pub fn pthread_rwlockattr_setpshared(attr: *mut pthread_rwlockattr_t, val: ::c_int) -> ::c_int; 1731 pub fn ptsname_r(fd: ::c_int, buf: *mut ::c_char, buflen: ::size_t) -> ::c_int; 1732 pub fn clearenv() -> ::c_int; 1733 pub fn waitid(idtype: idtype_t, id: id_t, infop: *mut ::siginfo_t, options: ::c_int) 1734 -> ::c_int; 1735 pub fn getresuid(ruid: *mut ::uid_t, euid: *mut ::uid_t, suid: *mut ::uid_t) -> ::c_int; 1736 pub fn getresgid(rgid: *mut ::gid_t, egid: *mut ::gid_t, sgid: *mut ::gid_t) -> ::c_int; 1737 pub fn acct(filename: *const ::c_char) -> ::c_int; 1738 pub fn brk(addr: *mut ::c_void) -> ::c_int; 1739 pub fn sbrk(increment: ::intptr_t) -> *mut ::c_void; 1740 #[deprecated( 1741 since = "0.2.66", 1742 note = "causes memory corruption, see rust-lang/libc#1596" 1743 )] 1744 pub fn vfork() -> ::pid_t; 1745 pub fn setresgid(rgid: ::gid_t, egid: ::gid_t, sgid: ::gid_t) -> ::c_int; 1746 pub fn setresuid(ruid: ::uid_t, euid: ::uid_t, suid: ::uid_t) -> ::c_int; 1747 pub fn wait4( 1748 pid: ::pid_t, 1749 status: *mut ::c_int, 1750 options: ::c_int, 1751 rusage: *mut ::rusage, 1752 ) -> ::pid_t; 1753 pub fn login_tty(fd: ::c_int) -> ::c_int; 1754 1755 // DIFF(main): changed to `*const *mut` in e77f551de9 1756 pub fn execvpe( 1757 file: *const ::c_char, 1758 argv: *const *const ::c_char, 1759 envp: *const *const ::c_char, 1760 ) -> ::c_int; 1761 pub fn fexecve( 1762 fd: ::c_int, 1763 argv: *const *const ::c_char, 1764 envp: *const *const ::c_char, 1765 ) -> ::c_int; 1766 1767 pub fn getifaddrs(ifap: *mut *mut ::ifaddrs) -> ::c_int; 1768 pub fn freeifaddrs(ifa: *mut ::ifaddrs); 1769 pub fn bind(socket: ::c_int, address: *const ::sockaddr, address_len: ::socklen_t) -> ::c_int; 1770 1771 pub fn writev(fd: ::c_int, iov: *const ::iovec, iovcnt: ::c_int) -> ::ssize_t; 1772 pub fn readv(fd: ::c_int, iov: *const ::iovec, iovcnt: ::c_int) -> ::ssize_t; 1773 1774 pub fn sendmsg(fd: ::c_int, msg: *const ::msghdr, flags: ::c_int) -> ::ssize_t; 1775 pub fn recvmsg(fd: ::c_int, msg: *mut ::msghdr, flags: ::c_int) -> ::ssize_t; 1776 pub fn uname(buf: *mut ::utsname) -> ::c_int; 1777 1778 pub fn strchrnul(s: *const ::c_char, c: ::c_int) -> *mut ::c_char; 1779 1780 pub fn strftime( 1781 s: *mut ::c_char, 1782 max: ::size_t, 1783 format: *const ::c_char, 1784 tm: *const ::tm, 1785 ) -> ::size_t; 1786 pub fn strftime_l( 1787 s: *mut ::c_char, 1788 max: ::size_t, 1789 format: *const ::c_char, 1790 tm: *const ::tm, 1791 locale: ::locale_t, 1792 ) -> ::size_t; 1793 pub fn strptime(s: *const ::c_char, format: *const ::c_char, tm: *mut ::tm) -> *mut ::c_char; 1794 1795 pub fn mkostemp(template: *mut ::c_char, flags: ::c_int) -> ::c_int; 1796 pub fn mkostemps(template: *mut ::c_char, suffixlen: ::c_int, flags: ::c_int) -> ::c_int; 1797 } 1798 1799 // LFS64 extensions 1800 // 1801 // * musl and Emscripten has 64-bit versions only so aliases the LFS64 symbols to the standard ones 1802 // * ulibc doesn't have preadv64/pwritev64 1803 cfg_if! { 1804 if #[cfg(not(any(target_env = "musl", target_os = "emscripten")))] { 1805 extern "C" { 1806 pub fn fstatfs64(fd: ::c_int, buf: *mut statfs64) -> ::c_int; 1807 pub fn statvfs64(path: *const ::c_char, buf: *mut statvfs64) -> ::c_int; 1808 pub fn fstatvfs64(fd: ::c_int, buf: *mut statvfs64) -> ::c_int; 1809 pub fn statfs64(path: *const ::c_char, buf: *mut statfs64) -> ::c_int; 1810 pub fn creat64(path: *const c_char, mode: mode_t) -> ::c_int; 1811 pub fn fstat64(fildes: ::c_int, buf: *mut stat64) -> ::c_int; 1812 pub fn fstatat64( 1813 dirfd: ::c_int, 1814 pathname: *const c_char, 1815 buf: *mut stat64, 1816 flags: ::c_int, 1817 ) -> ::c_int; 1818 pub fn ftruncate64(fd: ::c_int, length: off64_t) -> ::c_int; 1819 pub fn lseek64(fd: ::c_int, offset: off64_t, whence: ::c_int) -> off64_t; 1820 pub fn lstat64(path: *const c_char, buf: *mut stat64) -> ::c_int; 1821 pub fn mmap64( 1822 addr: *mut ::c_void, 1823 len: ::size_t, 1824 prot: ::c_int, 1825 flags: ::c_int, 1826 fd: ::c_int, 1827 offset: off64_t, 1828 ) -> *mut ::c_void; 1829 pub fn open64(path: *const c_char, oflag: ::c_int, ...) -> ::c_int; 1830 pub fn openat64(fd: ::c_int, path: *const c_char, oflag: ::c_int, ...) -> ::c_int; 1831 pub fn posix_fadvise64( 1832 fd: ::c_int, 1833 offset: ::off64_t, 1834 len: ::off64_t, 1835 advise: ::c_int, 1836 ) -> ::c_int; 1837 pub fn pread64( 1838 fd: ::c_int, 1839 buf: *mut ::c_void, 1840 count: ::size_t, 1841 offset: off64_t, 1842 ) -> ::ssize_t; 1843 pub fn pwrite64( 1844 fd: ::c_int, 1845 buf: *const ::c_void, 1846 count: ::size_t, 1847 offset: off64_t, 1848 ) -> ::ssize_t; 1849 pub fn readdir64(dirp: *mut ::DIR) -> *mut ::dirent64; 1850 pub fn readdir64_r( 1851 dirp: *mut ::DIR, 1852 entry: *mut ::dirent64, 1853 result: *mut *mut ::dirent64, 1854 ) -> ::c_int; 1855 pub fn stat64(path: *const c_char, buf: *mut stat64) -> ::c_int; 1856 pub fn truncate64(path: *const c_char, length: off64_t) -> ::c_int; 1857 } 1858 } 1859 } 1860 1861 cfg_if! { 1862 if #[cfg(not(any( 1863 target_env = "uclibc", 1864 target_env = "musl", 1865 target_os = "emscripten" 1866 )))] { 1867 extern "C" { 1868 pub fn preadv64( 1869 fd: ::c_int, 1870 iov: *const ::iovec, 1871 iovcnt: ::c_int, 1872 offset: ::off64_t, 1873 ) -> ::ssize_t; 1874 pub fn pwritev64( 1875 fd: ::c_int, 1876 iov: *const ::iovec, 1877 iovcnt: ::c_int, 1878 offset: ::off64_t, 1879 ) -> ::ssize_t; 1880 } 1881 } 1882 } 1883 1884 cfg_if! { 1885 if #[cfg(not(target_env = "uclibc"))] { 1886 extern "C" { 1887 // uclibc has separate non-const version of this function 1888 pub fn forkpty( 1889 amaster: *mut ::c_int, 1890 name: *mut ::c_char, 1891 termp: *const termios, 1892 winp: *const ::winsize, 1893 ) -> ::pid_t; 1894 // uclibc has separate non-const version of this function 1895 pub fn openpty( 1896 amaster: *mut ::c_int, 1897 aslave: *mut ::c_int, 1898 name: *mut ::c_char, 1899 termp: *const termios, 1900 winp: *const ::winsize, 1901 ) -> ::c_int; 1902 } 1903 } 1904 } 1905 1906 cfg_if! { 1907 if #[cfg(target_os = "emscripten")] { 1908 mod emscripten; 1909 pub use self::emscripten::*; 1910 } else if #[cfg(target_os = "linux")] { 1911 mod linux; 1912 pub use self::linux::*; 1913 } else if #[cfg(target_os = "l4re")] { 1914 mod linux; 1915 pub use self::linux::*; 1916 } else if #[cfg(target_os = "android")] { 1917 mod android; 1918 pub use self::android::*; 1919 } else { 1920 // Unknown target_os 1921 } 1922 } 1923