1 use crate::off_t;
2 use crate::prelude::*;
3 
4 pub type mode_t = u16;
5 pub type pthread_attr_t = *mut c_void;
6 pub type rlim_t = i64;
7 pub type pthread_mutex_t = *mut c_void;
8 pub type pthread_mutexattr_t = *mut c_void;
9 pub type pthread_cond_t = *mut c_void;
10 pub type pthread_condattr_t = *mut c_void;
11 pub type pthread_rwlock_t = *mut c_void;
12 pub type pthread_rwlockattr_t = *mut c_void;
13 pub type pthread_key_t = c_int;
14 pub type tcflag_t = c_uint;
15 pub type speed_t = c_uint;
16 pub type nl_item = c_int;
17 pub type id_t = i64;
18 pub type vm_size_t = crate::uintptr_t;
19 pub type key_t = c_long;
20 
21 // elf.h
22 
23 pub type Elf32_Addr = u32;
24 pub type Elf32_Half = u16;
25 pub type Elf32_Lword = u64;
26 pub type Elf32_Off = u32;
27 pub type Elf32_Sword = i32;
28 pub type Elf32_Word = u32;
29 
30 pub type Elf64_Addr = u64;
31 pub type Elf64_Half = u16;
32 pub type Elf64_Lword = u64;
33 pub type Elf64_Off = u64;
34 pub type Elf64_Sword = i32;
35 pub type Elf64_Sxword = i64;
36 pub type Elf64_Word = u32;
37 pub type Elf64_Xword = u64;
38 
39 pub type iconv_t = *mut c_void;
40 
41 // It's an alias over "struct __kvm_t". However, its fields aren't supposed to be used directly,
42 // making the type definition system dependent. Better not bind it exactly.
43 pub type kvm_t = c_void;
44 
45 pub type posix_spawnattr_t = *mut c_void;
46 pub type posix_spawn_file_actions_t = *mut c_void;
47 
48 cfg_if! {
49     if #[cfg(target_pointer_width = "64")] {
50         type Elf_Addr = Elf64_Addr;
51         type Elf_Half = Elf64_Half;
52         type Elf_Phdr = Elf64_Phdr;
53     } else if #[cfg(target_pointer_width = "32")] {
54         type Elf_Addr = Elf32_Addr;
55         type Elf_Half = Elf32_Half;
56         type Elf_Phdr = Elf32_Phdr;
57     }
58 }
59 
60 // link.h
61 
62 #[cfg_attr(feature = "extra_traits", derive(Debug))]
63 pub enum timezone {}
64 impl Copy for timezone {}
65 impl Clone for timezone {
clone(&self) -> timezone66     fn clone(&self) -> timezone {
67         *self
68     }
69 }
70 
71 impl siginfo_t {
si_addr(&self) -> *mut c_void72     pub unsafe fn si_addr(&self) -> *mut c_void {
73         self.si_addr
74     }
75 
si_value(&self) -> crate::sigval76     pub unsafe fn si_value(&self) -> crate::sigval {
77         self.si_value
78     }
79 
si_pid(&self) -> crate::pid_t80     pub unsafe fn si_pid(&self) -> crate::pid_t {
81         self.si_pid
82     }
83 
si_uid(&self) -> crate::uid_t84     pub unsafe fn si_uid(&self) -> crate::uid_t {
85         self.si_uid
86     }
87 
si_status(&self) -> c_int88     pub unsafe fn si_status(&self) -> c_int {
89         self.si_status
90     }
91 }
92 
93 s! {
94     pub struct in_addr {
95         pub s_addr: crate::in_addr_t,
96     }
97 
98     pub struct ip_mreq {
99         pub imr_multiaddr: in_addr,
100         pub imr_interface: in_addr,
101     }
102 
103     pub struct ip_mreqn {
104         pub imr_multiaddr: in_addr,
105         pub imr_address: in_addr,
106         pub imr_ifindex: c_int,
107     }
108 
109     pub struct ip_mreq_source {
110         pub imr_multiaddr: in_addr,
111         pub imr_sourceaddr: in_addr,
112         pub imr_interface: in_addr,
113     }
114 
115     pub struct glob_t {
116         pub gl_pathc: size_t,
117         pub gl_matchc: size_t,
118         pub gl_offs: size_t,
119         pub gl_flags: c_int,
120         pub gl_pathv: *mut *mut c_char,
121         __unused3: *mut c_void,
122         __unused4: *mut c_void,
123         __unused5: *mut c_void,
124         __unused6: *mut c_void,
125         __unused7: *mut c_void,
126         __unused8: *mut c_void,
127     }
128 
129     pub struct addrinfo {
130         pub ai_flags: c_int,
131         pub ai_family: c_int,
132         pub ai_socktype: c_int,
133         pub ai_protocol: c_int,
134         pub ai_addrlen: crate::socklen_t,
135         pub ai_canonname: *mut c_char,
136         pub ai_addr: *mut crate::sockaddr,
137         pub ai_next: *mut addrinfo,
138     }
139 
140     pub struct sigset_t {
141         bits: [u32; 4],
142     }
143 
144     pub struct siginfo_t {
145         pub si_signo: c_int,
146         pub si_errno: c_int,
147         pub si_code: c_int,
148         pub si_pid: crate::pid_t,
149         pub si_uid: crate::uid_t,
150         pub si_status: c_int,
151         pub si_addr: *mut c_void,
152         pub si_value: crate::sigval,
153         _pad1: c_long,
154         _pad2: [c_int; 7],
155     }
156 
157     pub struct sigaction {
158         pub sa_sigaction: crate::sighandler_t,
159         pub sa_flags: c_int,
160         pub sa_mask: sigset_t,
161     }
162 
163     pub struct sched_param {
164         pub sched_priority: c_int,
165     }
166 
167     pub struct Dl_info {
168         pub dli_fname: *const c_char,
169         pub dli_fbase: *mut c_void,
170         pub dli_sname: *const c_char,
171         pub dli_saddr: *mut c_void,
172     }
173 
174     pub struct sockaddr_in {
175         pub sin_len: u8,
176         pub sin_family: crate::sa_family_t,
177         pub sin_port: crate::in_port_t,
178         pub sin_addr: crate::in_addr,
179         pub sin_zero: [c_char; 8],
180     }
181 
182     pub struct termios {
183         pub c_iflag: crate::tcflag_t,
184         pub c_oflag: crate::tcflag_t,
185         pub c_cflag: crate::tcflag_t,
186         pub c_lflag: crate::tcflag_t,
187         pub c_cc: [crate::cc_t; crate::NCCS],
188         pub c_ispeed: crate::speed_t,
189         pub c_ospeed: crate::speed_t,
190     }
191 
192     pub struct flock {
193         pub l_start: off_t,
194         pub l_len: off_t,
195         pub l_pid: crate::pid_t,
196         pub l_type: c_short,
197         pub l_whence: c_short,
198         #[cfg(not(target_os = "dragonfly"))]
199         pub l_sysid: c_int,
200     }
201 
202     pub struct sf_hdtr {
203         pub headers: *mut crate::iovec,
204         pub hdr_cnt: c_int,
205         pub trailers: *mut crate::iovec,
206         pub trl_cnt: c_int,
207     }
208 
209     pub struct lconv {
210         pub decimal_point: *mut c_char,
211         pub thousands_sep: *mut c_char,
212         pub grouping: *mut c_char,
213         pub int_curr_symbol: *mut c_char,
214         pub currency_symbol: *mut c_char,
215         pub mon_decimal_point: *mut c_char,
216         pub mon_thousands_sep: *mut c_char,
217         pub mon_grouping: *mut c_char,
218         pub positive_sign: *mut c_char,
219         pub negative_sign: *mut c_char,
220         pub int_frac_digits: c_char,
221         pub frac_digits: c_char,
222         pub p_cs_precedes: c_char,
223         pub p_sep_by_space: c_char,
224         pub n_cs_precedes: c_char,
225         pub n_sep_by_space: c_char,
226         pub p_sign_posn: c_char,
227         pub n_sign_posn: c_char,
228         pub int_p_cs_precedes: c_char,
229         pub int_n_cs_precedes: c_char,
230         pub int_p_sep_by_space: c_char,
231         pub int_n_sep_by_space: c_char,
232         pub int_p_sign_posn: c_char,
233         pub int_n_sign_posn: c_char,
234     }
235 
236     pub struct cmsgcred {
237         pub cmcred_pid: crate::pid_t,
238         pub cmcred_uid: crate::uid_t,
239         pub cmcred_euid: crate::uid_t,
240         pub cmcred_gid: crate::gid_t,
241         pub cmcred_ngroups: c_short,
242         pub cmcred_groups: [crate::gid_t; CMGROUP_MAX],
243     }
244 
245     pub struct rtprio {
246         pub type_: c_ushort,
247         pub prio: c_ushort,
248     }
249 
250     pub struct in6_pktinfo {
251         pub ipi6_addr: crate::in6_addr,
252         pub ipi6_ifindex: c_uint,
253     }
254 
255     pub struct arphdr {
256         pub ar_hrd: u16,
257         pub ar_pro: u16,
258         pub ar_hln: u8,
259         pub ar_pln: u8,
260         pub ar_op: u16,
261     }
262 
263     pub struct timex {
264         pub modes: c_uint,
265         pub offset: c_long,
266         pub freq: c_long,
267         pub maxerror: c_long,
268         pub esterror: c_long,
269         pub status: c_int,
270         pub constant: c_long,
271         pub precision: c_long,
272         pub tolerance: c_long,
273         pub ppsfreq: c_long,
274         pub jitter: c_long,
275         pub shift: c_int,
276         pub stabil: c_long,
277         pub jitcnt: c_long,
278         pub calcnt: c_long,
279         pub errcnt: c_long,
280         pub stbcnt: c_long,
281     }
282 
283     pub struct ntptimeval {
284         pub time: crate::timespec,
285         pub maxerror: c_long,
286         pub esterror: c_long,
287         pub tai: c_long,
288         pub time_state: c_int,
289     }
290 
291     pub struct accept_filter_arg {
292         pub af_name: [c_char; 16],
293         af_arg: [c_char; 256 - 16],
294     }
295 
296     pub struct ptrace_io_desc {
297         pub piod_op: c_int,
298         pub piod_offs: *mut c_void,
299         pub piod_addr: *mut c_void,
300         pub piod_len: size_t,
301     }
302 
303     // bpf.h
304 
305     pub struct bpf_program {
306         pub bf_len: c_uint,
307         pub bf_insns: *mut bpf_insn,
308     }
309 
310     pub struct bpf_stat {
311         pub bs_recv: c_uint,
312         pub bs_drop: c_uint,
313     }
314 
315     pub struct bpf_version {
316         pub bv_major: c_ushort,
317         pub bv_minor: c_ushort,
318     }
319 
320     pub struct bpf_hdr {
321         pub bh_tstamp: crate::timeval,
322         pub bh_caplen: u32,
323         pub bh_datalen: u32,
324         pub bh_hdrlen: c_ushort,
325     }
326 
327     pub struct bpf_insn {
328         pub code: c_ushort,
329         pub jt: c_uchar,
330         pub jf: c_uchar,
331         pub k: u32,
332     }
333 
334     pub struct bpf_dltlist {
335         bfl_len: c_uint,
336         bfl_list: *mut c_uint,
337     }
338 
339     // elf.h
340 
341     pub struct Elf32_Phdr {
342         pub p_type: Elf32_Word,
343         pub p_offset: Elf32_Off,
344         pub p_vaddr: Elf32_Addr,
345         pub p_paddr: Elf32_Addr,
346         pub p_filesz: Elf32_Word,
347         pub p_memsz: Elf32_Word,
348         pub p_flags: Elf32_Word,
349         pub p_align: Elf32_Word,
350     }
351 
352     pub struct Elf64_Phdr {
353         pub p_type: Elf64_Word,
354         pub p_flags: Elf64_Word,
355         pub p_offset: Elf64_Off,
356         pub p_vaddr: Elf64_Addr,
357         pub p_paddr: Elf64_Addr,
358         pub p_filesz: Elf64_Xword,
359         pub p_memsz: Elf64_Xword,
360         pub p_align: Elf64_Xword,
361     }
362 
363     // link.h
364 
365     pub struct dl_phdr_info {
366         pub dlpi_addr: Elf_Addr,
367         pub dlpi_name: *const c_char,
368         pub dlpi_phdr: *const Elf_Phdr,
369         pub dlpi_phnum: Elf_Half,
370         pub dlpi_adds: c_ulonglong,
371         pub dlpi_subs: c_ulonglong,
372         pub dlpi_tls_modid: usize,
373         pub dlpi_tls_data: *mut c_void,
374     }
375 
376     pub struct ipc_perm {
377         pub cuid: crate::uid_t,
378         pub cgid: crate::gid_t,
379         pub uid: crate::uid_t,
380         pub gid: crate::gid_t,
381         pub mode: mode_t,
382         pub seq: c_ushort,
383         pub key: crate::key_t,
384     }
385 
386     pub struct eui64 {
387         pub octet: [u8; EUI64_LEN],
388     }
389 }
390 
391 s_no_extra_traits! {
392     pub struct sockaddr_storage {
393         pub ss_len: u8,
394         pub ss_family: crate::sa_family_t,
395         __ss_pad1: [u8; 6],
396         __ss_align: i64,
397         __ss_pad2: [u8; 112],
398     }
399 }
400 
401 cfg_if! {
402     if #[cfg(feature = "extra_traits")] {
403         impl PartialEq for sockaddr_storage {
404             fn eq(&self, other: &sockaddr_storage) -> bool {
405                 self.ss_len == other.ss_len
406                     && self.ss_family == other.ss_family
407                     && self.__ss_pad1 == other.__ss_pad1
408                     && self.__ss_align == other.__ss_align
409                     && self
410                         .__ss_pad2
411                         .iter()
412                         .zip(other.__ss_pad2.iter())
413                         .all(|(a, b)| a == b)
414             }
415         }
416         impl Eq for sockaddr_storage {}
417         impl hash::Hash for sockaddr_storage {
418             fn hash<H: hash::Hasher>(&self, state: &mut H) {
419                 self.ss_len.hash(state);
420                 self.ss_family.hash(state);
421                 self.__ss_pad1.hash(state);
422                 self.__ss_align.hash(state);
423                 self.__ss_pad2.hash(state);
424             }
425         }
426     }
427 }
428 
429 // Non-public helper constant
430 const SIZEOF_LONG: usize = mem::size_of::<c_long>();
431 
432 #[deprecated(
433     since = "0.2.64",
434     note = "Can vary at runtime.  Use sysconf(3) instead"
435 )]
436 pub const AIO_LISTIO_MAX: c_int = 16;
437 pub const AIO_CANCELED: c_int = 1;
438 pub const AIO_NOTCANCELED: c_int = 2;
439 pub const AIO_ALLDONE: c_int = 3;
440 pub const LIO_NOP: c_int = 0;
441 pub const LIO_WRITE: c_int = 1;
442 pub const LIO_READ: c_int = 2;
443 pub const LIO_WAIT: c_int = 1;
444 pub const LIO_NOWAIT: c_int = 0;
445 
446 pub const SIGEV_NONE: c_int = 0;
447 pub const SIGEV_SIGNAL: c_int = 1;
448 pub const SIGEV_THREAD: c_int = 2;
449 pub const SIGEV_KEVENT: c_int = 3;
450 
451 pub const CODESET: crate::nl_item = 0;
452 pub const D_T_FMT: crate::nl_item = 1;
453 pub const D_FMT: crate::nl_item = 2;
454 pub const T_FMT: crate::nl_item = 3;
455 pub const T_FMT_AMPM: crate::nl_item = 4;
456 pub const AM_STR: crate::nl_item = 5;
457 pub const PM_STR: crate::nl_item = 6;
458 
459 pub const DAY_1: crate::nl_item = 7;
460 pub const DAY_2: crate::nl_item = 8;
461 pub const DAY_3: crate::nl_item = 9;
462 pub const DAY_4: crate::nl_item = 10;
463 pub const DAY_5: crate::nl_item = 11;
464 pub const DAY_6: crate::nl_item = 12;
465 pub const DAY_7: crate::nl_item = 13;
466 
467 pub const ABDAY_1: crate::nl_item = 14;
468 pub const ABDAY_2: crate::nl_item = 15;
469 pub const ABDAY_3: crate::nl_item = 16;
470 pub const ABDAY_4: crate::nl_item = 17;
471 pub const ABDAY_5: crate::nl_item = 18;
472 pub const ABDAY_6: crate::nl_item = 19;
473 pub const ABDAY_7: crate::nl_item = 20;
474 
475 pub const MON_1: crate::nl_item = 21;
476 pub const MON_2: crate::nl_item = 22;
477 pub const MON_3: crate::nl_item = 23;
478 pub const MON_4: crate::nl_item = 24;
479 pub const MON_5: crate::nl_item = 25;
480 pub const MON_6: crate::nl_item = 26;
481 pub const MON_7: crate::nl_item = 27;
482 pub const MON_8: crate::nl_item = 28;
483 pub const MON_9: crate::nl_item = 29;
484 pub const MON_10: crate::nl_item = 30;
485 pub const MON_11: crate::nl_item = 31;
486 pub const MON_12: crate::nl_item = 32;
487 
488 pub const ABMON_1: crate::nl_item = 33;
489 pub const ABMON_2: crate::nl_item = 34;
490 pub const ABMON_3: crate::nl_item = 35;
491 pub const ABMON_4: crate::nl_item = 36;
492 pub const ABMON_5: crate::nl_item = 37;
493 pub const ABMON_6: crate::nl_item = 38;
494 pub const ABMON_7: crate::nl_item = 39;
495 pub const ABMON_8: crate::nl_item = 40;
496 pub const ABMON_9: crate::nl_item = 41;
497 pub const ABMON_10: crate::nl_item = 42;
498 pub const ABMON_11: crate::nl_item = 43;
499 pub const ABMON_12: crate::nl_item = 44;
500 
501 pub const ERA: crate::nl_item = 45;
502 pub const ERA_D_FMT: crate::nl_item = 46;
503 pub const ERA_D_T_FMT: crate::nl_item = 47;
504 pub const ERA_T_FMT: crate::nl_item = 48;
505 pub const ALT_DIGITS: crate::nl_item = 49;
506 
507 pub const RADIXCHAR: crate::nl_item = 50;
508 pub const THOUSEP: crate::nl_item = 51;
509 
510 pub const YESEXPR: crate::nl_item = 52;
511 pub const NOEXPR: crate::nl_item = 53;
512 
513 pub const YESSTR: crate::nl_item = 54;
514 pub const NOSTR: crate::nl_item = 55;
515 
516 pub const CRNCYSTR: crate::nl_item = 56;
517 
518 pub const D_MD_ORDER: crate::nl_item = 57;
519 
520 pub const ALTMON_1: crate::nl_item = 58;
521 pub const ALTMON_2: crate::nl_item = 59;
522 pub const ALTMON_3: crate::nl_item = 60;
523 pub const ALTMON_4: crate::nl_item = 61;
524 pub const ALTMON_5: crate::nl_item = 62;
525 pub const ALTMON_6: crate::nl_item = 63;
526 pub const ALTMON_7: crate::nl_item = 64;
527 pub const ALTMON_8: crate::nl_item = 65;
528 pub const ALTMON_9: crate::nl_item = 66;
529 pub const ALTMON_10: crate::nl_item = 67;
530 pub const ALTMON_11: crate::nl_item = 68;
531 pub const ALTMON_12: crate::nl_item = 69;
532 
533 pub const EXIT_FAILURE: c_int = 1;
534 pub const EXIT_SUCCESS: c_int = 0;
535 pub const EOF: c_int = -1;
536 pub const SEEK_SET: c_int = 0;
537 pub const SEEK_CUR: c_int = 1;
538 pub const SEEK_END: c_int = 2;
539 pub const SEEK_DATA: c_int = 3;
540 pub const SEEK_HOLE: c_int = 4;
541 pub const _IOFBF: c_int = 0;
542 pub const _IONBF: c_int = 2;
543 pub const _IOLBF: c_int = 1;
544 pub const BUFSIZ: c_uint = 1024;
545 pub const FOPEN_MAX: c_uint = 20;
546 pub const FILENAME_MAX: c_uint = 1024;
547 pub const L_tmpnam: c_uint = 1024;
548 pub const TMP_MAX: c_uint = 308915776;
549 
550 pub const O_NOCTTY: c_int = 32768;
551 pub const O_DIRECT: c_int = 0x00010000;
552 
553 pub const S_IFIFO: mode_t = 0o1_0000;
554 pub const S_IFCHR: mode_t = 0o2_0000;
555 pub const S_IFBLK: mode_t = 0o6_0000;
556 pub const S_IFDIR: mode_t = 0o4_0000;
557 pub const S_IFREG: mode_t = 0o10_0000;
558 pub const S_IFLNK: mode_t = 0o12_0000;
559 pub const S_IFSOCK: mode_t = 0o14_0000;
560 pub const S_IFMT: mode_t = 0o17_0000;
561 pub const S_IEXEC: mode_t = 0o0100;
562 pub const S_IWRITE: mode_t = 0o0200;
563 pub const S_IREAD: mode_t = 0o0400;
564 pub const S_IRWXU: mode_t = 0o0700;
565 pub const S_IXUSR: mode_t = 0o0100;
566 pub const S_IWUSR: mode_t = 0o0200;
567 pub const S_IRUSR: mode_t = 0o0400;
568 pub const S_IRWXG: mode_t = 0o0070;
569 pub const S_IXGRP: mode_t = 0o0010;
570 pub const S_IWGRP: mode_t = 0o0020;
571 pub const S_IRGRP: mode_t = 0o0040;
572 pub const S_IRWXO: mode_t = 0o0007;
573 pub const S_IXOTH: mode_t = 0o0001;
574 pub const S_IWOTH: mode_t = 0o0002;
575 pub const S_IROTH: mode_t = 0o0004;
576 pub const F_OK: c_int = 0;
577 pub const R_OK: c_int = 4;
578 pub const W_OK: c_int = 2;
579 pub const X_OK: c_int = 1;
580 pub const STDIN_FILENO: c_int = 0;
581 pub const STDOUT_FILENO: c_int = 1;
582 pub const STDERR_FILENO: c_int = 2;
583 pub const F_LOCK: c_int = 1;
584 pub const F_TEST: c_int = 3;
585 pub const F_TLOCK: c_int = 2;
586 pub const F_ULOCK: c_int = 0;
587 pub const F_DUPFD_CLOEXEC: c_int = 17;
588 pub const F_DUP2FD: c_int = 10;
589 pub const F_DUP2FD_CLOEXEC: c_int = 18;
590 pub const SIGHUP: c_int = 1;
591 pub const SIGINT: c_int = 2;
592 pub const SIGQUIT: c_int = 3;
593 pub const SIGILL: c_int = 4;
594 pub const SIGABRT: c_int = 6;
595 pub const SIGEMT: c_int = 7;
596 pub const SIGFPE: c_int = 8;
597 pub const SIGKILL: c_int = 9;
598 pub const SIGSEGV: c_int = 11;
599 pub const SIGPIPE: c_int = 13;
600 pub const SIGALRM: c_int = 14;
601 pub const SIGTERM: c_int = 15;
602 
603 pub const PROT_NONE: c_int = 0;
604 pub const PROT_READ: c_int = 1;
605 pub const PROT_WRITE: c_int = 2;
606 pub const PROT_EXEC: c_int = 4;
607 
608 pub const MAP_FILE: c_int = 0x0000;
609 pub const MAP_SHARED: c_int = 0x0001;
610 pub const MAP_PRIVATE: c_int = 0x0002;
611 pub const MAP_FIXED: c_int = 0x0010;
612 pub const MAP_ANON: c_int = 0x1000;
613 pub const MAP_ANONYMOUS: c_int = MAP_ANON;
614 
615 pub const MAP_FAILED: *mut c_void = !0 as *mut c_void;
616 
617 pub const MCL_CURRENT: c_int = 0x0001;
618 pub const MCL_FUTURE: c_int = 0x0002;
619 
620 pub const MNT_EXPUBLIC: c_int = 0x20000000;
621 pub const MNT_NOATIME: c_int = 0x10000000;
622 pub const MNT_NOCLUSTERR: c_int = 0x40000000;
623 pub const MNT_NOCLUSTERW: c_int = 0x80000000;
624 pub const MNT_NOSYMFOLLOW: c_int = 0x00400000;
625 pub const MNT_SOFTDEP: c_int = 0x00200000;
626 pub const MNT_SUIDDIR: c_int = 0x00100000;
627 pub const MNT_EXRDONLY: c_int = 0x00000080;
628 pub const MNT_DEFEXPORTED: c_int = 0x00000200;
629 pub const MNT_EXPORTANON: c_int = 0x00000400;
630 pub const MNT_EXKERB: c_int = 0x00000800;
631 pub const MNT_DELEXPORT: c_int = 0x00020000;
632 
633 pub const MS_SYNC: c_int = 0x0000;
634 pub const MS_ASYNC: c_int = 0x0001;
635 pub const MS_INVALIDATE: c_int = 0x0002;
636 
637 pub const EPERM: c_int = 1;
638 pub const ENOENT: c_int = 2;
639 pub const ESRCH: c_int = 3;
640 pub const EINTR: c_int = 4;
641 pub const EIO: c_int = 5;
642 pub const ENXIO: c_int = 6;
643 pub const E2BIG: c_int = 7;
644 pub const ENOEXEC: c_int = 8;
645 pub const EBADF: c_int = 9;
646 pub const ECHILD: c_int = 10;
647 pub const EDEADLK: c_int = 11;
648 pub const ENOMEM: c_int = 12;
649 pub const EACCES: c_int = 13;
650 pub const EFAULT: c_int = 14;
651 pub const ENOTBLK: c_int = 15;
652 pub const EBUSY: c_int = 16;
653 pub const EEXIST: c_int = 17;
654 pub const EXDEV: c_int = 18;
655 pub const ENODEV: c_int = 19;
656 pub const ENOTDIR: c_int = 20;
657 pub const EISDIR: c_int = 21;
658 pub const EINVAL: c_int = 22;
659 pub const ENFILE: c_int = 23;
660 pub const EMFILE: c_int = 24;
661 pub const ENOTTY: c_int = 25;
662 pub const ETXTBSY: c_int = 26;
663 pub const EFBIG: c_int = 27;
664 pub const ENOSPC: c_int = 28;
665 pub const ESPIPE: c_int = 29;
666 pub const EROFS: c_int = 30;
667 pub const EMLINK: c_int = 31;
668 pub const EPIPE: c_int = 32;
669 pub const EDOM: c_int = 33;
670 pub const ERANGE: c_int = 34;
671 pub const EAGAIN: c_int = 35;
672 pub const EWOULDBLOCK: c_int = 35;
673 pub const EINPROGRESS: c_int = 36;
674 pub const EALREADY: c_int = 37;
675 pub const ENOTSOCK: c_int = 38;
676 pub const EDESTADDRREQ: c_int = 39;
677 pub const EMSGSIZE: c_int = 40;
678 pub const EPROTOTYPE: c_int = 41;
679 pub const ENOPROTOOPT: c_int = 42;
680 pub const EPROTONOSUPPORT: c_int = 43;
681 pub const ESOCKTNOSUPPORT: c_int = 44;
682 pub const EOPNOTSUPP: c_int = 45;
683 pub const ENOTSUP: c_int = EOPNOTSUPP;
684 pub const EPFNOSUPPORT: c_int = 46;
685 pub const EAFNOSUPPORT: c_int = 47;
686 pub const EADDRINUSE: c_int = 48;
687 pub const EADDRNOTAVAIL: c_int = 49;
688 pub const ENETDOWN: c_int = 50;
689 pub const ENETUNREACH: c_int = 51;
690 pub const ENETRESET: c_int = 52;
691 pub const ECONNABORTED: c_int = 53;
692 pub const ECONNRESET: c_int = 54;
693 pub const ENOBUFS: c_int = 55;
694 pub const EISCONN: c_int = 56;
695 pub const ENOTCONN: c_int = 57;
696 pub const ESHUTDOWN: c_int = 58;
697 pub const ETOOMANYREFS: c_int = 59;
698 pub const ETIMEDOUT: c_int = 60;
699 pub const ECONNREFUSED: c_int = 61;
700 pub const ELOOP: c_int = 62;
701 pub const ENAMETOOLONG: c_int = 63;
702 pub const EHOSTDOWN: c_int = 64;
703 pub const EHOSTUNREACH: c_int = 65;
704 pub const ENOTEMPTY: c_int = 66;
705 pub const EPROCLIM: c_int = 67;
706 pub const EUSERS: c_int = 68;
707 pub const EDQUOT: c_int = 69;
708 pub const ESTALE: c_int = 70;
709 pub const EREMOTE: c_int = 71;
710 pub const EBADRPC: c_int = 72;
711 pub const ERPCMISMATCH: c_int = 73;
712 pub const EPROGUNAVAIL: c_int = 74;
713 pub const EPROGMISMATCH: c_int = 75;
714 pub const EPROCUNAVAIL: c_int = 76;
715 pub const ENOLCK: c_int = 77;
716 pub const ENOSYS: c_int = 78;
717 pub const EFTYPE: c_int = 79;
718 pub const EAUTH: c_int = 80;
719 pub const ENEEDAUTH: c_int = 81;
720 pub const EIDRM: c_int = 82;
721 pub const ENOMSG: c_int = 83;
722 pub const EOVERFLOW: c_int = 84;
723 pub const ECANCELED: c_int = 85;
724 pub const EILSEQ: c_int = 86;
725 pub const ENOATTR: c_int = 87;
726 pub const EDOOFUS: c_int = 88;
727 pub const EBADMSG: c_int = 89;
728 pub const EMULTIHOP: c_int = 90;
729 pub const ENOLINK: c_int = 91;
730 pub const EPROTO: c_int = 92;
731 
732 pub const POLLSTANDARD: c_short = crate::POLLIN
733     | crate::POLLPRI
734     | crate::POLLOUT
735     | crate::POLLRDNORM
736     | crate::POLLRDBAND
737     | crate::POLLWRBAND
738     | crate::POLLERR
739     | crate::POLLHUP
740     | crate::POLLNVAL;
741 
742 pub const AI_PASSIVE: c_int = 0x00000001;
743 pub const AI_CANONNAME: c_int = 0x00000002;
744 pub const AI_NUMERICHOST: c_int = 0x00000004;
745 pub const AI_NUMERICSERV: c_int = 0x00000008;
746 pub const AI_ALL: c_int = 0x00000100;
747 pub const AI_ADDRCONFIG: c_int = 0x00000400;
748 pub const AI_V4MAPPED: c_int = 0x00000800;
749 
750 pub const EAI_AGAIN: c_int = 2;
751 pub const EAI_BADFLAGS: c_int = 3;
752 pub const EAI_FAIL: c_int = 4;
753 pub const EAI_FAMILY: c_int = 5;
754 pub const EAI_MEMORY: c_int = 6;
755 pub const EAI_NONAME: c_int = 8;
756 pub const EAI_SERVICE: c_int = 9;
757 pub const EAI_SOCKTYPE: c_int = 10;
758 pub const EAI_SYSTEM: c_int = 11;
759 pub const EAI_OVERFLOW: c_int = 14;
760 
761 pub const F_DUPFD: c_int = 0;
762 pub const F_GETFD: c_int = 1;
763 pub const F_SETFD: c_int = 2;
764 pub const F_GETFL: c_int = 3;
765 pub const F_SETFL: c_int = 4;
766 
767 pub const SIGTRAP: c_int = 5;
768 
769 pub const GLOB_APPEND: c_int = 0x0001;
770 pub const GLOB_DOOFFS: c_int = 0x0002;
771 pub const GLOB_ERR: c_int = 0x0004;
772 pub const GLOB_MARK: c_int = 0x0008;
773 pub const GLOB_NOCHECK: c_int = 0x0010;
774 pub const GLOB_NOSORT: c_int = 0x0020;
775 pub const GLOB_NOESCAPE: c_int = 0x2000;
776 
777 pub const GLOB_NOSPACE: c_int = -1;
778 pub const GLOB_ABORTED: c_int = -2;
779 pub const GLOB_NOMATCH: c_int = -3;
780 
781 pub const POSIX_MADV_NORMAL: c_int = 0;
782 pub const POSIX_MADV_RANDOM: c_int = 1;
783 pub const POSIX_MADV_SEQUENTIAL: c_int = 2;
784 pub const POSIX_MADV_WILLNEED: c_int = 3;
785 pub const POSIX_MADV_DONTNEED: c_int = 4;
786 
787 pub const PTHREAD_BARRIER_SERIAL_THREAD: c_int = -1;
788 pub const PTHREAD_PROCESS_PRIVATE: c_int = 0;
789 pub const PTHREAD_PROCESS_SHARED: c_int = 1;
790 pub const PTHREAD_CREATE_JOINABLE: c_int = 0;
791 pub const PTHREAD_CREATE_DETACHED: c_int = 1;
792 
793 pub const RLIMIT_CPU: c_int = 0;
794 pub const RLIMIT_FSIZE: c_int = 1;
795 pub const RLIMIT_DATA: c_int = 2;
796 pub const RLIMIT_STACK: c_int = 3;
797 pub const RLIMIT_CORE: c_int = 4;
798 pub const RLIMIT_RSS: c_int = 5;
799 pub const RLIMIT_MEMLOCK: c_int = 6;
800 pub const RLIMIT_NPROC: c_int = 7;
801 pub const RLIMIT_NOFILE: c_int = 8;
802 pub const RLIMIT_SBSIZE: c_int = 9;
803 pub const RLIMIT_VMEM: c_int = 10;
804 pub const RLIMIT_AS: c_int = RLIMIT_VMEM;
805 pub const RLIM_INFINITY: rlim_t = 0x7fff_ffff_ffff_ffff;
806 
807 pub const RUSAGE_SELF: c_int = 0;
808 pub const RUSAGE_CHILDREN: c_int = -1;
809 
810 pub const CLOCK_REALTIME: crate::clockid_t = 0;
811 pub const CLOCK_VIRTUAL: crate::clockid_t = 1;
812 pub const CLOCK_PROF: crate::clockid_t = 2;
813 pub const CLOCK_MONOTONIC: crate::clockid_t = 4;
814 pub const CLOCK_UPTIME: crate::clockid_t = 5;
815 pub const CLOCK_UPTIME_PRECISE: crate::clockid_t = 7;
816 pub const CLOCK_UPTIME_FAST: crate::clockid_t = 8;
817 pub const CLOCK_REALTIME_PRECISE: crate::clockid_t = 9;
818 pub const CLOCK_REALTIME_FAST: crate::clockid_t = 10;
819 pub const CLOCK_MONOTONIC_PRECISE: crate::clockid_t = 11;
820 pub const CLOCK_MONOTONIC_FAST: crate::clockid_t = 12;
821 pub const CLOCK_SECOND: crate::clockid_t = 13;
822 pub const CLOCK_THREAD_CPUTIME_ID: crate::clockid_t = 14;
823 pub const CLOCK_PROCESS_CPUTIME_ID: crate::clockid_t = 15;
824 
825 pub const MADV_NORMAL: c_int = 0;
826 pub const MADV_RANDOM: c_int = 1;
827 pub const MADV_SEQUENTIAL: c_int = 2;
828 pub const MADV_WILLNEED: c_int = 3;
829 pub const MADV_DONTNEED: c_int = 4;
830 pub const MADV_FREE: c_int = 5;
831 pub const MADV_NOSYNC: c_int = 6;
832 pub const MADV_AUTOSYNC: c_int = 7;
833 pub const MADV_NOCORE: c_int = 8;
834 pub const MADV_CORE: c_int = 9;
835 
836 pub const MINCORE_INCORE: c_int = 0x1;
837 pub const MINCORE_REFERENCED: c_int = 0x2;
838 pub const MINCORE_MODIFIED: c_int = 0x4;
839 pub const MINCORE_REFERENCED_OTHER: c_int = 0x8;
840 pub const MINCORE_MODIFIED_OTHER: c_int = 0x10;
841 
842 pub const AF_UNSPEC: c_int = 0;
843 pub const AF_LOCAL: c_int = 1;
844 pub const AF_UNIX: c_int = AF_LOCAL;
845 pub const AF_INET: c_int = 2;
846 pub const AF_IMPLINK: c_int = 3;
847 pub const AF_PUP: c_int = 4;
848 pub const AF_CHAOS: c_int = 5;
849 pub const AF_NETBIOS: c_int = 6;
850 pub const AF_ISO: c_int = 7;
851 pub const AF_OSI: c_int = AF_ISO;
852 pub const AF_ECMA: c_int = 8;
853 pub const AF_DATAKIT: c_int = 9;
854 pub const AF_CCITT: c_int = 10;
855 pub const AF_SNA: c_int = 11;
856 pub const AF_DECnet: c_int = 12;
857 pub const AF_DLI: c_int = 13;
858 pub const AF_LAT: c_int = 14;
859 pub const AF_HYLINK: c_int = 15;
860 pub const AF_APPLETALK: c_int = 16;
861 pub const AF_ROUTE: c_int = 17;
862 pub const AF_LINK: c_int = 18;
863 pub const pseudo_AF_XTP: c_int = 19;
864 pub const AF_COIP: c_int = 20;
865 pub const AF_CNT: c_int = 21;
866 pub const pseudo_AF_RTIP: c_int = 22;
867 pub const AF_IPX: c_int = 23;
868 pub const AF_SIP: c_int = 24;
869 pub const pseudo_AF_PIP: c_int = 25;
870 pub const AF_ISDN: c_int = 26;
871 pub const AF_E164: c_int = AF_ISDN;
872 pub const pseudo_AF_KEY: c_int = 27;
873 pub const AF_INET6: c_int = 28;
874 pub const AF_NATM: c_int = 29;
875 pub const AF_ATM: c_int = 30;
876 pub const pseudo_AF_HDRCMPLT: c_int = 31;
877 pub const AF_NETGRAPH: c_int = 32;
878 
879 pub const PF_UNSPEC: c_int = AF_UNSPEC;
880 pub const PF_LOCAL: c_int = AF_LOCAL;
881 pub const PF_UNIX: c_int = PF_LOCAL;
882 pub const PF_INET: c_int = AF_INET;
883 pub const PF_IMPLINK: c_int = AF_IMPLINK;
884 pub const PF_PUP: c_int = AF_PUP;
885 pub const PF_CHAOS: c_int = AF_CHAOS;
886 pub const PF_NETBIOS: c_int = AF_NETBIOS;
887 pub const PF_ISO: c_int = AF_ISO;
888 pub const PF_OSI: c_int = AF_ISO;
889 pub const PF_ECMA: c_int = AF_ECMA;
890 pub const PF_DATAKIT: c_int = AF_DATAKIT;
891 pub const PF_CCITT: c_int = AF_CCITT;
892 pub const PF_SNA: c_int = AF_SNA;
893 pub const PF_DECnet: c_int = AF_DECnet;
894 pub const PF_DLI: c_int = AF_DLI;
895 pub const PF_LAT: c_int = AF_LAT;
896 pub const PF_HYLINK: c_int = AF_HYLINK;
897 pub const PF_APPLETALK: c_int = AF_APPLETALK;
898 pub const PF_ROUTE: c_int = AF_ROUTE;
899 pub const PF_LINK: c_int = AF_LINK;
900 pub const PF_XTP: c_int = pseudo_AF_XTP;
901 pub const PF_COIP: c_int = AF_COIP;
902 pub const PF_CNT: c_int = AF_CNT;
903 pub const PF_SIP: c_int = AF_SIP;
904 pub const PF_IPX: c_int = AF_IPX;
905 pub const PF_RTIP: c_int = pseudo_AF_RTIP;
906 pub const PF_PIP: c_int = pseudo_AF_PIP;
907 pub const PF_ISDN: c_int = AF_ISDN;
908 pub const PF_KEY: c_int = pseudo_AF_KEY;
909 pub const PF_INET6: c_int = AF_INET6;
910 pub const PF_NATM: c_int = AF_NATM;
911 pub const PF_ATM: c_int = AF_ATM;
912 pub const PF_NETGRAPH: c_int = AF_NETGRAPH;
913 
914 pub const PIOD_READ_D: c_int = 1;
915 pub const PIOD_WRITE_D: c_int = 2;
916 pub const PIOD_READ_I: c_int = 3;
917 pub const PIOD_WRITE_I: c_int = 4;
918 
919 pub const PT_TRACE_ME: c_int = 0;
920 pub const PT_READ_I: c_int = 1;
921 pub const PT_READ_D: c_int = 2;
922 pub const PT_WRITE_I: c_int = 4;
923 pub const PT_WRITE_D: c_int = 5;
924 pub const PT_CONTINUE: c_int = 7;
925 pub const PT_KILL: c_int = 8;
926 pub const PT_STEP: c_int = 9;
927 pub const PT_ATTACH: c_int = 10;
928 pub const PT_DETACH: c_int = 11;
929 pub const PT_IO: c_int = 12;
930 
931 pub const SOMAXCONN: c_int = 128;
932 
933 pub const MSG_OOB: c_int = 0x00000001;
934 pub const MSG_PEEK: c_int = 0x00000002;
935 pub const MSG_DONTROUTE: c_int = 0x00000004;
936 pub const MSG_EOR: c_int = 0x00000008;
937 pub const MSG_TRUNC: c_int = 0x00000010;
938 pub const MSG_CTRUNC: c_int = 0x00000020;
939 pub const MSG_WAITALL: c_int = 0x00000040;
940 pub const MSG_DONTWAIT: c_int = 0x00000080;
941 pub const MSG_EOF: c_int = 0x00000100;
942 
943 pub const SCM_TIMESTAMP: c_int = 0x02;
944 pub const SCM_CREDS: c_int = 0x03;
945 
946 pub const SOCK_STREAM: c_int = 1;
947 pub const SOCK_DGRAM: c_int = 2;
948 pub const SOCK_RAW: c_int = 3;
949 pub const SOCK_RDM: c_int = 4;
950 pub const SOCK_SEQPACKET: c_int = 5;
951 pub const SOCK_CLOEXEC: c_int = 0x10000000;
952 pub const SOCK_NONBLOCK: c_int = 0x20000000;
953 pub const SOCK_MAXADDRLEN: c_int = 255;
954 pub const IP_TTL: c_int = 4;
955 pub const IP_HDRINCL: c_int = 2;
956 pub const IP_RECVDSTADDR: c_int = 7;
957 pub const IP_SENDSRCADDR: c_int = IP_RECVDSTADDR;
958 pub const IP_ADD_MEMBERSHIP: c_int = 12;
959 pub const IP_DROP_MEMBERSHIP: c_int = 13;
960 pub const IP_RECVIF: c_int = 20;
961 pub const IP_RECVTTL: c_int = 65;
962 pub const IPV6_RECVHOPLIMIT: c_int = 37;
963 pub const IPV6_JOIN_GROUP: c_int = 12;
964 pub const IPV6_LEAVE_GROUP: c_int = 13;
965 pub const IPV6_CHECKSUM: c_int = 26;
966 pub const IPV6_RECVPKTINFO: c_int = 36;
967 pub const IPV6_PKTINFO: c_int = 46;
968 pub const IPV6_HOPLIMIT: c_int = 47;
969 pub const IPV6_RECVTCLASS: c_int = 57;
970 pub const IPV6_TCLASS: c_int = 61;
971 pub const IP_ADD_SOURCE_MEMBERSHIP: c_int = 70;
972 pub const IP_DROP_SOURCE_MEMBERSHIP: c_int = 71;
973 pub const IP_BLOCK_SOURCE: c_int = 72;
974 pub const IP_UNBLOCK_SOURCE: c_int = 73;
975 
976 pub const TCP_NOPUSH: c_int = 4;
977 pub const TCP_NOOPT: c_int = 8;
978 pub const TCP_KEEPIDLE: c_int = 256;
979 pub const TCP_KEEPINTVL: c_int = 512;
980 pub const TCP_KEEPCNT: c_int = 1024;
981 
982 pub const SOL_SOCKET: c_int = 0xffff;
983 pub const SO_DEBUG: c_int = 0x01;
984 pub const SO_ACCEPTCONN: c_int = 0x0002;
985 pub const SO_REUSEADDR: c_int = 0x0004;
986 pub const SO_KEEPALIVE: c_int = 0x0008;
987 pub const SO_DONTROUTE: c_int = 0x0010;
988 pub const SO_BROADCAST: c_int = 0x0020;
989 pub const SO_USELOOPBACK: c_int = 0x0040;
990 pub const SO_LINGER: c_int = 0x0080;
991 pub const SO_OOBINLINE: c_int = 0x0100;
992 pub const SO_REUSEPORT: c_int = 0x0200;
993 pub const SO_TIMESTAMP: c_int = 0x0400;
994 pub const SO_NOSIGPIPE: c_int = 0x0800;
995 pub const SO_ACCEPTFILTER: c_int = 0x1000;
996 pub const SO_SNDBUF: c_int = 0x1001;
997 pub const SO_RCVBUF: c_int = 0x1002;
998 pub const SO_SNDLOWAT: c_int = 0x1003;
999 pub const SO_RCVLOWAT: c_int = 0x1004;
1000 pub const SO_SNDTIMEO: c_int = 0x1005;
1001 pub const SO_RCVTIMEO: c_int = 0x1006;
1002 pub const SO_ERROR: c_int = 0x1007;
1003 pub const SO_TYPE: c_int = 0x1008;
1004 
1005 pub const LOCAL_PEERCRED: c_int = 1;
1006 
1007 // net/route.h
1008 pub const RTF_XRESOLVE: c_int = 0x200;
1009 pub const RTF_LLINFO: c_int = 0x400;
1010 pub const RTF_PROTO3: c_int = 0x40000;
1011 pub const RTF_PINNED: c_int = 0x100000;
1012 pub const RTF_LOCAL: c_int = 0x200000;
1013 pub const RTF_BROADCAST: c_int = 0x400000;
1014 pub const RTF_MULTICAST: c_int = 0x800000;
1015 
1016 pub const RTM_LOCK: c_int = 0x8;
1017 pub const RTM_RESOLVE: c_int = 0xb;
1018 pub const RTM_NEWADDR: c_int = 0xc;
1019 pub const RTM_DELADDR: c_int = 0xd;
1020 pub const RTM_IFINFO: c_int = 0xe;
1021 pub const RTM_NEWMADDR: c_int = 0xf;
1022 pub const RTM_DELMADDR: c_int = 0x10;
1023 pub const RTM_IFANNOUNCE: c_int = 0x11;
1024 pub const RTM_IEEE80211: c_int = 0x12;
1025 
1026 pub const SHUT_RD: c_int = 0;
1027 pub const SHUT_WR: c_int = 1;
1028 pub const SHUT_RDWR: c_int = 2;
1029 
1030 pub const LOCK_SH: c_int = 1;
1031 pub const LOCK_EX: c_int = 2;
1032 pub const LOCK_NB: c_int = 4;
1033 pub const LOCK_UN: c_int = 8;
1034 
1035 pub const MAP_COPY: c_int = 0x0002;
1036 #[doc(hidden)]
1037 #[deprecated(
1038     since = "0.2.54",
1039     note = "Removed in FreeBSD 11, unused in DragonFlyBSD"
1040 )]
1041 pub const MAP_RENAME: c_int = 0x0020;
1042 #[doc(hidden)]
1043 #[deprecated(
1044     since = "0.2.54",
1045     note = "Removed in FreeBSD 11, unused in DragonFlyBSD"
1046 )]
1047 pub const MAP_NORESERVE: c_int = 0x0040;
1048 pub const MAP_HASSEMAPHORE: c_int = 0x0200;
1049 pub const MAP_STACK: c_int = 0x0400;
1050 pub const MAP_NOSYNC: c_int = 0x0800;
1051 pub const MAP_NOCORE: c_int = 0x020000;
1052 
1053 pub const IPPROTO_RAW: c_int = 255;
1054 
1055 pub const _PC_LINK_MAX: c_int = 1;
1056 pub const _PC_MAX_CANON: c_int = 2;
1057 pub const _PC_MAX_INPUT: c_int = 3;
1058 pub const _PC_NAME_MAX: c_int = 4;
1059 pub const _PC_PATH_MAX: c_int = 5;
1060 pub const _PC_PIPE_BUF: c_int = 6;
1061 pub const _PC_CHOWN_RESTRICTED: c_int = 7;
1062 pub const _PC_NO_TRUNC: c_int = 8;
1063 pub const _PC_VDISABLE: c_int = 9;
1064 pub const _PC_ALLOC_SIZE_MIN: c_int = 10;
1065 pub const _PC_FILESIZEBITS: c_int = 12;
1066 pub const _PC_REC_INCR_XFER_SIZE: c_int = 14;
1067 pub const _PC_REC_MAX_XFER_SIZE: c_int = 15;
1068 pub const _PC_REC_MIN_XFER_SIZE: c_int = 16;
1069 pub const _PC_REC_XFER_ALIGN: c_int = 17;
1070 pub const _PC_SYMLINK_MAX: c_int = 18;
1071 pub const _PC_MIN_HOLE_SIZE: c_int = 21;
1072 pub const _PC_ASYNC_IO: c_int = 53;
1073 pub const _PC_PRIO_IO: c_int = 54;
1074 pub const _PC_SYNC_IO: c_int = 55;
1075 pub const _PC_ACL_EXTENDED: c_int = 59;
1076 pub const _PC_ACL_PATH_MAX: c_int = 60;
1077 pub const _PC_CAP_PRESENT: c_int = 61;
1078 pub const _PC_INF_PRESENT: c_int = 62;
1079 pub const _PC_MAC_PRESENT: c_int = 63;
1080 
1081 pub const _SC_ARG_MAX: c_int = 1;
1082 pub const _SC_CHILD_MAX: c_int = 2;
1083 pub const _SC_CLK_TCK: c_int = 3;
1084 pub const _SC_NGROUPS_MAX: c_int = 4;
1085 pub const _SC_OPEN_MAX: c_int = 5;
1086 pub const _SC_JOB_CONTROL: c_int = 6;
1087 pub const _SC_SAVED_IDS: c_int = 7;
1088 pub const _SC_VERSION: c_int = 8;
1089 pub const _SC_BC_BASE_MAX: c_int = 9;
1090 pub const _SC_BC_DIM_MAX: c_int = 10;
1091 pub const _SC_BC_SCALE_MAX: c_int = 11;
1092 pub const _SC_BC_STRING_MAX: c_int = 12;
1093 pub const _SC_COLL_WEIGHTS_MAX: c_int = 13;
1094 pub const _SC_EXPR_NEST_MAX: c_int = 14;
1095 pub const _SC_LINE_MAX: c_int = 15;
1096 pub const _SC_RE_DUP_MAX: c_int = 16;
1097 pub const _SC_2_VERSION: c_int = 17;
1098 pub const _SC_2_C_BIND: c_int = 18;
1099 pub const _SC_2_C_DEV: c_int = 19;
1100 pub const _SC_2_CHAR_TERM: c_int = 20;
1101 pub const _SC_2_FORT_DEV: c_int = 21;
1102 pub const _SC_2_FORT_RUN: c_int = 22;
1103 pub const _SC_2_LOCALEDEF: c_int = 23;
1104 pub const _SC_2_SW_DEV: c_int = 24;
1105 pub const _SC_2_UPE: c_int = 25;
1106 pub const _SC_STREAM_MAX: c_int = 26;
1107 pub const _SC_TZNAME_MAX: c_int = 27;
1108 pub const _SC_ASYNCHRONOUS_IO: c_int = 28;
1109 pub const _SC_MAPPED_FILES: c_int = 29;
1110 pub const _SC_MEMLOCK: c_int = 30;
1111 pub const _SC_MEMLOCK_RANGE: c_int = 31;
1112 pub const _SC_MEMORY_PROTECTION: c_int = 32;
1113 pub const _SC_MESSAGE_PASSING: c_int = 33;
1114 pub const _SC_PRIORITIZED_IO: c_int = 34;
1115 pub const _SC_PRIORITY_SCHEDULING: c_int = 35;
1116 pub const _SC_REALTIME_SIGNALS: c_int = 36;
1117 pub const _SC_SEMAPHORES: c_int = 37;
1118 pub const _SC_FSYNC: c_int = 38;
1119 pub const _SC_SHARED_MEMORY_OBJECTS: c_int = 39;
1120 pub const _SC_SYNCHRONIZED_IO: c_int = 40;
1121 pub const _SC_TIMERS: c_int = 41;
1122 pub const _SC_AIO_LISTIO_MAX: c_int = 42;
1123 pub const _SC_AIO_MAX: c_int = 43;
1124 pub const _SC_AIO_PRIO_DELTA_MAX: c_int = 44;
1125 pub const _SC_DELAYTIMER_MAX: c_int = 45;
1126 pub const _SC_MQ_OPEN_MAX: c_int = 46;
1127 pub const _SC_PAGESIZE: c_int = 47;
1128 pub const _SC_PAGE_SIZE: c_int = _SC_PAGESIZE;
1129 pub const _SC_RTSIG_MAX: c_int = 48;
1130 pub const _SC_SEM_NSEMS_MAX: c_int = 49;
1131 pub const _SC_SEM_VALUE_MAX: c_int = 50;
1132 pub const _SC_SIGQUEUE_MAX: c_int = 51;
1133 pub const _SC_TIMER_MAX: c_int = 52;
1134 pub const _SC_IOV_MAX: c_int = 56;
1135 pub const _SC_NPROCESSORS_CONF: c_int = 57;
1136 pub const _SC_2_PBS: c_int = 59;
1137 pub const _SC_2_PBS_ACCOUNTING: c_int = 60;
1138 pub const _SC_2_PBS_CHECKPOINT: c_int = 61;
1139 pub const _SC_2_PBS_LOCATE: c_int = 62;
1140 pub const _SC_2_PBS_MESSAGE: c_int = 63;
1141 pub const _SC_2_PBS_TRACK: c_int = 64;
1142 pub const _SC_ADVISORY_INFO: c_int = 65;
1143 pub const _SC_BARRIERS: c_int = 66;
1144 pub const _SC_CLOCK_SELECTION: c_int = 67;
1145 pub const _SC_CPUTIME: c_int = 68;
1146 pub const _SC_FILE_LOCKING: c_int = 69;
1147 pub const _SC_NPROCESSORS_ONLN: c_int = 58;
1148 pub const _SC_GETGR_R_SIZE_MAX: c_int = 70;
1149 pub const _SC_GETPW_R_SIZE_MAX: c_int = 71;
1150 pub const _SC_HOST_NAME_MAX: c_int = 72;
1151 pub const _SC_LOGIN_NAME_MAX: c_int = 73;
1152 pub const _SC_MONOTONIC_CLOCK: c_int = 74;
1153 pub const _SC_MQ_PRIO_MAX: c_int = 75;
1154 pub const _SC_READER_WRITER_LOCKS: c_int = 76;
1155 pub const _SC_REGEXP: c_int = 77;
1156 pub const _SC_SHELL: c_int = 78;
1157 pub const _SC_SPAWN: c_int = 79;
1158 pub const _SC_SPIN_LOCKS: c_int = 80;
1159 pub const _SC_SPORADIC_SERVER: c_int = 81;
1160 pub const _SC_THREAD_ATTR_STACKADDR: c_int = 82;
1161 pub const _SC_THREAD_ATTR_STACKSIZE: c_int = 83;
1162 pub const _SC_THREAD_DESTRUCTOR_ITERATIONS: c_int = 85;
1163 pub const _SC_THREAD_KEYS_MAX: c_int = 86;
1164 pub const _SC_THREAD_PRIO_INHERIT: c_int = 87;
1165 pub const _SC_THREAD_PRIO_PROTECT: c_int = 88;
1166 pub const _SC_THREAD_PRIORITY_SCHEDULING: c_int = 89;
1167 pub const _SC_THREAD_PROCESS_SHARED: c_int = 90;
1168 pub const _SC_THREAD_SAFE_FUNCTIONS: c_int = 91;
1169 pub const _SC_THREAD_SPORADIC_SERVER: c_int = 92;
1170 pub const _SC_THREAD_STACK_MIN: c_int = 93;
1171 pub const _SC_THREAD_THREADS_MAX: c_int = 94;
1172 pub const _SC_TIMEOUTS: c_int = 95;
1173 pub const _SC_THREADS: c_int = 96;
1174 pub const _SC_TRACE: c_int = 97;
1175 pub const _SC_TRACE_EVENT_FILTER: c_int = 98;
1176 pub const _SC_TRACE_INHERIT: c_int = 99;
1177 pub const _SC_TRACE_LOG: c_int = 100;
1178 pub const _SC_TTY_NAME_MAX: c_int = 101;
1179 pub const _SC_TYPED_MEMORY_OBJECTS: c_int = 102;
1180 pub const _SC_V6_ILP32_OFF32: c_int = 103;
1181 pub const _SC_V6_ILP32_OFFBIG: c_int = 104;
1182 pub const _SC_V6_LP64_OFF64: c_int = 105;
1183 pub const _SC_V6_LPBIG_OFFBIG: c_int = 106;
1184 pub const _SC_ATEXIT_MAX: c_int = 107;
1185 pub const _SC_XOPEN_CRYPT: c_int = 108;
1186 pub const _SC_XOPEN_ENH_I18N: c_int = 109;
1187 pub const _SC_XOPEN_LEGACY: c_int = 110;
1188 pub const _SC_XOPEN_REALTIME: c_int = 111;
1189 pub const _SC_XOPEN_REALTIME_THREADS: c_int = 112;
1190 pub const _SC_XOPEN_SHM: c_int = 113;
1191 pub const _SC_XOPEN_STREAMS: c_int = 114;
1192 pub const _SC_XOPEN_UNIX: c_int = 115;
1193 pub const _SC_XOPEN_VERSION: c_int = 116;
1194 pub const _SC_XOPEN_XCU_VERSION: c_int = 117;
1195 pub const _SC_IPV6: c_int = 118;
1196 pub const _SC_RAW_SOCKETS: c_int = 119;
1197 pub const _SC_SYMLOOP_MAX: c_int = 120;
1198 pub const _SC_PHYS_PAGES: c_int = 121;
1199 
1200 pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = 0 as *mut _;
1201 pub const PTHREAD_COND_INITIALIZER: pthread_cond_t = 0 as *mut _;
1202 pub const PTHREAD_RWLOCK_INITIALIZER: pthread_rwlock_t = 0 as *mut _;
1203 pub const PTHREAD_MUTEX_ERRORCHECK: c_int = 1;
1204 pub const PTHREAD_MUTEX_RECURSIVE: c_int = 2;
1205 pub const PTHREAD_MUTEX_NORMAL: c_int = 3;
1206 pub const PTHREAD_MUTEX_DEFAULT: c_int = PTHREAD_MUTEX_ERRORCHECK;
1207 
1208 pub const SCHED_FIFO: c_int = 1;
1209 pub const SCHED_OTHER: c_int = 2;
1210 pub const SCHED_RR: c_int = 3;
1211 
1212 pub const FD_SETSIZE: usize = 1024;
1213 
1214 pub const ST_NOSUID: c_ulong = 2;
1215 
1216 pub const NI_MAXHOST: size_t = 1025;
1217 
1218 pub const XUCRED_VERSION: c_uint = 0;
1219 
1220 pub const RTLD_LOCAL: c_int = 0;
1221 pub const RTLD_NODELETE: c_int = 0x1000;
1222 pub const RTLD_NOLOAD: c_int = 0x2000;
1223 pub const RTLD_GLOBAL: c_int = 0x100;
1224 
1225 pub const LOG_NTP: c_int = 12 << 3;
1226 pub const LOG_SECURITY: c_int = 13 << 3;
1227 pub const LOG_CONSOLE: c_int = 14 << 3;
1228 pub const LOG_NFACILITIES: c_int = 24;
1229 
1230 pub const TIOCEXCL: c_ulong = 0x2000740d;
1231 pub const TIOCNXCL: c_ulong = 0x2000740e;
1232 pub const TIOCFLUSH: c_ulong = 0x80047410;
1233 pub const TIOCGETA: c_ulong = 0x402c7413;
1234 pub const TIOCSETA: c_ulong = 0x802c7414;
1235 pub const TIOCSETAW: c_ulong = 0x802c7415;
1236 pub const TIOCSETAF: c_ulong = 0x802c7416;
1237 pub const TIOCGETD: c_ulong = 0x4004741a;
1238 pub const TIOCSETD: c_ulong = 0x8004741b;
1239 pub const TIOCGDRAINWAIT: c_ulong = 0x40047456;
1240 pub const TIOCSDRAINWAIT: c_ulong = 0x80047457;
1241 pub const TIOCMGDTRWAIT: c_ulong = 0x4004745a;
1242 pub const TIOCMSDTRWAIT: c_ulong = 0x8004745b;
1243 pub const TIOCDRAIN: c_ulong = 0x2000745e;
1244 pub const TIOCEXT: c_ulong = 0x80047460;
1245 pub const TIOCSCTTY: c_ulong = 0x20007461;
1246 pub const TIOCCONS: c_ulong = 0x80047462;
1247 pub const TIOCGSID: c_ulong = 0x40047463;
1248 pub const TIOCSTAT: c_ulong = 0x20007465;
1249 pub const TIOCUCNTL: c_ulong = 0x80047466;
1250 pub const TIOCSWINSZ: c_ulong = 0x80087467;
1251 pub const TIOCGWINSZ: c_ulong = 0x40087468;
1252 pub const TIOCMGET: c_ulong = 0x4004746a;
1253 pub const TIOCM_LE: c_int = 0x1;
1254 pub const TIOCM_DTR: c_int = 0x2;
1255 pub const TIOCM_RTS: c_int = 0x4;
1256 pub const TIOCM_ST: c_int = 0x8;
1257 pub const TIOCM_SR: c_int = 0x10;
1258 pub const TIOCM_CTS: c_int = 0x20;
1259 pub const TIOCM_RI: c_int = 0x80;
1260 pub const TIOCM_DSR: c_int = 0x100;
1261 pub const TIOCM_CD: c_int = 0x40;
1262 pub const TIOCM_CAR: c_int = 0x40;
1263 pub const TIOCM_RNG: c_int = 0x80;
1264 pub const TIOCMBIC: c_ulong = 0x8004746b;
1265 pub const TIOCMBIS: c_ulong = 0x8004746c;
1266 pub const TIOCMSET: c_ulong = 0x8004746d;
1267 pub const TIOCSTART: c_ulong = 0x2000746e;
1268 pub const TIOCSTOP: c_ulong = 0x2000746f;
1269 pub const TIOCPKT: c_ulong = 0x80047470;
1270 pub const TIOCPKT_DATA: c_int = 0x0;
1271 pub const TIOCPKT_FLUSHREAD: c_int = 0x1;
1272 pub const TIOCPKT_FLUSHWRITE: c_int = 0x2;
1273 pub const TIOCPKT_STOP: c_int = 0x4;
1274 pub const TIOCPKT_START: c_int = 0x8;
1275 pub const TIOCPKT_NOSTOP: c_int = 0x10;
1276 pub const TIOCPKT_DOSTOP: c_int = 0x20;
1277 pub const TIOCPKT_IOCTL: c_int = 0x40;
1278 pub const TIOCNOTTY: c_ulong = 0x20007471;
1279 pub const TIOCSTI: c_ulong = 0x80017472;
1280 pub const TIOCOUTQ: c_ulong = 0x40047473;
1281 pub const TIOCSPGRP: c_ulong = 0x80047476;
1282 pub const TIOCGPGRP: c_ulong = 0x40047477;
1283 pub const TIOCCDTR: c_ulong = 0x20007478;
1284 pub const TIOCSDTR: c_ulong = 0x20007479;
1285 pub const TTYDISC: c_int = 0x0;
1286 pub const SLIPDISC: c_int = 0x4;
1287 pub const PPPDISC: c_int = 0x5;
1288 pub const NETGRAPHDISC: c_int = 0x6;
1289 
1290 pub const BIOCGRSIG: c_ulong = 0x40044272;
1291 pub const BIOCSRSIG: c_ulong = 0x80044273;
1292 pub const BIOCSDLT: c_ulong = 0x80044278;
1293 pub const BIOCGSEESENT: c_ulong = 0x40044276;
1294 pub const BIOCSSEESENT: c_ulong = 0x80044277;
1295 cfg_if! {
1296     if #[cfg(target_pointer_width = "64")] {
1297         pub const BIOCGDLTLIST: c_ulong = 0xc0104279;
1298         pub const BIOCSETF: c_ulong = 0x80104267;
1299     } else if #[cfg(target_pointer_width = "32")] {
1300         pub const BIOCGDLTLIST: c_ulong = 0xc0084279;
1301         pub const BIOCSETF: c_ulong = 0x80084267;
1302     }
1303 }
1304 
1305 pub const FIODTYPE: c_ulong = 0x4004667a;
1306 pub const FIOGETLBA: c_ulong = 0x40046679;
1307 
1308 pub const B0: speed_t = 0;
1309 pub const B50: speed_t = 50;
1310 pub const B75: speed_t = 75;
1311 pub const B110: speed_t = 110;
1312 pub const B134: speed_t = 134;
1313 pub const B150: speed_t = 150;
1314 pub const B200: speed_t = 200;
1315 pub const B300: speed_t = 300;
1316 pub const B600: speed_t = 600;
1317 pub const B1200: speed_t = 1200;
1318 pub const B1800: speed_t = 1800;
1319 pub const B2400: speed_t = 2400;
1320 pub const B4800: speed_t = 4800;
1321 pub const B9600: speed_t = 9600;
1322 pub const B19200: speed_t = 19200;
1323 pub const B38400: speed_t = 38400;
1324 pub const B7200: speed_t = 7200;
1325 pub const B14400: speed_t = 14400;
1326 pub const B28800: speed_t = 28800;
1327 pub const B57600: speed_t = 57600;
1328 pub const B76800: speed_t = 76800;
1329 pub const B115200: speed_t = 115200;
1330 pub const B230400: speed_t = 230400;
1331 pub const EXTA: speed_t = 19200;
1332 pub const EXTB: speed_t = 38400;
1333 
1334 pub const SEM_FAILED: *mut sem_t = 0 as *mut sem_t;
1335 
1336 pub const CRTSCTS: crate::tcflag_t = 0x00030000;
1337 pub const CCTS_OFLOW: crate::tcflag_t = 0x00010000;
1338 pub const CRTS_IFLOW: crate::tcflag_t = 0x00020000;
1339 pub const CDTR_IFLOW: crate::tcflag_t = 0x00040000;
1340 pub const CDSR_OFLOW: crate::tcflag_t = 0x00080000;
1341 pub const CCAR_OFLOW: crate::tcflag_t = 0x00100000;
1342 pub const VERASE2: usize = 7;
1343 pub const OCRNL: crate::tcflag_t = 0x10;
1344 pub const ONOCR: crate::tcflag_t = 0x20;
1345 pub const ONLRET: crate::tcflag_t = 0x40;
1346 
1347 pub const CMGROUP_MAX: usize = 16;
1348 
1349 pub const EUI64_LEN: usize = 8;
1350 
1351 // https://github.com/freebsd/freebsd/blob/HEAD/sys/net/bpf.h
1352 pub const BPF_ALIGNMENT: usize = SIZEOF_LONG;
1353 
1354 // Values for rtprio struct (prio field) and syscall (function argument)
1355 pub const RTP_PRIO_MIN: c_ushort = 0;
1356 pub const RTP_PRIO_MAX: c_ushort = 31;
1357 pub const RTP_LOOKUP: c_int = 0;
1358 pub const RTP_SET: c_int = 1;
1359 
1360 // Flags for chflags(2)
1361 pub const UF_SETTABLE: c_ulong = 0x0000ffff;
1362 pub const UF_NODUMP: c_ulong = 0x00000001;
1363 pub const UF_IMMUTABLE: c_ulong = 0x00000002;
1364 pub const UF_APPEND: c_ulong = 0x00000004;
1365 pub const UF_OPAQUE: c_ulong = 0x00000008;
1366 pub const UF_NOUNLINK: c_ulong = 0x00000010;
1367 pub const SF_SETTABLE: c_ulong = 0xffff0000;
1368 pub const SF_ARCHIVED: c_ulong = 0x00010000;
1369 pub const SF_IMMUTABLE: c_ulong = 0x00020000;
1370 pub const SF_APPEND: c_ulong = 0x00040000;
1371 pub const SF_NOUNLINK: c_ulong = 0x00100000;
1372 
1373 pub const TIMER_ABSTIME: c_int = 1;
1374 
1375 //<sys/timex.h>
1376 pub const NTP_API: c_int = 4;
1377 pub const MAXPHASE: c_long = 500000000;
1378 pub const MAXFREQ: c_long = 500000;
1379 pub const MINSEC: c_int = 256;
1380 pub const MAXSEC: c_int = 2048;
1381 pub const NANOSECOND: c_long = 1000000000;
1382 pub const SCALE_PPM: c_int = 65;
1383 pub const MAXTC: c_int = 10;
1384 pub const MOD_OFFSET: c_uint = 0x0001;
1385 pub const MOD_FREQUENCY: c_uint = 0x0002;
1386 pub const MOD_MAXERROR: c_uint = 0x0004;
1387 pub const MOD_ESTERROR: c_uint = 0x0008;
1388 pub const MOD_STATUS: c_uint = 0x0010;
1389 pub const MOD_TIMECONST: c_uint = 0x0020;
1390 pub const MOD_PPSMAX: c_uint = 0x0040;
1391 pub const MOD_TAI: c_uint = 0x0080;
1392 pub const MOD_MICRO: c_uint = 0x1000;
1393 pub const MOD_NANO: c_uint = 0x2000;
1394 pub const MOD_CLKB: c_uint = 0x4000;
1395 pub const MOD_CLKA: c_uint = 0x8000;
1396 pub const STA_PLL: c_int = 0x0001;
1397 pub const STA_PPSFREQ: c_int = 0x0002;
1398 pub const STA_PPSTIME: c_int = 0x0004;
1399 pub const STA_FLL: c_int = 0x0008;
1400 pub const STA_INS: c_int = 0x0010;
1401 pub const STA_DEL: c_int = 0x0020;
1402 pub const STA_UNSYNC: c_int = 0x0040;
1403 pub const STA_FREQHOLD: c_int = 0x0080;
1404 pub const STA_PPSSIGNAL: c_int = 0x0100;
1405 pub const STA_PPSJITTER: c_int = 0x0200;
1406 pub const STA_PPSWANDER: c_int = 0x0400;
1407 pub const STA_PPSERROR: c_int = 0x0800;
1408 pub const STA_CLOCKERR: c_int = 0x1000;
1409 pub const STA_NANO: c_int = 0x2000;
1410 pub const STA_MODE: c_int = 0x4000;
1411 pub const STA_CLK: c_int = 0x8000;
1412 pub const STA_RONLY: c_int = STA_PPSSIGNAL
1413     | STA_PPSJITTER
1414     | STA_PPSWANDER
1415     | STA_PPSERROR
1416     | STA_CLOCKERR
1417     | STA_NANO
1418     | STA_MODE
1419     | STA_CLK;
1420 pub const TIME_OK: c_int = 0;
1421 pub const TIME_INS: c_int = 1;
1422 pub const TIME_DEL: c_int = 2;
1423 pub const TIME_OOP: c_int = 3;
1424 pub const TIME_WAIT: c_int = 4;
1425 pub const TIME_ERROR: c_int = 5;
1426 
1427 pub const REG_ENOSYS: c_int = -1;
1428 pub const REG_ILLSEQ: c_int = 17;
1429 
1430 pub const IPC_PRIVATE: crate::key_t = 0;
1431 pub const IPC_CREAT: c_int = 0o1000;
1432 pub const IPC_EXCL: c_int = 0o2000;
1433 pub const IPC_NOWAIT: c_int = 0o4000;
1434 pub const IPC_RMID: c_int = 0;
1435 pub const IPC_SET: c_int = 1;
1436 pub const IPC_STAT: c_int = 2;
1437 pub const IPC_R: c_int = 0o400;
1438 pub const IPC_W: c_int = 0o200;
1439 pub const IPC_M: c_int = 0o10000;
1440 
1441 pub const SHM_RDONLY: c_int = 0o10000;
1442 pub const SHM_RND: c_int = 0o20000;
1443 pub const SHM_R: c_int = 0o400;
1444 pub const SHM_W: c_int = 0o200;
1445 
1446 pub const KENV_GET: c_int = 0;
1447 pub const KENV_SET: c_int = 1;
1448 pub const KENV_UNSET: c_int = 2;
1449 pub const KENV_DUMP: c_int = 3;
1450 pub const KENV_MNAMELEN: c_int = 128;
1451 pub const KENV_MVALLEN: c_int = 128;
1452 
1453 pub const RB_ASKNAME: c_int = 0x001;
1454 pub const RB_SINGLE: c_int = 0x002;
1455 pub const RB_NOSYNC: c_int = 0x004;
1456 pub const RB_HALT: c_int = 0x008;
1457 pub const RB_INITNAME: c_int = 0x010;
1458 pub const RB_DFLTROOT: c_int = 0x020;
1459 pub const RB_KDB: c_int = 0x040;
1460 pub const RB_RDONLY: c_int = 0x080;
1461 pub const RB_DUMP: c_int = 0x100;
1462 pub const RB_MINIROOT: c_int = 0x200;
1463 pub const RB_VERBOSE: c_int = 0x800;
1464 pub const RB_SERIAL: c_int = 0x1000;
1465 pub const RB_CDROM: c_int = 0x2000;
1466 pub const RB_POWEROFF: c_int = 0x4000;
1467 pub const RB_GDB: c_int = 0x8000;
1468 pub const RB_MUTE: c_int = 0x10000;
1469 pub const RB_SELFTEST: c_int = 0x20000;
1470 
1471 // For getrandom()
1472 pub const GRND_NONBLOCK: c_uint = 0x1;
1473 pub const GRND_RANDOM: c_uint = 0x2;
1474 pub const GRND_INSECURE: c_uint = 0x4;
1475 
1476 // DIFF(main): changed to `c_short` in f62eb023ab
1477 pub const POSIX_SPAWN_RESETIDS: c_int = 0x01;
1478 pub const POSIX_SPAWN_SETPGROUP: c_int = 0x02;
1479 pub const POSIX_SPAWN_SETSCHEDPARAM: c_int = 0x04;
1480 pub const POSIX_SPAWN_SETSCHEDULER: c_int = 0x08;
1481 pub const POSIX_SPAWN_SETSIGDEF: c_int = 0x10;
1482 pub const POSIX_SPAWN_SETSIGMASK: c_int = 0x20;
1483 
1484 safe_f! {
1485     pub {const} fn WIFCONTINUED(status: c_int) -> bool {
1486         status == 0x13
1487     }
1488 
1489     pub {const} fn WSTOPSIG(status: c_int) -> c_int {
1490         status >> 8
1491     }
1492 
1493     pub {const} fn WIFSTOPPED(status: c_int) -> bool {
1494         (status & 0o177) == 0o177
1495     }
1496 }
1497 
1498 extern "C" {
sem_destroy(sem: *mut sem_t) -> c_int1499     pub fn sem_destroy(sem: *mut sem_t) -> c_int;
sem_init(sem: *mut sem_t, pshared: c_int, value: c_uint) -> c_int1500     pub fn sem_init(sem: *mut sem_t, pshared: c_int, value: c_uint) -> c_int;
1501 
daemon(nochdir: c_int, noclose: c_int) -> c_int1502     pub fn daemon(nochdir: c_int, noclose: c_int) -> c_int;
gettimeofday(tp: *mut crate::timeval, tz: *mut crate::timezone) -> c_int1503     pub fn gettimeofday(tp: *mut crate::timeval, tz: *mut crate::timezone) -> c_int;
accept4( s: c_int, addr: *mut crate::sockaddr, addrlen: *mut crate::socklen_t, flags: c_int, ) -> c_int1504     pub fn accept4(
1505         s: c_int,
1506         addr: *mut crate::sockaddr,
1507         addrlen: *mut crate::socklen_t,
1508         flags: c_int,
1509     ) -> c_int;
chflags(path: *const c_char, flags: c_ulong) -> c_int1510     pub fn chflags(path: *const c_char, flags: c_ulong) -> c_int;
chflagsat(fd: c_int, path: *const c_char, flags: c_ulong, atflag: c_int) -> c_int1511     pub fn chflagsat(fd: c_int, path: *const c_char, flags: c_ulong, atflag: c_int) -> c_int;
1512 
clock_nanosleep( clk_id: crate::clockid_t, flags: c_int, rqtp: *const crate::timespec, rmtp: *mut crate::timespec, ) -> c_int1513     pub fn clock_nanosleep(
1514         clk_id: crate::clockid_t,
1515         flags: c_int,
1516         rqtp: *const crate::timespec,
1517         rmtp: *mut crate::timespec,
1518     ) -> c_int;
1519 
clock_getres(clk_id: crate::clockid_t, tp: *mut crate::timespec) -> c_int1520     pub fn clock_getres(clk_id: crate::clockid_t, tp: *mut crate::timespec) -> c_int;
clock_gettime(clk_id: crate::clockid_t, tp: *mut crate::timespec) -> c_int1521     pub fn clock_gettime(clk_id: crate::clockid_t, tp: *mut crate::timespec) -> c_int;
clock_settime(clk_id: crate::clockid_t, tp: *const crate::timespec) -> c_int1522     pub fn clock_settime(clk_id: crate::clockid_t, tp: *const crate::timespec) -> c_int;
clock_getcpuclockid(pid: crate::pid_t, clk_id: *mut crate::clockid_t) -> c_int1523     pub fn clock_getcpuclockid(pid: crate::pid_t, clk_id: *mut crate::clockid_t) -> c_int;
1524 
pthread_getcpuclockid(thread: crate::pthread_t, clk_id: *mut crate::clockid_t) -> c_int1525     pub fn pthread_getcpuclockid(thread: crate::pthread_t, clk_id: *mut crate::clockid_t) -> c_int;
1526 
dirfd(dirp: *mut crate::DIR) -> c_int1527     pub fn dirfd(dirp: *mut crate::DIR) -> c_int;
duplocale(base: crate::locale_t) -> crate::locale_t1528     pub fn duplocale(base: crate::locale_t) -> crate::locale_t;
endutxent()1529     pub fn endutxent();
fchflags(fd: c_int, flags: c_ulong) -> c_int1530     pub fn fchflags(fd: c_int, flags: c_ulong) -> c_int;
1531 
1532     // DIFF(main): changed to `*const *mut` in e77f551de9
fexecve(fd: c_int, argv: *const *const c_char, envp: *const *const c_char) -> c_int1533     pub fn fexecve(fd: c_int, argv: *const *const c_char, envp: *const *const c_char) -> c_int;
1534 
futimens(fd: c_int, times: *const crate::timespec) -> c_int1535     pub fn futimens(fd: c_int, times: *const crate::timespec) -> c_int;
getdomainname(name: *mut c_char, len: c_int) -> c_int1536     pub fn getdomainname(name: *mut c_char, len: c_int) -> c_int;
getgrent_r( grp: *mut crate::group, buf: *mut c_char, buflen: size_t, result: *mut *mut crate::group, ) -> c_int1537     pub fn getgrent_r(
1538         grp: *mut crate::group,
1539         buf: *mut c_char,
1540         buflen: size_t,
1541         result: *mut *mut crate::group,
1542     ) -> c_int;
getpwent_r( pwd: *mut crate::passwd, buf: *mut c_char, buflen: size_t, result: *mut *mut crate::passwd, ) -> c_int1543     pub fn getpwent_r(
1544         pwd: *mut crate::passwd,
1545         buf: *mut c_char,
1546         buflen: size_t,
1547         result: *mut *mut crate::passwd,
1548     ) -> c_int;
getgrouplist( name: *const c_char, basegid: crate::gid_t, groups: *mut crate::gid_t, ngroups: *mut c_int, ) -> c_int1549     pub fn getgrouplist(
1550         name: *const c_char,
1551         basegid: crate::gid_t,
1552         groups: *mut crate::gid_t,
1553         ngroups: *mut c_int,
1554     ) -> c_int;
getnameinfo( sa: *const crate::sockaddr, salen: crate::socklen_t, host: *mut c_char, hostlen: size_t, serv: *mut c_char, servlen: size_t, flags: c_int, ) -> c_int1555     pub fn getnameinfo(
1556         sa: *const crate::sockaddr,
1557         salen: crate::socklen_t,
1558         host: *mut c_char,
1559         hostlen: size_t,
1560         serv: *mut c_char,
1561         servlen: size_t,
1562         flags: c_int,
1563     ) -> c_int;
getpriority(which: c_int, who: c_int) -> c_int1564     pub fn getpriority(which: c_int, who: c_int) -> c_int;
getresgid( rgid: *mut crate::gid_t, egid: *mut crate::gid_t, sgid: *mut crate::gid_t, ) -> c_int1565     pub fn getresgid(
1566         rgid: *mut crate::gid_t,
1567         egid: *mut crate::gid_t,
1568         sgid: *mut crate::gid_t,
1569     ) -> c_int;
getresuid( ruid: *mut crate::uid_t, euid: *mut crate::uid_t, suid: *mut crate::uid_t, ) -> c_int1570     pub fn getresuid(
1571         ruid: *mut crate::uid_t,
1572         euid: *mut crate::uid_t,
1573         suid: *mut crate::uid_t,
1574     ) -> c_int;
getutxent() -> *mut utmpx1575     pub fn getutxent() -> *mut utmpx;
getutxid(ut: *const utmpx) -> *mut utmpx1576     pub fn getutxid(ut: *const utmpx) -> *mut utmpx;
getutxline(ut: *const utmpx) -> *mut utmpx1577     pub fn getutxline(ut: *const utmpx) -> *mut utmpx;
initgroups(name: *const c_char, basegid: crate::gid_t) -> c_int1578     pub fn initgroups(name: *const c_char, basegid: crate::gid_t) -> c_int;
1579     #[cfg_attr(
1580         all(target_os = "freebsd", any(freebsd11, freebsd10)),
1581         link_name = "kevent@FBSD_1.0"
1582     )]
kevent( kq: c_int, changelist: *const crate::kevent, nchanges: c_int, eventlist: *mut crate::kevent, nevents: c_int, timeout: *const crate::timespec, ) -> c_int1583     pub fn kevent(
1584         kq: c_int,
1585         changelist: *const crate::kevent,
1586         nchanges: c_int,
1587         eventlist: *mut crate::kevent,
1588         nevents: c_int,
1589         timeout: *const crate::timespec,
1590     ) -> c_int;
lchflags(path: *const c_char, flags: c_ulong) -> c_int1591     pub fn lchflags(path: *const c_char, flags: c_ulong) -> c_int;
lutimes(file: *const c_char, times: *const crate::timeval) -> c_int1592     pub fn lutimes(file: *const c_char, times: *const crate::timeval) -> c_int;
memrchr(cx: *const c_void, c: c_int, n: size_t) -> *mut c_void1593     pub fn memrchr(cx: *const c_void, c: c_int, n: size_t) -> *mut c_void;
mkfifoat(dirfd: c_int, pathname: *const c_char, mode: mode_t) -> c_int1594     pub fn mkfifoat(dirfd: c_int, pathname: *const c_char, mode: mode_t) -> c_int;
1595     #[cfg_attr(
1596         all(target_os = "freebsd", any(freebsd11, freebsd10)),
1597         link_name = "mknodat@FBSD_1.1"
1598     )]
mknodat(dirfd: c_int, pathname: *const c_char, mode: mode_t, dev: dev_t) -> c_int1599     pub fn mknodat(dirfd: c_int, pathname: *const c_char, mode: mode_t, dev: dev_t) -> c_int;
malloc_usable_size(ptr: *const c_void) -> size_t1600     pub fn malloc_usable_size(ptr: *const c_void) -> size_t;
mincore(addr: *const c_void, len: size_t, vec: *mut c_char) -> c_int1601     pub fn mincore(addr: *const c_void, len: size_t, vec: *mut c_char) -> c_int;
newlocale(mask: c_int, locale: *const c_char, base: crate::locale_t) -> crate::locale_t1602     pub fn newlocale(mask: c_int, locale: *const c_char, base: crate::locale_t) -> crate::locale_t;
nl_langinfo_l(item: crate::nl_item, locale: crate::locale_t) -> *mut c_char1603     pub fn nl_langinfo_l(item: crate::nl_item, locale: crate::locale_t) -> *mut c_char;
pipe2(fds: *mut c_int, flags: c_int) -> c_int1604     pub fn pipe2(fds: *mut c_int, flags: c_int) -> c_int;
posix_fallocate(fd: c_int, offset: off_t, len: off_t) -> c_int1605     pub fn posix_fallocate(fd: c_int, offset: off_t, len: off_t) -> c_int;
posix_fadvise(fd: c_int, offset: off_t, len: off_t, advise: c_int) -> c_int1606     pub fn posix_fadvise(fd: c_int, offset: off_t, len: off_t, advise: c_int) -> c_int;
ppoll( fds: *mut crate::pollfd, nfds: crate::nfds_t, timeout: *const crate::timespec, sigmask: *const sigset_t, ) -> c_int1607     pub fn ppoll(
1608         fds: *mut crate::pollfd,
1609         nfds: crate::nfds_t,
1610         timeout: *const crate::timespec,
1611         sigmask: *const sigset_t,
1612     ) -> c_int;
preadv(fd: c_int, iov: *const crate::iovec, iovcnt: c_int, offset: off_t) -> ssize_t1613     pub fn preadv(fd: c_int, iov: *const crate::iovec, iovcnt: c_int, offset: off_t) -> ssize_t;
pthread_attr_get_np(tid: crate::pthread_t, attr: *mut crate::pthread_attr_t) -> c_int1614     pub fn pthread_attr_get_np(tid: crate::pthread_t, attr: *mut crate::pthread_attr_t) -> c_int;
pthread_attr_getguardsize( attr: *const crate::pthread_attr_t, guardsize: *mut size_t, ) -> c_int1615     pub fn pthread_attr_getguardsize(
1616         attr: *const crate::pthread_attr_t,
1617         guardsize: *mut size_t,
1618     ) -> c_int;
pthread_attr_setguardsize(attr: *mut crate::pthread_attr_t, guardsize: size_t) -> c_int1619     pub fn pthread_attr_setguardsize(attr: *mut crate::pthread_attr_t, guardsize: size_t) -> c_int;
pthread_attr_getstack( attr: *const crate::pthread_attr_t, stackaddr: *mut *mut c_void, stacksize: *mut size_t, ) -> c_int1620     pub fn pthread_attr_getstack(
1621         attr: *const crate::pthread_attr_t,
1622         stackaddr: *mut *mut c_void,
1623         stacksize: *mut size_t,
1624     ) -> c_int;
pthread_condattr_getclock( attr: *const pthread_condattr_t, clock_id: *mut clockid_t, ) -> c_int1625     pub fn pthread_condattr_getclock(
1626         attr: *const pthread_condattr_t,
1627         clock_id: *mut clockid_t,
1628     ) -> c_int;
pthread_condattr_getpshared( attr: *const pthread_condattr_t, pshared: *mut c_int, ) -> c_int1629     pub fn pthread_condattr_getpshared(
1630         attr: *const pthread_condattr_t,
1631         pshared: *mut c_int,
1632     ) -> c_int;
pthread_condattr_setclock( attr: *mut pthread_condattr_t, clock_id: crate::clockid_t, ) -> c_int1633     pub fn pthread_condattr_setclock(
1634         attr: *mut pthread_condattr_t,
1635         clock_id: crate::clockid_t,
1636     ) -> c_int;
pthread_condattr_setpshared(attr: *mut pthread_condattr_t, pshared: c_int) -> c_int1637     pub fn pthread_condattr_setpshared(attr: *mut pthread_condattr_t, pshared: c_int) -> c_int;
pthread_main_np() -> c_int1638     pub fn pthread_main_np() -> c_int;
pthread_mutex_timedlock( lock: *mut pthread_mutex_t, abstime: *const crate::timespec, ) -> c_int1639     pub fn pthread_mutex_timedlock(
1640         lock: *mut pthread_mutex_t,
1641         abstime: *const crate::timespec,
1642     ) -> c_int;
pthread_mutexattr_getpshared( attr: *const pthread_mutexattr_t, pshared: *mut c_int, ) -> c_int1643     pub fn pthread_mutexattr_getpshared(
1644         attr: *const pthread_mutexattr_t,
1645         pshared: *mut c_int,
1646     ) -> c_int;
pthread_mutexattr_setpshared(attr: *mut pthread_mutexattr_t, pshared: c_int) -> c_int1647     pub fn pthread_mutexattr_setpshared(attr: *mut pthread_mutexattr_t, pshared: c_int) -> c_int;
pthread_rwlockattr_getpshared( attr: *const pthread_rwlockattr_t, val: *mut c_int, ) -> c_int1648     pub fn pthread_rwlockattr_getpshared(
1649         attr: *const pthread_rwlockattr_t,
1650         val: *mut c_int,
1651     ) -> c_int;
pthread_rwlockattr_setpshared(attr: *mut pthread_rwlockattr_t, val: c_int) -> c_int1652     pub fn pthread_rwlockattr_setpshared(attr: *mut pthread_rwlockattr_t, val: c_int) -> c_int;
pthread_barrierattr_init(attr: *mut crate::pthread_barrierattr_t) -> c_int1653     pub fn pthread_barrierattr_init(attr: *mut crate::pthread_barrierattr_t) -> c_int;
pthread_barrierattr_destroy(attr: *mut crate::pthread_barrierattr_t) -> c_int1654     pub fn pthread_barrierattr_destroy(attr: *mut crate::pthread_barrierattr_t) -> c_int;
pthread_barrierattr_getpshared( attr: *const crate::pthread_barrierattr_t, shared: *mut c_int, ) -> c_int1655     pub fn pthread_barrierattr_getpshared(
1656         attr: *const crate::pthread_barrierattr_t,
1657         shared: *mut c_int,
1658     ) -> c_int;
pthread_barrierattr_setpshared( attr: *mut crate::pthread_barrierattr_t, shared: c_int, ) -> c_int1659     pub fn pthread_barrierattr_setpshared(
1660         attr: *mut crate::pthread_barrierattr_t,
1661         shared: c_int,
1662     ) -> c_int;
pthread_barrier_init( barrier: *mut pthread_barrier_t, attr: *const crate::pthread_barrierattr_t, count: c_uint, ) -> c_int1663     pub fn pthread_barrier_init(
1664         barrier: *mut pthread_barrier_t,
1665         attr: *const crate::pthread_barrierattr_t,
1666         count: c_uint,
1667     ) -> c_int;
pthread_barrier_destroy(barrier: *mut pthread_barrier_t) -> c_int1668     pub fn pthread_barrier_destroy(barrier: *mut pthread_barrier_t) -> c_int;
pthread_barrier_wait(barrier: *mut pthread_barrier_t) -> c_int1669     pub fn pthread_barrier_wait(barrier: *mut pthread_barrier_t) -> c_int;
pthread_get_name_np(tid: crate::pthread_t, name: *mut c_char, len: size_t)1670     pub fn pthread_get_name_np(tid: crate::pthread_t, name: *mut c_char, len: size_t);
pthread_set_name_np(tid: crate::pthread_t, name: *const c_char)1671     pub fn pthread_set_name_np(tid: crate::pthread_t, name: *const c_char);
pthread_getname_np( thread: crate::pthread_t, buffer: *mut c_char, length: size_t, ) -> c_int1672     pub fn pthread_getname_np(
1673         thread: crate::pthread_t,
1674         buffer: *mut c_char,
1675         length: size_t,
1676     ) -> c_int;
pthread_setname_np(thread: crate::pthread_t, name: *const c_char) -> c_int1677     pub fn pthread_setname_np(thread: crate::pthread_t, name: *const c_char) -> c_int;
pthread_setschedparam( native: crate::pthread_t, policy: c_int, param: *const sched_param, ) -> c_int1678     pub fn pthread_setschedparam(
1679         native: crate::pthread_t,
1680         policy: c_int,
1681         param: *const sched_param,
1682     ) -> c_int;
pthread_getschedparam( native: crate::pthread_t, policy: *mut c_int, param: *mut sched_param, ) -> c_int1683     pub fn pthread_getschedparam(
1684         native: crate::pthread_t,
1685         policy: *mut c_int,
1686         param: *mut sched_param,
1687     ) -> c_int;
ptrace(request: c_int, pid: crate::pid_t, addr: *mut c_char, data: c_int) -> c_int1688     pub fn ptrace(request: c_int, pid: crate::pid_t, addr: *mut c_char, data: c_int) -> c_int;
utrace(addr: *const c_void, len: size_t) -> c_int1689     pub fn utrace(addr: *const c_void, len: size_t) -> c_int;
pututxline(ut: *const utmpx) -> *mut utmpx1690     pub fn pututxline(ut: *const utmpx) -> *mut utmpx;
pwritev(fd: c_int, iov: *const crate::iovec, iovcnt: c_int, offset: off_t) -> ssize_t1691     pub fn pwritev(fd: c_int, iov: *const crate::iovec, iovcnt: c_int, offset: off_t) -> ssize_t;
querylocale(mask: c_int, loc: crate::locale_t) -> *const c_char1692     pub fn querylocale(mask: c_int, loc: crate::locale_t) -> *const c_char;
rtprio(function: c_int, pid: crate::pid_t, rtp: *mut rtprio) -> c_int1693     pub fn rtprio(function: c_int, pid: crate::pid_t, rtp: *mut rtprio) -> c_int;
sched_rr_get_interval(pid: crate::pid_t, t: *mut crate::timespec) -> c_int1694     pub fn sched_rr_get_interval(pid: crate::pid_t, t: *mut crate::timespec) -> c_int;
sched_getparam(pid: crate::pid_t, param: *mut sched_param) -> c_int1695     pub fn sched_getparam(pid: crate::pid_t, param: *mut sched_param) -> c_int;
sched_setparam(pid: crate::pid_t, param: *const sched_param) -> c_int1696     pub fn sched_setparam(pid: crate::pid_t, param: *const sched_param) -> c_int;
sched_getscheduler(pid: crate::pid_t) -> c_int1697     pub fn sched_getscheduler(pid: crate::pid_t) -> c_int;
sched_setscheduler( pid: crate::pid_t, policy: c_int, param: *const crate::sched_param, ) -> c_int1698     pub fn sched_setscheduler(
1699         pid: crate::pid_t,
1700         policy: c_int,
1701         param: *const crate::sched_param,
1702     ) -> c_int;
sem_getvalue(sem: *mut sem_t, sval: *mut c_int) -> c_int1703     pub fn sem_getvalue(sem: *mut sem_t, sval: *mut c_int) -> c_int;
sem_timedwait(sem: *mut sem_t, abstime: *const crate::timespec) -> c_int1704     pub fn sem_timedwait(sem: *mut sem_t, abstime: *const crate::timespec) -> c_int;
sendfile( fd: c_int, s: c_int, offset: off_t, nbytes: size_t, hdtr: *mut crate::sf_hdtr, sbytes: *mut off_t, flags: c_int, ) -> c_int1705     pub fn sendfile(
1706         fd: c_int,
1707         s: c_int,
1708         offset: off_t,
1709         nbytes: size_t,
1710         hdtr: *mut crate::sf_hdtr,
1711         sbytes: *mut off_t,
1712         flags: c_int,
1713     ) -> c_int;
setdomainname(name: *const c_char, len: c_int) -> c_int1714     pub fn setdomainname(name: *const c_char, len: c_int) -> c_int;
sethostname(name: *const c_char, len: c_int) -> c_int1715     pub fn sethostname(name: *const c_char, len: c_int) -> c_int;
setpriority(which: c_int, who: c_int, prio: c_int) -> c_int1716     pub fn setpriority(which: c_int, who: c_int, prio: c_int) -> c_int;
setresgid(rgid: crate::gid_t, egid: crate::gid_t, sgid: crate::gid_t) -> c_int1717     pub fn setresgid(rgid: crate::gid_t, egid: crate::gid_t, sgid: crate::gid_t) -> c_int;
setresuid(ruid: crate::uid_t, euid: crate::uid_t, suid: crate::uid_t) -> c_int1718     pub fn setresuid(ruid: crate::uid_t, euid: crate::uid_t, suid: crate::uid_t) -> c_int;
settimeofday(tv: *const crate::timeval, tz: *const crate::timezone) -> c_int1719     pub fn settimeofday(tv: *const crate::timeval, tz: *const crate::timezone) -> c_int;
setutxent()1720     pub fn setutxent();
shm_open(name: *const c_char, oflag: c_int, mode: mode_t) -> c_int1721     pub fn shm_open(name: *const c_char, oflag: c_int, mode: mode_t) -> c_int;
sigtimedwait( set: *const sigset_t, info: *mut siginfo_t, timeout: *const crate::timespec, ) -> c_int1722     pub fn sigtimedwait(
1723         set: *const sigset_t,
1724         info: *mut siginfo_t,
1725         timeout: *const crate::timespec,
1726     ) -> c_int;
sigwaitinfo(set: *const sigset_t, info: *mut siginfo_t) -> c_int1727     pub fn sigwaitinfo(set: *const sigset_t, info: *mut siginfo_t) -> c_int;
sysctl( name: *const c_int, namelen: c_uint, oldp: *mut c_void, oldlenp: *mut size_t, newp: *const c_void, newlen: size_t, ) -> c_int1728     pub fn sysctl(
1729         name: *const c_int,
1730         namelen: c_uint,
1731         oldp: *mut c_void,
1732         oldlenp: *mut size_t,
1733         newp: *const c_void,
1734         newlen: size_t,
1735     ) -> c_int;
sysctlbyname( name: *const c_char, oldp: *mut c_void, oldlenp: *mut size_t, newp: *const c_void, newlen: size_t, ) -> c_int1736     pub fn sysctlbyname(
1737         name: *const c_char,
1738         oldp: *mut c_void,
1739         oldlenp: *mut size_t,
1740         newp: *const c_void,
1741         newlen: size_t,
1742     ) -> c_int;
sysctlnametomib(name: *const c_char, mibp: *mut c_int, sizep: *mut size_t) -> c_int1743     pub fn sysctlnametomib(name: *const c_char, mibp: *mut c_int, sizep: *mut size_t) -> c_int;
uselocale(loc: crate::locale_t) -> crate::locale_t1744     pub fn uselocale(loc: crate::locale_t) -> crate::locale_t;
utimensat( dirfd: c_int, path: *const c_char, times: *const crate::timespec, flag: c_int, ) -> c_int1745     pub fn utimensat(
1746         dirfd: c_int,
1747         path: *const c_char,
1748         times: *const crate::timespec,
1749         flag: c_int,
1750     ) -> c_int;
1751 
ntp_adjtime(buf: *mut timex) -> c_int1752     pub fn ntp_adjtime(buf: *mut timex) -> c_int;
ntp_gettime(buf: *mut ntptimeval) -> c_int1753     pub fn ntp_gettime(buf: *mut ntptimeval) -> c_int;
1754 
1755     // #include <link.h>
dl_iterate_phdr( callback: Option< unsafe extern "C" fn(info: *mut dl_phdr_info, size: usize, data: *mut c_void) -> c_int, >, data: *mut c_void, ) -> c_int1756     pub fn dl_iterate_phdr(
1757         callback: Option<
1758             unsafe extern "C" fn(info: *mut dl_phdr_info, size: usize, data: *mut c_void) -> c_int,
1759         >,
1760         data: *mut c_void,
1761     ) -> c_int;
1762 
iconv_open(tocode: *const c_char, fromcode: *const c_char) -> iconv_t1763     pub fn iconv_open(tocode: *const c_char, fromcode: *const c_char) -> iconv_t;
iconv( cd: iconv_t, inbuf: *mut *mut c_char, inbytesleft: *mut size_t, outbuf: *mut *mut c_char, outbytesleft: *mut size_t, ) -> size_t1764     pub fn iconv(
1765         cd: iconv_t,
1766         inbuf: *mut *mut c_char,
1767         inbytesleft: *mut size_t,
1768         outbuf: *mut *mut c_char,
1769         outbytesleft: *mut size_t,
1770     ) -> size_t;
iconv_close(cd: iconv_t) -> c_int1771     pub fn iconv_close(cd: iconv_t) -> c_int;
1772 
1773     // Added in `FreeBSD` 11.0
1774     // Added in `DragonFly BSD` 5.4
explicit_bzero(s: *mut c_void, len: size_t)1775     pub fn explicit_bzero(s: *mut c_void, len: size_t);
1776     // ISO/IEC 9899:2011 ("ISO C11") K.3.7.4.1
memset_s(s: *mut c_void, smax: size_t, c: c_int, n: size_t) -> c_int1777     pub fn memset_s(s: *mut c_void, smax: size_t, c: c_int, n: size_t) -> c_int;
gethostid() -> c_long1778     pub fn gethostid() -> c_long;
sethostid(hostid: c_long)1779     pub fn sethostid(hostid: c_long);
1780 
eui64_aton(a: *const c_char, e: *mut eui64) -> c_int1781     pub fn eui64_aton(a: *const c_char, e: *mut eui64) -> c_int;
eui64_ntoa(id: *const eui64, a: *mut c_char, len: size_t) -> c_int1782     pub fn eui64_ntoa(id: *const eui64, a: *mut c_char, len: size_t) -> c_int;
eui64_ntohost(hostname: *mut c_char, len: size_t, id: *const eui64) -> c_int1783     pub fn eui64_ntohost(hostname: *mut c_char, len: size_t, id: *const eui64) -> c_int;
eui64_hostton(hostname: *const c_char, id: *mut eui64) -> c_int1784     pub fn eui64_hostton(hostname: *const c_char, id: *mut eui64) -> c_int;
1785 
eaccess(path: *const c_char, mode: c_int) -> c_int1786     pub fn eaccess(path: *const c_char, mode: c_int) -> c_int;
1787 
kenv(action: c_int, name: *const c_char, value: *mut c_char, len: c_int) -> c_int1788     pub fn kenv(action: c_int, name: *const c_char, value: *mut c_char, len: c_int) -> c_int;
reboot(howto: c_int) -> c_int1789     pub fn reboot(howto: c_int) -> c_int;
1790 
exect(path: *const c_char, argv: *const *mut c_char, envp: *const *mut c_char) -> c_int1791     pub fn exect(path: *const c_char, argv: *const *mut c_char, envp: *const *mut c_char) -> c_int;
execvP( file: *const c_char, search_path: *const c_char, argv: *const *mut c_char, ) -> c_int1792     pub fn execvP(
1793         file: *const c_char,
1794         search_path: *const c_char,
1795         argv: *const *mut c_char,
1796     ) -> c_int;
1797 
mkostemp(template: *mut c_char, flags: c_int) -> c_int1798     pub fn mkostemp(template: *mut c_char, flags: c_int) -> c_int;
mkostemps(template: *mut c_char, suffixlen: c_int, flags: c_int) -> c_int1799     pub fn mkostemps(template: *mut c_char, suffixlen: c_int, flags: c_int) -> c_int;
1800 
posix_spawn( pid: *mut crate::pid_t, path: *const c_char, file_actions: *const crate::posix_spawn_file_actions_t, attrp: *const crate::posix_spawnattr_t, argv: *const *mut c_char, envp: *const *mut c_char, ) -> c_int1801     pub fn posix_spawn(
1802         pid: *mut crate::pid_t,
1803         path: *const c_char,
1804         file_actions: *const crate::posix_spawn_file_actions_t,
1805         attrp: *const crate::posix_spawnattr_t,
1806         argv: *const *mut c_char,
1807         envp: *const *mut c_char,
1808     ) -> c_int;
posix_spawnp( pid: *mut crate::pid_t, file: *const c_char, file_actions: *const crate::posix_spawn_file_actions_t, attrp: *const crate::posix_spawnattr_t, argv: *const *mut c_char, envp: *const *mut c_char, ) -> c_int1809     pub fn posix_spawnp(
1810         pid: *mut crate::pid_t,
1811         file: *const c_char,
1812         file_actions: *const crate::posix_spawn_file_actions_t,
1813         attrp: *const crate::posix_spawnattr_t,
1814         argv: *const *mut c_char,
1815         envp: *const *mut c_char,
1816     ) -> c_int;
posix_spawnattr_init(attr: *mut posix_spawnattr_t) -> c_int1817     pub fn posix_spawnattr_init(attr: *mut posix_spawnattr_t) -> c_int;
posix_spawnattr_destroy(attr: *mut posix_spawnattr_t) -> c_int1818     pub fn posix_spawnattr_destroy(attr: *mut posix_spawnattr_t) -> c_int;
posix_spawnattr_getsigdefault( attr: *const posix_spawnattr_t, default: *mut crate::sigset_t, ) -> c_int1819     pub fn posix_spawnattr_getsigdefault(
1820         attr: *const posix_spawnattr_t,
1821         default: *mut crate::sigset_t,
1822     ) -> c_int;
posix_spawnattr_setsigdefault( attr: *mut posix_spawnattr_t, default: *const crate::sigset_t, ) -> c_int1823     pub fn posix_spawnattr_setsigdefault(
1824         attr: *mut posix_spawnattr_t,
1825         default: *const crate::sigset_t,
1826     ) -> c_int;
posix_spawnattr_getsigmask( attr: *const posix_spawnattr_t, default: *mut crate::sigset_t, ) -> c_int1827     pub fn posix_spawnattr_getsigmask(
1828         attr: *const posix_spawnattr_t,
1829         default: *mut crate::sigset_t,
1830     ) -> c_int;
posix_spawnattr_setsigmask( attr: *mut posix_spawnattr_t, default: *const crate::sigset_t, ) -> c_int1831     pub fn posix_spawnattr_setsigmask(
1832         attr: *mut posix_spawnattr_t,
1833         default: *const crate::sigset_t,
1834     ) -> c_int;
posix_spawnattr_getflags(attr: *const posix_spawnattr_t, flags: *mut c_short) -> c_int1835     pub fn posix_spawnattr_getflags(attr: *const posix_spawnattr_t, flags: *mut c_short) -> c_int;
posix_spawnattr_setflags(attr: *mut posix_spawnattr_t, flags: c_short) -> c_int1836     pub fn posix_spawnattr_setflags(attr: *mut posix_spawnattr_t, flags: c_short) -> c_int;
posix_spawnattr_getpgroup( attr: *const posix_spawnattr_t, flags: *mut crate::pid_t, ) -> c_int1837     pub fn posix_spawnattr_getpgroup(
1838         attr: *const posix_spawnattr_t,
1839         flags: *mut crate::pid_t,
1840     ) -> c_int;
posix_spawnattr_setpgroup(attr: *mut posix_spawnattr_t, flags: crate::pid_t) -> c_int1841     pub fn posix_spawnattr_setpgroup(attr: *mut posix_spawnattr_t, flags: crate::pid_t) -> c_int;
posix_spawnattr_getschedpolicy( attr: *const posix_spawnattr_t, flags: *mut c_int, ) -> c_int1842     pub fn posix_spawnattr_getschedpolicy(
1843         attr: *const posix_spawnattr_t,
1844         flags: *mut c_int,
1845     ) -> c_int;
posix_spawnattr_setschedpolicy(attr: *mut posix_spawnattr_t, flags: c_int) -> c_int1846     pub fn posix_spawnattr_setschedpolicy(attr: *mut posix_spawnattr_t, flags: c_int) -> c_int;
posix_spawnattr_getschedparam( attr: *const posix_spawnattr_t, param: *mut crate::sched_param, ) -> c_int1847     pub fn posix_spawnattr_getschedparam(
1848         attr: *const posix_spawnattr_t,
1849         param: *mut crate::sched_param,
1850     ) -> c_int;
posix_spawnattr_setschedparam( attr: *mut posix_spawnattr_t, param: *const crate::sched_param, ) -> c_int1851     pub fn posix_spawnattr_setschedparam(
1852         attr: *mut posix_spawnattr_t,
1853         param: *const crate::sched_param,
1854     ) -> c_int;
1855 
posix_spawn_file_actions_init(actions: *mut posix_spawn_file_actions_t) -> c_int1856     pub fn posix_spawn_file_actions_init(actions: *mut posix_spawn_file_actions_t) -> c_int;
posix_spawn_file_actions_destroy(actions: *mut posix_spawn_file_actions_t) -> c_int1857     pub fn posix_spawn_file_actions_destroy(actions: *mut posix_spawn_file_actions_t) -> c_int;
posix_spawn_file_actions_addopen( actions: *mut posix_spawn_file_actions_t, fd: c_int, path: *const c_char, oflag: c_int, mode: mode_t, ) -> c_int1858     pub fn posix_spawn_file_actions_addopen(
1859         actions: *mut posix_spawn_file_actions_t,
1860         fd: c_int,
1861         path: *const c_char,
1862         oflag: c_int,
1863         mode: mode_t,
1864     ) -> c_int;
posix_spawn_file_actions_addclose( actions: *mut posix_spawn_file_actions_t, fd: c_int, ) -> c_int1865     pub fn posix_spawn_file_actions_addclose(
1866         actions: *mut posix_spawn_file_actions_t,
1867         fd: c_int,
1868     ) -> c_int;
posix_spawn_file_actions_adddup2( actions: *mut posix_spawn_file_actions_t, fd: c_int, newfd: c_int, ) -> c_int1869     pub fn posix_spawn_file_actions_adddup2(
1870         actions: *mut posix_spawn_file_actions_t,
1871         fd: c_int,
1872         newfd: c_int,
1873     ) -> c_int;
1874 }
1875 
1876 #[link(name = "rt")]
1877 extern "C" {
mq_close(mqd: crate::mqd_t) -> c_int1878     pub fn mq_close(mqd: crate::mqd_t) -> c_int;
mq_getattr(mqd: crate::mqd_t, attr: *mut crate::mq_attr) -> c_int1879     pub fn mq_getattr(mqd: crate::mqd_t, attr: *mut crate::mq_attr) -> c_int;
mq_notify(mqd: crate::mqd_t, notification: *const crate::sigevent) -> c_int1880     pub fn mq_notify(mqd: crate::mqd_t, notification: *const crate::sigevent) -> c_int;
mq_open(name: *const c_char, oflag: c_int, ...) -> crate::mqd_t1881     pub fn mq_open(name: *const c_char, oflag: c_int, ...) -> crate::mqd_t;
mq_receive( mqd: crate::mqd_t, msg_ptr: *mut c_char, msg_len: size_t, msg_prio: *mut c_uint, ) -> ssize_t1882     pub fn mq_receive(
1883         mqd: crate::mqd_t,
1884         msg_ptr: *mut c_char,
1885         msg_len: size_t,
1886         msg_prio: *mut c_uint,
1887     ) -> ssize_t;
mq_send( mqd: crate::mqd_t, msg_ptr: *const c_char, msg_len: size_t, msg_prio: c_uint, ) -> c_int1888     pub fn mq_send(
1889         mqd: crate::mqd_t,
1890         msg_ptr: *const c_char,
1891         msg_len: size_t,
1892         msg_prio: c_uint,
1893     ) -> c_int;
mq_setattr( mqd: crate::mqd_t, newattr: *const crate::mq_attr, oldattr: *mut crate::mq_attr, ) -> c_int1894     pub fn mq_setattr(
1895         mqd: crate::mqd_t,
1896         newattr: *const crate::mq_attr,
1897         oldattr: *mut crate::mq_attr,
1898     ) -> c_int;
mq_timedreceive( mqd: crate::mqd_t, msg_ptr: *mut c_char, msg_len: size_t, msg_prio: *mut c_uint, abs_timeout: *const crate::timespec, ) -> ssize_t1899     pub fn mq_timedreceive(
1900         mqd: crate::mqd_t,
1901         msg_ptr: *mut c_char,
1902         msg_len: size_t,
1903         msg_prio: *mut c_uint,
1904         abs_timeout: *const crate::timespec,
1905     ) -> ssize_t;
mq_timedsend( mqd: crate::mqd_t, msg_ptr: *const c_char, msg_len: size_t, msg_prio: c_uint, abs_timeout: *const crate::timespec, ) -> c_int1906     pub fn mq_timedsend(
1907         mqd: crate::mqd_t,
1908         msg_ptr: *const c_char,
1909         msg_len: size_t,
1910         msg_prio: c_uint,
1911         abs_timeout: *const crate::timespec,
1912     ) -> c_int;
mq_unlink(name: *const c_char) -> c_int1913     pub fn mq_unlink(name: *const c_char) -> c_int;
1914 
getrandom(buf: *mut c_void, buflen: size_t, flags: c_uint) -> ssize_t1915     pub fn getrandom(buf: *mut c_void, buflen: size_t, flags: c_uint) -> ssize_t;
getentropy(buf: *mut c_void, buflen: size_t) -> c_int1916     pub fn getentropy(buf: *mut c_void, buflen: size_t) -> c_int;
1917 }
1918 
1919 #[link(name = "util")]
1920 extern "C" {
openpty( amaster: *mut c_int, aslave: *mut c_int, name: *mut c_char, termp: *mut termios, winp: *mut crate::winsize, ) -> c_int1921     pub fn openpty(
1922         amaster: *mut c_int,
1923         aslave: *mut c_int,
1924         name: *mut c_char,
1925         termp: *mut termios,
1926         winp: *mut crate::winsize,
1927     ) -> c_int;
forkpty( amaster: *mut c_int, name: *mut c_char, termp: *mut termios, winp: *mut crate::winsize, ) -> crate::pid_t1928     pub fn forkpty(
1929         amaster: *mut c_int,
1930         name: *mut c_char,
1931         termp: *mut termios,
1932         winp: *mut crate::winsize,
1933     ) -> crate::pid_t;
login_tty(fd: c_int) -> c_int1934     pub fn login_tty(fd: c_int) -> c_int;
fparseln( stream: *mut crate::FILE, len: *mut size_t, lineno: *mut size_t, delim: *const c_char, flags: c_int, ) -> *mut c_char1935     pub fn fparseln(
1936         stream: *mut crate::FILE,
1937         len: *mut size_t,
1938         lineno: *mut size_t,
1939         delim: *const c_char,
1940         flags: c_int,
1941     ) -> *mut c_char;
1942 }
1943 
1944 #[link(name = "execinfo")]
1945 extern "C" {
backtrace(addrlist: *mut *mut c_void, len: size_t) -> size_t1946     pub fn backtrace(addrlist: *mut *mut c_void, len: size_t) -> size_t;
backtrace_symbols(addrlist: *const *mut c_void, len: size_t) -> *mut *mut c_char1947     pub fn backtrace_symbols(addrlist: *const *mut c_void, len: size_t) -> *mut *mut c_char;
backtrace_symbols_fd(addrlist: *const *mut c_void, len: size_t, fd: c_int) -> c_int1948     pub fn backtrace_symbols_fd(addrlist: *const *mut c_void, len: size_t, fd: c_int) -> c_int;
1949 }
1950 
1951 #[link(name = "kvm")]
1952 extern "C" {
kvm_open( execfile: *const c_char, corefile: *const c_char, swapfile: *const c_char, flags: c_int, errstr: *const c_char, ) -> *mut crate::kvm_t1953     pub fn kvm_open(
1954         execfile: *const c_char,
1955         corefile: *const c_char,
1956         swapfile: *const c_char,
1957         flags: c_int,
1958         errstr: *const c_char,
1959     ) -> *mut crate::kvm_t;
kvm_close(kd: *mut crate::kvm_t) -> c_int1960     pub fn kvm_close(kd: *mut crate::kvm_t) -> c_int;
kvm_getprocs( kd: *mut crate::kvm_t, op: c_int, arg: c_int, cnt: *mut c_int, ) -> *mut crate::kinfo_proc1961     pub fn kvm_getprocs(
1962         kd: *mut crate::kvm_t,
1963         op: c_int,
1964         arg: c_int,
1965         cnt: *mut c_int,
1966     ) -> *mut crate::kinfo_proc;
kvm_getloadavg(kd: *mut kvm_t, loadavg: *mut c_double, nelem: c_int) -> c_int1967     pub fn kvm_getloadavg(kd: *mut kvm_t, loadavg: *mut c_double, nelem: c_int) -> c_int;
kvm_openfiles( execfile: *const c_char, corefile: *const c_char, swapfile: *const c_char, flags: c_int, errbuf: *mut c_char, ) -> *mut crate::kvm_t1968     pub fn kvm_openfiles(
1969         execfile: *const c_char,
1970         corefile: *const c_char,
1971         swapfile: *const c_char,
1972         flags: c_int,
1973         errbuf: *mut c_char,
1974     ) -> *mut crate::kvm_t;
kvm_read( kd: *mut crate::kvm_t, addr: c_ulong, buf: *mut c_void, nbytes: size_t, ) -> ssize_t1975     pub fn kvm_read(
1976         kd: *mut crate::kvm_t,
1977         addr: c_ulong,
1978         buf: *mut c_void,
1979         nbytes: size_t,
1980     ) -> ssize_t;
kvm_write( kd: *mut crate::kvm_t, addr: c_ulong, buf: *const c_void, nbytes: size_t, ) -> ssize_t1981     pub fn kvm_write(
1982         kd: *mut crate::kvm_t,
1983         addr: c_ulong,
1984         buf: *const c_void,
1985         nbytes: size_t,
1986     ) -> ssize_t;
1987 }
1988 
1989 cfg_if! {
1990     if #[cfg(target_os = "freebsd")] {
1991         mod freebsd;
1992         pub use self::freebsd::*;
1993     } else if #[cfg(target_os = "dragonfly")] {
1994         mod dragonfly;
1995         pub use self::dragonfly::*;
1996     } else {
1997         // ...
1998     }
1999 }
2000