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