1 pub type clock_t = ::c_uint;
2 pub type suseconds_t = ::c_int;
3 pub type dev_t = u64;
4 pub type blksize_t = i32;
5 pub type fsblkcnt_t = u64;
6 pub type fsfilcnt_t = u64;
7 pub type idtype_t = ::c_int;
8 pub type mqd_t = ::c_int;
9 type __pthread_spin_t = __cpu_simple_lock_nv_t;
10 pub type vm_size_t = ::uintptr_t;
11 pub type lwpid_t = ::c_uint;
12 pub type shmatt_t = ::c_uint;
13
14 impl siginfo_t {
si_value(&self) -> ::sigval15 pub unsafe fn si_value(&self) -> ::sigval {
16 #[repr(C)]
17 struct siginfo_timer {
18 _si_signo: ::c_int,
19 _si_errno: ::c_int,
20 _si_code: ::c_int,
21 __pad1: ::c_int,
22 _pid: ::pid_t,
23 _uid: ::uid_t,
24 value: ::sigval,
25 }
26 (*(self as *const siginfo_t as *const siginfo_timer)).value
27 }
28 }
29
30 s! {
31 pub struct aiocb {
32 pub aio_offset: ::off_t,
33 pub aio_buf: *mut ::c_void,
34 pub aio_nbytes: ::size_t,
35 pub aio_fildes: ::c_int,
36 pub aio_lio_opcode: ::c_int,
37 pub aio_reqprio: ::c_int,
38 pub aio_sigevent: ::sigevent,
39 _state: ::c_int,
40 _errno: ::c_int,
41 _retval: ::ssize_t
42 }
43
44 pub struct glob_t {
45 pub gl_pathc: ::size_t,
46 pub gl_matchc: ::size_t,
47 pub gl_offs: ::size_t,
48 pub gl_flags: ::c_int,
49 pub gl_pathv: *mut *mut ::c_char,
50
51 __unused3: *mut ::c_void,
52
53 __unused4: *mut ::c_void,
54 __unused5: *mut ::c_void,
55 __unused6: *mut ::c_void,
56 __unused7: *mut ::c_void,
57 __unused8: *mut ::c_void,
58 }
59
60 pub struct mq_attr {
61 pub mq_flags: ::c_long,
62 pub mq_maxmsg: ::c_long,
63 pub mq_msgsize: ::c_long,
64 pub mq_curmsgs: ::c_long,
65 }
66
67 pub struct sigset_t {
68 __bits: [u32; 4],
69 }
70
71 pub struct stat {
72 pub st_dev: ::dev_t,
73 pub st_mode: ::mode_t,
74 pub st_ino: ::ino_t,
75 pub st_nlink: ::nlink_t,
76 pub st_uid: ::uid_t,
77 pub st_gid: ::gid_t,
78 pub st_rdev: ::dev_t,
79 pub st_atime: ::time_t,
80 pub st_atimensec: ::c_long,
81 pub st_mtime: ::time_t,
82 pub st_mtimensec: ::c_long,
83 pub st_ctime: ::time_t,
84 pub st_ctimensec: ::c_long,
85 pub st_birthtime: ::time_t,
86 pub st_birthtimensec: ::c_long,
87 pub st_size: ::off_t,
88 pub st_blocks: ::blkcnt_t,
89 pub st_blksize: ::blksize_t,
90 pub st_flags: u32,
91 pub st_gen: u32,
92 pub st_spare: [u32; 2],
93 }
94
95 pub struct addrinfo {
96 pub ai_flags: ::c_int,
97 pub ai_family: ::c_int,
98 pub ai_socktype: ::c_int,
99 pub ai_protocol: ::c_int,
100 pub ai_addrlen: ::socklen_t,
101 pub ai_canonname: *mut ::c_char,
102 pub ai_addr: *mut ::sockaddr,
103 pub ai_next: *mut ::addrinfo,
104 }
105
106 pub struct siginfo_t {
107 pub si_signo: ::c_int,
108 pub si_code: ::c_int,
109 pub si_errno: ::c_int,
110 __pad1: ::c_int,
111 pub si_addr: *mut ::c_void,
112 __pad2: [u64; 13],
113 }
114
115 pub struct pthread_attr_t {
116 pta_magic: ::c_uint,
117 pta_flags: ::c_int,
118 pta_private: *mut ::c_void,
119 }
120
121 pub struct pthread_mutex_t {
122 ptm_magic: ::c_uint,
123 ptm_errorcheck: __pthread_spin_t,
124 #[cfg(any(target_arch = "sparc", target_arch = "sparc64",
125 target_arch = "x86", target_arch = "x86_64"))]
126 ptm_pad1: [u8; 3],
127 // actually a union with a non-unused, 0-initialized field
128 ptm_unused: __pthread_spin_t,
129 #[cfg(any(target_arch = "sparc", target_arch = "sparc64",
130 target_arch = "x86", target_arch = "x86_64"))]
131 ptm_pad2: [u8; 3],
132 ptm_owner: ::pthread_t,
133 ptm_waiters: *mut u8,
134 ptm_recursed: ::c_uint,
135 ptm_spare2: *mut ::c_void,
136 }
137
138 pub struct pthread_mutexattr_t {
139 ptma_magic: ::c_uint,
140 ptma_private: *mut ::c_void,
141 }
142
143 pub struct pthread_rwlockattr_t {
144 ptra_magic: ::c_uint,
145 ptra_private: *mut ::c_void,
146 }
147
148 pub struct pthread_cond_t {
149 ptc_magic: ::c_uint,
150 ptc_lock: __pthread_spin_t,
151 ptc_waiters_first: *mut u8,
152 ptc_waiters_last: *mut u8,
153 ptc_mutex: *mut ::pthread_mutex_t,
154 ptc_private: *mut ::c_void,
155 }
156
157 pub struct pthread_condattr_t {
158 ptca_magic: ::c_uint,
159 ptca_private: *mut ::c_void,
160 }
161
162 pub struct pthread_rwlock_t {
163 ptr_magic: ::c_uint,
164 ptr_interlock: __pthread_spin_t,
165 ptr_rblocked_first: *mut u8,
166 ptr_rblocked_last: *mut u8,
167 ptr_wblocked_first: *mut u8,
168 ptr_wblocked_last: *mut u8,
169 ptr_nreaders: ::c_uint,
170 ptr_owner: ::pthread_t,
171 ptr_private: *mut ::c_void,
172 }
173
174 pub struct kevent {
175 pub ident: ::uintptr_t,
176 pub filter: u32,
177 pub flags: u32,
178 pub fflags: u32,
179 pub data: i64,
180 pub udata: ::intptr_t,
181 }
182
183 pub struct dqblk {
184 pub dqb_bhardlimit: u32,
185 pub dqb_bsoftlimit: u32,
186 pub dqb_curblocks: u32,
187 pub dqb_ihardlimit: u32,
188 pub dqb_isoftlimit: u32,
189 pub dqb_curinodes: u32,
190 pub dqb_btime: i32,
191 pub dqb_itime: i32,
192 }
193
194 pub struct Dl_info {
195 pub dli_fname: *const ::c_char,
196 pub dli_fbase: *mut ::c_void,
197 pub dli_sname: *const ::c_char,
198 pub dli_saddr: *const ::c_void,
199 }
200
201 pub struct lconv {
202 pub decimal_point: *mut ::c_char,
203 pub thousands_sep: *mut ::c_char,
204 pub grouping: *mut ::c_char,
205 pub int_curr_symbol: *mut ::c_char,
206 pub currency_symbol: *mut ::c_char,
207 pub mon_decimal_point: *mut ::c_char,
208 pub mon_thousands_sep: *mut ::c_char,
209 pub mon_grouping: *mut ::c_char,
210 pub positive_sign: *mut ::c_char,
211 pub negative_sign: *mut ::c_char,
212 pub int_frac_digits: ::c_char,
213 pub frac_digits: ::c_char,
214 pub p_cs_precedes: ::c_char,
215 pub p_sep_by_space: ::c_char,
216 pub n_cs_precedes: ::c_char,
217 pub n_sep_by_space: ::c_char,
218 pub p_sign_posn: ::c_char,
219 pub n_sign_posn: ::c_char,
220 pub int_p_cs_precedes: ::c_char,
221 pub int_n_cs_precedes: ::c_char,
222 pub int_p_sep_by_space: ::c_char,
223 pub int_n_sep_by_space: ::c_char,
224 pub int_p_sign_posn: ::c_char,
225 pub int_n_sign_posn: ::c_char,
226 }
227
228 pub struct if_data {
229 pub ifi_type: ::c_uchar,
230 pub ifi_addrlen: ::c_uchar,
231 pub ifi_hdrlen: ::c_uchar,
232 pub ifi_link_state: ::c_int,
233 pub ifi_mtu: u64,
234 pub ifi_metric: u64,
235 pub ifi_baudrate: u64,
236 pub ifi_ipackets: u64,
237 pub ifi_ierrors: u64,
238 pub ifi_opackets: u64,
239 pub ifi_oerrors: u64,
240 pub ifi_collisions: u64,
241 pub ifi_ibytes: u64,
242 pub ifi_obytes: u64,
243 pub ifi_imcasts: u64,
244 pub ifi_omcasts: u64,
245 pub ifi_iqdrops: u64,
246 pub ifi_noproto: u64,
247 pub ifi_lastchange: ::timespec,
248 }
249
250 pub struct if_msghdr {
251 pub ifm_msglen: ::c_ushort,
252 pub ifm_version: ::c_uchar,
253 pub ifm_type: ::c_uchar,
254 pub ifm_addrs: ::c_int,
255 pub ifm_flags: ::c_int,
256 pub ifm_index: ::c_ushort,
257 pub ifm_data: if_data,
258 }
259
260 pub struct sockcred {
261 pub sc_pid: ::pid_t,
262 pub sc_uid: ::uid_t,
263 pub sc_euid: ::uid_t,
264 pub sc_gid: ::gid_t,
265 pub sc_egid: ::gid_t,
266 pub sc_ngroups: ::c_int,
267 pub sc_groups: [::gid_t; 1],
268 }
269
270 pub struct sockaddr_dl {
271 pub sdl_len: ::c_uchar,
272 pub sdl_family: ::c_uchar,
273 pub sdl_index: ::c_ushort,
274 pub sdl_type: u8,
275 pub sdl_nlen: u8,
276 pub sdl_alen: u8,
277 pub sdl_slen: u8,
278 pub sdl_data: [::c_char; 12],
279 }
280
281 pub struct mmsghdr {
282 pub msg_hdr: ::msghdr,
283 pub msg_len: ::c_uint,
284 }
285
286 pub struct __exit_status {
287 pub e_termination: u16,
288 pub e_exit: u16,
289 }
290
291 pub struct shmid_ds {
292 pub shm_perm: ::ipc_perm,
293 pub shm_segsz: ::size_t,
294 pub shm_lpid: ::pid_t,
295 pub shm_cpid: ::pid_t,
296 pub shm_nattch: ::shmatt_t,
297 pub shm_atime: ::time_t,
298 pub shm_dtime: ::time_t,
299 pub shm_ctime: ::time_t,
300 _shm_internal: *mut ::c_void,
301 }
302
303 pub struct utmp {
304 pub ut_line: [::c_char; UT_LINESIZE],
305 pub ut_name: [::c_char; UT_NAMESIZE],
306 pub ut_host: [::c_char; UT_HOSTSIZE],
307 pub ut_time: ::time_t
308 }
309
310 pub struct lastlog {
311 pub ll_line: [::c_char; UT_LINESIZE],
312 pub ll_host: [::c_char; UT_HOSTSIZE],
313 pub ll_time: ::time_t
314 }
315
316 pub struct timex {
317 pub modes: ::c_uint,
318 pub offset: ::c_long,
319 pub freq: ::c_long,
320 pub maxerror: ::c_long,
321 pub esterror: ::c_long,
322 pub status: ::c_int,
323 pub constant: ::c_long,
324 pub precision: ::c_long,
325 pub tolerance: ::c_long,
326 pub ppsfreq: ::c_long,
327 pub jitter: ::c_long,
328 pub shift: ::c_int,
329 pub stabil: ::c_long,
330 pub jitcnt: ::c_long,
331 pub calcnt: ::c_long,
332 pub errcnt: ::c_long,
333 pub stbcnt: ::c_long,
334 }
335
336 pub struct ntptimeval {
337 pub time: ::timespec,
338 pub maxerror: ::c_long,
339 pub esterror: ::c_long,
340 pub tai: ::c_long,
341 pub time_state: ::c_int,
342 }
343
344 }
345
346 s_no_extra_traits! {
347
348 pub struct utmpx {
349 pub ut_name: [::c_char; _UTX_USERSIZE],
350 pub ut_id: [::c_char; _UTX_IDSIZE],
351 pub ut_line: [::c_char; _UTX_LINESIZE],
352 pub ut_host: [::c_char; _UTX_HOSTSIZE],
353 pub ut_session: u16,
354 pub ut_type: u16,
355 pub ut_pid: ::pid_t,
356 pub ut_exit: __exit_status,
357 pub ut_ss: sockaddr_storage,
358 pub ut_tv: ::timeval,
359 pub ut_pad: [u8; _UTX_PADSIZE],
360 }
361
362 pub struct lastlogx {
363 pub ll_tv: ::timeval,
364 pub ll_line: [::c_char; _UTX_LINESIZE],
365 pub ll_host: [::c_char; _UTX_HOSTSIZE],
366 pub ll_ss: sockaddr_storage,
367 }
368
369 pub struct in_pktinfo {
370 pub ipi_addr: ::in_addr,
371 pub ipi_ifindex: ::c_uint,
372 }
373
374 #[repr(packed)]
375 pub struct arphdr {
376 pub ar_hrd: u16,
377 pub ar_pro: u16,
378 pub ar_hln: u8,
379 pub ar_pln: u8,
380 pub ar_op: u16,
381 }
382
383 #[repr(packed)]
384 pub struct in_addr {
385 pub s_addr: ::in_addr_t,
386 }
387
388 pub struct ip_mreq {
389 pub imr_multiaddr: in_addr,
390 pub imr_interface: in_addr,
391 }
392
393 pub struct sockaddr_in {
394 pub sin_len: u8,
395 pub sin_family: ::sa_family_t,
396 pub sin_port: ::in_port_t,
397 pub sin_addr: ::in_addr,
398 pub sin_zero: [i8; 8],
399 }
400
401 pub struct dirent {
402 pub d_fileno: ::ino_t,
403 pub d_reclen: u16,
404 pub d_namlen: u16,
405 pub d_type: u8,
406 pub d_name: [::c_char; 512],
407 }
408
409 pub struct statvfs {
410 pub f_flag: ::c_ulong,
411 pub f_bsize: ::c_ulong,
412 pub f_frsize: ::c_ulong,
413 pub f_iosize: ::c_ulong,
414
415 pub f_blocks: ::fsblkcnt_t,
416 pub f_bfree: ::fsblkcnt_t,
417 pub f_bavail: ::fsblkcnt_t,
418 pub f_bresvd: ::fsblkcnt_t,
419
420 pub f_files: ::fsfilcnt_t,
421 pub f_ffree: ::fsfilcnt_t,
422 pub f_favail: ::fsfilcnt_t,
423 pub f_fresvd: ::fsfilcnt_t,
424
425 pub f_syncreads: u64,
426 pub f_syncwrites: u64,
427
428 pub f_asyncreads: u64,
429 pub f_asyncwrites: u64,
430
431 pub f_fsidx: ::fsid_t,
432 pub f_fsid: ::c_ulong,
433 pub f_namemax: ::c_ulong,
434 pub f_owner: ::uid_t,
435
436 pub f_spare: [u32; 4],
437
438 pub f_fstypename: [::c_char; 32],
439 pub f_mntonname: [::c_char; 1024],
440 pub f_mntfromname: [::c_char; 1024],
441 }
442
443 pub struct sockaddr_storage {
444 pub ss_len: u8,
445 pub ss_family: ::sa_family_t,
446 __ss_pad1: [u8; 6],
447 __ss_pad2: i64,
448 __ss_pad3: [u8; 112],
449 }
450
451 pub struct sigevent {
452 pub sigev_notify: ::c_int,
453 pub sigev_signo: ::c_int,
454 pub sigev_value: ::sigval,
455 __unused1: *mut ::c_void, //actually a function pointer
456 pub sigev_notify_attributes: *mut ::c_void
457 }
458 }
459
460 cfg_if! {
461 if #[cfg(feature = "extra_traits")] {
462 impl PartialEq for utmpx {
463 fn eq(&self, other: &utmpx) -> bool {
464 self.ut_type == other.ut_type
465 && self.ut_pid == other.ut_pid
466 && self.ut_name == other.ut_name
467 && self.ut_line == other.ut_line
468 && self.ut_id == other.ut_id
469 && self.ut_exit == other.ut_exit
470 && self.ut_session == other.ut_session
471 && self.ut_tv == other.ut_tv
472 && self.ut_ss == other.ut_ss
473 && self
474 .ut_pad
475 .iter()
476 .zip(other.ut_pad.iter())
477 .all(|(a,b)| a == b)
478 && self
479 .ut_host
480 .iter()
481 .zip(other.ut_host.iter())
482 .all(|(a,b)| a == b)
483 }
484 }
485
486 impl Eq for utmpx {}
487
488 impl ::fmt::Debug for utmpx {
489 fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
490 f.debug_struct("utmpx")
491 .field("ut_name", &self.ut_name)
492 .field("ut_id", &self.ut_id)
493 .field("ut_line", &self.ut_line)
494 // FIXME .field("ut_host", &self.ut_host)
495 .field("ut_session", &self.ut_session)
496 .field("ut_type", &self.ut_type)
497 .field("ut_pid", &self.ut_pid)
498 .field("ut_exit", &self.ut_exit)
499 .field("ut_ss", &self.ut_ss)
500 .field("ut_tv", &self.ut_tv)
501 // FIXME .field("ut_pad", &self.ut_pad)
502 .finish()
503 }
504 }
505
506 impl ::hash::Hash for utmpx {
507 fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
508 self.ut_name.hash(state);
509 self.ut_type.hash(state);
510 self.ut_pid.hash(state);
511 self.ut_line.hash(state);
512 self.ut_id.hash(state);
513 self.ut_host.hash(state);
514 self.ut_exit.hash(state);
515 self.ut_session.hash(state);
516 self.ut_tv.hash(state);
517 self.ut_ss.hash(state);
518 self.ut_pad.hash(state);
519 }
520 }
521
522 impl PartialEq for lastlogx {
523 fn eq(&self, other: &lastlogx) -> bool {
524 self.ll_tv == other.ll_tv
525 && self.ll_line == other.ll_line
526 && self.ll_ss == other.ll_ss
527 && self
528 .ll_host
529 .iter()
530 .zip(other.ll_host.iter())
531 .all(|(a,b)| a == b)
532 }
533 }
534
535 impl Eq for lastlogx {}
536
537 impl ::fmt::Debug for lastlogx {
538 fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
539 f.debug_struct("lastlogx")
540 .field("ll_tv", &self.ll_tv)
541 .field("ll_line", &self.ll_line)
542 // FIXME.field("ll_host", &self.ll_host)
543 .field("ll_ss", &self.ll_ss)
544 .finish()
545 }
546 }
547
548 impl ::hash::Hash for lastlogx {
549 fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
550 self.ll_tv.hash(state);
551 self.ll_line.hash(state);
552 self.ll_host.hash(state);
553 self.ll_ss.hash(state);
554 }
555 }
556
557 impl PartialEq for in_pktinfo {
558 fn eq(&self, other: &in_pktinfo) -> bool {
559 self.ipi_addr == other.ipi_addr
560 && self.ipi_ifindex == other.ipi_ifindex
561 }
562 }
563 impl Eq for in_pktinfo {}
564 impl ::fmt::Debug for in_pktinfo {
565 fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
566 f.debug_struct("in_pktinfo")
567 .field("ipi_addr", &self.ipi_addr)
568 .field("ipi_ifindex", &self.ipi_ifindex)
569 .finish()
570 }
571 }
572 impl ::hash::Hash for in_pktinfo {
573 fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
574 self.ipi_addr.hash(state);
575 self.ipi_ifindex.hash(state);
576 }
577 }
578
579 impl PartialEq for arphdr {
580 fn eq(&self, other: &arphdr) -> bool {
581 self.ar_hrd == other.ar_hrd
582 && self.ar_pro == other.ar_pro
583 && self.ar_hln == other.ar_hln
584 && self.ar_pln == other.ar_pln
585 && self.ar_op == other.ar_op
586 }
587 }
588 impl Eq for arphdr {}
589 impl ::fmt::Debug for arphdr {
590 fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
591 let ar_hrd = self.ar_hrd;
592 let ar_pro = self.ar_pro;
593 let ar_op = self.ar_op;
594 f.debug_struct("arphdr")
595 .field("ar_hrd", &ar_hrd)
596 .field("ar_pro", &ar_pro)
597 .field("ar_hln", &self.ar_hln)
598 .field("ar_pln", &self.ar_pln)
599 .field("ar_op", &ar_op)
600 .finish()
601 }
602 }
603 impl ::hash::Hash for arphdr {
604 fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
605 let ar_hrd = self.ar_hrd;
606 let ar_pro = self.ar_pro;
607 let ar_op = self.ar_op;
608 ar_hrd.hash(state);
609 ar_pro.hash(state);
610 self.ar_hln.hash(state);
611 self.ar_pln.hash(state);
612 ar_op.hash(state);
613 }
614 }
615
616 impl PartialEq for in_addr {
617 fn eq(&self, other: &in_addr) -> bool {
618 self.s_addr == other.s_addr
619 }
620 }
621 impl Eq for in_addr {}
622 impl ::fmt::Debug for in_addr {
623 fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
624 let s_addr = self.s_addr;
625 f.debug_struct("in_addr")
626 .field("s_addr", &s_addr)
627 .finish()
628 }
629 }
630 impl ::hash::Hash for in_addr {
631 fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
632 let s_addr = self.s_addr;
633 s_addr.hash(state);
634 }
635 }
636
637 impl PartialEq for ip_mreq {
638 fn eq(&self, other: &ip_mreq) -> bool {
639 self.imr_multiaddr == other.imr_multiaddr
640 && self.imr_interface == other.imr_interface
641 }
642 }
643 impl Eq for ip_mreq {}
644 impl ::fmt::Debug for ip_mreq {
645 fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
646 f.debug_struct("ip_mreq")
647 .field("imr_multiaddr", &self.imr_multiaddr)
648 .field("imr_interface", &self.imr_interface)
649 .finish()
650 }
651 }
652 impl ::hash::Hash for ip_mreq {
653 fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
654 self.imr_multiaddr.hash(state);
655 self.imr_interface.hash(state);
656 }
657 }
658
659 impl PartialEq for sockaddr_in {
660 fn eq(&self, other: &sockaddr_in) -> bool {
661 self.sin_len == other.sin_len
662 && self.sin_family == other.sin_family
663 && self.sin_port == other.sin_port
664 && self.sin_addr == other.sin_addr
665 && self.sin_zero == other.sin_zero
666 }
667 }
668 impl Eq for sockaddr_in {}
669 impl ::fmt::Debug for sockaddr_in {
670 fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
671 f.debug_struct("sockaddr_in")
672 .field("sin_len", &self.sin_len)
673 .field("sin_family", &self.sin_family)
674 .field("sin_port", &self.sin_port)
675 .field("sin_addr", &self.sin_addr)
676 .field("sin_zero", &self.sin_zero)
677 .finish()
678 }
679 }
680 impl ::hash::Hash for sockaddr_in {
681 fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
682 self.sin_len.hash(state);
683 self.sin_family.hash(state);
684 self.sin_port.hash(state);
685 self.sin_addr.hash(state);
686 self.sin_zero.hash(state);
687 }
688 }
689
690 impl PartialEq for dirent {
691 fn eq(&self, other: &dirent) -> bool {
692 self.d_fileno == other.d_fileno
693 && self.d_reclen == other.d_reclen
694 && self.d_namlen == other.d_namlen
695 && self.d_type == other.d_type
696 && self
697 .d_name
698 .iter()
699 .zip(other.d_name.iter())
700 .all(|(a,b)| a == b)
701 }
702 }
703 impl Eq for dirent {}
704 impl ::fmt::Debug for dirent {
705 fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
706 f.debug_struct("dirent")
707 .field("d_fileno", &self.d_fileno)
708 .field("d_reclen", &self.d_reclen)
709 .field("d_namlen", &self.d_namlen)
710 .field("d_type", &self.d_type)
711 // FIXME: .field("d_name", &self.d_name)
712 .finish()
713 }
714 }
715 impl ::hash::Hash for dirent {
716 fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
717 self.d_fileno.hash(state);
718 self.d_reclen.hash(state);
719 self.d_namlen.hash(state);
720 self.d_type.hash(state);
721 self.d_name.hash(state);
722 }
723 }
724
725 impl PartialEq for statvfs {
726 fn eq(&self, other: &statvfs) -> bool {
727 self.f_flag == other.f_flag
728 && self.f_bsize == other.f_bsize
729 && self.f_frsize == other.f_frsize
730 && self.f_iosize == other.f_iosize
731 && self.f_blocks == other.f_blocks
732 && self.f_bfree == other.f_bfree
733 && self.f_bavail == other.f_bavail
734 && self.f_bresvd == other.f_bresvd
735 && self.f_files == other.f_files
736 && self.f_ffree == other.f_ffree
737 && self.f_favail == other.f_favail
738 && self.f_fresvd == other.f_fresvd
739 && self.f_syncreads == other.f_syncreads
740 && self.f_syncwrites == other.f_syncwrites
741 && self.f_asyncreads == other.f_asyncreads
742 && self.f_asyncwrites == other.f_asyncwrites
743 && self.f_fsidx == other.f_fsidx
744 && self.f_fsid == other.f_fsid
745 && self.f_namemax == other.f_namemax
746 && self.f_owner == other.f_owner
747 && self.f_spare == other.f_spare
748 && self.f_fstypename == other.f_fstypename
749 && self
750 .f_mntonname
751 .iter()
752 .zip(other.f_mntonname.iter())
753 .all(|(a,b)| a == b)
754 && self
755 .f_mntfromname
756 .iter()
757 .zip(other.f_mntfromname.iter())
758 .all(|(a,b)| a == b)
759 }
760 }
761 impl Eq for statvfs {}
762 impl ::fmt::Debug for statvfs {
763 fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
764 f.debug_struct("statvfs")
765 .field("f_flag", &self.f_flag)
766 .field("f_bsize", &self.f_bsize)
767 .field("f_frsize", &self.f_frsize)
768 .field("f_iosize", &self.f_iosize)
769 .field("f_blocks", &self.f_blocks)
770 .field("f_bfree", &self.f_bfree)
771 .field("f_bavail", &self.f_bavail)
772 .field("f_bresvd", &self.f_bresvd)
773 .field("f_files", &self.f_files)
774 .field("f_ffree", &self.f_ffree)
775 .field("f_favail", &self.f_favail)
776 .field("f_fresvd", &self.f_fresvd)
777 .field("f_syncreads", &self.f_syncreads)
778 .field("f_syncwrites", &self.f_syncwrites)
779 .field("f_asyncreads", &self.f_asyncreads)
780 .field("f_asyncwrites", &self.f_asyncwrites)
781 .field("f_fsidx", &self.f_fsidx)
782 .field("f_fsid", &self.f_fsid)
783 .field("f_namemax", &self.f_namemax)
784 .field("f_owner", &self.f_owner)
785 .field("f_spare", &self.f_spare)
786 .field("f_fstypename", &self.f_fstypename)
787 // FIXME: .field("f_mntonname", &self.f_mntonname)
788 // FIXME: .field("f_mntfromname", &self.f_mntfromname)
789 .finish()
790 }
791 }
792 impl ::hash::Hash for statvfs {
793 fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
794 self.f_flag.hash(state);
795 self.f_bsize.hash(state);
796 self.f_frsize.hash(state);
797 self.f_iosize.hash(state);
798 self.f_blocks.hash(state);
799 self.f_bfree.hash(state);
800 self.f_bavail.hash(state);
801 self.f_bresvd.hash(state);
802 self.f_files.hash(state);
803 self.f_ffree.hash(state);
804 self.f_favail.hash(state);
805 self.f_fresvd.hash(state);
806 self.f_syncreads.hash(state);
807 self.f_syncwrites.hash(state);
808 self.f_asyncreads.hash(state);
809 self.f_asyncwrites.hash(state);
810 self.f_fsidx.hash(state);
811 self.f_fsid.hash(state);
812 self.f_namemax.hash(state);
813 self.f_owner.hash(state);
814 self.f_spare.hash(state);
815 self.f_fstypename.hash(state);
816 self.f_mntonname.hash(state);
817 self.f_mntfromname.hash(state);
818 }
819 }
820
821 impl PartialEq for sockaddr_storage {
822 fn eq(&self, other: &sockaddr_storage) -> bool {
823 self.ss_len == other.ss_len
824 && self.ss_family == other.ss_family
825 && self.__ss_pad1 == other.__ss_pad1
826 && self.__ss_pad2 == other.__ss_pad2
827 && self
828 .__ss_pad3
829 .iter()
830 .zip(other.__ss_pad3.iter())
831 .all(|(a,b)| a == b)
832 }
833 }
834 impl Eq for sockaddr_storage {}
835 impl ::fmt::Debug for sockaddr_storage {
836 fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
837 f.debug_struct("sockaddr_storage")
838 .field("ss_len", &self.ss_len)
839 .field("ss_family", &self.ss_family)
840 .field("__ss_pad1", &self.__ss_pad1)
841 .field("__ss_pad2", &self.__ss_pad2)
842 // FIXME: .field("__ss_pad3", &self.__ss_pad3)
843 .finish()
844 }
845 }
846 impl ::hash::Hash for sockaddr_storage {
847 fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
848 self.ss_len.hash(state);
849 self.ss_family.hash(state);
850 self.__ss_pad1.hash(state);
851 self.__ss_pad2.hash(state);
852 self.__ss_pad3.hash(state);
853 }
854 }
855
856 impl PartialEq for sigevent {
857 fn eq(&self, other: &sigevent) -> bool {
858 self.sigev_notify == other.sigev_notify
859 && self.sigev_signo == other.sigev_signo
860 && self.sigev_value == other.sigev_value
861 && self.sigev_notify_attributes
862 == other.sigev_notify_attributes
863 }
864 }
865 impl Eq for sigevent {}
866 impl ::fmt::Debug for sigevent {
867 fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
868 f.debug_struct("sigevent")
869 .field("sigev_notify", &self.sigev_notify)
870 .field("sigev_signo", &self.sigev_signo)
871 .field("sigev_value", &self.sigev_value)
872 .field("sigev_notify_attributes",
873 &self.sigev_notify_attributes)
874 .finish()
875 }
876 }
877 impl ::hash::Hash for sigevent {
878 fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
879 self.sigev_notify.hash(state);
880 self.sigev_signo.hash(state);
881 self.sigev_value.hash(state);
882 self.sigev_notify_attributes.hash(state);
883 }
884 }
885 }
886 }
887
888 pub const AT_FDCWD: ::c_int = -100;
889 pub const AT_EACCESS: ::c_int = 0x100;
890 pub const AT_SYMLINK_NOFOLLOW: ::c_int = 0x200;
891 pub const AT_SYMLINK_FOLLOW: ::c_int = 0x400;
892 pub const AT_REMOVEDIR: ::c_int = 0x800;
893
894 pub const EXTATTR_NAMESPACE_USER: ::c_int = 1;
895 pub const EXTATTR_NAMESPACE_SYSTEM: ::c_int = 2;
896
897 pub const LC_COLLATE_MASK: ::c_int = 1 << ::LC_COLLATE;
898 pub const LC_CTYPE_MASK: ::c_int = 1 << ::LC_CTYPE;
899 pub const LC_MONETARY_MASK: ::c_int = 1 << ::LC_MONETARY;
900 pub const LC_NUMERIC_MASK: ::c_int = 1 << ::LC_NUMERIC;
901 pub const LC_TIME_MASK: ::c_int = 1 << ::LC_TIME;
902 pub const LC_MESSAGES_MASK: ::c_int = 1 << ::LC_MESSAGES;
903 pub const LC_ALL_MASK: ::c_int = !0;
904
905 pub const ERA: ::nl_item = 52;
906 pub const ERA_D_FMT: ::nl_item = 53;
907 pub const ERA_D_T_FMT: ::nl_item = 54;
908 pub const ERA_T_FMT: ::nl_item = 55;
909 pub const ALT_DIGITS: ::nl_item = 56;
910
911 pub const O_CLOEXEC: ::c_int = 0x400000;
912 pub const O_ALT_IO: ::c_int = 0x40000;
913 pub const O_NOSIGPIPE: ::c_int = 0x1000000;
914 pub const O_SEARCH: ::c_int = 0x800000;
915 pub const O_DIRECTORY: ::c_int = 0x200000;
916 pub const O_DIRECT: ::c_int = 0x00080000;
917 pub const O_RSYNC: ::c_int = 0x00020000;
918
919 pub const MS_SYNC: ::c_int = 0x4;
920 pub const MS_INVALIDATE: ::c_int = 0x2;
921
922 #[deprecated(since = "0.2.64", note = "Not stable across OS versions")]
923 pub const RLIM_NLIMITS: ::c_int = 12;
924
925 pub const EIDRM: ::c_int = 82;
926 pub const ENOMSG: ::c_int = 83;
927 pub const EOVERFLOW: ::c_int = 84;
928 pub const EILSEQ: ::c_int = 85;
929 pub const ENOTSUP: ::c_int = 86;
930 pub const ECANCELED: ::c_int = 87;
931 pub const EBADMSG: ::c_int = 88;
932 pub const ENODATA: ::c_int = 89;
933 pub const ENOSR: ::c_int = 90;
934 pub const ENOSTR: ::c_int = 91;
935 pub const ETIME: ::c_int = 92;
936 pub const ENOATTR: ::c_int = 93;
937 pub const EMULTIHOP: ::c_int = 94;
938 pub const ENOLINK: ::c_int = 95;
939 pub const EPROTO: ::c_int = 96;
940 pub const ELAST: ::c_int = 96;
941
942 pub const F_DUPFD_CLOEXEC: ::c_int = 12;
943 pub const F_CLOSEM: ::c_int = 10;
944 pub const F_GETNOSIGPIPE: ::c_int = 13;
945 pub const F_SETNOSIGPIPE: ::c_int = 14;
946 pub const F_MAXFD: ::c_int = 11;
947
948 pub const IP_RECVDSTADDR: ::c_int = 7;
949 pub const IP_SENDSRCADDR: ::c_int = IP_RECVDSTADDR;
950 pub const IP_RECVIF: ::c_int = 20;
951 pub const IP_PKTINFO: ::c_int = 25;
952 pub const IP_RECVPKTINFO: ::c_int = 26;
953 pub const IPV6_JOIN_GROUP: ::c_int = 12;
954 pub const IPV6_LEAVE_GROUP: ::c_int = 13;
955
956 pub const TCP_KEEPIDLE: ::c_int = 3;
957 pub const TCP_KEEPINTVL: ::c_int = 5;
958 pub const TCP_KEEPCNT: ::c_int = 6;
959 pub const TCP_KEEPINIT: ::c_int = 7;
960 pub const TCP_INFO: ::c_int = 9;
961 pub const TCP_MD5SIG: ::c_int = 0x10;
962 pub const TCP_CONGCTL: ::c_int = 0x20;
963
964 pub const SOCK_CONN_DGRAM: ::c_int = 6;
965 pub const SOCK_DCCP: ::c_int = SOCK_CONN_DGRAM;
966 pub const SOCK_NOSIGPIPE: ::c_int = 0x40000000;
967 pub const SOCK_FLAGS_MASK: ::c_int = 0xf0000000;
968
969 pub const SO_SNDTIMEO: ::c_int = 0x100b;
970 pub const SO_RCVTIMEO: ::c_int = 0x100c;
971 pub const SO_ACCEPTFILTER: ::c_int = 0x1000;
972 pub const SO_TIMESTAMP: ::c_int = 0x2000;
973 pub const SO_OVERFLOWED: ::c_int = 0x1009;
974 pub const SO_NOHEADER: ::c_int = 0x100a;
975
976 // https://github.com/NetBSD/src/blob/trunk/sys/net/if.h#L373
977 pub const IFF_UP: ::c_int = 0x0001; // interface is up
978 pub const IFF_BROADCAST: ::c_int = 0x0002; // broadcast address valid
979 pub const IFF_DEBUG: ::c_int = 0x0004; // turn on debugging
980 pub const IFF_LOOPBACK: ::c_int = 0x0008; // is a loopback net
981 pub const IFF_POINTOPOINT: ::c_int = 0x0010; // interface is point-to-point link
982 pub const IFF_NOTRAILERS: ::c_int = 0x0020; // avoid use of trailers
983 pub const IFF_RUNNING: ::c_int = 0x0040; // resources allocated
984 pub const IFF_NOARP: ::c_int = 0x0080; // no address resolution protocol
985 pub const IFF_PROMISC: ::c_int = 0x0100; // receive all packets
986 pub const IFF_ALLMULTI: ::c_int = 0x0200; // receive all multicast packets
987 pub const IFF_OACTIVE: ::c_int = 0x0400; // transmission in progress
988 pub const IFF_SIMPLEX: ::c_int = 0x0800; // can't hear own transmissions
989 pub const IFF_LINK0: ::c_int = 0x1000; // per link layer defined bit
990 pub const IFF_LINK1: ::c_int = 0x2000; // per link layer defined bit
991 pub const IFF_LINK2: ::c_int = 0x4000; // per link layer defined bit
992 pub const IFF_MULTICAST: ::c_int = 0x8000; // supports multicast
993
994 // sys/netinet/in.h
995 // Protocols (RFC 1700)
996 // NOTE: These are in addition to the constants defined in src/unix/mod.rs
997
998 // IPPROTO_IP defined in src/unix/mod.rs
999 /// Hop-by-hop option header
1000 pub const IPPROTO_HOPOPTS: ::c_int = 0;
1001 // IPPROTO_ICMP defined in src/unix/mod.rs
1002 /// group mgmt protocol
1003 pub const IPPROTO_IGMP: ::c_int = 2;
1004 /// gateway^2 (deprecated)
1005 pub const IPPROTO_GGP: ::c_int = 3;
1006 /// for compatibility
1007 pub const IPPROTO_IPIP: ::c_int = 4;
1008 // IPPROTO_TCP defined in src/unix/mod.rs
1009 /// exterior gateway protocol
1010 pub const IPPROTO_EGP: ::c_int = 8;
1011 /// pup
1012 pub const IPPROTO_PUP: ::c_int = 12;
1013 // IPPROTO_UDP defined in src/unix/mod.rs
1014 /// xns idp
1015 pub const IPPROTO_IDP: ::c_int = 22;
1016 /// tp-4 w/ class negotiation
1017 pub const IPPROTO_TP: ::c_int = 29;
1018 /// DCCP
1019 pub const IPPROTO_DCCP: ::c_int = 33;
1020 // IPPROTO_IPV6 defined in src/unix/mod.rs
1021 /// IP6 routing header
1022 pub const IPPROTO_ROUTING: ::c_int = 43;
1023 /// IP6 fragmentation header
1024 pub const IPPROTO_FRAGMENT: ::c_int = 44;
1025 /// resource reservation
1026 pub const IPPROTO_RSVP: ::c_int = 46;
1027 /// General Routing Encap.
1028 pub const IPPROTO_GRE: ::c_int = 47;
1029 /// IP6 Encap Sec. Payload
1030 pub const IPPROTO_ESP: ::c_int = 50;
1031 /// IP6 Auth Header
1032 pub const IPPROTO_AH: ::c_int = 51;
1033 /// IP Mobility RFC 2004
1034 pub const IPPROTO_MOBILE: ::c_int = 55;
1035 /// IPv6 ICMP
1036 pub const IPPROTO_IPV6_ICMP: ::c_int = 58;
1037 // IPPROTO_ICMPV6 defined in src/unix/mod.rs
1038 /// IP6 no next header
1039 pub const IPPROTO_NONE: ::c_int = 59;
1040 /// IP6 destination option
1041 pub const IPPROTO_DSTOPTS: ::c_int = 60;
1042 /// ISO cnlp
1043 pub const IPPROTO_EON: ::c_int = 80;
1044 /// Ethernet-in-IP
1045 pub const IPPROTO_ETHERIP: ::c_int = 97;
1046 /// encapsulation header
1047 pub const IPPROTO_ENCAP: ::c_int = 98;
1048 /// Protocol indep. multicast
1049 pub const IPPROTO_PIM: ::c_int = 103;
1050 /// IP Payload Comp. Protocol
1051 pub const IPPROTO_IPCOMP: ::c_int = 108;
1052 /// VRRP RFC 2338
1053 pub const IPPROTO_VRRP: ::c_int = 112;
1054 /// Common Address Resolution Protocol
1055 pub const IPPROTO_CARP: ::c_int = 112;
1056 /// L2TPv3
1057 // TEMP: Disabled for now; this constant was added to NetBSD on 2017-02-16,
1058 // but isn't yet supported by the NetBSD rumprun kernel image used for
1059 // libc testing.
1060 //pub const IPPROTO_L2TP: ::c_int = 115;
1061 /// SCTP
1062 pub const IPPROTO_SCTP: ::c_int = 132;
1063 /// PFSYNC
1064 pub const IPPROTO_PFSYNC: ::c_int = 240;
1065 pub const IPPROTO_MAX: ::c_int = 256;
1066
1067 /// last return value of *_input(), meaning "all job for this pkt is done".
1068 pub const IPPROTO_DONE: ::c_int = 257;
1069
1070 /// sysctl placeholder for (FAST_)IPSEC
1071 pub const CTL_IPPROTO_IPSEC: ::c_int = 258;
1072
1073 pub const AF_OROUTE: ::c_int = 17;
1074 pub const AF_ARP: ::c_int = 28;
1075 pub const pseudo_AF_KEY: ::c_int = 29;
1076 pub const pseudo_AF_HDRCMPLT: ::c_int = 30;
1077 pub const AF_BLUETOOTH: ::c_int = 31;
1078 pub const AF_IEEE80211: ::c_int = 32;
1079 pub const AF_MPLS: ::c_int = 33;
1080 pub const AF_ROUTE: ::c_int = 34;
1081 pub const NET_RT_DUMP: ::c_int = 1;
1082 pub const NET_RT_FLAGS: ::c_int = 2;
1083 pub const NET_RT_OOOIFLIST: ::c_int = 3;
1084 pub const NET_RT_OOIFLIST: ::c_int = 4;
1085 pub const NET_RT_OIFLIST: ::c_int = 5;
1086 pub const NET_RT_IFLIST: ::c_int = 6;
1087 pub const NET_RT_MAXID: ::c_int = 7;
1088
1089 pub const PF_OROUTE: ::c_int = AF_OROUTE;
1090 pub const PF_ARP: ::c_int = AF_ARP;
1091 pub const PF_KEY: ::c_int = pseudo_AF_KEY;
1092 pub const PF_BLUETOOTH: ::c_int = AF_BLUETOOTH;
1093 pub const PF_MPLS: ::c_int = AF_MPLS;
1094 pub const PF_ROUTE: ::c_int = AF_ROUTE;
1095
1096 pub const MSG_NBIO: ::c_int = 0x1000;
1097 pub const MSG_WAITFORONE: ::c_int = 0x2000;
1098 pub const MSG_NOTIFICATION: ::c_int = 0x4000;
1099
1100 pub const SCM_TIMESTAMP: ::c_int = 0x08;
1101 pub const SCM_CREDS: ::c_int = 0x10;
1102
1103 pub const O_DSYNC: ::c_int = 0x10000;
1104
1105 pub const MAP_RENAME: ::c_int = 0x20;
1106 pub const MAP_NORESERVE: ::c_int = 0x40;
1107 pub const MAP_HASSEMAPHORE: ::c_int = 0x200;
1108 pub const MAP_WIRED: ::c_int = 0x800;
1109
1110 pub const DCCP_TYPE_REQUEST: ::c_int = 0;
1111 pub const DCCP_TYPE_RESPONSE: ::c_int = 1;
1112 pub const DCCP_TYPE_DATA: ::c_int = 2;
1113 pub const DCCP_TYPE_ACK: ::c_int = 3;
1114 pub const DCCP_TYPE_DATAACK: ::c_int = 4;
1115 pub const DCCP_TYPE_CLOSEREQ: ::c_int = 5;
1116 pub const DCCP_TYPE_CLOSE: ::c_int = 6;
1117 pub const DCCP_TYPE_RESET: ::c_int = 7;
1118 pub const DCCP_TYPE_MOVE: ::c_int = 8;
1119
1120 pub const DCCP_FEATURE_CC: ::c_int = 1;
1121 pub const DCCP_FEATURE_ECN: ::c_int = 2;
1122 pub const DCCP_FEATURE_ACKRATIO: ::c_int = 3;
1123 pub const DCCP_FEATURE_ACKVECTOR: ::c_int = 4;
1124 pub const DCCP_FEATURE_MOBILITY: ::c_int = 5;
1125 pub const DCCP_FEATURE_LOSSWINDOW: ::c_int = 6;
1126 pub const DCCP_FEATURE_CONN_NONCE: ::c_int = 8;
1127 pub const DCCP_FEATURE_IDENTREG: ::c_int = 7;
1128
1129 pub const DCCP_OPT_PADDING: ::c_int = 0;
1130 pub const DCCP_OPT_DATA_DISCARD: ::c_int = 1;
1131 pub const DCCP_OPT_SLOW_RECV: ::c_int = 2;
1132 pub const DCCP_OPT_BUF_CLOSED: ::c_int = 3;
1133 pub const DCCP_OPT_CHANGE_L: ::c_int = 32;
1134 pub const DCCP_OPT_CONFIRM_L: ::c_int = 33;
1135 pub const DCCP_OPT_CHANGE_R: ::c_int = 34;
1136 pub const DCCP_OPT_CONFIRM_R: ::c_int = 35;
1137 pub const DCCP_OPT_INIT_COOKIE: ::c_int = 36;
1138 pub const DCCP_OPT_NDP_COUNT: ::c_int = 37;
1139 pub const DCCP_OPT_ACK_VECTOR0: ::c_int = 38;
1140 pub const DCCP_OPT_ACK_VECTOR1: ::c_int = 39;
1141 pub const DCCP_OPT_RECV_BUF_DROPS: ::c_int = 40;
1142 pub const DCCP_OPT_TIMESTAMP: ::c_int = 41;
1143 pub const DCCP_OPT_TIMESTAMP_ECHO: ::c_int = 42;
1144 pub const DCCP_OPT_ELAPSEDTIME: ::c_int = 43;
1145 pub const DCCP_OPT_DATACHECKSUM: ::c_int = 44;
1146
1147 pub const DCCP_REASON_UNSPEC: ::c_int = 0;
1148 pub const DCCP_REASON_CLOSED: ::c_int = 1;
1149 pub const DCCP_REASON_INVALID: ::c_int = 2;
1150 pub const DCCP_REASON_OPTION_ERR: ::c_int = 3;
1151 pub const DCCP_REASON_FEA_ERR: ::c_int = 4;
1152 pub const DCCP_REASON_CONN_REF: ::c_int = 5;
1153 pub const DCCP_REASON_BAD_SNAME: ::c_int = 6;
1154 pub const DCCP_REASON_BAD_COOKIE: ::c_int = 7;
1155 pub const DCCP_REASON_INV_MOVE: ::c_int = 8;
1156 pub const DCCP_REASON_UNANSW_CH: ::c_int = 10;
1157 pub const DCCP_REASON_FRUITLESS_NEG: ::c_int = 11;
1158
1159 pub const DCCP_CCID: ::c_int = 1;
1160 pub const DCCP_CSLEN: ::c_int = 2;
1161 pub const DCCP_MAXSEG: ::c_int = 4;
1162 pub const DCCP_SERVICE: ::c_int = 8;
1163
1164 pub const DCCP_NDP_LIMIT: ::c_int = 16;
1165 pub const DCCP_SEQ_NUM_LIMIT: ::c_int = 16777216;
1166 pub const DCCP_MAX_OPTIONS: ::c_int = 32;
1167 pub const DCCP_MAX_PKTS: ::c_int = 100;
1168
1169 pub const _PC_LINK_MAX: ::c_int = 1;
1170 pub const _PC_MAX_CANON: ::c_int = 2;
1171 pub const _PC_MAX_INPUT: ::c_int = 3;
1172 pub const _PC_NAME_MAX: ::c_int = 4;
1173 pub const _PC_PATH_MAX: ::c_int = 5;
1174 pub const _PC_PIPE_BUF: ::c_int = 6;
1175 pub const _PC_CHOWN_RESTRICTED: ::c_int = 7;
1176 pub const _PC_NO_TRUNC: ::c_int = 8;
1177 pub const _PC_VDISABLE: ::c_int = 9;
1178 pub const _PC_SYNC_IO: ::c_int = 10;
1179 pub const _PC_FILESIZEBITS: ::c_int = 11;
1180 pub const _PC_SYMLINK_MAX: ::c_int = 12;
1181 pub const _PC_2_SYMLINKS: ::c_int = 13;
1182 pub const _PC_ACL_EXTENDED: ::c_int = 14;
1183 pub const _PC_MIN_HOLE_SIZE: ::c_int = 15;
1184
1185 pub const _SC_SYNCHRONIZED_IO: ::c_int = 31;
1186 pub const _SC_IOV_MAX: ::c_int = 32;
1187 pub const _SC_MAPPED_FILES: ::c_int = 33;
1188 pub const _SC_MEMLOCK: ::c_int = 34;
1189 pub const _SC_MEMLOCK_RANGE: ::c_int = 35;
1190 pub const _SC_MEMORY_PROTECTION: ::c_int = 36;
1191 pub const _SC_LOGIN_NAME_MAX: ::c_int = 37;
1192 pub const _SC_MONOTONIC_CLOCK: ::c_int = 38;
1193 pub const _SC_CLK_TCK: ::c_int = 39;
1194 pub const _SC_ATEXIT_MAX: ::c_int = 40;
1195 pub const _SC_THREADS: ::c_int = 41;
1196 pub const _SC_SEMAPHORES: ::c_int = 42;
1197 pub const _SC_BARRIERS: ::c_int = 43;
1198 pub const _SC_TIMERS: ::c_int = 44;
1199 pub const _SC_SPIN_LOCKS: ::c_int = 45;
1200 pub const _SC_READER_WRITER_LOCKS: ::c_int = 46;
1201 pub const _SC_GETGR_R_SIZE_MAX: ::c_int = 47;
1202 pub const _SC_GETPW_R_SIZE_MAX: ::c_int = 48;
1203 pub const _SC_CLOCK_SELECTION: ::c_int = 49;
1204 pub const _SC_ASYNCHRONOUS_IO: ::c_int = 50;
1205 pub const _SC_AIO_LISTIO_MAX: ::c_int = 51;
1206 pub const _SC_AIO_MAX: ::c_int = 52;
1207 pub const _SC_MESSAGE_PASSING: ::c_int = 53;
1208 pub const _SC_MQ_OPEN_MAX: ::c_int = 54;
1209 pub const _SC_MQ_PRIO_MAX: ::c_int = 55;
1210 pub const _SC_PRIORITY_SCHEDULING: ::c_int = 56;
1211 pub const _SC_THREAD_DESTRUCTOR_ITERATIONS: ::c_int = 57;
1212 pub const _SC_THREAD_KEYS_MAX: ::c_int = 58;
1213 pub const _SC_THREAD_STACK_MIN: ::c_int = 59;
1214 pub const _SC_THREAD_THREADS_MAX: ::c_int = 60;
1215 pub const _SC_THREAD_ATTR_STACKADDR: ::c_int = 61;
1216 pub const _SC_THREAD_ATTR_STACKSIZE: ::c_int = 62;
1217 pub const _SC_THREAD_PRIORITY_SCHEDULING: ::c_int = 63;
1218 pub const _SC_THREAD_PRIO_INHERIT: ::c_int = 64;
1219 pub const _SC_THREAD_PRIO_PROTECT: ::c_int = 65;
1220 pub const _SC_THREAD_PROCESS_SHARED: ::c_int = 66;
1221 pub const _SC_THREAD_SAFE_FUNCTIONS: ::c_int = 67;
1222 pub const _SC_TTY_NAME_MAX: ::c_int = 68;
1223 pub const _SC_HOST_NAME_MAX: ::c_int = 69;
1224 pub const _SC_PASS_MAX: ::c_int = 70;
1225 pub const _SC_REGEXP: ::c_int = 71;
1226 pub const _SC_SHELL: ::c_int = 72;
1227 pub const _SC_SYMLOOP_MAX: ::c_int = 73;
1228 pub const _SC_V6_ILP32_OFF32: ::c_int = 74;
1229 pub const _SC_V6_ILP32_OFFBIG: ::c_int = 75;
1230 pub const _SC_V6_LP64_OFF64: ::c_int = 76;
1231 pub const _SC_V6_LPBIG_OFFBIG: ::c_int = 77;
1232 pub const _SC_2_PBS: ::c_int = 80;
1233 pub const _SC_2_PBS_ACCOUNTING: ::c_int = 81;
1234 pub const _SC_2_PBS_CHECKPOINT: ::c_int = 82;
1235 pub const _SC_2_PBS_LOCATE: ::c_int = 83;
1236 pub const _SC_2_PBS_MESSAGE: ::c_int = 84;
1237 pub const _SC_2_PBS_TRACK: ::c_int = 85;
1238 pub const _SC_SPAWN: ::c_int = 86;
1239 pub const _SC_SHARED_MEMORY_OBJECTS: ::c_int = 87;
1240 pub const _SC_TIMER_MAX: ::c_int = 88;
1241 pub const _SC_SEM_NSEMS_MAX: ::c_int = 89;
1242 pub const _SC_CPUTIME: ::c_int = 90;
1243 pub const _SC_THREAD_CPUTIME: ::c_int = 91;
1244 pub const _SC_DELAYTIMER_MAX: ::c_int = 92;
1245 // These two variables will be supported in NetBSD 8.0
1246 // pub const _SC_SIGQUEUE_MAX : ::c_int = 93;
1247 // pub const _SC_REALTIME_SIGNALS : ::c_int = 94;
1248 pub const _SC_PHYS_PAGES: ::c_int = 121;
1249 pub const _SC_NPROCESSORS_CONF: ::c_int = 1001;
1250 pub const _SC_NPROCESSORS_ONLN: ::c_int = 1002;
1251 pub const _SC_SCHED_RT_TS: ::c_int = 2001;
1252 pub const _SC_SCHED_PRI_MIN: ::c_int = 2002;
1253 pub const _SC_SCHED_PRI_MAX: ::c_int = 2003;
1254
1255 pub const FD_SETSIZE: usize = 0x100;
1256
1257 pub const ST_NOSUID: ::c_ulong = 8;
1258
1259 pub const BIOCGRSIG: ::c_ulong = 0x40044272;
1260 pub const BIOCSRSIG: ::c_ulong = 0x80044273;
1261 pub const BIOCSDLT: ::c_ulong = 0x80044278;
1262 pub const BIOCGSEESENT: ::c_ulong = 0x40044276;
1263 pub const BIOCSSEESENT: ::c_ulong = 0x80044277;
1264
1265 //<sys/timex.h>
1266 pub const NTP_API: ::c_int = 4;
1267 pub const MAXPHASE: ::c_long = 500000000;
1268 pub const MAXFREQ: ::c_long = 500000;
1269 pub const MINSEC: ::c_int = 256;
1270 pub const MAXSEC: ::c_int = 2048;
1271 pub const NANOSECOND: ::c_long = 1000000000;
1272 pub const SCALE_PPM: ::c_int = 65;
1273 pub const MAXTC: ::c_int = 10;
1274 pub const MOD_OFFSET: ::c_uint = 0x0001;
1275 pub const MOD_FREQUENCY: ::c_uint = 0x0002;
1276 pub const MOD_MAXERROR: ::c_uint = 0x0004;
1277 pub const MOD_ESTERROR: ::c_uint = 0x0008;
1278 pub const MOD_STATUS: ::c_uint = 0x0010;
1279 pub const MOD_TIMECONST: ::c_uint = 0x0020;
1280 pub const MOD_PPSMAX: ::c_uint = 0x0040;
1281 pub const MOD_TAI: ::c_uint = 0x0080;
1282 pub const MOD_MICRO: ::c_uint = 0x1000;
1283 pub const MOD_NANO: ::c_uint = 0x2000;
1284 pub const MOD_CLKB: ::c_uint = 0x4000;
1285 pub const MOD_CLKA: ::c_uint = 0x8000;
1286 pub const STA_PLL: ::c_int = 0x0001;
1287 pub const STA_PPSFREQ: ::c_int = 0x0002;
1288 pub const STA_PPSTIME: ::c_int = 0x0004;
1289 pub const STA_FLL: ::c_int = 0x0008;
1290 pub const STA_INS: ::c_int = 0x0010;
1291 pub const STA_DEL: ::c_int = 0x0020;
1292 pub const STA_UNSYNC: ::c_int = 0x0040;
1293 pub const STA_FREQHOLD: ::c_int = 0x0080;
1294 pub const STA_PPSSIGNAL: ::c_int = 0x0100;
1295 pub const STA_PPSJITTER: ::c_int = 0x0200;
1296 pub const STA_PPSWANDER: ::c_int = 0x0400;
1297 pub const STA_PPSERROR: ::c_int = 0x0800;
1298 pub const STA_CLOCKERR: ::c_int = 0x1000;
1299 pub const STA_NANO: ::c_int = 0x2000;
1300 pub const STA_MODE: ::c_int = 0x4000;
1301 pub const STA_CLK: ::c_int = 0x8000;
1302 pub const STA_RONLY: ::c_int = STA_PPSSIGNAL
1303 | STA_PPSJITTER
1304 | STA_PPSWANDER
1305 | STA_PPSERROR
1306 | STA_CLOCKERR
1307 | STA_NANO
1308 | STA_MODE
1309 | STA_CLK;
1310 pub const TIME_OK: ::c_int = 0;
1311 pub const TIME_INS: ::c_int = 1;
1312 pub const TIME_DEL: ::c_int = 2;
1313 pub const TIME_OOP: ::c_int = 3;
1314 pub const TIME_WAIT: ::c_int = 4;
1315 pub const TIME_ERROR: ::c_int = 5;
1316
1317 cfg_if! {
1318 if #[cfg(any(target_arch = "sparc", target_arch = "sparc64",
1319 target_arch = "x86", target_arch = "x86_64"))] {
1320 pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t
1321 = pthread_mutex_t {
1322 ptm_magic: 0x33330003,
1323 ptm_errorcheck: 0,
1324 ptm_pad1: [0; 3],
1325 ptm_unused: 0,
1326 ptm_pad2: [0; 3],
1327 ptm_waiters: 0 as *mut _,
1328 ptm_owner: 0,
1329 ptm_recursed: 0,
1330 ptm_spare2: 0 as *mut _,
1331 };
1332 } else {
1333 pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t
1334 = pthread_mutex_t {
1335 ptm_magic: 0x33330003,
1336 ptm_errorcheck: 0,
1337 ptm_unused: 0,
1338 ptm_waiters: 0 as *mut _,
1339 ptm_owner: 0,
1340 ptm_recursed: 0,
1341 ptm_spare2: 0 as *mut _,
1342 };
1343 }
1344 }
1345
1346 pub const PTHREAD_COND_INITIALIZER: pthread_cond_t = pthread_cond_t {
1347 ptc_magic: 0x55550005,
1348 ptc_lock: 0,
1349 ptc_waiters_first: 0 as *mut _,
1350 ptc_waiters_last: 0 as *mut _,
1351 ptc_mutex: 0 as *mut _,
1352 ptc_private: 0 as *mut _,
1353 };
1354 pub const PTHREAD_RWLOCK_INITIALIZER: pthread_rwlock_t = pthread_rwlock_t {
1355 ptr_magic: 0x99990009,
1356 ptr_interlock: 0,
1357 ptr_rblocked_first: 0 as *mut _,
1358 ptr_rblocked_last: 0 as *mut _,
1359 ptr_wblocked_first: 0 as *mut _,
1360 ptr_wblocked_last: 0 as *mut _,
1361 ptr_nreaders: 0,
1362 ptr_owner: 0,
1363 ptr_private: 0 as *mut _,
1364 };
1365 pub const PTHREAD_MUTEX_NORMAL: ::c_int = 0;
1366 pub const PTHREAD_MUTEX_ERRORCHECK: ::c_int = 1;
1367 pub const PTHREAD_MUTEX_RECURSIVE: ::c_int = 2;
1368 pub const PTHREAD_MUTEX_DEFAULT: ::c_int = PTHREAD_MUTEX_NORMAL;
1369
1370 pub const EVFILT_AIO: u32 = 2;
1371 pub const EVFILT_PROC: u32 = 4;
1372 pub const EVFILT_READ: u32 = 0;
1373 pub const EVFILT_SIGNAL: u32 = 5;
1374 pub const EVFILT_TIMER: u32 = 6;
1375 pub const EVFILT_VNODE: u32 = 3;
1376 pub const EVFILT_WRITE: u32 = 1;
1377
1378 pub const EV_ADD: u32 = 0x1;
1379 pub const EV_DELETE: u32 = 0x2;
1380 pub const EV_ENABLE: u32 = 0x4;
1381 pub const EV_DISABLE: u32 = 0x8;
1382 pub const EV_ONESHOT: u32 = 0x10;
1383 pub const EV_CLEAR: u32 = 0x20;
1384 pub const EV_RECEIPT: u32 = 0x40;
1385 pub const EV_DISPATCH: u32 = 0x80;
1386 pub const EV_FLAG1: u32 = 0x2000;
1387 pub const EV_ERROR: u32 = 0x4000;
1388 pub const EV_EOF: u32 = 0x8000;
1389 pub const EV_SYSFLAGS: u32 = 0xf000;
1390
1391 pub const NOTE_LOWAT: u32 = 0x00000001;
1392 pub const NOTE_DELETE: u32 = 0x00000001;
1393 pub const NOTE_WRITE: u32 = 0x00000002;
1394 pub const NOTE_EXTEND: u32 = 0x00000004;
1395 pub const NOTE_ATTRIB: u32 = 0x00000008;
1396 pub const NOTE_LINK: u32 = 0x00000010;
1397 pub const NOTE_RENAME: u32 = 0x00000020;
1398 pub const NOTE_REVOKE: u32 = 0x00000040;
1399 pub const NOTE_EXIT: u32 = 0x80000000;
1400 pub const NOTE_FORK: u32 = 0x40000000;
1401 pub const NOTE_EXEC: u32 = 0x20000000;
1402 pub const NOTE_PDATAMASK: u32 = 0x000fffff;
1403 pub const NOTE_PCTRLMASK: u32 = 0xf0000000;
1404 pub const NOTE_TRACK: u32 = 0x00000001;
1405 pub const NOTE_TRACKERR: u32 = 0x00000002;
1406 pub const NOTE_CHILD: u32 = 0x00000004;
1407
1408 pub const TMP_MAX: ::c_uint = 308915776;
1409
1410 pub const NI_MAXHOST: ::socklen_t = 1025;
1411
1412 pub const RTLD_NOLOAD: ::c_int = 0x2000;
1413 pub const RTLD_LOCAL: ::c_int = 0x200;
1414
1415 pub const CTL_MAXNAME: ::c_int = 12;
1416 pub const SYSCTL_NAMELEN: ::c_int = 32;
1417 pub const SYSCTL_DEFSIZE: ::c_int = 8;
1418 pub const CTLTYPE_NODE: ::c_int = 1;
1419 pub const CTLTYPE_INT: ::c_int = 2;
1420 pub const CTLTYPE_STRING: ::c_int = 3;
1421 pub const CTLTYPE_QUAD: ::c_int = 4;
1422 pub const CTLTYPE_STRUCT: ::c_int = 5;
1423 pub const CTLTYPE_BOOL: ::c_int = 6;
1424 pub const CTLFLAG_READONLY: ::c_int = 0x00000000;
1425 pub const CTLFLAG_READWRITE: ::c_int = 0x00000070;
1426 pub const CTLFLAG_ANYWRITE: ::c_int = 0x00000080;
1427 pub const CTLFLAG_PRIVATE: ::c_int = 0x00000100;
1428 pub const CTLFLAG_PERMANENT: ::c_int = 0x00000200;
1429 pub const CTLFLAG_OWNDATA: ::c_int = 0x00000400;
1430 pub const CTLFLAG_IMMEDIATE: ::c_int = 0x00000800;
1431 pub const CTLFLAG_HEX: ::c_int = 0x00001000;
1432 pub const CTLFLAG_ROOT: ::c_int = 0x00002000;
1433 pub const CTLFLAG_ANYNUMBER: ::c_int = 0x00004000;
1434 pub const CTLFLAG_HIDDEN: ::c_int = 0x00008000;
1435 pub const CTLFLAG_ALIAS: ::c_int = 0x00010000;
1436 pub const CTLFLAG_MMAP: ::c_int = 0x00020000;
1437 pub const CTLFLAG_OWNDESC: ::c_int = 0x00040000;
1438 pub const CTLFLAG_UNSIGNED: ::c_int = 0x00080000;
1439 pub const SYSCTL_VERS_MASK: ::c_int = 0xff000000;
1440 pub const SYSCTL_VERS_0: ::c_int = 0x00000000;
1441 pub const SYSCTL_VERS_1: ::c_int = 0x01000000;
1442 pub const SYSCTL_VERSION: ::c_int = SYSCTL_VERS_1;
1443 pub const CTL_EOL: ::c_int = -1;
1444 pub const CTL_QUERY: ::c_int = -2;
1445 pub const CTL_CREATE: ::c_int = -3;
1446 pub const CTL_CREATESYM: ::c_int = -4;
1447 pub const CTL_DESTROY: ::c_int = -5;
1448 pub const CTL_MMAP: ::c_int = -6;
1449 pub const CTL_DESCRIBE: ::c_int = -7;
1450 pub const CTL_UNSPEC: ::c_int = 0;
1451 pub const CTL_KERN: ::c_int = 1;
1452 pub const CTL_VM: ::c_int = 2;
1453 pub const CTL_VFS: ::c_int = 3;
1454 pub const CTL_NET: ::c_int = 4;
1455 pub const CTL_DEBUG: ::c_int = 5;
1456 pub const CTL_HW: ::c_int = 6;
1457 pub const CTL_MACHDEP: ::c_int = 7;
1458 pub const CTL_USER: ::c_int = 8;
1459 pub const CTL_DDB: ::c_int = 9;
1460 pub const CTL_PROC: ::c_int = 10;
1461 pub const CTL_VENDOR: ::c_int = 11;
1462 pub const CTL_EMUL: ::c_int = 12;
1463 pub const CTL_SECURITY: ::c_int = 13;
1464 pub const CTL_MAXID: ::c_int = 14;
1465 pub const KERN_OSTYPE: ::c_int = 1;
1466 pub const KERN_OSRELEASE: ::c_int = 2;
1467 pub const KERN_OSREV: ::c_int = 3;
1468 pub const KERN_VERSION: ::c_int = 4;
1469 pub const KERN_MAXVNODES: ::c_int = 5;
1470 pub const KERN_MAXPROC: ::c_int = 6;
1471 pub const KERN_MAXFILES: ::c_int = 7;
1472 pub const KERN_ARGMAX: ::c_int = 8;
1473 pub const KERN_SECURELVL: ::c_int = 9;
1474 pub const KERN_HOSTNAME: ::c_int = 10;
1475 pub const KERN_HOSTID: ::c_int = 11;
1476 pub const KERN_CLOCKRATE: ::c_int = 12;
1477 pub const KERN_VNODE: ::c_int = 13;
1478 pub const KERN_PROC: ::c_int = 14;
1479 pub const KERN_FILE: ::c_int = 15;
1480 pub const KERN_PROF: ::c_int = 16;
1481 pub const KERN_POSIX1: ::c_int = 17;
1482 pub const KERN_NGROUPS: ::c_int = 18;
1483 pub const KERN_JOB_CONTROL: ::c_int = 19;
1484 pub const KERN_SAVED_IDS: ::c_int = 20;
1485 pub const KERN_OBOOTTIME: ::c_int = 21;
1486 pub const KERN_DOMAINNAME: ::c_int = 22;
1487 pub const KERN_MAXPARTITIONS: ::c_int = 23;
1488 pub const KERN_RAWPARTITION: ::c_int = 24;
1489 pub const KERN_NTPTIME: ::c_int = 25;
1490 pub const KERN_TIMEX: ::c_int = 26;
1491 pub const KERN_AUTONICETIME: ::c_int = 27;
1492 pub const KERN_AUTONICEVAL: ::c_int = 28;
1493 pub const KERN_RTC_OFFSET: ::c_int = 29;
1494 pub const KERN_ROOT_DEVICE: ::c_int = 30;
1495 pub const KERN_MSGBUFSIZE: ::c_int = 31;
1496 pub const KERN_FSYNC: ::c_int = 32;
1497 pub const KERN_OLDSYSVMSG: ::c_int = 33;
1498 pub const KERN_OLDSYSVSEM: ::c_int = 34;
1499 pub const KERN_OLDSYSVSHM: ::c_int = 35;
1500 pub const KERN_OLDSHORTCORENAME: ::c_int = 36;
1501 pub const KERN_SYNCHRONIZED_IO: ::c_int = 37;
1502 pub const KERN_IOV_MAX: ::c_int = 38;
1503 pub const KERN_MBUF: ::c_int = 39;
1504 pub const KERN_MAPPED_FILES: ::c_int = 40;
1505 pub const KERN_MEMLOCK: ::c_int = 41;
1506 pub const KERN_MEMLOCK_RANGE: ::c_int = 42;
1507 pub const KERN_MEMORY_PROTECTION: ::c_int = 43;
1508 pub const KERN_LOGIN_NAME_MAX: ::c_int = 44;
1509 pub const KERN_DEFCORENAME: ::c_int = 45;
1510 pub const KERN_LOGSIGEXIT: ::c_int = 46;
1511 pub const KERN_PROC2: ::c_int = 47;
1512 pub const KERN_PROC_ARGS: ::c_int = 48;
1513 pub const KERN_FSCALE: ::c_int = 49;
1514 pub const KERN_CCPU: ::c_int = 50;
1515 pub const KERN_CP_TIME: ::c_int = 51;
1516 pub const KERN_OLDSYSVIPC_INFO: ::c_int = 52;
1517 pub const KERN_MSGBUF: ::c_int = 53;
1518 pub const KERN_CONSDEV: ::c_int = 54;
1519 pub const KERN_MAXPTYS: ::c_int = 55;
1520 pub const KERN_PIPE: ::c_int = 56;
1521 pub const KERN_MAXPHYS: ::c_int = 57;
1522 pub const KERN_SBMAX: ::c_int = 58;
1523 pub const KERN_TKSTAT: ::c_int = 59;
1524 pub const KERN_MONOTONIC_CLOCK: ::c_int = 60;
1525 pub const KERN_URND: ::c_int = 61;
1526 pub const KERN_LABELSECTOR: ::c_int = 62;
1527 pub const KERN_LABELOFFSET: ::c_int = 63;
1528 pub const KERN_LWP: ::c_int = 64;
1529 pub const KERN_FORKFSLEEP: ::c_int = 65;
1530 pub const KERN_POSIX_THREADS: ::c_int = 66;
1531 pub const KERN_POSIX_SEMAPHORES: ::c_int = 67;
1532 pub const KERN_POSIX_BARRIERS: ::c_int = 68;
1533 pub const KERN_POSIX_TIMERS: ::c_int = 69;
1534 pub const KERN_POSIX_SPIN_LOCKS: ::c_int = 70;
1535 pub const KERN_POSIX_READER_WRITER_LOCKS: ::c_int = 71;
1536 pub const KERN_DUMP_ON_PANIC: ::c_int = 72;
1537 pub const KERN_SOMAXKVA: ::c_int = 73;
1538 pub const KERN_ROOT_PARTITION: ::c_int = 74;
1539 pub const KERN_DRIVERS: ::c_int = 75;
1540 pub const KERN_BUF: ::c_int = 76;
1541 pub const KERN_FILE2: ::c_int = 77;
1542 pub const KERN_VERIEXEC: ::c_int = 78;
1543 pub const KERN_CP_ID: ::c_int = 79;
1544 pub const KERN_HARDCLOCK_TICKS: ::c_int = 80;
1545 pub const KERN_ARND: ::c_int = 81;
1546 pub const KERN_SYSVIPC: ::c_int = 82;
1547 pub const KERN_BOOTTIME: ::c_int = 83;
1548 pub const KERN_EVCNT: ::c_int = 84;
1549 pub const KERN_MAXID: ::c_int = 85;
1550 pub const KERN_PROC_ALL: ::c_int = 0;
1551 pub const KERN_PROC_PID: ::c_int = 1;
1552 pub const KERN_PROC_PGRP: ::c_int = 2;
1553 pub const KERN_PROC_SESSION: ::c_int = 3;
1554 pub const KERN_PROC_TTY: ::c_int = 4;
1555 pub const KERN_PROC_UID: ::c_int = 5;
1556 pub const KERN_PROC_RUID: ::c_int = 6;
1557 pub const KERN_PROC_GID: ::c_int = 7;
1558 pub const KERN_PROC_RGID: ::c_int = 8;
1559 pub const KERN_PROC_ARGV: ::c_int = 1;
1560 pub const KERN_PROC_NARGV: ::c_int = 2;
1561 pub const KERN_PROC_ENV: ::c_int = 3;
1562 pub const KERN_PROC_NENV: ::c_int = 4;
1563 pub const KERN_PROC_PATHNAME: ::c_int = 5;
1564
1565 pub const EAI_AGAIN: ::c_int = 2;
1566 pub const EAI_BADFLAGS: ::c_int = 3;
1567 pub const EAI_FAIL: ::c_int = 4;
1568 pub const EAI_FAMILY: ::c_int = 5;
1569 pub const EAI_MEMORY: ::c_int = 6;
1570 pub const EAI_NODATA: ::c_int = 7;
1571 pub const EAI_NONAME: ::c_int = 8;
1572 pub const EAI_SERVICE: ::c_int = 9;
1573 pub const EAI_SOCKTYPE: ::c_int = 10;
1574 pub const EAI_SYSTEM: ::c_int = 11;
1575 pub const EAI_OVERFLOW: ::c_int = 14;
1576
1577 pub const AIO_CANCELED: ::c_int = 1;
1578 pub const AIO_NOTCANCELED: ::c_int = 2;
1579 pub const AIO_ALLDONE: ::c_int = 3;
1580 pub const LIO_NOP: ::c_int = 0;
1581 pub const LIO_WRITE: ::c_int = 1;
1582 pub const LIO_READ: ::c_int = 2;
1583 pub const LIO_WAIT: ::c_int = 1;
1584 pub const LIO_NOWAIT: ::c_int = 0;
1585
1586 pub const SIGEV_NONE: ::c_int = 0;
1587 pub const SIGEV_SIGNAL: ::c_int = 1;
1588 pub const SIGEV_THREAD: ::c_int = 2;
1589
1590 pub const WSTOPPED: ::c_int = 0x00000002; // same as WUNTRACED
1591 pub const WCONTINUED: ::c_int = 0x00000010;
1592 pub const WEXITED: ::c_int = 0x000000020;
1593 pub const WNOWAIT: ::c_int = 0x00010000;
1594
1595 pub const P_ALL: idtype_t = 0;
1596 pub const P_PID: idtype_t = 1;
1597 pub const P_PGID: idtype_t = 4;
1598
1599 pub const UTIME_OMIT: c_long = 1073741822;
1600 pub const UTIME_NOW: c_long = 1073741823;
1601
1602 pub const B460800: ::speed_t = 460800;
1603 pub const B921600: ::speed_t = 921600;
1604
1605 pub const ONOCR: ::tcflag_t = 0x20;
1606 pub const ONLRET: ::tcflag_t = 0x40;
1607 pub const CDTRCTS: ::tcflag_t = 0x00020000;
1608 pub const CHWFLOW: ::tcflag_t = ::MDMBUF | ::CRTSCTS | ::CDTRCTS;
1609
1610 // pub const _PATH_UTMPX: &[::c_char; 14] = b"/var/run/utmpx";
1611 // pub const _PATH_WTMPX: &[::c_char; 14] = b"/var/log/wtmpx";
1612 // pub const _PATH_LASTLOGX: &[::c_char; 17] = b"/var/log/lastlogx";
1613 // pub const _PATH_UTMP_UPDATE: &[::c_char; 24] = b"/usr/libexec/utmp_update";
1614 pub const UT_NAMESIZE: usize = 8;
1615 pub const UT_LINESIZE: usize = 8;
1616 pub const UT_HOSTSIZE: usize = 16;
1617 pub const _UTX_USERSIZE: usize = 32;
1618 pub const _UTX_LINESIZE: usize = 32;
1619 pub const _UTX_PADSIZE: usize = 40;
1620 pub const _UTX_IDSIZE: usize = 4;
1621 pub const _UTX_HOSTSIZE: usize = 256;
1622 pub const EMPTY: u16 = 0;
1623 pub const RUN_LVL: u16 = 1;
1624 pub const BOOT_TIME: u16 = 2;
1625 pub const OLD_TIME: u16 = 3;
1626 pub const NEW_TIME: u16 = 4;
1627 pub const INIT_PROCESS: u16 = 5;
1628 pub const LOGIN_PROCESS: u16 = 6;
1629 pub const USER_PROCESS: u16 = 7;
1630 pub const DEAD_PROCESS: u16 = 8;
1631 pub const ACCOUNTING: u16 = 9;
1632 pub const SIGNATURE: u16 = 10;
1633 pub const DOWN_TIME: u16 = 11;
1634
1635 pub const SOCK_CLOEXEC: ::c_int = 0x10000000;
1636 pub const SOCK_NONBLOCK: ::c_int = 0x20000000;
1637
1638 // Uncomment on next NetBSD release
1639 // pub const FIOSEEKDATA: ::c_ulong = 0xc0086661;
1640 // pub const FIOSEEKHOLE: ::c_ulong = 0xc0086662;
1641 pub const OFIOGETBMAP: ::c_ulong = 0xc004667a;
1642 pub const FIOGETBMAP: ::c_ulong = 0xc008667a;
1643 pub const FIONWRITE: ::c_ulong = 0x40046679;
1644 pub const FIONSPACE: ::c_ulong = 0x40046678;
1645 pub const FIBMAP: ::c_ulong = 0xc008667a;
1646
1647 pub const SIGSTKSZ: ::size_t = 40960;
1648
1649 pub const REG_ENOSYS: ::c_int = 17;
1650
1651 pub const PT_DUMPCORE: ::c_int = 12;
1652 pub const PT_LWPINFO: ::c_int = 13;
1653 pub const PT_SYSCALL: ::c_int = 14;
1654 pub const PT_SYSCALLEMU: ::c_int = 15;
1655 pub const PT_SET_EVENT_MASK: ::c_int = 16;
1656 pub const PT_GET_EVENT_MASK: ::c_int = 17;
1657 pub const PT_GET_PROCESS_STATE: ::c_int = 18;
1658 pub const PT_FIRSTMACH: ::c_int = 32;
1659
1660 // Flags for chflags(2)
1661 pub const SF_SNAPSHOT: ::c_ulong = 0x00200000;
1662 pub const SF_LOG: ::c_ulong = 0x00400000;
1663 pub const SF_SNAPINVAL: ::c_ulong = 0x00800000;
1664
_ALIGN(p: usize) -> usize1665 fn _ALIGN(p: usize) -> usize {
1666 (p + _ALIGNBYTES) & !_ALIGNBYTES
1667 }
1668
1669 f! {
1670 pub fn CMSG_DATA(cmsg: *const ::cmsghdr) -> *mut ::c_uchar {
1671 (cmsg as *mut ::c_uchar)
1672 .offset(_ALIGN(::mem::size_of::<::cmsghdr>()) as isize)
1673 }
1674
1675 pub fn CMSG_LEN(length: ::c_uint) -> ::c_uint {
1676 _ALIGN(::mem::size_of::<::cmsghdr>()) as ::c_uint + length
1677 }
1678
1679 pub fn CMSG_NXTHDR(mhdr: *const ::msghdr, cmsg: *const ::cmsghdr)
1680 -> *mut ::cmsghdr
1681 {
1682 if cmsg.is_null() {
1683 return ::CMSG_FIRSTHDR(mhdr);
1684 };
1685 let next = cmsg as usize + _ALIGN((*cmsg).cmsg_len as usize)
1686 + _ALIGN(::mem::size_of::<::cmsghdr>());
1687 let max = (*mhdr).msg_control as usize
1688 + (*mhdr).msg_controllen as usize;
1689 if next > max {
1690 0 as *mut ::cmsghdr
1691 } else {
1692 (cmsg as usize + _ALIGN((*cmsg).cmsg_len as usize))
1693 as *mut ::cmsghdr
1694 }
1695 }
1696
1697 pub fn CMSG_SPACE(length: ::c_uint) -> ::c_uint {
1698 (_ALIGN(::mem::size_of::<::cmsghdr>()) + _ALIGN(length as usize))
1699 as ::c_uint
1700 }
1701
1702 // dirfd() is a macro on netbsd to access
1703 // the first field of the struct where dirp points to:
1704 // http://cvsweb.netbsd.org/bsdweb.cgi/src/include/dirent.h?rev=1.36
1705 pub fn dirfd(dirp: *mut ::DIR) -> ::c_int {
1706 *(dirp as *const ::c_int)
1707 }
1708
1709 pub fn SOCKCREDSIZE(ngrps: usize) -> usize {
1710 let ngrps = if ngrps > 0 {
1711 ngrps - 1
1712 } else {
1713 0
1714 };
1715 ::mem::size_of::<sockcred>() + ::mem::size_of::<::gid_t>() * ngrps
1716 }
1717 }
1718
1719 safe_f! {
1720 pub {const} fn WSTOPSIG(status: ::c_int) -> ::c_int {
1721 status >> 8
1722 }
1723
1724 pub {const} fn WIFSIGNALED(status: ::c_int) -> bool {
1725 (status & 0o177) != 0o177 && (status & 0o177) != 0
1726 }
1727
1728 pub {const} fn WIFSTOPPED(status: ::c_int) -> bool {
1729 (status & 0o177) == 0o177
1730 }
1731
1732 pub {const} fn WIFCONTINUED(status: ::c_int) -> bool {
1733 status == 0xffff
1734 }
1735 }
1736
1737 extern "C" {
ntp_adjtime(buf: *mut timex) -> ::c_int1738 pub fn ntp_adjtime(buf: *mut timex) -> ::c_int;
ntp_gettime(buf: *mut ntptimeval) -> ::c_int1739 pub fn ntp_gettime(buf: *mut ntptimeval) -> ::c_int;
1740 }
1741
1742 #[link(name = "rt")]
1743 extern "C" {
aio_read(aiocbp: *mut aiocb) -> ::c_int1744 pub fn aio_read(aiocbp: *mut aiocb) -> ::c_int;
aio_write(aiocbp: *mut aiocb) -> ::c_int1745 pub fn aio_write(aiocbp: *mut aiocb) -> ::c_int;
aio_fsync(op: ::c_int, aiocbp: *mut aiocb) -> ::c_int1746 pub fn aio_fsync(op: ::c_int, aiocbp: *mut aiocb) -> ::c_int;
aio_error(aiocbp: *const aiocb) -> ::c_int1747 pub fn aio_error(aiocbp: *const aiocb) -> ::c_int;
aio_return(aiocbp: *mut aiocb) -> ::ssize_t1748 pub fn aio_return(aiocbp: *mut aiocb) -> ::ssize_t;
1749 #[link_name = "__aio_suspend50"]
aio_suspend( aiocb_list: *const *const aiocb, nitems: ::c_int, timeout: *const ::timespec, ) -> ::c_int1750 pub fn aio_suspend(
1751 aiocb_list: *const *const aiocb,
1752 nitems: ::c_int,
1753 timeout: *const ::timespec,
1754 ) -> ::c_int;
aio_cancel(fd: ::c_int, aiocbp: *mut aiocb) -> ::c_int1755 pub fn aio_cancel(fd: ::c_int, aiocbp: *mut aiocb) -> ::c_int;
lio_listio( mode: ::c_int, aiocb_list: *const *mut aiocb, nitems: ::c_int, sevp: *mut sigevent, ) -> ::c_int1756 pub fn lio_listio(
1757 mode: ::c_int,
1758 aiocb_list: *const *mut aiocb,
1759 nitems: ::c_int,
1760 sevp: *mut sigevent,
1761 ) -> ::c_int;
1762 }
1763
1764 extern "C" {
chflags(path: *const ::c_char, flags: ::c_ulong) -> ::c_int1765 pub fn chflags(path: *const ::c_char, flags: ::c_ulong) -> ::c_int;
fchflags(fd: ::c_int, flags: ::c_ulong) -> ::c_int1766 pub fn fchflags(fd: ::c_int, flags: ::c_ulong) -> ::c_int;
lchflags(path: *const ::c_char, flags: ::c_ulong) -> ::c_int1767 pub fn lchflags(path: *const ::c_char, flags: ::c_ulong) -> ::c_int;
1768
extattr_delete_fd( fd: ::c_int, attrnamespace: ::c_int, attrname: *const ::c_char, ) -> ::c_int1769 pub fn extattr_delete_fd(
1770 fd: ::c_int,
1771 attrnamespace: ::c_int,
1772 attrname: *const ::c_char,
1773 ) -> ::c_int;
extattr_delete_file( path: *const ::c_char, attrnamespace: ::c_int, attrname: *const ::c_char, ) -> ::c_int1774 pub fn extattr_delete_file(
1775 path: *const ::c_char,
1776 attrnamespace: ::c_int,
1777 attrname: *const ::c_char,
1778 ) -> ::c_int;
extattr_delete_link( path: *const ::c_char, attrnamespace: ::c_int, attrname: *const ::c_char, ) -> ::c_int1779 pub fn extattr_delete_link(
1780 path: *const ::c_char,
1781 attrnamespace: ::c_int,
1782 attrname: *const ::c_char,
1783 ) -> ::c_int;
extattr_get_fd( fd: ::c_int, attrnamespace: ::c_int, attrname: *const ::c_char, data: *mut ::c_void, nbytes: ::size_t, ) -> ::ssize_t1784 pub fn extattr_get_fd(
1785 fd: ::c_int,
1786 attrnamespace: ::c_int,
1787 attrname: *const ::c_char,
1788 data: *mut ::c_void,
1789 nbytes: ::size_t,
1790 ) -> ::ssize_t;
extattr_get_file( path: *const ::c_char, attrnamespace: ::c_int, attrname: *const ::c_char, data: *mut ::c_void, nbytes: ::size_t, ) -> ::ssize_t1791 pub fn extattr_get_file(
1792 path: *const ::c_char,
1793 attrnamespace: ::c_int,
1794 attrname: *const ::c_char,
1795 data: *mut ::c_void,
1796 nbytes: ::size_t,
1797 ) -> ::ssize_t;
extattr_get_link( path: *const ::c_char, attrnamespace: ::c_int, attrname: *const ::c_char, data: *mut ::c_void, nbytes: ::size_t, ) -> ::ssize_t1798 pub fn extattr_get_link(
1799 path: *const ::c_char,
1800 attrnamespace: ::c_int,
1801 attrname: *const ::c_char,
1802 data: *mut ::c_void,
1803 nbytes: ::size_t,
1804 ) -> ::ssize_t;
extattr_namespace_to_string( attrnamespace: ::c_int, string: *mut *mut ::c_char, ) -> ::c_int1805 pub fn extattr_namespace_to_string(
1806 attrnamespace: ::c_int,
1807 string: *mut *mut ::c_char,
1808 ) -> ::c_int;
extattr_set_fd( fd: ::c_int, attrnamespace: ::c_int, attrname: *const ::c_char, data: *const ::c_void, nbytes: ::size_t, ) -> ::c_int1809 pub fn extattr_set_fd(
1810 fd: ::c_int,
1811 attrnamespace: ::c_int,
1812 attrname: *const ::c_char,
1813 data: *const ::c_void,
1814 nbytes: ::size_t,
1815 ) -> ::c_int;
extattr_set_file( path: *const ::c_char, attrnamespace: ::c_int, attrname: *const ::c_char, data: *const ::c_void, nbytes: ::size_t, ) -> ::c_int1816 pub fn extattr_set_file(
1817 path: *const ::c_char,
1818 attrnamespace: ::c_int,
1819 attrname: *const ::c_char,
1820 data: *const ::c_void,
1821 nbytes: ::size_t,
1822 ) -> ::c_int;
extattr_set_link( path: *const ::c_char, attrnamespace: ::c_int, attrname: *const ::c_char, data: *const ::c_void, nbytes: ::size_t, ) -> ::c_int1823 pub fn extattr_set_link(
1824 path: *const ::c_char,
1825 attrnamespace: ::c_int,
1826 attrname: *const ::c_char,
1827 data: *const ::c_void,
1828 nbytes: ::size_t,
1829 ) -> ::c_int;
extattr_string_to_namespace( string: *const ::c_char, attrnamespace: *mut ::c_int, ) -> ::c_int1830 pub fn extattr_string_to_namespace(
1831 string: *const ::c_char,
1832 attrnamespace: *mut ::c_int,
1833 ) -> ::c_int;
1834
1835 #[link_name = "__lutimes50"]
lutimes(file: *const ::c_char, times: *const ::timeval) -> ::c_int1836 pub fn lutimes(file: *const ::c_char, times: *const ::timeval) -> ::c_int;
1837 #[link_name = "__gettimeofday50"]
gettimeofday(tp: *mut ::timeval, tz: *mut ::c_void) -> ::c_int1838 pub fn gettimeofday(tp: *mut ::timeval, tz: *mut ::c_void) -> ::c_int;
getnameinfo( sa: *const ::sockaddr, salen: ::socklen_t, host: *mut ::c_char, hostlen: ::socklen_t, serv: *mut ::c_char, sevlen: ::socklen_t, flags: ::c_int, ) -> ::c_int1839 pub fn getnameinfo(
1840 sa: *const ::sockaddr,
1841 salen: ::socklen_t,
1842 host: *mut ::c_char,
1843 hostlen: ::socklen_t,
1844 serv: *mut ::c_char,
1845 sevlen: ::socklen_t,
1846 flags: ::c_int,
1847 ) -> ::c_int;
mprotect( addr: *mut ::c_void, len: ::size_t, prot: ::c_int, ) -> ::c_int1848 pub fn mprotect(
1849 addr: *mut ::c_void,
1850 len: ::size_t,
1851 prot: ::c_int,
1852 ) -> ::c_int;
sysctl( name: *const ::c_int, namelen: ::c_uint, oldp: *mut ::c_void, oldlenp: *mut ::size_t, newp: *const ::c_void, newlen: ::size_t, ) -> ::c_int1853 pub fn sysctl(
1854 name: *const ::c_int,
1855 namelen: ::c_uint,
1856 oldp: *mut ::c_void,
1857 oldlenp: *mut ::size_t,
1858 newp: *const ::c_void,
1859 newlen: ::size_t,
1860 ) -> ::c_int;
sysctlbyname( name: *const ::c_char, oldp: *mut ::c_void, oldlenp: *mut ::size_t, newp: *const ::c_void, newlen: ::size_t, ) -> ::c_int1861 pub fn sysctlbyname(
1862 name: *const ::c_char,
1863 oldp: *mut ::c_void,
1864 oldlenp: *mut ::size_t,
1865 newp: *const ::c_void,
1866 newlen: ::size_t,
1867 ) -> ::c_int;
1868 #[link_name = "__kevent50"]
kevent( kq: ::c_int, changelist: *const ::kevent, nchanges: ::size_t, eventlist: *mut ::kevent, nevents: ::size_t, timeout: *const ::timespec, ) -> ::c_int1869 pub fn kevent(
1870 kq: ::c_int,
1871 changelist: *const ::kevent,
1872 nchanges: ::size_t,
1873 eventlist: *mut ::kevent,
1874 nevents: ::size_t,
1875 timeout: *const ::timespec,
1876 ) -> ::c_int;
1877 #[link_name = "__mount50"]
mount( src: *const ::c_char, target: *const ::c_char, flags: ::c_int, data: *mut ::c_void, size: ::size_t, ) -> ::c_int1878 pub fn mount(
1879 src: *const ::c_char,
1880 target: *const ::c_char,
1881 flags: ::c_int,
1882 data: *mut ::c_void,
1883 size: ::size_t,
1884 ) -> ::c_int;
mq_open(name: *const ::c_char, oflag: ::c_int, ...) -> ::mqd_t1885 pub fn mq_open(name: *const ::c_char, oflag: ::c_int, ...) -> ::mqd_t;
mq_close(mqd: ::mqd_t) -> ::c_int1886 pub fn mq_close(mqd: ::mqd_t) -> ::c_int;
mq_getattr(mqd: ::mqd_t, attr: *mut ::mq_attr) -> ::c_int1887 pub fn mq_getattr(mqd: ::mqd_t, attr: *mut ::mq_attr) -> ::c_int;
mq_notify(mqd: ::mqd_t, notification: *const ::sigevent) -> ::c_int1888 pub fn mq_notify(mqd: ::mqd_t, notification: *const ::sigevent)
1889 -> ::c_int;
mq_receive( mqd: ::mqd_t, msg_ptr: *mut ::c_char, msg_len: ::size_t, msg_prio: *mut ::c_uint, ) -> ::ssize_t1890 pub fn mq_receive(
1891 mqd: ::mqd_t,
1892 msg_ptr: *mut ::c_char,
1893 msg_len: ::size_t,
1894 msg_prio: *mut ::c_uint,
1895 ) -> ::ssize_t;
mq_send( mqd: ::mqd_t, msg_ptr: *const ::c_char, msg_len: ::size_t, msg_prio: ::c_uint, ) -> ::c_int1896 pub fn mq_send(
1897 mqd: ::mqd_t,
1898 msg_ptr: *const ::c_char,
1899 msg_len: ::size_t,
1900 msg_prio: ::c_uint,
1901 ) -> ::c_int;
mq_setattr( mqd: ::mqd_t, newattr: *const ::mq_attr, oldattr: *mut ::mq_attr, ) -> ::c_int1902 pub fn mq_setattr(
1903 mqd: ::mqd_t,
1904 newattr: *const ::mq_attr,
1905 oldattr: *mut ::mq_attr,
1906 ) -> ::c_int;
1907 #[link_name = "__mq_timedreceive50"]
mq_timedreceive( mqd: ::mqd_t, msg_ptr: *mut ::c_char, msg_len: ::size_t, msg_prio: *mut ::c_uint, abs_timeout: *const ::timespec, ) -> ::ssize_t1908 pub fn mq_timedreceive(
1909 mqd: ::mqd_t,
1910 msg_ptr: *mut ::c_char,
1911 msg_len: ::size_t,
1912 msg_prio: *mut ::c_uint,
1913 abs_timeout: *const ::timespec,
1914 ) -> ::ssize_t;
1915 #[link_name = "__mq_timedsend50"]
mq_timedsend( mqd: ::mqd_t, msg_ptr: *const ::c_char, msg_len: ::size_t, msg_prio: ::c_uint, abs_timeout: *const ::timespec, ) -> ::c_int1916 pub fn mq_timedsend(
1917 mqd: ::mqd_t,
1918 msg_ptr: *const ::c_char,
1919 msg_len: ::size_t,
1920 msg_prio: ::c_uint,
1921 abs_timeout: *const ::timespec,
1922 ) -> ::c_int;
mq_unlink(name: *const ::c_char) -> ::c_int1923 pub fn mq_unlink(name: *const ::c_char) -> ::c_int;
ptrace( request: ::c_int, pid: ::pid_t, addr: *mut ::c_void, data: ::c_int, ) -> ::c_int1924 pub fn ptrace(
1925 request: ::c_int,
1926 pid: ::pid_t,
1927 addr: *mut ::c_void,
1928 data: ::c_int,
1929 ) -> ::c_int;
pthread_setname_np( t: ::pthread_t, name: *const ::c_char, arg: *const ::c_void, ) -> ::c_int1930 pub fn pthread_setname_np(
1931 t: ::pthread_t,
1932 name: *const ::c_char,
1933 arg: *const ::c_void,
1934 ) -> ::c_int;
pthread_attr_get_np( thread: ::pthread_t, attr: *mut ::pthread_attr_t, ) -> ::c_int1935 pub fn pthread_attr_get_np(
1936 thread: ::pthread_t,
1937 attr: *mut ::pthread_attr_t,
1938 ) -> ::c_int;
pthread_getattr_np( native: ::pthread_t, attr: *mut ::pthread_attr_t, ) -> ::c_int1939 pub fn pthread_getattr_np(
1940 native: ::pthread_t,
1941 attr: *mut ::pthread_attr_t,
1942 ) -> ::c_int;
pthread_attr_getguardsize( attr: *const ::pthread_attr_t, guardsize: *mut ::size_t, ) -> ::c_int1943 pub fn pthread_attr_getguardsize(
1944 attr: *const ::pthread_attr_t,
1945 guardsize: *mut ::size_t,
1946 ) -> ::c_int;
pthread_attr_getstack( attr: *const ::pthread_attr_t, stackaddr: *mut *mut ::c_void, stacksize: *mut ::size_t, ) -> ::c_int1947 pub fn pthread_attr_getstack(
1948 attr: *const ::pthread_attr_t,
1949 stackaddr: *mut *mut ::c_void,
1950 stacksize: *mut ::size_t,
1951 ) -> ::c_int;
1952 #[link_name = "__sigtimedwait50"]
sigtimedwait( set: *const sigset_t, info: *mut siginfo_t, timeout: *const ::timespec, ) -> ::c_int1953 pub fn sigtimedwait(
1954 set: *const sigset_t,
1955 info: *mut siginfo_t,
1956 timeout: *const ::timespec,
1957 ) -> ::c_int;
sigwaitinfo(set: *const sigset_t, info: *mut siginfo_t) -> ::c_int1958 pub fn sigwaitinfo(set: *const sigset_t, info: *mut siginfo_t) -> ::c_int;
duplocale(base: ::locale_t) -> ::locale_t1959 pub fn duplocale(base: ::locale_t) -> ::locale_t;
freelocale(loc: ::locale_t)1960 pub fn freelocale(loc: ::locale_t);
localeconv_l(loc: ::locale_t) -> *mut lconv1961 pub fn localeconv_l(loc: ::locale_t) -> *mut lconv;
newlocale( mask: ::c_int, locale: *const ::c_char, base: ::locale_t, ) -> ::locale_t1962 pub fn newlocale(
1963 mask: ::c_int,
1964 locale: *const ::c_char,
1965 base: ::locale_t,
1966 ) -> ::locale_t;
1967 #[link_name = "__settimeofday50"]
settimeofday(tv: *const ::timeval, tz: *const ::c_void) -> ::c_int1968 pub fn settimeofday(tv: *const ::timeval, tz: *const ::c_void) -> ::c_int;
1969
dup3(src: ::c_int, dst: ::c_int, flags: ::c_int) -> ::c_int1970 pub fn dup3(src: ::c_int, dst: ::c_int, flags: ::c_int) -> ::c_int;
1971
sendmmsg( sockfd: ::c_int, msgvec: *mut ::mmsghdr, vlen: ::c_uint, flags: ::c_int, ) -> ::c_int1972 pub fn sendmmsg(
1973 sockfd: ::c_int,
1974 msgvec: *mut ::mmsghdr,
1975 vlen: ::c_uint,
1976 flags: ::c_int,
1977 ) -> ::c_int;
recvmmsg( sockfd: ::c_int, msgvec: *mut ::mmsghdr, vlen: ::c_uint, flags: ::c_int, timeout: *mut ::timespec, ) -> ::c_int1978 pub fn recvmmsg(
1979 sockfd: ::c_int,
1980 msgvec: *mut ::mmsghdr,
1981 vlen: ::c_uint,
1982 flags: ::c_int,
1983 timeout: *mut ::timespec,
1984 ) -> ::c_int;
1985
_lwp_self() -> lwpid_t1986 pub fn _lwp_self() -> lwpid_t;
memmem( haystack: *const ::c_void, haystacklen: ::size_t, needle: *const ::c_void, needlelen: ::size_t, ) -> *mut ::c_void1987 pub fn memmem(
1988 haystack: *const ::c_void,
1989 haystacklen: ::size_t,
1990 needle: *const ::c_void,
1991 needlelen: ::size_t,
1992 ) -> *mut ::c_void;
1993 }
1994
1995 #[link(name = "util")]
1996 extern "C" {
1997 #[cfg_attr(target_os = "netbsd", link_name = "__getpwent_r50")]
getpwent_r( pwd: *mut ::passwd, buf: *mut ::c_char, buflen: ::size_t, result: *mut *mut ::passwd, ) -> ::c_int1998 pub fn getpwent_r(
1999 pwd: *mut ::passwd,
2000 buf: *mut ::c_char,
2001 buflen: ::size_t,
2002 result: *mut *mut ::passwd,
2003 ) -> ::c_int;
getgrent_r( grp: *mut ::group, buf: *mut ::c_char, buflen: ::size_t, result: *mut *mut ::group, ) -> ::c_int2004 pub fn getgrent_r(
2005 grp: *mut ::group,
2006 buf: *mut ::c_char,
2007 buflen: ::size_t,
2008 result: *mut *mut ::group,
2009 ) -> ::c_int;
2010
updwtmpx(file: *const ::c_char, ut: *const utmpx) -> ::c_int2011 pub fn updwtmpx(file: *const ::c_char, ut: *const utmpx) -> ::c_int;
getlastlogx( fname: *const ::c_char, uid: ::uid_t, ll: *mut lastlogx, ) -> *mut lastlogx2012 pub fn getlastlogx(
2013 fname: *const ::c_char,
2014 uid: ::uid_t,
2015 ll: *mut lastlogx,
2016 ) -> *mut lastlogx;
updlastlogx( fname: *const ::c_char, uid: ::uid_t, ll: *mut lastlogx, ) -> ::c_int2017 pub fn updlastlogx(
2018 fname: *const ::c_char,
2019 uid: ::uid_t,
2020 ll: *mut lastlogx,
2021 ) -> ::c_int;
utmpxname(file: *const ::c_char) -> ::c_int2022 pub fn utmpxname(file: *const ::c_char) -> ::c_int;
getutxent() -> *mut utmpx2023 pub fn getutxent() -> *mut utmpx;
getutxid(ut: *const utmpx) -> *mut utmpx2024 pub fn getutxid(ut: *const utmpx) -> *mut utmpx;
getutxline(ut: *const utmpx) -> *mut utmpx2025 pub fn getutxline(ut: *const utmpx) -> *mut utmpx;
pututxline(ut: *const utmpx) -> *mut utmpx2026 pub fn pututxline(ut: *const utmpx) -> *mut utmpx;
setutxent()2027 pub fn setutxent();
endutxent()2028 pub fn endutxent();
2029
getutmp(ux: *const utmpx, u: *mut utmp)2030 pub fn getutmp(ux: *const utmpx, u: *mut utmp);
getutmpx(u: *const utmp, ux: *mut utmpx)2031 pub fn getutmpx(u: *const utmp, ux: *mut utmpx);
2032
utpname(file: *const ::c_char) -> ::c_int2033 pub fn utpname(file: *const ::c_char) -> ::c_int;
setutent()2034 pub fn setutent();
endutent()2035 pub fn endutent();
getutent() -> *mut utmp2036 pub fn getutent() -> *mut utmp;
2037 }
2038
2039 cfg_if! {
2040 if #[cfg(target_arch = "aarch64")] {
2041 mod aarch64;
2042 pub use self::aarch64::*;
2043 } else if #[cfg(target_arch = "arm")] {
2044 mod arm;
2045 pub use self::arm::*;
2046 } else if #[cfg(target_arch = "powerpc")] {
2047 mod powerpc;
2048 pub use self::powerpc::*;
2049 } else if #[cfg(target_arch = "sparc64")] {
2050 mod sparc64;
2051 pub use self::sparc64::*;
2052 } else if #[cfg(target_arch = "x86_64")] {
2053 mod x86_64;
2054 pub use self::x86_64::*;
2055 } else if #[cfg(target_arch = "x86")] {
2056 mod x86;
2057 pub use self::x86::*;
2058 } else {
2059 // Unknown target_arch
2060 }
2061 }
2062