1 pub type dev_t = u32;
2 pub type c_char = i8;
3 pub type wchar_t = i32;
4 pub type clock_t = u64;
5 pub type ino_t = u64;
6 pub type lwpid_t = i32;
7 pub type nlink_t = u32;
8 pub type blksize_t = i64;
9 pub type clockid_t = ::c_ulong;
10 
11 pub type c_long = i64;
12 pub type c_ulong = u64;
13 pub type time_t = i64;
14 pub type suseconds_t = i64;
15 
16 pub type uuid_t = ::uuid;
17 
18 pub type fsblkcnt_t = u64;
19 pub type fsfilcnt_t = u64;
20 pub type idtype_t = ::c_uint;
21 
22 pub type mqd_t = ::c_int;
23 pub type sem_t = *mut sem;
24 
25 pub type cpuset_t = cpumask_t;
26 pub type cpu_set_t = cpumask_t;
27 
28 #[cfg_attr(feature = "extra_traits", derive(Debug))]
29 pub enum sem {}
30 impl ::Copy for sem {}
31 impl ::Clone for sem {
clone(&self) -> sem32     fn clone(&self) -> sem {
33         *self
34     }
35 }
36 
37 s! {
38     pub struct kevent {
39         pub ident: ::uintptr_t,
40         pub filter: ::c_short,
41         pub flags: ::c_ushort,
42         pub fflags: ::c_uint,
43         pub data: ::intptr_t,
44         pub udata: *mut ::c_void,
45     }
46 
47     pub struct exit_status {
48         pub e_termination: u16,
49         pub e_exit: u16
50     }
51 
52     pub struct aiocb {
53         pub aio_fildes: ::c_int,
54         pub aio_offset: ::off_t,
55         pub aio_buf: *mut ::c_void,
56         pub aio_nbytes: ::size_t,
57         pub aio_sigevent: sigevent,
58         pub aio_lio_opcode: ::c_int,
59         pub aio_reqprio: ::c_int,
60         _aio_val: ::c_int,
61         _aio_err: ::c_int
62     }
63 
64     pub struct uuid {
65         pub time_low: u32,
66         pub time_mid: u16,
67         pub time_hi_and_version: u16,
68         pub clock_seq_hi_and_reserved: u8,
69         pub clock_seq_low: u8,
70         pub node: [u8; 6],
71     }
72 
73     pub struct mq_attr {
74         pub mq_flags: ::c_long,
75         pub mq_maxmsg: ::c_long,
76         pub mq_msgsize: ::c_long,
77         pub mq_curmsgs: ::c_long,
78     }
79 
80     pub struct statvfs {
81         pub f_bsize: ::c_ulong,
82         pub f_frsize: ::c_ulong,
83         pub f_blocks: ::fsblkcnt_t,
84         pub f_bfree: ::fsblkcnt_t,
85         pub f_bavail: ::fsblkcnt_t,
86         pub f_files: ::fsfilcnt_t,
87         pub f_ffree: ::fsfilcnt_t,
88         pub f_favail: ::fsfilcnt_t,
89         pub f_fsid: ::c_ulong,
90         pub f_flag: ::c_ulong,
91         pub f_namemax: ::c_ulong,
92         pub f_owner: ::uid_t,
93         pub f_type: ::c_uint,
94         pub f_syncreads: u64,
95         pub f_syncwrites: u64,
96         pub f_asyncreads: u64,
97         pub f_asyncwrites: u64,
98         pub f_fsid_uuid: ::uuid_t,
99         pub f_uid_uuid: ::uuid_t,
100     }
101 
102     pub struct stat {
103         pub st_ino: ::ino_t,
104         pub st_nlink: ::nlink_t,
105         pub st_dev: ::dev_t,
106         pub st_mode: ::mode_t,
107         pub st_padding1: u16,
108         pub st_uid: ::uid_t,
109         pub st_gid: ::gid_t,
110         pub st_rdev: ::dev_t,
111         pub st_atime: ::time_t,
112         pub st_atime_nsec: ::c_long,
113         pub st_mtime: ::time_t,
114         pub st_mtime_nsec: ::c_long,
115         pub st_ctime: ::time_t,
116         pub st_ctime_nsec: ::c_long,
117         pub st_size: ::off_t,
118         pub st_blocks: i64,
119         pub st_blksize: u32,
120         pub st_flags: u32,
121         pub st_gen: u32,
122         pub st_lspare: i32,
123         pub st_qspare1: i64,
124         pub st_qspare2: i64,
125     }
126 
127     pub struct if_data {
128         pub ifi_type: ::c_uchar,
129         pub ifi_physical: ::c_uchar,
130         pub ifi_addrlen: ::c_uchar,
131         pub ifi_hdrlen: ::c_uchar,
132         pub ifi_recvquota: ::c_uchar,
133         pub ifi_xmitquota: ::c_uchar,
134         pub ifi_mtu: ::c_ulong,
135         pub ifi_metric: ::c_ulong,
136         pub ifi_link_state: ::c_ulong,
137         pub ifi_baudrate: u64,
138         pub ifi_ipackets: ::c_ulong,
139         pub ifi_ierrors: ::c_ulong,
140         pub ifi_opackets: ::c_ulong,
141         pub ifi_oerrors: ::c_ulong,
142         pub ifi_collisions: ::c_ulong,
143         pub ifi_ibytes: ::c_ulong,
144         pub ifi_obytes: ::c_ulong,
145         pub ifi_imcasts: ::c_ulong,
146         pub ifi_omcasts: ::c_ulong,
147         pub ifi_iqdrops: ::c_ulong,
148         pub ifi_noproto: ::c_ulong,
149         pub ifi_hwassist: ::c_ulong,
150         pub ifi_oqdrops: ::c_ulong,
151         pub ifi_lastchange: ::timeval,
152     }
153 
154     pub struct if_msghdr {
155         pub ifm_msglen: ::c_ushort,
156         pub ifm_version: ::c_uchar,
157         pub ifm_type: ::c_uchar,
158         pub ifm_addrs: ::c_int,
159         pub ifm_flags: ::c_int,
160         pub ifm_index: ::c_ushort,
161         pub ifm_data: if_data,
162     }
163 
164     pub struct sockaddr_dl {
165         pub sdl_len: ::c_uchar,
166         pub sdl_family: ::c_uchar,
167         pub sdl_index: ::c_ushort,
168         pub sdl_type: ::c_uchar,
169         pub sdl_nlen: ::c_uchar,
170         pub sdl_alen: ::c_uchar,
171         pub sdl_slen: ::c_uchar,
172         pub sdl_data: [::c_char; 12],
173         pub sdl_rcf: ::c_ushort,
174         pub sdl_route: [::c_ushort; 16],
175     }
176 
177     pub struct xucred {
178         pub cr_version: ::c_uint,
179         pub cr_uid: ::uid_t,
180         pub cr_ngroups: ::c_short,
181         pub cr_groups: [::gid_t; 16],
182         __cr_unused1: *mut ::c_void,
183     }
184 
185     pub struct stack_t {
186         pub ss_sp: *mut ::c_char,
187         pub ss_size: ::size_t,
188         pub ss_flags: ::c_int,
189     }
190 
191     pub struct cpumask_t {
192         ary: [u64; 4],
193     }
194 }
195 
196 s_no_extra_traits! {
197     pub struct utmpx {
198         pub ut_name: [::c_char; 32],
199         pub ut_id: [::c_char; 4],
200 
201         pub ut_line: [::c_char; 32],
202         pub ut_host: [::c_char; 256],
203 
204         pub ut_unused: [u8; 16],
205         pub ut_session: u16,
206         pub ut_type: u16,
207         pub ut_pid: ::pid_t,
208         ut_exit: exit_status,
209         ut_ss: ::sockaddr_storage,
210         pub ut_tv: ::timeval,
211         pub ut_unused2: [u8; 16],
212     }
213 
214     pub struct dirent {
215         pub d_fileno: ::ino_t,
216         pub d_namlen: u16,
217         pub d_type: u8,
218         __unused1: u8,
219         __unused2: u32,
220         pub d_name: [::c_char; 256],
221     }
222 
223     pub struct statfs {
224         pub f_bsize: ::c_long,
225         pub f_iosize: ::c_long,
226         pub f_blocks: ::c_long,
227         pub f_bfree: ::c_long,
228         pub f_bavail: ::c_long,
229         pub f_files: ::c_long,
230         pub f_ffree: ::c_long,
231         pub f_fsid: ::fsid_t,
232         pub f_owner: ::uid_t,
233         pub f_type: i32,
234         pub f_flags: i32,
235         pub f_syncwrites: ::c_long,
236         pub f_asyncwrites: ::c_long,
237         pub f_fstypename: [::c_char; 16],
238         pub f_mntonname: [::c_char; 90],
239         pub f_syncreads: ::c_long,
240         pub f_asyncreads: ::c_long,
241         pub f_mntfromname: [::c_char; 90],
242     }
243 
244     pub struct sigevent {
245         pub sigev_notify: ::c_int,
246         // The union is 8-byte in size, so it is aligned at a 8-byte offset.
247         #[cfg(target_pointer_width = "64")]
248         __unused1: ::c_int,
249         pub sigev_signo: ::c_int,       //actually a union
250         // pad the union
251         #[cfg(target_pointer_width = "64")]
252         __unused2: ::c_int,
253         pub sigev_value: ::sigval,
254         __unused3: *mut ::c_void        //actually a function pointer
255     }
256 }
257 
258 cfg_if! {
259     if #[cfg(feature = "extra_traits")] {
260         impl PartialEq for utmpx {
261             fn eq(&self, other: &utmpx) -> bool {
262                 self.ut_name == other.ut_name
263                     && self.ut_id == other.ut_id
264                     && self.ut_line == other.ut_line
265                     && self
266                     .ut_host
267                     .iter()
268                     .zip(other.ut_host.iter())
269                     .all(|(a,b)| a == b)
270                     && self.ut_unused == other.ut_unused
271                     && self.ut_session == other.ut_session
272                     && self.ut_type == other.ut_type
273                     && self.ut_pid == other.ut_pid
274                     && self.ut_exit == other.ut_exit
275                     && self.ut_ss == other.ut_ss
276                     && self.ut_tv == other.ut_tv
277                     && self.ut_unused2 == other.ut_unused2
278             }
279         }
280         impl Eq for utmpx {}
281         impl ::fmt::Debug for utmpx {
282             fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
283                 f.debug_struct("utmpx")
284                     .field("ut_name", &self.ut_name)
285                     .field("ut_id", &self.ut_id)
286                     .field("ut_line", &self.ut_line)
287                     // FIXME: .field("ut_host", &self.ut_host)
288                     .field("ut_unused", &self.ut_unused)
289                     .field("ut_session", &self.ut_session)
290                     .field("ut_type", &self.ut_type)
291                     .field("ut_pid", &self.ut_pid)
292                     .field("ut_exit", &self.ut_exit)
293                     .field("ut_ss", &self.ut_ss)
294                     .field("ut_tv", &self.ut_tv)
295                     .field("ut_unused2", &self.ut_unused2)
296                     .finish()
297             }
298         }
299         impl ::hash::Hash for utmpx {
300             fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
301                 self.ut_name.hash(state);
302                 self.ut_id.hash(state);
303                 self.ut_line.hash(state);
304                 self.ut_host.hash(state);
305                 self.ut_unused.hash(state);
306                 self.ut_session.hash(state);
307                 self.ut_type.hash(state);
308                 self.ut_pid.hash(state);
309                 self.ut_exit.hash(state);
310                 self.ut_ss.hash(state);
311                 self.ut_tv.hash(state);
312                 self.ut_unused2.hash(state);
313             }
314         }
315 
316         impl PartialEq for dirent {
317             fn eq(&self, other: &dirent) -> bool {
318                 self.d_fileno == other.d_fileno
319                     && self.d_namlen == other.d_namlen
320                     && self.d_type == other.d_type
321                     // Ignore __unused1
322                     // Ignore __unused2
323                     && self
324                     .d_name
325                     .iter()
326                     .zip(other.d_name.iter())
327                     .all(|(a,b)| a == b)
328             }
329         }
330         impl Eq for dirent {}
331         impl ::fmt::Debug for dirent {
332             fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
333                 f.debug_struct("dirent")
334                     .field("d_fileno", &self.d_fileno)
335                     .field("d_namlen", &self.d_namlen)
336                     .field("d_type", &self.d_type)
337                     // Ignore __unused1
338                     // Ignore __unused2
339                     // FIXME: .field("d_name", &self.d_name)
340                     .finish()
341             }
342         }
343         impl ::hash::Hash for dirent {
344             fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
345                 self.d_fileno.hash(state);
346                 self.d_namlen.hash(state);
347                 self.d_type.hash(state);
348                     // Ignore __unused1
349                     // Ignore __unused2
350                 self.d_name.hash(state);
351             }
352         }
353 
354         impl PartialEq for statfs {
355             fn eq(&self, other: &statfs) -> bool {
356                 self.f_bsize == other.f_bsize
357                     && self.f_iosize == other.f_iosize
358                     && self.f_blocks == other.f_blocks
359                     && self.f_bfree == other.f_bfree
360                     && self.f_bavail == other.f_bavail
361                     && self.f_files == other.f_files
362                     && self.f_ffree == other.f_ffree
363                     && self.f_fsid == other.f_fsid
364                     && self.f_owner == other.f_owner
365                     && self.f_type == other.f_type
366                     && self.f_flags == other.f_flags
367                     && self.f_syncwrites == other.f_syncwrites
368                     && self.f_asyncwrites == other.f_asyncwrites
369                     && self.f_fstypename == other.f_fstypename
370                     && self
371                     .f_mntonname
372                     .iter()
373                     .zip(other.f_mntonname.iter())
374                     .all(|(a,b)| a == b)
375                     && self.f_syncreads == other.f_syncreads
376                     && self.f_asyncreads == other.f_asyncreads
377                     && self
378                     .f_mntfromname
379                     .iter()
380                     .zip(other.f_mntfromname.iter())
381                     .all(|(a,b)| a == b)
382             }
383         }
384         impl Eq for statfs {}
385         impl ::fmt::Debug for statfs {
386             fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
387                 f.debug_struct("statfs")
388                     .field("f_bsize", &self.f_bsize)
389                     .field("f_iosize", &self.f_iosize)
390                     .field("f_blocks", &self.f_blocks)
391                     .field("f_bfree", &self.f_bfree)
392                     .field("f_bavail", &self.f_bavail)
393                     .field("f_files", &self.f_files)
394                     .field("f_ffree", &self.f_ffree)
395                     .field("f_fsid", &self.f_fsid)
396                     .field("f_owner", &self.f_owner)
397                     .field("f_type", &self.f_type)
398                     .field("f_flags", &self.f_flags)
399                     .field("f_syncwrites", &self.f_syncwrites)
400                     .field("f_asyncwrites", &self.f_asyncwrites)
401                     // FIXME: .field("f_mntonname", &self.f_mntonname)
402                     .field("f_syncreads", &self.f_syncreads)
403                     .field("f_asyncreads", &self.f_asyncreads)
404                     // FIXME: .field("f_mntfromname", &self.f_mntfromname)
405                     .finish()
406             }
407         }
408         impl ::hash::Hash for statfs {
409             fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
410                 self.f_bsize.hash(state);
411                 self.f_iosize.hash(state);
412                 self.f_blocks.hash(state);
413                 self.f_bfree.hash(state);
414                 self.f_bavail.hash(state);
415                 self.f_files.hash(state);
416                 self.f_ffree.hash(state);
417                 self.f_fsid.hash(state);
418                 self.f_owner.hash(state);
419                 self.f_type.hash(state);
420                 self.f_flags.hash(state);
421                 self.f_syncwrites.hash(state);
422                 self.f_asyncwrites.hash(state);
423                 self.f_fstypename.hash(state);
424                 self.f_mntonname.hash(state);
425                 self.f_syncreads.hash(state);
426                 self.f_asyncreads.hash(state);
427                 self.f_mntfromname.hash(state);
428             }
429         }
430 
431         impl PartialEq for sigevent {
432             fn eq(&self, other: &sigevent) -> bool {
433                 self.sigev_notify == other.sigev_notify
434                     && self.sigev_signo == other.sigev_signo
435                     && self.sigev_value == other.sigev_value
436             }
437         }
438         impl Eq for sigevent {}
439         impl ::fmt::Debug for sigevent {
440             fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
441                 f.debug_struct("sigevent")
442                     .field("sigev_notify", &self.sigev_notify)
443                     .field("sigev_signo", &self.sigev_signo)
444                     .field("sigev_value", &self.sigev_value)
445                     .finish()
446             }
447         }
448         impl ::hash::Hash for sigevent {
449             fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
450                 self.sigev_notify.hash(state);
451                 self.sigev_signo.hash(state);
452                 self.sigev_value.hash(state);
453             }
454         }
455     }
456 }
457 
458 pub const RAND_MAX: ::c_int = 0x7fff_ffff;
459 pub const PTHREAD_STACK_MIN: ::size_t = 16384;
460 pub const SIGSTKSZ: ::size_t = 40960;
461 pub const MADV_INVAL: ::c_int = 10;
462 pub const MADV_SETMAP: ::c_int = 11;
463 pub const O_CLOEXEC: ::c_int = 0x00020000;
464 pub const O_DIRECTORY: ::c_int = 0x08000000;
465 pub const F_GETLK: ::c_int = 7;
466 pub const F_SETLK: ::c_int = 8;
467 pub const F_SETLKW: ::c_int = 9;
468 pub const ENOMEDIUM: ::c_int = 93;
469 pub const EASYNC: ::c_int = 99;
470 pub const ELAST: ::c_int = 99;
471 pub const RLIMIT_POSIXLOCKS: ::c_int = 11;
472 #[deprecated(since = "0.2.64", note = "Not stable across OS versions")]
473 pub const RLIM_NLIMITS: ::rlim_t = 12;
474 
475 pub const Q_GETQUOTA: ::c_int = 0x300;
476 pub const Q_SETQUOTA: ::c_int = 0x400;
477 
478 pub const CTL_UNSPEC: ::c_int = 0;
479 pub const CTL_KERN: ::c_int = 1;
480 pub const CTL_VM: ::c_int = 2;
481 pub const CTL_VFS: ::c_int = 3;
482 pub const CTL_NET: ::c_int = 4;
483 pub const CTL_DEBUG: ::c_int = 5;
484 pub const CTL_HW: ::c_int = 6;
485 pub const CTL_MACHDEP: ::c_int = 7;
486 pub const CTL_USER: ::c_int = 8;
487 pub const CTL_P1003_1B: ::c_int = 9;
488 pub const CTL_LWKT: ::c_int = 10;
489 pub const CTL_MAXID: ::c_int = 11;
490 pub const KERN_OSTYPE: ::c_int = 1;
491 pub const KERN_OSRELEASE: ::c_int = 2;
492 pub const KERN_OSREV: ::c_int = 3;
493 pub const KERN_VERSION: ::c_int = 4;
494 pub const KERN_MAXVNODES: ::c_int = 5;
495 pub const KERN_MAXPROC: ::c_int = 6;
496 pub const KERN_MAXFILES: ::c_int = 7;
497 pub const KERN_ARGMAX: ::c_int = 8;
498 pub const KERN_SECURELVL: ::c_int = 9;
499 pub const KERN_HOSTNAME: ::c_int = 10;
500 pub const KERN_HOSTID: ::c_int = 11;
501 pub const KERN_CLOCKRATE: ::c_int = 12;
502 pub const KERN_VNODE: ::c_int = 13;
503 pub const KERN_PROC: ::c_int = 14;
504 pub const KERN_FILE: ::c_int = 15;
505 pub const KERN_PROF: ::c_int = 16;
506 pub const KERN_POSIX1: ::c_int = 17;
507 pub const KERN_NGROUPS: ::c_int = 18;
508 pub const KERN_JOB_CONTROL: ::c_int = 19;
509 pub const KERN_SAVED_IDS: ::c_int = 20;
510 pub const KERN_BOOTTIME: ::c_int = 21;
511 pub const KERN_NISDOMAINNAME: ::c_int = 22;
512 pub const KERN_UPDATEINTERVAL: ::c_int = 23;
513 pub const KERN_OSRELDATE: ::c_int = 24;
514 pub const KERN_NTP_PLL: ::c_int = 25;
515 pub const KERN_BOOTFILE: ::c_int = 26;
516 pub const KERN_MAXFILESPERPROC: ::c_int = 27;
517 pub const KERN_MAXPROCPERUID: ::c_int = 28;
518 pub const KERN_DUMPDEV: ::c_int = 29;
519 pub const KERN_IPC: ::c_int = 30;
520 pub const KERN_DUMMY: ::c_int = 31;
521 pub const KERN_PS_STRINGS: ::c_int = 32;
522 pub const KERN_USRSTACK: ::c_int = 33;
523 pub const KERN_LOGSIGEXIT: ::c_int = 34;
524 pub const KERN_IOV_MAX: ::c_int = 35;
525 pub const KERN_MAXPOSIXLOCKSPERUID: ::c_int = 36;
526 pub const KERN_MAXID: ::c_int = 37;
527 pub const KERN_PROC_ALL: ::c_int = 0;
528 pub const KERN_PROC_PID: ::c_int = 1;
529 pub const KERN_PROC_PGRP: ::c_int = 2;
530 pub const KERN_PROC_SESSION: ::c_int = 3;
531 pub const KERN_PROC_TTY: ::c_int = 4;
532 pub const KERN_PROC_UID: ::c_int = 5;
533 pub const KERN_PROC_RUID: ::c_int = 6;
534 pub const KERN_PROC_ARGS: ::c_int = 7;
535 pub const KERN_PROC_CWD: ::c_int = 8;
536 pub const KERN_PROC_PATHNAME: ::c_int = 9;
537 pub const KERN_PROC_FLAGMASK: ::c_int = 0x10;
538 pub const KERN_PROC_FLAG_LWP: ::c_int = 0x10;
539 pub const KIPC_MAXSOCKBUF: ::c_int = 1;
540 pub const KIPC_SOCKBUF_WASTE: ::c_int = 2;
541 pub const KIPC_SOMAXCONN: ::c_int = 3;
542 pub const KIPC_MAX_LINKHDR: ::c_int = 4;
543 pub const KIPC_MAX_PROTOHDR: ::c_int = 5;
544 pub const KIPC_MAX_HDR: ::c_int = 6;
545 pub const KIPC_MAX_DATALEN: ::c_int = 7;
546 pub const KIPC_MBSTAT: ::c_int = 8;
547 pub const KIPC_NMBCLUSTERS: ::c_int = 9;
548 pub const HW_MACHINE: ::c_int = 1;
549 pub const HW_MODEL: ::c_int = 2;
550 pub const HW_NCPU: ::c_int = 3;
551 pub const HW_BYTEORDER: ::c_int = 4;
552 pub const HW_PHYSMEM: ::c_int = 5;
553 pub const HW_USERMEM: ::c_int = 6;
554 pub const HW_PAGESIZE: ::c_int = 7;
555 pub const HW_DISKNAMES: ::c_int = 8;
556 pub const HW_DISKSTATS: ::c_int = 9;
557 pub const HW_FLOATINGPT: ::c_int = 10;
558 pub const HW_MACHINE_ARCH: ::c_int = 11;
559 pub const HW_MACHINE_PLATFORM: ::c_int = 12;
560 pub const HW_SENSORS: ::c_int = 13;
561 pub const HW_MAXID: ::c_int = 14;
562 pub const USER_CS_PATH: ::c_int = 1;
563 pub const USER_BC_BASE_MAX: ::c_int = 2;
564 pub const USER_BC_DIM_MAX: ::c_int = 3;
565 pub const USER_BC_SCALE_MAX: ::c_int = 4;
566 pub const USER_BC_STRING_MAX: ::c_int = 5;
567 pub const USER_COLL_WEIGHTS_MAX: ::c_int = 6;
568 pub const USER_EXPR_NEST_MAX: ::c_int = 7;
569 pub const USER_LINE_MAX: ::c_int = 8;
570 pub const USER_RE_DUP_MAX: ::c_int = 9;
571 pub const USER_POSIX2_VERSION: ::c_int = 10;
572 pub const USER_POSIX2_C_BIND: ::c_int = 11;
573 pub const USER_POSIX2_C_DEV: ::c_int = 12;
574 pub const USER_POSIX2_CHAR_TERM: ::c_int = 13;
575 pub const USER_POSIX2_FORT_DEV: ::c_int = 14;
576 pub const USER_POSIX2_FORT_RUN: ::c_int = 15;
577 pub const USER_POSIX2_LOCALEDEF: ::c_int = 16;
578 pub const USER_POSIX2_SW_DEV: ::c_int = 17;
579 pub const USER_POSIX2_UPE: ::c_int = 18;
580 pub const USER_STREAM_MAX: ::c_int = 19;
581 pub const USER_TZNAME_MAX: ::c_int = 20;
582 pub const USER_MAXID: ::c_int = 21;
583 pub const CTL_P1003_1B_ASYNCHRONOUS_IO: ::c_int = 1;
584 pub const CTL_P1003_1B_MAPPED_FILES: ::c_int = 2;
585 pub const CTL_P1003_1B_MEMLOCK: ::c_int = 3;
586 pub const CTL_P1003_1B_MEMLOCK_RANGE: ::c_int = 4;
587 pub const CTL_P1003_1B_MEMORY_PROTECTION: ::c_int = 5;
588 pub const CTL_P1003_1B_MESSAGE_PASSING: ::c_int = 6;
589 pub const CTL_P1003_1B_PRIORITIZED_IO: ::c_int = 7;
590 pub const CTL_P1003_1B_PRIORITY_SCHEDULING: ::c_int = 8;
591 pub const CTL_P1003_1B_REALTIME_SIGNALS: ::c_int = 9;
592 pub const CTL_P1003_1B_SEMAPHORES: ::c_int = 10;
593 pub const CTL_P1003_1B_FSYNC: ::c_int = 11;
594 pub const CTL_P1003_1B_SHARED_MEMORY_OBJECTS: ::c_int = 12;
595 pub const CTL_P1003_1B_SYNCHRONIZED_IO: ::c_int = 13;
596 pub const CTL_P1003_1B_TIMERS: ::c_int = 14;
597 pub const CTL_P1003_1B_AIO_LISTIO_MAX: ::c_int = 15;
598 pub const CTL_P1003_1B_AIO_MAX: ::c_int = 16;
599 pub const CTL_P1003_1B_AIO_PRIO_DELTA_MAX: ::c_int = 17;
600 pub const CTL_P1003_1B_DELAYTIMER_MAX: ::c_int = 18;
601 pub const CTL_P1003_1B_UNUSED1: ::c_int = 19;
602 pub const CTL_P1003_1B_PAGESIZE: ::c_int = 20;
603 pub const CTL_P1003_1B_RTSIG_MAX: ::c_int = 21;
604 pub const CTL_P1003_1B_SEM_NSEMS_MAX: ::c_int = 22;
605 pub const CTL_P1003_1B_SEM_VALUE_MAX: ::c_int = 23;
606 pub const CTL_P1003_1B_SIGQUEUE_MAX: ::c_int = 24;
607 pub const CTL_P1003_1B_TIMER_MAX: ::c_int = 25;
608 pub const CTL_P1003_1B_MAXID: ::c_int = 26;
609 
610 pub const EVFILT_READ: i16 = -1;
611 pub const EVFILT_WRITE: i16 = -2;
612 pub const EVFILT_AIO: i16 = -3;
613 pub const EVFILT_VNODE: i16 = -4;
614 pub const EVFILT_PROC: i16 = -5;
615 pub const EVFILT_SIGNAL: i16 = -6;
616 pub const EVFILT_TIMER: i16 = -7;
617 pub const EVFILT_EXCEPT: i16 = -8;
618 pub const EVFILT_USER: i16 = -9;
619 pub const EVFILT_FS: i16 = -10;
620 
621 pub const EV_ADD: u16 = 0x1;
622 pub const EV_DELETE: u16 = 0x2;
623 pub const EV_ENABLE: u16 = 0x4;
624 pub const EV_DISABLE: u16 = 0x8;
625 pub const EV_ONESHOT: u16 = 0x10;
626 pub const EV_CLEAR: u16 = 0x20;
627 pub const EV_RECEIPT: u16 = 0x40;
628 pub const EV_DISPATCH: u16 = 0x80;
629 pub const EV_NODATA: u16 = 0x1000;
630 pub const EV_FLAG1: u16 = 0x2000;
631 pub const EV_ERROR: u16 = 0x4000;
632 pub const EV_EOF: u16 = 0x8000;
633 pub const EV_SYSFLAGS: u16 = 0xf000;
634 
635 pub const NOTE_TRIGGER: u32 = 0x01000000;
636 pub const NOTE_FFNOP: u32 = 0x00000000;
637 pub const NOTE_FFAND: u32 = 0x40000000;
638 pub const NOTE_FFOR: u32 = 0x80000000;
639 pub const NOTE_FFCOPY: u32 = 0xc0000000;
640 pub const NOTE_FFCTRLMASK: u32 = 0xc0000000;
641 pub const NOTE_FFLAGSMASK: u32 = 0x00ffffff;
642 pub const NOTE_LOWAT: u32 = 0x00000001;
643 pub const NOTE_OOB: u32 = 0x00000002;
644 pub const NOTE_DELETE: u32 = 0x00000001;
645 pub const NOTE_WRITE: u32 = 0x00000002;
646 pub const NOTE_EXTEND: u32 = 0x00000004;
647 pub const NOTE_ATTRIB: u32 = 0x00000008;
648 pub const NOTE_LINK: u32 = 0x00000010;
649 pub const NOTE_RENAME: u32 = 0x00000020;
650 pub const NOTE_REVOKE: u32 = 0x00000040;
651 pub const NOTE_EXIT: u32 = 0x80000000;
652 pub const NOTE_FORK: u32 = 0x40000000;
653 pub const NOTE_EXEC: u32 = 0x20000000;
654 pub const NOTE_PDATAMASK: u32 = 0x000fffff;
655 pub const NOTE_PCTRLMASK: u32 = 0xf0000000;
656 pub const NOTE_TRACK: u32 = 0x00000001;
657 pub const NOTE_TRACKERR: u32 = 0x00000002;
658 pub const NOTE_CHILD: u32 = 0x00000004;
659 
660 pub const SO_SNDSPACE: ::c_int = 0x100a;
661 pub const SO_CPUHINT: ::c_int = 0x1030;
662 
663 pub const PT_FIRSTMACH: ::c_int = 32;
664 
665 // https://github.com/DragonFlyBSD/DragonFlyBSD/blob/master/sys/net/if.h#L101
666 pub const IFF_UP: ::c_int = 0x1; // interface is up
667 pub const IFF_BROADCAST: ::c_int = 0x2; // broadcast address valid
668 pub const IFF_DEBUG: ::c_int = 0x4; // turn on debugging
669 pub const IFF_LOOPBACK: ::c_int = 0x8; // is a loopback net
670 pub const IFF_POINTOPOINT: ::c_int = 0x10; // interface is point-to-point link
671 pub const IFF_SMART: ::c_int = 0x20; // interface manages own routes
672 pub const IFF_RUNNING: ::c_int = 0x40; // resources allocated
673 pub const IFF_NOARP: ::c_int = 0x80; // no address resolution protocol
674 pub const IFF_PROMISC: ::c_int = 0x100; // receive all packets
675 pub const IFF_ALLMULTI: ::c_int = 0x200; // receive all multicast packets
676 pub const IFF_OACTIVE_COMPAT: ::c_int = 0x400; // was transmission in progress
677 pub const IFF_SIMPLEX: ::c_int = 0x800; // can't hear own transmissions
678 pub const IFF_LINK0: ::c_int = 0x1000; // per link layer defined bit
679 pub const IFF_LINK1: ::c_int = 0x2000; // per link layer defined bit
680 pub const IFF_LINK2: ::c_int = 0x4000; // per link layer defined bit
681 pub const IFF_ALTPHYS: ::c_int = IFF_LINK2; // use alternate physical connection
682 pub const IFF_MULTICAST: ::c_int = 0x8000; // supports multicast
683                                            // was interface is in polling mode
684 pub const IFF_POLLING_COMPAT: ::c_int = 0x10000;
685 pub const IFF_PPROMISC: ::c_int = 0x20000; // user-requested promisc mode
686 pub const IFF_MONITOR: ::c_int = 0x40000; // user-requested monitor mode
687 pub const IFF_STATICARP: ::c_int = 0x80000; // static ARP
688 pub const IFF_NPOLLING: ::c_int = 0x100000; // interface is in polling mode
689 pub const IFF_IDIRECT: ::c_int = 0x200000; // direct input
690 
691 //
692 // sys/netinet/in.h
693 // Protocols (RFC 1700)
694 // NOTE: These are in addition to the constants defined in src/unix/mod.rs
695 
696 // IPPROTO_IP defined in src/unix/mod.rs
697 /// IP6 hop-by-hop options
698 pub const IPPROTO_HOPOPTS: ::c_int = 0;
699 // IPPROTO_ICMP defined in src/unix/mod.rs
700 /// group mgmt protocol
701 pub const IPPROTO_IGMP: ::c_int = 2;
702 /// gateway^2 (deprecated)
703 pub const IPPROTO_GGP: ::c_int = 3;
704 /// for compatibility
705 pub const IPPROTO_IPIP: ::c_int = 4;
706 // IPPROTO_TCP defined in src/unix/mod.rs
707 /// Stream protocol II.
708 pub const IPPROTO_ST: ::c_int = 7;
709 /// exterior gateway protocol
710 pub const IPPROTO_EGP: ::c_int = 8;
711 /// private interior gateway
712 pub const IPPROTO_PIGP: ::c_int = 9;
713 /// BBN RCC Monitoring
714 pub const IPPROTO_RCCMON: ::c_int = 10;
715 /// network voice protocol
716 pub const IPPROTO_NVPII: ::c_int = 11;
717 /// pup
718 pub const IPPROTO_PUP: ::c_int = 12;
719 /// Argus
720 pub const IPPROTO_ARGUS: ::c_int = 13;
721 /// EMCON
722 pub const IPPROTO_EMCON: ::c_int = 14;
723 /// Cross Net Debugger
724 pub const IPPROTO_XNET: ::c_int = 15;
725 /// Chaos
726 pub const IPPROTO_CHAOS: ::c_int = 16;
727 // IPPROTO_UDP defined in src/unix/mod.rs
728 /// Multiplexing
729 pub const IPPROTO_MUX: ::c_int = 18;
730 /// DCN Measurement Subsystems
731 pub const IPPROTO_MEAS: ::c_int = 19;
732 /// Host Monitoring
733 pub const IPPROTO_HMP: ::c_int = 20;
734 /// Packet Radio Measurement
735 pub const IPPROTO_PRM: ::c_int = 21;
736 /// xns idp
737 pub const IPPROTO_IDP: ::c_int = 22;
738 /// Trunk-1
739 pub const IPPROTO_TRUNK1: ::c_int = 23;
740 /// Trunk-2
741 pub const IPPROTO_TRUNK2: ::c_int = 24;
742 /// Leaf-1
743 pub const IPPROTO_LEAF1: ::c_int = 25;
744 /// Leaf-2
745 pub const IPPROTO_LEAF2: ::c_int = 26;
746 /// Reliable Data
747 pub const IPPROTO_RDP: ::c_int = 27;
748 /// Reliable Transaction
749 pub const IPPROTO_IRTP: ::c_int = 28;
750 /// tp-4 w/ class negotiation
751 pub const IPPROTO_TP: ::c_int = 29;
752 /// Bulk Data Transfer
753 pub const IPPROTO_BLT: ::c_int = 30;
754 /// Network Services
755 pub const IPPROTO_NSP: ::c_int = 31;
756 /// Merit Internodal
757 pub const IPPROTO_INP: ::c_int = 32;
758 /// Sequential Exchange
759 pub const IPPROTO_SEP: ::c_int = 33;
760 /// Third Party Connect
761 pub const IPPROTO_3PC: ::c_int = 34;
762 /// InterDomain Policy Routing
763 pub const IPPROTO_IDPR: ::c_int = 35;
764 /// XTP
765 pub const IPPROTO_XTP: ::c_int = 36;
766 /// Datagram Delivery
767 pub const IPPROTO_DDP: ::c_int = 37;
768 /// Control Message Transport
769 pub const IPPROTO_CMTP: ::c_int = 38;
770 /// TP++ Transport
771 pub const IPPROTO_TPXX: ::c_int = 39;
772 /// IL transport protocol
773 pub const IPPROTO_IL: ::c_int = 40;
774 // IPPROTO_IPV6 defined in src/unix/mod.rs
775 /// Source Demand Routing
776 pub const IPPROTO_SDRP: ::c_int = 42;
777 /// IP6 routing header
778 pub const IPPROTO_ROUTING: ::c_int = 43;
779 /// IP6 fragmentation header
780 pub const IPPROTO_FRAGMENT: ::c_int = 44;
781 /// InterDomain Routing
782 pub const IPPROTO_IDRP: ::c_int = 45;
783 /// resource reservation
784 pub const IPPROTO_RSVP: ::c_int = 46;
785 /// General Routing Encap.
786 pub const IPPROTO_GRE: ::c_int = 47;
787 /// Mobile Host Routing
788 pub const IPPROTO_MHRP: ::c_int = 48;
789 /// BHA
790 pub const IPPROTO_BHA: ::c_int = 49;
791 /// IP6 Encap Sec. Payload
792 pub const IPPROTO_ESP: ::c_int = 50;
793 /// IP6 Auth Header
794 pub const IPPROTO_AH: ::c_int = 51;
795 /// Integ. Net Layer Security
796 pub const IPPROTO_INLSP: ::c_int = 52;
797 /// IP with encryption
798 pub const IPPROTO_SWIPE: ::c_int = 53;
799 /// Next Hop Resolution
800 pub const IPPROTO_NHRP: ::c_int = 54;
801 /// IP Mobility
802 pub const IPPROTO_MOBILE: ::c_int = 55;
803 /// Transport Layer Security
804 pub const IPPROTO_TLSP: ::c_int = 56;
805 /// SKIP
806 pub const IPPROTO_SKIP: ::c_int = 57;
807 // IPPROTO_ICMPV6 defined in src/unix/mod.rs
808 /// IP6 no next header
809 pub const IPPROTO_NONE: ::c_int = 59;
810 /// IP6 destination option
811 pub const IPPROTO_DSTOPTS: ::c_int = 60;
812 /// any host internal protocol
813 pub const IPPROTO_AHIP: ::c_int = 61;
814 /// CFTP
815 pub const IPPROTO_CFTP: ::c_int = 62;
816 /// "hello" routing protocol
817 pub const IPPROTO_HELLO: ::c_int = 63;
818 /// SATNET/Backroom EXPAK
819 pub const IPPROTO_SATEXPAK: ::c_int = 64;
820 /// Kryptolan
821 pub const IPPROTO_KRYPTOLAN: ::c_int = 65;
822 /// Remote Virtual Disk
823 pub const IPPROTO_RVD: ::c_int = 66;
824 /// Pluribus Packet Core
825 pub const IPPROTO_IPPC: ::c_int = 67;
826 /// Any distributed FS
827 pub const IPPROTO_ADFS: ::c_int = 68;
828 /// Satnet Monitoring
829 pub const IPPROTO_SATMON: ::c_int = 69;
830 /// VISA Protocol
831 pub const IPPROTO_VISA: ::c_int = 70;
832 /// Packet Core Utility
833 pub const IPPROTO_IPCV: ::c_int = 71;
834 /// Comp. Prot. Net. Executive
835 pub const IPPROTO_CPNX: ::c_int = 72;
836 /// Comp. Prot. HeartBeat
837 pub const IPPROTO_CPHB: ::c_int = 73;
838 /// Wang Span Network
839 pub const IPPROTO_WSN: ::c_int = 74;
840 /// Packet Video Protocol
841 pub const IPPROTO_PVP: ::c_int = 75;
842 /// BackRoom SATNET Monitoring
843 pub const IPPROTO_BRSATMON: ::c_int = 76;
844 /// Sun net disk proto (temp.)
845 pub const IPPROTO_ND: ::c_int = 77;
846 /// WIDEBAND Monitoring
847 pub const IPPROTO_WBMON: ::c_int = 78;
848 /// WIDEBAND EXPAK
849 pub const IPPROTO_WBEXPAK: ::c_int = 79;
850 /// ISO cnlp
851 pub const IPPROTO_EON: ::c_int = 80;
852 /// VMTP
853 pub const IPPROTO_VMTP: ::c_int = 81;
854 /// Secure VMTP
855 pub const IPPROTO_SVMTP: ::c_int = 82;
856 /// Banyon VINES
857 pub const IPPROTO_VINES: ::c_int = 83;
858 /// TTP
859 pub const IPPROTO_TTP: ::c_int = 84;
860 /// NSFNET-IGP
861 pub const IPPROTO_IGP: ::c_int = 85;
862 /// dissimilar gateway prot.
863 pub const IPPROTO_DGP: ::c_int = 86;
864 /// TCF
865 pub const IPPROTO_TCF: ::c_int = 87;
866 /// Cisco/GXS IGRP
867 pub const IPPROTO_IGRP: ::c_int = 88;
868 /// OSPFIGP
869 pub const IPPROTO_OSPFIGP: ::c_int = 89;
870 /// Strite RPC protocol
871 pub const IPPROTO_SRPC: ::c_int = 90;
872 /// Locus Address Resoloution
873 pub const IPPROTO_LARP: ::c_int = 91;
874 /// Multicast Transport
875 pub const IPPROTO_MTP: ::c_int = 92;
876 /// AX.25 Frames
877 pub const IPPROTO_AX25: ::c_int = 93;
878 /// IP encapsulated in IP
879 pub const IPPROTO_IPEIP: ::c_int = 94;
880 /// Mobile Int.ing control
881 pub const IPPROTO_MICP: ::c_int = 95;
882 /// Semaphore Comm. security
883 pub const IPPROTO_SCCSP: ::c_int = 96;
884 /// Ethernet IP encapsulation
885 pub const IPPROTO_ETHERIP: ::c_int = 97;
886 /// encapsulation header
887 pub const IPPROTO_ENCAP: ::c_int = 98;
888 /// any private encr. scheme
889 pub const IPPROTO_APES: ::c_int = 99;
890 /// GMTP
891 pub const IPPROTO_GMTP: ::c_int = 100;
892 /// payload compression (IPComp)
893 pub const IPPROTO_IPCOMP: ::c_int = 108;
894 
895 /* 101-254: Partly Unassigned */
896 /// Protocol Independent Mcast
897 pub const IPPROTO_PIM: ::c_int = 103;
898 /// CARP
899 pub const IPPROTO_CARP: ::c_int = 112;
900 /// PGM
901 pub const IPPROTO_PGM: ::c_int = 113;
902 /// PFSYNC
903 pub const IPPROTO_PFSYNC: ::c_int = 240;
904 
905 /* 255: Reserved */
906 /* BSD Private, local use, namespace incursion, no longer used */
907 /// divert pseudo-protocol
908 pub const IPPROTO_DIVERT: ::c_int = 254;
909 pub const IPPROTO_MAX: ::c_int = 256;
910 /// last return value of *_input(), meaning "all job for this pkt is done".
911 pub const IPPROTO_DONE: ::c_int = 257;
912 
913 /// Used by RSS: the layer3 protocol is unknown
914 pub const IPPROTO_UNKNOWN: ::c_int = 258;
915 
916 // sys/netinet/tcp.h
917 pub const TCP_SIGNATURE_ENABLE: ::c_int = 16;
918 pub const TCP_KEEPINIT: ::c_int = 32;
919 pub const TCP_FASTKEEP: ::c_int = 128;
920 
921 pub const AF_BLUETOOTH: ::c_int = 33;
922 pub const AF_MPLS: ::c_int = 34;
923 pub const AF_IEEE80211: ::c_int = 35;
924 
925 pub const PF_BLUETOOTH: ::c_int = AF_BLUETOOTH;
926 
927 pub const NET_RT_DUMP: ::c_int = 1;
928 pub const NET_RT_FLAGS: ::c_int = 2;
929 pub const NET_RT_IFLIST: ::c_int = 3;
930 pub const NET_RT_MAXID: ::c_int = 4;
931 
932 pub const SOMAXOPT_SIZE: ::c_int = 65536;
933 
934 pub const MSG_UNUSED09: ::c_int = 0x00000200;
935 pub const MSG_NOSIGNAL: ::c_int = 0x00000400;
936 pub const MSG_SYNC: ::c_int = 0x00000800;
937 pub const MSG_CMSG_CLOEXEC: ::c_int = 0x00001000;
938 pub const MSG_FBLOCKING: ::c_int = 0x00010000;
939 pub const MSG_FNONBLOCKING: ::c_int = 0x00020000;
940 pub const MSG_FMASK: ::c_int = 0xFFFF0000;
941 
942 // utmpx entry types
943 pub const EMPTY: ::c_short = 0;
944 pub const RUN_LVL: ::c_short = 1;
945 pub const BOOT_TIME: ::c_short = 2;
946 pub const OLD_TIME: ::c_short = 3;
947 pub const NEW_TIME: ::c_short = 4;
948 pub const INIT_PROCESS: ::c_short = 5;
949 pub const LOGIN_PROCESS: ::c_short = 6;
950 pub const USER_PROCESS: ::c_short = 7;
951 pub const DEAD_PROCESS: ::c_short = 8;
952 pub const ACCOUNTING: ::c_short = 9;
953 pub const SIGNATURE: ::c_short = 10;
954 pub const DOWNTIME: ::c_short = 11;
955 // utmpx database types
956 pub const UTX_DB_UTMPX: ::c_uint = 0;
957 pub const UTX_DB_WTMPX: ::c_uint = 1;
958 pub const UTX_DB_LASTLOG: ::c_uint = 2;
959 
960 pub const LC_COLLATE_MASK: ::c_int = 1 << 0;
961 pub const LC_CTYPE_MASK: ::c_int = 1 << 1;
962 pub const LC_MONETARY_MASK: ::c_int = 1 << 2;
963 pub const LC_NUMERIC_MASK: ::c_int = 1 << 3;
964 pub const LC_TIME_MASK: ::c_int = 1 << 4;
965 pub const LC_MESSAGES_MASK: ::c_int = 1 << 5;
966 pub const LC_ALL_MASK: ::c_int = LC_COLLATE_MASK
967     | LC_CTYPE_MASK
968     | LC_MESSAGES_MASK
969     | LC_MONETARY_MASK
970     | LC_NUMERIC_MASK
971     | LC_TIME_MASK;
972 
973 pub const TIOCSIG: ::c_uint = 0x2000745f;
974 pub const BTUARTDISC: ::c_int = 0x7;
975 pub const TIOCDCDTIMESTAMP: ::c_uint = 0x40107458;
976 pub const TIOCISPTMASTER: ::c_uint = 0x20007455;
977 pub const TIOCMODG: ::c_uint = 0x40047403;
978 pub const TIOCMODS: ::c_ulong = 0x80047404;
979 pub const TIOCREMOTE: ::c_ulong = 0x80047469;
980 
981 // Constants used by "at" family of system calls.
982 pub const AT_FDCWD: ::c_int = 0xFFFAFDCD; // invalid file descriptor
983 pub const AT_SYMLINK_NOFOLLOW: ::c_int = 1;
984 pub const AT_REMOVEDIR: ::c_int = 2;
985 pub const AT_EACCESS: ::c_int = 4;
986 pub const AT_SYMLINK_FOLLOW: ::c_int = 8;
987 
988 pub const VCHECKPT: usize = 19;
989 
990 pub const _PC_2_SYMLINKS: ::c_int = 22;
991 pub const _PC_TIMESTAMP_RESOLUTION: ::c_int = 23;
992 
993 pub const _SC_V7_ILP32_OFF32: ::c_int = 122;
994 pub const _SC_V7_ILP32_OFFBIG: ::c_int = 123;
995 pub const _SC_V7_LP64_OFF64: ::c_int = 124;
996 pub const _SC_V7_LPBIG_OFFBIG: ::c_int = 125;
997 pub const _SC_THREAD_ROBUST_PRIO_INHERIT: ::c_int = 126;
998 pub const _SC_THREAD_ROBUST_PRIO_PROTECT: ::c_int = 127;
999 
1000 pub const WCONTINUED: ::c_int = 0x4;
1001 pub const WSTOPPED: ::c_int = 0x2;
1002 pub const WNOWAIT: ::c_int = 0x8;
1003 pub const WEXITED: ::c_int = 0x10;
1004 pub const WTRAPPED: ::c_int = 0x20;
1005 
1006 // Similar to FreeBSD, only the standardized ones are exposed.
1007 // There are more.
1008 pub const P_PID: idtype_t = 0;
1009 pub const P_PGID: idtype_t = 2;
1010 pub const P_ALL: idtype_t = 7;
1011 
1012 // Values for struct rtprio (type_ field)
1013 pub const RTP_PRIO_REALTIME: ::c_ushort = 0;
1014 pub const RTP_PRIO_NORMAL: ::c_ushort = 1;
1015 pub const RTP_PRIO_IDLE: ::c_ushort = 2;
1016 pub const RTP_PRIO_THREAD: ::c_ushort = 3;
1017 
1018 // Flags for chflags(2)
1019 pub const UF_NOHISTORY: ::c_ulong = 0x00000040;
1020 pub const UF_CACHE: ::c_ulong = 0x00000080;
1021 pub const UF_XLINK: ::c_ulong = 0x00000100;
1022 pub const SF_NOHISTORY: ::c_ulong = 0x00400000;
1023 pub const SF_CACHE: ::c_ulong = 0x00800000;
1024 pub const SF_XLINK: ::c_ulong = 0x01000000;
1025 
1026 // timespec constants
1027 pub const UTIME_OMIT: c_long = -2;
1028 pub const UTIME_NOW: c_long = -1;
1029 
1030 const_fn! {
1031     {const} fn _CMSG_ALIGN(n: usize) -> usize {
1032         (n + 3) & !3
1033     }
1034 }
1035 
1036 f! {
1037     pub fn CMSG_DATA(cmsg: *const ::cmsghdr) -> *mut ::c_uchar {
1038         (cmsg as *mut ::c_uchar)
1039             .offset(_CMSG_ALIGN(::mem::size_of::<::cmsghdr>()) as isize)
1040     }
1041 
1042     pub fn CMSG_LEN(length: ::c_uint) -> ::c_uint {
1043         (_CMSG_ALIGN(::mem::size_of::<::cmsghdr>()) + length as usize)
1044             as ::c_uint
1045     }
1046 
1047     pub fn CMSG_NXTHDR(mhdr: *const ::msghdr, cmsg: *const ::cmsghdr)
1048         -> *mut ::cmsghdr
1049     {
1050         let next = cmsg as usize + _CMSG_ALIGN((*cmsg).cmsg_len as usize)
1051             + _CMSG_ALIGN(::mem::size_of::<::cmsghdr>());
1052         let max = (*mhdr).msg_control as usize
1053             + (*mhdr).msg_controllen as usize;
1054         if next <= max {
1055             (cmsg as usize + _CMSG_ALIGN((*cmsg).cmsg_len as usize))
1056                 as *mut ::cmsghdr
1057         } else {
1058             0 as *mut ::cmsghdr
1059         }
1060     }
1061 
1062     pub {const} fn CMSG_SPACE(length: ::c_uint) -> ::c_uint {
1063         (_CMSG_ALIGN(::mem::size_of::<::cmsghdr>()) +
1064             _CMSG_ALIGN(length as usize)) as ::c_uint
1065     }
1066 
1067     pub fn CPU_ZERO(cpuset: &mut cpu_set_t) -> () {
1068         for slot in cpuset.ary.iter_mut() {
1069             *slot = 0;
1070         }
1071     }
1072 
1073     pub fn CPU_SET(cpu: usize, cpuset: &mut cpu_set_t) -> () {
1074         let (idx, offset) = ((cpu >> 6) & 3, cpu & 63);
1075         cpuset.ary[idx] |= 1 << offset;
1076         ()
1077     }
1078 
1079     pub fn CPU_CLR(cpu: usize, cpuset: &mut cpu_set_t) -> () {
1080         let (idx, offset) = ((cpu >> 6) & 3, cpu & 63);
1081         cpuset.ary[idx] &= !(1 << offset);
1082         ()
1083     }
1084 
1085     pub fn CPU_ISSET(cpu: usize, cpuset: &mut cpu_set_t) -> bool {
1086         let (idx, offset) = ((cpu >> 6) & 3, cpu & 63);
1087         0 != cpuset.ary[idx] & (1 << offset)
1088     }
1089 }
1090 
1091 safe_f! {
1092     pub {const} fn WIFSIGNALED(status: ::c_int) -> bool {
1093         (status & 0o177) != 0o177 && (status & 0o177) != 0
1094     }
1095 }
1096 
1097 extern "C" {
__errno_location() -> *mut ::c_int1098     pub fn __errno_location() -> *mut ::c_int;
setgrent()1099     pub fn setgrent();
mprotect(addr: *mut ::c_void, len: ::size_t, prot: ::c_int) -> ::c_int1100     pub fn mprotect(addr: *mut ::c_void, len: ::size_t, prot: ::c_int) -> ::c_int;
1101 
setutxdb(_type: ::c_uint, file: *mut ::c_char) -> ::c_int1102     pub fn setutxdb(_type: ::c_uint, file: *mut ::c_char) -> ::c_int;
1103 
aio_waitcomplete(iocbp: *mut *mut aiocb, timeout: *mut ::timespec) -> ::c_int1104     pub fn aio_waitcomplete(iocbp: *mut *mut aiocb, timeout: *mut ::timespec) -> ::c_int;
1105 
waitid( idtype: idtype_t, id: ::id_t, infop: *mut ::siginfo_t, options: ::c_int, ) -> ::c_int1106     pub fn waitid(
1107         idtype: idtype_t,
1108         id: ::id_t,
1109         infop: *mut ::siginfo_t,
1110         options: ::c_int,
1111     ) -> ::c_int;
1112 
freelocale(loc: ::locale_t)1113     pub fn freelocale(loc: ::locale_t);
1114 
lwp_rtprio( function: ::c_int, pid: ::pid_t, lwpid: lwpid_t, rtp: *mut super::rtprio, ) -> ::c_int1115     pub fn lwp_rtprio(
1116         function: ::c_int,
1117         pid: ::pid_t,
1118         lwpid: lwpid_t,
1119         rtp: *mut super::rtprio,
1120     ) -> ::c_int;
1121 
statfs(path: *const ::c_char, buf: *mut statfs) -> ::c_int1122     pub fn statfs(path: *const ::c_char, buf: *mut statfs) -> ::c_int;
fstatfs(fd: ::c_int, buf: *mut statfs) -> ::c_int1123     pub fn fstatfs(fd: ::c_int, buf: *mut statfs) -> ::c_int;
uname(buf: *mut ::utsname) -> ::c_int1124     pub fn uname(buf: *mut ::utsname) -> ::c_int;
memmem( haystack: *const ::c_void, haystacklen: ::size_t, needle: *const ::c_void, needlelen: ::size_t, ) -> *mut ::c_void1125     pub fn memmem(
1126         haystack: *const ::c_void,
1127         haystacklen: ::size_t,
1128         needle: *const ::c_void,
1129         needlelen: ::size_t,
1130     ) -> *mut ::c_void;
sched_getaffinity(pid: ::pid_t, cpusetsize: ::size_t, mask: *mut cpu_set_t) -> ::c_int1131     pub fn sched_getaffinity(pid: ::pid_t, cpusetsize: ::size_t, mask: *mut cpu_set_t) -> ::c_int;
sched_setaffinity(pid: ::pid_t, cpusetsize: ::size_t, mask: *const cpu_set_t) -> ::c_int1132     pub fn sched_setaffinity(pid: ::pid_t, cpusetsize: ::size_t, mask: *const cpu_set_t)
1133         -> ::c_int;
1134 }
1135 
1136 #[link(name = "rt")]
1137 extern "C" {
aio_cancel(fd: ::c_int, aiocbp: *mut aiocb) -> ::c_int1138     pub fn aio_cancel(fd: ::c_int, aiocbp: *mut aiocb) -> ::c_int;
aio_error(aiocbp: *const aiocb) -> ::c_int1139     pub fn aio_error(aiocbp: *const aiocb) -> ::c_int;
aio_fsync(op: ::c_int, aiocbp: *mut aiocb) -> ::c_int1140     pub fn aio_fsync(op: ::c_int, aiocbp: *mut aiocb) -> ::c_int;
aio_read(aiocbp: *mut aiocb) -> ::c_int1141     pub fn aio_read(aiocbp: *mut aiocb) -> ::c_int;
aio_return(aiocbp: *mut aiocb) -> ::ssize_t1142     pub fn aio_return(aiocbp: *mut aiocb) -> ::ssize_t;
aio_suspend( aiocb_list: *const *const aiocb, nitems: ::c_int, timeout: *const ::timespec, ) -> ::c_int1143     pub fn aio_suspend(
1144         aiocb_list: *const *const aiocb,
1145         nitems: ::c_int,
1146         timeout: *const ::timespec,
1147     ) -> ::c_int;
aio_write(aiocbp: *mut aiocb) -> ::c_int1148     pub fn aio_write(aiocbp: *mut aiocb) -> ::c_int;
lio_listio( mode: ::c_int, aiocb_list: *const *mut aiocb, nitems: ::c_int, sevp: *mut sigevent, ) -> ::c_int1149     pub fn lio_listio(
1150         mode: ::c_int,
1151         aiocb_list: *const *mut aiocb,
1152         nitems: ::c_int,
1153         sevp: *mut sigevent,
1154     ) -> ::c_int;
1155 }
1156 
1157 cfg_if! {
1158     if #[cfg(libc_thread_local)] {
1159         mod errno;
1160         pub use self::errno::*;
1161     }
1162 }
1163