Debian Codegraph @

debian/rust-vendor/libc/src/fuchsia/mod.rs

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