]> git.proxmox.com Git - rustc.git/blame - vendor/libc/src/unix/bsd/netbsdlike/netbsd/mod.rs
New upstream version 1.46.0+dfsg1
[rustc.git] / vendor / libc / src / unix / bsd / netbsdlike / netbsd / mod.rs
CommitLineData
476ff2be
SL
1pub type clock_t = ::c_uint;
2pub type suseconds_t = ::c_int;
3pub type dev_t = u64;
416331ca
XL
4pub type blksize_t = i32;
5pub type fsblkcnt_t = u64;
6pub type fsfilcnt_t = u64;
8bb4bdeb 7pub type idtype_t = ::c_int;
2c00a5a8 8pub type mqd_t = ::c_int;
69743fb6 9type __pthread_spin_t = __cpu_simple_lock_nv_t;
532ac7d7 10pub type vm_size_t = ::uintptr_t;
e74abb32 11pub type lwpid_t = ::c_uint;
dfeec247 12pub type shmatt_t = ::c_uint;
476ff2be 13
416331ca
XL
14impl siginfo_t {
15 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
476ff2be 30s! {
8bb4bdeb
XL
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
476ff2be
SL
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
2c00a5a8
XL
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
476ff2be
SL
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,
416331ca
XL
90 pub st_flags: u32,
91 pub st_gen: u32,
92 pub st_spare: [u32; 2],
476ff2be
SL
93 }
94
532ac7d7 95 pub struct addrinfo {
476ff2be
SL
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
476ff2be
SL
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,
69743fb6
XL
123 ptm_errorcheck: __pthread_spin_t,
124 #[cfg(any(target_arch = "sparc", target_arch = "sparc64",
125 target_arch = "x86", target_arch = "x86_64"))]
476ff2be 126 ptm_pad1: [u8; 3],
69743fb6
XL
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"))]
476ff2be
SL
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
041b39d2
XL
143 pub struct pthread_rwlockattr_t {
144 ptra_magic: ::c_uint,
145 ptra_private: *mut ::c_void,
146 }
147
476ff2be
SL
148 pub struct pthread_cond_t {
149 ptc_magic: ::c_uint,
69743fb6 150 ptc_lock: __pthread_spin_t,
476ff2be
SL
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,
69743fb6 164 ptr_interlock: __pthread_spin_t,
476ff2be
SL
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,
416331ca
XL
176 pub filter: u32,
177 pub flags: u32,
178 pub fflags: u32,
179 pub data: i64,
476ff2be
SL
180 pub udata: ::intptr_t,
181 }
182
183 pub struct dqblk {
416331ca
XL
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,
476ff2be
SL
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 }
3b2f2976
XL
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 }
2c00a5a8
XL
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,
416331ca
XL
274 pub sdl_type: u8,
275 pub sdl_nlen: u8,
276 pub sdl_alen: u8,
277 pub sdl_slen: u8,
2c00a5a8
XL
278 pub sdl_data: [::c_char; 12],
279 }
8faf50e0 280
532ac7d7
XL
281 pub struct mmsghdr {
282 pub msg_hdr: ::msghdr,
283 pub msg_len: ::c_uint,
284 }
dfeec247
XL
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 }
ba9703b0
XL
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
532ac7d7
XL
344}
345
346s_no_extra_traits! {
dfeec247
XL
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
8faf50e0
XL
369 pub struct in_pktinfo {
370 pub ipi_addr: ::in_addr,
371 pub ipi_ifindex: ::c_uint,
372 }
b7449926
XL
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 }
532ac7d7
XL
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,
416331ca 398 pub sin_zero: [i8; 8],
532ac7d7
XL
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
416331ca
XL
425 pub f_syncreads: u64,
426 pub f_syncwrites: u64,
532ac7d7 427
416331ca
XL
428 pub f_asyncreads: u64,
429 pub f_asyncwrites: u64,
532ac7d7
XL
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
416331ca 436 pub f_spare: [u32; 4],
532ac7d7
XL
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 }
416331ca
XL
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 }
532ac7d7
XL
458}
459
460cfg_if! {
461 if #[cfg(feature = "extra_traits")] {
dfeec247
XL
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
532ac7d7
XL
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 }
416331ca
XL
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 }
532ac7d7 885 }
476ff2be
SL
886}
887
7cac9316
XL
888pub const AT_FDCWD: ::c_int = -100;
889pub const AT_EACCESS: ::c_int = 0x100;
890pub const AT_SYMLINK_NOFOLLOW: ::c_int = 0x200;
891pub const AT_SYMLINK_FOLLOW: ::c_int = 0x400;
892pub const AT_REMOVEDIR: ::c_int = 0x800;
893
69743fb6
XL
894pub const EXTATTR_NAMESPACE_USER: ::c_int = 1;
895pub const EXTATTR_NAMESPACE_SYSTEM: ::c_int = 2;
896
ba9703b0
XL
897pub const LC_COLLATE_MASK: ::c_int = 1 << ::LC_COLLATE;
898pub const LC_CTYPE_MASK: ::c_int = 1 << ::LC_CTYPE;
899pub const LC_MONETARY_MASK: ::c_int = 1 << ::LC_MONETARY;
900pub const LC_NUMERIC_MASK: ::c_int = 1 << ::LC_NUMERIC;
901pub const LC_TIME_MASK: ::c_int = 1 << ::LC_TIME;
902pub const LC_MESSAGES_MASK: ::c_int = 1 << ::LC_MESSAGES;
476ff2be
SL
903pub const LC_ALL_MASK: ::c_int = !0;
904
905pub const ERA: ::nl_item = 52;
906pub const ERA_D_FMT: ::nl_item = 53;
907pub const ERA_D_T_FMT: ::nl_item = 54;
908pub const ERA_T_FMT: ::nl_item = 55;
909pub const ALT_DIGITS: ::nl_item = 56;
910
911pub const O_CLOEXEC: ::c_int = 0x400000;
912pub const O_ALT_IO: ::c_int = 0x40000;
913pub const O_NOSIGPIPE: ::c_int = 0x1000000;
914pub const O_SEARCH: ::c_int = 0x800000;
476ff2be 915pub const O_DIRECTORY: ::c_int = 0x200000;
e74abb32
XL
916pub const O_DIRECT: ::c_int = 0x00080000;
917pub const O_RSYNC: ::c_int = 0x00020000;
476ff2be 918
e74abb32
XL
919pub const MS_SYNC: ::c_int = 0x4;
920pub const MS_INVALIDATE: ::c_int = 0x2;
476ff2be 921
e74abb32 922#[deprecated(since = "0.2.64", note = "Not stable across OS versions")]
476ff2be
SL
923pub const RLIM_NLIMITS: ::c_int = 12;
924
2c00a5a8
XL
925pub const EIDRM: ::c_int = 82;
926pub const ENOMSG: ::c_int = 83;
927pub const EOVERFLOW: ::c_int = 84;
928pub const EILSEQ: ::c_int = 85;
929pub const ENOTSUP: ::c_int = 86;
930pub const ECANCELED: ::c_int = 87;
931pub const EBADMSG: ::c_int = 88;
932pub const ENODATA: ::c_int = 89;
933pub const ENOSR: ::c_int = 90;
934pub const ENOSTR: ::c_int = 91;
935pub const ETIME: ::c_int = 92;
936pub const ENOATTR: ::c_int = 93;
937pub const EMULTIHOP: ::c_int = 94;
938pub const ENOLINK: ::c_int = 95;
939pub const EPROTO: ::c_int = 96;
940pub const ELAST: ::c_int = 96;
476ff2be 941
e74abb32 942pub const F_DUPFD_CLOEXEC: ::c_int = 12;
476ff2be
SL
943pub const F_CLOSEM: ::c_int = 10;
944pub const F_GETNOSIGPIPE: ::c_int = 13;
945pub const F_SETNOSIGPIPE: ::c_int = 14;
946pub const F_MAXFD: ::c_int = 11;
947
0731742a
XL
948pub const IP_RECVDSTADDR: ::c_int = 7;
949pub const IP_SENDSRCADDR: ::c_int = IP_RECVDSTADDR;
950pub const IP_RECVIF: ::c_int = 20;
8faf50e0
XL
951pub const IP_PKTINFO: ::c_int = 25;
952pub const IP_RECVPKTINFO: ::c_int = 26;
476ff2be
SL
953pub const IPV6_JOIN_GROUP: ::c_int = 12;
954pub const IPV6_LEAVE_GROUP: ::c_int = 13;
955
e74abb32 956pub const TCP_KEEPIDLE: ::c_int = 3;
b7449926 957pub const TCP_KEEPINTVL: ::c_int = 5;
e74abb32
XL
958pub const TCP_KEEPCNT: ::c_int = 6;
959pub const TCP_KEEPINIT: ::c_int = 7;
960pub const TCP_INFO: ::c_int = 9;
961pub const TCP_MD5SIG: ::c_int = 0x10;
962pub const TCP_CONGCTL: ::c_int = 0x20;
b7449926 963
8bb4bdeb
XL
964pub const SOCK_CONN_DGRAM: ::c_int = 6;
965pub const SOCK_DCCP: ::c_int = SOCK_CONN_DGRAM;
966pub const SOCK_NOSIGPIPE: ::c_int = 0x40000000;
967pub const SOCK_FLAGS_MASK: ::c_int = 0xf0000000;
968
476ff2be
SL
969pub const SO_SNDTIMEO: ::c_int = 0x100b;
970pub const SO_RCVTIMEO: ::c_int = 0x100c;
8bb4bdeb
XL
971pub const SO_ACCEPTFILTER: ::c_int = 0x1000;
972pub const SO_TIMESTAMP: ::c_int = 0x2000;
973pub const SO_OVERFLOWED: ::c_int = 0x1009;
974pub const SO_NOHEADER: ::c_int = 0x100a;
975
ff7c6d11
XL
976// https://github.com/NetBSD/src/blob/trunk/sys/net/if.h#L373
977pub const IFF_UP: ::c_int = 0x0001; // interface is up
978pub const IFF_BROADCAST: ::c_int = 0x0002; // broadcast address valid
979pub const IFF_DEBUG: ::c_int = 0x0004; // turn on debugging
980pub const IFF_LOOPBACK: ::c_int = 0x0008; // is a loopback net
981pub const IFF_POINTOPOINT: ::c_int = 0x0010; // interface is point-to-point link
982pub const IFF_NOTRAILERS: ::c_int = 0x0020; // avoid use of trailers
983pub const IFF_RUNNING: ::c_int = 0x0040; // resources allocated
984pub const IFF_NOARP: ::c_int = 0x0080; // no address resolution protocol
985pub const IFF_PROMISC: ::c_int = 0x0100; // receive all packets
986pub const IFF_ALLMULTI: ::c_int = 0x0200; // receive all multicast packets
987pub const IFF_OACTIVE: ::c_int = 0x0400; // transmission in progress
988pub const IFF_SIMPLEX: ::c_int = 0x0800; // can't hear own transmissions
989pub const IFF_LINK0: ::c_int = 0x1000; // per link layer defined bit
990pub const IFF_LINK1: ::c_int = 0x2000; // per link layer defined bit
991pub const IFF_LINK2: ::c_int = 0x4000; // per link layer defined bit
992pub const IFF_MULTICAST: ::c_int = 0x8000; // supports multicast
993
ea8adc8c
XL
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
1000pub const IPPROTO_HOPOPTS: ::c_int = 0;
1001// IPPROTO_ICMP defined in src/unix/mod.rs
1002/// group mgmt protocol
1003pub const IPPROTO_IGMP: ::c_int = 2;
1004/// gateway^2 (deprecated)
1005pub const IPPROTO_GGP: ::c_int = 3;
1006/// for compatibility
1007pub const IPPROTO_IPIP: ::c_int = 4;
1008// IPPROTO_TCP defined in src/unix/mod.rs
1009/// exterior gateway protocol
1010pub const IPPROTO_EGP: ::c_int = 8;
1011/// pup
1012pub const IPPROTO_PUP: ::c_int = 12;
1013// IPPROTO_UDP defined in src/unix/mod.rs
1014/// xns idp
1015pub const IPPROTO_IDP: ::c_int = 22;
1016/// tp-4 w/ class negotiation
1017pub const IPPROTO_TP: ::c_int = 29;
1018/// DCCP
1019pub const IPPROTO_DCCP: ::c_int = 33;
1020// IPPROTO_IPV6 defined in src/unix/mod.rs
1021/// IP6 routing header
1022pub const IPPROTO_ROUTING: ::c_int = 43;
1023/// IP6 fragmentation header
1024pub const IPPROTO_FRAGMENT: ::c_int = 44;
1025/// resource reservation
1026pub const IPPROTO_RSVP: ::c_int = 46;
1027/// General Routing Encap.
1028pub const IPPROTO_GRE: ::c_int = 47;
1029/// IP6 Encap Sec. Payload
1030pub const IPPROTO_ESP: ::c_int = 50;
1031/// IP6 Auth Header
1032pub const IPPROTO_AH: ::c_int = 51;
1033/// IP Mobility RFC 2004
1034pub const IPPROTO_MOBILE: ::c_int = 55;
1035/// IPv6 ICMP
1036pub const IPPROTO_IPV6_ICMP: ::c_int = 58;
1037// IPPROTO_ICMPV6 defined in src/unix/mod.rs
1038/// IP6 no next header
1039pub const IPPROTO_NONE: ::c_int = 59;
1040/// IP6 destination option
1041pub const IPPROTO_DSTOPTS: ::c_int = 60;
1042/// ISO cnlp
1043pub const IPPROTO_EON: ::c_int = 80;
1044/// Ethernet-in-IP
1045pub const IPPROTO_ETHERIP: ::c_int = 97;
1046/// encapsulation header
1047pub const IPPROTO_ENCAP: ::c_int = 98;
1048/// Protocol indep. multicast
1049pub const IPPROTO_PIM: ::c_int = 103;
1050/// IP Payload Comp. Protocol
1051pub const IPPROTO_IPCOMP: ::c_int = 108;
1052/// VRRP RFC 2338
1053pub const IPPROTO_VRRP: ::c_int = 112;
1054/// Common Address Resolution Protocol
1055pub 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
1062pub const IPPROTO_SCTP: ::c_int = 132;
1063/// PFSYNC
1064pub const IPPROTO_PFSYNC: ::c_int = 240;
1065pub const IPPROTO_MAX: ::c_int = 256;
1066
1067/// last return value of *_input(), meaning "all job for this pkt is done".
1068pub const IPPROTO_DONE: ::c_int = 257;
1069
1070/// sysctl placeholder for (FAST_)IPSEC
1071pub const CTL_IPPROTO_IPSEC: ::c_int = 258;
1072
8bb4bdeb
XL
1073pub const AF_OROUTE: ::c_int = 17;
1074pub const AF_ARP: ::c_int = 28;
1075pub const pseudo_AF_KEY: ::c_int = 29;
1076pub const pseudo_AF_HDRCMPLT: ::c_int = 30;
1077pub const AF_BLUETOOTH: ::c_int = 31;
1078pub const AF_IEEE80211: ::c_int = 32;
1079pub const AF_MPLS: ::c_int = 33;
1080pub const AF_ROUTE: ::c_int = 34;
8bb4bdeb
XL
1081pub const NET_RT_DUMP: ::c_int = 1;
1082pub const NET_RT_FLAGS: ::c_int = 2;
532ac7d7
XL
1083pub const NET_RT_OOOIFLIST: ::c_int = 3;
1084pub const NET_RT_OOIFLIST: ::c_int = 4;
1085pub const NET_RT_OIFLIST: ::c_int = 5;
1086pub const NET_RT_IFLIST: ::c_int = 6;
1087pub const NET_RT_MAXID: ::c_int = 7;
8bb4bdeb
XL
1088
1089pub const PF_OROUTE: ::c_int = AF_OROUTE;
1090pub const PF_ARP: ::c_int = AF_ARP;
1091pub const PF_KEY: ::c_int = pseudo_AF_KEY;
1092pub const PF_BLUETOOTH: ::c_int = AF_BLUETOOTH;
1093pub const PF_MPLS: ::c_int = AF_MPLS;
1094pub const PF_ROUTE: ::c_int = AF_ROUTE;
8bb4bdeb
XL
1095
1096pub const MSG_NBIO: ::c_int = 0x1000;
1097pub const MSG_WAITFORONE: ::c_int = 0x2000;
1098pub const MSG_NOTIFICATION: ::c_int = 0x4000;
1099
1100pub const SCM_TIMESTAMP: ::c_int = 0x08;
1101pub const SCM_CREDS: ::c_int = 0x10;
476ff2be 1102
e74abb32 1103pub const O_DSYNC: ::c_int = 0x10000;
476ff2be 1104
e74abb32
XL
1105pub const MAP_RENAME: ::c_int = 0x20;
1106pub const MAP_NORESERVE: ::c_int = 0x40;
1107pub const MAP_HASSEMAPHORE: ::c_int = 0x200;
476ff2be
SL
1108pub const MAP_WIRED: ::c_int = 0x800;
1109
abe05a73
XL
1110pub const DCCP_TYPE_REQUEST: ::c_int = 0;
1111pub const DCCP_TYPE_RESPONSE: ::c_int = 1;
1112pub const DCCP_TYPE_DATA: ::c_int = 2;
1113pub const DCCP_TYPE_ACK: ::c_int = 3;
e74abb32 1114pub const DCCP_TYPE_DATAACK: ::c_int = 4;
abe05a73
XL
1115pub const DCCP_TYPE_CLOSEREQ: ::c_int = 5;
1116pub const DCCP_TYPE_CLOSE: ::c_int = 6;
1117pub const DCCP_TYPE_RESET: ::c_int = 7;
1118pub const DCCP_TYPE_MOVE: ::c_int = 8;
1119
1120pub const DCCP_FEATURE_CC: ::c_int = 1;
1121pub const DCCP_FEATURE_ECN: ::c_int = 2;
e74abb32 1122pub const DCCP_FEATURE_ACKRATIO: ::c_int = 3;
abe05a73 1123pub const DCCP_FEATURE_ACKVECTOR: ::c_int = 4;
e74abb32 1124pub const DCCP_FEATURE_MOBILITY: ::c_int = 5;
abe05a73
XL
1125pub const DCCP_FEATURE_LOSSWINDOW: ::c_int = 6;
1126pub const DCCP_FEATURE_CONN_NONCE: ::c_int = 8;
e74abb32 1127pub const DCCP_FEATURE_IDENTREG: ::c_int = 7;
abe05a73
XL
1128
1129pub const DCCP_OPT_PADDING: ::c_int = 0;
1130pub const DCCP_OPT_DATA_DISCARD: ::c_int = 1;
1131pub const DCCP_OPT_SLOW_RECV: ::c_int = 2;
1132pub const DCCP_OPT_BUF_CLOSED: ::c_int = 3;
1133pub const DCCP_OPT_CHANGE_L: ::c_int = 32;
1134pub const DCCP_OPT_CONFIRM_L: ::c_int = 33;
1135pub const DCCP_OPT_CHANGE_R: ::c_int = 34;
1136pub const DCCP_OPT_CONFIRM_R: ::c_int = 35;
1137pub const DCCP_OPT_INIT_COOKIE: ::c_int = 36;
1138pub const DCCP_OPT_NDP_COUNT: ::c_int = 37;
1139pub const DCCP_OPT_ACK_VECTOR0: ::c_int = 38;
1140pub const DCCP_OPT_ACK_VECTOR1: ::c_int = 39;
1141pub const DCCP_OPT_RECV_BUF_DROPS: ::c_int = 40;
1142pub const DCCP_OPT_TIMESTAMP: ::c_int = 41;
1143pub const DCCP_OPT_TIMESTAMP_ECHO: ::c_int = 42;
1144pub const DCCP_OPT_ELAPSEDTIME: ::c_int = 43;
1145pub const DCCP_OPT_DATACHECKSUM: ::c_int = 44;
1146
1147pub const DCCP_REASON_UNSPEC: ::c_int = 0;
1148pub const DCCP_REASON_CLOSED: ::c_int = 1;
1149pub const DCCP_REASON_INVALID: ::c_int = 2;
1150pub const DCCP_REASON_OPTION_ERR: ::c_int = 3;
1151pub const DCCP_REASON_FEA_ERR: ::c_int = 4;
1152pub const DCCP_REASON_CONN_REF: ::c_int = 5;
1153pub const DCCP_REASON_BAD_SNAME: ::c_int = 6;
1154pub const DCCP_REASON_BAD_COOKIE: ::c_int = 7;
1155pub const DCCP_REASON_INV_MOVE: ::c_int = 8;
1156pub const DCCP_REASON_UNANSW_CH: ::c_int = 10;
1157pub const DCCP_REASON_FRUITLESS_NEG: ::c_int = 11;
1158
1159pub const DCCP_CCID: ::c_int = 1;
1160pub const DCCP_CSLEN: ::c_int = 2;
1161pub const DCCP_MAXSEG: ::c_int = 4;
1162pub const DCCP_SERVICE: ::c_int = 8;
1163
1164pub const DCCP_NDP_LIMIT: ::c_int = 16;
1165pub const DCCP_SEQ_NUM_LIMIT: ::c_int = 16777216;
1166pub const DCCP_MAX_OPTIONS: ::c_int = 32;
1167pub const DCCP_MAX_PKTS: ::c_int = 100;
1168
e74abb32
XL
1169pub const _PC_LINK_MAX: ::c_int = 1;
1170pub const _PC_MAX_CANON: ::c_int = 2;
1171pub const _PC_MAX_INPUT: ::c_int = 3;
1172pub const _PC_NAME_MAX: ::c_int = 4;
1173pub const _PC_PATH_MAX: ::c_int = 5;
1174pub const _PC_PIPE_BUF: ::c_int = 6;
1175pub const _PC_CHOWN_RESTRICTED: ::c_int = 7;
1176pub const _PC_NO_TRUNC: ::c_int = 8;
1177pub const _PC_VDISABLE: ::c_int = 9;
1178pub const _PC_SYNC_IO: ::c_int = 10;
1179pub const _PC_FILESIZEBITS: ::c_int = 11;
1180pub const _PC_SYMLINK_MAX: ::c_int = 12;
1181pub const _PC_2_SYMLINKS: ::c_int = 13;
1182pub const _PC_ACL_EXTENDED: ::c_int = 14;
1183pub const _PC_MIN_HOLE_SIZE: ::c_int = 15;
1184
1185pub const _SC_SYNCHRONIZED_IO: ::c_int = 31;
1186pub const _SC_IOV_MAX: ::c_int = 32;
1187pub const _SC_MAPPED_FILES: ::c_int = 33;
1188pub const _SC_MEMLOCK: ::c_int = 34;
1189pub const _SC_MEMLOCK_RANGE: ::c_int = 35;
1190pub const _SC_MEMORY_PROTECTION: ::c_int = 36;
1191pub const _SC_LOGIN_NAME_MAX: ::c_int = 37;
1192pub const _SC_MONOTONIC_CLOCK: ::c_int = 38;
1193pub const _SC_CLK_TCK: ::c_int = 39;
1194pub const _SC_ATEXIT_MAX: ::c_int = 40;
1195pub const _SC_THREADS: ::c_int = 41;
1196pub const _SC_SEMAPHORES: ::c_int = 42;
1197pub const _SC_BARRIERS: ::c_int = 43;
1198pub const _SC_TIMERS: ::c_int = 44;
1199pub const _SC_SPIN_LOCKS: ::c_int = 45;
1200pub const _SC_READER_WRITER_LOCKS: ::c_int = 46;
1201pub const _SC_GETGR_R_SIZE_MAX: ::c_int = 47;
1202pub const _SC_GETPW_R_SIZE_MAX: ::c_int = 48;
1203pub const _SC_CLOCK_SELECTION: ::c_int = 49;
1204pub const _SC_ASYNCHRONOUS_IO: ::c_int = 50;
1205pub const _SC_AIO_LISTIO_MAX: ::c_int = 51;
1206pub const _SC_AIO_MAX: ::c_int = 52;
1207pub const _SC_MESSAGE_PASSING: ::c_int = 53;
1208pub const _SC_MQ_OPEN_MAX: ::c_int = 54;
1209pub const _SC_MQ_PRIO_MAX: ::c_int = 55;
1210pub const _SC_PRIORITY_SCHEDULING: ::c_int = 56;
1211pub const _SC_THREAD_DESTRUCTOR_ITERATIONS: ::c_int = 57;
1212pub const _SC_THREAD_KEYS_MAX: ::c_int = 58;
1213pub const _SC_THREAD_STACK_MIN: ::c_int = 59;
1214pub const _SC_THREAD_THREADS_MAX: ::c_int = 60;
1215pub const _SC_THREAD_ATTR_STACKADDR: ::c_int = 61;
1216pub const _SC_THREAD_ATTR_STACKSIZE: ::c_int = 62;
1217pub const _SC_THREAD_PRIORITY_SCHEDULING: ::c_int = 63;
1218pub const _SC_THREAD_PRIO_INHERIT: ::c_int = 64;
1219pub const _SC_THREAD_PRIO_PROTECT: ::c_int = 65;
1220pub const _SC_THREAD_PROCESS_SHARED: ::c_int = 66;
1221pub const _SC_THREAD_SAFE_FUNCTIONS: ::c_int = 67;
1222pub const _SC_TTY_NAME_MAX: ::c_int = 68;
1223pub const _SC_HOST_NAME_MAX: ::c_int = 69;
1224pub const _SC_PASS_MAX: ::c_int = 70;
1225pub const _SC_REGEXP: ::c_int = 71;
1226pub const _SC_SHELL: ::c_int = 72;
1227pub const _SC_SYMLOOP_MAX: ::c_int = 73;
1228pub const _SC_V6_ILP32_OFF32: ::c_int = 74;
1229pub const _SC_V6_ILP32_OFFBIG: ::c_int = 75;
1230pub const _SC_V6_LP64_OFF64: ::c_int = 76;
1231pub const _SC_V6_LPBIG_OFFBIG: ::c_int = 77;
1232pub const _SC_2_PBS: ::c_int = 80;
1233pub const _SC_2_PBS_ACCOUNTING: ::c_int = 81;
1234pub const _SC_2_PBS_CHECKPOINT: ::c_int = 82;
1235pub const _SC_2_PBS_LOCATE: ::c_int = 83;
1236pub const _SC_2_PBS_MESSAGE: ::c_int = 84;
1237pub const _SC_2_PBS_TRACK: ::c_int = 85;
1238pub const _SC_SPAWN: ::c_int = 86;
1239pub const _SC_SHARED_MEMORY_OBJECTS: ::c_int = 87;
1240pub const _SC_TIMER_MAX: ::c_int = 88;
1241pub const _SC_SEM_NSEMS_MAX: ::c_int = 89;
1242pub const _SC_CPUTIME: ::c_int = 90;
1243pub const _SC_THREAD_CPUTIME: ::c_int = 91;
1244pub const _SC_DELAYTIMER_MAX: ::c_int = 92;
041b39d2
XL
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;
e74abb32
XL
1248pub const _SC_PHYS_PAGES: ::c_int = 121;
1249pub const _SC_NPROCESSORS_CONF: ::c_int = 1001;
1250pub const _SC_NPROCESSORS_ONLN: ::c_int = 1002;
1251pub const _SC_SCHED_RT_TS: ::c_int = 2001;
1252pub const _SC_SCHED_PRI_MIN: ::c_int = 2002;
1253pub const _SC_SCHED_PRI_MAX: ::c_int = 2003;
476ff2be
SL
1254
1255pub const FD_SETSIZE: usize = 0x100;
1256
1257pub const ST_NOSUID: ::c_ulong = 8;
1258
e74abb32
XL
1259pub const BIOCGRSIG: ::c_ulong = 0x40044272;
1260pub const BIOCSRSIG: ::c_ulong = 0x80044273;
1261pub const BIOCSDLT: ::c_ulong = 0x80044278;
1262pub const BIOCGSEESENT: ::c_ulong = 0x40044276;
1263pub const BIOCSSEESENT: ::c_ulong = 0x80044277;
1264
ba9703b0
XL
1265//<sys/timex.h>
1266pub const NTP_API: ::c_int = 4;
1267pub const MAXPHASE: ::c_long = 500000000;
1268pub const MAXFREQ: ::c_long = 500000;
1269pub const MINSEC: ::c_int = 256;
1270pub const MAXSEC: ::c_int = 2048;
1271pub const NANOSECOND: ::c_long = 1000000000;
1272pub const SCALE_PPM: ::c_int = 65;
1273pub const MAXTC: ::c_int = 10;
1274pub const MOD_OFFSET: ::c_uint = 0x0001;
1275pub const MOD_FREQUENCY: ::c_uint = 0x0002;
1276pub const MOD_MAXERROR: ::c_uint = 0x0004;
1277pub const MOD_ESTERROR: ::c_uint = 0x0008;
1278pub const MOD_STATUS: ::c_uint = 0x0010;
1279pub const MOD_TIMECONST: ::c_uint = 0x0020;
1280pub const MOD_PPSMAX: ::c_uint = 0x0040;
1281pub const MOD_TAI: ::c_uint = 0x0080;
1282pub const MOD_MICRO: ::c_uint = 0x1000;
1283pub const MOD_NANO: ::c_uint = 0x2000;
1284pub const MOD_CLKB: ::c_uint = 0x4000;
1285pub const MOD_CLKA: ::c_uint = 0x8000;
1286pub const STA_PLL: ::c_int = 0x0001;
1287pub const STA_PPSFREQ: ::c_int = 0x0002;
1288pub const STA_PPSTIME: ::c_int = 0x0004;
1289pub const STA_FLL: ::c_int = 0x0008;
1290pub const STA_INS: ::c_int = 0x0010;
1291pub const STA_DEL: ::c_int = 0x0020;
1292pub const STA_UNSYNC: ::c_int = 0x0040;
1293pub const STA_FREQHOLD: ::c_int = 0x0080;
1294pub const STA_PPSSIGNAL: ::c_int = 0x0100;
1295pub const STA_PPSJITTER: ::c_int = 0x0200;
1296pub const STA_PPSWANDER: ::c_int = 0x0400;
1297pub const STA_PPSERROR: ::c_int = 0x0800;
1298pub const STA_CLOCKERR: ::c_int = 0x1000;
1299pub const STA_NANO: ::c_int = 0x2000;
1300pub const STA_MODE: ::c_int = 0x4000;
1301pub const STA_CLK: ::c_int = 0x8000;
1302pub 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;
1310pub const TIME_OK: ::c_int = 0;
1311pub const TIME_INS: ::c_int = 1;
1312pub const TIME_DEL: ::c_int = 2;
1313pub const TIME_OOP: ::c_int = 3;
1314pub const TIME_WAIT: ::c_int = 4;
1315pub const TIME_ERROR: ::c_int = 5;
1316
532ac7d7
XL
1317cfg_if! {
1318 if #[cfg(any(target_arch = "sparc", target_arch = "sparc64",
1319 target_arch = "x86", target_arch = "x86_64"))] {
e74abb32
XL
1320 pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t
1321 = pthread_mutex_t {
532ac7d7
XL
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 {
e74abb32
XL
1333 pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t
1334 = pthread_mutex_t {
532ac7d7
XL
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}
69743fb6 1345
476ff2be
SL
1346pub 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};
1354pub 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};
1365pub const PTHREAD_MUTEX_NORMAL: ::c_int = 0;
1366pub const PTHREAD_MUTEX_ERRORCHECK: ::c_int = 1;
1367pub const PTHREAD_MUTEX_RECURSIVE: ::c_int = 2;
1368pub const PTHREAD_MUTEX_DEFAULT: ::c_int = PTHREAD_MUTEX_NORMAL;
1369
416331ca
XL
1370pub const EVFILT_AIO: u32 = 2;
1371pub const EVFILT_PROC: u32 = 4;
1372pub const EVFILT_READ: u32 = 0;
1373pub const EVFILT_SIGNAL: u32 = 5;
1374pub const EVFILT_TIMER: u32 = 6;
1375pub const EVFILT_VNODE: u32 = 3;
1376pub const EVFILT_WRITE: u32 = 1;
1377
1378pub const EV_ADD: u32 = 0x1;
1379pub const EV_DELETE: u32 = 0x2;
1380pub const EV_ENABLE: u32 = 0x4;
1381pub const EV_DISABLE: u32 = 0x8;
1382pub const EV_ONESHOT: u32 = 0x10;
1383pub const EV_CLEAR: u32 = 0x20;
1384pub const EV_RECEIPT: u32 = 0x40;
1385pub const EV_DISPATCH: u32 = 0x80;
1386pub const EV_FLAG1: u32 = 0x2000;
1387pub const EV_ERROR: u32 = 0x4000;
1388pub const EV_EOF: u32 = 0x8000;
1389pub const EV_SYSFLAGS: u32 = 0xf000;
1390
1391pub const NOTE_LOWAT: u32 = 0x00000001;
1392pub const NOTE_DELETE: u32 = 0x00000001;
1393pub const NOTE_WRITE: u32 = 0x00000002;
1394pub const NOTE_EXTEND: u32 = 0x00000004;
1395pub const NOTE_ATTRIB: u32 = 0x00000008;
1396pub const NOTE_LINK: u32 = 0x00000010;
1397pub const NOTE_RENAME: u32 = 0x00000020;
1398pub const NOTE_REVOKE: u32 = 0x00000040;
1399pub const NOTE_EXIT: u32 = 0x80000000;
1400pub const NOTE_FORK: u32 = 0x40000000;
1401pub const NOTE_EXEC: u32 = 0x20000000;
1402pub const NOTE_PDATAMASK: u32 = 0x000fffff;
1403pub const NOTE_PCTRLMASK: u32 = 0xf0000000;
1404pub const NOTE_TRACK: u32 = 0x00000001;
1405pub const NOTE_TRACKERR: u32 = 0x00000002;
1406pub const NOTE_CHILD: u32 = 0x00000004;
476ff2be 1407
e74abb32 1408pub const TMP_MAX: ::c_uint = 308915776;
476ff2be
SL
1409
1410pub const NI_MAXHOST: ::socklen_t = 1025;
1411
1412pub const RTLD_NOLOAD: ::c_int = 0x2000;
1413pub const RTLD_LOCAL: ::c_int = 0x200;
1414
1415pub const CTL_MAXNAME: ::c_int = 12;
1416pub const SYSCTL_NAMELEN: ::c_int = 32;
1417pub const SYSCTL_DEFSIZE: ::c_int = 8;
1418pub const CTLTYPE_NODE: ::c_int = 1;
1419pub const CTLTYPE_INT: ::c_int = 2;
1420pub const CTLTYPE_STRING: ::c_int = 3;
1421pub const CTLTYPE_QUAD: ::c_int = 4;
1422pub const CTLTYPE_STRUCT: ::c_int = 5;
1423pub const CTLTYPE_BOOL: ::c_int = 6;
1424pub const CTLFLAG_READONLY: ::c_int = 0x00000000;
1425pub const CTLFLAG_READWRITE: ::c_int = 0x00000070;
1426pub const CTLFLAG_ANYWRITE: ::c_int = 0x00000080;
1427pub const CTLFLAG_PRIVATE: ::c_int = 0x00000100;
1428pub const CTLFLAG_PERMANENT: ::c_int = 0x00000200;
1429pub const CTLFLAG_OWNDATA: ::c_int = 0x00000400;
1430pub const CTLFLAG_IMMEDIATE: ::c_int = 0x00000800;
1431pub const CTLFLAG_HEX: ::c_int = 0x00001000;
1432pub const CTLFLAG_ROOT: ::c_int = 0x00002000;
1433pub const CTLFLAG_ANYNUMBER: ::c_int = 0x00004000;
1434pub const CTLFLAG_HIDDEN: ::c_int = 0x00008000;
1435pub const CTLFLAG_ALIAS: ::c_int = 0x00010000;
1436pub const CTLFLAG_MMAP: ::c_int = 0x00020000;
1437pub const CTLFLAG_OWNDESC: ::c_int = 0x00040000;
1438pub const CTLFLAG_UNSIGNED: ::c_int = 0x00080000;
1439pub const SYSCTL_VERS_MASK: ::c_int = 0xff000000;
1440pub const SYSCTL_VERS_0: ::c_int = 0x00000000;
1441pub const SYSCTL_VERS_1: ::c_int = 0x01000000;
1442pub const SYSCTL_VERSION: ::c_int = SYSCTL_VERS_1;
1443pub const CTL_EOL: ::c_int = -1;
1444pub const CTL_QUERY: ::c_int = -2;
1445pub const CTL_CREATE: ::c_int = -3;
1446pub const CTL_CREATESYM: ::c_int = -4;
1447pub const CTL_DESTROY: ::c_int = -5;
1448pub const CTL_MMAP: ::c_int = -6;
1449pub const CTL_DESCRIBE: ::c_int = -7;
1450pub const CTL_UNSPEC: ::c_int = 0;
1451pub const CTL_KERN: ::c_int = 1;
1452pub const CTL_VM: ::c_int = 2;
1453pub const CTL_VFS: ::c_int = 3;
1454pub const CTL_NET: ::c_int = 4;
1455pub const CTL_DEBUG: ::c_int = 5;
1456pub const CTL_HW: ::c_int = 6;
1457pub const CTL_MACHDEP: ::c_int = 7;
1458pub const CTL_USER: ::c_int = 8;
1459pub const CTL_DDB: ::c_int = 9;
1460pub const CTL_PROC: ::c_int = 10;
1461pub const CTL_VENDOR: ::c_int = 11;
1462pub const CTL_EMUL: ::c_int = 12;
1463pub const CTL_SECURITY: ::c_int = 13;
1464pub const CTL_MAXID: ::c_int = 14;
1465pub const KERN_OSTYPE: ::c_int = 1;
1466pub const KERN_OSRELEASE: ::c_int = 2;
1467pub const KERN_OSREV: ::c_int = 3;
1468pub const KERN_VERSION: ::c_int = 4;
1469pub const KERN_MAXVNODES: ::c_int = 5;
1470pub const KERN_MAXPROC: ::c_int = 6;
1471pub const KERN_MAXFILES: ::c_int = 7;
1472pub const KERN_ARGMAX: ::c_int = 8;
1473pub const KERN_SECURELVL: ::c_int = 9;
1474pub const KERN_HOSTNAME: ::c_int = 10;
1475pub const KERN_HOSTID: ::c_int = 11;
1476pub const KERN_CLOCKRATE: ::c_int = 12;
1477pub const KERN_VNODE: ::c_int = 13;
1478pub const KERN_PROC: ::c_int = 14;
1479pub const KERN_FILE: ::c_int = 15;
1480pub const KERN_PROF: ::c_int = 16;
1481pub const KERN_POSIX1: ::c_int = 17;
1482pub const KERN_NGROUPS: ::c_int = 18;
1483pub const KERN_JOB_CONTROL: ::c_int = 19;
1484pub const KERN_SAVED_IDS: ::c_int = 20;
1485pub const KERN_OBOOTTIME: ::c_int = 21;
1486pub const KERN_DOMAINNAME: ::c_int = 22;
1487pub const KERN_MAXPARTITIONS: ::c_int = 23;
1488pub const KERN_RAWPARTITION: ::c_int = 24;
1489pub const KERN_NTPTIME: ::c_int = 25;
1490pub const KERN_TIMEX: ::c_int = 26;
1491pub const KERN_AUTONICETIME: ::c_int = 27;
1492pub const KERN_AUTONICEVAL: ::c_int = 28;
1493pub const KERN_RTC_OFFSET: ::c_int = 29;
1494pub const KERN_ROOT_DEVICE: ::c_int = 30;
1495pub const KERN_MSGBUFSIZE: ::c_int = 31;
1496pub const KERN_FSYNC: ::c_int = 32;
1497pub const KERN_OLDSYSVMSG: ::c_int = 33;
1498pub const KERN_OLDSYSVSEM: ::c_int = 34;
1499pub const KERN_OLDSYSVSHM: ::c_int = 35;
1500pub const KERN_OLDSHORTCORENAME: ::c_int = 36;
1501pub const KERN_SYNCHRONIZED_IO: ::c_int = 37;
1502pub const KERN_IOV_MAX: ::c_int = 38;
1503pub const KERN_MBUF: ::c_int = 39;
1504pub const KERN_MAPPED_FILES: ::c_int = 40;
1505pub const KERN_MEMLOCK: ::c_int = 41;
1506pub const KERN_MEMLOCK_RANGE: ::c_int = 42;
1507pub const KERN_MEMORY_PROTECTION: ::c_int = 43;
1508pub const KERN_LOGIN_NAME_MAX: ::c_int = 44;
1509pub const KERN_DEFCORENAME: ::c_int = 45;
1510pub const KERN_LOGSIGEXIT: ::c_int = 46;
1511pub const KERN_PROC2: ::c_int = 47;
1512pub const KERN_PROC_ARGS: ::c_int = 48;
1513pub const KERN_FSCALE: ::c_int = 49;
1514pub const KERN_CCPU: ::c_int = 50;
1515pub const KERN_CP_TIME: ::c_int = 51;
1516pub const KERN_OLDSYSVIPC_INFO: ::c_int = 52;
1517pub const KERN_MSGBUF: ::c_int = 53;
1518pub const KERN_CONSDEV: ::c_int = 54;
1519pub const KERN_MAXPTYS: ::c_int = 55;
1520pub const KERN_PIPE: ::c_int = 56;
1521pub const KERN_MAXPHYS: ::c_int = 57;
1522pub const KERN_SBMAX: ::c_int = 58;
1523pub const KERN_TKSTAT: ::c_int = 59;
1524pub const KERN_MONOTONIC_CLOCK: ::c_int = 60;
1525pub const KERN_URND: ::c_int = 61;
1526pub const KERN_LABELSECTOR: ::c_int = 62;
1527pub const KERN_LABELOFFSET: ::c_int = 63;
1528pub const KERN_LWP: ::c_int = 64;
1529pub const KERN_FORKFSLEEP: ::c_int = 65;
1530pub const KERN_POSIX_THREADS: ::c_int = 66;
1531pub const KERN_POSIX_SEMAPHORES: ::c_int = 67;
1532pub const KERN_POSIX_BARRIERS: ::c_int = 68;
1533pub const KERN_POSIX_TIMERS: ::c_int = 69;
1534pub const KERN_POSIX_SPIN_LOCKS: ::c_int = 70;
1535pub const KERN_POSIX_READER_WRITER_LOCKS: ::c_int = 71;
1536pub const KERN_DUMP_ON_PANIC: ::c_int = 72;
1537pub const KERN_SOMAXKVA: ::c_int = 73;
1538pub const KERN_ROOT_PARTITION: ::c_int = 74;
1539pub const KERN_DRIVERS: ::c_int = 75;
1540pub const KERN_BUF: ::c_int = 76;
1541pub const KERN_FILE2: ::c_int = 77;
1542pub const KERN_VERIEXEC: ::c_int = 78;
1543pub const KERN_CP_ID: ::c_int = 79;
1544pub const KERN_HARDCLOCK_TICKS: ::c_int = 80;
1545pub const KERN_ARND: ::c_int = 81;
1546pub const KERN_SYSVIPC: ::c_int = 82;
1547pub const KERN_BOOTTIME: ::c_int = 83;
1548pub const KERN_EVCNT: ::c_int = 84;
1549pub const KERN_MAXID: ::c_int = 85;
1550pub const KERN_PROC_ALL: ::c_int = 0;
1551pub const KERN_PROC_PID: ::c_int = 1;
1552pub const KERN_PROC_PGRP: ::c_int = 2;
1553pub const KERN_PROC_SESSION: ::c_int = 3;
1554pub const KERN_PROC_TTY: ::c_int = 4;
1555pub const KERN_PROC_UID: ::c_int = 5;
1556pub const KERN_PROC_RUID: ::c_int = 6;
1557pub const KERN_PROC_GID: ::c_int = 7;
1558pub const KERN_PROC_RGID: ::c_int = 8;
abe05a73
XL
1559pub const KERN_PROC_ARGV: ::c_int = 1;
1560pub const KERN_PROC_NARGV: ::c_int = 2;
1561pub const KERN_PROC_ENV: ::c_int = 3;
1562pub const KERN_PROC_NENV: ::c_int = 4;
1563pub const KERN_PROC_PATHNAME: ::c_int = 5;
476ff2be 1564
2c00a5a8
XL
1565pub const EAI_AGAIN: ::c_int = 2;
1566pub const EAI_BADFLAGS: ::c_int = 3;
1567pub const EAI_FAIL: ::c_int = 4;
1568pub const EAI_FAMILY: ::c_int = 5;
1569pub const EAI_MEMORY: ::c_int = 6;
1570pub const EAI_NODATA: ::c_int = 7;
1571pub const EAI_NONAME: ::c_int = 8;
1572pub const EAI_SERVICE: ::c_int = 9;
1573pub const EAI_SOCKTYPE: ::c_int = 10;
476ff2be 1574pub const EAI_SYSTEM: ::c_int = 11;
2c00a5a8 1575pub const EAI_OVERFLOW: ::c_int = 14;
476ff2be 1576
8bb4bdeb
XL
1577pub const AIO_CANCELED: ::c_int = 1;
1578pub const AIO_NOTCANCELED: ::c_int = 2;
1579pub const AIO_ALLDONE: ::c_int = 3;
1580pub const LIO_NOP: ::c_int = 0;
1581pub const LIO_WRITE: ::c_int = 1;
1582pub const LIO_READ: ::c_int = 2;
1583pub const LIO_WAIT: ::c_int = 1;
1584pub const LIO_NOWAIT: ::c_int = 0;
1585
1586pub const SIGEV_NONE: ::c_int = 0;
1587pub const SIGEV_SIGNAL: ::c_int = 1;
1588pub const SIGEV_THREAD: ::c_int = 2;
1589
1590pub const WSTOPPED: ::c_int = 0x00000002; // same as WUNTRACED
1591pub const WCONTINUED: ::c_int = 0x00000010;
1592pub const WEXITED: ::c_int = 0x000000020;
1593pub const WNOWAIT: ::c_int = 0x00010000;
1594
1595pub const P_ALL: idtype_t = 0;
1596pub const P_PID: idtype_t = 1;
1597pub const P_PGID: idtype_t = 4;
1598
e74abb32
XL
1599pub const UTIME_OMIT: c_long = 1073741822;
1600pub const UTIME_NOW: c_long = 1073741823;
1601
7cac9316
XL
1602pub const B460800: ::speed_t = 460800;
1603pub const B921600: ::speed_t = 921600;
1604
041b39d2
XL
1605pub const ONOCR: ::tcflag_t = 0x20;
1606pub const ONLRET: ::tcflag_t = 0x40;
1607pub const CDTRCTS: ::tcflag_t = 0x00020000;
1608pub const CHWFLOW: ::tcflag_t = ::MDMBUF | ::CRTSCTS | ::CDTRCTS;
1609
dfeec247
XL
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";
1614pub const UT_NAMESIZE: usize = 8;
1615pub const UT_LINESIZE: usize = 8;
1616pub const UT_HOSTSIZE: usize = 16;
1617pub const _UTX_USERSIZE: usize = 32;
1618pub const _UTX_LINESIZE: usize = 32;
1619pub const _UTX_PADSIZE: usize = 40;
1620pub const _UTX_IDSIZE: usize = 4;
1621pub const _UTX_HOSTSIZE: usize = 256;
1622pub const EMPTY: u16 = 0;
1623pub const RUN_LVL: u16 = 1;
1624pub const BOOT_TIME: u16 = 2;
1625pub const OLD_TIME: u16 = 3;
1626pub const NEW_TIME: u16 = 4;
1627pub const INIT_PROCESS: u16 = 5;
1628pub const LOGIN_PROCESS: u16 = 6;
1629pub const USER_PROCESS: u16 = 7;
1630pub const DEAD_PROCESS: u16 = 8;
1631pub const ACCOUNTING: u16 = 9;
1632pub const SIGNATURE: u16 = 10;
1633pub const DOWN_TIME: u16 = 11;
1634
ea8adc8c
XL
1635pub const SOCK_CLOEXEC: ::c_int = 0x10000000;
1636pub const SOCK_NONBLOCK: ::c_int = 0x20000000;
1637
532ac7d7
XL
1638// Uncomment on next NetBSD release
1639// pub const FIOSEEKDATA: ::c_ulong = 0xc0086661;
1640// pub const FIOSEEKHOLE: ::c_ulong = 0xc0086662;
532ac7d7
XL
1641pub const OFIOGETBMAP: ::c_ulong = 0xc004667a;
1642pub const FIOGETBMAP: ::c_ulong = 0xc008667a;
1643pub const FIONWRITE: ::c_ulong = 0x40046679;
1644pub const FIONSPACE: ::c_ulong = 0x40046678;
1645pub const FIBMAP: ::c_ulong = 0xc008667a;
1646
e74abb32 1647pub const SIGSTKSZ: ::size_t = 40960;
8faf50e0 1648
f035d41b
XL
1649pub const REG_ENOSYS: ::c_int = 17;
1650
69743fb6
XL
1651pub const PT_DUMPCORE: ::c_int = 12;
1652pub const PT_LWPINFO: ::c_int = 13;
1653pub const PT_SYSCALL: ::c_int = 14;
1654pub const PT_SYSCALLEMU: ::c_int = 15;
1655pub const PT_SET_EVENT_MASK: ::c_int = 16;
1656pub const PT_GET_EVENT_MASK: ::c_int = 17;
1657pub const PT_GET_PROCESS_STATE: ::c_int = 18;
1658pub const PT_FIRSTMACH: ::c_int = 32;
1659
1660// Flags for chflags(2)
e74abb32
XL
1661pub const SF_SNAPSHOT: ::c_ulong = 0x00200000;
1662pub const SF_LOG: ::c_ulong = 0x00400000;
69743fb6
XL
1663pub const SF_SNAPINVAL: ::c_ulong = 0x00800000;
1664
532ac7d7
XL
1665fn _ALIGN(p: usize) -> usize {
1666 (p + _ALIGNBYTES) & !_ALIGNBYTES
1667}
1668
041b39d2 1669f! {
532ac7d7
XL
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 pub fn WSTOPSIG(status: ::c_int) -> ::c_int {
1703 status >> 8
1704 }
1705
1706 pub fn WIFSIGNALED(status: ::c_int) -> bool {
1707 (status & 0o177) != 0o177 && (status & 0o177) != 0
1708 }
1709
1710 pub fn WIFSTOPPED(status: ::c_int) -> bool {
1711 (status & 0o177) == 0o177
1712 }
1713
1714 // dirfd() is a macro on netbsd to access
1715 // the first field of the struct where dirp points to:
1716 // http://cvsweb.netbsd.org/bsdweb.cgi/src/include/dirent.h?rev=1.36
041b39d2 1717 pub fn dirfd(dirp: *mut ::DIR) -> ::c_int {
2c00a5a8 1718 *(dirp as *const ::c_int)
041b39d2 1719 }
ea8adc8c
XL
1720
1721 pub fn WIFCONTINUED(status: ::c_int) -> bool {
1722 status == 0xffff
1723 }
2c00a5a8
XL
1724
1725 pub fn SOCKCREDSIZE(ngrps: usize) -> usize {
1726 let ngrps = if ngrps > 0 {
1727 ngrps - 1
1728 } else {
1729 0
1730 };
532ac7d7 1731 ::mem::size_of::<sockcred>() + ::mem::size_of::<::gid_t>() * ngrps
2c00a5a8 1732 }
041b39d2
XL
1733}
1734
ba9703b0
XL
1735extern "C" {
1736 pub fn ntp_adjtime(buf: *mut timex) -> ::c_int;
1737 pub fn ntp_gettime(buf: *mut ntptimeval) -> ::c_int;
1738}
1739
532ac7d7 1740#[link(name = "rt")]
e74abb32 1741extern "C" {
8bb4bdeb
XL
1742 pub fn aio_read(aiocbp: *mut aiocb) -> ::c_int;
1743 pub fn aio_write(aiocbp: *mut aiocb) -> ::c_int;
1744 pub fn aio_fsync(op: ::c_int, aiocbp: *mut aiocb) -> ::c_int;
1745 pub fn aio_error(aiocbp: *const aiocb) -> ::c_int;
1746 pub fn aio_return(aiocbp: *mut aiocb) -> ::ssize_t;
1747 #[link_name = "__aio_suspend50"]
e74abb32
XL
1748 pub fn aio_suspend(
1749 aiocb_list: *const *const aiocb,
1750 nitems: ::c_int,
1751 timeout: *const ::timespec,
1752 ) -> ::c_int;
8bb4bdeb 1753 pub fn aio_cancel(fd: ::c_int, aiocbp: *mut aiocb) -> ::c_int;
e74abb32
XL
1754 pub fn lio_listio(
1755 mode: ::c_int,
1756 aiocb_list: *const *mut aiocb,
1757 nitems: ::c_int,
1758 sevp: *mut sigevent,
1759 ) -> ::c_int;
532ac7d7 1760}
8bb4bdeb 1761
e74abb32 1762extern "C" {
69743fb6
XL
1763 pub fn chflags(path: *const ::c_char, flags: ::c_ulong) -> ::c_int;
1764 pub fn fchflags(fd: ::c_int, flags: ::c_ulong) -> ::c_int;
1765 pub fn lchflags(path: *const ::c_char, flags: ::c_ulong) -> ::c_int;
1766
e74abb32
XL
1767 pub fn extattr_delete_fd(
1768 fd: ::c_int,
1769 attrnamespace: ::c_int,
1770 attrname: *const ::c_char,
1771 ) -> ::c_int;
1772 pub fn extattr_delete_file(
1773 path: *const ::c_char,
1774 attrnamespace: ::c_int,
1775 attrname: *const ::c_char,
1776 ) -> ::c_int;
1777 pub fn extattr_delete_link(
1778 path: *const ::c_char,
1779 attrnamespace: ::c_int,
1780 attrname: *const ::c_char,
1781 ) -> ::c_int;
1782 pub fn extattr_get_fd(
1783 fd: ::c_int,
1784 attrnamespace: ::c_int,
1785 attrname: *const ::c_char,
1786 data: *mut ::c_void,
1787 nbytes: ::size_t,
1788 ) -> ::ssize_t;
1789 pub fn extattr_get_file(
1790 path: *const ::c_char,
1791 attrnamespace: ::c_int,
1792 attrname: *const ::c_char,
1793 data: *mut ::c_void,
1794 nbytes: ::size_t,
1795 ) -> ::ssize_t;
1796 pub fn extattr_get_link(
1797 path: *const ::c_char,
1798 attrnamespace: ::c_int,
1799 attrname: *const ::c_char,
1800 data: *mut ::c_void,
1801 nbytes: ::size_t,
1802 ) -> ::ssize_t;
1803 pub fn extattr_namespace_to_string(
1804 attrnamespace: ::c_int,
1805 string: *mut *mut ::c_char,
1806 ) -> ::c_int;
1807 pub fn extattr_set_fd(
1808 fd: ::c_int,
1809 attrnamespace: ::c_int,
1810 attrname: *const ::c_char,
1811 data: *const ::c_void,
1812 nbytes: ::size_t,
1813 ) -> ::c_int;
1814 pub fn extattr_set_file(
1815 path: *const ::c_char,
1816 attrnamespace: ::c_int,
1817 attrname: *const ::c_char,
1818 data: *const ::c_void,
1819 nbytes: ::size_t,
1820 ) -> ::c_int;
1821 pub fn extattr_set_link(
1822 path: *const ::c_char,
1823 attrnamespace: ::c_int,
1824 attrname: *const ::c_char,
1825 data: *const ::c_void,
1826 nbytes: ::size_t,
1827 ) -> ::c_int;
1828 pub fn extattr_string_to_namespace(
1829 string: *const ::c_char,
1830 attrnamespace: *mut ::c_int,
1831 ) -> ::c_int;
69743fb6
XL
1832
1833 #[link_name = "__lutimes50"]
476ff2be 1834 pub fn lutimes(file: *const ::c_char, times: *const ::timeval) -> ::c_int;
416331ca 1835 #[link_name = "__gettimeofday50"]
e74abb32
XL
1836 pub fn gettimeofday(tp: *mut ::timeval, tz: *mut ::c_void) -> ::c_int;
1837 pub fn getnameinfo(
1838 sa: *const ::sockaddr,
1839 salen: ::socklen_t,
1840 host: *mut ::c_char,
1841 hostlen: ::socklen_t,
1842 serv: *mut ::c_char,
1843 sevlen: ::socklen_t,
1844 flags: ::c_int,
1845 ) -> ::c_int;
1846 pub fn mprotect(
1847 addr: *mut ::c_void,
1848 len: ::size_t,
1849 prot: ::c_int,
1850 ) -> ::c_int;
1851 pub fn sysctl(
1852 name: *const ::c_int,
1853 namelen: ::c_uint,
1854 oldp: *mut ::c_void,
1855 oldlenp: *mut ::size_t,
1856 newp: *const ::c_void,
1857 newlen: ::size_t,
1858 ) -> ::c_int;
1859 pub fn sysctlbyname(
1860 name: *const ::c_char,
1861 oldp: *mut ::c_void,
1862 oldlenp: *mut ::size_t,
1863 newp: *const ::c_void,
1864 newlen: ::size_t,
1865 ) -> ::c_int;
476ff2be 1866 #[link_name = "__kevent50"]
e74abb32
XL
1867 pub fn kevent(
1868 kq: ::c_int,
1869 changelist: *const ::kevent,
1870 nchanges: ::size_t,
1871 eventlist: *mut ::kevent,
1872 nevents: ::size_t,
1873 timeout: *const ::timespec,
1874 ) -> ::c_int;
476ff2be 1875 #[link_name = "__mount50"]
e74abb32
XL
1876 pub fn mount(
1877 src: *const ::c_char,
1878 target: *const ::c_char,
1879 flags: ::c_int,
1880 data: *mut ::c_void,
1881 size: ::size_t,
1882 ) -> ::c_int;
2c00a5a8
XL
1883 pub fn mq_open(name: *const ::c_char, oflag: ::c_int, ...) -> ::mqd_t;
1884 pub fn mq_close(mqd: ::mqd_t) -> ::c_int;
1885 pub fn mq_getattr(mqd: ::mqd_t, attr: *mut ::mq_attr) -> ::c_int;
e74abb32
XL
1886 pub fn mq_notify(mqd: ::mqd_t, notification: *const ::sigevent)
1887 -> ::c_int;
1888 pub fn mq_receive(
1889 mqd: ::mqd_t,
1890 msg_ptr: *mut ::c_char,
1891 msg_len: ::size_t,
1892 msg_prio: *mut ::c_uint,
1893 ) -> ::ssize_t;
1894 pub fn mq_send(
1895 mqd: ::mqd_t,
1896 msg_ptr: *const ::c_char,
1897 msg_len: ::size_t,
1898 msg_prio: ::c_uint,
1899 ) -> ::c_int;
1900 pub fn mq_setattr(
1901 mqd: ::mqd_t,
1902 newattr: *const ::mq_attr,
1903 oldattr: *mut ::mq_attr,
1904 ) -> ::c_int;
69743fb6 1905 #[link_name = "__mq_timedreceive50"]
e74abb32
XL
1906 pub fn mq_timedreceive(
1907 mqd: ::mqd_t,
1908 msg_ptr: *mut ::c_char,
1909 msg_len: ::size_t,
1910 msg_prio: *mut ::c_uint,
1911 abs_timeout: *const ::timespec,
1912 ) -> ::ssize_t;
69743fb6 1913 #[link_name = "__mq_timedsend50"]
e74abb32
XL
1914 pub fn mq_timedsend(
1915 mqd: ::mqd_t,
1916 msg_ptr: *const ::c_char,
1917 msg_len: ::size_t,
1918 msg_prio: ::c_uint,
1919 abs_timeout: *const ::timespec,
1920 ) -> ::c_int;
2c00a5a8 1921 pub fn mq_unlink(name: *const ::c_char) -> ::c_int;
e74abb32
XL
1922 pub fn ptrace(
1923 request: ::c_int,
1924 pid: ::pid_t,
1925 addr: *mut ::c_void,
1926 data: ::c_int,
1927 ) -> ::c_int;
1928 pub fn pthread_setname_np(
1929 t: ::pthread_t,
1930 name: *const ::c_char,
dfeec247
XL
1931 arg: *const ::c_void,
1932 ) -> ::c_int;
1933 pub fn pthread_attr_get_np(
1934 thread: ::pthread_t,
1935 attr: *mut ::pthread_attr_t,
e74abb32
XL
1936 ) -> ::c_int;
1937 pub fn pthread_getattr_np(
1938 native: ::pthread_t,
1939 attr: *mut ::pthread_attr_t,
1940 ) -> ::c_int;
1941 pub fn pthread_attr_getguardsize(
1942 attr: *const ::pthread_attr_t,
1943 guardsize: *mut ::size_t,
1944 ) -> ::c_int;
1945 pub fn pthread_attr_getstack(
1946 attr: *const ::pthread_attr_t,
1947 stackaddr: *mut *mut ::c_void,
1948 stacksize: *mut ::size_t,
1949 ) -> ::c_int;
476ff2be 1950 #[link_name = "__sigtimedwait50"]
e74abb32
XL
1951 pub fn sigtimedwait(
1952 set: *const sigset_t,
1953 info: *mut siginfo_t,
1954 timeout: *const ::timespec,
1955 ) -> ::c_int;
1956 pub fn sigwaitinfo(set: *const sigset_t, info: *mut siginfo_t) -> ::c_int;
476ff2be
SL
1957 pub fn duplocale(base: ::locale_t) -> ::locale_t;
1958 pub fn freelocale(loc: ::locale_t);
1959 pub fn localeconv_l(loc: ::locale_t) -> *mut lconv;
e74abb32
XL
1960 pub fn newlocale(
1961 mask: ::c_int,
1962 locale: *const ::c_char,
1963 base: ::locale_t,
1964 ) -> ::locale_t;
041b39d2
XL
1965 #[link_name = "__settimeofday50"]
1966 pub fn settimeofday(tv: *const ::timeval, tz: *const ::c_void) -> ::c_int;
69743fb6
XL
1967
1968 pub fn dup3(src: ::c_int, dst: ::c_int, flags: ::c_int) -> ::c_int;
532ac7d7 1969
e74abb32
XL
1970 pub fn sendmmsg(
1971 sockfd: ::c_int,
1972 msgvec: *mut ::mmsghdr,
1973 vlen: ::c_uint,
1974 flags: ::c_int,
1975 ) -> ::c_int;
1976 pub fn recvmmsg(
1977 sockfd: ::c_int,
1978 msgvec: *mut ::mmsghdr,
1979 vlen: ::c_uint,
1980 flags: ::c_int,
1981 timeout: *mut ::timespec,
1982 ) -> ::c_int;
1983
1984 pub fn _lwp_self() -> lwpid_t;
ba9703b0
XL
1985 pub fn memmem(
1986 haystack: *const ::c_void,
1987 haystacklen: ::size_t,
1988 needle: *const ::c_void,
1989 needlelen: ::size_t,
1990 ) -> *mut ::c_void;
476ff2be
SL
1991}
1992
0531ce1d 1993#[link(name = "util")]
e74abb32 1994extern "C" {
0531ce1d 1995 #[cfg_attr(target_os = "netbsd", link_name = "__getpwent_r50")]
e74abb32
XL
1996 pub fn getpwent_r(
1997 pwd: *mut ::passwd,
1998 buf: *mut ::c_char,
1999 buflen: ::size_t,
2000 result: *mut *mut ::passwd,
2001 ) -> ::c_int;
2002 pub fn getgrent_r(
2003 grp: *mut ::group,
2004 buf: *mut ::c_char,
2005 buflen: ::size_t,
2006 result: *mut *mut ::group,
2007 ) -> ::c_int;
dfeec247
XL
2008
2009 pub fn updwtmpx(file: *const ::c_char, ut: *const utmpx) -> ::c_int;
2010 pub fn getlastlogx(
2011 fname: *const ::c_char,
2012 uid: ::uid_t,
2013 ll: *mut lastlogx,
2014 ) -> *mut lastlogx;
2015 pub fn updlastlogx(
2016 fname: *const ::c_char,
2017 uid: ::uid_t,
2018 ll: *mut lastlogx,
2019 ) -> ::c_int;
2020 pub fn utmpxname(file: *const ::c_char) -> ::c_int;
2021 pub fn getutxent() -> *mut utmpx;
2022 pub fn getutxid(ut: *const utmpx) -> *mut utmpx;
2023 pub fn getutxline(ut: *const utmpx) -> *mut utmpx;
2024 pub fn pututxline(ut: *const utmpx) -> *mut utmpx;
2025 pub fn setutxent();
2026 pub fn endutxent();
2027
2028 pub fn getutmp(ux: *const utmpx, u: *mut utmp);
2029 pub fn getutmpx(u: *const utmp, ux: *mut utmpx);
2030
2031 pub fn utpname(file: *const ::c_char) -> ::c_int;
2032 pub fn setutent();
2033 pub fn endutent();
2034 pub fn getutent() -> *mut utmp;
0531ce1d
XL
2035}
2036
69743fb6
XL
2037cfg_if! {
2038 if #[cfg(target_arch = "aarch64")] {
2039 mod aarch64;
2040 pub use self::aarch64::*;
2041 } else if #[cfg(target_arch = "arm")] {
2042 mod arm;
2043 pub use self::arm::*;
2044 } else if #[cfg(target_arch = "powerpc")] {
2045 mod powerpc;
2046 pub use self::powerpc::*;
2047 } else if #[cfg(target_arch = "sparc64")] {
2048 mod sparc64;
2049 pub use self::sparc64::*;
2050 } else if #[cfg(target_arch = "x86_64")] {
2051 mod x86_64;
2052 pub use self::x86_64::*;
2053 } else if #[cfg(target_arch = "x86")] {
2054 mod x86;
2055 pub use self::x86::*;
2056 } else {
2057 // Unknown target_arch
2058 }
2059}