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