• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
317 s_no_extra_traits! {
318 
319     pub struct utmpx {
320         pub ut_name: [::c_char; _UTX_USERSIZE],
321         pub ut_id: [::c_char; _UTX_IDSIZE],
322         pub ut_line: [::c_char; _UTX_LINESIZE],
323         pub ut_host: [::c_char; _UTX_HOSTSIZE],
324         pub ut_session: u16,
325         pub ut_type: u16,
326         pub ut_pid: ::pid_t,
327         pub ut_exit: __exit_status,
328         pub ut_ss: sockaddr_storage,
329         pub ut_tv: ::timeval,
330         pub ut_pad: [u8; _UTX_PADSIZE],
331     }
332 
333     pub struct lastlogx {
334         pub ll_tv: ::timeval,
335         pub ll_line: [::c_char; _UTX_LINESIZE],
336         pub ll_host: [::c_char; _UTX_HOSTSIZE],
337         pub ll_ss: sockaddr_storage,
338     }
339 
340     pub struct in_pktinfo {
341         pub ipi_addr: ::in_addr,
342         pub ipi_ifindex: ::c_uint,
343     }
344 
345     #[repr(packed)]
346     pub struct arphdr {
347         pub ar_hrd: u16,
348         pub ar_pro: u16,
349         pub ar_hln: u8,
350         pub ar_pln: u8,
351         pub ar_op: u16,
352     }
353 
354     #[repr(packed)]
355     pub struct in_addr {
356         pub s_addr: ::in_addr_t,
357     }
358 
359     pub struct ip_mreq {
360         pub imr_multiaddr: in_addr,
361         pub imr_interface: in_addr,
362     }
363 
364     pub struct sockaddr_in {
365         pub sin_len: u8,
366         pub sin_family: ::sa_family_t,
367         pub sin_port: ::in_port_t,
368         pub sin_addr: ::in_addr,
369         pub sin_zero: [i8; 8],
370     }
371 
372     pub struct dirent {
373         pub d_fileno: ::ino_t,
374         pub d_reclen: u16,
375         pub d_namlen: u16,
376         pub d_type: u8,
377         pub d_name: [::c_char; 512],
378     }
379 
380     pub struct statvfs {
381         pub f_flag: ::c_ulong,
382         pub f_bsize: ::c_ulong,
383         pub f_frsize: ::c_ulong,
384         pub f_iosize: ::c_ulong,
385 
386         pub f_blocks: ::fsblkcnt_t,
387         pub f_bfree: ::fsblkcnt_t,
388         pub f_bavail: ::fsblkcnt_t,
389         pub f_bresvd: ::fsblkcnt_t,
390 
391         pub f_files: ::fsfilcnt_t,
392         pub f_ffree: ::fsfilcnt_t,
393         pub f_favail: ::fsfilcnt_t,
394         pub f_fresvd: ::fsfilcnt_t,
395 
396         pub f_syncreads: u64,
397         pub f_syncwrites: u64,
398 
399         pub f_asyncreads: u64,
400         pub f_asyncwrites: u64,
401 
402         pub f_fsidx: ::fsid_t,
403         pub f_fsid: ::c_ulong,
404         pub f_namemax: ::c_ulong,
405         pub f_owner: ::uid_t,
406 
407         pub f_spare: [u32; 4],
408 
409         pub f_fstypename: [::c_char; 32],
410         pub f_mntonname: [::c_char; 1024],
411         pub f_mntfromname: [::c_char; 1024],
412     }
413 
414     pub struct sockaddr_storage {
415         pub ss_len: u8,
416         pub ss_family: ::sa_family_t,
417         __ss_pad1: [u8; 6],
418         __ss_pad2: i64,
419         __ss_pad3: [u8; 112],
420     }
421 
422     pub struct sigevent {
423         pub sigev_notify: ::c_int,
424         pub sigev_signo: ::c_int,
425         pub sigev_value: ::sigval,
426         __unused1: *mut ::c_void,       //actually a function pointer
427         pub sigev_notify_attributes: *mut ::c_void
428     }
429 }
430 
431 cfg_if! {
432     if #[cfg(feature = "extra_traits")] {
433         impl PartialEq for utmpx {
434             fn eq(&self, other: &utmpx) -> bool {
435                 self.ut_type == other.ut_type
436                     && self.ut_pid == other.ut_pid
437                     && self.ut_name == other.ut_name
438                     && self.ut_line == other.ut_line
439                     && self.ut_id == other.ut_id
440                     && self.ut_exit == other.ut_exit
441                     && self.ut_session == other.ut_session
442                     && self.ut_tv == other.ut_tv
443                     && self.ut_ss == other.ut_ss
444                     && self
445                     .ut_pad
446                     .iter()
447                     .zip(other.ut_pad.iter())
448                     .all(|(a,b)| a == b)
449                     && self
450                     .ut_host
451                     .iter()
452                     .zip(other.ut_host.iter())
453                     .all(|(a,b)| a == b)
454             }
455         }
456 
457         impl Eq for utmpx {}
458 
459         impl ::fmt::Debug for utmpx {
460             fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
461                 f.debug_struct("utmpx")
462                     .field("ut_name", &self.ut_name)
463                     .field("ut_id", &self.ut_id)
464                     .field("ut_line", &self.ut_line)
465                 // FIXME .field("ut_host", &self.ut_host)
466                     .field("ut_session", &self.ut_session)
467                     .field("ut_type", &self.ut_type)
468                     .field("ut_pid", &self.ut_pid)
469                     .field("ut_exit", &self.ut_exit)
470                     .field("ut_ss", &self.ut_ss)
471                     .field("ut_tv", &self.ut_tv)
472                 // FIXME .field("ut_pad", &self.ut_pad)
473                     .finish()
474             }
475         }
476 
477         impl ::hash::Hash for utmpx {
478             fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
479                 self.ut_name.hash(state);
480                 self.ut_type.hash(state);
481                 self.ut_pid.hash(state);
482                 self.ut_line.hash(state);
483                 self.ut_id.hash(state);
484                 self.ut_host.hash(state);
485                 self.ut_exit.hash(state);
486                 self.ut_session.hash(state);
487                 self.ut_tv.hash(state);
488                 self.ut_ss.hash(state);
489                 self.ut_pad.hash(state);
490             }
491         }
492 
493         impl PartialEq for lastlogx {
494             fn eq(&self, other: &lastlogx) -> bool {
495                 self.ll_tv == other.ll_tv
496                     && self.ll_line == other.ll_line
497                     && self.ll_ss == other.ll_ss
498                     && self
499                     .ll_host
500                     .iter()
501                     .zip(other.ll_host.iter())
502                     .all(|(a,b)| a == b)
503             }
504         }
505 
506         impl Eq for lastlogx {}
507 
508         impl ::fmt::Debug for lastlogx {
509             fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
510                 f.debug_struct("lastlogx")
511                     .field("ll_tv", &self.ll_tv)
512                     .field("ll_line", &self.ll_line)
513                 // FIXME.field("ll_host", &self.ll_host)
514                     .field("ll_ss", &self.ll_ss)
515                     .finish()
516             }
517         }
518 
519         impl ::hash::Hash for lastlogx {
520             fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
521                 self.ll_tv.hash(state);
522                 self.ll_line.hash(state);
523                 self.ll_host.hash(state);
524                 self.ll_ss.hash(state);
525             }
526         }
527 
528         impl PartialEq for in_pktinfo {
529             fn eq(&self, other: &in_pktinfo) -> bool {
530                 self.ipi_addr == other.ipi_addr
531                     && self.ipi_ifindex == other.ipi_ifindex
532             }
533         }
534         impl Eq for in_pktinfo {}
535         impl ::fmt::Debug for in_pktinfo {
536             fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
537                 f.debug_struct("in_pktinfo")
538                     .field("ipi_addr", &self.ipi_addr)
539                     .field("ipi_ifindex", &self.ipi_ifindex)
540                     .finish()
541             }
542         }
543         impl ::hash::Hash for in_pktinfo {
544             fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
545                 self.ipi_addr.hash(state);
546                 self.ipi_ifindex.hash(state);
547             }
548         }
549 
550         impl PartialEq for arphdr {
551             fn eq(&self, other: &arphdr) -> bool {
552                 self.ar_hrd == other.ar_hrd
553                     && self.ar_pro == other.ar_pro
554                     && self.ar_hln == other.ar_hln
555                     && self.ar_pln == other.ar_pln
556                     && self.ar_op == other.ar_op
557             }
558         }
559         impl Eq for arphdr {}
560         impl ::fmt::Debug for arphdr {
561             fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
562                 let ar_hrd = self.ar_hrd;
563                 let ar_pro = self.ar_pro;
564                 let ar_op = self.ar_op;
565                 f.debug_struct("arphdr")
566                     .field("ar_hrd", &ar_hrd)
567                     .field("ar_pro", &ar_pro)
568                     .field("ar_hln", &self.ar_hln)
569                     .field("ar_pln", &self.ar_pln)
570                     .field("ar_op", &ar_op)
571                     .finish()
572             }
573         }
574         impl ::hash::Hash for arphdr {
575             fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
576                 let ar_hrd = self.ar_hrd;
577                 let ar_pro = self.ar_pro;
578                 let ar_op = self.ar_op;
579                 ar_hrd.hash(state);
580                 ar_pro.hash(state);
581                 self.ar_hln.hash(state);
582                 self.ar_pln.hash(state);
583                 ar_op.hash(state);
584             }
585         }
586 
587         impl PartialEq for in_addr {
588             fn eq(&self, other: &in_addr) -> bool {
589                 self.s_addr == other.s_addr
590             }
591         }
592         impl Eq for in_addr {}
593         impl ::fmt::Debug for in_addr {
594             fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
595                 let s_addr = self.s_addr;
596                 f.debug_struct("in_addr")
597                     .field("s_addr", &s_addr)
598                     .finish()
599             }
600         }
601         impl ::hash::Hash for in_addr {
602             fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
603                 let s_addr = self.s_addr;
604                 s_addr.hash(state);
605             }
606         }
607 
608         impl PartialEq for ip_mreq {
609             fn eq(&self, other: &ip_mreq) -> bool {
610                 self.imr_multiaddr == other.imr_multiaddr
611                     && self.imr_interface == other.imr_interface
612             }
613         }
614         impl Eq for ip_mreq {}
615         impl ::fmt::Debug for ip_mreq {
616             fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
617                 f.debug_struct("ip_mreq")
618                     .field("imr_multiaddr", &self.imr_multiaddr)
619                     .field("imr_interface", &self.imr_interface)
620                     .finish()
621             }
622         }
623         impl ::hash::Hash for ip_mreq {
624             fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
625                 self.imr_multiaddr.hash(state);
626                 self.imr_interface.hash(state);
627             }
628         }
629 
630         impl PartialEq for sockaddr_in {
631             fn eq(&self, other: &sockaddr_in) -> bool {
632                 self.sin_len == other.sin_len
633                     && self.sin_family == other.sin_family
634                     && self.sin_port == other.sin_port
635                     && self.sin_addr == other.sin_addr
636                     && self.sin_zero == other.sin_zero
637             }
638         }
639         impl Eq for sockaddr_in {}
640         impl ::fmt::Debug for sockaddr_in {
641             fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
642                 f.debug_struct("sockaddr_in")
643                     .field("sin_len", &self.sin_len)
644                     .field("sin_family", &self.sin_family)
645                     .field("sin_port", &self.sin_port)
646                     .field("sin_addr", &self.sin_addr)
647                     .field("sin_zero", &self.sin_zero)
648                     .finish()
649             }
650         }
651         impl ::hash::Hash for sockaddr_in {
652             fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
653                 self.sin_len.hash(state);
654                 self.sin_family.hash(state);
655                 self.sin_port.hash(state);
656                 self.sin_addr.hash(state);
657                 self.sin_zero.hash(state);
658             }
659         }
660 
661         impl PartialEq for dirent {
662             fn eq(&self, other: &dirent) -> bool {
663                 self.d_fileno == other.d_fileno
664                     && self.d_reclen == other.d_reclen
665                     && self.d_namlen == other.d_namlen
666                     && self.d_type == other.d_type
667                     && self
668                     .d_name
669                     .iter()
670                     .zip(other.d_name.iter())
671                     .all(|(a,b)| a == b)
672             }
673         }
674         impl Eq for dirent {}
675         impl ::fmt::Debug for dirent {
676             fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
677                 f.debug_struct("dirent")
678                     .field("d_fileno", &self.d_fileno)
679                     .field("d_reclen", &self.d_reclen)
680                     .field("d_namlen", &self.d_namlen)
681                     .field("d_type", &self.d_type)
682                     // FIXME: .field("d_name", &self.d_name)
683                     .finish()
684             }
685         }
686         impl ::hash::Hash for dirent {
687             fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
688                 self.d_fileno.hash(state);
689                 self.d_reclen.hash(state);
690                 self.d_namlen.hash(state);
691                 self.d_type.hash(state);
692                 self.d_name.hash(state);
693             }
694         }
695 
696         impl PartialEq for statvfs {
697             fn eq(&self, other: &statvfs) -> bool {
698                 self.f_flag == other.f_flag
699                     && self.f_bsize == other.f_bsize
700                     && self.f_frsize == other.f_frsize
701                     && self.f_iosize == other.f_iosize
702                     && self.f_blocks == other.f_blocks
703                     && self.f_bfree == other.f_bfree
704                     && self.f_bavail == other.f_bavail
705                     && self.f_bresvd == other.f_bresvd
706                     && self.f_files == other.f_files
707                     && self.f_ffree == other.f_ffree
708                     && self.f_favail == other.f_favail
709                     && self.f_fresvd == other.f_fresvd
710                     && self.f_syncreads == other.f_syncreads
711                     && self.f_syncwrites == other.f_syncwrites
712                     && self.f_asyncreads == other.f_asyncreads
713                     && self.f_asyncwrites == other.f_asyncwrites
714                     && self.f_fsidx == other.f_fsidx
715                     && self.f_fsid == other.f_fsid
716                     && self.f_namemax == other.f_namemax
717                     && self.f_owner == other.f_owner
718                     && self.f_spare == other.f_spare
719                     && self.f_fstypename == other.f_fstypename
720                     && self
721                     .f_mntonname
722                     .iter()
723                     .zip(other.f_mntonname.iter())
724                     .all(|(a,b)| a == b)
725                     && self
726                     .f_mntfromname
727                     .iter()
728                     .zip(other.f_mntfromname.iter())
729                     .all(|(a,b)| a == b)
730             }
731         }
732         impl Eq for statvfs {}
733         impl ::fmt::Debug for statvfs {
734             fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
735                 f.debug_struct("statvfs")
736                     .field("f_flag", &self.f_flag)
737                     .field("f_bsize", &self.f_bsize)
738                     .field("f_frsize", &self.f_frsize)
739                     .field("f_iosize", &self.f_iosize)
740                     .field("f_blocks", &self.f_blocks)
741                     .field("f_bfree", &self.f_bfree)
742                     .field("f_bavail", &self.f_bavail)
743                     .field("f_bresvd", &self.f_bresvd)
744                     .field("f_files", &self.f_files)
745                     .field("f_ffree", &self.f_ffree)
746                     .field("f_favail", &self.f_favail)
747                     .field("f_fresvd", &self.f_fresvd)
748                     .field("f_syncreads", &self.f_syncreads)
749                     .field("f_syncwrites", &self.f_syncwrites)
750                     .field("f_asyncreads", &self.f_asyncreads)
751                     .field("f_asyncwrites", &self.f_asyncwrites)
752                     .field("f_fsidx", &self.f_fsidx)
753                     .field("f_fsid", &self.f_fsid)
754                     .field("f_namemax", &self.f_namemax)
755                     .field("f_owner", &self.f_owner)
756                     .field("f_spare", &self.f_spare)
757                     .field("f_fstypename", &self.f_fstypename)
758                     // FIXME: .field("f_mntonname", &self.f_mntonname)
759                     // FIXME: .field("f_mntfromname", &self.f_mntfromname)
760                     .finish()
761             }
762         }
763         impl ::hash::Hash for statvfs {
764             fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
765                 self.f_flag.hash(state);
766                 self.f_bsize.hash(state);
767                 self.f_frsize.hash(state);
768                 self.f_iosize.hash(state);
769                 self.f_blocks.hash(state);
770                 self.f_bfree.hash(state);
771                 self.f_bavail.hash(state);
772                 self.f_bresvd.hash(state);
773                 self.f_files.hash(state);
774                 self.f_ffree.hash(state);
775                 self.f_favail.hash(state);
776                 self.f_fresvd.hash(state);
777                 self.f_syncreads.hash(state);
778                 self.f_syncwrites.hash(state);
779                 self.f_asyncreads.hash(state);
780                 self.f_asyncwrites.hash(state);
781                 self.f_fsidx.hash(state);
782                 self.f_fsid.hash(state);
783                 self.f_namemax.hash(state);
784                 self.f_owner.hash(state);
785                 self.f_spare.hash(state);
786                 self.f_fstypename.hash(state);
787                 self.f_mntonname.hash(state);
788                 self.f_mntfromname.hash(state);
789             }
790         }
791 
792         impl PartialEq for sockaddr_storage {
793             fn eq(&self, other: &sockaddr_storage) -> bool {
794                 self.ss_len == other.ss_len
795                     && self.ss_family == other.ss_family
796                     && self.__ss_pad1 == other.__ss_pad1
797                     && self.__ss_pad2 == other.__ss_pad2
798                     && self
799                     .__ss_pad3
800                     .iter()
801                     .zip(other.__ss_pad3.iter())
802                     .all(|(a,b)| a == b)
803             }
804         }
805         impl Eq for sockaddr_storage {}
806         impl ::fmt::Debug for sockaddr_storage {
807             fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
808                 f.debug_struct("sockaddr_storage")
809                     .field("ss_len", &self.ss_len)
810                     .field("ss_family", &self.ss_family)
811                     .field("__ss_pad1", &self.__ss_pad1)
812                     .field("__ss_pad2", &self.__ss_pad2)
813                     // FIXME: .field("__ss_pad3", &self.__ss_pad3)
814                     .finish()
815             }
816         }
817         impl ::hash::Hash for sockaddr_storage {
818             fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
819                 self.ss_len.hash(state);
820                 self.ss_family.hash(state);
821                 self.__ss_pad1.hash(state);
822                 self.__ss_pad2.hash(state);
823                 self.__ss_pad3.hash(state);
824             }
825         }
826 
827         impl PartialEq for sigevent {
828             fn eq(&self, other: &sigevent) -> bool {
829                 self.sigev_notify == other.sigev_notify
830                     && self.sigev_signo == other.sigev_signo
831                     && self.sigev_value == other.sigev_value
832                     && self.sigev_notify_attributes
833                         == other.sigev_notify_attributes
834             }
835         }
836         impl Eq for sigevent {}
837         impl ::fmt::Debug for sigevent {
838             fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
839                 f.debug_struct("sigevent")
840                     .field("sigev_notify", &self.sigev_notify)
841                     .field("sigev_signo", &self.sigev_signo)
842                     .field("sigev_value", &self.sigev_value)
843                     .field("sigev_notify_attributes",
844                            &self.sigev_notify_attributes)
845                     .finish()
846             }
847         }
848         impl ::hash::Hash for sigevent {
849             fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
850                 self.sigev_notify.hash(state);
851                 self.sigev_signo.hash(state);
852                 self.sigev_value.hash(state);
853                 self.sigev_notify_attributes.hash(state);
854             }
855         }
856     }
857 }
858 
859 pub const AT_FDCWD: ::c_int = -100;
860 pub const AT_EACCESS: ::c_int = 0x100;
861 pub const AT_SYMLINK_NOFOLLOW: ::c_int = 0x200;
862 pub const AT_SYMLINK_FOLLOW: ::c_int = 0x400;
863 pub const AT_REMOVEDIR: ::c_int = 0x800;
864 
865 pub const EXTATTR_NAMESPACE_USER: ::c_int = 1;
866 pub const EXTATTR_NAMESPACE_SYSTEM: ::c_int = 2;
867 
868 pub const LC_COLLATE_MASK: ::c_int = (1 << ::LC_COLLATE);
869 pub const LC_CTYPE_MASK: ::c_int = (1 << ::LC_CTYPE);
870 pub const LC_MONETARY_MASK: ::c_int = (1 << ::LC_MONETARY);
871 pub const LC_NUMERIC_MASK: ::c_int = (1 << ::LC_NUMERIC);
872 pub const LC_TIME_MASK: ::c_int = (1 << ::LC_TIME);
873 pub const LC_MESSAGES_MASK: ::c_int = (1 << ::LC_MESSAGES);
874 pub const LC_ALL_MASK: ::c_int = !0;
875 
876 pub const ERA: ::nl_item = 52;
877 pub const ERA_D_FMT: ::nl_item = 53;
878 pub const ERA_D_T_FMT: ::nl_item = 54;
879 pub const ERA_T_FMT: ::nl_item = 55;
880 pub const ALT_DIGITS: ::nl_item = 56;
881 
882 pub const O_CLOEXEC: ::c_int = 0x400000;
883 pub const O_ALT_IO: ::c_int = 0x40000;
884 pub const O_NOSIGPIPE: ::c_int = 0x1000000;
885 pub const O_SEARCH: ::c_int = 0x800000;
886 pub const O_DIRECTORY: ::c_int = 0x200000;
887 pub const O_DIRECT: ::c_int = 0x00080000;
888 pub const O_RSYNC: ::c_int = 0x00020000;
889 
890 pub const MS_SYNC: ::c_int = 0x4;
891 pub const MS_INVALIDATE: ::c_int = 0x2;
892 
893 #[deprecated(since = "0.2.64", note = "Not stable across OS versions")]
894 pub const RLIM_NLIMITS: ::c_int = 12;
895 
896 pub const EIDRM: ::c_int = 82;
897 pub const ENOMSG: ::c_int = 83;
898 pub const EOVERFLOW: ::c_int = 84;
899 pub const EILSEQ: ::c_int = 85;
900 pub const ENOTSUP: ::c_int = 86;
901 pub const ECANCELED: ::c_int = 87;
902 pub const EBADMSG: ::c_int = 88;
903 pub const ENODATA: ::c_int = 89;
904 pub const ENOSR: ::c_int = 90;
905 pub const ENOSTR: ::c_int = 91;
906 pub const ETIME: ::c_int = 92;
907 pub const ENOATTR: ::c_int = 93;
908 pub const EMULTIHOP: ::c_int = 94;
909 pub const ENOLINK: ::c_int = 95;
910 pub const EPROTO: ::c_int = 96;
911 pub const ELAST: ::c_int = 96;
912 
913 pub const F_DUPFD_CLOEXEC: ::c_int = 12;
914 pub const F_CLOSEM: ::c_int = 10;
915 pub const F_GETNOSIGPIPE: ::c_int = 13;
916 pub const F_SETNOSIGPIPE: ::c_int = 14;
917 pub const F_MAXFD: ::c_int = 11;
918 
919 pub const IP_RECVDSTADDR: ::c_int = 7;
920 pub const IP_SENDSRCADDR: ::c_int = IP_RECVDSTADDR;
921 pub const IP_RECVIF: ::c_int = 20;
922 pub const IP_PKTINFO: ::c_int = 25;
923 pub const IP_RECVPKTINFO: ::c_int = 26;
924 pub const IPV6_JOIN_GROUP: ::c_int = 12;
925 pub const IPV6_LEAVE_GROUP: ::c_int = 13;
926 
927 pub const TCP_KEEPIDLE: ::c_int = 3;
928 pub const TCP_KEEPINTVL: ::c_int = 5;
929 pub const TCP_KEEPCNT: ::c_int = 6;
930 pub const TCP_KEEPINIT: ::c_int = 7;
931 pub const TCP_INFO: ::c_int = 9;
932 pub const TCP_MD5SIG: ::c_int = 0x10;
933 pub const TCP_CONGCTL: ::c_int = 0x20;
934 
935 pub const SOCK_CONN_DGRAM: ::c_int = 6;
936 pub const SOCK_DCCP: ::c_int = SOCK_CONN_DGRAM;
937 pub const SOCK_NOSIGPIPE: ::c_int = 0x40000000;
938 pub const SOCK_FLAGS_MASK: ::c_int = 0xf0000000;
939 
940 pub const SO_SNDTIMEO: ::c_int = 0x100b;
941 pub const SO_RCVTIMEO: ::c_int = 0x100c;
942 pub const SO_ACCEPTFILTER: ::c_int = 0x1000;
943 pub const SO_TIMESTAMP: ::c_int = 0x2000;
944 pub const SO_OVERFLOWED: ::c_int = 0x1009;
945 pub const SO_NOHEADER: ::c_int = 0x100a;
946 
947 // https://github.com/NetBSD/src/blob/trunk/sys/net/if.h#L373
948 pub const IFF_UP: ::c_int = 0x0001; // interface is up
949 pub const IFF_BROADCAST: ::c_int = 0x0002; // broadcast address valid
950 pub const IFF_DEBUG: ::c_int = 0x0004; // turn on debugging
951 pub const IFF_LOOPBACK: ::c_int = 0x0008; // is a loopback net
952 pub const IFF_POINTOPOINT: ::c_int = 0x0010; // interface is point-to-point link
953 pub const IFF_NOTRAILERS: ::c_int = 0x0020; // avoid use of trailers
954 pub const IFF_RUNNING: ::c_int = 0x0040; // resources allocated
955 pub const IFF_NOARP: ::c_int = 0x0080; // no address resolution protocol
956 pub const IFF_PROMISC: ::c_int = 0x0100; // receive all packets
957 pub const IFF_ALLMULTI: ::c_int = 0x0200; // receive all multicast packets
958 pub const IFF_OACTIVE: ::c_int = 0x0400; // transmission in progress
959 pub const IFF_SIMPLEX: ::c_int = 0x0800; // can't hear own transmissions
960 pub const IFF_LINK0: ::c_int = 0x1000; // per link layer defined bit
961 pub const IFF_LINK1: ::c_int = 0x2000; // per link layer defined bit
962 pub const IFF_LINK2: ::c_int = 0x4000; // per link layer defined bit
963 pub const IFF_MULTICAST: ::c_int = 0x8000; // supports multicast
964 
965 // sys/netinet/in.h
966 // Protocols (RFC 1700)
967 // NOTE: These are in addition to the constants defined in src/unix/mod.rs
968 
969 // IPPROTO_IP defined in src/unix/mod.rs
970 /// Hop-by-hop option header
971 pub const IPPROTO_HOPOPTS: ::c_int = 0;
972 // IPPROTO_ICMP defined in src/unix/mod.rs
973 /// group mgmt protocol
974 pub const IPPROTO_IGMP: ::c_int = 2;
975 /// gateway^2 (deprecated)
976 pub const IPPROTO_GGP: ::c_int = 3;
977 /// for compatibility
978 pub const IPPROTO_IPIP: ::c_int = 4;
979 // IPPROTO_TCP defined in src/unix/mod.rs
980 /// exterior gateway protocol
981 pub const IPPROTO_EGP: ::c_int = 8;
982 /// pup
983 pub const IPPROTO_PUP: ::c_int = 12;
984 // IPPROTO_UDP defined in src/unix/mod.rs
985 /// xns idp
986 pub const IPPROTO_IDP: ::c_int = 22;
987 /// tp-4 w/ class negotiation
988 pub const IPPROTO_TP: ::c_int = 29;
989 /// DCCP
990 pub const IPPROTO_DCCP: ::c_int = 33;
991 // IPPROTO_IPV6 defined in src/unix/mod.rs
992 /// IP6 routing header
993 pub const IPPROTO_ROUTING: ::c_int = 43;
994 /// IP6 fragmentation header
995 pub const IPPROTO_FRAGMENT: ::c_int = 44;
996 /// resource reservation
997 pub const IPPROTO_RSVP: ::c_int = 46;
998 /// General Routing Encap.
999 pub const IPPROTO_GRE: ::c_int = 47;
1000 /// IP6 Encap Sec. Payload
1001 pub const IPPROTO_ESP: ::c_int = 50;
1002 /// IP6 Auth Header
1003 pub const IPPROTO_AH: ::c_int = 51;
1004 /// IP Mobility RFC 2004
1005 pub const IPPROTO_MOBILE: ::c_int = 55;
1006 /// IPv6 ICMP
1007 pub const IPPROTO_IPV6_ICMP: ::c_int = 58;
1008 // IPPROTO_ICMPV6 defined in src/unix/mod.rs
1009 /// IP6 no next header
1010 pub const IPPROTO_NONE: ::c_int = 59;
1011 /// IP6 destination option
1012 pub const IPPROTO_DSTOPTS: ::c_int = 60;
1013 /// ISO cnlp
1014 pub const IPPROTO_EON: ::c_int = 80;
1015 /// Ethernet-in-IP
1016 pub const IPPROTO_ETHERIP: ::c_int = 97;
1017 /// encapsulation header
1018 pub const IPPROTO_ENCAP: ::c_int = 98;
1019 /// Protocol indep. multicast
1020 pub const IPPROTO_PIM: ::c_int = 103;
1021 /// IP Payload Comp. Protocol
1022 pub const IPPROTO_IPCOMP: ::c_int = 108;
1023 /// VRRP RFC 2338
1024 pub const IPPROTO_VRRP: ::c_int = 112;
1025 /// Common Address Resolution Protocol
1026 pub const IPPROTO_CARP: ::c_int = 112;
1027 /// L2TPv3
1028 // TEMP: Disabled for now; this constant was added to NetBSD on 2017-02-16,
1029 // but isn't yet supported by the NetBSD rumprun kernel image used for
1030 // libc testing.
1031 //pub const IPPROTO_L2TP: ::c_int = 115;
1032 /// SCTP
1033 pub const IPPROTO_SCTP: ::c_int = 132;
1034 /// PFSYNC
1035 pub const IPPROTO_PFSYNC: ::c_int = 240;
1036 pub const IPPROTO_MAX: ::c_int = 256;
1037 
1038 /// last return value of *_input(), meaning "all job for this pkt is done".
1039 pub const IPPROTO_DONE: ::c_int = 257;
1040 
1041 /// sysctl placeholder for (FAST_)IPSEC
1042 pub const CTL_IPPROTO_IPSEC: ::c_int = 258;
1043 
1044 pub const AF_OROUTE: ::c_int = 17;
1045 pub const AF_ARP: ::c_int = 28;
1046 pub const pseudo_AF_KEY: ::c_int = 29;
1047 pub const pseudo_AF_HDRCMPLT: ::c_int = 30;
1048 pub const AF_BLUETOOTH: ::c_int = 31;
1049 pub const AF_IEEE80211: ::c_int = 32;
1050 pub const AF_MPLS: ::c_int = 33;
1051 pub const AF_ROUTE: ::c_int = 34;
1052 pub const NET_RT_DUMP: ::c_int = 1;
1053 pub const NET_RT_FLAGS: ::c_int = 2;
1054 pub const NET_RT_OOOIFLIST: ::c_int = 3;
1055 pub const NET_RT_OOIFLIST: ::c_int = 4;
1056 pub const NET_RT_OIFLIST: ::c_int = 5;
1057 pub const NET_RT_IFLIST: ::c_int = 6;
1058 pub const NET_RT_MAXID: ::c_int = 7;
1059 
1060 pub const PF_OROUTE: ::c_int = AF_OROUTE;
1061 pub const PF_ARP: ::c_int = AF_ARP;
1062 pub const PF_KEY: ::c_int = pseudo_AF_KEY;
1063 pub const PF_BLUETOOTH: ::c_int = AF_BLUETOOTH;
1064 pub const PF_MPLS: ::c_int = AF_MPLS;
1065 pub const PF_ROUTE: ::c_int = AF_ROUTE;
1066 
1067 pub const MSG_NBIO: ::c_int = 0x1000;
1068 pub const MSG_WAITFORONE: ::c_int = 0x2000;
1069 pub const MSG_NOTIFICATION: ::c_int = 0x4000;
1070 
1071 pub const SCM_TIMESTAMP: ::c_int = 0x08;
1072 pub const SCM_CREDS: ::c_int = 0x10;
1073 
1074 pub const O_DSYNC: ::c_int = 0x10000;
1075 
1076 pub const MAP_RENAME: ::c_int = 0x20;
1077 pub const MAP_NORESERVE: ::c_int = 0x40;
1078 pub const MAP_HASSEMAPHORE: ::c_int = 0x200;
1079 pub const MAP_WIRED: ::c_int = 0x800;
1080 
1081 pub const DCCP_TYPE_REQUEST: ::c_int = 0;
1082 pub const DCCP_TYPE_RESPONSE: ::c_int = 1;
1083 pub const DCCP_TYPE_DATA: ::c_int = 2;
1084 pub const DCCP_TYPE_ACK: ::c_int = 3;
1085 pub const DCCP_TYPE_DATAACK: ::c_int = 4;
1086 pub const DCCP_TYPE_CLOSEREQ: ::c_int = 5;
1087 pub const DCCP_TYPE_CLOSE: ::c_int = 6;
1088 pub const DCCP_TYPE_RESET: ::c_int = 7;
1089 pub const DCCP_TYPE_MOVE: ::c_int = 8;
1090 
1091 pub const DCCP_FEATURE_CC: ::c_int = 1;
1092 pub const DCCP_FEATURE_ECN: ::c_int = 2;
1093 pub const DCCP_FEATURE_ACKRATIO: ::c_int = 3;
1094 pub const DCCP_FEATURE_ACKVECTOR: ::c_int = 4;
1095 pub const DCCP_FEATURE_MOBILITY: ::c_int = 5;
1096 pub const DCCP_FEATURE_LOSSWINDOW: ::c_int = 6;
1097 pub const DCCP_FEATURE_CONN_NONCE: ::c_int = 8;
1098 pub const DCCP_FEATURE_IDENTREG: ::c_int = 7;
1099 
1100 pub const DCCP_OPT_PADDING: ::c_int = 0;
1101 pub const DCCP_OPT_DATA_DISCARD: ::c_int = 1;
1102 pub const DCCP_OPT_SLOW_RECV: ::c_int = 2;
1103 pub const DCCP_OPT_BUF_CLOSED: ::c_int = 3;
1104 pub const DCCP_OPT_CHANGE_L: ::c_int = 32;
1105 pub const DCCP_OPT_CONFIRM_L: ::c_int = 33;
1106 pub const DCCP_OPT_CHANGE_R: ::c_int = 34;
1107 pub const DCCP_OPT_CONFIRM_R: ::c_int = 35;
1108 pub const DCCP_OPT_INIT_COOKIE: ::c_int = 36;
1109 pub const DCCP_OPT_NDP_COUNT: ::c_int = 37;
1110 pub const DCCP_OPT_ACK_VECTOR0: ::c_int = 38;
1111 pub const DCCP_OPT_ACK_VECTOR1: ::c_int = 39;
1112 pub const DCCP_OPT_RECV_BUF_DROPS: ::c_int = 40;
1113 pub const DCCP_OPT_TIMESTAMP: ::c_int = 41;
1114 pub const DCCP_OPT_TIMESTAMP_ECHO: ::c_int = 42;
1115 pub const DCCP_OPT_ELAPSEDTIME: ::c_int = 43;
1116 pub const DCCP_OPT_DATACHECKSUM: ::c_int = 44;
1117 
1118 pub const DCCP_REASON_UNSPEC: ::c_int = 0;
1119 pub const DCCP_REASON_CLOSED: ::c_int = 1;
1120 pub const DCCP_REASON_INVALID: ::c_int = 2;
1121 pub const DCCP_REASON_OPTION_ERR: ::c_int = 3;
1122 pub const DCCP_REASON_FEA_ERR: ::c_int = 4;
1123 pub const DCCP_REASON_CONN_REF: ::c_int = 5;
1124 pub const DCCP_REASON_BAD_SNAME: ::c_int = 6;
1125 pub const DCCP_REASON_BAD_COOKIE: ::c_int = 7;
1126 pub const DCCP_REASON_INV_MOVE: ::c_int = 8;
1127 pub const DCCP_REASON_UNANSW_CH: ::c_int = 10;
1128 pub const DCCP_REASON_FRUITLESS_NEG: ::c_int = 11;
1129 
1130 pub const DCCP_CCID: ::c_int = 1;
1131 pub const DCCP_CSLEN: ::c_int = 2;
1132 pub const DCCP_MAXSEG: ::c_int = 4;
1133 pub const DCCP_SERVICE: ::c_int = 8;
1134 
1135 pub const DCCP_NDP_LIMIT: ::c_int = 16;
1136 pub const DCCP_SEQ_NUM_LIMIT: ::c_int = 16777216;
1137 pub const DCCP_MAX_OPTIONS: ::c_int = 32;
1138 pub const DCCP_MAX_PKTS: ::c_int = 100;
1139 
1140 pub const _PC_LINK_MAX: ::c_int = 1;
1141 pub const _PC_MAX_CANON: ::c_int = 2;
1142 pub const _PC_MAX_INPUT: ::c_int = 3;
1143 pub const _PC_NAME_MAX: ::c_int = 4;
1144 pub const _PC_PATH_MAX: ::c_int = 5;
1145 pub const _PC_PIPE_BUF: ::c_int = 6;
1146 pub const _PC_CHOWN_RESTRICTED: ::c_int = 7;
1147 pub const _PC_NO_TRUNC: ::c_int = 8;
1148 pub const _PC_VDISABLE: ::c_int = 9;
1149 pub const _PC_SYNC_IO: ::c_int = 10;
1150 pub const _PC_FILESIZEBITS: ::c_int = 11;
1151 pub const _PC_SYMLINK_MAX: ::c_int = 12;
1152 pub const _PC_2_SYMLINKS: ::c_int = 13;
1153 pub const _PC_ACL_EXTENDED: ::c_int = 14;
1154 pub const _PC_MIN_HOLE_SIZE: ::c_int = 15;
1155 
1156 pub const _SC_SYNCHRONIZED_IO: ::c_int = 31;
1157 pub const _SC_IOV_MAX: ::c_int = 32;
1158 pub const _SC_MAPPED_FILES: ::c_int = 33;
1159 pub const _SC_MEMLOCK: ::c_int = 34;
1160 pub const _SC_MEMLOCK_RANGE: ::c_int = 35;
1161 pub const _SC_MEMORY_PROTECTION: ::c_int = 36;
1162 pub const _SC_LOGIN_NAME_MAX: ::c_int = 37;
1163 pub const _SC_MONOTONIC_CLOCK: ::c_int = 38;
1164 pub const _SC_CLK_TCK: ::c_int = 39;
1165 pub const _SC_ATEXIT_MAX: ::c_int = 40;
1166 pub const _SC_THREADS: ::c_int = 41;
1167 pub const _SC_SEMAPHORES: ::c_int = 42;
1168 pub const _SC_BARRIERS: ::c_int = 43;
1169 pub const _SC_TIMERS: ::c_int = 44;
1170 pub const _SC_SPIN_LOCKS: ::c_int = 45;
1171 pub const _SC_READER_WRITER_LOCKS: ::c_int = 46;
1172 pub const _SC_GETGR_R_SIZE_MAX: ::c_int = 47;
1173 pub const _SC_GETPW_R_SIZE_MAX: ::c_int = 48;
1174 pub const _SC_CLOCK_SELECTION: ::c_int = 49;
1175 pub const _SC_ASYNCHRONOUS_IO: ::c_int = 50;
1176 pub const _SC_AIO_LISTIO_MAX: ::c_int = 51;
1177 pub const _SC_AIO_MAX: ::c_int = 52;
1178 pub const _SC_MESSAGE_PASSING: ::c_int = 53;
1179 pub const _SC_MQ_OPEN_MAX: ::c_int = 54;
1180 pub const _SC_MQ_PRIO_MAX: ::c_int = 55;
1181 pub const _SC_PRIORITY_SCHEDULING: ::c_int = 56;
1182 pub const _SC_THREAD_DESTRUCTOR_ITERATIONS: ::c_int = 57;
1183 pub const _SC_THREAD_KEYS_MAX: ::c_int = 58;
1184 pub const _SC_THREAD_STACK_MIN: ::c_int = 59;
1185 pub const _SC_THREAD_THREADS_MAX: ::c_int = 60;
1186 pub const _SC_THREAD_ATTR_STACKADDR: ::c_int = 61;
1187 pub const _SC_THREAD_ATTR_STACKSIZE: ::c_int = 62;
1188 pub const _SC_THREAD_PRIORITY_SCHEDULING: ::c_int = 63;
1189 pub const _SC_THREAD_PRIO_INHERIT: ::c_int = 64;
1190 pub const _SC_THREAD_PRIO_PROTECT: ::c_int = 65;
1191 pub const _SC_THREAD_PROCESS_SHARED: ::c_int = 66;
1192 pub const _SC_THREAD_SAFE_FUNCTIONS: ::c_int = 67;
1193 pub const _SC_TTY_NAME_MAX: ::c_int = 68;
1194 pub const _SC_HOST_NAME_MAX: ::c_int = 69;
1195 pub const _SC_PASS_MAX: ::c_int = 70;
1196 pub const _SC_REGEXP: ::c_int = 71;
1197 pub const _SC_SHELL: ::c_int = 72;
1198 pub const _SC_SYMLOOP_MAX: ::c_int = 73;
1199 pub const _SC_V6_ILP32_OFF32: ::c_int = 74;
1200 pub const _SC_V6_ILP32_OFFBIG: ::c_int = 75;
1201 pub const _SC_V6_LP64_OFF64: ::c_int = 76;
1202 pub const _SC_V6_LPBIG_OFFBIG: ::c_int = 77;
1203 pub const _SC_2_PBS: ::c_int = 80;
1204 pub const _SC_2_PBS_ACCOUNTING: ::c_int = 81;
1205 pub const _SC_2_PBS_CHECKPOINT: ::c_int = 82;
1206 pub const _SC_2_PBS_LOCATE: ::c_int = 83;
1207 pub const _SC_2_PBS_MESSAGE: ::c_int = 84;
1208 pub const _SC_2_PBS_TRACK: ::c_int = 85;
1209 pub const _SC_SPAWN: ::c_int = 86;
1210 pub const _SC_SHARED_MEMORY_OBJECTS: ::c_int = 87;
1211 pub const _SC_TIMER_MAX: ::c_int = 88;
1212 pub const _SC_SEM_NSEMS_MAX: ::c_int = 89;
1213 pub const _SC_CPUTIME: ::c_int = 90;
1214 pub const _SC_THREAD_CPUTIME: ::c_int = 91;
1215 pub const _SC_DELAYTIMER_MAX: ::c_int = 92;
1216 // These two variables will be supported in NetBSD 8.0
1217 // pub const _SC_SIGQUEUE_MAX : ::c_int = 93;
1218 // pub const _SC_REALTIME_SIGNALS : ::c_int = 94;
1219 pub const _SC_PHYS_PAGES: ::c_int = 121;
1220 pub const _SC_NPROCESSORS_CONF: ::c_int = 1001;
1221 pub const _SC_NPROCESSORS_ONLN: ::c_int = 1002;
1222 pub const _SC_SCHED_RT_TS: ::c_int = 2001;
1223 pub const _SC_SCHED_PRI_MIN: ::c_int = 2002;
1224 pub const _SC_SCHED_PRI_MAX: ::c_int = 2003;
1225 
1226 pub const FD_SETSIZE: usize = 0x100;
1227 
1228 pub const ST_NOSUID: ::c_ulong = 8;
1229 
1230 pub const BIOCGRSIG: ::c_ulong = 0x40044272;
1231 pub const BIOCSRSIG: ::c_ulong = 0x80044273;
1232 pub const BIOCSDLT: ::c_ulong = 0x80044278;
1233 pub const BIOCGSEESENT: ::c_ulong = 0x40044276;
1234 pub const BIOCSSEESENT: ::c_ulong = 0x80044277;
1235 
1236 cfg_if! {
1237     if #[cfg(any(target_arch = "sparc", target_arch = "sparc64",
1238                  target_arch = "x86", target_arch = "x86_64"))] {
1239         pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t
1240           = pthread_mutex_t {
1241             ptm_magic: 0x33330003,
1242             ptm_errorcheck: 0,
1243             ptm_pad1: [0; 3],
1244             ptm_unused: 0,
1245             ptm_pad2: [0; 3],
1246             ptm_waiters: 0 as *mut _,
1247             ptm_owner: 0,
1248             ptm_recursed: 0,
1249             ptm_spare2: 0 as *mut _,
1250         };
1251     } else {
1252         pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t
1253           = pthread_mutex_t {
1254             ptm_magic: 0x33330003,
1255             ptm_errorcheck: 0,
1256             ptm_unused: 0,
1257             ptm_waiters: 0 as *mut _,
1258             ptm_owner: 0,
1259             ptm_recursed: 0,
1260             ptm_spare2: 0 as *mut _,
1261         };
1262     }
1263 }
1264 
1265 pub const PTHREAD_COND_INITIALIZER: pthread_cond_t = pthread_cond_t {
1266     ptc_magic: 0x55550005,
1267     ptc_lock: 0,
1268     ptc_waiters_first: 0 as *mut _,
1269     ptc_waiters_last: 0 as *mut _,
1270     ptc_mutex: 0 as *mut _,
1271     ptc_private: 0 as *mut _,
1272 };
1273 pub const PTHREAD_RWLOCK_INITIALIZER: pthread_rwlock_t = pthread_rwlock_t {
1274     ptr_magic: 0x99990009,
1275     ptr_interlock: 0,
1276     ptr_rblocked_first: 0 as *mut _,
1277     ptr_rblocked_last: 0 as *mut _,
1278     ptr_wblocked_first: 0 as *mut _,
1279     ptr_wblocked_last: 0 as *mut _,
1280     ptr_nreaders: 0,
1281     ptr_owner: 0,
1282     ptr_private: 0 as *mut _,
1283 };
1284 pub const PTHREAD_MUTEX_NORMAL: ::c_int = 0;
1285 pub const PTHREAD_MUTEX_ERRORCHECK: ::c_int = 1;
1286 pub const PTHREAD_MUTEX_RECURSIVE: ::c_int = 2;
1287 pub const PTHREAD_MUTEX_DEFAULT: ::c_int = PTHREAD_MUTEX_NORMAL;
1288 
1289 pub const EVFILT_AIO: u32 = 2;
1290 pub const EVFILT_PROC: u32 = 4;
1291 pub const EVFILT_READ: u32 = 0;
1292 pub const EVFILT_SIGNAL: u32 = 5;
1293 pub const EVFILT_TIMER: u32 = 6;
1294 pub const EVFILT_VNODE: u32 = 3;
1295 pub const EVFILT_WRITE: u32 = 1;
1296 
1297 pub const EV_ADD: u32 = 0x1;
1298 pub const EV_DELETE: u32 = 0x2;
1299 pub const EV_ENABLE: u32 = 0x4;
1300 pub const EV_DISABLE: u32 = 0x8;
1301 pub const EV_ONESHOT: u32 = 0x10;
1302 pub const EV_CLEAR: u32 = 0x20;
1303 pub const EV_RECEIPT: u32 = 0x40;
1304 pub const EV_DISPATCH: u32 = 0x80;
1305 pub const EV_FLAG1: u32 = 0x2000;
1306 pub const EV_ERROR: u32 = 0x4000;
1307 pub const EV_EOF: u32 = 0x8000;
1308 pub const EV_SYSFLAGS: u32 = 0xf000;
1309 
1310 pub const NOTE_LOWAT: u32 = 0x00000001;
1311 pub const NOTE_DELETE: u32 = 0x00000001;
1312 pub const NOTE_WRITE: u32 = 0x00000002;
1313 pub const NOTE_EXTEND: u32 = 0x00000004;
1314 pub const NOTE_ATTRIB: u32 = 0x00000008;
1315 pub const NOTE_LINK: u32 = 0x00000010;
1316 pub const NOTE_RENAME: u32 = 0x00000020;
1317 pub const NOTE_REVOKE: u32 = 0x00000040;
1318 pub const NOTE_EXIT: u32 = 0x80000000;
1319 pub const NOTE_FORK: u32 = 0x40000000;
1320 pub const NOTE_EXEC: u32 = 0x20000000;
1321 pub const NOTE_PDATAMASK: u32 = 0x000fffff;
1322 pub const NOTE_PCTRLMASK: u32 = 0xf0000000;
1323 pub const NOTE_TRACK: u32 = 0x00000001;
1324 pub const NOTE_TRACKERR: u32 = 0x00000002;
1325 pub const NOTE_CHILD: u32 = 0x00000004;
1326 
1327 pub const TMP_MAX: ::c_uint = 308915776;
1328 
1329 pub const NI_MAXHOST: ::socklen_t = 1025;
1330 
1331 pub const RTLD_NOLOAD: ::c_int = 0x2000;
1332 pub const RTLD_LOCAL: ::c_int = 0x200;
1333 
1334 pub const CTL_MAXNAME: ::c_int = 12;
1335 pub const SYSCTL_NAMELEN: ::c_int = 32;
1336 pub const SYSCTL_DEFSIZE: ::c_int = 8;
1337 pub const CTLTYPE_NODE: ::c_int = 1;
1338 pub const CTLTYPE_INT: ::c_int = 2;
1339 pub const CTLTYPE_STRING: ::c_int = 3;
1340 pub const CTLTYPE_QUAD: ::c_int = 4;
1341 pub const CTLTYPE_STRUCT: ::c_int = 5;
1342 pub const CTLTYPE_BOOL: ::c_int = 6;
1343 pub const CTLFLAG_READONLY: ::c_int = 0x00000000;
1344 pub const CTLFLAG_READWRITE: ::c_int = 0x00000070;
1345 pub const CTLFLAG_ANYWRITE: ::c_int = 0x00000080;
1346 pub const CTLFLAG_PRIVATE: ::c_int = 0x00000100;
1347 pub const CTLFLAG_PERMANENT: ::c_int = 0x00000200;
1348 pub const CTLFLAG_OWNDATA: ::c_int = 0x00000400;
1349 pub const CTLFLAG_IMMEDIATE: ::c_int = 0x00000800;
1350 pub const CTLFLAG_HEX: ::c_int = 0x00001000;
1351 pub const CTLFLAG_ROOT: ::c_int = 0x00002000;
1352 pub const CTLFLAG_ANYNUMBER: ::c_int = 0x00004000;
1353 pub const CTLFLAG_HIDDEN: ::c_int = 0x00008000;
1354 pub const CTLFLAG_ALIAS: ::c_int = 0x00010000;
1355 pub const CTLFLAG_MMAP: ::c_int = 0x00020000;
1356 pub const CTLFLAG_OWNDESC: ::c_int = 0x00040000;
1357 pub const CTLFLAG_UNSIGNED: ::c_int = 0x00080000;
1358 pub const SYSCTL_VERS_MASK: ::c_int = 0xff000000;
1359 pub const SYSCTL_VERS_0: ::c_int = 0x00000000;
1360 pub const SYSCTL_VERS_1: ::c_int = 0x01000000;
1361 pub const SYSCTL_VERSION: ::c_int = SYSCTL_VERS_1;
1362 pub const CTL_EOL: ::c_int = -1;
1363 pub const CTL_QUERY: ::c_int = -2;
1364 pub const CTL_CREATE: ::c_int = -3;
1365 pub const CTL_CREATESYM: ::c_int = -4;
1366 pub const CTL_DESTROY: ::c_int = -5;
1367 pub const CTL_MMAP: ::c_int = -6;
1368 pub const CTL_DESCRIBE: ::c_int = -7;
1369 pub const CTL_UNSPEC: ::c_int = 0;
1370 pub const CTL_KERN: ::c_int = 1;
1371 pub const CTL_VM: ::c_int = 2;
1372 pub const CTL_VFS: ::c_int = 3;
1373 pub const CTL_NET: ::c_int = 4;
1374 pub const CTL_DEBUG: ::c_int = 5;
1375 pub const CTL_HW: ::c_int = 6;
1376 pub const CTL_MACHDEP: ::c_int = 7;
1377 pub const CTL_USER: ::c_int = 8;
1378 pub const CTL_DDB: ::c_int = 9;
1379 pub const CTL_PROC: ::c_int = 10;
1380 pub const CTL_VENDOR: ::c_int = 11;
1381 pub const CTL_EMUL: ::c_int = 12;
1382 pub const CTL_SECURITY: ::c_int = 13;
1383 pub const CTL_MAXID: ::c_int = 14;
1384 pub const KERN_OSTYPE: ::c_int = 1;
1385 pub const KERN_OSRELEASE: ::c_int = 2;
1386 pub const KERN_OSREV: ::c_int = 3;
1387 pub const KERN_VERSION: ::c_int = 4;
1388 pub const KERN_MAXVNODES: ::c_int = 5;
1389 pub const KERN_MAXPROC: ::c_int = 6;
1390 pub const KERN_MAXFILES: ::c_int = 7;
1391 pub const KERN_ARGMAX: ::c_int = 8;
1392 pub const KERN_SECURELVL: ::c_int = 9;
1393 pub const KERN_HOSTNAME: ::c_int = 10;
1394 pub const KERN_HOSTID: ::c_int = 11;
1395 pub const KERN_CLOCKRATE: ::c_int = 12;
1396 pub const KERN_VNODE: ::c_int = 13;
1397 pub const KERN_PROC: ::c_int = 14;
1398 pub const KERN_FILE: ::c_int = 15;
1399 pub const KERN_PROF: ::c_int = 16;
1400 pub const KERN_POSIX1: ::c_int = 17;
1401 pub const KERN_NGROUPS: ::c_int = 18;
1402 pub const KERN_JOB_CONTROL: ::c_int = 19;
1403 pub const KERN_SAVED_IDS: ::c_int = 20;
1404 pub const KERN_OBOOTTIME: ::c_int = 21;
1405 pub const KERN_DOMAINNAME: ::c_int = 22;
1406 pub const KERN_MAXPARTITIONS: ::c_int = 23;
1407 pub const KERN_RAWPARTITION: ::c_int = 24;
1408 pub const KERN_NTPTIME: ::c_int = 25;
1409 pub const KERN_TIMEX: ::c_int = 26;
1410 pub const KERN_AUTONICETIME: ::c_int = 27;
1411 pub const KERN_AUTONICEVAL: ::c_int = 28;
1412 pub const KERN_RTC_OFFSET: ::c_int = 29;
1413 pub const KERN_ROOT_DEVICE: ::c_int = 30;
1414 pub const KERN_MSGBUFSIZE: ::c_int = 31;
1415 pub const KERN_FSYNC: ::c_int = 32;
1416 pub const KERN_OLDSYSVMSG: ::c_int = 33;
1417 pub const KERN_OLDSYSVSEM: ::c_int = 34;
1418 pub const KERN_OLDSYSVSHM: ::c_int = 35;
1419 pub const KERN_OLDSHORTCORENAME: ::c_int = 36;
1420 pub const KERN_SYNCHRONIZED_IO: ::c_int = 37;
1421 pub const KERN_IOV_MAX: ::c_int = 38;
1422 pub const KERN_MBUF: ::c_int = 39;
1423 pub const KERN_MAPPED_FILES: ::c_int = 40;
1424 pub const KERN_MEMLOCK: ::c_int = 41;
1425 pub const KERN_MEMLOCK_RANGE: ::c_int = 42;
1426 pub const KERN_MEMORY_PROTECTION: ::c_int = 43;
1427 pub const KERN_LOGIN_NAME_MAX: ::c_int = 44;
1428 pub const KERN_DEFCORENAME: ::c_int = 45;
1429 pub const KERN_LOGSIGEXIT: ::c_int = 46;
1430 pub const KERN_PROC2: ::c_int = 47;
1431 pub const KERN_PROC_ARGS: ::c_int = 48;
1432 pub const KERN_FSCALE: ::c_int = 49;
1433 pub const KERN_CCPU: ::c_int = 50;
1434 pub const KERN_CP_TIME: ::c_int = 51;
1435 pub const KERN_OLDSYSVIPC_INFO: ::c_int = 52;
1436 pub const KERN_MSGBUF: ::c_int = 53;
1437 pub const KERN_CONSDEV: ::c_int = 54;
1438 pub const KERN_MAXPTYS: ::c_int = 55;
1439 pub const KERN_PIPE: ::c_int = 56;
1440 pub const KERN_MAXPHYS: ::c_int = 57;
1441 pub const KERN_SBMAX: ::c_int = 58;
1442 pub const KERN_TKSTAT: ::c_int = 59;
1443 pub const KERN_MONOTONIC_CLOCK: ::c_int = 60;
1444 pub const KERN_URND: ::c_int = 61;
1445 pub const KERN_LABELSECTOR: ::c_int = 62;
1446 pub const KERN_LABELOFFSET: ::c_int = 63;
1447 pub const KERN_LWP: ::c_int = 64;
1448 pub const KERN_FORKFSLEEP: ::c_int = 65;
1449 pub const KERN_POSIX_THREADS: ::c_int = 66;
1450 pub const KERN_POSIX_SEMAPHORES: ::c_int = 67;
1451 pub const KERN_POSIX_BARRIERS: ::c_int = 68;
1452 pub const KERN_POSIX_TIMERS: ::c_int = 69;
1453 pub const KERN_POSIX_SPIN_LOCKS: ::c_int = 70;
1454 pub const KERN_POSIX_READER_WRITER_LOCKS: ::c_int = 71;
1455 pub const KERN_DUMP_ON_PANIC: ::c_int = 72;
1456 pub const KERN_SOMAXKVA: ::c_int = 73;
1457 pub const KERN_ROOT_PARTITION: ::c_int = 74;
1458 pub const KERN_DRIVERS: ::c_int = 75;
1459 pub const KERN_BUF: ::c_int = 76;
1460 pub const KERN_FILE2: ::c_int = 77;
1461 pub const KERN_VERIEXEC: ::c_int = 78;
1462 pub const KERN_CP_ID: ::c_int = 79;
1463 pub const KERN_HARDCLOCK_TICKS: ::c_int = 80;
1464 pub const KERN_ARND: ::c_int = 81;
1465 pub const KERN_SYSVIPC: ::c_int = 82;
1466 pub const KERN_BOOTTIME: ::c_int = 83;
1467 pub const KERN_EVCNT: ::c_int = 84;
1468 pub const KERN_MAXID: ::c_int = 85;
1469 pub const KERN_PROC_ALL: ::c_int = 0;
1470 pub const KERN_PROC_PID: ::c_int = 1;
1471 pub const KERN_PROC_PGRP: ::c_int = 2;
1472 pub const KERN_PROC_SESSION: ::c_int = 3;
1473 pub const KERN_PROC_TTY: ::c_int = 4;
1474 pub const KERN_PROC_UID: ::c_int = 5;
1475 pub const KERN_PROC_RUID: ::c_int = 6;
1476 pub const KERN_PROC_GID: ::c_int = 7;
1477 pub const KERN_PROC_RGID: ::c_int = 8;
1478 pub const KERN_PROC_ARGV: ::c_int = 1;
1479 pub const KERN_PROC_NARGV: ::c_int = 2;
1480 pub const KERN_PROC_ENV: ::c_int = 3;
1481 pub const KERN_PROC_NENV: ::c_int = 4;
1482 pub const KERN_PROC_PATHNAME: ::c_int = 5;
1483 
1484 pub const EAI_AGAIN: ::c_int = 2;
1485 pub const EAI_BADFLAGS: ::c_int = 3;
1486 pub const EAI_FAIL: ::c_int = 4;
1487 pub const EAI_FAMILY: ::c_int = 5;
1488 pub const EAI_MEMORY: ::c_int = 6;
1489 pub const EAI_NODATA: ::c_int = 7;
1490 pub const EAI_NONAME: ::c_int = 8;
1491 pub const EAI_SERVICE: ::c_int = 9;
1492 pub const EAI_SOCKTYPE: ::c_int = 10;
1493 pub const EAI_SYSTEM: ::c_int = 11;
1494 pub const EAI_OVERFLOW: ::c_int = 14;
1495 
1496 pub const AIO_CANCELED: ::c_int = 1;
1497 pub const AIO_NOTCANCELED: ::c_int = 2;
1498 pub const AIO_ALLDONE: ::c_int = 3;
1499 pub const LIO_NOP: ::c_int = 0;
1500 pub const LIO_WRITE: ::c_int = 1;
1501 pub const LIO_READ: ::c_int = 2;
1502 pub const LIO_WAIT: ::c_int = 1;
1503 pub const LIO_NOWAIT: ::c_int = 0;
1504 
1505 pub const SIGEV_NONE: ::c_int = 0;
1506 pub const SIGEV_SIGNAL: ::c_int = 1;
1507 pub const SIGEV_THREAD: ::c_int = 2;
1508 
1509 pub const WSTOPPED: ::c_int = 0x00000002; // same as WUNTRACED
1510 pub const WCONTINUED: ::c_int = 0x00000010;
1511 pub const WEXITED: ::c_int = 0x000000020;
1512 pub const WNOWAIT: ::c_int = 0x00010000;
1513 
1514 pub const P_ALL: idtype_t = 0;
1515 pub const P_PID: idtype_t = 1;
1516 pub const P_PGID: idtype_t = 4;
1517 
1518 pub const UTIME_OMIT: c_long = 1073741822;
1519 pub const UTIME_NOW: c_long = 1073741823;
1520 
1521 pub const B460800: ::speed_t = 460800;
1522 pub const B921600: ::speed_t = 921600;
1523 
1524 pub const ONOCR: ::tcflag_t = 0x20;
1525 pub const ONLRET: ::tcflag_t = 0x40;
1526 pub const CDTRCTS: ::tcflag_t = 0x00020000;
1527 pub const CHWFLOW: ::tcflag_t = ::MDMBUF | ::CRTSCTS | ::CDTRCTS;
1528 
1529 // pub const _PATH_UTMPX: &[::c_char; 14] = b"/var/run/utmpx";
1530 // pub const _PATH_WTMPX: &[::c_char; 14] = b"/var/log/wtmpx";
1531 // pub const _PATH_LASTLOGX: &[::c_char; 17] = b"/var/log/lastlogx";
1532 // pub const _PATH_UTMP_UPDATE: &[::c_char; 24] = b"/usr/libexec/utmp_update";
1533 pub const UT_NAMESIZE: usize = 8;
1534 pub const UT_LINESIZE: usize = 8;
1535 pub const UT_HOSTSIZE: usize = 16;
1536 pub const _UTX_USERSIZE: usize = 32;
1537 pub const _UTX_LINESIZE: usize = 32;
1538 pub const _UTX_PADSIZE: usize = 40;
1539 pub const _UTX_IDSIZE: usize = 4;
1540 pub const _UTX_HOSTSIZE: usize = 256;
1541 pub const EMPTY: u16 = 0;
1542 pub const RUN_LVL: u16 = 1;
1543 pub const BOOT_TIME: u16 = 2;
1544 pub const OLD_TIME: u16 = 3;
1545 pub const NEW_TIME: u16 = 4;
1546 pub const INIT_PROCESS: u16 = 5;
1547 pub const LOGIN_PROCESS: u16 = 6;
1548 pub const USER_PROCESS: u16 = 7;
1549 pub const DEAD_PROCESS: u16 = 8;
1550 pub const ACCOUNTING: u16 = 9;
1551 pub const SIGNATURE: u16 = 10;
1552 pub const DOWN_TIME: u16 = 11;
1553 
1554 pub const SOCK_CLOEXEC: ::c_int = 0x10000000;
1555 pub const SOCK_NONBLOCK: ::c_int = 0x20000000;
1556 
1557 // Uncomment on next NetBSD release
1558 // pub const FIOSEEKDATA: ::c_ulong = 0xc0086661;
1559 // pub const FIOSEEKHOLE: ::c_ulong = 0xc0086662;
1560 pub const OFIOGETBMAP: ::c_ulong = 0xc004667a;
1561 pub const FIOGETBMAP: ::c_ulong = 0xc008667a;
1562 pub const FIONWRITE: ::c_ulong = 0x40046679;
1563 pub const FIONSPACE: ::c_ulong = 0x40046678;
1564 pub const FIBMAP: ::c_ulong = 0xc008667a;
1565 
1566 pub const SIGSTKSZ: ::size_t = 40960;
1567 
1568 pub const PT_DUMPCORE: ::c_int = 12;
1569 pub const PT_LWPINFO: ::c_int = 13;
1570 pub const PT_SYSCALL: ::c_int = 14;
1571 pub const PT_SYSCALLEMU: ::c_int = 15;
1572 pub const PT_SET_EVENT_MASK: ::c_int = 16;
1573 pub const PT_GET_EVENT_MASK: ::c_int = 17;
1574 pub const PT_GET_PROCESS_STATE: ::c_int = 18;
1575 pub const PT_FIRSTMACH: ::c_int = 32;
1576 
1577 // Flags for chflags(2)
1578 pub const SF_SNAPSHOT: ::c_ulong = 0x00200000;
1579 pub const SF_LOG: ::c_ulong = 0x00400000;
1580 pub const SF_SNAPINVAL: ::c_ulong = 0x00800000;
1581 
_ALIGN(p: usize) -> usize1582 fn _ALIGN(p: usize) -> usize {
1583     (p + _ALIGNBYTES) & !_ALIGNBYTES
1584 }
1585 
1586 f! {
1587     pub fn CMSG_DATA(cmsg: *const ::cmsghdr) -> *mut ::c_uchar {
1588         (cmsg as *mut ::c_uchar)
1589             .offset(_ALIGN(::mem::size_of::<::cmsghdr>()) as isize)
1590     }
1591 
1592     pub fn CMSG_LEN(length: ::c_uint) -> ::c_uint {
1593         _ALIGN(::mem::size_of::<::cmsghdr>()) as ::c_uint + length
1594     }
1595 
1596     pub fn CMSG_NXTHDR(mhdr: *const ::msghdr, cmsg: *const ::cmsghdr)
1597         -> *mut ::cmsghdr
1598     {
1599         if cmsg.is_null() {
1600             return ::CMSG_FIRSTHDR(mhdr);
1601         };
1602         let next = cmsg as usize + _ALIGN((*cmsg).cmsg_len as usize)
1603             + _ALIGN(::mem::size_of::<::cmsghdr>());
1604         let max = (*mhdr).msg_control as usize
1605             + (*mhdr).msg_controllen as usize;
1606         if next > max {
1607             0 as *mut ::cmsghdr
1608         } else {
1609             (cmsg as usize + _ALIGN((*cmsg).cmsg_len as usize))
1610                 as *mut ::cmsghdr
1611         }
1612     }
1613 
1614     pub fn CMSG_SPACE(length: ::c_uint) -> ::c_uint {
1615         (_ALIGN(::mem::size_of::<::cmsghdr>()) + _ALIGN(length as usize))
1616             as ::c_uint
1617     }
1618 
1619     pub fn WSTOPSIG(status: ::c_int) -> ::c_int {
1620         status >> 8
1621     }
1622 
1623     pub fn WIFSIGNALED(status: ::c_int) -> bool {
1624         (status & 0o177) != 0o177 && (status & 0o177) != 0
1625     }
1626 
1627     pub fn WIFSTOPPED(status: ::c_int) -> bool {
1628         (status & 0o177) == 0o177
1629     }
1630 
1631     // dirfd() is a macro on netbsd to access
1632     // the first field of the struct where dirp points to:
1633     // http://cvsweb.netbsd.org/bsdweb.cgi/src/include/dirent.h?rev=1.36
1634     pub fn dirfd(dirp: *mut ::DIR) -> ::c_int {
1635         *(dirp as *const ::c_int)
1636     }
1637 
1638     pub fn WIFCONTINUED(status: ::c_int) -> bool {
1639         status == 0xffff
1640     }
1641 
1642     pub fn SOCKCREDSIZE(ngrps: usize) -> usize {
1643         let ngrps = if ngrps > 0 {
1644             ngrps - 1
1645         } else {
1646             0
1647         };
1648         ::mem::size_of::<sockcred>() + ::mem::size_of::<::gid_t>() * ngrps
1649     }
1650 }
1651 
1652 #[link(name = "rt")]
1653 extern "C" {
aio_read(aiocbp: *mut aiocb) -> ::c_int1654     pub fn aio_read(aiocbp: *mut aiocb) -> ::c_int;
aio_write(aiocbp: *mut aiocb) -> ::c_int1655     pub fn aio_write(aiocbp: *mut aiocb) -> ::c_int;
aio_fsync(op: ::c_int, aiocbp: *mut aiocb) -> ::c_int1656     pub fn aio_fsync(op: ::c_int, aiocbp: *mut aiocb) -> ::c_int;
aio_error(aiocbp: *const aiocb) -> ::c_int1657     pub fn aio_error(aiocbp: *const aiocb) -> ::c_int;
aio_return(aiocbp: *mut aiocb) -> ::ssize_t1658     pub fn aio_return(aiocbp: *mut aiocb) -> ::ssize_t;
1659     #[link_name = "__aio_suspend50"]
aio_suspend( aiocb_list: *const *const aiocb, nitems: ::c_int, timeout: *const ::timespec, ) -> ::c_int1660     pub fn aio_suspend(
1661         aiocb_list: *const *const aiocb,
1662         nitems: ::c_int,
1663         timeout: *const ::timespec,
1664     ) -> ::c_int;
aio_cancel(fd: ::c_int, aiocbp: *mut aiocb) -> ::c_int1665     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_int1666     pub fn lio_listio(
1667         mode: ::c_int,
1668         aiocb_list: *const *mut aiocb,
1669         nitems: ::c_int,
1670         sevp: *mut sigevent,
1671     ) -> ::c_int;
1672 }
1673 
1674 extern "C" {
chflags(path: *const ::c_char, flags: ::c_ulong) -> ::c_int1675     pub fn chflags(path: *const ::c_char, flags: ::c_ulong) -> ::c_int;
fchflags(fd: ::c_int, flags: ::c_ulong) -> ::c_int1676     pub fn fchflags(fd: ::c_int, flags: ::c_ulong) -> ::c_int;
lchflags(path: *const ::c_char, flags: ::c_ulong) -> ::c_int1677     pub fn lchflags(path: *const ::c_char, flags: ::c_ulong) -> ::c_int;
1678 
extattr_delete_fd( fd: ::c_int, attrnamespace: ::c_int, attrname: *const ::c_char, ) -> ::c_int1679     pub fn extattr_delete_fd(
1680         fd: ::c_int,
1681         attrnamespace: ::c_int,
1682         attrname: *const ::c_char,
1683     ) -> ::c_int;
extattr_delete_file( path: *const ::c_char, attrnamespace: ::c_int, attrname: *const ::c_char, ) -> ::c_int1684     pub fn extattr_delete_file(
1685         path: *const ::c_char,
1686         attrnamespace: ::c_int,
1687         attrname: *const ::c_char,
1688     ) -> ::c_int;
extattr_delete_link( path: *const ::c_char, attrnamespace: ::c_int, attrname: *const ::c_char, ) -> ::c_int1689     pub fn extattr_delete_link(
1690         path: *const ::c_char,
1691         attrnamespace: ::c_int,
1692         attrname: *const ::c_char,
1693     ) -> ::c_int;
extattr_get_fd( fd: ::c_int, attrnamespace: ::c_int, attrname: *const ::c_char, data: *mut ::c_void, nbytes: ::size_t, ) -> ::ssize_t1694     pub fn extattr_get_fd(
1695         fd: ::c_int,
1696         attrnamespace: ::c_int,
1697         attrname: *const ::c_char,
1698         data: *mut ::c_void,
1699         nbytes: ::size_t,
1700     ) -> ::ssize_t;
extattr_get_file( path: *const ::c_char, attrnamespace: ::c_int, attrname: *const ::c_char, data: *mut ::c_void, nbytes: ::size_t, ) -> ::ssize_t1701     pub fn extattr_get_file(
1702         path: *const ::c_char,
1703         attrnamespace: ::c_int,
1704         attrname: *const ::c_char,
1705         data: *mut ::c_void,
1706         nbytes: ::size_t,
1707     ) -> ::ssize_t;
extattr_get_link( path: *const ::c_char, attrnamespace: ::c_int, attrname: *const ::c_char, data: *mut ::c_void, nbytes: ::size_t, ) -> ::ssize_t1708     pub fn extattr_get_link(
1709         path: *const ::c_char,
1710         attrnamespace: ::c_int,
1711         attrname: *const ::c_char,
1712         data: *mut ::c_void,
1713         nbytes: ::size_t,
1714     ) -> ::ssize_t;
extattr_namespace_to_string( attrnamespace: ::c_int, string: *mut *mut ::c_char, ) -> ::c_int1715     pub fn extattr_namespace_to_string(
1716         attrnamespace: ::c_int,
1717         string: *mut *mut ::c_char,
1718     ) -> ::c_int;
extattr_set_fd( fd: ::c_int, attrnamespace: ::c_int, attrname: *const ::c_char, data: *const ::c_void, nbytes: ::size_t, ) -> ::c_int1719     pub fn extattr_set_fd(
1720         fd: ::c_int,
1721         attrnamespace: ::c_int,
1722         attrname: *const ::c_char,
1723         data: *const ::c_void,
1724         nbytes: ::size_t,
1725     ) -> ::c_int;
extattr_set_file( path: *const ::c_char, attrnamespace: ::c_int, attrname: *const ::c_char, data: *const ::c_void, nbytes: ::size_t, ) -> ::c_int1726     pub fn extattr_set_file(
1727         path: *const ::c_char,
1728         attrnamespace: ::c_int,
1729         attrname: *const ::c_char,
1730         data: *const ::c_void,
1731         nbytes: ::size_t,
1732     ) -> ::c_int;
extattr_set_link( path: *const ::c_char, attrnamespace: ::c_int, attrname: *const ::c_char, data: *const ::c_void, nbytes: ::size_t, ) -> ::c_int1733     pub fn extattr_set_link(
1734         path: *const ::c_char,
1735         attrnamespace: ::c_int,
1736         attrname: *const ::c_char,
1737         data: *const ::c_void,
1738         nbytes: ::size_t,
1739     ) -> ::c_int;
extattr_string_to_namespace( string: *const ::c_char, attrnamespace: *mut ::c_int, ) -> ::c_int1740     pub fn extattr_string_to_namespace(
1741         string: *const ::c_char,
1742         attrnamespace: *mut ::c_int,
1743     ) -> ::c_int;
1744 
1745     #[link_name = "__lutimes50"]
lutimes(file: *const ::c_char, times: *const ::timeval) -> ::c_int1746     pub fn lutimes(file: *const ::c_char, times: *const ::timeval) -> ::c_int;
1747     #[link_name = "__gettimeofday50"]
gettimeofday(tp: *mut ::timeval, tz: *mut ::c_void) -> ::c_int1748     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_int1749     pub fn getnameinfo(
1750         sa: *const ::sockaddr,
1751         salen: ::socklen_t,
1752         host: *mut ::c_char,
1753         hostlen: ::socklen_t,
1754         serv: *mut ::c_char,
1755         sevlen: ::socklen_t,
1756         flags: ::c_int,
1757     ) -> ::c_int;
mprotect( addr: *mut ::c_void, len: ::size_t, prot: ::c_int, ) -> ::c_int1758     pub fn mprotect(
1759         addr: *mut ::c_void,
1760         len: ::size_t,
1761         prot: ::c_int,
1762     ) -> ::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_int1763     pub fn sysctl(
1764         name: *const ::c_int,
1765         namelen: ::c_uint,
1766         oldp: *mut ::c_void,
1767         oldlenp: *mut ::size_t,
1768         newp: *const ::c_void,
1769         newlen: ::size_t,
1770     ) -> ::c_int;
sysctlbyname( name: *const ::c_char, oldp: *mut ::c_void, oldlenp: *mut ::size_t, newp: *const ::c_void, newlen: ::size_t, ) -> ::c_int1771     pub fn sysctlbyname(
1772         name: *const ::c_char,
1773         oldp: *mut ::c_void,
1774         oldlenp: *mut ::size_t,
1775         newp: *const ::c_void,
1776         newlen: ::size_t,
1777     ) -> ::c_int;
1778     #[link_name = "__kevent50"]
kevent( kq: ::c_int, changelist: *const ::kevent, nchanges: ::size_t, eventlist: *mut ::kevent, nevents: ::size_t, timeout: *const ::timespec, ) -> ::c_int1779     pub fn kevent(
1780         kq: ::c_int,
1781         changelist: *const ::kevent,
1782         nchanges: ::size_t,
1783         eventlist: *mut ::kevent,
1784         nevents: ::size_t,
1785         timeout: *const ::timespec,
1786     ) -> ::c_int;
1787     #[link_name = "__mount50"]
mount( src: *const ::c_char, target: *const ::c_char, flags: ::c_int, data: *mut ::c_void, size: ::size_t, ) -> ::c_int1788     pub fn mount(
1789         src: *const ::c_char,
1790         target: *const ::c_char,
1791         flags: ::c_int,
1792         data: *mut ::c_void,
1793         size: ::size_t,
1794     ) -> ::c_int;
mq_open(name: *const ::c_char, oflag: ::c_int, ...) -> ::mqd_t1795     pub fn mq_open(name: *const ::c_char, oflag: ::c_int, ...) -> ::mqd_t;
mq_close(mqd: ::mqd_t) -> ::c_int1796     pub fn mq_close(mqd: ::mqd_t) -> ::c_int;
mq_getattr(mqd: ::mqd_t, attr: *mut ::mq_attr) -> ::c_int1797     pub fn mq_getattr(mqd: ::mqd_t, attr: *mut ::mq_attr) -> ::c_int;
mq_notify(mqd: ::mqd_t, notification: *const ::sigevent) -> ::c_int1798     pub fn mq_notify(mqd: ::mqd_t, notification: *const ::sigevent)
1799         -> ::c_int;
mq_receive( mqd: ::mqd_t, msg_ptr: *mut ::c_char, msg_len: ::size_t, msg_prio: *mut ::c_uint, ) -> ::ssize_t1800     pub fn mq_receive(
1801         mqd: ::mqd_t,
1802         msg_ptr: *mut ::c_char,
1803         msg_len: ::size_t,
1804         msg_prio: *mut ::c_uint,
1805     ) -> ::ssize_t;
mq_send( mqd: ::mqd_t, msg_ptr: *const ::c_char, msg_len: ::size_t, msg_prio: ::c_uint, ) -> ::c_int1806     pub fn mq_send(
1807         mqd: ::mqd_t,
1808         msg_ptr: *const ::c_char,
1809         msg_len: ::size_t,
1810         msg_prio: ::c_uint,
1811     ) -> ::c_int;
mq_setattr( mqd: ::mqd_t, newattr: *const ::mq_attr, oldattr: *mut ::mq_attr, ) -> ::c_int1812     pub fn mq_setattr(
1813         mqd: ::mqd_t,
1814         newattr: *const ::mq_attr,
1815         oldattr: *mut ::mq_attr,
1816     ) -> ::c_int;
1817     #[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_t1818     pub fn mq_timedreceive(
1819         mqd: ::mqd_t,
1820         msg_ptr: *mut ::c_char,
1821         msg_len: ::size_t,
1822         msg_prio: *mut ::c_uint,
1823         abs_timeout: *const ::timespec,
1824     ) -> ::ssize_t;
1825     #[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_int1826     pub fn mq_timedsend(
1827         mqd: ::mqd_t,
1828         msg_ptr: *const ::c_char,
1829         msg_len: ::size_t,
1830         msg_prio: ::c_uint,
1831         abs_timeout: *const ::timespec,
1832     ) -> ::c_int;
mq_unlink(name: *const ::c_char) -> ::c_int1833     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_int1834     pub fn ptrace(
1835         request: ::c_int,
1836         pid: ::pid_t,
1837         addr: *mut ::c_void,
1838         data: ::c_int,
1839     ) -> ::c_int;
pthread_setname_np( t: ::pthread_t, name: *const ::c_char, arg: *const ::c_void, ) -> ::c_int1840     pub fn pthread_setname_np(
1841         t: ::pthread_t,
1842         name: *const ::c_char,
1843         arg: *const ::c_void,
1844     ) -> ::c_int;
pthread_attr_get_np( thread: ::pthread_t, attr: *mut ::pthread_attr_t, ) -> ::c_int1845     pub fn pthread_attr_get_np(
1846         thread: ::pthread_t,
1847         attr: *mut ::pthread_attr_t,
1848     ) -> ::c_int;
pthread_getattr_np( native: ::pthread_t, attr: *mut ::pthread_attr_t, ) -> ::c_int1849     pub fn pthread_getattr_np(
1850         native: ::pthread_t,
1851         attr: *mut ::pthread_attr_t,
1852     ) -> ::c_int;
pthread_attr_getguardsize( attr: *const ::pthread_attr_t, guardsize: *mut ::size_t, ) -> ::c_int1853     pub fn pthread_attr_getguardsize(
1854         attr: *const ::pthread_attr_t,
1855         guardsize: *mut ::size_t,
1856     ) -> ::c_int;
pthread_attr_getstack( attr: *const ::pthread_attr_t, stackaddr: *mut *mut ::c_void, stacksize: *mut ::size_t, ) -> ::c_int1857     pub fn pthread_attr_getstack(
1858         attr: *const ::pthread_attr_t,
1859         stackaddr: *mut *mut ::c_void,
1860         stacksize: *mut ::size_t,
1861     ) -> ::c_int;
1862     #[link_name = "__sigtimedwait50"]
sigtimedwait( set: *const sigset_t, info: *mut siginfo_t, timeout: *const ::timespec, ) -> ::c_int1863     pub fn sigtimedwait(
1864         set: *const sigset_t,
1865         info: *mut siginfo_t,
1866         timeout: *const ::timespec,
1867     ) -> ::c_int;
sigwaitinfo(set: *const sigset_t, info: *mut siginfo_t) -> ::c_int1868     pub fn sigwaitinfo(set: *const sigset_t, info: *mut siginfo_t) -> ::c_int;
duplocale(base: ::locale_t) -> ::locale_t1869     pub fn duplocale(base: ::locale_t) -> ::locale_t;
freelocale(loc: ::locale_t)1870     pub fn freelocale(loc: ::locale_t);
localeconv_l(loc: ::locale_t) -> *mut lconv1871     pub fn localeconv_l(loc: ::locale_t) -> *mut lconv;
newlocale( mask: ::c_int, locale: *const ::c_char, base: ::locale_t, ) -> ::locale_t1872     pub fn newlocale(
1873         mask: ::c_int,
1874         locale: *const ::c_char,
1875         base: ::locale_t,
1876     ) -> ::locale_t;
1877     #[link_name = "__settimeofday50"]
settimeofday(tv: *const ::timeval, tz: *const ::c_void) -> ::c_int1878     pub fn settimeofday(tv: *const ::timeval, tz: *const ::c_void) -> ::c_int;
1879 
dup3(src: ::c_int, dst: ::c_int, flags: ::c_int) -> ::c_int1880     pub fn dup3(src: ::c_int, dst: ::c_int, flags: ::c_int) -> ::c_int;
1881 
sendmmsg( sockfd: ::c_int, msgvec: *mut ::mmsghdr, vlen: ::c_uint, flags: ::c_int, ) -> ::c_int1882     pub fn sendmmsg(
1883         sockfd: ::c_int,
1884         msgvec: *mut ::mmsghdr,
1885         vlen: ::c_uint,
1886         flags: ::c_int,
1887     ) -> ::c_int;
recvmmsg( sockfd: ::c_int, msgvec: *mut ::mmsghdr, vlen: ::c_uint, flags: ::c_int, timeout: *mut ::timespec, ) -> ::c_int1888     pub fn recvmmsg(
1889         sockfd: ::c_int,
1890         msgvec: *mut ::mmsghdr,
1891         vlen: ::c_uint,
1892         flags: ::c_int,
1893         timeout: *mut ::timespec,
1894     ) -> ::c_int;
1895 
_lwp_self() -> lwpid_t1896     pub fn _lwp_self() -> lwpid_t;
1897 }
1898 
1899 #[link(name = "util")]
1900 extern "C" {
1901     #[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_int1902     pub fn getpwent_r(
1903         pwd: *mut ::passwd,
1904         buf: *mut ::c_char,
1905         buflen: ::size_t,
1906         result: *mut *mut ::passwd,
1907     ) -> ::c_int;
getgrent_r( grp: *mut ::group, buf: *mut ::c_char, buflen: ::size_t, result: *mut *mut ::group, ) -> ::c_int1908     pub fn getgrent_r(
1909         grp: *mut ::group,
1910         buf: *mut ::c_char,
1911         buflen: ::size_t,
1912         result: *mut *mut ::group,
1913     ) -> ::c_int;
1914 
updwtmpx(file: *const ::c_char, ut: *const utmpx) -> ::c_int1915     pub fn updwtmpx(file: *const ::c_char, ut: *const utmpx) -> ::c_int;
getlastlogx( fname: *const ::c_char, uid: ::uid_t, ll: *mut lastlogx, ) -> *mut lastlogx1916     pub fn getlastlogx(
1917         fname: *const ::c_char,
1918         uid: ::uid_t,
1919         ll: *mut lastlogx,
1920     ) -> *mut lastlogx;
updlastlogx( fname: *const ::c_char, uid: ::uid_t, ll: *mut lastlogx, ) -> ::c_int1921     pub fn updlastlogx(
1922         fname: *const ::c_char,
1923         uid: ::uid_t,
1924         ll: *mut lastlogx,
1925     ) -> ::c_int;
utmpxname(file: *const ::c_char) -> ::c_int1926     pub fn utmpxname(file: *const ::c_char) -> ::c_int;
getutxent() -> *mut utmpx1927     pub fn getutxent() -> *mut utmpx;
getutxid(ut: *const utmpx) -> *mut utmpx1928     pub fn getutxid(ut: *const utmpx) -> *mut utmpx;
getutxline(ut: *const utmpx) -> *mut utmpx1929     pub fn getutxline(ut: *const utmpx) -> *mut utmpx;
pututxline(ut: *const utmpx) -> *mut utmpx1930     pub fn pututxline(ut: *const utmpx) -> *mut utmpx;
setutxent()1931     pub fn setutxent();
endutxent()1932     pub fn endutxent();
1933 
getutmp(ux: *const utmpx, u: *mut utmp)1934     pub fn getutmp(ux: *const utmpx, u: *mut utmp);
getutmpx(u: *const utmp, ux: *mut utmpx)1935     pub fn getutmpx(u: *const utmp, ux: *mut utmpx);
1936 
utpname(file: *const ::c_char) -> ::c_int1937     pub fn utpname(file: *const ::c_char) -> ::c_int;
setutent()1938     pub fn setutent();
endutent()1939     pub fn endutent();
getutent() -> *mut utmp1940     pub fn getutent() -> *mut utmp;
1941 }
1942 
1943 cfg_if! {
1944     if #[cfg(target_arch = "aarch64")] {
1945         mod aarch64;
1946         pub use self::aarch64::*;
1947     } else if #[cfg(target_arch = "arm")] {
1948         mod arm;
1949         pub use self::arm::*;
1950     } else if #[cfg(target_arch = "powerpc")] {
1951         mod powerpc;
1952         pub use self::powerpc::*;
1953     } else if #[cfg(target_arch = "sparc64")] {
1954         mod sparc64;
1955         pub use self::sparc64::*;
1956     } else if #[cfg(target_arch = "x86_64")] {
1957         mod x86_64;
1958         pub use self::x86_64::*;
1959     } else if #[cfg(target_arch = "x86")] {
1960         mod x86;
1961         pub use self::x86::*;
1962     } else {
1963         // Unknown target_arch
1964     }
1965 }
1966