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