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