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