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 key_t = ::c_long;
14 pub type msglen_t = ::c_ulong;
15 pub type msgqnum_t = ::c_ulong;
16 
17 pub type cpulevel_t = ::c_int;
18 pub type cpuwhich_t = ::c_int;
19 
20 pub type mqd_t = *mut ::c_void;
21 pub type posix_spawnattr_t = *mut ::c_void;
22 pub type posix_spawn_file_actions_t = *mut ::c_void;
23 
24 s! {
25     pub struct aiocb {
26         pub aio_fildes: ::c_int,
27         pub aio_offset: ::off_t,
28         pub aio_buf: *mut ::c_void,
29         pub aio_nbytes: ::size_t,
30         __unused1: [::c_int; 2],
31         __unused2: *mut ::c_void,
32         pub aio_lio_opcode: ::c_int,
33         pub aio_reqprio: ::c_int,
34         // unused 3 through 5 are the __aiocb_private structure
35         __unused3: ::c_long,
36         __unused4: ::c_long,
37         __unused5: *mut ::c_void,
38         pub aio_sigevent: sigevent
39     }
40 
41     pub struct jail {
42         pub version: u32,
43         pub path: *mut ::c_char,
44         pub hostname: *mut ::c_char,
45         pub jailname: *mut ::c_char,
46         pub ip4s: ::c_uint,
47         pub ip6s: ::c_uint,
48         pub ip4: *mut ::in_addr,
49         pub ip6: *mut ::in6_addr,
50     }
51 
52     pub struct statvfs {
53         pub f_bavail: ::fsblkcnt_t,
54         pub f_bfree: ::fsblkcnt_t,
55         pub f_blocks: ::fsblkcnt_t,
56         pub f_favail: ::fsfilcnt_t,
57         pub f_ffree: ::fsfilcnt_t,
58         pub f_files: ::fsfilcnt_t,
59         pub f_bsize: ::c_ulong,
60         pub f_flag: ::c_ulong,
61         pub f_frsize: ::c_ulong,
62         pub f_fsid: ::c_ulong,
63         pub f_namemax: ::c_ulong,
64     }
65 
66     // internal structure has changed over time
67     pub struct _sem {
68         data: [u32; 4],
69     }
70 
71     pub struct ipc_perm {
72         pub cuid: ::uid_t,
73         pub cgid: ::gid_t,
74         pub uid: ::uid_t,
75         pub gid: ::gid_t,
76         pub mode: ::mode_t,
77         pub seq: ::c_ushort,
78         pub key: ::key_t,
79     }
80 
81     pub struct msqid_ds {
82         pub msg_perm: ::ipc_perm,
83         __unused1: *mut ::c_void,
84         __unused2: *mut ::c_void,
85         pub msg_cbytes: ::msglen_t,
86         pub msg_qnum: ::msgqnum_t,
87         pub msg_qbytes: ::msglen_t,
88         pub msg_lspid: ::pid_t,
89         pub msg_lrpid: ::pid_t,
90         pub msg_stime: ::time_t,
91         pub msg_rtime: ::time_t,
92         pub msg_ctime: ::time_t,
93     }
94 
95     pub struct stack_t {
96         pub ss_sp: *mut ::c_void,
97         pub ss_size: ::size_t,
98         pub ss_flags: ::c_int,
99     }
100 
101     pub struct mmsghdr {
102         pub msg_hdr: ::msghdr,
103         pub msg_len: ::ssize_t,
104     }
105 
106     pub struct sockcred {
107         pub sc_uid: ::uid_t,
108         pub sc_euid: ::uid_t,
109         pub sc_gid: ::gid_t,
110         pub sc_egid: ::gid_t,
111         pub sc_ngroups: ::c_int,
112         pub sc_groups: [::gid_t; 1],
113     }
114 
115     pub struct ptrace_vm_entry {
116         pub pve_entry: ::c_int,
117         pub pve_timestamp: ::c_int,
118         pub pve_start: ::c_ulong,
119         pub pve_end: ::c_ulong,
120         pub pve_offset: ::c_ulong,
121         pub pve_prot: ::c_uint,
122         pub pve_pathlen: ::c_uint,
123         pub pve_fileid: ::c_long,
124         pub pve_fsid: u32,
125         pub pve_path: *mut ::c_char,
126     }
127 
128     pub struct cpuset_t {
129         #[cfg(target_pointer_width = "64")]
130         __bits: [::c_long; 4],
131         #[cfg(target_pointer_width = "32")]
132         __bits: [::c_long; 8],
133     }
134 
135     pub struct cap_rights_t {
136         cr_rights: [u64; 2],
137     }
138 }
139 
140 s_no_extra_traits! {
141     pub struct utmpx {
142         pub ut_type: ::c_short,
143         pub ut_tv: ::timeval,
144         pub ut_id: [::c_char; 8],
145         pub ut_pid: ::pid_t,
146         pub ut_user: [::c_char; 32],
147         pub ut_line: [::c_char; 16],
148         pub ut_host: [::c_char; 128],
149         pub __ut_spare: [::c_char; 64],
150     }
151 
152     #[cfg(libc_union)]
153     pub union __c_anonymous_cr_pid {
154         __cr_unused: *mut ::c_void,
155         pub cr_pid: ::pid_t,
156     }
157 
158     pub struct xucred {
159         pub cr_version: ::c_uint,
160         pub cr_uid: ::uid_t,
161         pub cr_ngroups: ::c_short,
162         pub cr_groups: [::gid_t; 16],
163         #[cfg(libc_union)]
164         pub cr_pid__c_anonymous_union: __c_anonymous_cr_pid,
165         #[cfg(not(libc_union))]
166         __cr_unused1: *mut ::c_void,
167     }
168 
169     pub struct sockaddr_dl {
170         pub sdl_len: ::c_uchar,
171         pub sdl_family: ::c_uchar,
172         pub sdl_index: ::c_ushort,
173         pub sdl_type: ::c_uchar,
174         pub sdl_nlen: ::c_uchar,
175         pub sdl_alen: ::c_uchar,
176         pub sdl_slen: ::c_uchar,
177         pub sdl_data: [::c_char; 46],
178     }
179 
180     pub struct mq_attr {
181         pub mq_flags: ::c_long,
182         pub mq_maxmsg: ::c_long,
183         pub mq_msgsize: ::c_long,
184         pub mq_curmsgs: ::c_long,
185         __reserved: [::c_long; 4]
186     }
187 
188     pub struct sigevent {
189         pub sigev_notify: ::c_int,
190         pub sigev_signo: ::c_int,
191         pub sigev_value: ::sigval,
192         //The rest of the structure is actually a union.  We expose only
193         //sigev_notify_thread_id because it's the most useful union member.
194         pub sigev_notify_thread_id: ::lwpid_t,
195         #[cfg(target_pointer_width = "64")]
196         __unused1: ::c_int,
197         __unused2: [::c_long; 7]
198     }
199 }
200 
201 cfg_if! {
202     if #[cfg(feature = "extra_traits")] {
203         impl PartialEq for utmpx {
204             fn eq(&self, other: &utmpx) -> bool {
205                 self.ut_type == other.ut_type
206                     && self.ut_tv == other.ut_tv
207                     && self.ut_id == other.ut_id
208                     && self.ut_pid == other.ut_pid
209                     && self.ut_user == other.ut_user
210                     && self.ut_line == other.ut_line
211                     && self
212                     .ut_host
213                     .iter()
214                     .zip(other.ut_host.iter())
215                     .all(|(a,b)| a == b)
216                     && self
217                     .__ut_spare
218                     .iter()
219                     .zip(other.__ut_spare.iter())
220                     .all(|(a,b)| a == b)
221             }
222         }
223         impl Eq for utmpx {}
224         impl ::fmt::Debug for utmpx {
225             fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
226                 f.debug_struct("utmpx")
227                     .field("ut_type", &self.ut_type)
228                     .field("ut_tv", &self.ut_tv)
229                     .field("ut_id", &self.ut_id)
230                     .field("ut_pid", &self.ut_pid)
231                     .field("ut_user", &self.ut_user)
232                     .field("ut_line", &self.ut_line)
233                     // FIXME: .field("ut_host", &self.ut_host)
234                     // FIXME: .field("__ut_spare", &self.__ut_spare)
235                     .finish()
236             }
237         }
238         impl ::hash::Hash for utmpx {
239             fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
240                 self.ut_type.hash(state);
241                 self.ut_tv.hash(state);
242                 self.ut_id.hash(state);
243                 self.ut_pid.hash(state);
244                 self.ut_user.hash(state);
245                 self.ut_line.hash(state);
246                 self.ut_host.hash(state);
247                 self.__ut_spare.hash(state);
248             }
249         }
250 
251         #[cfg(libc_union)]
252         impl PartialEq for __c_anonymous_cr_pid {
253             fn eq(&self, other: &__c_anonymous_cr_pid) -> bool {
254                 unsafe { self.cr_pid == other.cr_pid}
255             }
256         }
257         #[cfg(libc_union)]
258         impl Eq for __c_anonymous_cr_pid {}
259         #[cfg(libc_union)]
260         impl ::fmt::Debug for __c_anonymous_cr_pid {
261             fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
262                 f.debug_struct("cr_pid")
263                     .field("cr_pid", unsafe { &self.cr_pid })
264                     .finish()
265             }
266         }
267         #[cfg(libc_union)]
268         impl ::hash::Hash for __c_anonymous_cr_pid {
269             fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
270                 unsafe { self.cr_pid.hash(state) };
271             }
272         }
273 
274         impl PartialEq for xucred {
275             fn eq(&self, other: &xucred) -> bool {
276                 #[cfg(libc_union)]
277                 let equal_cr_pid = self.cr_pid__c_anonymous_union
278                     == other.cr_pid__c_anonymous_union;
279                 #[cfg(not(libc_union))]
280                 let equal_cr_pid = self.__cr_unused1 == other.__cr_unused1;
281 
282                 self.cr_version == other.cr_version
283                     && self.cr_uid == other.cr_uid
284                     && self.cr_ngroups == other.cr_ngroups
285                     && self.cr_groups == other.cr_groups
286                     && equal_cr_pid
287             }
288         }
289         impl Eq for xucred {}
290         impl ::fmt::Debug for xucred {
291             fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
292                 let mut struct_formatter = f.debug_struct("xucred");
293                 struct_formatter.field("cr_version", &self.cr_version);
294                 struct_formatter.field("cr_uid", &self.cr_uid);
295                 struct_formatter.field("cr_ngroups", &self.cr_ngroups);
296                 struct_formatter.field("cr_groups", &self.cr_groups);
297                 #[cfg(libc_union)]
298                 struct_formatter.field(
299                     "cr_pid__c_anonymous_union",
300                     &self.cr_pid__c_anonymous_union
301                 );
302                 struct_formatter.finish()
303             }
304         }
305         impl ::hash::Hash for xucred {
306             fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
307                 self.cr_version.hash(state);
308                 self.cr_uid.hash(state);
309                 self.cr_ngroups.hash(state);
310                 self.cr_groups.hash(state);
311                 #[cfg(libc_union)]
312                 self.cr_pid__c_anonymous_union.hash(state);
313                 #[cfg(not(libc_union))]
314                 self.__cr_unused1.hash(state);
315             }
316         }
317 
318         impl PartialEq for sockaddr_dl {
319             fn eq(&self, other: &sockaddr_dl) -> bool {
320                 self.sdl_len == other.sdl_len
321                     && self.sdl_family == other.sdl_family
322                     && self.sdl_index == other.sdl_index
323                     && self.sdl_type == other.sdl_type
324                     && self.sdl_nlen == other.sdl_nlen
325                     && self.sdl_alen == other.sdl_alen
326                     && self.sdl_slen == other.sdl_slen
327                     && self
328                     .sdl_data
329                     .iter()
330                     .zip(other.sdl_data.iter())
331                     .all(|(a,b)| a == b)
332             }
333         }
334         impl Eq for sockaddr_dl {}
335         impl ::fmt::Debug for sockaddr_dl {
336             fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
337                 f.debug_struct("sockaddr_dl")
338                     .field("sdl_len", &self.sdl_len)
339                     .field("sdl_family", &self.sdl_family)
340                     .field("sdl_index", &self.sdl_index)
341                     .field("sdl_type", &self.sdl_type)
342                     .field("sdl_nlen", &self.sdl_nlen)
343                     .field("sdl_alen", &self.sdl_alen)
344                     .field("sdl_slen", &self.sdl_slen)
345                     // FIXME: .field("sdl_data", &self.sdl_data)
346                     .finish()
347             }
348         }
349         impl ::hash::Hash for sockaddr_dl {
350             fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
351                 self.sdl_len.hash(state);
352                 self.sdl_family.hash(state);
353                 self.sdl_index.hash(state);
354                 self.sdl_type.hash(state);
355                 self.sdl_nlen.hash(state);
356                 self.sdl_alen.hash(state);
357                 self.sdl_slen.hash(state);
358                 self.sdl_data.hash(state);
359             }
360         }
361 
362         impl PartialEq for mq_attr {
363             fn eq(&self, other: &mq_attr) -> bool {
364                 self.mq_flags == other.mq_flags &&
365                 self.mq_maxmsg == other.mq_maxmsg &&
366                 self.mq_msgsize == other.mq_msgsize &&
367                 self.mq_curmsgs == other.mq_curmsgs
368             }
369         }
370         impl Eq for mq_attr {}
371         impl ::fmt::Debug for mq_attr {
372             fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
373                 f.debug_struct("mq_attr")
374                     .field("mq_flags", &self.mq_flags)
375                     .field("mq_maxmsg", &self.mq_maxmsg)
376                     .field("mq_msgsize", &self.mq_msgsize)
377                     .field("mq_curmsgs", &self.mq_curmsgs)
378                     .finish()
379             }
380         }
381         impl ::hash::Hash for mq_attr {
382             fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
383                 self.mq_flags.hash(state);
384                 self.mq_maxmsg.hash(state);
385                 self.mq_msgsize.hash(state);
386                 self.mq_curmsgs.hash(state);
387             }
388         }
389 
390         impl PartialEq for sigevent {
391             fn eq(&self, other: &sigevent) -> bool {
392                 self.sigev_notify == other.sigev_notify
393                     && self.sigev_signo == other.sigev_signo
394                     && self.sigev_value == other.sigev_value
395                     && self.sigev_notify_thread_id
396                         == other.sigev_notify_thread_id
397             }
398         }
399         impl Eq for sigevent {}
400         impl ::fmt::Debug for sigevent {
401             fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
402                 f.debug_struct("sigevent")
403                     .field("sigev_notify", &self.sigev_notify)
404                     .field("sigev_signo", &self.sigev_signo)
405                     .field("sigev_value", &self.sigev_value)
406                     .field("sigev_notify_thread_id",
407                            &self.sigev_notify_thread_id)
408                     .finish()
409             }
410         }
411         impl ::hash::Hash for sigevent {
412             fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
413                 self.sigev_notify.hash(state);
414                 self.sigev_signo.hash(state);
415                 self.sigev_value.hash(state);
416                 self.sigev_notify_thread_id.hash(state);
417             }
418         }
419     }
420 }
421 
422 pub const SIGEV_THREAD_ID: ::c_int = 4;
423 
424 pub const EXTATTR_NAMESPACE_EMPTY: ::c_int = 0;
425 pub const EXTATTR_NAMESPACE_USER: ::c_int = 1;
426 pub const EXTATTR_NAMESPACE_SYSTEM: ::c_int = 2;
427 
428 pub const PTHREAD_STACK_MIN: ::size_t = MINSIGSTKSZ;
429 pub const PTHREAD_MUTEX_ADAPTIVE_NP: ::c_int = 4;
430 pub const SIGSTKSZ: ::size_t = MINSIGSTKSZ + 32768;
431 pub const SF_NODISKIO: ::c_int = 0x00000001;
432 pub const SF_MNOWAIT: ::c_int = 0x00000002;
433 pub const SF_SYNC: ::c_int = 0x00000004;
434 pub const SF_USER_READAHEAD: ::c_int = 0x00000008;
435 pub const SF_NOCACHE: ::c_int = 0x00000010;
436 pub const O_CLOEXEC: ::c_int = 0x00100000;
437 pub const O_DIRECTORY: ::c_int = 0x00020000;
438 pub const O_EXEC: ::c_int = 0x00040000;
439 pub const O_TTY_INIT: ::c_int = 0x00080000;
440 pub const F_GETLK: ::c_int = 11;
441 pub const F_SETLK: ::c_int = 12;
442 pub const F_SETLKW: ::c_int = 13;
443 pub const ENOTCAPABLE: ::c_int = 93;
444 pub const ECAPMODE: ::c_int = 94;
445 pub const ENOTRECOVERABLE: ::c_int = 95;
446 pub const EOWNERDEAD: ::c_int = 96;
447 pub const RLIMIT_NPTS: ::c_int = 11;
448 pub const RLIMIT_SWAP: ::c_int = 12;
449 pub const RLIMIT_KQUEUES: ::c_int = 13;
450 pub const RLIMIT_UMTXP: ::c_int = 14;
451 #[deprecated(since = "0.2.64", note = "Not stable across OS versions")]
452 pub const RLIM_NLIMITS: ::rlim_t = 15;
453 
454 pub const NI_NOFQDN: ::c_int = 0x00000001;
455 pub const NI_NUMERICHOST: ::c_int = 0x00000002;
456 pub const NI_NAMEREQD: ::c_int = 0x00000004;
457 pub const NI_NUMERICSERV: ::c_int = 0x00000008;
458 pub const NI_DGRAM: ::c_int = 0x00000010;
459 pub const NI_NUMERICSCOPE: ::c_int = 0x00000020;
460 
461 pub const Q_GETQUOTA: ::c_int = 0x700;
462 pub const Q_SETQUOTA: ::c_int = 0x800;
463 
464 pub const MAP_GUARD: ::c_int = 0x00002000;
465 pub const MAP_ALIGNED_SUPER: ::c_int = 1 << 24;
466 
467 pub const POSIX_FADV_NORMAL: ::c_int = 0;
468 pub const POSIX_FADV_RANDOM: ::c_int = 1;
469 pub const POSIX_FADV_SEQUENTIAL: ::c_int = 2;
470 pub const POSIX_FADV_WILLNEED: ::c_int = 3;
471 pub const POSIX_FADV_DONTNEED: ::c_int = 4;
472 pub const POSIX_FADV_NOREUSE: ::c_int = 5;
473 
474 pub const POLLINIGNEOF: ::c_short = 0x2000;
475 
476 pub const EVFILT_READ: i16 = -1;
477 pub const EVFILT_WRITE: i16 = -2;
478 pub const EVFILT_AIO: i16 = -3;
479 pub const EVFILT_VNODE: i16 = -4;
480 pub const EVFILT_PROC: i16 = -5;
481 pub const EVFILT_SIGNAL: i16 = -6;
482 pub const EVFILT_TIMER: i16 = -7;
483 pub const EVFILT_PROCDESC: i16 = -8;
484 pub const EVFILT_FS: i16 = -9;
485 pub const EVFILT_LIO: i16 = -10;
486 pub const EVFILT_USER: i16 = -11;
487 pub const EVFILT_SENDFILE: i16 = -12;
488 pub const EVFILT_EMPTY: i16 = -13;
489 
490 pub const EV_ADD: u16 = 0x1;
491 pub const EV_DELETE: u16 = 0x2;
492 pub const EV_ENABLE: u16 = 0x4;
493 pub const EV_DISABLE: u16 = 0x8;
494 pub const EV_ONESHOT: u16 = 0x10;
495 pub const EV_CLEAR: u16 = 0x20;
496 pub const EV_RECEIPT: u16 = 0x40;
497 pub const EV_DISPATCH: u16 = 0x80;
498 pub const EV_DROP: u16 = 0x1000;
499 pub const EV_FLAG1: u16 = 0x2000;
500 pub const EV_ERROR: u16 = 0x4000;
501 pub const EV_EOF: u16 = 0x8000;
502 pub const EV_SYSFLAGS: u16 = 0xf000;
503 
504 pub const NOTE_TRIGGER: u32 = 0x01000000;
505 pub const NOTE_FFNOP: u32 = 0x00000000;
506 pub const NOTE_FFAND: u32 = 0x40000000;
507 pub const NOTE_FFOR: u32 = 0x80000000;
508 pub const NOTE_FFCOPY: u32 = 0xc0000000;
509 pub const NOTE_FFCTRLMASK: u32 = 0xc0000000;
510 pub const NOTE_FFLAGSMASK: u32 = 0x00ffffff;
511 pub const NOTE_LOWAT: u32 = 0x00000001;
512 pub const NOTE_DELETE: u32 = 0x00000001;
513 pub const NOTE_WRITE: u32 = 0x00000002;
514 pub const NOTE_EXTEND: u32 = 0x00000004;
515 pub const NOTE_ATTRIB: u32 = 0x00000008;
516 pub const NOTE_LINK: u32 = 0x00000010;
517 pub const NOTE_RENAME: u32 = 0x00000020;
518 pub const NOTE_REVOKE: u32 = 0x00000040;
519 pub const NOTE_EXIT: u32 = 0x80000000;
520 pub const NOTE_FORK: u32 = 0x40000000;
521 pub const NOTE_EXEC: u32 = 0x20000000;
522 pub const NOTE_PDATAMASK: u32 = 0x000fffff;
523 pub const NOTE_PCTRLMASK: u32 = 0xf0000000;
524 pub const NOTE_TRACK: u32 = 0x00000001;
525 pub const NOTE_TRACKERR: u32 = 0x00000002;
526 pub const NOTE_CHILD: u32 = 0x00000004;
527 pub const NOTE_SECONDS: u32 = 0x00000001;
528 pub const NOTE_MSECONDS: u32 = 0x00000002;
529 pub const NOTE_USECONDS: u32 = 0x00000004;
530 pub const NOTE_NSECONDS: u32 = 0x00000008;
531 
532 pub const MADV_PROTECT: ::c_int = 10;
533 pub const RUSAGE_THREAD: ::c_int = 1;
534 
535 #[doc(hidden)]
536 #[deprecated(
537     since = "0.2.72",
538     note = "CTL_UNSPEC is deprecated. Use CTL_SYSCTL instead"
539 )]
540 pub const CTL_UNSPEC: ::c_int = 0;
541 pub const CTL_SYSCTL: ::c_int = 0;
542 pub const CTL_KERN: ::c_int = 1;
543 pub const CTL_VM: ::c_int = 2;
544 pub const CTL_VFS: ::c_int = 3;
545 pub const CTL_NET: ::c_int = 4;
546 pub const CTL_DEBUG: ::c_int = 5;
547 pub const CTL_HW: ::c_int = 6;
548 pub const CTL_MACHDEP: ::c_int = 7;
549 pub const CTL_USER: ::c_int = 8;
550 pub const CTL_P1003_1B: ::c_int = 9;
551 pub const CTL_SYSCTL_DEBUG: ::c_int = 0;
552 pub const CTL_SYSCTL_NAME: ::c_int = 1;
553 pub const CTL_SYSCTL_NEXT: ::c_int = 2;
554 pub const CTL_SYSCTL_NAME2OID: ::c_int = 3;
555 pub const CTL_SYSCTL_OIDFMT: ::c_int = 4;
556 pub const CTL_SYSCTL_OIDDESCR: ::c_int = 5;
557 pub const CTL_SYSCTL_OIDLABEL: ::c_int = 6;
558 pub const KERN_OSTYPE: ::c_int = 1;
559 pub const KERN_OSRELEASE: ::c_int = 2;
560 pub const KERN_OSREV: ::c_int = 3;
561 pub const KERN_VERSION: ::c_int = 4;
562 pub const KERN_MAXVNODES: ::c_int = 5;
563 pub const KERN_MAXPROC: ::c_int = 6;
564 pub const KERN_MAXFILES: ::c_int = 7;
565 pub const KERN_ARGMAX: ::c_int = 8;
566 pub const KERN_SECURELVL: ::c_int = 9;
567 pub const KERN_HOSTNAME: ::c_int = 10;
568 pub const KERN_HOSTID: ::c_int = 11;
569 pub const KERN_CLOCKRATE: ::c_int = 12;
570 pub const KERN_VNODE: ::c_int = 13;
571 pub const KERN_PROC: ::c_int = 14;
572 pub const KERN_FILE: ::c_int = 15;
573 pub const KERN_PROF: ::c_int = 16;
574 pub const KERN_POSIX1: ::c_int = 17;
575 pub const KERN_NGROUPS: ::c_int = 18;
576 pub const KERN_JOB_CONTROL: ::c_int = 19;
577 pub const KERN_SAVED_IDS: ::c_int = 20;
578 pub const KERN_BOOTTIME: ::c_int = 21;
579 pub const KERN_NISDOMAINNAME: ::c_int = 22;
580 pub const KERN_UPDATEINTERVAL: ::c_int = 23;
581 pub const KERN_OSRELDATE: ::c_int = 24;
582 pub const KERN_NTP_PLL: ::c_int = 25;
583 pub const KERN_BOOTFILE: ::c_int = 26;
584 pub const KERN_MAXFILESPERPROC: ::c_int = 27;
585 pub const KERN_MAXPROCPERUID: ::c_int = 28;
586 pub const KERN_DUMPDEV: ::c_int = 29;
587 pub const KERN_IPC: ::c_int = 30;
588 pub const KERN_DUMMY: ::c_int = 31;
589 pub const KERN_PS_STRINGS: ::c_int = 32;
590 pub const KERN_USRSTACK: ::c_int = 33;
591 pub const KERN_LOGSIGEXIT: ::c_int = 34;
592 pub const KERN_IOV_MAX: ::c_int = 35;
593 pub const KERN_HOSTUUID: ::c_int = 36;
594 pub const KERN_ARND: ::c_int = 37;
595 pub const KERN_PROC_ALL: ::c_int = 0;
596 pub const KERN_PROC_PID: ::c_int = 1;
597 pub const KERN_PROC_PGRP: ::c_int = 2;
598 pub const KERN_PROC_SESSION: ::c_int = 3;
599 pub const KERN_PROC_TTY: ::c_int = 4;
600 pub const KERN_PROC_UID: ::c_int = 5;
601 pub const KERN_PROC_RUID: ::c_int = 6;
602 pub const KERN_PROC_ARGS: ::c_int = 7;
603 pub const KERN_PROC_PROC: ::c_int = 8;
604 pub const KERN_PROC_SV_NAME: ::c_int = 9;
605 pub const KERN_PROC_RGID: ::c_int = 10;
606 pub const KERN_PROC_GID: ::c_int = 11;
607 pub const KERN_PROC_PATHNAME: ::c_int = 12;
608 pub const KERN_PROC_OVMMAP: ::c_int = 13;
609 pub const KERN_PROC_OFILEDESC: ::c_int = 14;
610 pub const KERN_PROC_KSTACK: ::c_int = 15;
611 pub const KERN_PROC_INC_THREAD: ::c_int = 0x10;
612 pub const KERN_PROC_VMMAP: ::c_int = 32;
613 pub const KERN_PROC_FILEDESC: ::c_int = 33;
614 pub const KERN_PROC_GROUPS: ::c_int = 34;
615 pub const KERN_PROC_ENV: ::c_int = 35;
616 pub const KERN_PROC_AUXV: ::c_int = 36;
617 pub const KERN_PROC_RLIMIT: ::c_int = 37;
618 pub const KERN_PROC_PS_STRINGS: ::c_int = 38;
619 pub const KERN_PROC_UMASK: ::c_int = 39;
620 pub const KERN_PROC_OSREL: ::c_int = 40;
621 pub const KERN_PROC_SIGTRAMP: ::c_int = 41;
622 pub const KIPC_MAXSOCKBUF: ::c_int = 1;
623 pub const KIPC_SOCKBUF_WASTE: ::c_int = 2;
624 pub const KIPC_SOMAXCONN: ::c_int = 3;
625 pub const KIPC_MAX_LINKHDR: ::c_int = 4;
626 pub const KIPC_MAX_PROTOHDR: ::c_int = 5;
627 pub const KIPC_MAX_HDR: ::c_int = 6;
628 pub const KIPC_MAX_DATALEN: ::c_int = 7;
629 pub const HW_MACHINE: ::c_int = 1;
630 pub const HW_MODEL: ::c_int = 2;
631 pub const HW_NCPU: ::c_int = 3;
632 pub const HW_BYTEORDER: ::c_int = 4;
633 pub const HW_PHYSMEM: ::c_int = 5;
634 pub const HW_USERMEM: ::c_int = 6;
635 pub const HW_PAGESIZE: ::c_int = 7;
636 pub const HW_DISKNAMES: ::c_int = 8;
637 pub const HW_DISKSTATS: ::c_int = 9;
638 pub const HW_FLOATINGPT: ::c_int = 10;
639 pub const HW_MACHINE_ARCH: ::c_int = 11;
640 pub const HW_REALMEM: ::c_int = 12;
641 pub const USER_CS_PATH: ::c_int = 1;
642 pub const USER_BC_BASE_MAX: ::c_int = 2;
643 pub const USER_BC_DIM_MAX: ::c_int = 3;
644 pub const USER_BC_SCALE_MAX: ::c_int = 4;
645 pub const USER_BC_STRING_MAX: ::c_int = 5;
646 pub const USER_COLL_WEIGHTS_MAX: ::c_int = 6;
647 pub const USER_EXPR_NEST_MAX: ::c_int = 7;
648 pub const USER_LINE_MAX: ::c_int = 8;
649 pub const USER_RE_DUP_MAX: ::c_int = 9;
650 pub const USER_POSIX2_VERSION: ::c_int = 10;
651 pub const USER_POSIX2_C_BIND: ::c_int = 11;
652 pub const USER_POSIX2_C_DEV: ::c_int = 12;
653 pub const USER_POSIX2_CHAR_TERM: ::c_int = 13;
654 pub const USER_POSIX2_FORT_DEV: ::c_int = 14;
655 pub const USER_POSIX2_FORT_RUN: ::c_int = 15;
656 pub const USER_POSIX2_LOCALEDEF: ::c_int = 16;
657 pub const USER_POSIX2_SW_DEV: ::c_int = 17;
658 pub const USER_POSIX2_UPE: ::c_int = 18;
659 pub const USER_STREAM_MAX: ::c_int = 19;
660 pub const USER_TZNAME_MAX: ::c_int = 20;
661 pub const CTL_P1003_1B_ASYNCHRONOUS_IO: ::c_int = 1;
662 pub const CTL_P1003_1B_MAPPED_FILES: ::c_int = 2;
663 pub const CTL_P1003_1B_MEMLOCK: ::c_int = 3;
664 pub const CTL_P1003_1B_MEMLOCK_RANGE: ::c_int = 4;
665 pub const CTL_P1003_1B_MEMORY_PROTECTION: ::c_int = 5;
666 pub const CTL_P1003_1B_MESSAGE_PASSING: ::c_int = 6;
667 pub const CTL_P1003_1B_PRIORITIZED_IO: ::c_int = 7;
668 pub const CTL_P1003_1B_PRIORITY_SCHEDULING: ::c_int = 8;
669 pub const CTL_P1003_1B_REALTIME_SIGNALS: ::c_int = 9;
670 pub const CTL_P1003_1B_SEMAPHORES: ::c_int = 10;
671 pub const CTL_P1003_1B_FSYNC: ::c_int = 11;
672 pub const CTL_P1003_1B_SHARED_MEMORY_OBJECTS: ::c_int = 12;
673 pub const CTL_P1003_1B_SYNCHRONIZED_IO: ::c_int = 13;
674 pub const CTL_P1003_1B_TIMERS: ::c_int = 14;
675 pub const CTL_P1003_1B_AIO_LISTIO_MAX: ::c_int = 15;
676 pub const CTL_P1003_1B_AIO_MAX: ::c_int = 16;
677 pub const CTL_P1003_1B_AIO_PRIO_DELTA_MAX: ::c_int = 17;
678 pub const CTL_P1003_1B_DELAYTIMER_MAX: ::c_int = 18;
679 pub const CTL_P1003_1B_MQ_OPEN_MAX: ::c_int = 19;
680 pub const CTL_P1003_1B_PAGESIZE: ::c_int = 20;
681 pub const CTL_P1003_1B_RTSIG_MAX: ::c_int = 21;
682 pub const CTL_P1003_1B_SEM_NSEMS_MAX: ::c_int = 22;
683 pub const CTL_P1003_1B_SEM_VALUE_MAX: ::c_int = 23;
684 pub const CTL_P1003_1B_SIGQUEUE_MAX: ::c_int = 24;
685 pub const CTL_P1003_1B_TIMER_MAX: ::c_int = 25;
686 pub const TIOCGPTN: ::c_uint = 0x4004740f;
687 pub const TIOCPTMASTER: ::c_uint = 0x2000741c;
688 pub const TIOCSIG: ::c_uint = 0x2004745f;
689 pub const TIOCM_DCD: ::c_int = 0x40;
690 pub const H4DISC: ::c_int = 0x7;
691 
692 pub const BIOCSETFNR: ::c_ulong = 0x80104282;
693 
694 pub const FIONWRITE: ::c_ulong = 0x40046677;
695 pub const FIONSPACE: ::c_ulong = 0x40046676;
696 pub const FIOSEEKDATA: ::c_ulong = 0xc0086661;
697 pub const FIOSEEKHOLE: ::c_ulong = 0xc0086662;
698 
699 pub const JAIL_API_VERSION: u32 = 2;
700 pub const JAIL_CREATE: ::c_int = 0x01;
701 pub const JAIL_UPDATE: ::c_int = 0x02;
702 pub const JAIL_ATTACH: ::c_int = 0x04;
703 pub const JAIL_DYING: ::c_int = 0x08;
704 pub const JAIL_SET_MASK: ::c_int = 0x0f;
705 pub const JAIL_GET_MASK: ::c_int = 0x08;
706 pub const JAIL_SYS_DISABLE: ::c_int = 0;
707 pub const JAIL_SYS_NEW: ::c_int = 1;
708 pub const JAIL_SYS_INHERIT: ::c_int = 2;
709 
710 pub const SO_BINTIME: ::c_int = 0x2000;
711 pub const SO_NO_OFFLOAD: ::c_int = 0x4000;
712 pub const SO_NO_DDP: ::c_int = 0x8000;
713 pub const SO_REUSEPORT_LB: ::c_int = 0x10000;
714 pub const SO_LABEL: ::c_int = 0x1009;
715 pub const SO_PEERLABEL: ::c_int = 0x1010;
716 pub const SO_LISTENQLIMIT: ::c_int = 0x1011;
717 pub const SO_LISTENQLEN: ::c_int = 0x1012;
718 pub const SO_LISTENINCQLEN: ::c_int = 0x1013;
719 pub const SO_SETFIB: ::c_int = 0x1014;
720 pub const SO_USER_COOKIE: ::c_int = 0x1015;
721 pub const SO_PROTOCOL: ::c_int = 0x1016;
722 pub const SO_PROTOTYPE: ::c_int = SO_PROTOCOL;
723 pub const SO_VENDOR: ::c_int = 0x80000000;
724 
725 pub const LOCAL_CREDS: ::c_int = 2;
726 pub const LOCAL_CONNWAIT: ::c_int = 4;
727 pub const LOCAL_VENDOR: ::c_int = SO_VENDOR;
728 
729 pub const PT_LWPINFO: ::c_int = 13;
730 pub const PT_GETNUMLWPS: ::c_int = 14;
731 pub const PT_GETLWPLIST: ::c_int = 15;
732 pub const PT_CLEARSTEP: ::c_int = 16;
733 pub const PT_SETSTEP: ::c_int = 17;
734 pub const PT_SUSPEND: ::c_int = 18;
735 pub const PT_RESUME: ::c_int = 19;
736 pub const PT_TO_SCE: ::c_int = 20;
737 pub const PT_TO_SCX: ::c_int = 21;
738 pub const PT_SYSCALL: ::c_int = 22;
739 pub const PT_FOLLOW_FORK: ::c_int = 23;
740 pub const PT_LWP_EVENTS: ::c_int = 24;
741 pub const PT_GET_EVENT_MASK: ::c_int = 25;
742 pub const PT_SET_EVENT_MASK: ::c_int = 26;
743 pub const PT_GETREGS: ::c_int = 33;
744 pub const PT_SETREGS: ::c_int = 34;
745 pub const PT_GETFPREGS: ::c_int = 35;
746 pub const PT_SETFPREGS: ::c_int = 36;
747 pub const PT_GETDBREGS: ::c_int = 37;
748 pub const PT_SETDBREGS: ::c_int = 38;
749 pub const PT_VM_TIMESTAMP: ::c_int = 40;
750 pub const PT_VM_ENTRY: ::c_int = 41;
751 pub const PT_FIRSTMACH: ::c_int = 64;
752 
753 pub const PTRACE_EXEC: ::c_int = 0x0001;
754 pub const PTRACE_SCE: ::c_int = 0x0002;
755 pub const PTRACE_SCX: ::c_int = 0x0004;
756 pub const PTRACE_SYSCALL: ::c_int = PTRACE_SCE | PTRACE_SCX;
757 pub const PTRACE_FORK: ::c_int = 0x0008;
758 pub const PTRACE_LWP: ::c_int = 0x0010;
759 pub const PTRACE_VFORK: ::c_int = 0x0020;
760 pub const PTRACE_DEFAULT: ::c_int = PTRACE_EXEC;
761 
762 pub const AF_SLOW: ::c_int = 33;
763 pub const AF_SCLUSTER: ::c_int = 34;
764 pub const AF_ARP: ::c_int = 35;
765 pub const AF_BLUETOOTH: ::c_int = 36;
766 pub const AF_IEEE80211: ::c_int = 37;
767 pub const AF_INET_SDP: ::c_int = 40;
768 pub const AF_INET6_SDP: ::c_int = 42;
769 
770 // https://github.com/freebsd/freebsd/blob/master/sys/net/if.h#L140
771 pub const IFF_UP: ::c_int = 0x1; // (n) interface is up
772 pub const IFF_BROADCAST: ::c_int = 0x2; // (i) broadcast address valid
773 pub const IFF_DEBUG: ::c_int = 0x4; // (n) turn on debugging
774 pub const IFF_LOOPBACK: ::c_int = 0x8; // (i) is a loopback net
775 pub const IFF_POINTOPOINT: ::c_int = 0x10; // (i) is a point-to-point link
776                                            // 0x20           was IFF_SMART
777 pub const IFF_RUNNING: ::c_int = 0x40; // (d) resources allocated
778 #[doc(hidden)]
779 #[deprecated(
780     since = "0.2.54",
781     note = "IFF_DRV_RUNNING is deprecated. Use the portable IFF_RUNNING instead"
782 )]
783 pub const IFF_DRV_RUNNING: ::c_int = 0x40;
784 pub const IFF_NOARP: ::c_int = 0x80; // (n) no address resolution protocol
785 pub const IFF_PROMISC: ::c_int = 0x100; // (n) receive all packets
786 pub const IFF_ALLMULTI: ::c_int = 0x200; // (n) receive all multicast packets
787 pub const IFF_OACTIVE: ::c_int = 0x400; // (d) tx hardware queue is full
788 #[doc(hidden)]
789 #[deprecated(since = "0.2.54", note = "Use the portable `IFF_OACTIVE` instead")]
790 pub const IFF_DRV_OACTIVE: ::c_int = 0x400;
791 pub const IFF_SIMPLEX: ::c_int = 0x800; // (i) can't hear own transmissions
792 pub const IFF_LINK0: ::c_int = 0x1000; // per link layer defined bit
793 pub const IFF_LINK1: ::c_int = 0x2000; // per link layer defined bit
794 pub const IFF_LINK2: ::c_int = 0x4000; // per link layer defined bit
795 pub const IFF_ALTPHYS: ::c_int = IFF_LINK2; // use alternate physical connection
796 pub const IFF_MULTICAST: ::c_int = 0x8000; // (i) supports multicast
797                                            // (i) unconfigurable using ioctl(2)
798 pub const IFF_CANTCONFIG: ::c_int = 0x10000;
799 pub const IFF_PPROMISC: ::c_int = 0x20000; // (n) user-requested promisc mode
800 pub const IFF_MONITOR: ::c_int = 0x40000; // (n) user-requested monitor mode
801 pub const IFF_STATICARP: ::c_int = 0x80000; // (n) static ARP
802 pub const IFF_DYING: ::c_int = 0x200000; // (n) interface is winding down
803 pub const IFF_RENAMING: ::c_int = 0x400000; // (n) interface is being renamed
804 
805 // sys/netinet/in.h
806 // Protocols (RFC 1700)
807 // NOTE: These are in addition to the constants defined in src/unix/mod.rs
808 
809 // IPPROTO_IP defined in src/unix/mod.rs
810 /// IP6 hop-by-hop options
811 pub const IPPROTO_HOPOPTS: ::c_int = 0;
812 // IPPROTO_ICMP defined in src/unix/mod.rs
813 /// group mgmt protocol
814 pub const IPPROTO_IGMP: ::c_int = 2;
815 /// gateway^2 (deprecated)
816 pub const IPPROTO_GGP: ::c_int = 3;
817 /// for compatibility
818 pub const IPPROTO_IPIP: ::c_int = 4;
819 // IPPROTO_TCP defined in src/unix/mod.rs
820 /// Stream protocol II.
821 pub const IPPROTO_ST: ::c_int = 7;
822 /// exterior gateway protocol
823 pub const IPPROTO_EGP: ::c_int = 8;
824 /// private interior gateway
825 pub const IPPROTO_PIGP: ::c_int = 9;
826 /// BBN RCC Monitoring
827 pub const IPPROTO_RCCMON: ::c_int = 10;
828 /// network voice protocol
829 pub const IPPROTO_NVPII: ::c_int = 11;
830 /// pup
831 pub const IPPROTO_PUP: ::c_int = 12;
832 /// Argus
833 pub const IPPROTO_ARGUS: ::c_int = 13;
834 /// EMCON
835 pub const IPPROTO_EMCON: ::c_int = 14;
836 /// Cross Net Debugger
837 pub const IPPROTO_XNET: ::c_int = 15;
838 /// Chaos
839 pub const IPPROTO_CHAOS: ::c_int = 16;
840 // IPPROTO_UDP defined in src/unix/mod.rs
841 /// Multiplexing
842 pub const IPPROTO_MUX: ::c_int = 18;
843 /// DCN Measurement Subsystems
844 pub const IPPROTO_MEAS: ::c_int = 19;
845 /// Host Monitoring
846 pub const IPPROTO_HMP: ::c_int = 20;
847 /// Packet Radio Measurement
848 pub const IPPROTO_PRM: ::c_int = 21;
849 /// xns idp
850 pub const IPPROTO_IDP: ::c_int = 22;
851 /// Trunk-1
852 pub const IPPROTO_TRUNK1: ::c_int = 23;
853 /// Trunk-2
854 pub const IPPROTO_TRUNK2: ::c_int = 24;
855 /// Leaf-1
856 pub const IPPROTO_LEAF1: ::c_int = 25;
857 /// Leaf-2
858 pub const IPPROTO_LEAF2: ::c_int = 26;
859 /// Reliable Data
860 pub const IPPROTO_RDP: ::c_int = 27;
861 /// Reliable Transaction
862 pub const IPPROTO_IRTP: ::c_int = 28;
863 /// tp-4 w/ class negotiation
864 pub const IPPROTO_TP: ::c_int = 29;
865 /// Bulk Data Transfer
866 pub const IPPROTO_BLT: ::c_int = 30;
867 /// Network Services
868 pub const IPPROTO_NSP: ::c_int = 31;
869 /// Merit Internodal
870 pub const IPPROTO_INP: ::c_int = 32;
871 #[doc(hidden)]
872 #[deprecated(
873     since = "0.2.72",
874     note = "IPPROTO_SEP is deprecated. Use IPPROTO_DCCP instead"
875 )]
876 pub const IPPROTO_SEP: ::c_int = 33;
877 /// Datagram Congestion Control Protocol
878 pub const IPPROTO_DCCP: ::c_int = 33;
879 /// Third Party Connect
880 pub const IPPROTO_3PC: ::c_int = 34;
881 /// InterDomain Policy Routing
882 pub const IPPROTO_IDPR: ::c_int = 35;
883 /// XTP
884 pub const IPPROTO_XTP: ::c_int = 36;
885 /// Datagram Delivery
886 pub const IPPROTO_DDP: ::c_int = 37;
887 /// Control Message Transport
888 pub const IPPROTO_CMTP: ::c_int = 38;
889 /// TP++ Transport
890 pub const IPPROTO_TPXX: ::c_int = 39;
891 /// IL transport protocol
892 pub const IPPROTO_IL: ::c_int = 40;
893 // IPPROTO_IPV6 defined in src/unix/mod.rs
894 /// Source Demand Routing
895 pub const IPPROTO_SDRP: ::c_int = 42;
896 /// IP6 routing header
897 pub const IPPROTO_ROUTING: ::c_int = 43;
898 /// IP6 fragmentation header
899 pub const IPPROTO_FRAGMENT: ::c_int = 44;
900 /// InterDomain Routing
901 pub const IPPROTO_IDRP: ::c_int = 45;
902 /// resource reservation
903 pub const IPPROTO_RSVP: ::c_int = 46;
904 /// General Routing Encap.
905 pub const IPPROTO_GRE: ::c_int = 47;
906 /// Mobile Host Routing
907 pub const IPPROTO_MHRP: ::c_int = 48;
908 /// BHA
909 pub const IPPROTO_BHA: ::c_int = 49;
910 /// IP6 Encap Sec. Payload
911 pub const IPPROTO_ESP: ::c_int = 50;
912 /// IP6 Auth Header
913 pub const IPPROTO_AH: ::c_int = 51;
914 /// Integ. Net Layer Security
915 pub const IPPROTO_INLSP: ::c_int = 52;
916 /// IP with encryption
917 pub const IPPROTO_SWIPE: ::c_int = 53;
918 /// Next Hop Resolution
919 pub const IPPROTO_NHRP: ::c_int = 54;
920 /// IP Mobility
921 pub const IPPROTO_MOBILE: ::c_int = 55;
922 /// Transport Layer Security
923 pub const IPPROTO_TLSP: ::c_int = 56;
924 /// SKIP
925 pub const IPPROTO_SKIP: ::c_int = 57;
926 // IPPROTO_ICMPV6 defined in src/unix/mod.rs
927 /// IP6 no next header
928 pub const IPPROTO_NONE: ::c_int = 59;
929 /// IP6 destination option
930 pub const IPPROTO_DSTOPTS: ::c_int = 60;
931 /// any host internal protocol
932 pub const IPPROTO_AHIP: ::c_int = 61;
933 /// CFTP
934 pub const IPPROTO_CFTP: ::c_int = 62;
935 /// "hello" routing protocol
936 pub const IPPROTO_HELLO: ::c_int = 63;
937 /// SATNET/Backroom EXPAK
938 pub const IPPROTO_SATEXPAK: ::c_int = 64;
939 /// Kryptolan
940 pub const IPPROTO_KRYPTOLAN: ::c_int = 65;
941 /// Remote Virtual Disk
942 pub const IPPROTO_RVD: ::c_int = 66;
943 /// Pluribus Packet Core
944 pub const IPPROTO_IPPC: ::c_int = 67;
945 /// Any distributed FS
946 pub const IPPROTO_ADFS: ::c_int = 68;
947 /// Satnet Monitoring
948 pub const IPPROTO_SATMON: ::c_int = 69;
949 /// VISA Protocol
950 pub const IPPROTO_VISA: ::c_int = 70;
951 /// Packet Core Utility
952 pub const IPPROTO_IPCV: ::c_int = 71;
953 /// Comp. Prot. Net. Executive
954 pub const IPPROTO_CPNX: ::c_int = 72;
955 /// Comp. Prot. HeartBeat
956 pub const IPPROTO_CPHB: ::c_int = 73;
957 /// Wang Span Network
958 pub const IPPROTO_WSN: ::c_int = 74;
959 /// Packet Video Protocol
960 pub const IPPROTO_PVP: ::c_int = 75;
961 /// BackRoom SATNET Monitoring
962 pub const IPPROTO_BRSATMON: ::c_int = 76;
963 /// Sun net disk proto (temp.)
964 pub const IPPROTO_ND: ::c_int = 77;
965 /// WIDEBAND Monitoring
966 pub const IPPROTO_WBMON: ::c_int = 78;
967 /// WIDEBAND EXPAK
968 pub const IPPROTO_WBEXPAK: ::c_int = 79;
969 /// ISO cnlp
970 pub const IPPROTO_EON: ::c_int = 80;
971 /// VMTP
972 pub const IPPROTO_VMTP: ::c_int = 81;
973 /// Secure VMTP
974 pub const IPPROTO_SVMTP: ::c_int = 82;
975 /// Banyon VINES
976 pub const IPPROTO_VINES: ::c_int = 83;
977 /// TTP
978 pub const IPPROTO_TTP: ::c_int = 84;
979 /// NSFNET-IGP
980 pub const IPPROTO_IGP: ::c_int = 85;
981 /// dissimilar gateway prot.
982 pub const IPPROTO_DGP: ::c_int = 86;
983 /// TCF
984 pub const IPPROTO_TCF: ::c_int = 87;
985 /// Cisco/GXS IGRP
986 pub const IPPROTO_IGRP: ::c_int = 88;
987 /// OSPFIGP
988 pub const IPPROTO_OSPFIGP: ::c_int = 89;
989 /// Strite RPC protocol
990 pub const IPPROTO_SRPC: ::c_int = 90;
991 /// Locus Address Resoloution
992 pub const IPPROTO_LARP: ::c_int = 91;
993 /// Multicast Transport
994 pub const IPPROTO_MTP: ::c_int = 92;
995 /// AX.25 Frames
996 pub const IPPROTO_AX25: ::c_int = 93;
997 /// IP encapsulated in IP
998 pub const IPPROTO_IPEIP: ::c_int = 94;
999 /// Mobile Int.ing control
1000 pub const IPPROTO_MICP: ::c_int = 95;
1001 /// Semaphore Comm. security
1002 pub const IPPROTO_SCCSP: ::c_int = 96;
1003 /// Ethernet IP encapsulation
1004 pub const IPPROTO_ETHERIP: ::c_int = 97;
1005 /// encapsulation header
1006 pub const IPPROTO_ENCAP: ::c_int = 98;
1007 /// any private encr. scheme
1008 pub const IPPROTO_APES: ::c_int = 99;
1009 /// GMTP
1010 pub const IPPROTO_GMTP: ::c_int = 100;
1011 /// payload compression (IPComp)
1012 pub const IPPROTO_IPCOMP: ::c_int = 108;
1013 /// SCTP
1014 pub const IPPROTO_SCTP: ::c_int = 132;
1015 /// IPv6 Mobility Header
1016 pub const IPPROTO_MH: ::c_int = 135;
1017 /// UDP-Lite
1018 pub const IPPROTO_UDPLITE: ::c_int = 136;
1019 /// IP6 Host Identity Protocol
1020 pub const IPPROTO_HIP: ::c_int = 139;
1021 /// IP6 Shim6 Protocol
1022 pub const IPPROTO_SHIM6: ::c_int = 140;
1023 
1024 /* 101-254: Partly Unassigned */
1025 /// Protocol Independent Mcast
1026 pub const IPPROTO_PIM: ::c_int = 103;
1027 /// CARP
1028 pub const IPPROTO_CARP: ::c_int = 112;
1029 /// PGM
1030 pub const IPPROTO_PGM: ::c_int = 113;
1031 /// MPLS-in-IP
1032 pub const IPPROTO_MPLS: ::c_int = 137;
1033 /// PFSYNC
1034 pub const IPPROTO_PFSYNC: ::c_int = 240;
1035 
1036 /* 255: Reserved */
1037 /* BSD Private, local use, namespace incursion, no longer used */
1038 /// OLD divert pseudo-proto
1039 pub const IPPROTO_OLD_DIVERT: ::c_int = 254;
1040 pub const IPPROTO_MAX: ::c_int = 256;
1041 /// last return value of *_input(), meaning "all job for this pkt is done".
1042 pub const IPPROTO_DONE: ::c_int = 257;
1043 
1044 /* Only used internally, so can be outside the range of valid IP protocols. */
1045 /// divert pseudo-protocol
1046 pub const IPPROTO_DIVERT: ::c_int = 258;
1047 /// SeND pseudo-protocol
1048 pub const IPPROTO_SEND: ::c_int = 259;
1049 
1050 // sys/netinet/TCP.h
1051 pub const TCP_MD5SIG: ::c_int = 16;
1052 pub const TCP_INFO: ::c_int = 32;
1053 pub const TCP_CONGESTION: ::c_int = 64;
1054 pub const TCP_CCALGOOPT: ::c_int = 65;
1055 pub const TCP_KEEPINIT: ::c_int = 128;
1056 pub const TCP_FASTOPEN: ::c_int = 1025;
1057 pub const TCP_PCAP_OUT: ::c_int = 2048;
1058 pub const TCP_PCAP_IN: ::c_int = 4096;
1059 
1060 pub const IP_BINDANY: ::c_int = 24;
1061 pub const IP_BINDMULTI: ::c_int = 25;
1062 pub const IP_RSS_LISTEN_BUCKET: ::c_int = 26;
1063 pub const IP_ORIGDSTADDR: ::c_int = 27;
1064 pub const IP_RECVORIGDSTADDR: ::c_int = IP_ORIGDSTADDR;
1065 
1066 pub const IP_RECVTOS: ::c_int = 68;
1067 
1068 pub const IPV6_BINDANY: ::c_int = 64;
1069 pub const IPV6_ORIGDSTADDR: ::c_int = 72;
1070 pub const IPV6_RECVORIGDSTADDR: ::c_int = IPV6_ORIGDSTADDR;
1071 
1072 pub const PF_SLOW: ::c_int = AF_SLOW;
1073 pub const PF_SCLUSTER: ::c_int = AF_SCLUSTER;
1074 pub const PF_ARP: ::c_int = AF_ARP;
1075 pub const PF_BLUETOOTH: ::c_int = AF_BLUETOOTH;
1076 pub const PF_IEEE80211: ::c_int = AF_IEEE80211;
1077 pub const PF_INET_SDP: ::c_int = AF_INET_SDP;
1078 pub const PF_INET6_SDP: ::c_int = AF_INET6_SDP;
1079 
1080 pub const NET_RT_DUMP: ::c_int = 1;
1081 pub const NET_RT_FLAGS: ::c_int = 2;
1082 pub const NET_RT_IFLIST: ::c_int = 3;
1083 pub const NET_RT_IFMALIST: ::c_int = 4;
1084 pub const NET_RT_IFLISTL: ::c_int = 5;
1085 
1086 // System V IPC
1087 pub const IPC_PRIVATE: ::key_t = 0;
1088 pub const IPC_CREAT: ::c_int = 0o1000;
1089 pub const IPC_EXCL: ::c_int = 0o2000;
1090 pub const IPC_NOWAIT: ::c_int = 0o4000;
1091 pub const IPC_RMID: ::c_int = 0;
1092 pub const IPC_SET: ::c_int = 1;
1093 pub const IPC_STAT: ::c_int = 2;
1094 pub const IPC_INFO: ::c_int = 3;
1095 pub const IPC_R: ::c_int = 0o400;
1096 pub const IPC_W: ::c_int = 0o200;
1097 pub const IPC_M: ::c_int = 0o10000;
1098 pub const MSG_NOERROR: ::c_int = 0o10000;
1099 pub const SHM_RDONLY: ::c_int = 0o10000;
1100 pub const SHM_RND: ::c_int = 0o20000;
1101 pub const SHM_R: ::c_int = 0o400;
1102 pub const SHM_W: ::c_int = 0o200;
1103 pub const SHM_LOCK: ::c_int = 11;
1104 pub const SHM_UNLOCK: ::c_int = 12;
1105 pub const SHM_STAT: ::c_int = 13;
1106 pub const SHM_INFO: ::c_int = 14;
1107 pub const SHM_ANON: *mut ::c_char = 1 as *mut ::c_char;
1108 
1109 // The *_MAXID constants never should've been used outside of the
1110 // FreeBSD base system.  And with the exception of CTL_P1003_1B_MAXID,
1111 // they were all removed in svn r262489.  They remain here for backwards
1112 // compatibility only, and are scheduled to be removed in libc 1.0.0.
1113 #[doc(hidden)]
1114 #[deprecated(since = "0.2.54", note = "Removed in FreeBSD 11")]
1115 pub const CTL_MAXID: ::c_int = 10;
1116 #[doc(hidden)]
1117 #[deprecated(since = "0.2.54", note = "Removed in FreeBSD 11")]
1118 pub const KERN_MAXID: ::c_int = 38;
1119 #[doc(hidden)]
1120 #[deprecated(since = "0.2.54", note = "Removed in FreeBSD 11")]
1121 pub const HW_MAXID: ::c_int = 13;
1122 #[doc(hidden)]
1123 #[deprecated(since = "0.2.54", note = "Removed in FreeBSD 11")]
1124 pub const USER_MAXID: ::c_int = 21;
1125 #[doc(hidden)]
1126 #[deprecated(since = "0.2.74", note = "Removed in FreeBSD 13")]
1127 pub const CTL_P1003_1B_MAXID: ::c_int = 26;
1128 
1129 pub const MSG_NOTIFICATION: ::c_int = 0x00002000;
1130 pub const MSG_NBIO: ::c_int = 0x00004000;
1131 pub const MSG_COMPAT: ::c_int = 0x00008000;
1132 pub const MSG_CMSG_CLOEXEC: ::c_int = 0x00040000;
1133 pub const MSG_NOSIGNAL: ::c_int = 0x20000;
1134 
1135 // utmpx entry types
1136 pub const EMPTY: ::c_short = 0;
1137 pub const BOOT_TIME: ::c_short = 1;
1138 pub const OLD_TIME: ::c_short = 2;
1139 pub const NEW_TIME: ::c_short = 3;
1140 pub const USER_PROCESS: ::c_short = 4;
1141 pub const INIT_PROCESS: ::c_short = 5;
1142 pub const LOGIN_PROCESS: ::c_short = 6;
1143 pub const DEAD_PROCESS: ::c_short = 7;
1144 pub const SHUTDOWN_TIME: ::c_short = 8;
1145 // utmp database types
1146 pub const UTXDB_ACTIVE: ::c_int = 0;
1147 pub const UTXDB_LASTLOGIN: ::c_int = 1;
1148 pub const UTXDB_LOG: ::c_int = 2;
1149 
1150 pub const LC_COLLATE_MASK: ::c_int = 1 << 0;
1151 pub const LC_CTYPE_MASK: ::c_int = 1 << 1;
1152 pub const LC_MONETARY_MASK: ::c_int = 1 << 2;
1153 pub const LC_NUMERIC_MASK: ::c_int = 1 << 3;
1154 pub const LC_TIME_MASK: ::c_int = 1 << 4;
1155 pub const LC_MESSAGES_MASK: ::c_int = 1 << 5;
1156 pub const LC_ALL_MASK: ::c_int = LC_COLLATE_MASK
1157     | LC_CTYPE_MASK
1158     | LC_MESSAGES_MASK
1159     | LC_MONETARY_MASK
1160     | LC_NUMERIC_MASK
1161     | LC_TIME_MASK;
1162 
1163 pub const WSTOPPED: ::c_int = 2; // same as WUNTRACED
1164 pub const WCONTINUED: ::c_int = 4;
1165 pub const WNOWAIT: ::c_int = 8;
1166 pub const WEXITED: ::c_int = 16;
1167 pub const WTRAPPED: ::c_int = 32;
1168 
1169 // FreeBSD defines a great many more of these, we only expose the
1170 // standardized ones.
1171 pub const P_PID: idtype_t = 0;
1172 pub const P_PGID: idtype_t = 2;
1173 pub const P_ALL: idtype_t = 7;
1174 
1175 pub const UTIME_OMIT: c_long = -2;
1176 pub const UTIME_NOW: c_long = -1;
1177 
1178 pub const B460800: ::speed_t = 460800;
1179 pub const B921600: ::speed_t = 921600;
1180 
1181 pub const AT_FDCWD: ::c_int = -100;
1182 pub const AT_EACCESS: ::c_int = 0x100;
1183 pub const AT_SYMLINK_NOFOLLOW: ::c_int = 0x200;
1184 pub const AT_SYMLINK_FOLLOW: ::c_int = 0x400;
1185 pub const AT_REMOVEDIR: ::c_int = 0x800;
1186 
1187 pub const TABDLY: ::tcflag_t = 0x00000004;
1188 pub const TAB0: ::tcflag_t = 0x00000000;
1189 pub const TAB3: ::tcflag_t = 0x00000004;
1190 
1191 pub const _PC_ACL_NFS4: ::c_int = 64;
1192 
1193 pub const _SC_CPUSET_SIZE: ::c_int = 122;
1194 
1195 // Flags which can be passed to pdfork(2)
1196 pub const PD_DAEMON: ::c_int = 0x00000001;
1197 pub const PD_CLOEXEC: ::c_int = 0x00000002;
1198 pub const PD_ALLOWED_AT_FORK: ::c_int = PD_DAEMON | PD_CLOEXEC;
1199 
1200 // Values for struct rtprio (type_ field)
1201 pub const RTP_PRIO_REALTIME: ::c_ushort = 2;
1202 pub const RTP_PRIO_NORMAL: ::c_ushort = 3;
1203 pub const RTP_PRIO_IDLE: ::c_ushort = 4;
1204 
1205 pub const POSIX_SPAWN_RESETIDS: ::c_int = 0x01;
1206 pub const POSIX_SPAWN_SETPGROUP: ::c_int = 0x02;
1207 pub const POSIX_SPAWN_SETSCHEDPARAM: ::c_int = 0x04;
1208 pub const POSIX_SPAWN_SETSCHEDULER: ::c_int = 0x08;
1209 pub const POSIX_SPAWN_SETSIGDEF: ::c_int = 0x10;
1210 pub const POSIX_SPAWN_SETSIGMASK: ::c_int = 0x20;
1211 
1212 // Flags for chflags(2)
1213 pub const UF_SYSTEM: ::c_ulong = 0x00000080;
1214 pub const UF_SPARSE: ::c_ulong = 0x00000100;
1215 pub const UF_OFFLINE: ::c_ulong = 0x00000200;
1216 pub const UF_REPARSE: ::c_ulong = 0x00000400;
1217 pub const UF_ARCHIVE: ::c_ulong = 0x00000800;
1218 pub const UF_READONLY: ::c_ulong = 0x00001000;
1219 pub const UF_HIDDEN: ::c_ulong = 0x00008000;
1220 pub const SF_SNAPSHOT: ::c_ulong = 0x00200000;
1221 
1222 pub const F_OGETLK: ::c_int = 7;
1223 pub const F_OSETLK: ::c_int = 8;
1224 pub const F_OSETLKW: ::c_int = 9;
1225 pub const F_DUP2FD: ::c_int = 10;
1226 pub const F_SETLK_REMOTE: ::c_int = 14;
1227 pub const F_READAHEAD: ::c_int = 15;
1228 pub const F_RDAHEAD: ::c_int = 16;
1229 pub const F_DUP2FD_CLOEXEC: ::c_int = 18;
1230 
1231 // For realhostname* api
1232 pub const HOSTNAME_FOUND: ::c_int = 0;
1233 pub const HOSTNAME_INCORRECTNAME: ::c_int = 1;
1234 pub const HOSTNAME_INVALIDADDR: ::c_int = 2;
1235 pub const HOSTNAME_INVALIDNAME: ::c_int = 3;
1236 
1237 const_fn! {
1238     {const} fn _ALIGN(p: usize) -> usize {
1239         (p + _ALIGNBYTES) & !_ALIGNBYTES
1240     }
1241 }
1242 
1243 f! {
1244     pub fn CMSG_DATA(cmsg: *const ::cmsghdr) -> *mut ::c_uchar {
1245         (cmsg as *mut ::c_uchar)
1246             .offset(_ALIGN(::mem::size_of::<::cmsghdr>()) as isize)
1247     }
1248 
1249     pub fn CMSG_LEN(length: ::c_uint) -> ::c_uint {
1250         _ALIGN(::mem::size_of::<::cmsghdr>()) as ::c_uint + length
1251     }
1252 
1253     pub fn CMSG_NXTHDR(mhdr: *const ::msghdr, cmsg: *const ::cmsghdr)
1254         -> *mut ::cmsghdr
1255     {
1256         if cmsg.is_null() {
1257             return ::CMSG_FIRSTHDR(mhdr);
1258         };
1259         let next = cmsg as usize + _ALIGN((*cmsg).cmsg_len as usize)
1260             + _ALIGN(::mem::size_of::<::cmsghdr>());
1261         let max = (*mhdr).msg_control as usize
1262             + (*mhdr).msg_controllen as usize;
1263         if next > max {
1264             0 as *mut ::cmsghdr
1265         } else {
1266             (cmsg as usize + _ALIGN((*cmsg).cmsg_len as usize))
1267                 as *mut ::cmsghdr
1268         }
1269     }
1270 
1271     pub {const} fn CMSG_SPACE(length: ::c_uint) -> ::c_uint {
1272         (_ALIGN(::mem::size_of::<::cmsghdr>()) + _ALIGN(length as usize))
1273             as ::c_uint
1274     }
1275 
1276     pub fn SOCKCREDSIZE(ngrps: usize) -> usize {
1277         let ngrps = if ngrps > 0 {
1278             ngrps - 1
1279         } else {
1280             0
1281         };
1282         ::mem::size_of::<sockcred>() + ::mem::size_of::<::gid_t>() * ngrps
1283     }
1284 
1285     pub fn uname(buf: *mut ::utsname) -> ::c_int {
1286         __xuname(256, buf as *mut ::c_void)
1287     }
1288 
1289     pub fn CPU_ZERO(cpuset: &mut cpuset_t) -> () {
1290         for slot in cpuset.__bits.iter_mut() {
1291             *slot = 0;
1292         }
1293     }
1294 
1295     pub fn CPU_FILL(cpuset: &mut cpuset_t) -> () {
1296         for slot in cpuset.__bits.iter_mut() {
1297             *slot = !0;
1298         }
1299     }
1300 
1301     pub fn CPU_SET(cpu: usize, cpuset: &mut cpuset_t) -> () {
1302         let bitset_bits = ::mem::size_of::<::c_long>();
1303         let (idx, offset) = (cpu / bitset_bits, cpu % bitset_bits);
1304         cpuset.__bits[idx] |= 1 << offset;
1305         ()
1306     }
1307 
1308     pub fn CPU_CLR(cpu: usize, cpuset: &mut cpuset_t) -> () {
1309         let bitset_bits = ::mem::size_of::<::c_long>();
1310         let (idx, offset) = (cpu / bitset_bits, cpu % bitset_bits);
1311         cpuset.__bits[idx] &= !(1 << offset);
1312         ()
1313     }
1314 
1315     pub fn CPU_ISSET(cpu: usize, cpuset: &mut cpuset_t) -> bool {
1316         let bitset_bits = ::mem::size_of::<::c_long>();
1317         let (idx, offset) = (cpu / bitset_bits, cpu % bitset_bits);
1318         0 != cpuset.__bits[idx] & (1 << offset)
1319     }
1320 }
1321 
1322 safe_f! {
1323     pub {const} fn WIFSIGNALED(status: ::c_int) -> bool {
1324         (status & 0o177) != 0o177 && (status & 0o177) != 0 && status != 0x13
1325     }
1326 }
1327 
1328 extern "C" {
__error() -> *mut ::c_int1329     pub fn __error() -> *mut ::c_int;
1330 
aio_cancel(fd: ::c_int, aiocbp: *mut aiocb) -> ::c_int1331     pub fn aio_cancel(fd: ::c_int, aiocbp: *mut aiocb) -> ::c_int;
aio_error(aiocbp: *const aiocb) -> ::c_int1332     pub fn aio_error(aiocbp: *const aiocb) -> ::c_int;
aio_fsync(op: ::c_int, aiocbp: *mut aiocb) -> ::c_int1333     pub fn aio_fsync(op: ::c_int, aiocbp: *mut aiocb) -> ::c_int;
aio_read(aiocbp: *mut aiocb) -> ::c_int1334     pub fn aio_read(aiocbp: *mut aiocb) -> ::c_int;
aio_return(aiocbp: *mut aiocb) -> ::ssize_t1335     pub fn aio_return(aiocbp: *mut aiocb) -> ::ssize_t;
aio_suspend( aiocb_list: *const *const aiocb, nitems: ::c_int, timeout: *const ::timespec, ) -> ::c_int1336     pub fn aio_suspend(
1337         aiocb_list: *const *const aiocb,
1338         nitems: ::c_int,
1339         timeout: *const ::timespec,
1340     ) -> ::c_int;
aio_write(aiocbp: *mut aiocb) -> ::c_int1341     pub fn aio_write(aiocbp: *mut aiocb) -> ::c_int;
1342 
extattr_delete_fd( fd: ::c_int, attrnamespace: ::c_int, attrname: *const ::c_char, ) -> ::c_int1343     pub fn extattr_delete_fd(
1344         fd: ::c_int,
1345         attrnamespace: ::c_int,
1346         attrname: *const ::c_char,
1347     ) -> ::c_int;
extattr_delete_file( path: *const ::c_char, attrnamespace: ::c_int, attrname: *const ::c_char, ) -> ::c_int1348     pub fn extattr_delete_file(
1349         path: *const ::c_char,
1350         attrnamespace: ::c_int,
1351         attrname: *const ::c_char,
1352     ) -> ::c_int;
extattr_delete_link( path: *const ::c_char, attrnamespace: ::c_int, attrname: *const ::c_char, ) -> ::c_int1353     pub fn extattr_delete_link(
1354         path: *const ::c_char,
1355         attrnamespace: ::c_int,
1356         attrname: *const ::c_char,
1357     ) -> ::c_int;
extattr_get_fd( fd: ::c_int, attrnamespace: ::c_int, attrname: *const ::c_char, data: *mut ::c_void, nbytes: ::size_t, ) -> ::ssize_t1358     pub fn extattr_get_fd(
1359         fd: ::c_int,
1360         attrnamespace: ::c_int,
1361         attrname: *const ::c_char,
1362         data: *mut ::c_void,
1363         nbytes: ::size_t,
1364     ) -> ::ssize_t;
extattr_get_file( path: *const ::c_char, attrnamespace: ::c_int, attrname: *const ::c_char, data: *mut ::c_void, nbytes: ::size_t, ) -> ::ssize_t1365     pub fn extattr_get_file(
1366         path: *const ::c_char,
1367         attrnamespace: ::c_int,
1368         attrname: *const ::c_char,
1369         data: *mut ::c_void,
1370         nbytes: ::size_t,
1371     ) -> ::ssize_t;
extattr_get_link( path: *const ::c_char, attrnamespace: ::c_int, attrname: *const ::c_char, data: *mut ::c_void, nbytes: ::size_t, ) -> ::ssize_t1372     pub fn extattr_get_link(
1373         path: *const ::c_char,
1374         attrnamespace: ::c_int,
1375         attrname: *const ::c_char,
1376         data: *mut ::c_void,
1377         nbytes: ::size_t,
1378     ) -> ::ssize_t;
extattr_list_fd( fd: ::c_int, attrnamespace: ::c_int, data: *mut ::c_void, nbytes: ::size_t, ) -> ::ssize_t1379     pub fn extattr_list_fd(
1380         fd: ::c_int,
1381         attrnamespace: ::c_int,
1382         data: *mut ::c_void,
1383         nbytes: ::size_t,
1384     ) -> ::ssize_t;
extattr_list_file( path: *const ::c_char, attrnamespace: ::c_int, data: *mut ::c_void, nbytes: ::size_t, ) -> ::ssize_t1385     pub fn extattr_list_file(
1386         path: *const ::c_char,
1387         attrnamespace: ::c_int,
1388         data: *mut ::c_void,
1389         nbytes: ::size_t,
1390     ) -> ::ssize_t;
extattr_list_link( path: *const ::c_char, attrnamespace: ::c_int, data: *mut ::c_void, nbytes: ::size_t, ) -> ::ssize_t1391     pub fn extattr_list_link(
1392         path: *const ::c_char,
1393         attrnamespace: ::c_int,
1394         data: *mut ::c_void,
1395         nbytes: ::size_t,
1396     ) -> ::ssize_t;
extattr_set_fd( fd: ::c_int, attrnamespace: ::c_int, attrname: *const ::c_char, data: *const ::c_void, nbytes: ::size_t, ) -> ::ssize_t1397     pub fn extattr_set_fd(
1398         fd: ::c_int,
1399         attrnamespace: ::c_int,
1400         attrname: *const ::c_char,
1401         data: *const ::c_void,
1402         nbytes: ::size_t,
1403     ) -> ::ssize_t;
extattr_set_file( path: *const ::c_char, attrnamespace: ::c_int, attrname: *const ::c_char, data: *const ::c_void, nbytes: ::size_t, ) -> ::ssize_t1404     pub fn extattr_set_file(
1405         path: *const ::c_char,
1406         attrnamespace: ::c_int,
1407         attrname: *const ::c_char,
1408         data: *const ::c_void,
1409         nbytes: ::size_t,
1410     ) -> ::ssize_t;
extattr_set_link( path: *const ::c_char, attrnamespace: ::c_int, attrname: *const ::c_char, data: *const ::c_void, nbytes: ::size_t, ) -> ::ssize_t1411     pub fn extattr_set_link(
1412         path: *const ::c_char,
1413         attrnamespace: ::c_int,
1414         attrname: *const ::c_char,
1415         data: *const ::c_void,
1416         nbytes: ::size_t,
1417     ) -> ::ssize_t;
1418 
jail(jail: *mut ::jail) -> ::c_int1419     pub fn jail(jail: *mut ::jail) -> ::c_int;
jail_attach(jid: ::c_int) -> ::c_int1420     pub fn jail_attach(jid: ::c_int) -> ::c_int;
jail_remove(jid: ::c_int) -> ::c_int1421     pub fn jail_remove(jid: ::c_int) -> ::c_int;
jail_get(iov: *mut ::iovec, niov: ::c_uint, flags: ::c_int) -> ::c_int1422     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_int1423     pub fn jail_set(iov: *mut ::iovec, niov: ::c_uint, flags: ::c_int) -> ::c_int;
1424 
lio_listio( mode: ::c_int, aiocb_list: *const *mut aiocb, nitems: ::c_int, sevp: *mut sigevent, ) -> ::c_int1425     pub fn lio_listio(
1426         mode: ::c_int,
1427         aiocb_list: *const *mut aiocb,
1428         nitems: ::c_int,
1429         sevp: *mut sigevent,
1430     ) -> ::c_int;
1431 
posix_fallocate(fd: ::c_int, offset: ::off_t, len: ::off_t) -> ::c_int1432     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_int1433     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_int1434     pub fn mkostemp(template: *mut ::c_char, flags: ::c_int) -> ::c_int;
mkostemps(template: *mut ::c_char, suffixlen: ::c_int, flags: ::c_int) -> ::c_int1435     pub fn mkostemps(template: *mut ::c_char, suffixlen: ::c_int, flags: ::c_int) -> ::c_int;
1436 
getutxuser(user: *const ::c_char) -> *mut utmpx1437     pub fn getutxuser(user: *const ::c_char) -> *mut utmpx;
setutxdb(_type: ::c_int, file: *const ::c_char) -> ::c_int1438     pub fn setutxdb(_type: ::c_int, file: *const ::c_char) -> ::c_int;
1439 
aio_waitcomplete(iocbp: *mut *mut aiocb, timeout: *mut ::timespec) -> ::ssize_t1440     pub fn aio_waitcomplete(iocbp: *mut *mut aiocb, timeout: *mut ::timespec) -> ::ssize_t;
mq_getfd_np(mqd: ::mqd_t) -> ::c_int1441     pub fn mq_getfd_np(mqd: ::mqd_t) -> ::c_int;
1442 
waitid( idtype: idtype_t, id: ::id_t, infop: *mut ::siginfo_t, options: ::c_int, ) -> ::c_int1443     pub fn waitid(
1444         idtype: idtype_t,
1445         id: ::id_t,
1446         infop: *mut ::siginfo_t,
1447         options: ::c_int,
1448     ) -> ::c_int;
1449 
ftok(pathname: *const ::c_char, proj_id: ::c_int) -> ::key_t1450     pub fn ftok(pathname: *const ::c_char, proj_id: ::c_int) -> ::key_t;
shmget(key: ::key_t, size: ::size_t, shmflg: ::c_int) -> ::c_int1451     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_void1452     pub fn shmat(shmid: ::c_int, shmaddr: *const ::c_void, shmflg: ::c_int) -> *mut ::c_void;
shmdt(shmaddr: *const ::c_void) -> ::c_int1453     pub fn shmdt(shmaddr: *const ::c_void) -> ::c_int;
shmctl(shmid: ::c_int, cmd: ::c_int, buf: *mut ::shmid_ds) -> ::c_int1454     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_int1455     pub fn msgctl(msqid: ::c_int, cmd: ::c_int, buf: *mut ::msqid_ds) -> ::c_int;
msgget(key: ::key_t, msgflg: ::c_int) -> ::c_int1456     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_int1457     pub fn msgsnd(
1458         msqid: ::c_int,
1459         msgp: *const ::c_void,
1460         msgsz: ::size_t,
1461         msgflg: ::c_int,
1462     ) -> ::c_int;
cfmakesane(termios: *mut ::termios)1463     pub fn cfmakesane(termios: *mut ::termios);
fexecve( fd: ::c_int, argv: *const *const ::c_char, envp: *const *const ::c_char, ) -> ::c_int1464     pub fn fexecve(
1465         fd: ::c_int,
1466         argv: *const *const ::c_char,
1467         envp: *const *const ::c_char,
1468     ) -> ::c_int;
1469 
pdfork(fdp: *mut ::c_int, flags: ::c_int) -> ::pid_t1470     pub fn pdfork(fdp: *mut ::c_int, flags: ::c_int) -> ::pid_t;
pdgetpid(fd: ::c_int, pidp: *mut ::pid_t) -> ::c_int1471     pub fn pdgetpid(fd: ::c_int, pidp: *mut ::pid_t) -> ::c_int;
pdkill(fd: ::c_int, signum: ::c_int) -> ::c_int1472     pub fn pdkill(fd: ::c_int, signum: ::c_int) -> ::c_int;
1473 
rtprio_thread(function: ::c_int, lwpid: ::lwpid_t, rtp: *mut super::rtprio) -> ::c_int1474     pub fn rtprio_thread(function: ::c_int, lwpid: ::lwpid_t, rtp: *mut super::rtprio) -> ::c_int;
1475 
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_int1476     pub fn posix_spawn(
1477         pid: *mut ::pid_t,
1478         path: *const ::c_char,
1479         file_actions: *const ::posix_spawn_file_actions_t,
1480         attrp: *const ::posix_spawnattr_t,
1481         argv: *const *mut ::c_char,
1482         envp: *const *mut ::c_char,
1483     ) -> ::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_int1484     pub fn posix_spawnp(
1485         pid: *mut ::pid_t,
1486         file: *const ::c_char,
1487         file_actions: *const ::posix_spawn_file_actions_t,
1488         attrp: *const ::posix_spawnattr_t,
1489         argv: *const *mut ::c_char,
1490         envp: *const *mut ::c_char,
1491     ) -> ::c_int;
posix_spawnattr_init(attr: *mut posix_spawnattr_t) -> ::c_int1492     pub fn posix_spawnattr_init(attr: *mut posix_spawnattr_t) -> ::c_int;
posix_spawnattr_destroy(attr: *mut posix_spawnattr_t) -> ::c_int1493     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_int1494     pub fn posix_spawnattr_getsigdefault(
1495         attr: *const posix_spawnattr_t,
1496         default: *mut ::sigset_t,
1497     ) -> ::c_int;
posix_spawnattr_setsigdefault( attr: *mut posix_spawnattr_t, default: *const ::sigset_t, ) -> ::c_int1498     pub fn posix_spawnattr_setsigdefault(
1499         attr: *mut posix_spawnattr_t,
1500         default: *const ::sigset_t,
1501     ) -> ::c_int;
posix_spawnattr_getsigmask( attr: *const posix_spawnattr_t, default: *mut ::sigset_t, ) -> ::c_int1502     pub fn posix_spawnattr_getsigmask(
1503         attr: *const posix_spawnattr_t,
1504         default: *mut ::sigset_t,
1505     ) -> ::c_int;
posix_spawnattr_setsigmask( attr: *mut posix_spawnattr_t, default: *const ::sigset_t, ) -> ::c_int1506     pub fn posix_spawnattr_setsigmask(
1507         attr: *mut posix_spawnattr_t,
1508         default: *const ::sigset_t,
1509     ) -> ::c_int;
posix_spawnattr_getflags( attr: *const posix_spawnattr_t, flags: *mut ::c_short, ) -> ::c_int1510     pub fn posix_spawnattr_getflags(
1511         attr: *const posix_spawnattr_t,
1512         flags: *mut ::c_short,
1513     ) -> ::c_int;
posix_spawnattr_setflags(attr: *mut posix_spawnattr_t, flags: ::c_short) -> ::c_int1514     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_int1515     pub fn posix_spawnattr_getpgroup(
1516         attr: *const posix_spawnattr_t,
1517         flags: *mut ::pid_t,
1518     ) -> ::c_int;
posix_spawnattr_setpgroup(attr: *mut posix_spawnattr_t, flags: ::pid_t) -> ::c_int1519     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_int1520     pub fn posix_spawnattr_getschedpolicy(
1521         attr: *const posix_spawnattr_t,
1522         flags: *mut ::c_int,
1523     ) -> ::c_int;
posix_spawnattr_setschedpolicy(attr: *mut posix_spawnattr_t, flags: ::c_int) -> ::c_int1524     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_int1525     pub fn posix_spawnattr_getschedparam(
1526         attr: *const posix_spawnattr_t,
1527         param: *mut ::sched_param,
1528     ) -> ::c_int;
posix_spawnattr_setschedparam( attr: *mut posix_spawnattr_t, param: *const ::sched_param, ) -> ::c_int1529     pub fn posix_spawnattr_setschedparam(
1530         attr: *mut posix_spawnattr_t,
1531         param: *const ::sched_param,
1532     ) -> ::c_int;
1533 
posix_spawn_file_actions_init(actions: *mut posix_spawn_file_actions_t) -> ::c_int1534     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_int1535     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_int1536     pub fn posix_spawn_file_actions_addopen(
1537         actions: *mut posix_spawn_file_actions_t,
1538         fd: ::c_int,
1539         path: *const ::c_char,
1540         oflag: ::c_int,
1541         mode: ::mode_t,
1542     ) -> ::c_int;
posix_spawn_file_actions_addclose( actions: *mut posix_spawn_file_actions_t, fd: ::c_int, ) -> ::c_int1543     pub fn posix_spawn_file_actions_addclose(
1544         actions: *mut posix_spawn_file_actions_t,
1545         fd: ::c_int,
1546     ) -> ::c_int;
posix_spawn_file_actions_adddup2( actions: *mut posix_spawn_file_actions_t, fd: ::c_int, newfd: ::c_int, ) -> ::c_int1547     pub fn posix_spawn_file_actions_adddup2(
1548         actions: *mut posix_spawn_file_actions_t,
1549         fd: ::c_int,
1550         newfd: ::c_int,
1551     ) -> ::c_int;
1552 
1553     #[cfg_attr(all(target_os = "freebsd", freebsd11), link_name = "statfs@FBSD_1.0")]
statfs(path: *const ::c_char, buf: *mut statfs) -> ::c_int1554     pub fn statfs(path: *const ::c_char, buf: *mut statfs) -> ::c_int;
1555     #[cfg_attr(all(target_os = "freebsd", freebsd11), link_name = "fstatfs@FBSD_1.0")]
fstatfs(fd: ::c_int, buf: *mut statfs) -> ::c_int1556     pub fn fstatfs(fd: ::c_int, buf: *mut statfs) -> ::c_int;
1557 
dup3(src: ::c_int, dst: ::c_int, flags: ::c_int) -> ::c_int1558     pub fn dup3(src: ::c_int, dst: ::c_int, flags: ::c_int) -> ::c_int;
__xuname(nmln: ::c_int, buf: *mut ::c_void) -> ::c_int1559     pub fn __xuname(nmln: ::c_int, buf: *mut ::c_void) -> ::c_int;
1560 
sendmmsg( sockfd: ::c_int, msgvec: *mut ::mmsghdr, vlen: ::size_t, flags: ::c_int, ) -> ::ssize_t1561     pub fn sendmmsg(
1562         sockfd: ::c_int,
1563         msgvec: *mut ::mmsghdr,
1564         vlen: ::size_t,
1565         flags: ::c_int,
1566     ) -> ::ssize_t;
recvmmsg( sockfd: ::c_int, msgvec: *mut ::mmsghdr, vlen: ::size_t, flags: ::c_int, timeout: *const ::timespec, ) -> ::ssize_t1567     pub fn recvmmsg(
1568         sockfd: ::c_int,
1569         msgvec: *mut ::mmsghdr,
1570         vlen: ::size_t,
1571         flags: ::c_int,
1572         timeout: *const ::timespec,
1573     ) -> ::ssize_t;
memmem( haystack: *const ::c_void, haystacklen: ::size_t, needle: *const ::c_void, needlelen: ::size_t, ) -> *mut ::c_void1574     pub fn memmem(
1575         haystack: *const ::c_void,
1576         haystacklen: ::size_t,
1577         needle: *const ::c_void,
1578         needlelen: ::size_t,
1579     ) -> *mut ::c_void;
1580 
nmount(iov: *mut ::iovec, niov: ::c_uint, flags: ::c_int) -> ::c_int1581     pub fn nmount(iov: *mut ::iovec, niov: ::c_uint, flags: ::c_int) -> ::c_int;
cpuset_getaffinity( level: cpulevel_t, which: cpuwhich_t, id: ::id_t, setsize: ::size_t, mask: *mut cpuset_t, ) -> ::c_int1582     pub fn cpuset_getaffinity(
1583         level: cpulevel_t,
1584         which: cpuwhich_t,
1585         id: ::id_t,
1586         setsize: ::size_t,
1587         mask: *mut cpuset_t,
1588     ) -> ::c_int;
cpuset_setaffinity( level: cpulevel_t, which: cpuwhich_t, id: ::id_t, setsize: ::size_t, mask: *const cpuset_t, ) -> ::c_int1589     pub fn cpuset_setaffinity(
1590         level: cpulevel_t,
1591         which: cpuwhich_t,
1592         id: ::id_t,
1593         setsize: ::size_t,
1594         mask: *const cpuset_t,
1595     ) -> ::c_int;
cap_enter() -> ::c_int1596     pub fn cap_enter() -> ::c_int;
cap_getmode(modep: *mut ::c_uint) -> ::c_int1597     pub fn cap_getmode(modep: *mut ::c_uint) -> ::c_int;
__cap_rights_init(version: ::c_int, rights: *mut cap_rights_t, ...) -> *mut cap_rights_t1598     pub fn __cap_rights_init(version: ::c_int, rights: *mut cap_rights_t, ...)
1599         -> *mut cap_rights_t;
__cap_rights_set(rights: *mut cap_rights_t, ...) -> *mut cap_rights_t1600     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_t1601     pub fn __cap_rights_clear(rights: *mut cap_rights_t, ...) -> *mut cap_rights_t;
__cap_rights_is_set(rights: *const cap_rights_t, ...) -> bool1602     pub fn __cap_rights_is_set(rights: *const cap_rights_t, ...) -> bool;
cap_rights_is_valid(rights: *const cap_rights_t) -> bool1603     pub fn cap_rights_is_valid(rights: *const cap_rights_t) -> bool;
cap_rights_limit(fd: ::c_int, rights: *const cap_rights_t) -> ::c_int1604     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_t1605     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_t1606     pub fn cap_rights_remove(dst: *mut cap_rights_t, src: *const cap_rights_t)
1607         -> *mut cap_rights_t;
cap_rights_contains(big: *const cap_rights_t, little: *const cap_rights_t) -> bool1608     pub fn cap_rights_contains(big: *const cap_rights_t, little: *const cap_rights_t) -> bool;
1609 }
1610 
1611 #[link(name = "util")]
1612 extern "C" {
extattr_namespace_to_string( attrnamespace: ::c_int, string: *mut *mut ::c_char, ) -> ::c_int1613     pub fn extattr_namespace_to_string(
1614         attrnamespace: ::c_int,
1615         string: *mut *mut ::c_char,
1616     ) -> ::c_int;
extattr_string_to_namespace( string: *const ::c_char, attrnamespace: *mut ::c_int, ) -> ::c_int1617     pub fn extattr_string_to_namespace(
1618         string: *const ::c_char,
1619         attrnamespace: *mut ::c_int,
1620     ) -> ::c_int;
realhostname(host: *mut ::c_char, hsize: ::size_t, ip: *const ::in_addr) -> ::c_int1621     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_int1622     pub fn realhostname_sa(
1623         host: *mut ::c_char,
1624         hsize: ::size_t,
1625         addr: *mut ::sockaddr,
1626         addrlen: ::c_int,
1627     ) -> ::c_int;
1628 }
1629 
1630 cfg_if! {
1631     if #[cfg(freebsd13)] {
1632         mod freebsd13;
1633         pub use self::freebsd13::*;
1634     } else if #[cfg(freebsd12)] {
1635         mod freebsd12;
1636         pub use self::freebsd12::*;
1637     } else if #[cfg(any(freebsd10, freebsd11))] {
1638         mod freebsd11;
1639         pub use self::freebsd11::*;
1640     } else {
1641         // Unknown freebsd version
1642     }
1643 }
1644 
1645 cfg_if! {
1646     if #[cfg(target_arch = "x86")] {
1647         mod x86;
1648         pub use self::x86::*;
1649     } else if #[cfg(target_arch = "x86_64")] {
1650         mod x86_64;
1651         pub use self::x86_64::*;
1652     } else if #[cfg(target_arch = "aarch64")] {
1653         mod aarch64;
1654         pub use self::aarch64::*;
1655     } else if #[cfg(target_arch = "arm")] {
1656         mod arm;
1657         pub use self::arm::*;
1658     } else if #[cfg(target_arch = "powerpc64")] {
1659         mod powerpc64;
1660         pub use self::powerpc64::*;
1661     } else if #[cfg(target_arch = "powerpc")] {
1662         mod powerpc;
1663         pub use self::powerpc::*;
1664     } else {
1665         // Unknown target_arch
1666     }
1667 }
1668