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