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 key_t = ::c_int; 6 pub type id_t = ::c_uint; 7 8 #[cfg_attr(feature = "extra_traits", derive(Debug))] 9 pub enum timezone {} 10 impl ::Copy for timezone {} 11 impl ::Clone for timezone { 12 fn clone(&self) -> timezone { 13 *self 14 } 15 } 16 17 s! { 18 pub struct in_addr { 19 pub s_addr: ::in_addr_t, 20 } 21 22 pub struct ip_mreq { 23 pub imr_multiaddr: in_addr, 24 pub imr_interface: in_addr, 25 } 26 27 pub struct ip_mreq_source { 28 pub imr_multiaddr: in_addr, 29 pub imr_interface: in_addr, 30 pub imr_sourceaddr: in_addr, 31 } 32 33 pub struct sockaddr { 34 pub sa_family: sa_family_t, 35 pub sa_data: [::c_char; 14], 36 } 37 38 pub struct sockaddr_in { 39 pub sin_family: sa_family_t, 40 pub sin_port: ::in_port_t, 41 pub sin_addr: ::in_addr, 42 pub sin_zero: [u8; 8], 43 } 44 45 pub struct sockaddr_in6 { 46 pub sin6_family: sa_family_t, 47 pub sin6_port: ::in_port_t, 48 pub sin6_flowinfo: u32, 49 pub sin6_addr: ::in6_addr, 50 pub sin6_scope_id: u32, 51 } 52 53 pub struct addrinfo { 54 pub ai_flags: ::c_int, 55 pub ai_family: ::c_int, 56 pub ai_socktype: ::c_int, 57 pub ai_protocol: ::c_int, 58 pub ai_addrlen: socklen_t, 59 60 #[cfg(any(target_os = "linux", 61 target_os = "emscripten"))] 62 pub ai_addr: *mut ::sockaddr, 63 64 pub ai_canonname: *mut c_char, 65 66 #[cfg(target_os = "android")] 67 pub ai_addr: *mut ::sockaddr, 68 69 pub ai_next: *mut addrinfo, 70 } 71 72 pub struct sockaddr_ll { 73 pub sll_family: ::c_ushort, 74 pub sll_protocol: ::c_ushort, 75 pub sll_ifindex: ::c_int, 76 pub sll_hatype: ::c_ushort, 77 pub sll_pkttype: ::c_uchar, 78 pub sll_halen: ::c_uchar, 79 pub sll_addr: [::c_uchar; 8] 80 } 81 82 pub struct fd_set { 83 fds_bits: [::c_ulong; FD_SETSIZE / ULONG_SIZE], 84 } 85 86 pub struct tm { 87 pub tm_sec: ::c_int, 88 pub tm_min: ::c_int, 89 pub tm_hour: ::c_int, 90 pub tm_mday: ::c_int, 91 pub tm_mon: ::c_int, 92 pub tm_year: ::c_int, 93 pub tm_wday: ::c_int, 94 pub tm_yday: ::c_int, 95 pub tm_isdst: ::c_int, 96 pub tm_gmtoff: ::c_long, 97 pub tm_zone: *const ::c_char, 98 } 99 100 pub struct sched_param { 101 pub sched_priority: ::c_int, 102 #[cfg(any(target_env = "musl", target_os = "emscripten"))] 103 pub sched_ss_low_priority: ::c_int, 104 #[cfg(any(target_env = "musl", target_os = "emscripten"))] 105 pub sched_ss_repl_period: ::timespec, 106 #[cfg(any(target_env = "musl", target_os = "emscripten"))] 107 pub sched_ss_init_budget: ::timespec, 108 #[cfg(any(target_env = "musl", target_os = "emscripten"))] 109 pub sched_ss_max_repl: ::c_int, 110 } 111 112 pub struct Dl_info { 113 pub dli_fname: *const ::c_char, 114 pub dli_fbase: *mut ::c_void, 115 pub dli_sname: *const ::c_char, 116 pub dli_saddr: *mut ::c_void, 117 } 118 119 pub struct lconv { 120 pub decimal_point: *mut ::c_char, 121 pub thousands_sep: *mut ::c_char, 122 pub grouping: *mut ::c_char, 123 pub int_curr_symbol: *mut ::c_char, 124 pub currency_symbol: *mut ::c_char, 125 pub mon_decimal_point: *mut ::c_char, 126 pub mon_thousands_sep: *mut ::c_char, 127 pub mon_grouping: *mut ::c_char, 128 pub positive_sign: *mut ::c_char, 129 pub negative_sign: *mut ::c_char, 130 pub int_frac_digits: ::c_char, 131 pub frac_digits: ::c_char, 132 pub p_cs_precedes: ::c_char, 133 pub p_sep_by_space: ::c_char, 134 pub n_cs_precedes: ::c_char, 135 pub n_sep_by_space: ::c_char, 136 pub p_sign_posn: ::c_char, 137 pub n_sign_posn: ::c_char, 138 pub int_p_cs_precedes: ::c_char, 139 pub int_p_sep_by_space: ::c_char, 140 pub int_n_cs_precedes: ::c_char, 141 pub int_n_sep_by_space: ::c_char, 142 pub int_p_sign_posn: ::c_char, 143 pub int_n_sign_posn: ::c_char, 144 } 145 146 pub struct in_pktinfo { 147 pub ipi_ifindex: ::c_int, 148 pub ipi_spec_dst: ::in_addr, 149 pub ipi_addr: ::in_addr, 150 } 151 152 pub struct ifaddrs { 153 pub ifa_next: *mut ifaddrs, 154 pub ifa_name: *mut c_char, 155 pub ifa_flags: ::c_uint, 156 pub ifa_addr: *mut ::sockaddr, 157 pub ifa_netmask: *mut ::sockaddr, 158 pub ifa_ifu: *mut ::sockaddr, // FIXME This should be a union 159 pub ifa_data: *mut ::c_void 160 } 161 162 pub struct in6_rtmsg { 163 rtmsg_dst: ::in6_addr, 164 rtmsg_src: ::in6_addr, 165 rtmsg_gateway: ::in6_addr, 166 rtmsg_type: u32, 167 rtmsg_dst_len: u16, 168 rtmsg_src_len: u16, 169 rtmsg_metric: u32, 170 rtmsg_info: ::c_ulong, 171 rtmsg_flags: u32, 172 rtmsg_ifindex: ::c_int, 173 } 174 175 pub struct arpreq { 176 pub arp_pa: ::sockaddr, 177 pub arp_ha: ::sockaddr, 178 pub arp_flags: ::c_int, 179 pub arp_netmask: ::sockaddr, 180 pub arp_dev: [::c_char; 16], 181 } 182 183 pub struct arpreq_old { 184 pub arp_pa: ::sockaddr, 185 pub arp_ha: ::sockaddr, 186 pub arp_flags: ::c_int, 187 pub arp_netmask: ::sockaddr, 188 } 189 190 pub struct arphdr { 191 pub ar_hrd: u16, 192 pub ar_pro: u16, 193 pub ar_hln: u8, 194 pub ar_pln: u8, 195 pub ar_op: u16, 196 } 197 198 pub struct mmsghdr { 199 pub msg_hdr: ::msghdr, 200 pub msg_len: ::c_uint, 201 } 202 203 pub struct sock_extended_err { 204 pub ee_errno: u32, 205 pub ee_origin: u8, 206 pub ee_type: u8, 207 pub ee_code: u8, 208 pub ee_pad: u8, 209 pub ee_info: u32, 210 pub ee_data: u32 211 } 212 } 213 214 s_no_extra_traits! { 215 #[cfg_attr( 216 any( 217 all( 218 target_arch = "x86", 219 not(target_env = "musl"), 220 not(target_os = "android")), 221 target_arch = "x86_64"), 222 repr(packed))] 223 pub struct epoll_event { 224 pub events: u32, 225 pub u64: u64, 226 } 227 228 pub struct sockaddr_un { 229 pub sun_family: sa_family_t, 230 pub sun_path: [::c_char; 108] 231 } 232 233 pub struct sockaddr_storage { 234 pub ss_family: sa_family_t, 235 __ss_align: ::size_t, 236 #[cfg(target_pointer_width = "32")] 237 __ss_pad2: [u8; 128 - 2 * 4], 238 #[cfg(target_pointer_width = "64")] 239 __ss_pad2: [u8; 128 - 2 * 8], 240 } 241 242 pub struct utsname { 243 pub sysname: [::c_char; 65], 244 pub nodename: [::c_char; 65], 245 pub release: [::c_char; 65], 246 pub version: [::c_char; 65], 247 pub machine: [::c_char; 65], 248 pub domainname: [::c_char; 65] 249 } 250 251 pub struct sigevent { 252 pub sigev_value: ::sigval, 253 pub sigev_signo: ::c_int, 254 pub sigev_notify: ::c_int, 255 // Actually a union. We only expose sigev_notify_thread_id because it's 256 // the most useful member 257 pub sigev_notify_thread_id: ::c_int, 258 #[cfg(target_pointer_width = "64")] 259 __unused1: [::c_int; 11], 260 #[cfg(target_pointer_width = "32")] 261 __unused1: [::c_int; 12] 262 } 263 } 264 265 cfg_if! { 266 if #[cfg(feature = "extra_traits")] { 267 impl PartialEq for epoll_event { 268 fn eq(&self, other: &epoll_event) -> bool { 269 self.events == other.events 270 && self.u64 == other.u64 271 } 272 } 273 impl Eq for epoll_event {} 274 impl ::fmt::Debug for epoll_event { 275 fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { 276 let events = self.events; 277 let u64 = self.u64; 278 f.debug_struct("epoll_event") 279 .field("events", &events) 280 .field("u64", &u64) 281 .finish() 282 } 283 } 284 impl ::hash::Hash for epoll_event { 285 fn hash<H: ::hash::Hasher>(&self, state: &mut H) { 286 let events = self.events; 287 let u64 = self.u64; 288 events.hash(state); 289 u64.hash(state); 290 } 291 } 292 293 impl PartialEq for sockaddr_un { 294 fn eq(&self, other: &sockaddr_un) -> bool { 295 self.sun_family == other.sun_family 296 && self 297 .sun_path 298 .iter() 299 .zip(other.sun_path.iter()) 300 .all(|(a, b)| a == b) 301 } 302 } 303 impl Eq for sockaddr_un {} 304 impl ::fmt::Debug for sockaddr_un { 305 fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { 306 f.debug_struct("sockaddr_un") 307 .field("sun_family", &self.sun_family) 308 // FIXME: .field("sun_path", &self.sun_path) 309 .finish() 310 } 311 } 312 impl ::hash::Hash for sockaddr_un { 313 fn hash<H: ::hash::Hasher>(&self, state: &mut H) { 314 self.sun_family.hash(state); 315 self.sun_path.hash(state); 316 } 317 } 318 319 impl PartialEq for sockaddr_storage { 320 fn eq(&self, other: &sockaddr_storage) -> bool { 321 self.ss_family == other.ss_family 322 && self 323 .__ss_pad2 324 .iter() 325 .zip(other.__ss_pad2.iter()) 326 .all(|(a, b)| a == b) 327 } 328 } 329 330 impl Eq for sockaddr_storage {} 331 332 impl ::fmt::Debug for sockaddr_storage { 333 fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { 334 f.debug_struct("sockaddr_storage") 335 .field("ss_family", &self.ss_family) 336 .field("__ss_align", &self.__ss_align) 337 // FIXME: .field("__ss_pad2", &self.__ss_pad2) 338 .finish() 339 } 340 } 341 342 impl ::hash::Hash for sockaddr_storage { 343 fn hash<H: ::hash::Hasher>(&self, state: &mut H) { 344 self.ss_family.hash(state); 345 self.__ss_pad2.hash(state); 346 } 347 } 348 349 impl PartialEq for utsname { 350 fn eq(&self, other: &utsname) -> bool { 351 self.sysname 352 .iter() 353 .zip(other.sysname.iter()) 354 .all(|(a, b)| a == b) 355 && self 356 .nodename 357 .iter() 358 .zip(other.nodename.iter()) 359 .all(|(a, b)| a == b) 360 && self 361 .release 362 .iter() 363 .zip(other.release.iter()) 364 .all(|(a, b)| a == b) 365 && self 366 .version 367 .iter() 368 .zip(other.version.iter()) 369 .all(|(a, b)| a == b) 370 && self 371 .machine 372 .iter() 373 .zip(other.machine.iter()) 374 .all(|(a, b)| a == b) 375 && self 376 .domainname 377 .iter() 378 .zip(other.domainname.iter()) 379 .all(|(a, b)| a == b) 380 } 381 } 382 383 impl Eq for utsname {} 384 385 impl ::fmt::Debug for utsname { 386 fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { 387 f.debug_struct("utsname") 388 // FIXME: .field("sysname", &self.sysname) 389 // FIXME: .field("nodename", &self.nodename) 390 // FIXME: .field("release", &self.release) 391 // FIXME: .field("version", &self.version) 392 // FIXME: .field("machine", &self.machine) 393 // FIXME: .field("domainname", &self.domainname) 394 .finish() 395 } 396 } 397 398 impl ::hash::Hash for utsname { 399 fn hash<H: ::hash::Hasher>(&self, state: &mut H) { 400 self.sysname.hash(state); 401 self.nodename.hash(state); 402 self.release.hash(state); 403 self.version.hash(state); 404 self.machine.hash(state); 405 self.domainname.hash(state); 406 } 407 } 408 409 impl PartialEq for sigevent { 410 fn eq(&self, other: &sigevent) -> bool { 411 self.sigev_value == other.sigev_value 412 && self.sigev_signo == other.sigev_signo 413 && self.sigev_notify == other.sigev_notify 414 && self.sigev_notify_thread_id 415 == other.sigev_notify_thread_id 416 } 417 } 418 impl Eq for sigevent {} 419 impl ::fmt::Debug for sigevent { 420 fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { 421 f.debug_struct("sigevent") 422 .field("sigev_value", &self.sigev_value) 423 .field("sigev_signo", &self.sigev_signo) 424 .field("sigev_notify", &self.sigev_notify) 425 .field("sigev_notify_thread_id", 426 &self.sigev_notify_thread_id) 427 .finish() 428 } 429 } 430 impl ::hash::Hash for sigevent { 431 fn hash<H: ::hash::Hasher>(&self, state: &mut H) { 432 self.sigev_value.hash(state); 433 self.sigev_signo.hash(state); 434 self.sigev_notify.hash(state); 435 self.sigev_notify_thread_id.hash(state); 436 } 437 } 438 } 439 } 440 441 // intentionally not public, only used for fd_set 442 cfg_if! { 443 if #[cfg(target_pointer_width = "32")] { 444 const ULONG_SIZE: usize = 32; 445 } else if #[cfg(target_pointer_width = "64")] { 446 const ULONG_SIZE: usize = 64; 447 } else { 448 // Unknown target_pointer_width 449 } 450 } 451 452 pub const EXIT_FAILURE: ::c_int = 1; 453 pub const EXIT_SUCCESS: ::c_int = 0; 454 pub const RAND_MAX: ::c_int = 2147483647; 455 pub const EOF: ::c_int = -1; 456 pub const SEEK_SET: ::c_int = 0; 457 pub const SEEK_CUR: ::c_int = 1; 458 pub const SEEK_END: ::c_int = 2; 459 pub const _IOFBF: ::c_int = 0; 460 pub const _IONBF: ::c_int = 2; 461 pub const _IOLBF: ::c_int = 1; 462 463 pub const F_DUPFD: ::c_int = 0; 464 pub const F_GETFD: ::c_int = 1; 465 pub const F_SETFD: ::c_int = 2; 466 pub const F_GETFL: ::c_int = 3; 467 pub const F_SETFL: ::c_int = 4; 468 469 // Linux-specific fcntls 470 pub const F_SETLEASE: ::c_int = 1024; 471 pub const F_GETLEASE: ::c_int = 1025; 472 pub const F_NOTIFY: ::c_int = 1026; 473 pub const F_CANCELLK: ::c_int = 1029; 474 pub const F_DUPFD_CLOEXEC: ::c_int = 1030; 475 pub const F_SETPIPE_SZ: ::c_int = 1031; 476 pub const F_GETPIPE_SZ: ::c_int = 1032; 477 pub const F_ADD_SEALS: ::c_int = 1033; 478 pub const F_GET_SEALS: ::c_int = 1034; 479 480 pub const F_SEAL_SEAL: ::c_int = 0x0001; 481 pub const F_SEAL_SHRINK: ::c_int = 0x0002; 482 pub const F_SEAL_GROW: ::c_int = 0x0004; 483 pub const F_SEAL_WRITE: ::c_int = 0x0008; 484 485 // TODO(#235): Include file sealing fcntls once we have a way to verify them. 486 487 pub const SIGTRAP: ::c_int = 5; 488 489 pub const PTHREAD_CREATE_JOINABLE: ::c_int = 0; 490 pub const PTHREAD_CREATE_DETACHED: ::c_int = 1; 491 492 pub const CLOCK_REALTIME: ::clockid_t = 0; 493 pub const CLOCK_MONOTONIC: ::clockid_t = 1; 494 pub const CLOCK_PROCESS_CPUTIME_ID: ::clockid_t = 2; 495 pub const CLOCK_THREAD_CPUTIME_ID: ::clockid_t = 3; 496 pub const CLOCK_MONOTONIC_RAW: ::clockid_t = 4; 497 pub const CLOCK_REALTIME_COARSE: ::clockid_t = 5; 498 pub const CLOCK_MONOTONIC_COARSE: ::clockid_t = 6; 499 pub const CLOCK_BOOTTIME: ::clockid_t = 7; 500 pub const CLOCK_REALTIME_ALARM: ::clockid_t = 8; 501 pub const CLOCK_BOOTTIME_ALARM: ::clockid_t = 9; 502 // TODO(#247) Someday our Travis shall have glibc 2.21 (released in Sep 503 // 2014.) See also musl/mod.rs 504 // pub const CLOCK_SGI_CYCLE: ::clockid_t = 10; 505 // pub const CLOCK_TAI: ::clockid_t = 11; 506 pub const TIMER_ABSTIME: ::c_int = 1; 507 508 pub const RUSAGE_SELF: ::c_int = 0; 509 510 pub const O_RDONLY: ::c_int = 0; 511 pub const O_WRONLY: ::c_int = 1; 512 pub const O_RDWR: ::c_int = 2; 513 514 pub const SOCK_CLOEXEC: ::c_int = O_CLOEXEC; 515 516 pub const S_IFIFO: ::mode_t = 4096; 517 pub const S_IFCHR: ::mode_t = 8192; 518 pub const S_IFBLK: ::mode_t = 24576; 519 pub const S_IFDIR: ::mode_t = 16384; 520 pub const S_IFREG: ::mode_t = 32768; 521 pub const S_IFLNK: ::mode_t = 40960; 522 pub const S_IFSOCK: ::mode_t = 49152; 523 pub const S_IFMT: ::mode_t = 61440; 524 pub const S_IRWXU: ::mode_t = 448; 525 pub const S_IXUSR: ::mode_t = 64; 526 pub const S_IWUSR: ::mode_t = 128; 527 pub const S_IRUSR: ::mode_t = 256; 528 pub const S_IRWXG: ::mode_t = 56; 529 pub const S_IXGRP: ::mode_t = 8; 530 pub const S_IWGRP: ::mode_t = 16; 531 pub const S_IRGRP: ::mode_t = 32; 532 pub const S_IRWXO: ::mode_t = 7; 533 pub const S_IXOTH: ::mode_t = 1; 534 pub const S_IWOTH: ::mode_t = 2; 535 pub const S_IROTH: ::mode_t = 4; 536 pub const F_OK: ::c_int = 0; 537 pub const R_OK: ::c_int = 4; 538 pub const W_OK: ::c_int = 2; 539 pub const X_OK: ::c_int = 1; 540 pub const STDIN_FILENO: ::c_int = 0; 541 pub const STDOUT_FILENO: ::c_int = 1; 542 pub const STDERR_FILENO: ::c_int = 2; 543 pub const SIGHUP: ::c_int = 1; 544 pub const SIGINT: ::c_int = 2; 545 pub const SIGQUIT: ::c_int = 3; 546 pub const SIGILL: ::c_int = 4; 547 pub const SIGABRT: ::c_int = 6; 548 pub const SIGFPE: ::c_int = 8; 549 pub const SIGKILL: ::c_int = 9; 550 pub const SIGSEGV: ::c_int = 11; 551 pub const SIGPIPE: ::c_int = 13; 552 pub const SIGALRM: ::c_int = 14; 553 pub const SIGTERM: ::c_int = 15; 554 555 pub const PROT_NONE: ::c_int = 0; 556 pub const PROT_READ: ::c_int = 1; 557 pub const PROT_WRITE: ::c_int = 2; 558 pub const PROT_EXEC: ::c_int = 4; 559 560 pub const LC_CTYPE: ::c_int = 0; 561 pub const LC_NUMERIC: ::c_int = 1; 562 pub const LC_TIME: ::c_int = 2; 563 pub const LC_COLLATE: ::c_int = 3; 564 pub const LC_MONETARY: ::c_int = 4; 565 pub const LC_MESSAGES: ::c_int = 5; 566 pub const LC_ALL: ::c_int = 6; 567 pub const LC_CTYPE_MASK: ::c_int = 1 << LC_CTYPE; 568 pub const LC_NUMERIC_MASK: ::c_int = 1 << LC_NUMERIC; 569 pub const LC_TIME_MASK: ::c_int = 1 << LC_TIME; 570 pub const LC_COLLATE_MASK: ::c_int = 1 << LC_COLLATE; 571 pub const LC_MONETARY_MASK: ::c_int = 1 << LC_MONETARY; 572 pub const LC_MESSAGES_MASK: ::c_int = 1 << LC_MESSAGES; 573 // LC_ALL_MASK defined per platform 574 575 pub const MAP_FILE: ::c_int = 0x0000; 576 pub const MAP_SHARED: ::c_int = 0x0001; 577 pub const MAP_PRIVATE: ::c_int = 0x0002; 578 pub const MAP_FIXED: ::c_int = 0x0010; 579 580 pub const MAP_FAILED: *mut ::c_void = !0 as *mut ::c_void; 581 582 // MS_ flags for msync(2) 583 pub const MS_ASYNC: ::c_int = 0x0001; 584 pub const MS_INVALIDATE: ::c_int = 0x0002; 585 pub const MS_SYNC: ::c_int = 0x0004; 586 587 // MS_ flags for mount(2) 588 pub const MS_RDONLY: ::c_ulong = 0x01; 589 pub const MS_NOSUID: ::c_ulong = 0x02; 590 pub const MS_NODEV: ::c_ulong = 0x04; 591 pub const MS_NOEXEC: ::c_ulong = 0x08; 592 pub const MS_SYNCHRONOUS: ::c_ulong = 0x10; 593 pub const MS_REMOUNT: ::c_ulong = 0x20; 594 pub const MS_MANDLOCK: ::c_ulong = 0x40; 595 pub const MS_DIRSYNC: ::c_ulong = 0x80; 596 pub const MS_NOATIME: ::c_ulong = 0x0400; 597 pub const MS_NODIRATIME: ::c_ulong = 0x0800; 598 pub const MS_BIND: ::c_ulong = 0x1000; 599 pub const MS_MOVE: ::c_ulong = 0x2000; 600 pub const MS_REC: ::c_ulong = 0x4000; 601 pub const MS_SILENT: ::c_ulong = 0x8000; 602 pub const MS_POSIXACL: ::c_ulong = 0x010000; 603 pub const MS_UNBINDABLE: ::c_ulong = 0x020000; 604 pub const MS_PRIVATE: ::c_ulong = 0x040000; 605 pub const MS_SLAVE: ::c_ulong = 0x080000; 606 pub const MS_SHARED: ::c_ulong = 0x100000; 607 pub const MS_RELATIME: ::c_ulong = 0x200000; 608 pub const MS_KERNMOUNT: ::c_ulong = 0x400000; 609 pub const MS_I_VERSION: ::c_ulong = 0x800000; 610 pub const MS_STRICTATIME: ::c_ulong = 0x1000000; 611 pub const MS_ACTIVE: ::c_ulong = 0x40000000; 612 pub const MS_MGC_VAL: ::c_ulong = 0xc0ed0000; 613 pub const MS_MGC_MSK: ::c_ulong = 0xffff0000; 614 615 pub const EPERM: ::c_int = 1; 616 pub const ENOENT: ::c_int = 2; 617 pub const ESRCH: ::c_int = 3; 618 pub const EINTR: ::c_int = 4; 619 pub const EIO: ::c_int = 5; 620 pub const ENXIO: ::c_int = 6; 621 pub const E2BIG: ::c_int = 7; 622 pub const ENOEXEC: ::c_int = 8; 623 pub const EBADF: ::c_int = 9; 624 pub const ECHILD: ::c_int = 10; 625 pub const EAGAIN: ::c_int = 11; 626 pub const ENOMEM: ::c_int = 12; 627 pub const EACCES: ::c_int = 13; 628 pub const EFAULT: ::c_int = 14; 629 pub const ENOTBLK: ::c_int = 15; 630 pub const EBUSY: ::c_int = 16; 631 pub const EEXIST: ::c_int = 17; 632 pub const EXDEV: ::c_int = 18; 633 pub const ENODEV: ::c_int = 19; 634 pub const ENOTDIR: ::c_int = 20; 635 pub const EISDIR: ::c_int = 21; 636 pub const EINVAL: ::c_int = 22; 637 pub const ENFILE: ::c_int = 23; 638 pub const EMFILE: ::c_int = 24; 639 pub const ENOTTY: ::c_int = 25; 640 pub const ETXTBSY: ::c_int = 26; 641 pub const EFBIG: ::c_int = 27; 642 pub const ENOSPC: ::c_int = 28; 643 pub const ESPIPE: ::c_int = 29; 644 pub const EROFS: ::c_int = 30; 645 pub const EMLINK: ::c_int = 31; 646 pub const EPIPE: ::c_int = 32; 647 pub const EDOM: ::c_int = 33; 648 pub const ERANGE: ::c_int = 34; 649 pub const EWOULDBLOCK: ::c_int = EAGAIN; 650 651 pub const SCM_RIGHTS: ::c_int = 0x01; 652 pub const SCM_CREDENTIALS: ::c_int = 0x02; 653 654 pub const PROT_GROWSDOWN: ::c_int = 0x1000000; 655 pub const PROT_GROWSUP: ::c_int = 0x2000000; 656 657 pub const MAP_TYPE: ::c_int = 0x000f; 658 659 pub const MADV_NORMAL: ::c_int = 0; 660 pub const MADV_RANDOM: ::c_int = 1; 661 pub const MADV_SEQUENTIAL: ::c_int = 2; 662 pub const MADV_WILLNEED: ::c_int = 3; 663 pub const MADV_DONTNEED: ::c_int = 4; 664 pub const MADV_FREE: ::c_int = 8; 665 pub const MADV_REMOVE: ::c_int = 9; 666 pub const MADV_DONTFORK: ::c_int = 10; 667 pub const MADV_DOFORK: ::c_int = 11; 668 pub const MADV_MERGEABLE: ::c_int = 12; 669 pub const MADV_UNMERGEABLE: ::c_int = 13; 670 pub const MADV_HUGEPAGE: ::c_int = 14; 671 pub const MADV_NOHUGEPAGE: ::c_int = 15; 672 pub const MADV_DONTDUMP: ::c_int = 16; 673 pub const MADV_DODUMP: ::c_int = 17; 674 pub const MADV_HWPOISON: ::c_int = 100; 675 676 pub const IFF_UP: ::c_int = 0x1; 677 pub const IFF_BROADCAST: ::c_int = 0x2; 678 pub const IFF_DEBUG: ::c_int = 0x4; 679 pub const IFF_LOOPBACK: ::c_int = 0x8; 680 pub const IFF_POINTOPOINT: ::c_int = 0x10; 681 pub const IFF_NOTRAILERS: ::c_int = 0x20; 682 pub const IFF_RUNNING: ::c_int = 0x40; 683 pub const IFF_NOARP: ::c_int = 0x80; 684 pub const IFF_PROMISC: ::c_int = 0x100; 685 pub const IFF_ALLMULTI: ::c_int = 0x200; 686 pub const IFF_MASTER: ::c_int = 0x400; 687 pub const IFF_SLAVE: ::c_int = 0x800; 688 pub const IFF_MULTICAST: ::c_int = 0x1000; 689 pub const IFF_PORTSEL: ::c_int = 0x2000; 690 pub const IFF_AUTOMEDIA: ::c_int = 0x4000; 691 pub const IFF_DYNAMIC: ::c_int = 0x8000; 692 693 pub const SOL_IP: ::c_int = 0; 694 pub const SOL_TCP: ::c_int = 6; 695 pub const SOL_UDP: ::c_int = 17; 696 pub const SOL_IPV6: ::c_int = 41; 697 pub const SOL_ICMPV6: ::c_int = 58; 698 pub const SOL_RAW: ::c_int = 255; 699 pub const SOL_DECNET: ::c_int = 261; 700 pub const SOL_X25: ::c_int = 262; 701 pub const SOL_PACKET: ::c_int = 263; 702 pub const SOL_ATM: ::c_int = 264; 703 pub const SOL_AAL: ::c_int = 265; 704 pub const SOL_IRDA: ::c_int = 266; 705 pub const SOL_NETBEUI: ::c_int = 267; 706 pub const SOL_LLC: ::c_int = 268; 707 pub const SOL_DCCP: ::c_int = 269; 708 pub const SOL_NETLINK: ::c_int = 270; 709 pub const SOL_TIPC: ::c_int = 271; 710 pub const SOL_BLUETOOTH: ::c_int = 274; 711 pub const SOL_ALG: ::c_int = 279; 712 713 pub const AF_UNSPEC: ::c_int = 0; 714 pub const AF_UNIX: ::c_int = 1; 715 pub const AF_LOCAL: ::c_int = 1; 716 pub const AF_INET: ::c_int = 2; 717 pub const AF_AX25: ::c_int = 3; 718 pub const AF_IPX: ::c_int = 4; 719 pub const AF_APPLETALK: ::c_int = 5; 720 pub const AF_NETROM: ::c_int = 6; 721 pub const AF_BRIDGE: ::c_int = 7; 722 pub const AF_ATMPVC: ::c_int = 8; 723 pub const AF_X25: ::c_int = 9; 724 pub const AF_INET6: ::c_int = 10; 725 pub const AF_ROSE: ::c_int = 11; 726 pub const AF_DECnet: ::c_int = 12; 727 pub const AF_NETBEUI: ::c_int = 13; 728 pub const AF_SECURITY: ::c_int = 14; 729 pub const AF_KEY: ::c_int = 15; 730 pub const AF_NETLINK: ::c_int = 16; 731 pub const AF_ROUTE: ::c_int = AF_NETLINK; 732 pub const AF_PACKET: ::c_int = 17; 733 pub const AF_ASH: ::c_int = 18; 734 pub const AF_ECONET: ::c_int = 19; 735 pub const AF_ATMSVC: ::c_int = 20; 736 pub const AF_RDS: ::c_int = 21; 737 pub const AF_SNA: ::c_int = 22; 738 pub const AF_IRDA: ::c_int = 23; 739 pub const AF_PPPOX: ::c_int = 24; 740 pub const AF_WANPIPE: ::c_int = 25; 741 pub const AF_LLC: ::c_int = 26; 742 pub const AF_CAN: ::c_int = 29; 743 pub const AF_TIPC: ::c_int = 30; 744 pub const AF_BLUETOOTH: ::c_int = 31; 745 pub const AF_IUCV: ::c_int = 32; 746 pub const AF_RXRPC: ::c_int = 33; 747 pub const AF_ISDN: ::c_int = 34; 748 pub const AF_PHONET: ::c_int = 35; 749 pub const AF_IEEE802154: ::c_int = 36; 750 pub const AF_CAIF: ::c_int = 37; 751 pub const AF_ALG: ::c_int = 38; 752 753 pub const PF_UNSPEC: ::c_int = AF_UNSPEC; 754 pub const PF_UNIX: ::c_int = AF_UNIX; 755 pub const PF_LOCAL: ::c_int = AF_LOCAL; 756 pub const PF_INET: ::c_int = AF_INET; 757 pub const PF_AX25: ::c_int = AF_AX25; 758 pub const PF_IPX: ::c_int = AF_IPX; 759 pub const PF_APPLETALK: ::c_int = AF_APPLETALK; 760 pub const PF_NETROM: ::c_int = AF_NETROM; 761 pub const PF_BRIDGE: ::c_int = AF_BRIDGE; 762 pub const PF_ATMPVC: ::c_int = AF_ATMPVC; 763 pub const PF_X25: ::c_int = AF_X25; 764 pub const PF_INET6: ::c_int = AF_INET6; 765 pub const PF_ROSE: ::c_int = AF_ROSE; 766 pub const PF_DECnet: ::c_int = AF_DECnet; 767 pub const PF_NETBEUI: ::c_int = AF_NETBEUI; 768 pub const PF_SECURITY: ::c_int = AF_SECURITY; 769 pub const PF_KEY: ::c_int = AF_KEY; 770 pub const PF_NETLINK: ::c_int = AF_NETLINK; 771 pub const PF_ROUTE: ::c_int = AF_ROUTE; 772 pub const PF_PACKET: ::c_int = AF_PACKET; 773 pub const PF_ASH: ::c_int = AF_ASH; 774 pub const PF_ECONET: ::c_int = AF_ECONET; 775 pub const PF_ATMSVC: ::c_int = AF_ATMSVC; 776 pub const PF_RDS: ::c_int = AF_RDS; 777 pub const PF_SNA: ::c_int = AF_SNA; 778 pub const PF_IRDA: ::c_int = AF_IRDA; 779 pub const PF_PPPOX: ::c_int = AF_PPPOX; 780 pub const PF_WANPIPE: ::c_int = AF_WANPIPE; 781 pub const PF_LLC: ::c_int = AF_LLC; 782 pub const PF_CAN: ::c_int = AF_CAN; 783 pub const PF_TIPC: ::c_int = AF_TIPC; 784 pub const PF_BLUETOOTH: ::c_int = AF_BLUETOOTH; 785 pub const PF_IUCV: ::c_int = AF_IUCV; 786 pub const PF_RXRPC: ::c_int = AF_RXRPC; 787 pub const PF_ISDN: ::c_int = AF_ISDN; 788 pub const PF_PHONET: ::c_int = AF_PHONET; 789 pub const PF_IEEE802154: ::c_int = AF_IEEE802154; 790 pub const PF_CAIF: ::c_int = AF_CAIF; 791 pub const PF_ALG: ::c_int = AF_ALG; 792 793 pub const SOMAXCONN: ::c_int = 128; 794 795 pub const MSG_OOB: ::c_int = 1; 796 pub const MSG_PEEK: ::c_int = 2; 797 pub const MSG_DONTROUTE: ::c_int = 4; 798 pub const MSG_CTRUNC: ::c_int = 8; 799 pub const MSG_TRUNC: ::c_int = 0x20; 800 pub const MSG_DONTWAIT: ::c_int = 0x40; 801 pub const MSG_EOR: ::c_int = 0x80; 802 pub const MSG_WAITALL: ::c_int = 0x100; 803 pub const MSG_FIN: ::c_int = 0x200; 804 pub const MSG_SYN: ::c_int = 0x400; 805 pub const MSG_CONFIRM: ::c_int = 0x800; 806 pub const MSG_RST: ::c_int = 0x1000; 807 pub const MSG_ERRQUEUE: ::c_int = 0x2000; 808 pub const MSG_NOSIGNAL: ::c_int = 0x4000; 809 pub const MSG_MORE: ::c_int = 0x8000; 810 pub const MSG_WAITFORONE: ::c_int = 0x10000; 811 pub const MSG_FASTOPEN: ::c_int = 0x20000000; 812 pub const MSG_CMSG_CLOEXEC: ::c_int = 0x40000000; 813 814 pub const SCM_TIMESTAMP: ::c_int = SO_TIMESTAMP; 815 816 pub const SOCK_RAW: ::c_int = 3; 817 pub const SOCK_RDM: ::c_int = 4; 818 pub const IP_MULTICAST_IF: ::c_int = 32; 819 pub const IP_MULTICAST_TTL: ::c_int = 33; 820 pub const IP_MULTICAST_LOOP: ::c_int = 34; 821 pub const IP_TOS: ::c_int = 1; 822 pub const IP_TTL: ::c_int = 2; 823 pub const IP_HDRINCL: ::c_int = 3; 824 pub const IP_PKTINFO: ::c_int = 8; 825 pub const IP_RECVTOS: ::c_int = 13; 826 pub const IP_RECVERR: ::c_int = 11; 827 pub const IP_ADD_MEMBERSHIP: ::c_int = 35; 828 pub const IP_DROP_MEMBERSHIP: ::c_int = 36; 829 pub const IP_ADD_SOURCE_MEMBERSHIP: ::c_int = 39; 830 pub const IP_DROP_SOURCE_MEMBERSHIP: ::c_int = 40; 831 pub const IP_TRANSPARENT: ::c_int = 19; 832 pub const IPV6_ADDRFORM: ::c_int = 1; 833 pub const IPV6_2292PKTINFO: ::c_int = 2; 834 pub const IPV6_2292HOPOPTS: ::c_int = 3; 835 pub const IPV6_2292DSTOPTS: ::c_int = 4; 836 pub const IPV6_2292RTHDR: ::c_int = 5; 837 pub const IPV6_2292PKTOPTIONS: ::c_int = 6; 838 pub const IPV6_CHECKSUM: ::c_int = 7; 839 pub const IPV6_2292HOPLIMIT: ::c_int = 8; 840 pub const IPV6_NEXTHOP: ::c_int = 9; 841 pub const IPV6_FLOWINFO: ::c_int = 11; 842 pub const IPV6_UNICAST_HOPS: ::c_int = 16; 843 pub const IPV6_MULTICAST_IF: ::c_int = 17; 844 pub const IPV6_MULTICAST_HOPS: ::c_int = 18; 845 pub const IPV6_MULTICAST_LOOP: ::c_int = 19; 846 pub const IPV6_ADD_MEMBERSHIP: ::c_int = 20; 847 pub const IPV6_DROP_MEMBERSHIP: ::c_int = 21; 848 pub const IPV6_ROUTER_ALERT: ::c_int = 22; 849 pub const IPV6_MTU_DISCOVER: ::c_int = 23; 850 pub const IPV6_MTU: ::c_int = 24; 851 pub const IPV6_RECVERR: ::c_int = 25; 852 pub const IPV6_V6ONLY: ::c_int = 26; 853 pub const IPV6_JOIN_ANYCAST: ::c_int = 27; 854 pub const IPV6_LEAVE_ANYCAST: ::c_int = 28; 855 pub const IPV6_RECVPKTINFO: ::c_int = 49; 856 pub const IPV6_PKTINFO: ::c_int = 50; 857 pub const IPV6_RECVTCLASS: ::c_int = 66; 858 pub const IPV6_TCLASS: ::c_int = 67; 859 860 pub const TCP_NODELAY: ::c_int = 1; 861 pub const TCP_MAXSEG: ::c_int = 2; 862 pub const TCP_CORK: ::c_int = 3; 863 pub const TCP_KEEPIDLE: ::c_int = 4; 864 pub const TCP_KEEPINTVL: ::c_int = 5; 865 pub const TCP_KEEPCNT: ::c_int = 6; 866 pub const TCP_SYNCNT: ::c_int = 7; 867 pub const TCP_LINGER2: ::c_int = 8; 868 pub const TCP_DEFER_ACCEPT: ::c_int = 9; 869 pub const TCP_WINDOW_CLAMP: ::c_int = 10; 870 pub const TCP_INFO: ::c_int = 11; 871 pub const TCP_QUICKACK: ::c_int = 12; 872 pub const TCP_CONGESTION: ::c_int = 13; 873 874 pub const SO_DEBUG: ::c_int = 1; 875 876 pub const SHUT_RD: ::c_int = 0; 877 pub const SHUT_WR: ::c_int = 1; 878 pub const SHUT_RDWR: ::c_int = 2; 879 880 pub const LOCK_SH: ::c_int = 1; 881 pub const LOCK_EX: ::c_int = 2; 882 pub const LOCK_NB: ::c_int = 4; 883 pub const LOCK_UN: ::c_int = 8; 884 885 pub const SS_ONSTACK: ::c_int = 1; 886 pub const SS_DISABLE: ::c_int = 2; 887 888 pub const PATH_MAX: ::c_int = 4096; 889 890 pub const FD_SETSIZE: usize = 1024; 891 892 pub const EPOLLIN: ::c_int = 0x1; 893 pub const EPOLLPRI: ::c_int = 0x2; 894 pub const EPOLLOUT: ::c_int = 0x4; 895 pub const EPOLLRDNORM: ::c_int = 0x40; 896 pub const EPOLLRDBAND: ::c_int = 0x80; 897 pub const EPOLLWRNORM: ::c_int = 0x100; 898 pub const EPOLLWRBAND: ::c_int = 0x200; 899 pub const EPOLLMSG: ::c_int = 0x400; 900 pub const EPOLLERR: ::c_int = 0x8; 901 pub const EPOLLHUP: ::c_int = 0x10; 902 pub const EPOLLET: ::c_int = 0x80000000; 903 904 pub const EPOLL_CTL_ADD: ::c_int = 1; 905 pub const EPOLL_CTL_MOD: ::c_int = 3; 906 pub const EPOLL_CTL_DEL: ::c_int = 2; 907 908 pub const MNT_DETACH: ::c_int = 0x2; 909 pub const MNT_EXPIRE: ::c_int = 0x4; 910 911 pub const Q_GETFMT: ::c_int = 0x800004; 912 pub const Q_GETINFO: ::c_int = 0x800005; 913 pub const Q_SETINFO: ::c_int = 0x800006; 914 pub const QIF_BLIMITS: u32 = 1; 915 pub const QIF_SPACE: u32 = 2; 916 pub const QIF_ILIMITS: u32 = 4; 917 pub const QIF_INODES: u32 = 8; 918 pub const QIF_BTIME: u32 = 16; 919 pub const QIF_ITIME: u32 = 32; 920 pub const QIF_LIMITS: u32 = 5; 921 pub const QIF_USAGE: u32 = 10; 922 pub const QIF_TIMES: u32 = 48; 923 pub const QIF_ALL: u32 = 63; 924 925 pub const MNT_FORCE: ::c_int = 0x1; 926 927 pub const Q_SYNC: ::c_int = 0x800001; 928 pub const Q_QUOTAON: ::c_int = 0x800002; 929 pub const Q_QUOTAOFF: ::c_int = 0x800003; 930 pub const Q_GETQUOTA: ::c_int = 0x800007; 931 pub const Q_SETQUOTA: ::c_int = 0x800008; 932 933 pub const TCIOFF: ::c_int = 2; 934 pub const TCION: ::c_int = 3; 935 pub const TCOOFF: ::c_int = 0; 936 pub const TCOON: ::c_int = 1; 937 pub const TCIFLUSH: ::c_int = 0; 938 pub const TCOFLUSH: ::c_int = 1; 939 pub const TCIOFLUSH: ::c_int = 2; 940 pub const NL0: ::tcflag_t = 0x00000000; 941 pub const NL1: ::tcflag_t = 0x00000100; 942 pub const TAB0: ::tcflag_t = 0x00000000; 943 pub const CR0: ::tcflag_t = 0x00000000; 944 pub const FF0: ::tcflag_t = 0x00000000; 945 pub const BS0: ::tcflag_t = 0x00000000; 946 pub const VT0: ::tcflag_t = 0x00000000; 947 pub const VERASE: usize = 2; 948 pub const VKILL: usize = 3; 949 pub const VINTR: usize = 0; 950 pub const VQUIT: usize = 1; 951 pub const VLNEXT: usize = 15; 952 pub const IGNBRK: ::tcflag_t = 0x00000001; 953 pub const BRKINT: ::tcflag_t = 0x00000002; 954 pub const IGNPAR: ::tcflag_t = 0x00000004; 955 pub const PARMRK: ::tcflag_t = 0x00000008; 956 pub const INPCK: ::tcflag_t = 0x00000010; 957 pub const ISTRIP: ::tcflag_t = 0x00000020; 958 pub const INLCR: ::tcflag_t = 0x00000040; 959 pub const IGNCR: ::tcflag_t = 0x00000080; 960 pub const ICRNL: ::tcflag_t = 0x00000100; 961 pub const IXANY: ::tcflag_t = 0x00000800; 962 pub const IMAXBEL: ::tcflag_t = 0x00002000; 963 pub const OPOST: ::tcflag_t = 0x1; 964 pub const CS5: ::tcflag_t = 0x00000000; 965 pub const CRTSCTS: ::tcflag_t = 0x80000000; 966 pub const ECHO: ::tcflag_t = 0x00000008; 967 pub const OCRNL: ::tcflag_t = 0o000010; 968 pub const ONOCR: ::tcflag_t = 0o000020; 969 pub const ONLRET: ::tcflag_t = 0o000040; 970 pub const OFILL: ::tcflag_t = 0o000100; 971 pub const OFDEL: ::tcflag_t = 0o000200; 972 973 pub const CLONE_VM: ::c_int = 0x100; 974 pub const CLONE_FS: ::c_int = 0x200; 975 pub const CLONE_FILES: ::c_int = 0x400; 976 pub const CLONE_SIGHAND: ::c_int = 0x800; 977 pub const CLONE_PTRACE: ::c_int = 0x2000; 978 pub const CLONE_VFORK: ::c_int = 0x4000; 979 pub const CLONE_PARENT: ::c_int = 0x8000; 980 pub const CLONE_THREAD: ::c_int = 0x10000; 981 pub const CLONE_NEWNS: ::c_int = 0x20000; 982 pub const CLONE_SYSVSEM: ::c_int = 0x40000; 983 pub const CLONE_SETTLS: ::c_int = 0x80000; 984 pub const CLONE_PARENT_SETTID: ::c_int = 0x100000; 985 pub const CLONE_CHILD_CLEARTID: ::c_int = 0x200000; 986 pub const CLONE_DETACHED: ::c_int = 0x400000; 987 pub const CLONE_UNTRACED: ::c_int = 0x800000; 988 pub const CLONE_CHILD_SETTID: ::c_int = 0x01000000; 989 pub const CLONE_NEWUTS: ::c_int = 0x04000000; 990 pub const CLONE_NEWIPC: ::c_int = 0x08000000; 991 pub const CLONE_NEWUSER: ::c_int = 0x10000000; 992 pub const CLONE_NEWPID: ::c_int = 0x20000000; 993 pub const CLONE_NEWNET: ::c_int = 0x40000000; 994 pub const CLONE_IO: ::c_int = 0x80000000; 995 pub const CLONE_NEWCGROUP: ::c_int = 0x02000000; 996 997 pub const WNOHANG: ::c_int = 0x00000001; 998 pub const WUNTRACED: ::c_int = 0x00000002; 999 pub const WSTOPPED: ::c_int = WUNTRACED; 1000 pub const WEXITED: ::c_int = 0x00000004; 1001 pub const WCONTINUED: ::c_int = 0x00000008; 1002 pub const WNOWAIT: ::c_int = 0x01000000; 1003 1004 // Options set using PTRACE_SETOPTIONS. 1005 pub const PTRACE_O_TRACESYSGOOD: ::c_int = 0x00000001; 1006 pub const PTRACE_O_TRACEFORK: ::c_int = 0x00000002; 1007 pub const PTRACE_O_TRACEVFORK: ::c_int = 0x00000004; 1008 pub const PTRACE_O_TRACECLONE: ::c_int = 0x00000008; 1009 pub const PTRACE_O_TRACEEXEC: ::c_int = 0x00000010; 1010 pub const PTRACE_O_TRACEVFORKDONE: ::c_int = 0x00000020; 1011 pub const PTRACE_O_TRACEEXIT: ::c_int = 0x00000040; 1012 pub const PTRACE_O_TRACESECCOMP: ::c_int = 0x00000080; 1013 pub const PTRACE_O_EXITKILL: ::c_int = 0x00100000; 1014 pub const PTRACE_O_SUSPEND_SECCOMP: ::c_int = 0x00200000; 1015 pub const PTRACE_O_MASK: ::c_int = 0x003000ff; 1016 1017 // Wait extended result codes for the above trace options. 1018 pub const PTRACE_EVENT_FORK: ::c_int = 1; 1019 pub const PTRACE_EVENT_VFORK: ::c_int = 2; 1020 pub const PTRACE_EVENT_CLONE: ::c_int = 3; 1021 pub const PTRACE_EVENT_EXEC: ::c_int = 4; 1022 pub const PTRACE_EVENT_VFORK_DONE: ::c_int = 5; 1023 pub const PTRACE_EVENT_EXIT: ::c_int = 6; 1024 pub const PTRACE_EVENT_SECCOMP: ::c_int = 7; 1025 // PTRACE_EVENT_STOP was added to glibc in 2.26 1026 // pub const PTRACE_EVENT_STOP: ::c_int = 128; 1027 1028 pub const __WNOTHREAD: ::c_int = 0x20000000; 1029 pub const __WALL: ::c_int = 0x40000000; 1030 pub const __WCLONE: ::c_int = 0x80000000; 1031 1032 pub const SPLICE_F_MOVE: ::c_uint = 0x01; 1033 pub const SPLICE_F_NONBLOCK: ::c_uint = 0x02; 1034 pub const SPLICE_F_MORE: ::c_uint = 0x04; 1035 pub const SPLICE_F_GIFT: ::c_uint = 0x08; 1036 1037 pub const RTLD_LOCAL: ::c_int = 0; 1038 pub const RTLD_LAZY: ::c_int = 1; 1039 1040 pub const POSIX_FADV_NORMAL: ::c_int = 0; 1041 pub const POSIX_FADV_RANDOM: ::c_int = 1; 1042 pub const POSIX_FADV_SEQUENTIAL: ::c_int = 2; 1043 pub const POSIX_FADV_WILLNEED: ::c_int = 3; 1044 1045 pub const AT_FDCWD: ::c_int = -100; 1046 pub const AT_SYMLINK_NOFOLLOW: ::c_int = 0x100; 1047 pub const AT_REMOVEDIR: ::c_int = 0x200; 1048 pub const AT_SYMLINK_FOLLOW: ::c_int = 0x400; 1049 pub const AT_NO_AUTOMOUNT: ::c_int = 0x800; 1050 pub const AT_EMPTY_PATH: ::c_int = 0x1000; 1051 1052 pub const LOG_CRON: ::c_int = 9 << 3; 1053 pub const LOG_AUTHPRIV: ::c_int = 10 << 3; 1054 pub const LOG_FTP: ::c_int = 11 << 3; 1055 pub const LOG_PERROR: ::c_int = 0x20; 1056 1057 pub const PIPE_BUF: usize = 4096; 1058 1059 pub const SI_LOAD_SHIFT: ::c_uint = 16; 1060 1061 pub const SIGEV_SIGNAL: ::c_int = 0; 1062 pub const SIGEV_NONE: ::c_int = 1; 1063 pub const SIGEV_THREAD: ::c_int = 2; 1064 1065 pub const P_ALL: idtype_t = 0; 1066 pub const P_PID: idtype_t = 1; 1067 pub const P_PGID: idtype_t = 2; 1068 1069 pub const UTIME_OMIT: c_long = 1073741822; 1070 pub const UTIME_NOW: c_long = 1073741823; 1071 1072 pub const POLLIN: ::c_short = 0x1; 1073 pub const POLLPRI: ::c_short = 0x2; 1074 pub const POLLOUT: ::c_short = 0x4; 1075 pub const POLLERR: ::c_short = 0x8; 1076 pub const POLLHUP: ::c_short = 0x10; 1077 pub const POLLNVAL: ::c_short = 0x20; 1078 pub const POLLRDNORM: ::c_short = 0x040; 1079 pub const POLLRDBAND: ::c_short = 0x080; 1080 1081 pub const IPTOS_LOWDELAY: u8 = 0x10; 1082 pub const IPTOS_THROUGHPUT: u8 = 0x08; 1083 pub const IPTOS_RELIABILITY: u8 = 0x04; 1084 pub const IPTOS_MINCOST: u8 = 0x02; 1085 1086 pub const IPTOS_PREC_NETCONTROL: u8 = 0xe0; 1087 pub const IPTOS_PREC_INTERNETCONTROL: u8 = 0xc0; 1088 pub const IPTOS_PREC_CRITIC_ECP: u8 = 0xa0; 1089 pub const IPTOS_PREC_FLASHOVERRIDE: u8 = 0x80; 1090 pub const IPTOS_PREC_FLASH: u8 = 0x60; 1091 pub const IPTOS_PREC_IMMEDIATE: u8 = 0x40; 1092 pub const IPTOS_PREC_PRIORITY: u8 = 0x20; 1093 pub const IPTOS_PREC_ROUTINE: u8 = 0x00; 1094 1095 pub const IPTOS_ECN_MASK: u8 = 0x03; 1096 pub const IPTOS_ECN_ECT1: u8 = 0x01; 1097 pub const IPTOS_ECN_ECT0: u8 = 0x02; 1098 pub const IPTOS_ECN_CE: u8 = 0x03; 1099 1100 pub const IPOPT_COPY: u8 = 0x80; 1101 pub const IPOPT_CLASS_MASK: u8 = 0x60; 1102 pub const IPOPT_NUMBER_MASK: u8 = 0x1f; 1103 1104 pub const IPOPT_CONTROL: u8 = 0x00; 1105 pub const IPOPT_RESERVED1: u8 = 0x20; 1106 pub const IPOPT_MEASUREMENT: u8 = 0x40; 1107 pub const IPOPT_RESERVED2: u8 = 0x60; 1108 pub const IPOPT_END: u8 = 0 | IPOPT_CONTROL; 1109 pub const IPOPT_NOOP: u8 = 1 | IPOPT_CONTROL; 1110 pub const IPOPT_SEC: u8 = 2 | IPOPT_CONTROL | IPOPT_COPY; 1111 pub const IPOPT_LSRR: u8 = 3 | IPOPT_CONTROL | IPOPT_COPY; 1112 pub const IPOPT_TIMESTAMP: u8 = 4 | IPOPT_MEASUREMENT; 1113 pub const IPOPT_RR: u8 = 7 | IPOPT_CONTROL; 1114 pub const IPOPT_SID: u8 = 8 | IPOPT_CONTROL | IPOPT_COPY; 1115 pub const IPOPT_SSRR: u8 = 9 | IPOPT_CONTROL | IPOPT_COPY; 1116 pub const IPOPT_RA: u8 = 20 | IPOPT_CONTROL | IPOPT_COPY; 1117 pub const IPVERSION: u8 = 4; 1118 pub const MAXTTL: u8 = 255; 1119 pub const IPDEFTTL: u8 = 64; 1120 pub const IPOPT_OPTVAL: u8 = 0; 1121 pub const IPOPT_OLEN: u8 = 1; 1122 pub const IPOPT_OFFSET: u8 = 2; 1123 pub const IPOPT_MINOFF: u8 = 4; 1124 pub const MAX_IPOPTLEN: u8 = 40; 1125 pub const IPOPT_NOP: u8 = IPOPT_NOOP; 1126 pub const IPOPT_EOL: u8 = IPOPT_END; 1127 pub const IPOPT_TS: u8 = IPOPT_TIMESTAMP; 1128 pub const IPOPT_TS_TSONLY: u8 = 0; 1129 pub const IPOPT_TS_TSANDADDR: u8 = 1; 1130 pub const IPOPT_TS_PRESPEC: u8 = 3; 1131 1132 pub const ARPOP_RREQUEST: u16 = 3; 1133 pub const ARPOP_RREPLY: u16 = 4; 1134 pub const ARPOP_InREQUEST: u16 = 8; 1135 pub const ARPOP_InREPLY: u16 = 9; 1136 pub const ARPOP_NAK: u16 = 10; 1137 1138 pub const ATF_NETMASK: ::c_int = 0x20; 1139 pub const ATF_DONTPUB: ::c_int = 0x40; 1140 1141 pub const ARPHRD_NETROM: u16 = 0; 1142 pub const ARPHRD_ETHER: u16 = 1; 1143 pub const ARPHRD_EETHER: u16 = 2; 1144 pub const ARPHRD_AX25: u16 = 3; 1145 pub const ARPHRD_PRONET: u16 = 4; 1146 pub const ARPHRD_CHAOS: u16 = 5; 1147 pub const ARPHRD_IEEE802: u16 = 6; 1148 pub const ARPHRD_ARCNET: u16 = 7; 1149 pub const ARPHRD_APPLETLK: u16 = 8; 1150 pub const ARPHRD_DLCI: u16 = 15; 1151 pub const ARPHRD_ATM: u16 = 19; 1152 pub const ARPHRD_METRICOM: u16 = 23; 1153 pub const ARPHRD_IEEE1394: u16 = 24; 1154 pub const ARPHRD_EUI64: u16 = 27; 1155 pub const ARPHRD_INFINIBAND: u16 = 32; 1156 1157 pub const ARPHRD_SLIP: u16 = 256; 1158 pub const ARPHRD_CSLIP: u16 = 257; 1159 pub const ARPHRD_SLIP6: u16 = 258; 1160 pub const ARPHRD_CSLIP6: u16 = 259; 1161 pub const ARPHRD_RSRVD: u16 = 260; 1162 pub const ARPHRD_ADAPT: u16 = 264; 1163 pub const ARPHRD_ROSE: u16 = 270; 1164 pub const ARPHRD_X25: u16 = 271; 1165 pub const ARPHRD_HWX25: u16 = 272; 1166 pub const ARPHRD_PPP: u16 = 512; 1167 pub const ARPHRD_CISCO: u16 = 513; 1168 pub const ARPHRD_HDLC: u16 = ARPHRD_CISCO; 1169 pub const ARPHRD_LAPB: u16 = 516; 1170 pub const ARPHRD_DDCMP: u16 = 517; 1171 pub const ARPHRD_RAWHDLC: u16 = 518; 1172 1173 pub const ARPHRD_TUNNEL: u16 = 768; 1174 pub const ARPHRD_TUNNEL6: u16 = 769; 1175 pub const ARPHRD_FRAD: u16 = 770; 1176 pub const ARPHRD_SKIP: u16 = 771; 1177 pub const ARPHRD_LOOPBACK: u16 = 772; 1178 pub const ARPHRD_LOCALTLK: u16 = 773; 1179 pub const ARPHRD_FDDI: u16 = 774; 1180 pub const ARPHRD_BIF: u16 = 775; 1181 pub const ARPHRD_SIT: u16 = 776; 1182 pub const ARPHRD_IPDDP: u16 = 777; 1183 pub const ARPHRD_IPGRE: u16 = 778; 1184 pub const ARPHRD_PIMREG: u16 = 779; 1185 pub const ARPHRD_HIPPI: u16 = 780; 1186 pub const ARPHRD_ASH: u16 = 781; 1187 pub const ARPHRD_ECONET: u16 = 782; 1188 pub const ARPHRD_IRDA: u16 = 783; 1189 pub const ARPHRD_FCPP: u16 = 784; 1190 pub const ARPHRD_FCAL: u16 = 785; 1191 pub const ARPHRD_FCPL: u16 = 786; 1192 pub const ARPHRD_FCFABRIC: u16 = 787; 1193 pub const ARPHRD_IEEE802_TR: u16 = 800; 1194 pub const ARPHRD_IEEE80211: u16 = 801; 1195 pub const ARPHRD_IEEE80211_PRISM: u16 = 802; 1196 pub const ARPHRD_IEEE80211_RADIOTAP: u16 = 803; 1197 pub const ARPHRD_IEEE802154: u16 = 804; 1198 1199 pub const ARPHRD_VOID: u16 = 0xFFFF; 1200 pub const ARPHRD_NONE: u16 = 0xFFFE; 1201 1202 pub const SO_EE_ORIGIN_NONE: u8 = 0; 1203 pub const SO_EE_ORIGIN_LOCAL: u8 = 1; 1204 pub const SO_EE_ORIGIN_ICMP: u8 = 2; 1205 pub const SO_EE_ORIGIN_ICMP6: u8 = 3; 1206 pub const SO_EE_ORIGIN_TXSTATUS: u8 = 4; 1207 pub const SO_EE_ORIGIN_TIMESTAMPING: u8 = SO_EE_ORIGIN_TXSTATUS; 1208 1209 const_fn! { 1210 {const} fn CMSG_ALIGN(len: usize) -> usize { 1211 len + ::mem::size_of::<usize>() - 1 & !(::mem::size_of::<usize>() - 1) 1212 } 1213 } 1214 1215 f! { 1216 pub fn CMSG_FIRSTHDR(mhdr: *const msghdr) -> *mut cmsghdr { 1217 if (*mhdr).msg_controllen as usize >= ::mem::size_of::<cmsghdr>() { 1218 (*mhdr).msg_control as *mut cmsghdr 1219 } else { 1220 0 as *mut cmsghdr 1221 } 1222 } 1223 1224 pub fn CMSG_DATA(cmsg: *const cmsghdr) -> *mut ::c_uchar { 1225 cmsg.offset(1) as *mut ::c_uchar 1226 } 1227 1228 pub {const} fn CMSG_SPACE(length: ::c_uint) -> ::c_uint { 1229 (CMSG_ALIGN(length as usize) + CMSG_ALIGN(::mem::size_of::<cmsghdr>())) 1230 as ::c_uint 1231 } 1232 1233 pub fn CMSG_LEN(length: ::c_uint) -> ::c_uint { 1234 CMSG_ALIGN(::mem::size_of::<cmsghdr>()) as ::c_uint + length 1235 } 1236 1237 pub fn FD_CLR(fd: ::c_int, set: *mut fd_set) -> () { 1238 let fd = fd as usize; 1239 let size = ::mem::size_of_val(&(*set).fds_bits[0]) * 8; 1240 (*set).fds_bits[fd / size] &= !(1 << (fd % size)); 1241 return 1242 } 1243 1244 pub fn FD_ISSET(fd: ::c_int, set: *mut fd_set) -> bool { 1245 let fd = fd as usize; 1246 let size = ::mem::size_of_val(&(*set).fds_bits[0]) * 8; 1247 return ((*set).fds_bits[fd / size] & (1 << (fd % size))) != 0 1248 } 1249 1250 pub fn FD_SET(fd: ::c_int, set: *mut fd_set) -> () { 1251 let fd = fd as usize; 1252 let size = ::mem::size_of_val(&(*set).fds_bits[0]) * 8; 1253 (*set).fds_bits[fd / size] |= 1 << (fd % size); 1254 return 1255 } 1256 1257 pub fn FD_ZERO(set: *mut fd_set) -> () { 1258 for slot in (*set).fds_bits.iter_mut() { 1259 *slot = 0; 1260 } 1261 } 1262 1263 pub fn WIFSTOPPED(status: ::c_int) -> bool { 1264 (status & 0xff) == 0x7f 1265 } 1266 1267 pub fn WSTOPSIG(status: ::c_int) -> ::c_int { 1268 (status >> 8) & 0xff 1269 } 1270 1271 pub fn WIFCONTINUED(status: ::c_int) -> bool { 1272 status == 0xffff 1273 } 1274 1275 pub fn WIFSIGNALED(status: ::c_int) -> bool { 1276 ((status & 0x7f) + 1) as i8 >= 2 1277 } 1278 1279 pub fn WTERMSIG(status: ::c_int) -> ::c_int { 1280 status & 0x7f 1281 } 1282 1283 pub fn WIFEXITED(status: ::c_int) -> bool { 1284 (status & 0x7f) == 0 1285 } 1286 1287 pub fn WEXITSTATUS(status: ::c_int) -> ::c_int { 1288 (status >> 8) & 0xff 1289 } 1290 1291 pub fn WCOREDUMP(status: ::c_int) -> bool { 1292 (status & 0x80) != 0 1293 } 1294 1295 pub fn QCMD(cmd: ::c_int, type_: ::c_int) -> ::c_int { 1296 (cmd << 8) | (type_ & 0x00ff) 1297 } 1298 1299 pub fn IPOPT_COPIED(o: u8) -> u8 { 1300 o & IPOPT_COPY 1301 } 1302 1303 pub fn IPOPT_CLASS(o: u8) -> u8 { 1304 o & IPOPT_CLASS_MASK 1305 } 1306 1307 pub fn IPOPT_NUMBER(o: u8) -> u8 { 1308 o & IPOPT_NUMBER_MASK 1309 } 1310 1311 pub fn IPTOS_ECN(x: u8) -> u8 { 1312 x & ::IPTOS_ECN_MASK 1313 } 1314 1315 pub fn SO_EE_OFFENDER(ee: *const ::sock_extended_err) -> *mut ::sockaddr { 1316 ee.offset(1) as *mut ::sockaddr 1317 } 1318 } 1319 1320 extern "C" { 1321 pub fn sem_destroy(sem: *mut sem_t) -> ::c_int; 1322 pub fn sem_init( 1323 sem: *mut sem_t, 1324 pshared: ::c_int, 1325 value: ::c_uint, 1326 ) -> ::c_int; 1327 pub fn fdatasync(fd: ::c_int) -> ::c_int; 1328 pub fn mincore( 1329 addr: *mut ::c_void, 1330 len: ::size_t, 1331 vec: *mut ::c_uchar, 1332 ) -> ::c_int; 1333 pub fn clock_getres(clk_id: ::clockid_t, tp: *mut ::timespec) -> ::c_int; 1334 pub fn clock_gettime(clk_id: ::clockid_t, tp: *mut ::timespec) -> ::c_int; 1335 pub fn clock_settime( 1336 clk_id: ::clockid_t, 1337 tp: *const ::timespec, 1338 ) -> ::c_int; 1339 pub fn dirfd(dirp: *mut ::DIR) -> ::c_int; 1340 1341 pub fn pthread_getattr_np( 1342 native: ::pthread_t, 1343 attr: *mut ::pthread_attr_t, 1344 ) -> ::c_int; 1345 pub fn pthread_attr_getstack( 1346 attr: *const ::pthread_attr_t, 1347 stackaddr: *mut *mut ::c_void, 1348 stacksize: *mut ::size_t, 1349 ) -> ::c_int; 1350 pub fn memalign(align: ::size_t, size: ::size_t) -> *mut ::c_void; 1351 pub fn setgroups(ngroups: ::size_t, ptr: *const ::gid_t) -> ::c_int; 1352 pub fn pipe2(fds: *mut ::c_int, flags: ::c_int) -> ::c_int; 1353 pub fn statfs(path: *const ::c_char, buf: *mut statfs) -> ::c_int; 1354 pub fn statfs64(path: *const ::c_char, buf: *mut statfs64) -> ::c_int; 1355 pub fn fstatfs(fd: ::c_int, buf: *mut statfs) -> ::c_int; 1356 pub fn fstatfs64(fd: ::c_int, buf: *mut statfs64) -> ::c_int; 1357 pub fn statvfs64(path: *const ::c_char, buf: *mut statvfs64) -> ::c_int; 1358 pub fn fstatvfs64(fd: ::c_int, buf: *mut statvfs64) -> ::c_int; 1359 pub fn memrchr( 1360 cx: *const ::c_void, 1361 c: ::c_int, 1362 n: ::size_t, 1363 ) -> *mut ::c_void; 1364 1365 pub fn posix_fadvise( 1366 fd: ::c_int, 1367 offset: ::off_t, 1368 len: ::off_t, 1369 advise: ::c_int, 1370 ) -> ::c_int; 1371 pub fn futimens(fd: ::c_int, times: *const ::timespec) -> ::c_int; 1372 pub fn utimensat( 1373 dirfd: ::c_int, 1374 path: *const ::c_char, 1375 times: *const ::timespec, 1376 flag: ::c_int, 1377 ) -> ::c_int; 1378 pub fn duplocale(base: ::locale_t) -> ::locale_t; 1379 pub fn freelocale(loc: ::locale_t); 1380 pub fn newlocale( 1381 mask: ::c_int, 1382 locale: *const ::c_char, 1383 base: ::locale_t, 1384 ) -> ::locale_t; 1385 pub fn uselocale(loc: ::locale_t) -> ::locale_t; 1386 pub fn creat64(path: *const c_char, mode: mode_t) -> ::c_int; 1387 pub fn fstat64(fildes: ::c_int, buf: *mut stat64) -> ::c_int; 1388 pub fn fstatat64( 1389 dirfd: ::c_int, 1390 pathname: *const c_char, 1391 buf: *mut stat64, 1392 flags: ::c_int, 1393 ) -> ::c_int; 1394 pub fn ftruncate64(fd: ::c_int, length: off64_t) -> ::c_int; 1395 pub fn lseek64(fd: ::c_int, offset: off64_t, whence: ::c_int) -> off64_t; 1396 pub fn lstat64(path: *const c_char, buf: *mut stat64) -> ::c_int; 1397 pub fn mmap64( 1398 addr: *mut ::c_void, 1399 len: ::size_t, 1400 prot: ::c_int, 1401 flags: ::c_int, 1402 fd: ::c_int, 1403 offset: off64_t, 1404 ) -> *mut ::c_void; 1405 pub fn open64(path: *const c_char, oflag: ::c_int, ...) -> ::c_int; 1406 pub fn openat64( 1407 fd: ::c_int, 1408 path: *const c_char, 1409 oflag: ::c_int, 1410 ... 1411 ) -> ::c_int; 1412 pub fn pread64( 1413 fd: ::c_int, 1414 buf: *mut ::c_void, 1415 count: ::size_t, 1416 offset: off64_t, 1417 ) -> ::ssize_t; 1418 pub fn preadv64( 1419 fd: ::c_int, 1420 iov: *const ::iovec, 1421 iovcnt: ::c_int, 1422 offset: ::off64_t, 1423 ) -> ::ssize_t; 1424 pub fn pwrite64( 1425 fd: ::c_int, 1426 buf: *const ::c_void, 1427 count: ::size_t, 1428 offset: off64_t, 1429 ) -> ::ssize_t; 1430 pub fn pwritev64( 1431 fd: ::c_int, 1432 iov: *const ::iovec, 1433 iovcnt: ::c_int, 1434 offset: ::off64_t, 1435 ) -> ::ssize_t; 1436 pub fn readdir64(dirp: *mut ::DIR) -> *mut ::dirent64; 1437 pub fn readdir64_r( 1438 dirp: *mut ::DIR, 1439 entry: *mut ::dirent64, 1440 result: *mut *mut ::dirent64, 1441 ) -> ::c_int; 1442 pub fn stat64(path: *const c_char, buf: *mut stat64) -> ::c_int; 1443 pub fn truncate64(path: *const c_char, length: off64_t) -> ::c_int; 1444 1445 pub fn mknodat( 1446 dirfd: ::c_int, 1447 pathname: *const ::c_char, 1448 mode: ::mode_t, 1449 dev: dev_t, 1450 ) -> ::c_int; 1451 pub fn pthread_condattr_getclock( 1452 attr: *const pthread_condattr_t, 1453 clock_id: *mut clockid_t, 1454 ) -> ::c_int; 1455 pub fn pthread_condattr_setclock( 1456 attr: *mut pthread_condattr_t, 1457 clock_id: ::clockid_t, 1458 ) -> ::c_int; 1459 pub fn pthread_condattr_setpshared( 1460 attr: *mut pthread_condattr_t, 1461 pshared: ::c_int, 1462 ) -> ::c_int; 1463 pub fn accept4( 1464 fd: ::c_int, 1465 addr: *mut ::sockaddr, 1466 len: *mut ::socklen_t, 1467 flg: ::c_int, 1468 ) -> ::c_int; 1469 pub fn pthread_mutexattr_setpshared( 1470 attr: *mut pthread_mutexattr_t, 1471 pshared: ::c_int, 1472 ) -> ::c_int; 1473 pub fn pthread_rwlockattr_getpshared( 1474 attr: *const pthread_rwlockattr_t, 1475 val: *mut ::c_int, 1476 ) -> ::c_int; 1477 pub fn pthread_rwlockattr_setpshared( 1478 attr: *mut pthread_rwlockattr_t, 1479 val: ::c_int, 1480 ) -> ::c_int; 1481 pub fn ptsname_r( 1482 fd: ::c_int, 1483 buf: *mut ::c_char, 1484 buflen: ::size_t, 1485 ) -> ::c_int; 1486 pub fn clearenv() -> ::c_int; 1487 pub fn waitid( 1488 idtype: idtype_t, 1489 id: id_t, 1490 infop: *mut ::siginfo_t, 1491 options: ::c_int, 1492 ) -> ::c_int; 1493 pub fn setreuid(ruid: ::uid_t, euid: ::uid_t) -> ::c_int; 1494 pub fn setregid(rgid: ::gid_t, egid: ::gid_t) -> ::c_int; 1495 pub fn getresuid( 1496 ruid: *mut ::uid_t, 1497 euid: *mut ::uid_t, 1498 suid: *mut ::uid_t, 1499 ) -> ::c_int; 1500 pub fn getresgid( 1501 rgid: *mut ::gid_t, 1502 egid: *mut ::gid_t, 1503 sgid: *mut ::gid_t, 1504 ) -> ::c_int; 1505 pub fn acct(filename: *const ::c_char) -> ::c_int; 1506 pub fn brk(addr: *mut ::c_void) -> ::c_int; 1507 pub fn sbrk(increment: ::intptr_t) -> *mut ::c_void; 1508 #[deprecated( 1509 since = "0.2.66", 1510 note = "causes memory corruption, see rust-lang/libc#1596" 1511 )] 1512 pub fn vfork() -> ::pid_t; 1513 pub fn setresgid(rgid: ::gid_t, egid: ::gid_t, sgid: ::gid_t) -> ::c_int; 1514 pub fn setresuid(ruid: ::uid_t, euid: ::uid_t, suid: ::uid_t) -> ::c_int; 1515 pub fn wait4( 1516 pid: ::pid_t, 1517 status: *mut ::c_int, 1518 options: ::c_int, 1519 rusage: *mut ::rusage, 1520 ) -> ::pid_t; 1521 pub fn openpty( 1522 amaster: *mut ::c_int, 1523 aslave: *mut ::c_int, 1524 name: *mut ::c_char, 1525 termp: *const termios, 1526 winp: *const ::winsize, 1527 ) -> ::c_int; 1528 pub fn forkpty( 1529 amaster: *mut ::c_int, 1530 name: *mut ::c_char, 1531 termp: *const termios, 1532 winp: *const ::winsize, 1533 ) -> ::pid_t; 1534 pub fn login_tty(fd: ::c_int) -> ::c_int; 1535 pub fn execvpe( 1536 file: *const ::c_char, 1537 argv: *const *const ::c_char, 1538 envp: *const *const ::c_char, 1539 ) -> ::c_int; 1540 pub fn fexecve( 1541 fd: ::c_int, 1542 argv: *const *const ::c_char, 1543 envp: *const *const ::c_char, 1544 ) -> ::c_int; 1545 pub fn getifaddrs(ifap: *mut *mut ::ifaddrs) -> ::c_int; 1546 pub fn freeifaddrs(ifa: *mut ::ifaddrs); 1547 pub fn bind( 1548 socket: ::c_int, 1549 address: *const ::sockaddr, 1550 address_len: ::socklen_t, 1551 ) -> ::c_int; 1552 1553 pub fn writev( 1554 fd: ::c_int, 1555 iov: *const ::iovec, 1556 iovcnt: ::c_int, 1557 ) -> ::ssize_t; 1558 pub fn readv( 1559 fd: ::c_int, 1560 iov: *const ::iovec, 1561 iovcnt: ::c_int, 1562 ) -> ::ssize_t; 1563 1564 pub fn sendmsg( 1565 fd: ::c_int, 1566 msg: *const ::msghdr, 1567 flags: ::c_int, 1568 ) -> ::ssize_t; 1569 pub fn recvmsg( 1570 fd: ::c_int, 1571 msg: *mut ::msghdr, 1572 flags: ::c_int, 1573 ) -> ::ssize_t; 1574 pub fn uname(buf: *mut ::utsname) -> ::c_int; 1575 } 1576 1577 cfg_if! { 1578 if #[cfg(target_os = "emscripten")] { 1579 mod emscripten; 1580 pub use self::emscripten::*; 1581 } else if #[cfg(target_os = "linux")] { 1582 mod linux; 1583 pub use self::linux::*; 1584 } else if #[cfg(target_os = "android")] { 1585 mod android; 1586 pub use self::android::*; 1587 } else { 1588 // Unknown target_os 1589 } 1590 } 1591