1 pub type fflags_t = u32;
2 pub type clock_t = i32;
3 
4 pub type lwpid_t = i32;
5 pub type blksize_t = i32;
6 pub type clockid_t = ::c_int;
7 pub type sem_t = _sem;
8 
9 pub type fsblkcnt_t = u64;
10 pub type fsfilcnt_t = u64;
11 pub type idtype_t = ::c_uint;
12 
13 pub type msglen_t = ::c_ulong;
14 pub type msgqnum_t = ::c_ulong;
15 
16 pub type cpulevel_t = ::c_int;
17 pub type cpuwhich_t = ::c_int;
18 
19 pub type mqd_t = *mut ::c_void;
20 pub type posix_spawnattr_t = *mut ::c_void;
21 pub type posix_spawn_file_actions_t = *mut ::c_void;
22 
23 pub type pthread_spinlock_t = *mut __c_anonymous_pthread_spinlock;
24 pub type pthread_barrierattr_t = *mut __c_anonymous_pthread_barrierattr;
25 pub type pthread_barrier_t = *mut __c_anonymous_pthread_barrier;
26 
27 s! {
28     pub struct aiocb {
29         pub aio_fildes: ::c_int,
30         pub aio_offset: ::off_t,
31         pub aio_buf: *mut ::c_void,
32         pub aio_nbytes: ::size_t,
33         __unused1: [::c_int; 2],
34         __unused2: *mut ::c_void,
35         pub aio_lio_opcode: ::c_int,
36         pub aio_reqprio: ::c_int,
37         // unused 3 through 5 are the __aiocb_private structure
38         __unused3: ::c_long,
39         __unused4: ::c_long,
40         __unused5: *mut ::c_void,
41         pub aio_sigevent: sigevent
42     }
43 
44     pub struct jail {
45         pub version: u32,
46         pub path: *mut ::c_char,
47         pub hostname: *mut ::c_char,
48         pub jailname: *mut ::c_char,
49         pub ip4s: ::c_uint,
50         pub ip6s: ::c_uint,
51         pub ip4: *mut ::in_addr,
52         pub ip6: *mut ::in6_addr,
53     }
54 
55     pub struct statvfs {
56         pub f_bavail: ::fsblkcnt_t,
57         pub f_bfree: ::fsblkcnt_t,
58         pub f_blocks: ::fsblkcnt_t,
59         pub f_favail: ::fsfilcnt_t,
60         pub f_ffree: ::fsfilcnt_t,
61         pub f_files: ::fsfilcnt_t,
62         pub f_bsize: ::c_ulong,
63         pub f_flag: ::c_ulong,
64         pub f_frsize: ::c_ulong,
65         pub f_fsid: ::c_ulong,
66         pub f_namemax: ::c_ulong,
67     }
68 
69     // internal structure has changed over time
70     pub struct _sem {
71         data: [u32; 4],
72     }
73 
74     pub struct msqid_ds {
75         pub msg_perm: ::ipc_perm,
76         __unused1: *mut ::c_void,
77         __unused2: *mut ::c_void,
78         pub msg_cbytes: ::msglen_t,
79         pub msg_qnum: ::msgqnum_t,
80         pub msg_qbytes: ::msglen_t,
81         pub msg_lspid: ::pid_t,
82         pub msg_lrpid: ::pid_t,
83         pub msg_stime: ::time_t,
84         pub msg_rtime: ::time_t,
85         pub msg_ctime: ::time_t,
86     }
87 
88     pub struct stack_t {
89         pub ss_sp: *mut ::c_void,
90         pub ss_size: ::size_t,
91         pub ss_flags: ::c_int,
92     }
93 
94     pub struct mmsghdr {
95         pub msg_hdr: ::msghdr,
96         pub msg_len: ::ssize_t,
97     }
98 
99     pub struct sockcred {
100         pub sc_uid: ::uid_t,
101         pub sc_euid: ::uid_t,
102         pub sc_gid: ::gid_t,
103         pub sc_egid: ::gid_t,
104         pub sc_ngroups: ::c_int,
105         pub sc_groups: [::gid_t; 1],
106     }
107 
108     pub struct accept_filter_arg {
109         pub af_name: [::c_char; 16],
110         af_arg: [[::c_char; 10]; 24],
111     }
112 
113     pub struct ptrace_vm_entry {
114         pub pve_entry: ::c_int,
115         pub pve_timestamp: ::c_int,
116         pub pve_start: ::c_ulong,
117         pub pve_end: ::c_ulong,
118         pub pve_offset: ::c_ulong,
119         pub pve_prot: ::c_uint,
120         pub pve_pathlen: ::c_uint,
121         pub pve_fileid: ::c_long,
122         pub pve_fsid: u32,
123         pub pve_path: *mut ::c_char,
124     }
125 
126     pub struct cpuset_t {
127         #[cfg(target_pointer_width = "64")]
128         __bits: [::c_long; 4],
129         #[cfg(target_pointer_width = "32")]
130         __bits: [::c_long; 8],
131     }
132 
133     pub struct cap_rights_t {
134         cr_rights: [u64; 2],
135     }
136 
137     pub struct umutex {
138         m_owner: ::lwpid_t,
139         m_flags: u32,
140         m_ceilings: [u32; 2],
141         m_rb_link: ::uintptr_t,
142         #[cfg(target_pointer_width = "32")]
143         m_pad: u32,
144         m_spare: [u32; 2],
145 
146     }
147 
148     pub struct ucond {
149         c_has_waiters: u32,
150         c_flags: u32,
151         c_clockid: u32,
152         c_spare: [u32; 1],
153     }
154 
155     pub struct __c_anonymous_pthread_spinlock {
156         s_clock: umutex,
157     }
158 
159     pub struct __c_anonymous_pthread_barrierattr {
160         pshared: ::c_int,
161     }
162 
163     pub struct __c_anonymous_pthread_barrier {
164         b_lock: umutex,
165         b_cv: ucond,
166         b_cycle: i64,
167         b_count: ::c_int,
168         b_waiters: ::c_int,
169         b_refcount: ::c_int,
170         b_destroying: ::c_int,
171     }
172 
173     pub struct kinfo_vmentry {
174         pub kve_structsize: ::c_int,
175         pub kve_type: ::c_int,
176         pub kve_start: u64,
177         pub kve_end: u64,
178         pub kve_offset: u64,
179         pub kve_vn_fileid: u64,
180         #[cfg(not(freebsd11))]
181         pub kve_vn_fsid_freebsd11: u32,
182         #[cfg(freebsd11)]
183         pub kve_vn_fsid: u32,
184         pub kve_flags: ::c_int,
185         pub kve_resident: ::c_int,
186         pub kve_private_resident: ::c_int,
187         pub kve_protection: ::c_int,
188         pub kve_ref_count: ::c_int,
189         pub kve_shadow_count: ::c_int,
190         pub kve_vn_type: ::c_int,
191         pub kve_vn_size: u64,
192         #[cfg(not(freebsd11))]
193         pub kve_vn_rdev_freebsd11: u32,
194         #[cfg(freebsd11)]
195         pub kve_vn_rdev: u32,
196         pub kve_vn_mode: u16,
197         pub kve_status: u16,
198         #[cfg(not(freebsd11))]
199         pub kve_vn_fsid: u64,
200         #[cfg(not(freebsd11))]
201         pub kve_vn_rdev: u64,
202         #[cfg(not(freebsd11))]
203         _kve_is_spare: [::c_int; 8],
204         #[cfg(freebsd11)]
205         _kve_is_spare: [::c_int; 12],
206         pub kve_path: [[::c_char; 32]; 32],
207     }
208 
209     pub struct kinfo_proc {
210         __pad0: [[::uintptr_t; 17]; 8],
211     }
212 
213     pub struct filestat {
214         fs_type: ::c_int,
215         fs_flags: ::c_int,
216         fs_fflags: ::c_int,
217         fs_uflags: ::c_int,
218         fs_fd: ::c_int,
219         fs_ref_count: ::c_int,
220         fs_offset: ::off_t,
221         fs_typedep: *mut ::c_void,
222         fs_path: *mut ::c_char,
223         next: *mut filestat,
224         fs_cap_rights: cap_rights_t,
225     }
226 
227     pub struct filestat_list {
228         stqh_first: *mut filestat,
229         stqh_last: *mut *mut filestat,
230     }
231 
232     pub struct procstat {
233         tpe: ::c_int,
234         kd: ::uintptr_t,
235         vmentries: *mut ::c_void,
236         files: *mut ::c_void,
237         argv: *mut ::c_void,
238         envv: *mut ::c_void,
239         core: ::uintptr_t,
240     }
241 }
242 
243 s_no_extra_traits! {
244     pub struct utmpx {
245         pub ut_type: ::c_short,
246         pub ut_tv: ::timeval,
247         pub ut_id: [::c_char; 8],
248         pub ut_pid: ::pid_t,
249         pub ut_user: [::c_char; 32],
250         pub ut_line: [::c_char; 16],
251         pub ut_host: [::c_char; 128],
252         pub __ut_spare: [::c_char; 64],
253     }
254 
255     #[cfg(libc_union)]
256     pub union __c_anonymous_cr_pid {
257         __cr_unused: *mut ::c_void,
258         pub cr_pid: ::pid_t,
259     }
260 
261     pub struct xucred {
262         pub cr_version: ::c_uint,
263         pub cr_uid: ::uid_t,
264         pub cr_ngroups: ::c_short,
265         pub cr_groups: [::gid_t; 16],
266         #[cfg(libc_union)]
267         pub cr_pid__c_anonymous_union: __c_anonymous_cr_pid,
268         #[cfg(not(libc_union))]
269         __cr_unused1: *mut ::c_void,
270     }
271 
272     pub struct sockaddr_dl {
273         pub sdl_len: ::c_uchar,
274         pub sdl_family: ::c_uchar,
275         pub sdl_index: ::c_ushort,
276         pub sdl_type: ::c_uchar,
277         pub sdl_nlen: ::c_uchar,
278         pub sdl_alen: ::c_uchar,
279         pub sdl_slen: ::c_uchar,
280         pub sdl_data: [::c_char; 46],
281     }
282 
283     pub struct mq_attr {
284         pub mq_flags: ::c_long,
285         pub mq_maxmsg: ::c_long,
286         pub mq_msgsize: ::c_long,
287         pub mq_curmsgs: ::c_long,
288         __reserved: [::c_long; 4]
289     }
290 
291     pub struct sigevent {
292         pub sigev_notify: ::c_int,
293         pub sigev_signo: ::c_int,
294         pub sigev_value: ::sigval,
295         //The rest of the structure is actually a union.  We expose only
296         //sigev_notify_thread_id because it's the most useful union member.
297         pub sigev_notify_thread_id: ::lwpid_t,
298         #[cfg(target_pointer_width = "64")]
299         __unused1: ::c_int,
300         __unused2: [::c_long; 7]
301     }
302 
303     #[cfg(libc_union)]
304     pub union __c_anonymous_elf32_auxv_union {
305         pub a_val: ::c_int,
306     }
307 
308     pub struct Elf32_Auxinfo {
309         pub a_type: ::c_int,
310         #[cfg(libc_union)]
311         pub a_un: __c_anonymous_elf32_auxv_union,
312     }
313 }
314 
315 cfg_if! {
316     if #[cfg(feature = "extra_traits")] {
317         impl PartialEq for utmpx {
318             fn eq(&self, other: &utmpx) -> bool {
319                 self.ut_type == other.ut_type
320                     && self.ut_tv == other.ut_tv
321                     && self.ut_id == other.ut_id
322                     && self.ut_pid == other.ut_pid
323                     && self.ut_user == other.ut_user
324                     && self.ut_line == other.ut_line
325                     && self
326                     .ut_host
327                     .iter()
328                     .zip(other.ut_host.iter())
329                     .all(|(a,b)| a == b)
330                     && self
331                     .__ut_spare
332                     .iter()
333                     .zip(other.__ut_spare.iter())
334                     .all(|(a,b)| a == b)
335             }
336         }
337         impl Eq for utmpx {}
338         impl ::fmt::Debug for utmpx {
339             fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
340                 f.debug_struct("utmpx")
341                     .field("ut_type", &self.ut_type)
342                     .field("ut_tv", &self.ut_tv)
343                     .field("ut_id", &self.ut_id)
344                     .field("ut_pid", &self.ut_pid)
345                     .field("ut_user", &self.ut_user)
346                     .field("ut_line", &self.ut_line)
347                     // FIXME: .field("ut_host", &self.ut_host)
348                     // FIXME: .field("__ut_spare", &self.__ut_spare)
349                     .finish()
350             }
351         }
352         impl ::hash::Hash for utmpx {
353             fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
354                 self.ut_type.hash(state);
355                 self.ut_tv.hash(state);
356                 self.ut_id.hash(state);
357                 self.ut_pid.hash(state);
358                 self.ut_user.hash(state);
359                 self.ut_line.hash(state);
360                 self.ut_host.hash(state);
361                 self.__ut_spare.hash(state);
362             }
363         }
364 
365         #[cfg(libc_union)]
366         impl PartialEq for __c_anonymous_cr_pid {
367             fn eq(&self, other: &__c_anonymous_cr_pid) -> bool {
368                 unsafe { self.cr_pid == other.cr_pid}
369             }
370         }
371         #[cfg(libc_union)]
372         impl Eq for __c_anonymous_cr_pid {}
373         #[cfg(libc_union)]
374         impl ::fmt::Debug for __c_anonymous_cr_pid {
375             fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
376                 f.debug_struct("cr_pid")
377                     .field("cr_pid", unsafe { &self.cr_pid })
378                     .finish()
379             }
380         }
381         #[cfg(libc_union)]
382         impl ::hash::Hash for __c_anonymous_cr_pid {
383             fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
384                 unsafe { self.cr_pid.hash(state) };
385             }
386         }
387 
388         impl PartialEq for xucred {
389             fn eq(&self, other: &xucred) -> bool {
390                 #[cfg(libc_union)]
391                 let equal_cr_pid = self.cr_pid__c_anonymous_union
392                     == other.cr_pid__c_anonymous_union;
393                 #[cfg(not(libc_union))]
394                 let equal_cr_pid = self.__cr_unused1 == other.__cr_unused1;
395 
396                 self.cr_version == other.cr_version
397                     && self.cr_uid == other.cr_uid
398                     && self.cr_ngroups == other.cr_ngroups
399                     && self.cr_groups == other.cr_groups
400                     && equal_cr_pid
401             }
402         }
403         impl Eq for xucred {}
404         impl ::fmt::Debug for xucred {
405             fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
406                 let mut struct_formatter = f.debug_struct("xucred");
407                 struct_formatter.field("cr_version", &self.cr_version);
408                 struct_formatter.field("cr_uid", &self.cr_uid);
409                 struct_formatter.field("cr_ngroups", &self.cr_ngroups);
410                 struct_formatter.field("cr_groups", &self.cr_groups);
411                 #[cfg(libc_union)]
412                 struct_formatter.field(
413                     "cr_pid__c_anonymous_union",
414                     &self.cr_pid__c_anonymous_union
415                 );
416                 struct_formatter.finish()
417             }
418         }
419         impl ::hash::Hash for xucred {
420             fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
421                 self.cr_version.hash(state);
422                 self.cr_uid.hash(state);
423                 self.cr_ngroups.hash(state);
424                 self.cr_groups.hash(state);
425                 #[cfg(libc_union)]
426                 self.cr_pid__c_anonymous_union.hash(state);
427                 #[cfg(not(libc_union))]
428                 self.__cr_unused1.hash(state);
429             }
430         }
431 
432         impl PartialEq for sockaddr_dl {
433             fn eq(&self, other: &sockaddr_dl) -> bool {
434                 self.sdl_len == other.sdl_len
435                     && self.sdl_family == other.sdl_family
436                     && self.sdl_index == other.sdl_index
437                     && self.sdl_type == other.sdl_type
438                     && self.sdl_nlen == other.sdl_nlen
439                     && self.sdl_alen == other.sdl_alen
440                     && self.sdl_slen == other.sdl_slen
441                     && self
442                     .sdl_data
443                     .iter()
444                     .zip(other.sdl_data.iter())
445                     .all(|(a,b)| a == b)
446             }
447         }
448         impl Eq for sockaddr_dl {}
449         impl ::fmt::Debug for sockaddr_dl {
450             fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
451                 f.debug_struct("sockaddr_dl")
452                     .field("sdl_len", &self.sdl_len)
453                     .field("sdl_family", &self.sdl_family)
454                     .field("sdl_index", &self.sdl_index)
455                     .field("sdl_type", &self.sdl_type)
456                     .field("sdl_nlen", &self.sdl_nlen)
457                     .field("sdl_alen", &self.sdl_alen)
458                     .field("sdl_slen", &self.sdl_slen)
459                     // FIXME: .field("sdl_data", &self.sdl_data)
460                     .finish()
461             }
462         }
463         impl ::hash::Hash for sockaddr_dl {
464             fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
465                 self.sdl_len.hash(state);
466                 self.sdl_family.hash(state);
467                 self.sdl_index.hash(state);
468                 self.sdl_type.hash(state);
469                 self.sdl_nlen.hash(state);
470                 self.sdl_alen.hash(state);
471                 self.sdl_slen.hash(state);
472                 self.sdl_data.hash(state);
473             }
474         }
475 
476         impl PartialEq for mq_attr {
477             fn eq(&self, other: &mq_attr) -> bool {
478                 self.mq_flags == other.mq_flags &&
479                 self.mq_maxmsg == other.mq_maxmsg &&
480                 self.mq_msgsize == other.mq_msgsize &&
481                 self.mq_curmsgs == other.mq_curmsgs
482             }
483         }
484         impl Eq for mq_attr {}
485         impl ::fmt::Debug for mq_attr {
486             fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
487                 f.debug_struct("mq_attr")
488                     .field("mq_flags", &self.mq_flags)
489                     .field("mq_maxmsg", &self.mq_maxmsg)
490                     .field("mq_msgsize", &self.mq_msgsize)
491                     .field("mq_curmsgs", &self.mq_curmsgs)
492                     .finish()
493             }
494         }
495         impl ::hash::Hash for mq_attr {
496             fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
497                 self.mq_flags.hash(state);
498                 self.mq_maxmsg.hash(state);
499                 self.mq_msgsize.hash(state);
500                 self.mq_curmsgs.hash(state);
501             }
502         }
503 
504         impl PartialEq for sigevent {
505             fn eq(&self, other: &sigevent) -> bool {
506                 self.sigev_notify == other.sigev_notify
507                     && self.sigev_signo == other.sigev_signo
508                     && self.sigev_value == other.sigev_value
509                     && self.sigev_notify_thread_id
510                         == other.sigev_notify_thread_id
511             }
512         }
513         impl Eq for sigevent {}
514         impl ::fmt::Debug for sigevent {
515             fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
516                 f.debug_struct("sigevent")
517                     .field("sigev_notify", &self.sigev_notify)
518                     .field("sigev_signo", &self.sigev_signo)
519                     .field("sigev_value", &self.sigev_value)
520                     .field("sigev_notify_thread_id",
521                            &self.sigev_notify_thread_id)
522                     .finish()
523             }
524         }
525         impl ::hash::Hash for sigevent {
526             fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
527                 self.sigev_notify.hash(state);
528                 self.sigev_signo.hash(state);
529                 self.sigev_value.hash(state);
530                 self.sigev_notify_thread_id.hash(state);
531             }
532         }
533         #[cfg(libc_union)]
534         impl PartialEq for __c_anonymous_elf32_auxv_union {
535             fn eq(&self, other: &__c_anonymous_elf32_auxv_union) -> bool {
536                 unsafe { self.a_val == other.a_val}
537             }
538         }
539         #[cfg(libc_union)]
540         impl Eq for __c_anonymous_elf32_auxv_union {}
541         #[cfg(libc_union)]
542         impl ::fmt::Debug for __c_anonymous_elf32_auxv_union {
543             fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
544                 f.debug_struct("a_val")
545                     .field("a_val", unsafe { &self.a_val })
546                     .finish()
547             }
548         }
549         #[cfg(not(libc_union))]
550         impl PartialEq for Elf32_Auxinfo {
551             fn eq(&self, other: &Elf32_Auxinfo) -> bool {
552                 self.a_type == other.a_type
553             }
554         }
555         #[cfg(libc_union)]
556         impl PartialEq for Elf32_Auxinfo {
557             fn eq(&self, other: &Elf32_Auxinfo) -> bool {
558                 self.a_type == other.a_type
559                     && self.a_un == other.a_un
560             }
561         }
562         impl Eq for Elf32_Auxinfo {}
563         #[cfg(not(libc_union))]
564         impl ::fmt::Debug for Elf32_Auxinfo {
565             fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
566                 f.debug_struct("Elf32_Auxinfo")
567                     .field("a_type", &self.a_type)
568                     .finish()
569             }
570         }
571         #[cfg(libc_union)]
572         impl ::fmt::Debug for Elf32_Auxinfo {
573             fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
574                 f.debug_struct("Elf32_Auxinfo")
575                     .field("a_type", &self.a_type)
576                     .field("a_un", &self.a_un)
577                     .finish()
578             }
579         }
580     }
581 }
582 
583 pub const SIGEV_THREAD_ID: ::c_int = 4;
584 
585 pub const EXTATTR_NAMESPACE_EMPTY: ::c_int = 0;
586 pub const EXTATTR_NAMESPACE_USER: ::c_int = 1;
587 pub const EXTATTR_NAMESPACE_SYSTEM: ::c_int = 2;
588 
589 pub const PTHREAD_STACK_MIN: ::size_t = MINSIGSTKSZ;
590 pub const PTHREAD_MUTEX_ADAPTIVE_NP: ::c_int = 4;
591 pub const SIGSTKSZ: ::size_t = MINSIGSTKSZ + 32768;
592 pub const SF_NODISKIO: ::c_int = 0x00000001;
593 pub const SF_MNOWAIT: ::c_int = 0x00000002;
594 pub const SF_SYNC: ::c_int = 0x00000004;
595 pub const SF_USER_READAHEAD: ::c_int = 0x00000008;
596 pub const SF_NOCACHE: ::c_int = 0x00000010;
597 pub const O_CLOEXEC: ::c_int = 0x00100000;
598 pub const O_DIRECTORY: ::c_int = 0x00020000;
599 pub const O_EXEC: ::c_int = 0x00040000;
600 pub const O_TTY_INIT: ::c_int = 0x00080000;
601 pub const F_GETLK: ::c_int = 11;
602 pub const F_SETLK: ::c_int = 12;
603 pub const F_SETLKW: ::c_int = 13;
604 pub const ENOTCAPABLE: ::c_int = 93;
605 pub const ECAPMODE: ::c_int = 94;
606 pub const ENOTRECOVERABLE: ::c_int = 95;
607 pub const EOWNERDEAD: ::c_int = 96;
608 pub const RLIMIT_NPTS: ::c_int = 11;
609 pub const RLIMIT_SWAP: ::c_int = 12;
610 pub const RLIMIT_KQUEUES: ::c_int = 13;
611 pub const RLIMIT_UMTXP: ::c_int = 14;
612 #[deprecated(since = "0.2.64", note = "Not stable across OS versions")]
613 pub const RLIM_NLIMITS: ::rlim_t = 15;
614 
615 pub const NI_NOFQDN: ::c_int = 0x00000001;
616 pub const NI_NUMERICHOST: ::c_int = 0x00000002;
617 pub const NI_NAMEREQD: ::c_int = 0x00000004;
618 pub const NI_NUMERICSERV: ::c_int = 0x00000008;
619 pub const NI_DGRAM: ::c_int = 0x00000010;
620 pub const NI_NUMERICSCOPE: ::c_int = 0x00000020;
621 
622 pub const Q_GETQUOTA: ::c_int = 0x700;
623 pub const Q_SETQUOTA: ::c_int = 0x800;
624 
625 pub const MAP_GUARD: ::c_int = 0x00002000;
626 pub const MAP_EXCL: ::c_int = 0x00004000;
627 pub const MAP_ALIGNED_SUPER: ::c_int = 1 << 24;
628 
629 pub const POSIX_FADV_NORMAL: ::c_int = 0;
630 pub const POSIX_FADV_RANDOM: ::c_int = 1;
631 pub const POSIX_FADV_SEQUENTIAL: ::c_int = 2;
632 pub const POSIX_FADV_WILLNEED: ::c_int = 3;
633 pub const POSIX_FADV_DONTNEED: ::c_int = 4;
634 pub const POSIX_FADV_NOREUSE: ::c_int = 5;
635 
636 pub const POLLINIGNEOF: ::c_short = 0x2000;
637 
638 pub const EVFILT_READ: i16 = -1;
639 pub const EVFILT_WRITE: i16 = -2;
640 pub const EVFILT_AIO: i16 = -3;
641 pub const EVFILT_VNODE: i16 = -4;
642 pub const EVFILT_PROC: i16 = -5;
643 pub const EVFILT_SIGNAL: i16 = -6;
644 pub const EVFILT_TIMER: i16 = -7;
645 pub const EVFILT_PROCDESC: i16 = -8;
646 pub const EVFILT_FS: i16 = -9;
647 pub const EVFILT_LIO: i16 = -10;
648 pub const EVFILT_USER: i16 = -11;
649 pub const EVFILT_SENDFILE: i16 = -12;
650 pub const EVFILT_EMPTY: i16 = -13;
651 
652 pub const EV_ADD: u16 = 0x1;
653 pub const EV_DELETE: u16 = 0x2;
654 pub const EV_ENABLE: u16 = 0x4;
655 pub const EV_DISABLE: u16 = 0x8;
656 pub const EV_ONESHOT: u16 = 0x10;
657 pub const EV_CLEAR: u16 = 0x20;
658 pub const EV_RECEIPT: u16 = 0x40;
659 pub const EV_DISPATCH: u16 = 0x80;
660 pub const EV_DROP: u16 = 0x1000;
661 pub const EV_FLAG1: u16 = 0x2000;
662 pub const EV_ERROR: u16 = 0x4000;
663 pub const EV_EOF: u16 = 0x8000;
664 pub const EV_SYSFLAGS: u16 = 0xf000;
665 
666 pub const NOTE_TRIGGER: u32 = 0x01000000;
667 pub const NOTE_FFNOP: u32 = 0x00000000;
668 pub const NOTE_FFAND: u32 = 0x40000000;
669 pub const NOTE_FFOR: u32 = 0x80000000;
670 pub const NOTE_FFCOPY: u32 = 0xc0000000;
671 pub const NOTE_FFCTRLMASK: u32 = 0xc0000000;
672 pub const NOTE_FFLAGSMASK: u32 = 0x00ffffff;
673 pub const NOTE_LOWAT: u32 = 0x00000001;
674 pub const NOTE_DELETE: u32 = 0x00000001;
675 pub const NOTE_WRITE: u32 = 0x00000002;
676 pub const NOTE_EXTEND: u32 = 0x00000004;
677 pub const NOTE_ATTRIB: u32 = 0x00000008;
678 pub const NOTE_LINK: u32 = 0x00000010;
679 pub const NOTE_RENAME: u32 = 0x00000020;
680 pub const NOTE_REVOKE: u32 = 0x00000040;
681 pub const NOTE_EXIT: u32 = 0x80000000;
682 pub const NOTE_FORK: u32 = 0x40000000;
683 pub const NOTE_EXEC: u32 = 0x20000000;
684 pub const NOTE_PDATAMASK: u32 = 0x000fffff;
685 pub const NOTE_PCTRLMASK: u32 = 0xf0000000;
686 pub const NOTE_TRACK: u32 = 0x00000001;
687 pub const NOTE_TRACKERR: u32 = 0x00000002;
688 pub const NOTE_CHILD: u32 = 0x00000004;
689 pub const NOTE_SECONDS: u32 = 0x00000001;
690 pub const NOTE_MSECONDS: u32 = 0x00000002;
691 pub const NOTE_USECONDS: u32 = 0x00000004;
692 pub const NOTE_NSECONDS: u32 = 0x00000008;
693 
694 pub const MADV_PROTECT: ::c_int = 10;
695 pub const RUSAGE_THREAD: ::c_int = 1;
696 
697 #[doc(hidden)]
698 #[deprecated(
699     since = "0.2.72",
700     note = "CTL_UNSPEC is deprecated. Use CTL_SYSCTL instead"
701 )]
702 pub const CTL_UNSPEC: ::c_int = 0;
703 pub const CTL_SYSCTL: ::c_int = 0;
704 pub const CTL_KERN: ::c_int = 1;
705 pub const CTL_VM: ::c_int = 2;
706 pub const CTL_VFS: ::c_int = 3;
707 pub const CTL_NET: ::c_int = 4;
708 pub const CTL_DEBUG: ::c_int = 5;
709 pub const CTL_HW: ::c_int = 6;
710 pub const CTL_MACHDEP: ::c_int = 7;
711 pub const CTL_USER: ::c_int = 8;
712 pub const CTL_P1003_1B: ::c_int = 9;
713 pub const CTL_SYSCTL_DEBUG: ::c_int = 0;
714 pub const CTL_SYSCTL_NAME: ::c_int = 1;
715 pub const CTL_SYSCTL_NEXT: ::c_int = 2;
716 pub const CTL_SYSCTL_NAME2OID: ::c_int = 3;
717 pub const CTL_SYSCTL_OIDFMT: ::c_int = 4;
718 pub const CTL_SYSCTL_OIDDESCR: ::c_int = 5;
719 pub const CTL_SYSCTL_OIDLABEL: ::c_int = 6;
720 pub const KERN_OSTYPE: ::c_int = 1;
721 pub const KERN_OSRELEASE: ::c_int = 2;
722 pub const KERN_OSREV: ::c_int = 3;
723 pub const KERN_VERSION: ::c_int = 4;
724 pub const KERN_MAXVNODES: ::c_int = 5;
725 pub const KERN_MAXPROC: ::c_int = 6;
726 pub const KERN_MAXFILES: ::c_int = 7;
727 pub const KERN_ARGMAX: ::c_int = 8;
728 pub const KERN_SECURELVL: ::c_int = 9;
729 pub const KERN_HOSTNAME: ::c_int = 10;
730 pub const KERN_HOSTID: ::c_int = 11;
731 pub const KERN_CLOCKRATE: ::c_int = 12;
732 pub const KERN_VNODE: ::c_int = 13;
733 pub const KERN_PROC: ::c_int = 14;
734 pub const KERN_FILE: ::c_int = 15;
735 pub const KERN_PROF: ::c_int = 16;
736 pub const KERN_POSIX1: ::c_int = 17;
737 pub const KERN_NGROUPS: ::c_int = 18;
738 pub const KERN_JOB_CONTROL: ::c_int = 19;
739 pub const KERN_SAVED_IDS: ::c_int = 20;
740 pub const KERN_BOOTTIME: ::c_int = 21;
741 pub const KERN_NISDOMAINNAME: ::c_int = 22;
742 pub const KERN_UPDATEINTERVAL: ::c_int = 23;
743 pub const KERN_OSRELDATE: ::c_int = 24;
744 pub const KERN_NTP_PLL: ::c_int = 25;
745 pub const KERN_BOOTFILE: ::c_int = 26;
746 pub const KERN_MAXFILESPERPROC: ::c_int = 27;
747 pub const KERN_MAXPROCPERUID: ::c_int = 28;
748 pub const KERN_DUMPDEV: ::c_int = 29;
749 pub const KERN_IPC: ::c_int = 30;
750 pub const KERN_DUMMY: ::c_int = 31;
751 pub const KERN_PS_STRINGS: ::c_int = 32;
752 pub const KERN_USRSTACK: ::c_int = 33;
753 pub const KERN_LOGSIGEXIT: ::c_int = 34;
754 pub const KERN_IOV_MAX: ::c_int = 35;
755 pub const KERN_HOSTUUID: ::c_int = 36;
756 pub const KERN_ARND: ::c_int = 37;
757 pub const KERN_PROC_ALL: ::c_int = 0;
758 pub const KERN_PROC_PID: ::c_int = 1;
759 pub const KERN_PROC_PGRP: ::c_int = 2;
760 pub const KERN_PROC_SESSION: ::c_int = 3;
761 pub const KERN_PROC_TTY: ::c_int = 4;
762 pub const KERN_PROC_UID: ::c_int = 5;
763 pub const KERN_PROC_RUID: ::c_int = 6;
764 pub const KERN_PROC_ARGS: ::c_int = 7;
765 pub const KERN_PROC_PROC: ::c_int = 8;
766 pub const KERN_PROC_SV_NAME: ::c_int = 9;
767 pub const KERN_PROC_RGID: ::c_int = 10;
768 pub const KERN_PROC_GID: ::c_int = 11;
769 pub const KERN_PROC_PATHNAME: ::c_int = 12;
770 pub const KERN_PROC_OVMMAP: ::c_int = 13;
771 pub const KERN_PROC_OFILEDESC: ::c_int = 14;
772 pub const KERN_PROC_KSTACK: ::c_int = 15;
773 pub const KERN_PROC_INC_THREAD: ::c_int = 0x10;
774 pub const KERN_PROC_VMMAP: ::c_int = 32;
775 pub const KERN_PROC_FILEDESC: ::c_int = 33;
776 pub const KERN_PROC_GROUPS: ::c_int = 34;
777 pub const KERN_PROC_ENV: ::c_int = 35;
778 pub const KERN_PROC_AUXV: ::c_int = 36;
779 pub const KERN_PROC_RLIMIT: ::c_int = 37;
780 pub const KERN_PROC_PS_STRINGS: ::c_int = 38;
781 pub const KERN_PROC_UMASK: ::c_int = 39;
782 pub const KERN_PROC_OSREL: ::c_int = 40;
783 pub const KERN_PROC_SIGTRAMP: ::c_int = 41;
784 pub const KIPC_MAXSOCKBUF: ::c_int = 1;
785 pub const KIPC_SOCKBUF_WASTE: ::c_int = 2;
786 pub const KIPC_SOMAXCONN: ::c_int = 3;
787 pub const KIPC_MAX_LINKHDR: ::c_int = 4;
788 pub const KIPC_MAX_PROTOHDR: ::c_int = 5;
789 pub const KIPC_MAX_HDR: ::c_int = 6;
790 pub const KIPC_MAX_DATALEN: ::c_int = 7;
791 pub const HW_MACHINE: ::c_int = 1;
792 pub const HW_MODEL: ::c_int = 2;
793 pub const HW_NCPU: ::c_int = 3;
794 pub const HW_BYTEORDER: ::c_int = 4;
795 pub const HW_PHYSMEM: ::c_int = 5;
796 pub const HW_USERMEM: ::c_int = 6;
797 pub const HW_PAGESIZE: ::c_int = 7;
798 pub const HW_DISKNAMES: ::c_int = 8;
799 pub const HW_DISKSTATS: ::c_int = 9;
800 pub const HW_FLOATINGPT: ::c_int = 10;
801 pub const HW_MACHINE_ARCH: ::c_int = 11;
802 pub const HW_REALMEM: ::c_int = 12;
803 pub const USER_CS_PATH: ::c_int = 1;
804 pub const USER_BC_BASE_MAX: ::c_int = 2;
805 pub const USER_BC_DIM_MAX: ::c_int = 3;
806 pub const USER_BC_SCALE_MAX: ::c_int = 4;
807 pub const USER_BC_STRING_MAX: ::c_int = 5;
808 pub const USER_COLL_WEIGHTS_MAX: ::c_int = 6;
809 pub const USER_EXPR_NEST_MAX: ::c_int = 7;
810 pub const USER_LINE_MAX: ::c_int = 8;
811 pub const USER_RE_DUP_MAX: ::c_int = 9;
812 pub const USER_POSIX2_VERSION: ::c_int = 10;
813 pub const USER_POSIX2_C_BIND: ::c_int = 11;
814 pub const USER_POSIX2_C_DEV: ::c_int = 12;
815 pub const USER_POSIX2_CHAR_TERM: ::c_int = 13;
816 pub const USER_POSIX2_FORT_DEV: ::c_int = 14;
817 pub const USER_POSIX2_FORT_RUN: ::c_int = 15;
818 pub const USER_POSIX2_LOCALEDEF: ::c_int = 16;
819 pub const USER_POSIX2_SW_DEV: ::c_int = 17;
820 pub const USER_POSIX2_UPE: ::c_int = 18;
821 pub const USER_STREAM_MAX: ::c_int = 19;
822 pub const USER_TZNAME_MAX: ::c_int = 20;
823 pub const CTL_P1003_1B_ASYNCHRONOUS_IO: ::c_int = 1;
824 pub const CTL_P1003_1B_MAPPED_FILES: ::c_int = 2;
825 pub const CTL_P1003_1B_MEMLOCK: ::c_int = 3;
826 pub const CTL_P1003_1B_MEMLOCK_RANGE: ::c_int = 4;
827 pub const CTL_P1003_1B_MEMORY_PROTECTION: ::c_int = 5;
828 pub const CTL_P1003_1B_MESSAGE_PASSING: ::c_int = 6;
829 pub const CTL_P1003_1B_PRIORITIZED_IO: ::c_int = 7;
830 pub const CTL_P1003_1B_PRIORITY_SCHEDULING: ::c_int = 8;
831 pub const CTL_P1003_1B_REALTIME_SIGNALS: ::c_int = 9;
832 pub const CTL_P1003_1B_SEMAPHORES: ::c_int = 10;
833 pub const CTL_P1003_1B_FSYNC: ::c_int = 11;
834 pub const CTL_P1003_1B_SHARED_MEMORY_OBJECTS: ::c_int = 12;
835 pub const CTL_P1003_1B_SYNCHRONIZED_IO: ::c_int = 13;
836 pub const CTL_P1003_1B_TIMERS: ::c_int = 14;
837 pub const CTL_P1003_1B_AIO_LISTIO_MAX: ::c_int = 15;
838 pub const CTL_P1003_1B_AIO_MAX: ::c_int = 16;
839 pub const CTL_P1003_1B_AIO_PRIO_DELTA_MAX: ::c_int = 17;
840 pub const CTL_P1003_1B_DELAYTIMER_MAX: ::c_int = 18;
841 pub const CTL_P1003_1B_MQ_OPEN_MAX: ::c_int = 19;
842 pub const CTL_P1003_1B_PAGESIZE: ::c_int = 20;
843 pub const CTL_P1003_1B_RTSIG_MAX: ::c_int = 21;
844 pub const CTL_P1003_1B_SEM_NSEMS_MAX: ::c_int = 22;
845 pub const CTL_P1003_1B_SEM_VALUE_MAX: ::c_int = 23;
846 pub const CTL_P1003_1B_SIGQUEUE_MAX: ::c_int = 24;
847 pub const CTL_P1003_1B_TIMER_MAX: ::c_int = 25;
848 pub const TIOCGPTN: ::c_uint = 0x4004740f;
849 pub const TIOCPTMASTER: ::c_uint = 0x2000741c;
850 pub const TIOCSIG: ::c_uint = 0x2004745f;
851 pub const TIOCM_DCD: ::c_int = 0x40;
852 pub const H4DISC: ::c_int = 0x7;
853 
854 pub const BIOCSETFNR: ::c_ulong = 0x80104282;
855 
856 pub const FIONWRITE: ::c_ulong = 0x40046677;
857 pub const FIONSPACE: ::c_ulong = 0x40046676;
858 pub const FIOSEEKDATA: ::c_ulong = 0xc0086661;
859 pub const FIOSEEKHOLE: ::c_ulong = 0xc0086662;
860 
861 pub const JAIL_API_VERSION: u32 = 2;
862 pub const JAIL_CREATE: ::c_int = 0x01;
863 pub const JAIL_UPDATE: ::c_int = 0x02;
864 pub const JAIL_ATTACH: ::c_int = 0x04;
865 pub const JAIL_DYING: ::c_int = 0x08;
866 pub const JAIL_SET_MASK: ::c_int = 0x0f;
867 pub const JAIL_GET_MASK: ::c_int = 0x08;
868 pub const JAIL_SYS_DISABLE: ::c_int = 0;
869 pub const JAIL_SYS_NEW: ::c_int = 1;
870 pub const JAIL_SYS_INHERIT: ::c_int = 2;
871 
872 pub const MNT_ACLS: ::c_int = 0x08000000;
873 pub const MNT_BYFSID: ::c_int = 0x08000000;
874 pub const MNT_GJOURNAL: ::c_int = 0x02000000;
875 pub const MNT_MULTILABEL: ::c_int = 0x04000000;
876 pub const MNT_NFS4ACLS: ::c_int = 0x00000010;
877 pub const MNT_SNAPSHOT: ::c_int = 0x01000000;
878 pub const MNT_UNION: ::c_int = 0x00000020;
879 pub const MNT_EXPUBLIC: ::c_int = 0x20000000;
880 pub const MNT_NONBUSY: ::c_int = 0x04000000;
881 
882 pub const SO_BINTIME: ::c_int = 0x2000;
883 pub const SO_NO_OFFLOAD: ::c_int = 0x4000;
884 pub const SO_NO_DDP: ::c_int = 0x8000;
885 pub const SO_REUSEPORT_LB: ::c_int = 0x10000;
886 pub const SO_LABEL: ::c_int = 0x1009;
887 pub const SO_PEERLABEL: ::c_int = 0x1010;
888 pub const SO_LISTENQLIMIT: ::c_int = 0x1011;
889 pub const SO_LISTENQLEN: ::c_int = 0x1012;
890 pub const SO_LISTENINCQLEN: ::c_int = 0x1013;
891 pub const SO_SETFIB: ::c_int = 0x1014;
892 pub const SO_USER_COOKIE: ::c_int = 0x1015;
893 pub const SO_PROTOCOL: ::c_int = 0x1016;
894 pub const SO_PROTOTYPE: ::c_int = SO_PROTOCOL;
895 pub const SO_VENDOR: ::c_int = 0x80000000;
896 
897 pub const LOCAL_CREDS: ::c_int = 2;
898 pub const LOCAL_CONNWAIT: ::c_int = 4;
899 pub const LOCAL_VENDOR: ::c_int = SO_VENDOR;
900 
901 pub const PT_LWPINFO: ::c_int = 13;
902 pub const PT_GETNUMLWPS: ::c_int = 14;
903 pub const PT_GETLWPLIST: ::c_int = 15;
904 pub const PT_CLEARSTEP: ::c_int = 16;
905 pub const PT_SETSTEP: ::c_int = 17;
906 pub const PT_SUSPEND: ::c_int = 18;
907 pub const PT_RESUME: ::c_int = 19;
908 pub const PT_TO_SCE: ::c_int = 20;
909 pub const PT_TO_SCX: ::c_int = 21;
910 pub const PT_SYSCALL: ::c_int = 22;
911 pub const PT_FOLLOW_FORK: ::c_int = 23;
912 pub const PT_LWP_EVENTS: ::c_int = 24;
913 pub const PT_GET_EVENT_MASK: ::c_int = 25;
914 pub const PT_SET_EVENT_MASK: ::c_int = 26;
915 pub const PT_GETREGS: ::c_int = 33;
916 pub const PT_SETREGS: ::c_int = 34;
917 pub const PT_GETFPREGS: ::c_int = 35;
918 pub const PT_SETFPREGS: ::c_int = 36;
919 pub const PT_GETDBREGS: ::c_int = 37;
920 pub const PT_SETDBREGS: ::c_int = 38;
921 pub const PT_VM_TIMESTAMP: ::c_int = 40;
922 pub const PT_VM_ENTRY: ::c_int = 41;
923 pub const PT_FIRSTMACH: ::c_int = 64;
924 
925 pub const PTRACE_EXEC: ::c_int = 0x0001;
926 pub const PTRACE_SCE: ::c_int = 0x0002;
927 pub const PTRACE_SCX: ::c_int = 0x0004;
928 pub const PTRACE_SYSCALL: ::c_int = PTRACE_SCE | PTRACE_SCX;
929 pub const PTRACE_FORK: ::c_int = 0x0008;
930 pub const PTRACE_LWP: ::c_int = 0x0010;
931 pub const PTRACE_VFORK: ::c_int = 0x0020;
932 pub const PTRACE_DEFAULT: ::c_int = PTRACE_EXEC;
933 
934 pub const PROC_SPROTECT: ::c_int = 1;
935 pub const PROC_REAP_ACQUIRE: ::c_int = 2;
936 pub const PROC_REAP_RELEASE: ::c_int = 3;
937 pub const PROC_REAP_STATUS: ::c_int = 4;
938 pub const PROC_REAP_GETPIDS: ::c_int = 5;
939 pub const PROC_REAP_KILL: ::c_int = 6;
940 pub const PROC_TRACE_CTL: ::c_int = 7;
941 pub const PROC_TRACE_STATUS: ::c_int = 8;
942 pub const PROC_TRAPCAP_CTL: ::c_int = 9;
943 pub const PROC_TRAPCAP_STATUS: ::c_int = 10;
944 pub const PROC_PDEATHSIG_CTL: ::c_int = 11;
945 pub const PROC_PDEATHSIG_STATUS: ::c_int = 12;
946 pub const PROC_STACKGAP_CTL: ::c_int = 17;
947 pub const PROC_STACKGAP_STATUS: ::c_int = 18;
948 
949 pub const AF_SLOW: ::c_int = 33;
950 pub const AF_SCLUSTER: ::c_int = 34;
951 pub const AF_ARP: ::c_int = 35;
952 pub const AF_BLUETOOTH: ::c_int = 36;
953 pub const AF_IEEE80211: ::c_int = 37;
954 pub const AF_INET_SDP: ::c_int = 40;
955 pub const AF_INET6_SDP: ::c_int = 42;
956 
957 // https://github.com/freebsd/freebsd/blob/master/sys/net/if.h#L140
958 pub const IFF_UP: ::c_int = 0x1; // (n) interface is up
959 pub const IFF_BROADCAST: ::c_int = 0x2; // (i) broadcast address valid
960 pub const IFF_DEBUG: ::c_int = 0x4; // (n) turn on debugging
961 pub const IFF_LOOPBACK: ::c_int = 0x8; // (i) is a loopback net
962 pub const IFF_POINTOPOINT: ::c_int = 0x10; // (i) is a point-to-point link
963                                            // 0x20           was IFF_SMART
964 pub const IFF_RUNNING: ::c_int = 0x40; // (d) resources allocated
965 #[doc(hidden)]
966 #[deprecated(
967     since = "0.2.54",
968     note = "IFF_DRV_RUNNING is deprecated. Use the portable IFF_RUNNING instead"
969 )]
970 pub const IFF_DRV_RUNNING: ::c_int = 0x40;
971 pub const IFF_NOARP: ::c_int = 0x80; // (n) no address resolution protocol
972 pub const IFF_PROMISC: ::c_int = 0x100; // (n) receive all packets
973 pub const IFF_ALLMULTI: ::c_int = 0x200; // (n) receive all multicast packets
974 pub const IFF_OACTIVE: ::c_int = 0x400; // (d) tx hardware queue is full
975 #[doc(hidden)]
976 #[deprecated(since = "0.2.54", note = "Use the portable `IFF_OACTIVE` instead")]
977 pub const IFF_DRV_OACTIVE: ::c_int = 0x400;
978 pub const IFF_SIMPLEX: ::c_int = 0x800; // (i) can't hear own transmissions
979 pub const IFF_LINK0: ::c_int = 0x1000; // per link layer defined bit
980 pub const IFF_LINK1: ::c_int = 0x2000; // per link layer defined bit
981 pub const IFF_LINK2: ::c_int = 0x4000; // per link layer defined bit
982 pub const IFF_ALTPHYS: ::c_int = IFF_LINK2; // use alternate physical connection
983 pub const IFF_MULTICAST: ::c_int = 0x8000; // (i) supports multicast
984                                            // (i) unconfigurable using ioctl(2)
985 pub const IFF_CANTCONFIG: ::c_int = 0x10000;
986 pub const IFF_PPROMISC: ::c_int = 0x20000; // (n) user-requested promisc mode
987 pub const IFF_MONITOR: ::c_int = 0x40000; // (n) user-requested monitor mode
988 pub const IFF_STATICARP: ::c_int = 0x80000; // (n) static ARP
989 pub const IFF_DYING: ::c_int = 0x200000; // (n) interface is winding down
990 pub const IFF_RENAMING: ::c_int = 0x400000; // (n) interface is being renamed
991 
992 // sys/netinet/in.h
993 // Protocols (RFC 1700)
994 // NOTE: These are in addition to the constants defined in src/unix/mod.rs
995 
996 // IPPROTO_IP defined in src/unix/mod.rs
997 /// IP6 hop-by-hop options
998 pub const IPPROTO_HOPOPTS: ::c_int = 0;
999 // IPPROTO_ICMP defined in src/unix/mod.rs
1000 /// group mgmt protocol
1001 pub const IPPROTO_IGMP: ::c_int = 2;
1002 /// gateway^2 (deprecated)
1003 pub const IPPROTO_GGP: ::c_int = 3;
1004 /// for compatibility
1005 pub const IPPROTO_IPIP: ::c_int = 4;
1006 // IPPROTO_TCP defined in src/unix/mod.rs
1007 /// Stream protocol II.
1008 pub const IPPROTO_ST: ::c_int = 7;
1009 /// exterior gateway protocol
1010 pub const IPPROTO_EGP: ::c_int = 8;
1011 /// private interior gateway
1012 pub const IPPROTO_PIGP: ::c_int = 9;
1013 /// BBN RCC Monitoring
1014 pub const IPPROTO_RCCMON: ::c_int = 10;
1015 /// network voice protocol
1016 pub const IPPROTO_NVPII: ::c_int = 11;
1017 /// pup
1018 pub const IPPROTO_PUP: ::c_int = 12;
1019 /// Argus
1020 pub const IPPROTO_ARGUS: ::c_int = 13;
1021 /// EMCON
1022 pub const IPPROTO_EMCON: ::c_int = 14;
1023 /// Cross Net Debugger
1024 pub const IPPROTO_XNET: ::c_int = 15;
1025 /// Chaos
1026 pub const IPPROTO_CHAOS: ::c_int = 16;
1027 // IPPROTO_UDP defined in src/unix/mod.rs
1028 /// Multiplexing
1029 pub const IPPROTO_MUX: ::c_int = 18;
1030 /// DCN Measurement Subsystems
1031 pub const IPPROTO_MEAS: ::c_int = 19;
1032 /// Host Monitoring
1033 pub const IPPROTO_HMP: ::c_int = 20;
1034 /// Packet Radio Measurement
1035 pub const IPPROTO_PRM: ::c_int = 21;
1036 /// xns idp
1037 pub const IPPROTO_IDP: ::c_int = 22;
1038 /// Trunk-1
1039 pub const IPPROTO_TRUNK1: ::c_int = 23;
1040 /// Trunk-2
1041 pub const IPPROTO_TRUNK2: ::c_int = 24;
1042 /// Leaf-1
1043 pub const IPPROTO_LEAF1: ::c_int = 25;
1044 /// Leaf-2
1045 pub const IPPROTO_LEAF2: ::c_int = 26;
1046 /// Reliable Data
1047 pub const IPPROTO_RDP: ::c_int = 27;
1048 /// Reliable Transaction
1049 pub const IPPROTO_IRTP: ::c_int = 28;
1050 /// tp-4 w/ class negotiation
1051 pub const IPPROTO_TP: ::c_int = 29;
1052 /// Bulk Data Transfer
1053 pub const IPPROTO_BLT: ::c_int = 30;
1054 /// Network Services
1055 pub const IPPROTO_NSP: ::c_int = 31;
1056 /// Merit Internodal
1057 pub const IPPROTO_INP: ::c_int = 32;
1058 #[doc(hidden)]
1059 #[deprecated(
1060     since = "0.2.72",
1061     note = "IPPROTO_SEP is deprecated. Use IPPROTO_DCCP instead"
1062 )]
1063 pub const IPPROTO_SEP: ::c_int = 33;
1064 /// Datagram Congestion Control Protocol
1065 pub const IPPROTO_DCCP: ::c_int = 33;
1066 /// Third Party Connect
1067 pub const IPPROTO_3PC: ::c_int = 34;
1068 /// InterDomain Policy Routing
1069 pub const IPPROTO_IDPR: ::c_int = 35;
1070 /// XTP
1071 pub const IPPROTO_XTP: ::c_int = 36;
1072 /// Datagram Delivery
1073 pub const IPPROTO_DDP: ::c_int = 37;
1074 /// Control Message Transport
1075 pub const IPPROTO_CMTP: ::c_int = 38;
1076 /// TP++ Transport
1077 pub const IPPROTO_TPXX: ::c_int = 39;
1078 /// IL transport protocol
1079 pub const IPPROTO_IL: ::c_int = 40;
1080 // IPPROTO_IPV6 defined in src/unix/mod.rs
1081 /// Source Demand Routing
1082 pub const IPPROTO_SDRP: ::c_int = 42;
1083 /// IP6 routing header
1084 pub const IPPROTO_ROUTING: ::c_int = 43;
1085 /// IP6 fragmentation header
1086 pub const IPPROTO_FRAGMENT: ::c_int = 44;
1087 /// InterDomain Routing
1088 pub const IPPROTO_IDRP: ::c_int = 45;
1089 /// resource reservation
1090 pub const IPPROTO_RSVP: ::c_int = 46;
1091 /// General Routing Encap.
1092 pub const IPPROTO_GRE: ::c_int = 47;
1093 /// Mobile Host Routing
1094 pub const IPPROTO_MHRP: ::c_int = 48;
1095 /// BHA
1096 pub const IPPROTO_BHA: ::c_int = 49;
1097 /// IP6 Encap Sec. Payload
1098 pub const IPPROTO_ESP: ::c_int = 50;
1099 /// IP6 Auth Header
1100 pub const IPPROTO_AH: ::c_int = 51;
1101 /// Integ. Net Layer Security
1102 pub const IPPROTO_INLSP: ::c_int = 52;
1103 /// IP with encryption
1104 pub const IPPROTO_SWIPE: ::c_int = 53;
1105 /// Next Hop Resolution
1106 pub const IPPROTO_NHRP: ::c_int = 54;
1107 /// IP Mobility
1108 pub const IPPROTO_MOBILE: ::c_int = 55;
1109 /// Transport Layer Security
1110 pub const IPPROTO_TLSP: ::c_int = 56;
1111 /// SKIP
1112 pub const IPPROTO_SKIP: ::c_int = 57;
1113 // IPPROTO_ICMPV6 defined in src/unix/mod.rs
1114 /// IP6 no next header
1115 pub const IPPROTO_NONE: ::c_int = 59;
1116 /// IP6 destination option
1117 pub const IPPROTO_DSTOPTS: ::c_int = 60;
1118 /// any host internal protocol
1119 pub const IPPROTO_AHIP: ::c_int = 61;
1120 /// CFTP
1121 pub const IPPROTO_CFTP: ::c_int = 62;
1122 /// "hello" routing protocol
1123 pub const IPPROTO_HELLO: ::c_int = 63;
1124 /// SATNET/Backroom EXPAK
1125 pub const IPPROTO_SATEXPAK: ::c_int = 64;
1126 /// Kryptolan
1127 pub const IPPROTO_KRYPTOLAN: ::c_int = 65;
1128 /// Remote Virtual Disk
1129 pub const IPPROTO_RVD: ::c_int = 66;
1130 /// Pluribus Packet Core
1131 pub const IPPROTO_IPPC: ::c_int = 67;
1132 /// Any distributed FS
1133 pub const IPPROTO_ADFS: ::c_int = 68;
1134 /// Satnet Monitoring
1135 pub const IPPROTO_SATMON: ::c_int = 69;
1136 /// VISA Protocol
1137 pub const IPPROTO_VISA: ::c_int = 70;
1138 /// Packet Core Utility
1139 pub const IPPROTO_IPCV: ::c_int = 71;
1140 /// Comp. Prot. Net. Executive
1141 pub const IPPROTO_CPNX: ::c_int = 72;
1142 /// Comp. Prot. HeartBeat
1143 pub const IPPROTO_CPHB: ::c_int = 73;
1144 /// Wang Span Network
1145 pub const IPPROTO_WSN: ::c_int = 74;
1146 /// Packet Video Protocol
1147 pub const IPPROTO_PVP: ::c_int = 75;
1148 /// BackRoom SATNET Monitoring
1149 pub const IPPROTO_BRSATMON: ::c_int = 76;
1150 /// Sun net disk proto (temp.)
1151 pub const IPPROTO_ND: ::c_int = 77;
1152 /// WIDEBAND Monitoring
1153 pub const IPPROTO_WBMON: ::c_int = 78;
1154 /// WIDEBAND EXPAK
1155 pub const IPPROTO_WBEXPAK: ::c_int = 79;
1156 /// ISO cnlp
1157 pub const IPPROTO_EON: ::c_int = 80;
1158 /// VMTP
1159 pub const IPPROTO_VMTP: ::c_int = 81;
1160 /// Secure VMTP
1161 pub const IPPROTO_SVMTP: ::c_int = 82;
1162 /// Banyon VINES
1163 pub const IPPROTO_VINES: ::c_int = 83;
1164 /// TTP
1165 pub const IPPROTO_TTP: ::c_int = 84;
1166 /// NSFNET-IGP
1167 pub const IPPROTO_IGP: ::c_int = 85;
1168 /// dissimilar gateway prot.
1169 pub const IPPROTO_DGP: ::c_int = 86;
1170 /// TCF
1171 pub const IPPROTO_TCF: ::c_int = 87;
1172 /// Cisco/GXS IGRP
1173 pub const IPPROTO_IGRP: ::c_int = 88;
1174 /// OSPFIGP
1175 pub const IPPROTO_OSPFIGP: ::c_int = 89;
1176 /// Strite RPC protocol
1177 pub const IPPROTO_SRPC: ::c_int = 90;
1178 /// Locus Address Resoloution
1179 pub const IPPROTO_LARP: ::c_int = 91;
1180 /// Multicast Transport
1181 pub const IPPROTO_MTP: ::c_int = 92;
1182 /// AX.25 Frames
1183 pub const IPPROTO_AX25: ::c_int = 93;
1184 /// IP encapsulated in IP
1185 pub const IPPROTO_IPEIP: ::c_int = 94;
1186 /// Mobile Int.ing control
1187 pub const IPPROTO_MICP: ::c_int = 95;
1188 /// Semaphore Comm. security
1189 pub const IPPROTO_SCCSP: ::c_int = 96;
1190 /// Ethernet IP encapsulation
1191 pub const IPPROTO_ETHERIP: ::c_int = 97;
1192 /// encapsulation header
1193 pub const IPPROTO_ENCAP: ::c_int = 98;
1194 /// any private encr. scheme
1195 pub const IPPROTO_APES: ::c_int = 99;
1196 /// GMTP
1197 pub const IPPROTO_GMTP: ::c_int = 100;
1198 /// payload compression (IPComp)
1199 pub const IPPROTO_IPCOMP: ::c_int = 108;
1200 /// SCTP
1201 pub const IPPROTO_SCTP: ::c_int = 132;
1202 /// IPv6 Mobility Header
1203 pub const IPPROTO_MH: ::c_int = 135;
1204 /// UDP-Lite
1205 pub const IPPROTO_UDPLITE: ::c_int = 136;
1206 /// IP6 Host Identity Protocol
1207 pub const IPPROTO_HIP: ::c_int = 139;
1208 /// IP6 Shim6 Protocol
1209 pub const IPPROTO_SHIM6: ::c_int = 140;
1210 
1211 /* 101-254: Partly Unassigned */
1212 /// Protocol Independent Mcast
1213 pub const IPPROTO_PIM: ::c_int = 103;
1214 /// CARP
1215 pub const IPPROTO_CARP: ::c_int = 112;
1216 /// PGM
1217 pub const IPPROTO_PGM: ::c_int = 113;
1218 /// MPLS-in-IP
1219 pub const IPPROTO_MPLS: ::c_int = 137;
1220 /// PFSYNC
1221 pub const IPPROTO_PFSYNC: ::c_int = 240;
1222 
1223 /* 255: Reserved */
1224 /* BSD Private, local use, namespace incursion, no longer used */
1225 /// OLD divert pseudo-proto
1226 pub const IPPROTO_OLD_DIVERT: ::c_int = 254;
1227 pub const IPPROTO_MAX: ::c_int = 256;
1228 /// last return value of *_input(), meaning "all job for this pkt is done".
1229 pub const IPPROTO_DONE: ::c_int = 257;
1230 
1231 /* Only used internally, so can be outside the range of valid IP protocols. */
1232 /// divert pseudo-protocol
1233 pub const IPPROTO_DIVERT: ::c_int = 258;
1234 /// SeND pseudo-protocol
1235 pub const IPPROTO_SEND: ::c_int = 259;
1236 
1237 // sys/netinet/TCP.h
1238 pub const TCP_MD5SIG: ::c_int = 16;
1239 pub const TCP_INFO: ::c_int = 32;
1240 pub const TCP_CONGESTION: ::c_int = 64;
1241 pub const TCP_CCALGOOPT: ::c_int = 65;
1242 pub const TCP_KEEPINIT: ::c_int = 128;
1243 pub const TCP_FASTOPEN: ::c_int = 1025;
1244 pub const TCP_PCAP_OUT: ::c_int = 2048;
1245 pub const TCP_PCAP_IN: ::c_int = 4096;
1246 
1247 pub const IP_BINDANY: ::c_int = 24;
1248 pub const IP_BINDMULTI: ::c_int = 25;
1249 pub const IP_RSS_LISTEN_BUCKET: ::c_int = 26;
1250 pub const IP_ORIGDSTADDR: ::c_int = 27;
1251 pub const IP_RECVORIGDSTADDR: ::c_int = IP_ORIGDSTADDR;
1252 
1253 pub const IP_RECVTOS: ::c_int = 68;
1254 
1255 pub const IPV6_BINDANY: ::c_int = 64;
1256 pub const IPV6_ORIGDSTADDR: ::c_int = 72;
1257 pub const IPV6_RECVORIGDSTADDR: ::c_int = IPV6_ORIGDSTADDR;
1258 
1259 pub const PF_SLOW: ::c_int = AF_SLOW;
1260 pub const PF_SCLUSTER: ::c_int = AF_SCLUSTER;
1261 pub const PF_ARP: ::c_int = AF_ARP;
1262 pub const PF_BLUETOOTH: ::c_int = AF_BLUETOOTH;
1263 pub const PF_IEEE80211: ::c_int = AF_IEEE80211;
1264 pub const PF_INET_SDP: ::c_int = AF_INET_SDP;
1265 pub const PF_INET6_SDP: ::c_int = AF_INET6_SDP;
1266 
1267 pub const NET_RT_DUMP: ::c_int = 1;
1268 pub const NET_RT_FLAGS: ::c_int = 2;
1269 pub const NET_RT_IFLIST: ::c_int = 3;
1270 pub const NET_RT_IFMALIST: ::c_int = 4;
1271 pub const NET_RT_IFLISTL: ::c_int = 5;
1272 
1273 // System V IPC
1274 pub const IPC_INFO: ::c_int = 3;
1275 pub const MSG_NOERROR: ::c_int = 0o10000;
1276 pub const SHM_LOCK: ::c_int = 11;
1277 pub const SHM_UNLOCK: ::c_int = 12;
1278 pub const SHM_STAT: ::c_int = 13;
1279 pub const SHM_INFO: ::c_int = 14;
1280 pub const SHM_ANON: *mut ::c_char = 1 as *mut ::c_char;
1281 
1282 // The *_MAXID constants never should've been used outside of the
1283 // FreeBSD base system.  And with the exception of CTL_P1003_1B_MAXID,
1284 // they were all removed in svn r262489.  They remain here for backwards
1285 // compatibility only, and are scheduled to be removed in libc 1.0.0.
1286 #[doc(hidden)]
1287 #[deprecated(since = "0.2.54", note = "Removed in FreeBSD 11")]
1288 pub const CTL_MAXID: ::c_int = 10;
1289 #[doc(hidden)]
1290 #[deprecated(since = "0.2.54", note = "Removed in FreeBSD 11")]
1291 pub const KERN_MAXID: ::c_int = 38;
1292 #[doc(hidden)]
1293 #[deprecated(since = "0.2.54", note = "Removed in FreeBSD 11")]
1294 pub const HW_MAXID: ::c_int = 13;
1295 #[doc(hidden)]
1296 #[deprecated(since = "0.2.54", note = "Removed in FreeBSD 11")]
1297 pub const USER_MAXID: ::c_int = 21;
1298 #[doc(hidden)]
1299 #[deprecated(since = "0.2.74", note = "Removed in FreeBSD 13")]
1300 pub const CTL_P1003_1B_MAXID: ::c_int = 26;
1301 
1302 pub const MSG_NOTIFICATION: ::c_int = 0x00002000;
1303 pub const MSG_NBIO: ::c_int = 0x00004000;
1304 pub const MSG_COMPAT: ::c_int = 0x00008000;
1305 pub const MSG_CMSG_CLOEXEC: ::c_int = 0x00040000;
1306 pub const MSG_NOSIGNAL: ::c_int = 0x20000;
1307 
1308 // utmpx entry types
1309 pub const EMPTY: ::c_short = 0;
1310 pub const BOOT_TIME: ::c_short = 1;
1311 pub const OLD_TIME: ::c_short = 2;
1312 pub const NEW_TIME: ::c_short = 3;
1313 pub const USER_PROCESS: ::c_short = 4;
1314 pub const INIT_PROCESS: ::c_short = 5;
1315 pub const LOGIN_PROCESS: ::c_short = 6;
1316 pub const DEAD_PROCESS: ::c_short = 7;
1317 pub const SHUTDOWN_TIME: ::c_short = 8;
1318 // utmp database types
1319 pub const UTXDB_ACTIVE: ::c_int = 0;
1320 pub const UTXDB_LASTLOGIN: ::c_int = 1;
1321 pub const UTXDB_LOG: ::c_int = 2;
1322 
1323 pub const LC_COLLATE_MASK: ::c_int = 1 << 0;
1324 pub const LC_CTYPE_MASK: ::c_int = 1 << 1;
1325 pub const LC_MONETARY_MASK: ::c_int = 1 << 2;
1326 pub const LC_NUMERIC_MASK: ::c_int = 1 << 3;
1327 pub const LC_TIME_MASK: ::c_int = 1 << 4;
1328 pub const LC_MESSAGES_MASK: ::c_int = 1 << 5;
1329 pub const LC_ALL_MASK: ::c_int = LC_COLLATE_MASK
1330     | LC_CTYPE_MASK
1331     | LC_MESSAGES_MASK
1332     | LC_MONETARY_MASK
1333     | LC_NUMERIC_MASK
1334     | LC_TIME_MASK;
1335 
1336 pub const WSTOPPED: ::c_int = 2; // same as WUNTRACED
1337 pub const WCONTINUED: ::c_int = 4;
1338 pub const WNOWAIT: ::c_int = 8;
1339 pub const WEXITED: ::c_int = 16;
1340 pub const WTRAPPED: ::c_int = 32;
1341 
1342 // FreeBSD defines a great many more of these, we only expose the
1343 // standardized ones.
1344 pub const P_PID: idtype_t = 0;
1345 pub const P_PGID: idtype_t = 2;
1346 pub const P_ALL: idtype_t = 7;
1347 
1348 pub const UTIME_OMIT: c_long = -2;
1349 pub const UTIME_NOW: c_long = -1;
1350 
1351 pub const B460800: ::speed_t = 460800;
1352 pub const B921600: ::speed_t = 921600;
1353 
1354 pub const AT_FDCWD: ::c_int = -100;
1355 pub const AT_EACCESS: ::c_int = 0x100;
1356 pub const AT_SYMLINK_NOFOLLOW: ::c_int = 0x200;
1357 pub const AT_SYMLINK_FOLLOW: ::c_int = 0x400;
1358 pub const AT_REMOVEDIR: ::c_int = 0x800;
1359 
1360 pub const AT_NULL: ::c_int = 0;
1361 pub const AT_IGNORE: ::c_int = 1;
1362 pub const AT_EXECFD: ::c_int = 2;
1363 pub const AT_PHDR: ::c_int = 3;
1364 pub const AT_PHENT: ::c_int = 4;
1365 pub const AT_PHNUM: ::c_int = 5;
1366 pub const AT_PAGESZ: ::c_int = 6;
1367 pub const AT_BASE: ::c_int = 7;
1368 pub const AT_FLAGS: ::c_int = 8;
1369 pub const AT_ENTRY: ::c_int = 9;
1370 pub const AT_NOTELF: ::c_int = 10;
1371 pub const AT_UID: ::c_int = 11;
1372 pub const AT_EUID: ::c_int = 12;
1373 pub const AT_GID: ::c_int = 13;
1374 pub const AT_EGID: ::c_int = 14;
1375 pub const AT_EXECPATH: ::c_int = 15;
1376 
1377 pub const TABDLY: ::tcflag_t = 0x00000004;
1378 pub const TAB0: ::tcflag_t = 0x00000000;
1379 pub const TAB3: ::tcflag_t = 0x00000004;
1380 
1381 pub const _PC_ACL_NFS4: ::c_int = 64;
1382 
1383 pub const _SC_CPUSET_SIZE: ::c_int = 122;
1384 
1385 // Flags which can be passed to pdfork(2)
1386 pub const PD_DAEMON: ::c_int = 0x00000001;
1387 pub const PD_CLOEXEC: ::c_int = 0x00000002;
1388 pub const PD_ALLOWED_AT_FORK: ::c_int = PD_DAEMON | PD_CLOEXEC;
1389 
1390 // Values for struct rtprio (type_ field)
1391 pub const RTP_PRIO_REALTIME: ::c_ushort = 2;
1392 pub const RTP_PRIO_NORMAL: ::c_ushort = 3;
1393 pub const RTP_PRIO_IDLE: ::c_ushort = 4;
1394 
1395 pub const POSIX_SPAWN_RESETIDS: ::c_int = 0x01;
1396 pub const POSIX_SPAWN_SETPGROUP: ::c_int = 0x02;
1397 pub const POSIX_SPAWN_SETSCHEDPARAM: ::c_int = 0x04;
1398 pub const POSIX_SPAWN_SETSCHEDULER: ::c_int = 0x08;
1399 pub const POSIX_SPAWN_SETSIGDEF: ::c_int = 0x10;
1400 pub const POSIX_SPAWN_SETSIGMASK: ::c_int = 0x20;
1401 
1402 // Flags for chflags(2)
1403 pub const UF_SYSTEM: ::c_ulong = 0x00000080;
1404 pub const UF_SPARSE: ::c_ulong = 0x00000100;
1405 pub const UF_OFFLINE: ::c_ulong = 0x00000200;
1406 pub const UF_REPARSE: ::c_ulong = 0x00000400;
1407 pub const UF_ARCHIVE: ::c_ulong = 0x00000800;
1408 pub const UF_READONLY: ::c_ulong = 0x00001000;
1409 pub const UF_HIDDEN: ::c_ulong = 0x00008000;
1410 pub const SF_SNAPSHOT: ::c_ulong = 0x00200000;
1411 
1412 pub const F_OGETLK: ::c_int = 7;
1413 pub const F_OSETLK: ::c_int = 8;
1414 pub const F_OSETLKW: ::c_int = 9;
1415 pub const F_DUP2FD: ::c_int = 10;
1416 pub const F_SETLK_REMOTE: ::c_int = 14;
1417 pub const F_READAHEAD: ::c_int = 15;
1418 pub const F_RDAHEAD: ::c_int = 16;
1419 pub const F_DUP2FD_CLOEXEC: ::c_int = 18;
1420 
1421 // For realhostname* api
1422 pub const HOSTNAME_FOUND: ::c_int = 0;
1423 pub const HOSTNAME_INCORRECTNAME: ::c_int = 1;
1424 pub const HOSTNAME_INVALIDADDR: ::c_int = 2;
1425 pub const HOSTNAME_INVALIDNAME: ::c_int = 3;
1426 
1427 // For rfork
1428 pub const RFFDG: ::c_int = 4;
1429 pub const RFPROC: ::c_int = 16;
1430 pub const RFMEM: ::c_int = 32;
1431 pub const RFNOWAIT: ::c_int = 64;
1432 pub const RFCFDG: ::c_int = 4096;
1433 pub const RFTHREAD: ::c_int = 8192;
1434 pub const RFLINUXTHPN: ::c_int = 65536;
1435 pub const RFTSIGZMB: ::c_int = 524288;
1436 pub const RFSPAWN: ::c_int = 2147483648;
1437 
1438 pub const MALLOCX_ZERO: ::c_int = 0x40;
1439 
1440 const_fn! {
1441     {const} fn _ALIGN(p: usize) -> usize {
1442         (p + _ALIGNBYTES) & !_ALIGNBYTES
1443     }
1444 }
1445 
1446 f! {
1447     pub fn CMSG_DATA(cmsg: *const ::cmsghdr) -> *mut ::c_uchar {
1448         (cmsg as *mut ::c_uchar)
1449             .offset(_ALIGN(::mem::size_of::<::cmsghdr>()) as isize)
1450     }
1451 
1452     pub fn CMSG_LEN(length: ::c_uint) -> ::c_uint {
1453         _ALIGN(::mem::size_of::<::cmsghdr>()) as ::c_uint + length
1454     }
1455 
1456     pub fn CMSG_NXTHDR(mhdr: *const ::msghdr, cmsg: *const ::cmsghdr)
1457         -> *mut ::cmsghdr
1458     {
1459         if cmsg.is_null() {
1460             return ::CMSG_FIRSTHDR(mhdr);
1461         };
1462         let next = cmsg as usize + _ALIGN((*cmsg).cmsg_len as usize)
1463             + _ALIGN(::mem::size_of::<::cmsghdr>());
1464         let max = (*mhdr).msg_control as usize
1465             + (*mhdr).msg_controllen as usize;
1466         if next > max {
1467             0 as *mut ::cmsghdr
1468         } else {
1469             (cmsg as usize + _ALIGN((*cmsg).cmsg_len as usize))
1470                 as *mut ::cmsghdr
1471         }
1472     }
1473 
1474     pub {const} fn CMSG_SPACE(length: ::c_uint) -> ::c_uint {
1475         (_ALIGN(::mem::size_of::<::cmsghdr>()) + _ALIGN(length as usize))
1476             as ::c_uint
1477     }
1478 
1479     pub fn MALLOCX_ALIGN(lg: ::c_uint) -> ::c_int {
1480         ffsl(lg as ::c_long - 1)
1481     }
1482 
1483     pub {const} fn MALLOCX_TCACHE(tc: ::c_int) -> ::c_int {
1484         (tc + 2) << 8 as ::c_int
1485     }
1486 
1487     pub {const} fn MALLOCX_ARENA(a: ::c_int) -> ::c_int {
1488         (a + 1) << 20 as ::c_int
1489     }
1490 
1491     pub fn SOCKCREDSIZE(ngrps: usize) -> usize {
1492         let ngrps = if ngrps > 0 {
1493             ngrps - 1
1494         } else {
1495             0
1496         };
1497         ::mem::size_of::<sockcred>() + ::mem::size_of::<::gid_t>() * ngrps
1498     }
1499 
1500     pub fn uname(buf: *mut ::utsname) -> ::c_int {
1501         __xuname(256, buf as *mut ::c_void)
1502     }
1503 
1504     pub fn CPU_ZERO(cpuset: &mut cpuset_t) -> () {
1505         for slot in cpuset.__bits.iter_mut() {
1506             *slot = 0;
1507         }
1508     }
1509 
1510     pub fn CPU_FILL(cpuset: &mut cpuset_t) -> () {
1511         for slot in cpuset.__bits.iter_mut() {
1512             *slot = !0;
1513         }
1514     }
1515 
1516     pub fn CPU_SET(cpu: usize, cpuset: &mut cpuset_t) -> () {
1517         let bitset_bits = ::mem::size_of::<::c_long>();
1518         let (idx, offset) = (cpu / bitset_bits, cpu % bitset_bits);
1519         cpuset.__bits[idx] |= 1 << offset;
1520         ()
1521     }
1522 
1523     pub fn CPU_CLR(cpu: usize, cpuset: &mut cpuset_t) -> () {
1524         let bitset_bits = ::mem::size_of::<::c_long>();
1525         let (idx, offset) = (cpu / bitset_bits, cpu % bitset_bits);
1526         cpuset.__bits[idx] &= !(1 << offset);
1527         ()
1528     }
1529 
1530     pub fn CPU_ISSET(cpu: usize, cpuset: &mut cpuset_t) -> bool {
1531         let bitset_bits = ::mem::size_of::<::c_long>();
1532         let (idx, offset) = (cpu / bitset_bits, cpu % bitset_bits);
1533         0 != cpuset.__bits[idx] & (1 << offset)
1534     }
1535 }
1536 
1537 safe_f! {
1538     pub {const} fn WIFSIGNALED(status: ::c_int) -> bool {
1539         (status & 0o177) != 0o177 && (status & 0o177) != 0 && status != 0x13
1540     }
1541 }
1542 
1543 extern "C" {
__error() -> *mut ::c_int1544     pub fn __error() -> *mut ::c_int;
1545 
aio_cancel(fd: ::c_int, aiocbp: *mut aiocb) -> ::c_int1546     pub fn aio_cancel(fd: ::c_int, aiocbp: *mut aiocb) -> ::c_int;
aio_error(aiocbp: *const aiocb) -> ::c_int1547     pub fn aio_error(aiocbp: *const aiocb) -> ::c_int;
aio_fsync(op: ::c_int, aiocbp: *mut aiocb) -> ::c_int1548     pub fn aio_fsync(op: ::c_int, aiocbp: *mut aiocb) -> ::c_int;
aio_read(aiocbp: *mut aiocb) -> ::c_int1549     pub fn aio_read(aiocbp: *mut aiocb) -> ::c_int;
aio_return(aiocbp: *mut aiocb) -> ::ssize_t1550     pub fn aio_return(aiocbp: *mut aiocb) -> ::ssize_t;
aio_suspend( aiocb_list: *const *const aiocb, nitems: ::c_int, timeout: *const ::timespec, ) -> ::c_int1551     pub fn aio_suspend(
1552         aiocb_list: *const *const aiocb,
1553         nitems: ::c_int,
1554         timeout: *const ::timespec,
1555     ) -> ::c_int;
aio_write(aiocbp: *mut aiocb) -> ::c_int1556     pub fn aio_write(aiocbp: *mut aiocb) -> ::c_int;
1557 
extattr_delete_fd( fd: ::c_int, attrnamespace: ::c_int, attrname: *const ::c_char, ) -> ::c_int1558     pub fn extattr_delete_fd(
1559         fd: ::c_int,
1560         attrnamespace: ::c_int,
1561         attrname: *const ::c_char,
1562     ) -> ::c_int;
extattr_delete_file( path: *const ::c_char, attrnamespace: ::c_int, attrname: *const ::c_char, ) -> ::c_int1563     pub fn extattr_delete_file(
1564         path: *const ::c_char,
1565         attrnamespace: ::c_int,
1566         attrname: *const ::c_char,
1567     ) -> ::c_int;
extattr_delete_link( path: *const ::c_char, attrnamespace: ::c_int, attrname: *const ::c_char, ) -> ::c_int1568     pub fn extattr_delete_link(
1569         path: *const ::c_char,
1570         attrnamespace: ::c_int,
1571         attrname: *const ::c_char,
1572     ) -> ::c_int;
extattr_get_fd( fd: ::c_int, attrnamespace: ::c_int, attrname: *const ::c_char, data: *mut ::c_void, nbytes: ::size_t, ) -> ::ssize_t1573     pub fn extattr_get_fd(
1574         fd: ::c_int,
1575         attrnamespace: ::c_int,
1576         attrname: *const ::c_char,
1577         data: *mut ::c_void,
1578         nbytes: ::size_t,
1579     ) -> ::ssize_t;
extattr_get_file( path: *const ::c_char, attrnamespace: ::c_int, attrname: *const ::c_char, data: *mut ::c_void, nbytes: ::size_t, ) -> ::ssize_t1580     pub fn extattr_get_file(
1581         path: *const ::c_char,
1582         attrnamespace: ::c_int,
1583         attrname: *const ::c_char,
1584         data: *mut ::c_void,
1585         nbytes: ::size_t,
1586     ) -> ::ssize_t;
extattr_get_link( path: *const ::c_char, attrnamespace: ::c_int, attrname: *const ::c_char, data: *mut ::c_void, nbytes: ::size_t, ) -> ::ssize_t1587     pub fn extattr_get_link(
1588         path: *const ::c_char,
1589         attrnamespace: ::c_int,
1590         attrname: *const ::c_char,
1591         data: *mut ::c_void,
1592         nbytes: ::size_t,
1593     ) -> ::ssize_t;
extattr_list_fd( fd: ::c_int, attrnamespace: ::c_int, data: *mut ::c_void, nbytes: ::size_t, ) -> ::ssize_t1594     pub fn extattr_list_fd(
1595         fd: ::c_int,
1596         attrnamespace: ::c_int,
1597         data: *mut ::c_void,
1598         nbytes: ::size_t,
1599     ) -> ::ssize_t;
extattr_list_file( path: *const ::c_char, attrnamespace: ::c_int, data: *mut ::c_void, nbytes: ::size_t, ) -> ::ssize_t1600     pub fn extattr_list_file(
1601         path: *const ::c_char,
1602         attrnamespace: ::c_int,
1603         data: *mut ::c_void,
1604         nbytes: ::size_t,
1605     ) -> ::ssize_t;
extattr_list_link( path: *const ::c_char, attrnamespace: ::c_int, data: *mut ::c_void, nbytes: ::size_t, ) -> ::ssize_t1606     pub fn extattr_list_link(
1607         path: *const ::c_char,
1608         attrnamespace: ::c_int,
1609         data: *mut ::c_void,
1610         nbytes: ::size_t,
1611     ) -> ::ssize_t;
extattr_set_fd( fd: ::c_int, attrnamespace: ::c_int, attrname: *const ::c_char, data: *const ::c_void, nbytes: ::size_t, ) -> ::ssize_t1612     pub fn extattr_set_fd(
1613         fd: ::c_int,
1614         attrnamespace: ::c_int,
1615         attrname: *const ::c_char,
1616         data: *const ::c_void,
1617         nbytes: ::size_t,
1618     ) -> ::ssize_t;
extattr_set_file( path: *const ::c_char, attrnamespace: ::c_int, attrname: *const ::c_char, data: *const ::c_void, nbytes: ::size_t, ) -> ::ssize_t1619     pub fn extattr_set_file(
1620         path: *const ::c_char,
1621         attrnamespace: ::c_int,
1622         attrname: *const ::c_char,
1623         data: *const ::c_void,
1624         nbytes: ::size_t,
1625     ) -> ::ssize_t;
extattr_set_link( path: *const ::c_char, attrnamespace: ::c_int, attrname: *const ::c_char, data: *const ::c_void, nbytes: ::size_t, ) -> ::ssize_t1626     pub fn extattr_set_link(
1627         path: *const ::c_char,
1628         attrnamespace: ::c_int,
1629         attrname: *const ::c_char,
1630         data: *const ::c_void,
1631         nbytes: ::size_t,
1632     ) -> ::ssize_t;
1633 
jail(jail: *mut ::jail) -> ::c_int1634     pub fn jail(jail: *mut ::jail) -> ::c_int;
jail_attach(jid: ::c_int) -> ::c_int1635     pub fn jail_attach(jid: ::c_int) -> ::c_int;
jail_remove(jid: ::c_int) -> ::c_int1636     pub fn jail_remove(jid: ::c_int) -> ::c_int;
jail_get(iov: *mut ::iovec, niov: ::c_uint, flags: ::c_int) -> ::c_int1637     pub fn jail_get(iov: *mut ::iovec, niov: ::c_uint, flags: ::c_int) -> ::c_int;
jail_set(iov: *mut ::iovec, niov: ::c_uint, flags: ::c_int) -> ::c_int1638     pub fn jail_set(iov: *mut ::iovec, niov: ::c_uint, flags: ::c_int) -> ::c_int;
1639 
lio_listio( mode: ::c_int, aiocb_list: *const *mut aiocb, nitems: ::c_int, sevp: *mut sigevent, ) -> ::c_int1640     pub fn lio_listio(
1641         mode: ::c_int,
1642         aiocb_list: *const *mut aiocb,
1643         nitems: ::c_int,
1644         sevp: *mut sigevent,
1645     ) -> ::c_int;
1646 
posix_fallocate(fd: ::c_int, offset: ::off_t, len: ::off_t) -> ::c_int1647     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_int1648     pub fn posix_fadvise(fd: ::c_int, offset: ::off_t, len: ::off_t, advise: ::c_int) -> ::c_int;
mkostemp(template: *mut ::c_char, flags: ::c_int) -> ::c_int1649     pub fn mkostemp(template: *mut ::c_char, flags: ::c_int) -> ::c_int;
mkostemps(template: *mut ::c_char, suffixlen: ::c_int, flags: ::c_int) -> ::c_int1650     pub fn mkostemps(template: *mut ::c_char, suffixlen: ::c_int, flags: ::c_int) -> ::c_int;
1651 
getutxuser(user: *const ::c_char) -> *mut utmpx1652     pub fn getutxuser(user: *const ::c_char) -> *mut utmpx;
setutxdb(_type: ::c_int, file: *const ::c_char) -> ::c_int1653     pub fn setutxdb(_type: ::c_int, file: *const ::c_char) -> ::c_int;
1654 
aio_waitcomplete(iocbp: *mut *mut aiocb, timeout: *mut ::timespec) -> ::ssize_t1655     pub fn aio_waitcomplete(iocbp: *mut *mut aiocb, timeout: *mut ::timespec) -> ::ssize_t;
mq_getfd_np(mqd: ::mqd_t) -> ::c_int1656     pub fn mq_getfd_np(mqd: ::mqd_t) -> ::c_int;
1657 
waitid( idtype: idtype_t, id: ::id_t, infop: *mut ::siginfo_t, options: ::c_int, ) -> ::c_int1658     pub fn waitid(
1659         idtype: idtype_t,
1660         id: ::id_t,
1661         infop: *mut ::siginfo_t,
1662         options: ::c_int,
1663     ) -> ::c_int;
1664 
ftok(pathname: *const ::c_char, proj_id: ::c_int) -> ::key_t1665     pub fn ftok(pathname: *const ::c_char, proj_id: ::c_int) -> ::key_t;
shmget(key: ::key_t, size: ::size_t, shmflg: ::c_int) -> ::c_int1666     pub fn shmget(key: ::key_t, size: ::size_t, shmflg: ::c_int) -> ::c_int;
shmat(shmid: ::c_int, shmaddr: *const ::c_void, shmflg: ::c_int) -> *mut ::c_void1667     pub fn shmat(shmid: ::c_int, shmaddr: *const ::c_void, shmflg: ::c_int) -> *mut ::c_void;
shmdt(shmaddr: *const ::c_void) -> ::c_int1668     pub fn shmdt(shmaddr: *const ::c_void) -> ::c_int;
shmctl(shmid: ::c_int, cmd: ::c_int, buf: *mut ::shmid_ds) -> ::c_int1669     pub fn shmctl(shmid: ::c_int, cmd: ::c_int, buf: *mut ::shmid_ds) -> ::c_int;
msgctl(msqid: ::c_int, cmd: ::c_int, buf: *mut ::msqid_ds) -> ::c_int1670     pub fn msgctl(msqid: ::c_int, cmd: ::c_int, buf: *mut ::msqid_ds) -> ::c_int;
msgget(key: ::key_t, msgflg: ::c_int) -> ::c_int1671     pub fn msgget(key: ::key_t, msgflg: ::c_int) -> ::c_int;
msgsnd( msqid: ::c_int, msgp: *const ::c_void, msgsz: ::size_t, msgflg: ::c_int, ) -> ::c_int1672     pub fn msgsnd(
1673         msqid: ::c_int,
1674         msgp: *const ::c_void,
1675         msgsz: ::size_t,
1676         msgflg: ::c_int,
1677     ) -> ::c_int;
cfmakesane(termios: *mut ::termios)1678     pub fn cfmakesane(termios: *mut ::termios);
fexecve( fd: ::c_int, argv: *const *const ::c_char, envp: *const *const ::c_char, ) -> ::c_int1679     pub fn fexecve(
1680         fd: ::c_int,
1681         argv: *const *const ::c_char,
1682         envp: *const *const ::c_char,
1683     ) -> ::c_int;
1684 
pdfork(fdp: *mut ::c_int, flags: ::c_int) -> ::pid_t1685     pub fn pdfork(fdp: *mut ::c_int, flags: ::c_int) -> ::pid_t;
pdgetpid(fd: ::c_int, pidp: *mut ::pid_t) -> ::c_int1686     pub fn pdgetpid(fd: ::c_int, pidp: *mut ::pid_t) -> ::c_int;
pdkill(fd: ::c_int, signum: ::c_int) -> ::c_int1687     pub fn pdkill(fd: ::c_int, signum: ::c_int) -> ::c_int;
1688 
rtprio_thread(function: ::c_int, lwpid: ::lwpid_t, rtp: *mut super::rtprio) -> ::c_int1689     pub fn rtprio_thread(function: ::c_int, lwpid: ::lwpid_t, rtp: *mut super::rtprio) -> ::c_int;
1690 
posix_spawn( pid: *mut ::pid_t, path: *const ::c_char, file_actions: *const ::posix_spawn_file_actions_t, attrp: *const ::posix_spawnattr_t, argv: *const *mut ::c_char, envp: *const *mut ::c_char, ) -> ::c_int1691     pub fn posix_spawn(
1692         pid: *mut ::pid_t,
1693         path: *const ::c_char,
1694         file_actions: *const ::posix_spawn_file_actions_t,
1695         attrp: *const ::posix_spawnattr_t,
1696         argv: *const *mut ::c_char,
1697         envp: *const *mut ::c_char,
1698     ) -> ::c_int;
posix_spawnp( pid: *mut ::pid_t, file: *const ::c_char, file_actions: *const ::posix_spawn_file_actions_t, attrp: *const ::posix_spawnattr_t, argv: *const *mut ::c_char, envp: *const *mut ::c_char, ) -> ::c_int1699     pub fn posix_spawnp(
1700         pid: *mut ::pid_t,
1701         file: *const ::c_char,
1702         file_actions: *const ::posix_spawn_file_actions_t,
1703         attrp: *const ::posix_spawnattr_t,
1704         argv: *const *mut ::c_char,
1705         envp: *const *mut ::c_char,
1706     ) -> ::c_int;
posix_spawnattr_init(attr: *mut posix_spawnattr_t) -> ::c_int1707     pub fn posix_spawnattr_init(attr: *mut posix_spawnattr_t) -> ::c_int;
posix_spawnattr_destroy(attr: *mut posix_spawnattr_t) -> ::c_int1708     pub fn posix_spawnattr_destroy(attr: *mut posix_spawnattr_t) -> ::c_int;
posix_spawnattr_getsigdefault( attr: *const posix_spawnattr_t, default: *mut ::sigset_t, ) -> ::c_int1709     pub fn posix_spawnattr_getsigdefault(
1710         attr: *const posix_spawnattr_t,
1711         default: *mut ::sigset_t,
1712     ) -> ::c_int;
posix_spawnattr_setsigdefault( attr: *mut posix_spawnattr_t, default: *const ::sigset_t, ) -> ::c_int1713     pub fn posix_spawnattr_setsigdefault(
1714         attr: *mut posix_spawnattr_t,
1715         default: *const ::sigset_t,
1716     ) -> ::c_int;
posix_spawnattr_getsigmask( attr: *const posix_spawnattr_t, default: *mut ::sigset_t, ) -> ::c_int1717     pub fn posix_spawnattr_getsigmask(
1718         attr: *const posix_spawnattr_t,
1719         default: *mut ::sigset_t,
1720     ) -> ::c_int;
posix_spawnattr_setsigmask( attr: *mut posix_spawnattr_t, default: *const ::sigset_t, ) -> ::c_int1721     pub fn posix_spawnattr_setsigmask(
1722         attr: *mut posix_spawnattr_t,
1723         default: *const ::sigset_t,
1724     ) -> ::c_int;
posix_spawnattr_getflags( attr: *const posix_spawnattr_t, flags: *mut ::c_short, ) -> ::c_int1725     pub fn posix_spawnattr_getflags(
1726         attr: *const posix_spawnattr_t,
1727         flags: *mut ::c_short,
1728     ) -> ::c_int;
posix_spawnattr_setflags(attr: *mut posix_spawnattr_t, flags: ::c_short) -> ::c_int1729     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 ::pid_t, ) -> ::c_int1730     pub fn posix_spawnattr_getpgroup(
1731         attr: *const posix_spawnattr_t,
1732         flags: *mut ::pid_t,
1733     ) -> ::c_int;
posix_spawnattr_setpgroup(attr: *mut posix_spawnattr_t, flags: ::pid_t) -> ::c_int1734     pub fn posix_spawnattr_setpgroup(attr: *mut posix_spawnattr_t, flags: ::pid_t) -> ::c_int;
posix_spawnattr_getschedpolicy( attr: *const posix_spawnattr_t, flags: *mut ::c_int, ) -> ::c_int1735     pub fn posix_spawnattr_getschedpolicy(
1736         attr: *const posix_spawnattr_t,
1737         flags: *mut ::c_int,
1738     ) -> ::c_int;
posix_spawnattr_setschedpolicy(attr: *mut posix_spawnattr_t, flags: ::c_int) -> ::c_int1739     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 ::sched_param, ) -> ::c_int1740     pub fn posix_spawnattr_getschedparam(
1741         attr: *const posix_spawnattr_t,
1742         param: *mut ::sched_param,
1743     ) -> ::c_int;
posix_spawnattr_setschedparam( attr: *mut posix_spawnattr_t, param: *const ::sched_param, ) -> ::c_int1744     pub fn posix_spawnattr_setschedparam(
1745         attr: *mut posix_spawnattr_t,
1746         param: *const ::sched_param,
1747     ) -> ::c_int;
1748 
posix_spawn_file_actions_init(actions: *mut posix_spawn_file_actions_t) -> ::c_int1749     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_int1750     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_int1751     pub fn posix_spawn_file_actions_addopen(
1752         actions: *mut posix_spawn_file_actions_t,
1753         fd: ::c_int,
1754         path: *const ::c_char,
1755         oflag: ::c_int,
1756         mode: ::mode_t,
1757     ) -> ::c_int;
posix_spawn_file_actions_addclose( actions: *mut posix_spawn_file_actions_t, fd: ::c_int, ) -> ::c_int1758     pub fn posix_spawn_file_actions_addclose(
1759         actions: *mut posix_spawn_file_actions_t,
1760         fd: ::c_int,
1761     ) -> ::c_int;
posix_spawn_file_actions_adddup2( actions: *mut posix_spawn_file_actions_t, fd: ::c_int, newfd: ::c_int, ) -> ::c_int1762     pub fn posix_spawn_file_actions_adddup2(
1763         actions: *mut posix_spawn_file_actions_t,
1764         fd: ::c_int,
1765         newfd: ::c_int,
1766     ) -> ::c_int;
1767 
pthread_getthreadid_np() -> ::c_int1768     pub fn pthread_getthreadid_np() -> ::c_int;
pthread_getaffinity_np( td: ::pthread_t, cpusetsize: ::size_t, cpusetp: *mut cpuset_t, ) -> ::c_int1769     pub fn pthread_getaffinity_np(
1770         td: ::pthread_t,
1771         cpusetsize: ::size_t,
1772         cpusetp: *mut cpuset_t,
1773     ) -> ::c_int;
pthread_setaffinity_np( td: ::pthread_t, cpusetsize: ::size_t, cpusetp: *const cpuset_t, ) -> ::c_int1774     pub fn pthread_setaffinity_np(
1775         td: ::pthread_t,
1776         cpusetsize: ::size_t,
1777         cpusetp: *const cpuset_t,
1778     ) -> ::c_int;
1779 
pthread_spin_init(lock: *mut pthread_spinlock_t, pshared: ::c_int) -> ::c_int1780     pub fn pthread_spin_init(lock: *mut pthread_spinlock_t, pshared: ::c_int) -> ::c_int;
pthread_spin_destroy(lock: *mut pthread_spinlock_t) -> ::c_int1781     pub fn pthread_spin_destroy(lock: *mut pthread_spinlock_t) -> ::c_int;
pthread_spin_lock(lock: *mut pthread_spinlock_t) -> ::c_int1782     pub fn pthread_spin_lock(lock: *mut pthread_spinlock_t) -> ::c_int;
pthread_spin_trylock(lock: *mut pthread_spinlock_t) -> ::c_int1783     pub fn pthread_spin_trylock(lock: *mut pthread_spinlock_t) -> ::c_int;
pthread_spin_unlock(lock: *mut pthread_spinlock_t) -> ::c_int1784     pub fn pthread_spin_unlock(lock: *mut pthread_spinlock_t) -> ::c_int;
1785 
1786     #[cfg_attr(all(target_os = "freebsd", freebsd11), link_name = "statfs@FBSD_1.0")]
statfs(path: *const ::c_char, buf: *mut statfs) -> ::c_int1787     pub fn statfs(path: *const ::c_char, buf: *mut statfs) -> ::c_int;
1788     #[cfg_attr(all(target_os = "freebsd", freebsd11), link_name = "fstatfs@FBSD_1.0")]
fstatfs(fd: ::c_int, buf: *mut statfs) -> ::c_int1789     pub fn fstatfs(fd: ::c_int, buf: *mut statfs) -> ::c_int;
1790 
dup3(src: ::c_int, dst: ::c_int, flags: ::c_int) -> ::c_int1791     pub fn dup3(src: ::c_int, dst: ::c_int, flags: ::c_int) -> ::c_int;
__xuname(nmln: ::c_int, buf: *mut ::c_void) -> ::c_int1792     pub fn __xuname(nmln: ::c_int, buf: *mut ::c_void) -> ::c_int;
1793 
sendmmsg( sockfd: ::c_int, msgvec: *mut ::mmsghdr, vlen: ::size_t, flags: ::c_int, ) -> ::ssize_t1794     pub fn sendmmsg(
1795         sockfd: ::c_int,
1796         msgvec: *mut ::mmsghdr,
1797         vlen: ::size_t,
1798         flags: ::c_int,
1799     ) -> ::ssize_t;
recvmmsg( sockfd: ::c_int, msgvec: *mut ::mmsghdr, vlen: ::size_t, flags: ::c_int, timeout: *const ::timespec, ) -> ::ssize_t1800     pub fn recvmmsg(
1801         sockfd: ::c_int,
1802         msgvec: *mut ::mmsghdr,
1803         vlen: ::size_t,
1804         flags: ::c_int,
1805         timeout: *const ::timespec,
1806     ) -> ::ssize_t;
memmem( haystack: *const ::c_void, haystacklen: ::size_t, needle: *const ::c_void, needlelen: ::size_t, ) -> *mut ::c_void1807     pub fn memmem(
1808         haystack: *const ::c_void,
1809         haystacklen: ::size_t,
1810         needle: *const ::c_void,
1811         needlelen: ::size_t,
1812     ) -> *mut ::c_void;
1813 
nmount(iov: *mut ::iovec, niov: ::c_uint, flags: ::c_int) -> ::c_int1814     pub fn nmount(iov: *mut ::iovec, niov: ::c_uint, flags: ::c_int) -> ::c_int;
setproctitle(fmt: *const ::c_char, ...)1815     pub fn setproctitle(fmt: *const ::c_char, ...);
rfork(flags: ::c_int) -> ::c_int1816     pub fn rfork(flags: ::c_int) -> ::c_int;
cpuset_getaffinity( level: cpulevel_t, which: cpuwhich_t, id: ::id_t, setsize: ::size_t, mask: *mut cpuset_t, ) -> ::c_int1817     pub fn cpuset_getaffinity(
1818         level: cpulevel_t,
1819         which: cpuwhich_t,
1820         id: ::id_t,
1821         setsize: ::size_t,
1822         mask: *mut cpuset_t,
1823     ) -> ::c_int;
cpuset_setaffinity( level: cpulevel_t, which: cpuwhich_t, id: ::id_t, setsize: ::size_t, mask: *const cpuset_t, ) -> ::c_int1824     pub fn cpuset_setaffinity(
1825         level: cpulevel_t,
1826         which: cpuwhich_t,
1827         id: ::id_t,
1828         setsize: ::size_t,
1829         mask: *const cpuset_t,
1830     ) -> ::c_int;
cap_enter() -> ::c_int1831     pub fn cap_enter() -> ::c_int;
cap_getmode(modep: *mut ::c_uint) -> ::c_int1832     pub fn cap_getmode(modep: *mut ::c_uint) -> ::c_int;
__cap_rights_init(version: ::c_int, rights: *mut cap_rights_t, ...) -> *mut cap_rights_t1833     pub fn __cap_rights_init(version: ::c_int, rights: *mut cap_rights_t, ...)
1834         -> *mut cap_rights_t;
__cap_rights_set(rights: *mut cap_rights_t, ...) -> *mut cap_rights_t1835     pub fn __cap_rights_set(rights: *mut cap_rights_t, ...) -> *mut cap_rights_t;
__cap_rights_clear(rights: *mut cap_rights_t, ...) -> *mut cap_rights_t1836     pub fn __cap_rights_clear(rights: *mut cap_rights_t, ...) -> *mut cap_rights_t;
__cap_rights_is_set(rights: *const cap_rights_t, ...) -> bool1837     pub fn __cap_rights_is_set(rights: *const cap_rights_t, ...) -> bool;
cap_rights_is_valid(rights: *const cap_rights_t) -> bool1838     pub fn cap_rights_is_valid(rights: *const cap_rights_t) -> bool;
cap_rights_limit(fd: ::c_int, rights: *const cap_rights_t) -> ::c_int1839     pub fn cap_rights_limit(fd: ::c_int, rights: *const cap_rights_t) -> ::c_int;
cap_rights_merge(dst: *mut cap_rights_t, src: *const cap_rights_t) -> *mut cap_rights_t1840     pub fn cap_rights_merge(dst: *mut cap_rights_t, src: *const cap_rights_t) -> *mut cap_rights_t;
cap_rights_remove(dst: *mut cap_rights_t, src: *const cap_rights_t) -> *mut cap_rights_t1841     pub fn cap_rights_remove(dst: *mut cap_rights_t, src: *const cap_rights_t)
1842         -> *mut cap_rights_t;
cap_rights_contains(big: *const cap_rights_t, little: *const cap_rights_t) -> bool1843     pub fn cap_rights_contains(big: *const cap_rights_t, little: *const cap_rights_t) -> bool;
1844 
reallocarray(ptr: *mut ::c_void, nmemb: ::size_t, size: ::size_t) -> *mut ::c_void1845     pub fn reallocarray(ptr: *mut ::c_void, nmemb: ::size_t, size: ::size_t) -> *mut ::c_void;
1846 
ffs(value: ::c_int) -> ::c_int1847     pub fn ffs(value: ::c_int) -> ::c_int;
ffsl(value: ::c_long) -> ::c_int1848     pub fn ffsl(value: ::c_long) -> ::c_int;
ffsll(value: ::c_longlong) -> ::c_int1849     pub fn ffsll(value: ::c_longlong) -> ::c_int;
fls(value: ::c_int) -> ::c_int1850     pub fn fls(value: ::c_int) -> ::c_int;
flsl(value: ::c_long) -> ::c_int1851     pub fn flsl(value: ::c_long) -> ::c_int;
flsll(value: ::c_longlong) -> ::c_int1852     pub fn flsll(value: ::c_longlong) -> ::c_int;
malloc_usable_size(ptr: *const ::c_void) -> ::size_t1853     pub fn malloc_usable_size(ptr: *const ::c_void) -> ::size_t;
malloc_stats_print( write_cb: unsafe extern "C" fn(*mut ::c_void, *const ::c_char), cbopaque: *mut ::c_void, opt: *const ::c_char, )1854     pub fn malloc_stats_print(
1855         write_cb: unsafe extern "C" fn(*mut ::c_void, *const ::c_char),
1856         cbopaque: *mut ::c_void,
1857         opt: *const ::c_char,
1858     );
mallctl( name: *const ::c_char, oldp: *mut ::c_void, oldlenp: *mut ::size_t, newp: *mut ::c_void, newlen: ::size_t, ) -> ::c_int1859     pub fn mallctl(
1860         name: *const ::c_char,
1861         oldp: *mut ::c_void,
1862         oldlenp: *mut ::size_t,
1863         newp: *mut ::c_void,
1864         newlen: ::size_t,
1865     ) -> ::c_int;
mallctlnametomib( name: *const ::c_char, mibp: *mut ::size_t, miplen: *mut ::size_t, ) -> ::c_int1866     pub fn mallctlnametomib(
1867         name: *const ::c_char,
1868         mibp: *mut ::size_t,
1869         miplen: *mut ::size_t,
1870     ) -> ::c_int;
mallctlbymib( mib: *const ::size_t, mible: ::size_t, oldp: *mut ::c_void, oldlenp: *mut ::size_t, newp: *mut ::c_void, newlen: ::size_t, ) -> ::c_int1871     pub fn mallctlbymib(
1872         mib: *const ::size_t,
1873         mible: ::size_t,
1874         oldp: *mut ::c_void,
1875         oldlenp: *mut ::size_t,
1876         newp: *mut ::c_void,
1877         newlen: ::size_t,
1878     ) -> ::c_int;
mallocx(size: ::size_t, flags: ::c_int) -> *mut ::c_void1879     pub fn mallocx(size: ::size_t, flags: ::c_int) -> *mut ::c_void;
rallocx(ptr: *mut ::c_void, size: ::size_t, flags: ::c_int) -> *mut ::c_void1880     pub fn rallocx(ptr: *mut ::c_void, size: ::size_t, flags: ::c_int) -> *mut ::c_void;
xallocx(ptr: *mut ::c_void, size: ::size_t, extra: ::size_t, flags: ::c_int) -> ::size_t1881     pub fn xallocx(ptr: *mut ::c_void, size: ::size_t, extra: ::size_t, flags: ::c_int)
1882         -> ::size_t;
sallocx(ptr: *const ::c_void, flags: ::c_int) -> ::size_t1883     pub fn sallocx(ptr: *const ::c_void, flags: ::c_int) -> ::size_t;
dallocx(ptr: *mut ::c_void, flags: ::c_int)1884     pub fn dallocx(ptr: *mut ::c_void, flags: ::c_int);
sdallocx(ptr: *mut ::c_void, size: ::size_t, flags: ::c_int)1885     pub fn sdallocx(ptr: *mut ::c_void, size: ::size_t, flags: ::c_int);
nallocx(size: ::size_t, flags: ::c_int) -> ::size_t1886     pub fn nallocx(size: ::size_t, flags: ::c_int) -> ::size_t;
1887 
procctl(idtype: ::idtype_t, id: ::id_t, cmd: ::c_int, data: *mut ::c_void) -> ::c_int1888     pub fn procctl(idtype: ::idtype_t, id: ::id_t, cmd: ::c_int, data: *mut ::c_void) -> ::c_int;
1889 }
1890 
1891 #[link(name = "util")]
1892 extern "C" {
extattr_namespace_to_string( attrnamespace: ::c_int, string: *mut *mut ::c_char, ) -> ::c_int1893     pub fn extattr_namespace_to_string(
1894         attrnamespace: ::c_int,
1895         string: *mut *mut ::c_char,
1896     ) -> ::c_int;
extattr_string_to_namespace( string: *const ::c_char, attrnamespace: *mut ::c_int, ) -> ::c_int1897     pub fn extattr_string_to_namespace(
1898         string: *const ::c_char,
1899         attrnamespace: *mut ::c_int,
1900     ) -> ::c_int;
realhostname(host: *mut ::c_char, hsize: ::size_t, ip: *const ::in_addr) -> ::c_int1901     pub fn realhostname(host: *mut ::c_char, hsize: ::size_t, ip: *const ::in_addr) -> ::c_int;
realhostname_sa( host: *mut ::c_char, hsize: ::size_t, addr: *mut ::sockaddr, addrlen: ::c_int, ) -> ::c_int1902     pub fn realhostname_sa(
1903         host: *mut ::c_char,
1904         hsize: ::size_t,
1905         addr: *mut ::sockaddr,
1906         addrlen: ::c_int,
1907     ) -> ::c_int;
1908 
kld_isloaded(name: *const ::c_char) -> ::c_int1909     pub fn kld_isloaded(name: *const ::c_char) -> ::c_int;
kld_load(name: *const ::c_char) -> ::c_int1910     pub fn kld_load(name: *const ::c_char) -> ::c_int;
1911 
kinfo_getvmmap(pid: ::pid_t, cntp: *mut ::c_int) -> *mut kinfo_vmentry1912     pub fn kinfo_getvmmap(pid: ::pid_t, cntp: *mut ::c_int) -> *mut kinfo_vmentry;
1913 }
1914 
1915 #[link(name = "procstat")]
1916 extern "C" {
procstat_open_sysctl() -> *mut procstat1917     pub fn procstat_open_sysctl() -> *mut procstat;
procstat_getfiles( procstat: *mut procstat, kp: *mut kinfo_proc, mmapped: ::c_int, ) -> *mut filestat_list1918     pub fn procstat_getfiles(
1919         procstat: *mut procstat,
1920         kp: *mut kinfo_proc,
1921         mmapped: ::c_int,
1922     ) -> *mut filestat_list;
procstat_freefiles(procstat: *mut procstat, head: *mut filestat_list)1923     pub fn procstat_freefiles(procstat: *mut procstat, head: *mut filestat_list);
procstat_getprocs( procstat: *mut procstat, what: ::c_int, arg: ::c_int, count: *mut ::c_uint, ) -> *mut kinfo_proc1924     pub fn procstat_getprocs(
1925         procstat: *mut procstat,
1926         what: ::c_int,
1927         arg: ::c_int,
1928         count: *mut ::c_uint,
1929     ) -> *mut kinfo_proc;
procstat_freeprocs(procstat: *mut procstat, p: *mut kinfo_proc)1930     pub fn procstat_freeprocs(procstat: *mut procstat, p: *mut kinfo_proc);
procstat_getvmmap( procstat: *mut procstat, kp: *mut kinfo_proc, count: *mut ::c_uint, ) -> *mut kinfo_vmentry1931     pub fn procstat_getvmmap(
1932         procstat: *mut procstat,
1933         kp: *mut kinfo_proc,
1934         count: *mut ::c_uint,
1935     ) -> *mut kinfo_vmentry;
procstat_freevmmap(procstat: *mut procstat, vmmap: *mut kinfo_vmentry)1936     pub fn procstat_freevmmap(procstat: *mut procstat, vmmap: *mut kinfo_vmentry);
procstat_close(procstat: *mut procstat)1937     pub fn procstat_close(procstat: *mut procstat);
1938 }
1939 
1940 cfg_if! {
1941     if #[cfg(freebsd13)] {
1942         mod freebsd13;
1943         pub use self::freebsd13::*;
1944     } else if #[cfg(freebsd12)] {
1945         mod freebsd12;
1946         pub use self::freebsd12::*;
1947     } else if #[cfg(any(freebsd10, freebsd11))] {
1948         mod freebsd11;
1949         pub use self::freebsd11::*;
1950     } else {
1951         // Unknown freebsd version
1952     }
1953 }
1954 
1955 cfg_if! {
1956     if #[cfg(target_arch = "x86")] {
1957         mod x86;
1958         pub use self::x86::*;
1959     } else if #[cfg(target_arch = "x86_64")] {
1960         mod x86_64;
1961         pub use self::x86_64::*;
1962     } else if #[cfg(target_arch = "aarch64")] {
1963         mod aarch64;
1964         pub use self::aarch64::*;
1965     } else if #[cfg(target_arch = "arm")] {
1966         mod arm;
1967         pub use self::arm::*;
1968     } else if #[cfg(target_arch = "powerpc64")] {
1969         mod powerpc64;
1970         pub use self::powerpc64::*;
1971     } else if #[cfg(target_arch = "powerpc")] {
1972         mod powerpc;
1973         pub use self::powerpc::*;
1974     } else {
1975         // Unknown target_arch
1976     }
1977 }
1978