1 // liblibc port for HermitCore (https://hermitcore.org) 2 // HermitCore is a unikernel based on lwIP, newlib, and 3 // pthread-embedded. 4 // Consider these definitions when porting liblibc to another 5 // lwIP/newlib/pte-based target. 6 // 7 // Ported by Colin Finck <colin.finck@rwth-aachen.de> 8 9 pub type c_long = i64; 10 pub type c_ulong = u64; 11 12 pub type speed_t = ::c_uint; 13 pub type mode_t = u32; 14 pub type dev_t = i16; 15 pub type nfds_t = ::c_ulong; 16 pub type socklen_t = u32; 17 pub type sa_family_t = u8; 18 pub type clock_t = c_ulong; 19 pub type time_t = c_long; 20 pub type suseconds_t = c_long; 21 pub type off_t = i64; 22 pub type rlim_t = ::c_ulonglong; 23 pub type sigset_t = ::c_ulong; 24 pub type ino_t = u16; 25 pub type nlink_t = u16; 26 pub type blksize_t = c_long; 27 pub type blkcnt_t = c_long; 28 pub type stat64 = stat; 29 pub type clockid_t = c_ulong; 30 pub type pthread_t = pte_handle_t; 31 pub type pthread_attr_t = usize; 32 pub type pthread_cond_t = usize; 33 pub type pthread_condattr_t = usize; 34 pub type pthread_key_t = usize; 35 pub type pthread_mutex_t = usize; 36 pub type pthread_mutexattr_t = usize; 37 pub type pthread_rwlock_t = usize; 38 pub type pthread_rwlockattr_t = usize; 39 40 s_no_extra_traits! { 41 pub struct dirent { 42 pub d_ino: ::c_long, 43 pub d_off: off_t, 44 pub d_reclen: u16, 45 pub d_name: [::c_char; 256], 46 } 47 48 // Dummy 49 pub struct sockaddr_un { 50 pub sun_family: sa_family_t, 51 pub sun_path: [::c_char; 108], 52 } 53 54 pub struct sockaddr { 55 pub sa_len: u8, 56 pub sa_family: sa_family_t, 57 pub sa_data: [::c_char; 14], 58 } 59 60 pub struct sockaddr_in { 61 pub sin_len: u8, 62 pub sin_family: sa_family_t, 63 pub sin_port: ::in_port_t, 64 pub sin_addr: ::in_addr, 65 pub sin_zero: [::c_char; 8], 66 } 67 68 pub struct fd_set { 69 fds_bits: [::c_ulong; FD_SETSIZE / ULONG_SIZE], 70 } 71 72 pub struct sockaddr_storage { 73 pub s2_len: u8, 74 pub ss_family: sa_family_t, 75 pub s2_data1: [::c_char; 2], 76 pub s2_data2: [u32; 3], 77 pub s2_data3: [u32; 3], 78 } 79 80 pub struct stat { 81 pub st_dev: ::dev_t, 82 pub st_ino: ::ino_t, 83 pub st_mode: ::mode_t, 84 pub st_nlink: ::nlink_t, 85 pub st_uid: ::uid_t, 86 pub st_gid: ::gid_t, 87 pub st_rdev: dev_t, 88 pub st_size: off_t, 89 pub st_atime: time_t, 90 pub st_atime_nsec: ::c_long, 91 pub st_mtime: time_t, 92 pub st_mtime_nsec: ::c_long, 93 pub st_ctime: time_t, 94 pub st_ctime_nsec: ::c_long, 95 pub st_blksize: blksize_t, 96 pub st_blocks: blkcnt_t, 97 pub st_spare4: [::c_long; 2], 98 } 99 } 100 101 cfg_if! { 102 if #[cfg(feature = "extra_traits")] { 103 impl PartialEq for dirent { 104 fn eq(&self, other: &dirent) -> bool { 105 self.d_ino == other.d_ino 106 && self.d_off == other.d_off 107 && self.d_reclen == other.d_reclen 108 && self 109 .d_name 110 .iter() 111 .zip(other.d_name.iter()) 112 .all(|(a,b)| a == b) 113 } 114 } 115 impl Eq for dirent {} 116 impl ::fmt::Debug for dirent { 117 fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { 118 f.debug_struct("dirent") 119 .field("d_ino", &self.d_ino) 120 .field("d_off", &self.d_off) 121 .field("d_reclen", &self.d_reclen) 122 // FIXME: .field("d_name", &self.d_name) 123 .finish() 124 } 125 } 126 impl ::hash::Hash for dirent { 127 fn hash<H: ::hash::Hasher>(&self, state: &mut H) { 128 self.d_ino.hash(state); 129 self.d_off.hash(state); 130 self.d_reclen.hash(state); 131 self.d_name.hash(state); 132 } 133 } 134 135 impl PartialEq for sockaddr_un { 136 fn eq(&self, other: &sockaddr_un) -> bool { 137 self.sun_family == other.sun_family 138 && self 139 .sun_path 140 .iter() 141 .zip(other.sun_path.iter()) 142 .all(|(a,b)| a == b) 143 } 144 } 145 impl Eq for sockaddr_un {} 146 impl ::fmt::Debug for sockaddr_un { 147 fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { 148 f.debug_struct("sockaddr_un") 149 .field("sun_family", &self.sun_family) 150 // FIXME: .field("sun_path", &self.sun_path) 151 .finish() 152 } 153 } 154 impl ::hash::Hash for sockaddr_un { 155 fn hash<H: ::hash::Hasher>(&self, state: &mut H) { 156 self.sun_family.hash(state); 157 self.sun_path.hash(state); 158 } 159 } 160 161 impl PartialEq for sockaddr { 162 fn eq(&self, other: &sockaddr) -> bool { 163 self.sa_len == other.sa_len 164 && self.sa_family == other.sa_family 165 && self 166 .sa_data 167 .iter() 168 .zip(other.sa_data.iter()) 169 .all(|(a,b)| a == b) 170 } 171 } 172 impl Eq for sockaddr {} 173 impl ::fmt::Debug for sockaddr { 174 fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { 175 f.debug_struct("sockaddr") 176 .field("sa_len", &self.sa_len) 177 .field("sa_family", &self.sa_family) 178 // FIXME: .field("sa_data", &self.sa_data) 179 .finish() 180 } 181 } 182 impl ::hash::Hash for sockaddr { 183 fn hash<H: ::hash::Hasher>(&self, state: &mut H) { 184 self.sa_len.hash(state); 185 self.sa_family.hash(state); 186 self.sa_data.hash(state); 187 } 188 } 189 190 impl PartialEq for sockaddr_in { 191 fn eq(&self, other: &sockaddr_in) -> bool { 192 self.sin_len == other.sin_len 193 && self.sin_family == other.sin_family 194 && self.sin_port == other.sin_port 195 && self.sin_addr == other.sin_addr 196 && self 197 .sin_zero 198 .iter() 199 .zip(other.sin_zero.iter()) 200 .all(|(a,b)| a == b) 201 } 202 } 203 impl Eq for sockaddr_in {} 204 impl ::fmt::Debug for sockaddr_in { 205 fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { 206 f.debug_struct("sockaddr_in") 207 .field("sin_len", &self.sin_len) 208 .field("sin_family", &self.sin_family) 209 .field("sin_port", &self.sin_port) 210 .field("sin_addr", &self.sin_addr) 211 // FIXME: .field("sin_zero", &self.sin_zero) 212 .finish() 213 } 214 } 215 impl ::hash::Hash for sockaddr_in { 216 fn hash<H: ::hash::Hasher>(&self, state: &mut H) { 217 self.sin_len.hash(state); 218 self.sin_family.hash(state); 219 self.sin_port.hash(state); 220 self.sin_addr.hash(state); 221 self.sin_zero.hash(state); 222 } 223 } 224 225 impl PartialEq for fd_set { 226 fn eq(&self, other: &fd_set) -> bool { 227 self.fds_bits 228 .iter() 229 .zip(other.fds_bits.iter()) 230 .all(|(a,b)| a == b) 231 } 232 } 233 impl Eq for fd_set {} 234 impl ::fmt::Debug for fd_set { 235 fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { 236 f.debug_struct("fd_set") 237 // FIXME: .field("fds_bits", &self.fds_bits) 238 .finish() 239 } 240 } 241 impl ::hash::Hash for fd_set { 242 fn hash<H: ::hash::Hasher>(&self, state: &mut H) { 243 self.fds_bits.hash(state); 244 } 245 } 246 247 impl PartialEq for sockaddr_storage { 248 fn eq(&self, other: &sockaddr_storage) -> bool { 249 self.s2_len == other.s2_len 250 && self.ss_family == other.ss_family 251 && self.s2_data1 252 .iter() 253 .zip(other.s2_data1.iter()) 254 .all(|(a,b)| a == b) 255 && self.s2_data2 256 .iter() 257 .zip(other.s2_data2.iter()) 258 .all(|(a,b)| a == b) 259 && self.s2_data3 260 .iter() 261 .zip(other.s2_data3.iter()) 262 .all(|(a,b)| a == b) 263 } 264 } 265 impl Eq for sockaddr_storage {} 266 impl ::fmt::Debug for sockaddr_storage { 267 fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { 268 f.debug_struct("sockaddr_storage") 269 .field("s2_len", &self.s2_len) 270 .field("ss_family", &self.ss_family) 271 // FIXME: .field("s2_data1", &self.s2_data1) 272 // FIXME: .field("s2_data2", &self.s2_data2) 273 // FIXME: .field("s2_data3", &self.s2_data3) 274 .finish() 275 } 276 } 277 impl ::hash::Hash for sockaddr_storage { 278 fn hash<H: ::hash::Hasher>(&self, state: &mut H) { 279 self.s2_len.hash(state); 280 self.ss_family.hash(state); 281 self.s2_data1.hash(state); 282 self.s2_data2.hash(state); 283 self.s2_data3.hash(state); 284 } 285 } 286 287 impl PartialEq for stat { 288 fn eq(&self, other: &stat) -> bool { 289 self.st_dev == other.st_dev 290 && self.st_ino == other.st_ino 291 && self.st_mode == other.st_mode 292 && self.st_nlink == other.st_nlink 293 && self.st_uid == other.st_uid 294 && self.st_gid == other.st_gid 295 && self.st_rdev == other.st_rdev 296 && self.st_size == other.st_size 297 && self.st_atime == other.st_atime 298 && self.st_atime_nsec == other.st_atime_nsec 299 && self.st_mtime == other.st_mtime 300 && self.st_mtime_nsec == other.st_mtime_nsec 301 && self.st_ctime == other.st_ctime 302 && self.st_ctime_nsec == other.st_ctime_nsec 303 && self.st_blksize == other.st_blksize 304 && self.st_blocks == other.st_blocks 305 && self 306 .st_spare4 307 .iter() 308 .zip(other.st_spare4.iter()) 309 .all(|(a,b)| a == b) 310 } 311 } 312 impl Eq for stat {} 313 impl ::fmt::Debug for stat { 314 fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { 315 f.debug_struct("stat") 316 .field("st_dev", &self.st_dev) 317 .field("st_ino", &self.st_ino) 318 .field("st_mode", &self.st_mode) 319 .field("st_nlink", &self.st_nlink) 320 .field("st_uid", &self.st_uid) 321 .field("st_gid", &self.st_gid) 322 .field("st_rdev", &self.st_rdev) 323 .field("st_size", &self.st_size) 324 .field("st_atime", &self.st_atime) 325 .field("st_atime_nsec", &self.st_atime_nsec) 326 .field("st_mtime", &self.st_mtime) 327 .field("st_mtime_nsec", &self.st_mtime_nsec) 328 .field("st_ctime", &self.st_ctime) 329 .field("st_ctime_nsec", &self.st_ctime_nsec) 330 .field("st_blksize", &self.st_blksize) 331 .field("st_blocks", &self.st_blocks) 332 // FIXME: .field("st_spare4", &self.st_spare4) 333 .finish() 334 } 335 } 336 impl ::hash::Hash for stat { 337 fn hash<H: ::hash::Hasher>(&self, state: &mut H) { 338 self.st_dev.hash(state); 339 self.st_ino.hash(state); 340 self.st_mode.hash(state); 341 self.st_nlink.hash(state); 342 self.st_uid.hash(state); 343 self.st_gid.hash(state); 344 self.st_rdev.hash(state); 345 self.st_size.hash(state); 346 self.st_atime.hash(state); 347 self.st_atime_nsec.hash(state); 348 self.st_mtime.hash(state); 349 self.st_mtime_nsec.hash(state); 350 self.st_ctime.hash(state); 351 self.st_ctime_nsec.hash(state); 352 self.st_blksize.hash(state); 353 self.st_blocks.hash(state); 354 self.st_spare4.hash(state); 355 } 356 } 357 } 358 } 359 360 s! { 361 pub struct in_addr { 362 pub s_addr: ::in_addr_t, 363 } 364 365 pub struct ip_mreq { 366 pub imr_multiaddr: in_addr, 367 pub imr_interface: in_addr, 368 } 369 370 pub struct addrinfo { 371 pub ai_flags: ::c_int, 372 pub ai_family: ::c_int, 373 pub ai_socktype: ::c_int, 374 pub ai_protocol: ::c_int, 375 pub ai_addrlen: socklen_t, 376 pub ai_addr: *mut ::sockaddr, 377 pub ai_canonname: *mut c_char, 378 pub ai_next: *mut addrinfo, 379 } 380 381 pub struct Dl_info {} 382 383 pub struct lconv { 384 pub decimal_point: *mut ::c_char, 385 pub thousands_sep: *mut ::c_char, 386 pub grouping: *mut ::c_char, 387 pub int_curr_symbol: *mut ::c_char, 388 pub currency_symbol: *mut ::c_char, 389 pub mon_decimal_point: *mut ::c_char, 390 pub mon_thousands_sep: *mut ::c_char, 391 pub mon_grouping: *mut ::c_char, 392 pub positive_sign: *mut ::c_char, 393 pub negative_sign: *mut ::c_char, 394 pub int_frac_digits: ::c_char, 395 pub frac_digits: ::c_char, 396 pub p_cs_precedes: ::c_char, 397 pub p_sep_by_space: ::c_char, 398 pub n_cs_precedes: ::c_char, 399 pub n_sep_by_space: ::c_char, 400 pub p_sign_posn: ::c_char, 401 pub n_sign_posn: ::c_char, 402 pub int_p_cs_precedes: ::c_char, 403 pub int_p_sep_by_space: ::c_char, 404 pub int_n_cs_precedes: ::c_char, 405 pub int_n_sep_by_space: ::c_char, 406 pub int_p_sign_posn: ::c_char, 407 pub int_n_sign_posn: ::c_char, 408 } 409 410 pub struct passwd { // Unverified 411 pub pw_name: *mut ::c_char, 412 pub pw_passwd: *mut ::c_char, 413 pub pw_uid: ::uid_t, 414 pub pw_gid: ::gid_t, 415 pub pw_gecos: *mut ::c_char, 416 pub pw_dir: *mut ::c_char, 417 pub pw_shell: *mut ::c_char, 418 } 419 420 pub struct pte_handle_t { 421 pub p: usize, 422 pub x: ::c_uint, 423 } 424 425 pub struct sched_param { 426 pub sched_priority: ::c_int, 427 } 428 429 pub struct sem_t { 430 pub value: i32, 431 pub lock: usize, 432 pub sem: usize, 433 } 434 435 pub struct sigaction { 436 pub sa_flags: ::c_int, 437 pub sa_mask: sigset_t, 438 pub sa_handler: usize, 439 } 440 441 pub struct sockaddr_in6 { 442 pub sin6_len: u8, 443 pub sin6_family: sa_family_t, 444 pub sin6_port: ::in_port_t, 445 pub sin6_flowinfo: u32, 446 pub sin6_addr: ::in6_addr, 447 pub sin6_scope_id: u32, 448 } 449 450 pub struct statvfs {} 451 452 pub struct tm { 453 pub tm_sec: ::c_int, 454 pub tm_min: ::c_int, 455 pub tm_hour: ::c_int, 456 pub tm_mday: ::c_int, 457 pub tm_mon: ::c_int, 458 pub tm_year: ::c_int, 459 pub tm_wday: ::c_int, 460 pub tm_yday: ::c_int, 461 pub tm_isdst: ::c_int, 462 } 463 464 pub struct tms { 465 pub tms_utime: ::clock_t, 466 pub tms_stime: ::clock_t, 467 pub tms_cutime: ::clock_t, 468 pub tms_cstime: ::clock_t, 469 } 470 471 pub struct termios {} 472 473 pub struct utsname {} 474 } 475 476 pub const AF_UNSPEC: ::c_int = 0; 477 pub const AF_INET: ::c_int = 2; 478 pub const AF_INET6: ::c_int = 10; 479 480 // Dummy 481 pub const AF_UNIX: ::c_int = 1; 482 483 pub const CLOCK_REALTIME: ::clockid_t = 1; 484 pub const CLOCK_MONOTONIC: ::clockid_t = 4; 485 486 // Dummy 487 pub const EAI_SYSTEM: ::c_int = -11; 488 489 pub const EPERM: ::c_int = 1; 490 pub const ENOENT: ::c_int = 2; 491 pub const ESRCH: ::c_int = 3; 492 pub const EINTR: ::c_int = 4; 493 pub const EIO: ::c_int = 5; 494 pub const ENXIO: ::c_int = 6; 495 pub const E2BIG: ::c_int = 7; 496 pub const ENOEXEC: ::c_int = 8; 497 pub const EBADF: ::c_int = 9; 498 pub const ECHILD: ::c_int = 10; 499 pub const EAGAIN: ::c_int = 11; 500 pub const ENOMEM: ::c_int = 12; 501 pub const EACCES: ::c_int = 13; 502 pub const EFAULT: ::c_int = 14; 503 pub const EBUSY: ::c_int = 16; 504 pub const EEXIST: ::c_int = 17; 505 pub const EXDEV: ::c_int = 18; 506 pub const ENODEV: ::c_int = 19; 507 pub const ENOTDIR: ::c_int = 20; 508 pub const EISDIR: ::c_int = 21; 509 pub const EINVAL: ::c_int = 22; 510 pub const ENFILE: ::c_int = 23; 511 pub const EMFILE: ::c_int = 24; 512 pub const ENOTTY: ::c_int = 25; 513 pub const ETXTBSY: ::c_int = 26; 514 pub const EFBIG: ::c_int = 27; 515 pub const ENOSPC: ::c_int = 28; 516 pub const ESPIPE: ::c_int = 29; 517 pub const EROFS: ::c_int = 30; 518 pub const EMLINK: ::c_int = 31; 519 pub const EPIPE: ::c_int = 32; 520 pub const EDOM: ::c_int = 33; 521 pub const ERANGE: ::c_int = 34; 522 pub const EDEADLK: ::c_int = 35; 523 pub const ENAMETOOLONG: ::c_int = 36; 524 pub const ENOLCK: ::c_int = 37; 525 pub const ENOSYS: ::c_int = 38; 526 pub const ENOTEMPTY: ::c_int = 39; 527 pub const ELOOP: ::c_int = 40; 528 pub const EWOULDBLOCK: ::c_int = EAGAIN; 529 pub const ENOMSG: ::c_int = 42; 530 pub const EIDRM: ::c_int = 43; 531 pub const ECHRNG: ::c_int = 44; 532 pub const EL2NSYNC: ::c_int = 45; 533 pub const EL3HLT: ::c_int = 46; 534 pub const EL3RST: ::c_int = 47; 535 pub const ELNRNG: ::c_int = 48; 536 pub const EUNATCH: ::c_int = 49; 537 pub const ENOCSI: ::c_int = 50; 538 pub const EL2HLT: ::c_int = 51; 539 pub const EBADE: ::c_int = 52; 540 pub const EBADR: ::c_int = 53; 541 pub const EXFULL: ::c_int = 54; 542 pub const ENOANO: ::c_int = 55; 543 pub const EBADRQC: ::c_int = 56; 544 pub const EBADSLT: ::c_int = 57; 545 pub const EDEADLOCK: ::c_int = EDEADLK; 546 pub const EBFONT: ::c_int = 59; 547 pub const ENOSTR: ::c_int = 60; 548 pub const ENODATA: ::c_int = 61; 549 pub const ETIME: ::c_int = 62; 550 pub const ENOSR: ::c_int = 63; 551 pub const ENONET: ::c_int = 64; 552 pub const ENOPKG: ::c_int = 65; 553 pub const EREMOTE: ::c_int = 66; 554 pub const ENOLINK: ::c_int = 67; 555 pub const EADV: ::c_int = 68; 556 pub const ESRMNT: ::c_int = 69; 557 pub const ECOMM: ::c_int = 70; 558 pub const EPROTO: ::c_int = 71; 559 pub const EMULTIHOP: ::c_int = 72; 560 pub const EDOTDOT: ::c_int = 73; 561 pub const EBADMSG: ::c_int = 74; 562 pub const EOVERFLOW: ::c_int = 75; 563 pub const ENOTUNIQ: ::c_int = 76; 564 pub const EBADFD: ::c_int = 77; 565 pub const EREMCHG: ::c_int = 78; 566 pub const ELIBACC: ::c_int = 79; 567 pub const ELIBBAD: ::c_int = 80; 568 pub const ELIBSCN: ::c_int = 81; 569 pub const ELIBMAX: ::c_int = 82; 570 pub const ELIBEXEC: ::c_int = 83; 571 pub const EILSEQ: ::c_int = 84; 572 pub const ERESTART: ::c_int = 85; 573 pub const ESTRPIPE: ::c_int = 86; 574 pub const EUSERS: ::c_int = 87; 575 pub const ENOTSOCK: ::c_int = 88; 576 pub const EDESTADDRREQ: ::c_int = 89; 577 pub const EMSGSIZE: ::c_int = 90; 578 pub const EPROTOTYPE: ::c_int = 91; 579 pub const ENOPROTOOPT: ::c_int = 92; 580 pub const EPROTONOSUPPORT: ::c_int = 93; 581 pub const ESOCKTNOSUPPORT: ::c_int = 94; 582 pub const EOPNOTSUPP: ::c_int = 95; 583 pub const EPFNOSUPPORT: ::c_int = 96; 584 pub const EAFNOSUPPORT: ::c_int = 97; 585 pub const EADDRINUSE: ::c_int = 98; 586 pub const EADDRNOTAVAIL: ::c_int = 99; 587 pub const ENETDOWN: ::c_int = 100; 588 pub const ENETUNREACH: ::c_int = 101; 589 pub const ENETRESET: ::c_int = 102; 590 pub const ECONNABORTED: ::c_int = 103; 591 pub const ECONNRESET: ::c_int = 104; 592 pub const ENOBUFS: ::c_int = 105; 593 pub const EISCONN: ::c_int = 106; 594 pub const ENOTCONN: ::c_int = 107; 595 pub const ESHUTDOWN: ::c_int = 108; 596 pub const ETOOMANYREFS: ::c_int = 109; 597 pub const ETIMEDOUT: ::c_int = 110; 598 pub const ECONNREFUSED: ::c_int = 111; 599 pub const EHOSTDOWN: ::c_int = 112; 600 pub const EHOSTUNREACH: ::c_int = 113; 601 pub const EALREADY: ::c_int = 114; 602 pub const EINPROGRESS: ::c_int = 115; 603 pub const ESTALE: ::c_int = 116; 604 pub const EUCLEAN: ::c_int = 117; 605 pub const ENOTNAM: ::c_int = 118; 606 pub const ENAVAIL: ::c_int = 119; 607 pub const EISNAM: ::c_int = 120; 608 pub const EREMOTEIO: ::c_int = 121; 609 pub const EDQUOT: ::c_int = 122; 610 pub const ENOMEDIUM: ::c_int = 123; 611 pub const EMEDIUMTYPE: ::c_int = 124; 612 pub const ECANCELED: ::c_int = 125; 613 pub const ENOKEY: ::c_int = 126; 614 pub const EKEYEXPIRED: ::c_int = 127; 615 pub const EKEYREVOKED: ::c_int = 128; 616 pub const EKEYREJECTED: ::c_int = 129; 617 pub const EOWNERDEAD: ::c_int = 130; 618 pub const ENOTRECOVERABLE: ::c_int = 131; 619 pub const ERFKILL: ::c_int = 132; 620 pub const EHWPOISON: ::c_int = 133; 621 622 pub const EXIT_FAILURE: ::c_int = 1; 623 pub const EXIT_SUCCESS: ::c_int = 0; 624 625 pub const F_DUPFD: ::c_int = 0; 626 pub const F_GETFD: ::c_int = 1; 627 pub const F_SETFD: ::c_int = 2; 628 pub const F_GETFL: ::c_int = 3; 629 pub const F_SETFL: ::c_int = 4; 630 pub const F_GETOWN: ::c_int = 5; 631 pub const F_SETOWN: ::c_int = 6; 632 pub const F_GETLK: ::c_int = 7; 633 pub const F_SETLK: ::c_int = 8; 634 pub const F_SETLKW: ::c_int = 9; 635 pub const F_RGETLK: ::c_int = 10; 636 pub const F_RSETLK: ::c_int = 11; 637 pub const F_CNVT: ::c_int = 12; 638 pub const F_RSETLKW: ::c_int = 13; 639 pub const F_DUPFD_CLOEXEC: ::c_int = 14; 640 641 pub const FD_SETSIZE: usize = 1024; 642 643 // Dummy 644 pub const FIOCLEX: ::c_int = 0x5451; 645 646 pub const FIONBIO: ::c_int = 0x8004667e; 647 pub const FIONREAD: ::c_int = 0x4004667f; 648 649 pub const IP_ADD_MEMBERSHIP: ::c_int = 3; 650 pub const IP_DROP_MEMBERSHIP: ::c_int = 4; 651 652 pub const IP_TOS: ::c_int = 1; 653 pub const IP_TTL: ::c_int = 2; 654 655 pub const IP_MULTICAST_TTL: ::c_int = 5; 656 pub const IP_MULTICAST_IF: ::c_int = 6; 657 pub const IP_MULTICAST_LOOP: ::c_int = 7; 658 659 pub const IPV6_JOIN_GROUP: ::c_int = 12; 660 pub const IPV6_ADD_MEMBERSHIP: ::c_int = 12; 661 pub const IPV6_LEAVE_GROUP: ::c_int = 13; 662 pub const IPV6_DROP_MEMBERSHIP: ::c_int = 13; 663 pub const IPV6_V6ONLY: ::c_int = 27; 664 665 // Dummy 666 pub const IPV6_MULTICAST_LOOP: ::c_int = 7; 667 668 pub const MSG_PEEK: ::c_int = 0x01; 669 pub const MSG_WAITALL: ::c_int = 0x02; 670 pub const MSG_OOB: ::c_int = 0x04; 671 pub const MSG_DONTWAIT: ::c_int = 0x08; 672 pub const MSG_MORE: ::c_int = 0x10; 673 674 pub const O_ACCMODE: ::c_int = 3; 675 pub const O_RDONLY: ::c_int = 0; 676 pub const O_WRONLY: ::c_int = 1; 677 pub const O_RDWR: ::c_int = 2; 678 pub const O_APPEND: ::c_int = 1024; 679 pub const O_CREAT: ::c_int = 64; 680 pub const O_EXCL: ::c_int = 128; 681 pub const O_NOCTTY: ::c_int = 256; 682 pub const O_NONBLOCK: ::c_int = 2048; 683 pub const O_TRUNC: ::c_int = 512; 684 pub const O_CLOEXEC: ::c_int = 524288; 685 686 pub const POLLIN: ::c_short = 0x1; 687 pub const POLLPRI: ::c_short = 0x2; 688 pub const POLLOUT: ::c_short = 0x4; 689 pub const POLLERR: ::c_short = 0x8; 690 pub const POLLHUP: ::c_short = 0x10; 691 pub const POLLNVAL: ::c_short = 0x20; 692 693 pub const PTHREAD_COND_INITIALIZER: pthread_cond_t = usize::max_value(); 694 pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = usize::max_value(); 695 pub const PTHREAD_RWLOCK_INITIALIZER: pthread_rwlock_t = usize::max_value(); 696 697 pub const PTHREAD_MUTEX_NORMAL: ::c_int = 0; 698 pub const PTHREAD_MUTEX_RECURSIVE: ::c_int = 1; 699 pub const PTHREAD_STACK_MIN: ::size_t = 0; 700 701 // Dummy 702 pub const RTLD_DEFAULT: *mut ::c_void = 0i64 as *mut ::c_void; 703 704 pub const _SC_ARG_MAX: ::c_int = 0; 705 pub const _SC_CHILD_MAX: ::c_int = 1; 706 pub const _SC_CLK_TCK: ::c_int = 2; 707 pub const _SC_NGROUPS_MAX: ::c_int = 3; 708 pub const _SC_OPEN_MAX: ::c_int = 4; 709 pub const _SC_JOB_CONTROL: ::c_int = 5; 710 pub const _SC_SAVED_IDS: ::c_int = 6; 711 pub const _SC_VERSION: ::c_int = 7; 712 pub const _SC_PAGESIZE: ::c_int = 8; 713 pub const _SC_PAGE_SIZE: ::c_int = _SC_PAGESIZE; 714 pub const _SC_NPROCESSORS_CONF: ::c_int = 9; 715 pub const _SC_NPROCESSORS_ONLN: ::c_int = 10; 716 pub const _SC_PHYS_PAGES: ::c_int = 11; 717 pub const _SC_AVPHYS_PAGES: ::c_int = 12; 718 pub const _SC_MQ_OPEN_MAX: ::c_int = 13; 719 pub const _SC_MQ_PRIO_MAX: ::c_int = 14; 720 pub const _SC_RTSIG_MAX: ::c_int = 15; 721 pub const _SC_SEM_NSEMS_MAX: ::c_int = 16; 722 pub const _SC_SEM_VALUE_MAX: ::c_int = 17; 723 pub const _SC_SIGQUEUE_MAX: ::c_int = 18; 724 pub const _SC_TIMER_MAX: ::c_int = 19; 725 pub const _SC_TZNAME_MAX: ::c_int = 20; 726 pub const _SC_ASYNCHRONOUS_IO: ::c_int = 21; 727 pub const _SC_FSYNC: ::c_int = 22; 728 pub const _SC_MAPPED_FILES: ::c_int = 23; 729 pub const _SC_MEMLOCK: ::c_int = 24; 730 pub const _SC_MEMLOCK_RANGE: ::c_int = 25; 731 pub const _SC_MEMORY_PROTECTION: ::c_int = 26; 732 pub const _SC_MESSAGE_PASSING: ::c_int = 27; 733 pub const _SC_PRIORITIZED_IO: ::c_int = 28; 734 pub const _SC_REALTIME_SIGNALS: ::c_int = 29; 735 pub const _SC_SEMAPHORES: ::c_int = 30; 736 pub const _SC_SHARED_MEMORY_OBJECTS: ::c_int = 31; 737 pub const _SC_SYNCHRONIZED_IO: ::c_int = 32; 738 pub const _SC_TIMERS: ::c_int = 33; 739 pub const _SC_AIO_LISTIO_MAX: ::c_int = 34; 740 pub const _SC_AIO_MAX: ::c_int = 35; 741 pub const _SC_AIO_PRIO_DELTA_MAX: ::c_int = 36; 742 pub const _SC_DELAYTIMER_MAX: ::c_int = 37; 743 pub const _SC_THREAD_KEYS_MAX: ::c_int = 38; 744 pub const _SC_THREAD_STACK_MIN: ::c_int = 39; 745 pub const _SC_THREAD_THREADS_MAX: ::c_int = 40; 746 pub const _SC_TTY_NAME_MAX: ::c_int = 41; 747 pub const _SC_THREADS: ::c_int = 42; 748 pub const _SC_THREAD_ATTR_STACKADDR: ::c_int = 43; 749 pub const _SC_THREAD_ATTR_STACKSIZE: ::c_int = 44; 750 pub const _SC_THREAD_PRIORITY_SCHEDULING: ::c_int = 45; 751 pub const _SC_THREAD_PRIO_INHERIT: ::c_int = 46; 752 pub const _SC_THREAD_PRIO_PROTECT: ::c_int = 47; 753 pub const _SC_THREAD_PRIO_CEILING: ::c_int = _SC_THREAD_PRIO_PROTECT; 754 pub const _SC_THREAD_PROCESS_SHARED: ::c_int = 48; 755 pub const _SC_THREAD_SAFE_FUNCTIONS: ::c_int = 49; 756 pub const _SC_GETGR_R_SIZE_MAX: ::c_int = 50; 757 pub const _SC_GETPW_R_SIZE_MAX: ::c_int = 51; 758 pub const _SC_LOGIN_NAME_MAX: ::c_int = 52; 759 pub const _SC_THREAD_DESTRUCTOR_ITERATIONS: ::c_int = 53; 760 pub const _SC_ADVISORY_INFO: ::c_int = 54; 761 pub const _SC_ATEXIT_MAX: ::c_int = 55; 762 pub const _SC_BARRIERS: ::c_int = 56; 763 pub const _SC_BC_BASE_MAX: ::c_int = 57; 764 pub const _SC_BC_DIM_MAX: ::c_int = 58; 765 pub const _SC_BC_SCALE_MAX: ::c_int = 59; 766 pub const _SC_BC_STRING_MAX: ::c_int = 60; 767 pub const _SC_CLOCK_SELECTION: ::c_int = 61; 768 pub const _SC_COLL_WEIGHTS_MAX: ::c_int = 62; 769 pub const _SC_CPUTIME: ::c_int = 63; 770 pub const _SC_EXPR_NEST_MAX: ::c_int = 64; 771 pub const _SC_HOST_NAME_MAX: ::c_int = 65; 772 pub const _SC_IOV_MAX: ::c_int = 66; 773 pub const _SC_IPV6: ::c_int = 67; 774 pub const _SC_LINE_MAX: ::c_int = 68; 775 pub const _SC_MONOTONIC_CLOCK: ::c_int = 69; 776 pub const _SC_RAW_SOCKETS: ::c_int = 70; 777 pub const _SC_READER_WRITER_LOCKS: ::c_int = 71; 778 pub const _SC_REGEXP: ::c_int = 72; 779 pub const _SC_RE_DUP_MAX: ::c_int = 73; 780 pub const _SC_SHELL: ::c_int = 74; 781 pub const _SC_SPAWN: ::c_int = 75; 782 pub const _SC_SPIN_LOCKS: ::c_int = 76; 783 pub const _SC_SPORADIC_SERVER: ::c_int = 77; 784 pub const _SC_SS_REPL_MAX: ::c_int = 78; 785 pub const _SC_SYMLOOP_MAX: ::c_int = 79; 786 pub const _SC_THREAD_CPUTIME: ::c_int = 80; 787 pub const _SC_THREAD_SPORADIC_SERVER: ::c_int = 81; 788 pub const _SC_TIMEOUTS: ::c_int = 82; 789 pub const _SC_TRACE: ::c_int = 83; 790 pub const _SC_TRACE_EVENT_FILTER: ::c_int = 84; 791 pub const _SC_TRACE_EVENT_NAME_MAX: ::c_int = 85; 792 pub const _SC_TRACE_INHERIT: ::c_int = 86; 793 pub const _SC_TRACE_LOG: ::c_int = 87; 794 pub const _SC_TRACE_NAME_MAX: ::c_int = 88; 795 pub const _SC_TRACE_SYS_MAX: ::c_int = 89; 796 pub const _SC_TRACE_USER_EVENT_MAX: ::c_int = 90; 797 pub const _SC_TYPED_MEMORY_OBJECTS: ::c_int = 91; 798 pub const _SC_V7_ILP32_OFF32: ::c_int = 92; 799 pub const _SC_V6_ILP32_OFF32: ::c_int = _SC_V7_ILP32_OFF32; 800 pub const _SC_XBS5_ILP32_OFF32: ::c_int = _SC_V7_ILP32_OFF32; 801 pub const _SC_V7_ILP32_OFFBIG: ::c_int = 93; 802 pub const _SC_V6_ILP32_OFFBIG: ::c_int = _SC_V7_ILP32_OFFBIG; 803 pub const _SC_XBS5_ILP32_OFFBIG: ::c_int = _SC_V7_ILP32_OFFBIG; 804 pub const _SC_V7_LP64_OFF64: ::c_int = 94; 805 pub const _SC_V6_LP64_OFF64: ::c_int = _SC_V7_LP64_OFF64; 806 pub const _SC_XBS5_LP64_OFF64: ::c_int = _SC_V7_LP64_OFF64; 807 pub const _SC_V7_LPBIG_OFFBIG: ::c_int = 95; 808 pub const _SC_V6_LPBIG_OFFBIG: ::c_int = _SC_V7_LPBIG_OFFBIG; 809 pub const _SC_XBS5_LPBIG_OFFBIG: ::c_int = _SC_V7_LPBIG_OFFBIG; 810 pub const _SC_XOPEN_CRYPT: ::c_int = 96; 811 pub const _SC_XOPEN_ENH_I18N: ::c_int = 97; 812 pub const _SC_XOPEN_LEGACY: ::c_int = 98; 813 pub const _SC_XOPEN_REALTIME: ::c_int = 99; 814 pub const _SC_STREAM_MAX: ::c_int = 100; 815 pub const _SC_PRIORITY_SCHEDULING: ::c_int = 101; 816 pub const _SC_XOPEN_REALTIME_THREADS: ::c_int = 102; 817 pub const _SC_XOPEN_SHM: ::c_int = 103; 818 pub const _SC_XOPEN_STREAMS: ::c_int = 104; 819 pub const _SC_XOPEN_UNIX: ::c_int = 105; 820 pub const _SC_XOPEN_VERSION: ::c_int = 106; 821 pub const _SC_2_CHAR_TERM: ::c_int = 107; 822 pub const _SC_2_C_BIND: ::c_int = 108; 823 pub const _SC_2_C_DEV: ::c_int = 109; 824 pub const _SC_2_FORT_DEV: ::c_int = 110; 825 pub const _SC_2_FORT_RUN: ::c_int = 111; 826 pub const _SC_2_LOCALEDEF: ::c_int = 112; 827 pub const _SC_2_PBS: ::c_int = 113; 828 pub const _SC_2_PBS_ACCOUNTING: ::c_int = 114; 829 pub const _SC_2_PBS_CHECKPOINT: ::c_int = 115; 830 pub const _SC_2_PBS_LOCATE: ::c_int = 116; 831 pub const _SC_2_PBS_MESSAGE: ::c_int = 117; 832 pub const _SC_2_PBS_TRACK: ::c_int = 118; 833 pub const _SC_2_SW_DEV: ::c_int = 119; 834 pub const _SC_2_UPE: ::c_int = 120; 835 pub const _SC_2_VERSION: ::c_int = 121; 836 pub const _SC_THREAD_ROBUST_PRIO_INHERIT: ::c_int = 122; 837 pub const _SC_THREAD_ROBUST_PRIO_PROTECT: ::c_int = 123; 838 pub const _SC_XOPEN_UUCP: ::c_int = 124; 839 pub const _SC_LEVEL1_ICACHE_SIZE: ::c_int = 125; 840 pub const _SC_LEVEL1_ICACHE_ASSOC: ::c_int = 126; 841 pub const _SC_LEVEL1_ICACHE_LINESIZE: ::c_int = 127; 842 pub const _SC_LEVEL1_DCACHE_SIZE: ::c_int = 128; 843 pub const _SC_LEVEL1_DCACHE_ASSOC: ::c_int = 129; 844 pub const _SC_LEVEL1_DCACHE_LINESIZE: ::c_int = 130; 845 pub const _SC_LEVEL2_CACHE_SIZE: ::c_int = 131; 846 pub const _SC_LEVEL2_CACHE_ASSOC: ::c_int = 132; 847 pub const _SC_LEVEL2_CACHE_LINESIZE: ::c_int = 133; 848 pub const _SC_LEVEL3_CACHE_SIZE: ::c_int = 134; 849 pub const _SC_LEVEL3_CACHE_ASSOC: ::c_int = 135; 850 pub const _SC_LEVEL3_CACHE_LINESIZE: ::c_int = 136; 851 pub const _SC_LEVEL4_CACHE_SIZE: ::c_int = 137; 852 pub const _SC_LEVEL4_CACHE_ASSOC: ::c_int = 138; 853 pub const _SC_LEVEL4_CACHE_LINESIZE: ::c_int = 139; 854 855 pub const S_BLKSIZE: ::mode_t = 1024; 856 pub const S_IREAD: ::mode_t = 256; 857 pub const S_IWRITE: ::mode_t = 128; 858 pub const S_IEXEC: ::mode_t = 64; 859 pub const S_ENFMT: ::mode_t = 1024; 860 pub const S_IFMT: ::mode_t = 61440; 861 pub const S_IFDIR: ::mode_t = 16384; 862 pub const S_IFCHR: ::mode_t = 8192; 863 pub const S_IFBLK: ::mode_t = 24576; 864 pub const S_IFREG: ::mode_t = 32768; 865 pub const S_IFLNK: ::mode_t = 40960; 866 pub const S_IFSOCK: ::mode_t = 49152; 867 pub const S_IFIFO: ::mode_t = 4096; 868 pub const S_IRUSR: ::mode_t = 256; 869 pub const S_IWUSR: ::mode_t = 128; 870 pub const S_IXUSR: ::mode_t = 64; 871 pub const S_IRGRP: ::mode_t = 32; 872 pub const S_IWGRP: ::mode_t = 16; 873 pub const S_IXGRP: ::mode_t = 8; 874 pub const S_IROTH: ::mode_t = 4; 875 pub const S_IWOTH: ::mode_t = 2; 876 pub const S_IXOTH: ::mode_t = 1; 877 878 pub const SEEK_SET: ::c_int = 0; 879 pub const SEEK_CUR: ::c_int = 1; 880 pub const SEEK_END: ::c_int = 2; 881 882 pub const SHUT_RD: ::c_int = 0; 883 pub const SHUT_WR: ::c_int = 1; 884 pub const SHUT_RDWR: ::c_int = 2; 885 886 pub const SIG_SETMASK: ::c_int = 0; 887 888 pub const SIGHUP: ::c_int = 1; 889 pub const SIGINT: ::c_int = 2; 890 pub const SIGQUIT: ::c_int = 3; 891 pub const SIGILL: ::c_int = 4; 892 pub const SIGABRT: ::c_int = 6; 893 pub const SIGEMT: ::c_int = 7; 894 pub const SIGFPE: ::c_int = 8; 895 pub const SIGKILL: ::c_int = 9; 896 pub const SIGSEGV: ::c_int = 11; 897 pub const SIGPIPE: ::c_int = 13; 898 pub const SIGALRM: ::c_int = 14; 899 pub const SIGTERM: ::c_int = 15; 900 901 pub const SO_DEBUG: ::c_int = 0x0001; 902 pub const SO_ACCEPTCONN: ::c_int = 0x0002; 903 pub const SO_REUSEADDR: ::c_int = 0x0004; 904 pub const SO_KEEPALIVE: ::c_int = 0x0008; 905 pub const SO_DONTROUTE: ::c_int = 0x0010; 906 pub const SO_BROADCAST: ::c_int = 0x0020; 907 pub const SO_USELOOPBACK: ::c_int = 0x0040; 908 pub const SO_LINGER: ::c_int = 0x0080; 909 pub const SO_OOBINLINE: ::c_int = 0x0100; 910 pub const SO_REUSEPORT: ::c_int = 0x0200; 911 pub const SO_SNDBUF: ::c_int = 0x1001; 912 pub const SO_RCVBUF: ::c_int = 0x1002; 913 pub const SO_SNDLOWAT: ::c_int = 0x1003; 914 pub const SO_RCVLOWAT: ::c_int = 0x1004; 915 pub const SO_SNDTIMEO: ::c_int = 0x1005; 916 pub const SO_RCVTIMEO: ::c_int = 0x1006; 917 pub const SO_ERROR: ::c_int = 0x1007; 918 pub const SO_TYPE: ::c_int = 0x1008; 919 pub const SO_CONTIMEO: ::c_int = 0x1009; 920 pub const SO_NO_CHECK: ::c_int = 0x100a; 921 922 pub const SOCK_STREAM: ::c_int = 1; 923 pub const SOCK_DGRAM: ::c_int = 2; 924 pub const SOCK_RAW: ::c_int = 3; 925 926 pub const SOL_SOCKET: ::c_int = 0xfff; 927 928 pub const STDIN_FILENO: ::c_int = 0; 929 pub const STDOUT_FILENO: ::c_int = 1; 930 pub const STDERR_FILENO: ::c_int = 2; 931 932 pub const TCP_NODELAY: ::c_int = 0x01; 933 pub const TCP_KEEPALIVE: ::c_int = 0x02; 934 pub const TCP_KEEPIDLE: ::c_int = 0x03; 935 pub const TCP_KEEPINTVL: ::c_int = 0x04; 936 pub const TCP_KEEPCNT: ::c_int = 0x05; 937 938 const ULONG_SIZE: usize = 64; 939 940 pub const WNOHANG: ::c_int = 0x00000001; 941 942 pub const PRIO_PROCESS: ::c_int = 0; 943 pub const PRIO_PGRP: ::c_int = 1; 944 pub const PRIO_USER: ::c_int = 2; 945 946 safe_f! { 947 pub {const} fn WEXITSTATUS(status: ::c_int) -> ::c_int { 948 (status >> 8) & 0xff 949 } 950 951 pub {const} fn WIFEXITED(status: ::c_int) -> bool { 952 (status & 0xff) == 0 953 } 954 955 pub {const} fn WTERMSIG(status: ::c_int) -> ::c_int { 956 status & 0x7f 957 } 958 } 959 960 extern "C" { getrlimit(resource: ::c_int, rlim: *mut ::rlimit) -> ::c_int961 pub fn getrlimit(resource: ::c_int, rlim: *mut ::rlimit) -> ::c_int; setrlimit(resource: ::c_int, rlim: *const ::rlimit) -> ::c_int962 pub fn setrlimit(resource: ::c_int, rlim: *const ::rlimit) -> ::c_int; strerror_r(errnum: ::c_int, buf: *mut c_char, buflen: ::size_t) -> ::c_int963 pub fn strerror_r(errnum: ::c_int, buf: *mut c_char, buflen: ::size_t) -> ::c_int; 964 sem_destroy(sem: *mut sem_t) -> ::c_int965 pub fn sem_destroy(sem: *mut sem_t) -> ::c_int; sem_init(sem: *mut sem_t, pshared: ::c_int, value: ::c_uint) -> ::c_int966 pub fn sem_init(sem: *mut sem_t, pshared: ::c_int, value: ::c_uint) -> ::c_int; 967 abs(i: ::c_int) -> ::c_int968 pub fn abs(i: ::c_int) -> ::c_int; atof(s: *const ::c_char) -> ::c_double969 pub fn atof(s: *const ::c_char) -> ::c_double; labs(i: ::c_long) -> ::c_long970 pub fn labs(i: ::c_long) -> ::c_long; rand() -> ::c_int971 pub fn rand() -> ::c_int; srand(seed: ::c_uint)972 pub fn srand(seed: ::c_uint); 973 bind(s: ::c_int, name: *const ::sockaddr, namelen: ::socklen_t) -> ::c_int974 pub fn bind(s: ::c_int, name: *const ::sockaddr, namelen: ::socklen_t) -> ::c_int; 975 clock_gettime(clock_id: ::clockid_t, tp: *mut ::timespec) -> ::c_int976 pub fn clock_gettime(clock_id: ::clockid_t, tp: *mut ::timespec) -> ::c_int; 977 gettimeofday(tp: *mut ::timeval, tz: *mut ::c_void) -> ::c_int978 pub fn gettimeofday(tp: *mut ::timeval, tz: *mut ::c_void) -> ::c_int; getpwuid_r( uid: ::uid_t, pwd: *mut passwd, buf: *mut ::c_char, buflen: ::size_t, result: *mut *mut passwd, ) -> ::c_int979 pub fn getpwuid_r( 980 uid: ::uid_t, 981 pwd: *mut passwd, 982 buf: *mut ::c_char, 983 buflen: ::size_t, 984 result: *mut *mut passwd, 985 ) -> ::c_int; 986 987 // Dummy ioctl(fd: ::c_int, request: ::c_int, ...) -> ::c_int988 pub fn ioctl(fd: ::c_int, request: ::c_int, ...) -> ::c_int; 989 memalign(align: ::size_t, nbytes: ::size_t) -> *mut ::c_void990 pub fn memalign(align: ::size_t, nbytes: ::size_t) -> *mut ::c_void; 991 pthread_create( tid: *mut ::pthread_t, attr: *const ::pthread_attr_t, start: extern "C" fn(*mut ::c_void) -> *mut ::c_void, arg: *mut ::c_void, ) -> ::c_int992 pub fn pthread_create( 993 tid: *mut ::pthread_t, 994 attr: *const ::pthread_attr_t, 995 start: extern "C" fn(*mut ::c_void) -> *mut ::c_void, 996 arg: *mut ::c_void, 997 ) -> ::c_int; 998 pthread_sigmask(how: ::c_int, set: *const ::sigset_t, oset: *mut ::sigset_t) -> ::c_int999 pub fn pthread_sigmask(how: ::c_int, set: *const ::sigset_t, oset: *mut ::sigset_t) -> ::c_int; 1000 recvfrom( s: ::c_int, mem: *mut ::c_void, len: ::size_t, flags: ::c_int, from: *mut ::sockaddr, fromlen: *mut ::socklen_t, ) -> ::c_int1001 pub fn recvfrom( 1002 s: ::c_int, 1003 mem: *mut ::c_void, 1004 len: ::size_t, 1005 flags: ::c_int, 1006 from: *mut ::sockaddr, 1007 fromlen: *mut ::socklen_t, 1008 ) -> ::c_int; 1009 setgroups(ngroups: ::c_int, grouplist: *const ::gid_t) -> ::c_int1010 pub fn setgroups(ngroups: ::c_int, grouplist: *const ::gid_t) -> ::c_int; uname(buf: *mut ::utsname) -> ::c_int1011 pub fn uname(buf: *mut ::utsname) -> ::c_int; 1012 } 1013 1014 cfg_if! { 1015 if #[cfg(target_arch = "aarch64")] { 1016 mod aarch64; 1017 pub use self::aarch64::*; 1018 } else if #[cfg(target_arch = "x86_64")] { 1019 mod x86_64; 1020 pub use self::x86_64::*; 1021 } else { 1022 // Unknown target_arch 1023 } 1024 } 1025