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