Debian Codegraph @

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