]> git.proxmox.com Git - rustc.git/blob - vendor/libc/src/unix/bsd/apple/mod.rs
New upstream version 1.55.0+dfsg1
[rustc.git] / vendor / libc / src / unix / bsd / apple / mod.rs
1 //! Apple (ios/darwin)-specific definitions
2 //!
3 //! This covers *-apple-* triples currently
4 pub type c_char = i8;
5 pub type wchar_t = i32;
6 pub type clock_t = c_ulong;
7 pub type time_t = c_long;
8 pub type suseconds_t = i32;
9 pub type dev_t = i32;
10 pub type ino_t = u64;
11 pub type mode_t = u16;
12 pub type nlink_t = u16;
13 pub type blksize_t = i32;
14 pub type rlim_t = u64;
15 pub type pthread_key_t = c_ulong;
16 pub type sigset_t = u32;
17 pub type clockid_t = ::c_uint;
18 pub type fsblkcnt_t = ::c_uint;
19 pub type fsfilcnt_t = ::c_uint;
20 pub type speed_t = ::c_ulong;
21 pub type tcflag_t = ::c_ulong;
22 pub type nl_item = ::c_int;
23 pub type id_t = ::c_uint;
24 pub type sem_t = ::c_int;
25 pub type idtype_t = ::c_uint;
26 pub type integer_t = ::c_int;
27 pub type cpu_type_t = integer_t;
28 pub type cpu_subtype_t = integer_t;
29 pub type natural_t = u32;
30 pub type mach_msg_type_number_t = natural_t;
31 pub type kern_return_t = ::c_int;
32 pub type uuid_t = [u8; 16];
33
34 pub type posix_spawnattr_t = *mut ::c_void;
35 pub type posix_spawn_file_actions_t = *mut ::c_void;
36 pub type key_t = ::c_int;
37 pub type shmatt_t = ::c_ushort;
38
39 pub type sae_associd_t = u32;
40 pub type sae_connid_t = u32;
41
42 pub type mach_port_t = ::c_uint;
43 pub type processor_flavor_t = ::c_int;
44
45 pub type iconv_t = *mut ::c_void;
46
47 pub type processor_cpu_load_info_t = *mut processor_cpu_load_info;
48 pub type processor_cpu_load_info_data_t = processor_cpu_load_info;
49 pub type processor_basic_info_t = *mut processor_basic_info;
50 pub type processor_basic_info_data_t = processor_basic_info;
51 pub type processor_set_basic_info_data_t = processor_set_basic_info;
52 pub type processor_set_basic_info_t = *mut processor_set_basic_info;
53 pub type processor_set_load_info_data_t = processor_set_load_info;
54 pub type processor_set_load_info_t = *mut processor_set_load_info;
55 pub type processor_info_t = *mut integer_t;
56 pub type processor_info_array_t = *mut integer_t;
57
58 pub type thread_t = mach_port_t;
59 pub type thread_policy_flavor_t = natural_t;
60 pub type thread_policy_t = *mut integer_t;
61 pub type thread_latency_qos_t = integer_t;
62 pub type thread_throughput_qos_t = integer_t;
63 pub type thread_standard_policy_data_t = thread_standard_policy;
64 pub type thread_standard_policy_t = *mut thread_standard_policy;
65 pub type thread_extended_policy_data_t = thread_extended_policy;
66 pub type thread_extended_policy_t = *mut thread_extended_policy;
67 pub type thread_time_constraint_policy_data_t = thread_time_constraint_policy;
68 pub type thread_time_constraint_policy_t = *mut thread_time_constraint_policy;
69 pub type thread_precedence_policy_data_t = thread_precedence_policy;
70 pub type thread_precedence_policy_t = *mut thread_precedence_policy;
71 pub type thread_affinity_policy_data_t = thread_affinity_policy;
72 pub type thread_affinity_policy_t = *mut thread_affinity_policy;
73 pub type thread_background_policy_data_t = thread_background_policy;
74 pub type thread_background_policy_t = *mut thread_background_policy;
75 pub type thread_latency_qos_policy_data_t = thread_latency_qos_policy;
76 pub type thread_latency_qos_policy_t = *mut thread_latency_qos_policy;
77 pub type thread_throughput_qos_policy_data_t = thread_throughput_qos_policy;
78 pub type thread_throughput_qos_policy_t = *mut thread_throughput_qos_policy;
79
80 pub type CCStatus = i32;
81 pub type CCCryptorStatus = i32;
82 pub type CCRNGStatus = ::CCCryptorStatus;
83
84 deprecated_mach! {
85 pub type vm_prot_t = ::c_int;
86 pub type vm_size_t = ::uintptr_t;
87 pub type mach_timebase_info_data_t = mach_timebase_info;
88 }
89
90 #[cfg_attr(feature = "extra_traits", derive(Debug))]
91 pub enum timezone {}
92 impl ::Copy for timezone {}
93 impl ::Clone for timezone {
94 fn clone(&self) -> timezone {
95 *self
96 }
97 }
98
99 #[cfg_attr(feature = "extra_traits", derive(Debug))]
100 #[repr(u32)]
101 pub enum qos_class_t {
102 QOS_CLASS_USER_INTERACTIVE = 0x21,
103 QOS_CLASS_USER_INITIATED = 0x19,
104 QOS_CLASS_DEFAULT = 0x15,
105 QOS_CLASS_UTILITY = 0x11,
106 QOS_CLASS_BACKGROUND = 0x09,
107 QOS_CLASS_UNSPECIFIED = 0x00,
108 }
109 impl ::Copy for qos_class_t {}
110 impl ::Clone for qos_class_t {
111 fn clone(&self) -> qos_class_t {
112 *self
113 }
114 }
115
116 s! {
117 pub struct ip_mreq {
118 pub imr_multiaddr: in_addr,
119 pub imr_interface: in_addr,
120 }
121
122 pub struct aiocb {
123 pub aio_fildes: ::c_int,
124 pub aio_offset: ::off_t,
125 pub aio_buf: *mut ::c_void,
126 pub aio_nbytes: ::size_t,
127 pub aio_reqprio: ::c_int,
128 pub aio_sigevent: sigevent,
129 pub aio_lio_opcode: ::c_int
130 }
131
132 pub struct glob_t {
133 pub gl_pathc: ::size_t,
134 __unused1: ::c_int,
135 pub gl_offs: ::size_t,
136 __unused2: ::c_int,
137 pub gl_pathv: *mut *mut ::c_char,
138
139 __unused3: *mut ::c_void,
140
141 __unused4: *mut ::c_void,
142 __unused5: *mut ::c_void,
143 __unused6: *mut ::c_void,
144 __unused7: *mut ::c_void,
145 __unused8: *mut ::c_void,
146 }
147
148 pub struct addrinfo {
149 pub ai_flags: ::c_int,
150 pub ai_family: ::c_int,
151 pub ai_socktype: ::c_int,
152 pub ai_protocol: ::c_int,
153 pub ai_addrlen: ::socklen_t,
154 pub ai_canonname: *mut ::c_char,
155 pub ai_addr: *mut ::sockaddr,
156 pub ai_next: *mut addrinfo,
157 }
158
159 #[deprecated(
160 since = "0.2.55",
161 note = "Use the `mach` crate instead",
162 )]
163 pub struct mach_timebase_info {
164 pub numer: u32,
165 pub denom: u32,
166 }
167
168 pub struct stat {
169 pub st_dev: dev_t,
170 pub st_mode: mode_t,
171 pub st_nlink: nlink_t,
172 pub st_ino: ino_t,
173 pub st_uid: ::uid_t,
174 pub st_gid: ::gid_t,
175 pub st_rdev: dev_t,
176 pub st_atime: time_t,
177 pub st_atime_nsec: c_long,
178 pub st_mtime: time_t,
179 pub st_mtime_nsec: c_long,
180 pub st_ctime: time_t,
181 pub st_ctime_nsec: c_long,
182 pub st_birthtime: time_t,
183 pub st_birthtime_nsec: c_long,
184 pub st_size: ::off_t,
185 pub st_blocks: ::blkcnt_t,
186 pub st_blksize: blksize_t,
187 pub st_flags: u32,
188 pub st_gen: u32,
189 pub st_lspare: i32,
190 pub st_qspare: [i64; 2],
191 }
192
193 pub struct pthread_mutexattr_t {
194 __sig: ::c_long,
195 __opaque: [u8; 8],
196 }
197
198 pub struct pthread_condattr_t {
199 __sig: ::c_long,
200 __opaque: [u8; __PTHREAD_CONDATTR_SIZE__],
201 }
202
203 pub struct pthread_rwlockattr_t {
204 __sig: ::c_long,
205 __opaque: [u8; __PTHREAD_RWLOCKATTR_SIZE__],
206 }
207
208 pub struct siginfo_t {
209 pub si_signo: ::c_int,
210 pub si_errno: ::c_int,
211 pub si_code: ::c_int,
212 pub si_pid: ::pid_t,
213 pub si_uid: ::uid_t,
214 pub si_status: ::c_int,
215 pub si_addr: *mut ::c_void,
216 //Requires it to be union for tests
217 //pub si_value: ::sigval,
218 _pad: [usize; 9],
219 }
220
221 pub struct sigaction {
222 // FIXME: this field is actually a union
223 pub sa_sigaction: ::sighandler_t,
224 pub sa_mask: sigset_t,
225 pub sa_flags: ::c_int,
226 }
227
228 pub struct stack_t {
229 pub ss_sp: *mut ::c_void,
230 pub ss_size: ::size_t,
231 pub ss_flags: ::c_int,
232 }
233
234 pub struct fstore_t {
235 pub fst_flags: ::c_uint,
236 pub fst_posmode: ::c_int,
237 pub fst_offset: ::off_t,
238 pub fst_length: ::off_t,
239 pub fst_bytesalloc: ::off_t,
240 }
241
242 pub struct radvisory {
243 pub ra_offset: ::off_t,
244 pub ra_count: ::c_int,
245 }
246
247 pub struct statvfs {
248 pub f_bsize: ::c_ulong,
249 pub f_frsize: ::c_ulong,
250 pub f_blocks: ::fsblkcnt_t,
251 pub f_bfree: ::fsblkcnt_t,
252 pub f_bavail: ::fsblkcnt_t,
253 pub f_files: ::fsfilcnt_t,
254 pub f_ffree: ::fsfilcnt_t,
255 pub f_favail: ::fsfilcnt_t,
256 pub f_fsid: ::c_ulong,
257 pub f_flag: ::c_ulong,
258 pub f_namemax: ::c_ulong,
259 }
260
261 pub struct Dl_info {
262 pub dli_fname: *const ::c_char,
263 pub dli_fbase: *mut ::c_void,
264 pub dli_sname: *const ::c_char,
265 pub dli_saddr: *mut ::c_void,
266 }
267
268 pub struct sockaddr_in {
269 pub sin_len: u8,
270 pub sin_family: ::sa_family_t,
271 pub sin_port: ::in_port_t,
272 pub sin_addr: ::in_addr,
273 pub sin_zero: [::c_char; 8],
274 }
275
276 pub struct kevent64_s {
277 pub ident: u64,
278 pub filter: i16,
279 pub flags: u16,
280 pub fflags: u32,
281 pub data: i64,
282 pub udata: u64,
283 pub ext: [u64; 2],
284 }
285
286 pub struct dqblk {
287 pub dqb_bhardlimit: u64,
288 pub dqb_bsoftlimit: u64,
289 pub dqb_curbytes: u64,
290 pub dqb_ihardlimit: u32,
291 pub dqb_isoftlimit: u32,
292 pub dqb_curinodes: u32,
293 pub dqb_btime: u32,
294 pub dqb_itime: u32,
295 pub dqb_id: u32,
296 pub dqb_spare: [u32; 4],
297 }
298
299 pub struct if_msghdr {
300 pub ifm_msglen: ::c_ushort,
301 pub ifm_version: ::c_uchar,
302 pub ifm_type: ::c_uchar,
303 pub ifm_addrs: ::c_int,
304 pub ifm_flags: ::c_int,
305 pub ifm_index: ::c_ushort,
306 pub ifm_data: if_data,
307 }
308
309 pub struct termios {
310 pub c_iflag: ::tcflag_t,
311 pub c_oflag: ::tcflag_t,
312 pub c_cflag: ::tcflag_t,
313 pub c_lflag: ::tcflag_t,
314 pub c_cc: [::cc_t; ::NCCS],
315 pub c_ispeed: ::speed_t,
316 pub c_ospeed: ::speed_t,
317 }
318
319 pub struct flock {
320 pub l_start: ::off_t,
321 pub l_len: ::off_t,
322 pub l_pid: ::pid_t,
323 pub l_type: ::c_short,
324 pub l_whence: ::c_short,
325 }
326
327 pub struct sf_hdtr {
328 pub headers: *mut ::iovec,
329 pub hdr_cnt: ::c_int,
330 pub trailers: *mut ::iovec,
331 pub trl_cnt: ::c_int,
332 }
333
334 pub struct lconv {
335 pub decimal_point: *mut ::c_char,
336 pub thousands_sep: *mut ::c_char,
337 pub grouping: *mut ::c_char,
338 pub int_curr_symbol: *mut ::c_char,
339 pub currency_symbol: *mut ::c_char,
340 pub mon_decimal_point: *mut ::c_char,
341 pub mon_thousands_sep: *mut ::c_char,
342 pub mon_grouping: *mut ::c_char,
343 pub positive_sign: *mut ::c_char,
344 pub negative_sign: *mut ::c_char,
345 pub int_frac_digits: ::c_char,
346 pub frac_digits: ::c_char,
347 pub p_cs_precedes: ::c_char,
348 pub p_sep_by_space: ::c_char,
349 pub n_cs_precedes: ::c_char,
350 pub n_sep_by_space: ::c_char,
351 pub p_sign_posn: ::c_char,
352 pub n_sign_posn: ::c_char,
353 pub int_p_cs_precedes: ::c_char,
354 pub int_n_cs_precedes: ::c_char,
355 pub int_p_sep_by_space: ::c_char,
356 pub int_n_sep_by_space: ::c_char,
357 pub int_p_sign_posn: ::c_char,
358 pub int_n_sign_posn: ::c_char,
359 }
360
361 pub struct proc_taskinfo {
362 pub pti_virtual_size: u64,
363 pub pti_resident_size: u64,
364 pub pti_total_user: u64,
365 pub pti_total_system: u64,
366 pub pti_threads_user: u64,
367 pub pti_threads_system: u64,
368 pub pti_policy: i32,
369 pub pti_faults: i32,
370 pub pti_pageins: i32,
371 pub pti_cow_faults: i32,
372 pub pti_messages_sent: i32,
373 pub pti_messages_received: i32,
374 pub pti_syscalls_mach: i32,
375 pub pti_syscalls_unix: i32,
376 pub pti_csw: i32,
377 pub pti_threadnum: i32,
378 pub pti_numrunning: i32,
379 pub pti_priority: i32,
380 }
381
382 pub struct proc_bsdinfo {
383 pub pbi_flags: u32,
384 pub pbi_status: u32,
385 pub pbi_xstatus: u32,
386 pub pbi_pid: u32,
387 pub pbi_ppid: u32,
388 pub pbi_uid: ::uid_t,
389 pub pbi_gid: ::gid_t,
390 pub pbi_ruid: ::uid_t,
391 pub pbi_rgid: ::gid_t,
392 pub pbi_svuid: ::uid_t,
393 pub pbi_svgid: ::gid_t,
394 pub rfu_1: u32,
395 pub pbi_comm: [::c_char; MAXCOMLEN],
396 pub pbi_name: [::c_char; 32], // MAXCOMLEN * 2, but macro isn't happy...
397 pub pbi_nfiles: u32,
398 pub pbi_pgid: u32,
399 pub pbi_pjobc: u32,
400 pub e_tdev: u32,
401 pub e_tpgid: u32,
402 pub pbi_nice: i32,
403 pub pbi_start_tvsec: u64,
404 pub pbi_start_tvusec: u64,
405 }
406
407 pub struct proc_taskallinfo {
408 pub pbsd: proc_bsdinfo,
409 pub ptinfo: proc_taskinfo,
410 }
411
412 pub struct xsw_usage {
413 pub xsu_total: u64,
414 pub xsu_avail: u64,
415 pub xsu_used: u64,
416 pub xsu_pagesize: u32,
417 pub xsu_encrypted: ::boolean_t,
418 }
419
420 pub struct xucred {
421 pub cr_version: ::c_uint,
422 pub cr_uid: ::uid_t,
423 pub cr_ngroups: ::c_short,
424 pub cr_groups: [::gid_t;16]
425 }
426
427 #[deprecated(
428 since = "0.2.55",
429 note = "Use the `mach` crate instead",
430 )]
431 pub struct mach_header {
432 pub magic: u32,
433 pub cputype: cpu_type_t,
434 pub cpusubtype: cpu_subtype_t,
435 pub filetype: u32,
436 pub ncmds: u32,
437 pub sizeofcmds: u32,
438 pub flags: u32,
439 }
440
441 #[deprecated(
442 since = "0.2.55",
443 note = "Use the `mach` crate instead",
444 )]
445 pub struct mach_header_64 {
446 pub magic: u32,
447 pub cputype: cpu_type_t,
448 pub cpusubtype: cpu_subtype_t,
449 pub filetype: u32,
450 pub ncmds: u32,
451 pub sizeofcmds: u32,
452 pub flags: u32,
453 pub reserved: u32,
454 }
455
456 pub struct segment_command {
457 pub cmd: u32,
458 pub cmdsize: u32,
459 pub segname: [::c_char; 16],
460 pub vmaddr: u32,
461 pub vmsize: u32,
462 pub fileoff: u32,
463 pub filesize: u32,
464 pub maxprot: vm_prot_t,
465 pub initprot: vm_prot_t,
466 pub nsects: u32,
467 pub flags: u32,
468 }
469
470 pub struct segment_command_64 {
471 pub cmd: u32,
472 pub cmdsize: u32,
473 pub segname: [::c_char; 16],
474 pub vmaddr: u64,
475 pub vmsize: u64,
476 pub fileoff: u64,
477 pub filesize: u64,
478 pub maxprot: vm_prot_t,
479 pub initprot: vm_prot_t,
480 pub nsects: u32,
481 pub flags: u32,
482 }
483
484 pub struct load_command {
485 pub cmd: u32,
486 pub cmdsize: u32,
487 }
488
489 pub struct sockaddr_dl {
490 pub sdl_len: ::c_uchar,
491 pub sdl_family: ::c_uchar,
492 pub sdl_index: ::c_ushort,
493 pub sdl_type: ::c_uchar,
494 pub sdl_nlen: ::c_uchar,
495 pub sdl_alen: ::c_uchar,
496 pub sdl_slen: ::c_uchar,
497 pub sdl_data: [::c_char; 12],
498 }
499
500 pub struct sockaddr_inarp {
501 pub sin_len: ::c_uchar,
502 pub sin_family: ::c_uchar,
503 pub sin_port: ::c_ushort,
504 pub sin_addr: ::in_addr,
505 pub sin_srcaddr: ::in_addr,
506 pub sin_tos: ::c_ushort,
507 pub sin_other: ::c_ushort,
508 }
509
510 pub struct sockaddr_ctl {
511 pub sc_len: ::c_uchar,
512 pub sc_family: ::c_uchar,
513 pub ss_sysaddr: u16,
514 pub sc_id: u32,
515 pub sc_unit: u32,
516 pub sc_reserved: [u32; 5],
517 }
518
519 pub struct in_pktinfo {
520 pub ipi_ifindex: ::c_uint,
521 pub ipi_spec_dst: ::in_addr,
522 pub ipi_addr: ::in_addr,
523 }
524
525 pub struct in6_pktinfo {
526 pub ipi6_addr: ::in6_addr,
527 pub ipi6_ifindex: ::c_uint,
528 }
529
530 // sys/ipc.h:
531
532 pub struct ipc_perm {
533 pub uid: ::uid_t,
534 pub gid: ::gid_t,
535 pub cuid: ::uid_t,
536 pub cgid: ::gid_t,
537 pub mode: ::mode_t,
538 pub _seq: ::c_ushort,
539 pub _key: ::key_t,
540 }
541
542 // sys/sem.h
543
544 pub struct sembuf {
545 pub sem_num: ::c_ushort,
546 pub sem_op: ::c_short,
547 pub sem_flg: ::c_short,
548 }
549
550 // sys/shm.h
551
552 pub struct arphdr {
553 pub ar_hrd: u16,
554 pub ar_pro: u16,
555 pub ar_hln: u8,
556 pub ar_pln: u8,
557 pub ar_op: u16,
558 }
559
560 pub struct in_addr {
561 pub s_addr: ::in_addr_t,
562 }
563
564 // sys/socket.h
565
566 pub struct sa_endpoints_t {
567 pub sae_srcif: ::c_uint, // optional source interface
568 pub sae_srcaddr: *const ::sockaddr, // optional source address
569 pub sae_srcaddrlen: ::socklen_t, // size of source address
570 pub sae_dstaddr: *const ::sockaddr, // destination address
571 pub sae_dstaddrlen: ::socklen_t, // size of destination address
572 }
573
574 pub struct timex {
575 pub modes: ::c_uint,
576 pub offset: ::c_long,
577 pub freq: ::c_long,
578 pub maxerror: ::c_long,
579 pub esterror: ::c_long,
580 pub status: ::c_int,
581 pub constant: ::c_long,
582 pub precision: ::c_long,
583 pub tolerance: ::c_long,
584 pub ppsfreq: ::c_long,
585 pub jitter: ::c_long,
586 pub shift: ::c_int,
587 pub stabil: ::c_long,
588 pub jitcnt: ::c_long,
589 pub calcnt: ::c_long,
590 pub errcnt: ::c_long,
591 pub stbcnt: ::c_long,
592 }
593
594 pub struct ntptimeval {
595 pub time: ::timespec,
596 pub maxerror: ::c_long,
597 pub esterror: ::c_long,
598 pub tai: ::c_long,
599 pub time_state: ::c_int,
600 }
601
602 pub struct thread_standard_policy {
603 pub no_data: natural_t,
604 }
605
606 pub struct thread_extended_policy {
607 pub timeshare: boolean_t,
608 }
609
610 pub struct thread_time_constraint_policy {
611 pub period: u32,
612 pub computation: u32,
613 pub constraint: u32,
614 pub preemptible: boolean_t,
615 }
616
617 pub struct thread_precedence_policy {
618 pub importance: integer_t,
619 }
620
621 pub struct thread_affinity_policy {
622 pub affinity_tag: integer_t,
623 }
624
625 pub struct thread_background_policy {
626 pub priority: integer_t,
627 }
628
629 pub struct thread_latency_qos_policy {
630 pub thread_latency_qos_tier: thread_latency_qos_t,
631 }
632
633 pub struct thread_throughput_qos_policy {
634 pub thread_throughput_qos_tier: thread_throughput_qos_t,
635 }
636
637 // malloc/malloc.h
638 pub struct malloc_statistics_t {
639 pub blocks_in_use: ::c_uint,
640 pub size_in_use: ::size_t,
641 pub max_size_in_use: ::size_t,
642 pub size_allocated: ::size_t,
643 }
644
645 pub struct mstats {
646 pub bytes_total: ::size_t,
647 pub chunks_used: ::size_t,
648 pub bytes_used: ::size_t,
649 pub chunks_free: ::size_t,
650 pub bytes_free: ::size_t,
651 }
652
653 pub struct malloc_zone_t {
654 __private: [::uintptr_t; 18], // FIXME: keeping private for now
655 }
656
657 // sched.h
658 pub struct sched_param {
659 pub sched_priority: ::c_int,
660 __opaque: [::c_char; 4],
661 }
662 }
663
664 s_no_extra_traits! {
665 #[cfg_attr(libc_packedN, repr(packed(4)))]
666 pub struct kevent {
667 pub ident: ::uintptr_t,
668 pub filter: i16,
669 pub flags: u16,
670 pub fflags: u32,
671 pub data: ::intptr_t,
672 pub udata: *mut ::c_void,
673 }
674
675 #[cfg_attr(libc_packedN, repr(packed(4)))]
676 pub struct semid_ds {
677 // Note the manpage shows different types than the system header.
678 pub sem_perm: ipc_perm,
679 pub sem_base: i32,
680 pub sem_nsems: ::c_ushort,
681 pub sem_otime: ::time_t,
682 pub sem_pad1: i32,
683 pub sem_ctime: ::time_t,
684 pub sem_pad2: i32,
685 pub sem_pad3: [i32; 4],
686 }
687
688 #[cfg_attr(libc_packedN, repr(packed(4)))]
689 pub struct shmid_ds {
690 pub shm_perm: ipc_perm,
691 pub shm_segsz: ::size_t,
692 pub shm_lpid: ::pid_t,
693 pub shm_cpid: ::pid_t,
694 pub shm_nattch: ::shmatt_t,
695 pub shm_atime: ::time_t, // FIXME: 64-bit wrong align => wrong offset
696 pub shm_dtime: ::time_t, // FIXME: 64-bit wrong align => wrong offset
697 pub shm_ctime: ::time_t, // FIXME: 64-bit wrong align => wrong offset
698 // FIXME: 64-bit wrong align => wrong offset:
699 pub shm_internal: *mut ::c_void,
700 }
701
702 pub struct proc_threadinfo {
703 pub pth_user_time: u64,
704 pub pth_system_time: u64,
705 pub pth_cpu_usage: i32,
706 pub pth_policy: i32,
707 pub pth_run_state: i32,
708 pub pth_flags: i32,
709 pub pth_sleep_time: i32,
710 pub pth_curpri: i32,
711 pub pth_priority: i32,
712 pub pth_maxpriority: i32,
713 pub pth_name: [::c_char; MAXTHREADNAMESIZE],
714 }
715
716 pub struct statfs {
717 pub f_bsize: u32,
718 pub f_iosize: i32,
719 pub f_blocks: u64,
720 pub f_bfree: u64,
721 pub f_bavail: u64,
722 pub f_files: u64,
723 pub f_ffree: u64,
724 pub f_fsid: ::fsid_t,
725 pub f_owner: ::uid_t,
726 pub f_type: u32,
727 pub f_flags: u32,
728 pub f_fssubtype: u32,
729 pub f_fstypename: [::c_char; 16],
730 pub f_mntonname: [::c_char; 1024],
731 pub f_mntfromname: [::c_char; 1024],
732 pub f_reserved: [u32; 8],
733 }
734
735 pub struct dirent {
736 pub d_ino: u64,
737 pub d_seekoff: u64,
738 pub d_reclen: u16,
739 pub d_namlen: u16,
740 pub d_type: u8,
741 pub d_name: [::c_char; 1024],
742 }
743
744 pub struct pthread_rwlock_t {
745 __sig: ::c_long,
746 __opaque: [u8; __PTHREAD_RWLOCK_SIZE__],
747 }
748
749 pub struct pthread_mutex_t {
750 __sig: ::c_long,
751 __opaque: [u8; __PTHREAD_MUTEX_SIZE__],
752 }
753
754 pub struct pthread_cond_t {
755 __sig: ::c_long,
756 __opaque: [u8; __PTHREAD_COND_SIZE__],
757 }
758
759 pub struct sockaddr_storage {
760 pub ss_len: u8,
761 pub ss_family: ::sa_family_t,
762 __ss_pad1: [u8; 6],
763 __ss_align: i64,
764 __ss_pad2: [u8; 112],
765 }
766
767 pub struct utmpx {
768 pub ut_user: [::c_char; _UTX_USERSIZE],
769 pub ut_id: [::c_char; _UTX_IDSIZE],
770 pub ut_line: [::c_char; _UTX_LINESIZE],
771 pub ut_pid: ::pid_t,
772 pub ut_type: ::c_short,
773 pub ut_tv: ::timeval,
774 pub ut_host: [::c_char; _UTX_HOSTSIZE],
775 ut_pad: [u32; 16],
776 }
777
778 pub struct sigevent {
779 pub sigev_notify: ::c_int,
780 pub sigev_signo: ::c_int,
781 pub sigev_value: ::sigval,
782 __unused1: *mut ::c_void, //actually a function pointer
783 pub sigev_notify_attributes: *mut ::pthread_attr_t
784 }
785
786 pub struct processor_cpu_load_info {
787 pub cpu_ticks: [::c_uint; CPU_STATE_MAX as usize],
788 }
789
790 pub struct processor_basic_info {
791 pub cpu_type: cpu_type_t,
792 pub cpu_subtype: cpu_subtype_t,
793 pub running: ::boolean_t,
794 pub slot_num: ::c_int,
795 pub is_master: ::boolean_t,
796 }
797
798 pub struct processor_set_basic_info {
799 pub processor_count: ::c_int,
800 pub default_policy: ::c_int,
801 }
802
803 pub struct processor_set_load_info {
804 pub task_count: ::c_int,
805 pub thread_count: ::c_int,
806 pub load_average: integer_t,
807 pub mach_factor: integer_t,
808 }
809 }
810
811 impl siginfo_t {
812 pub unsafe fn si_addr(&self) -> *mut ::c_void {
813 self.si_addr
814 }
815
816 pub unsafe fn si_value(&self) -> ::sigval {
817 #[repr(C)]
818 struct siginfo_timer {
819 _si_signo: ::c_int,
820 _si_errno: ::c_int,
821 _si_code: ::c_int,
822 _si_pid: ::pid_t,
823 _si_uid: ::uid_t,
824 _si_status: ::c_int,
825 _si_addr: *mut ::c_void,
826 si_value: ::sigval,
827 }
828
829 (*(self as *const siginfo_t as *const siginfo_timer)).si_value
830 }
831
832 pub unsafe fn si_pid(&self) -> ::pid_t {
833 self.si_pid
834 }
835
836 pub unsafe fn si_uid(&self) -> ::uid_t {
837 self.si_uid
838 }
839
840 pub unsafe fn si_status(&self) -> ::c_int {
841 self.si_status
842 }
843 }
844
845 cfg_if! {
846 if #[cfg(libc_union)] {
847 s_no_extra_traits! {
848 pub union semun {
849 pub val: ::c_int,
850 pub buf: *mut semid_ds,
851 pub array: *mut ::c_ushort,
852 }
853 }
854
855 cfg_if! {
856 if #[cfg(feature = "extra_traits")] {
857 impl PartialEq for semun {
858 fn eq(&self, other: &semun) -> bool {
859 unsafe { self.val == other.val }
860 }
861 }
862 impl Eq for semun {}
863 impl ::fmt::Debug for semun {
864 fn fmt(&self, f: &mut ::fmt::Formatter)
865 -> ::fmt::Result {
866 f.debug_struct("semun")
867 .field("val", unsafe { &self.val })
868 .finish()
869 }
870 }
871 impl ::hash::Hash for semun {
872 fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
873 unsafe { self.val.hash(state) };
874 }
875 }
876 }
877 }
878 }
879 }
880
881 cfg_if! {
882 if #[cfg(feature = "extra_traits")] {
883 impl PartialEq for kevent {
884 fn eq(&self, other: &kevent) -> bool {
885 self.ident == other.ident
886 && self.filter == other.filter
887 && self.flags == other.flags
888 && self.fflags == other.fflags
889 && self.data == other.data
890 && self.udata == other.udata
891 }
892 }
893 impl Eq for kevent {}
894 impl ::fmt::Debug for kevent {
895 fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
896 let ident = self.ident;
897 let filter = self.filter;
898 let flags = self.flags;
899 let fflags = self.fflags;
900 let data = self.data;
901 let udata = self.udata;
902 f.debug_struct("kevent")
903 .field("ident", &ident)
904 .field("filter", &filter)
905 .field("flags", &flags)
906 .field("fflags", &fflags)
907 .field("data", &data)
908 .field("udata", &udata)
909 .finish()
910 }
911 }
912 impl ::hash::Hash for kevent {
913 fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
914 let ident = self.ident;
915 let filter = self.filter;
916 let flags = self.flags;
917 let fflags = self.fflags;
918 let data = self.data;
919 let udata = self.udata;
920 ident.hash(state);
921 filter.hash(state);
922 flags.hash(state);
923 fflags.hash(state);
924 data.hash(state);
925 udata.hash(state);
926 }
927 }
928
929 impl PartialEq for semid_ds {
930 fn eq(&self, other: &semid_ds) -> bool {
931 let sem_perm = self.sem_perm;
932 let sem_pad3 = self.sem_pad3;
933 let other_sem_perm = other.sem_perm;
934 let other_sem_pad3 = other.sem_pad3;
935 sem_perm == other_sem_perm
936 && self.sem_base == other.sem_base
937 && self.sem_nsems == other.sem_nsems
938 && self.sem_otime == other.sem_otime
939 && self.sem_pad1 == other.sem_pad1
940 && self.sem_ctime == other.sem_ctime
941 && self.sem_pad2 == other.sem_pad2
942 && sem_pad3 == other_sem_pad3
943 }
944 }
945 impl Eq for semid_ds {}
946 impl ::fmt::Debug for semid_ds {
947 fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
948 let sem_perm = self.sem_perm;
949 let sem_base = self.sem_base;
950 let sem_nsems = self.sem_nsems;
951 let sem_otime = self.sem_otime;
952 let sem_pad1 = self.sem_pad1;
953 let sem_ctime = self.sem_ctime;
954 let sem_pad2 = self.sem_pad2;
955 let sem_pad3 = self.sem_pad3;
956 f.debug_struct("semid_ds")
957 .field("sem_perm", &sem_perm)
958 .field("sem_base", &sem_base)
959 .field("sem_nsems", &sem_nsems)
960 .field("sem_otime", &sem_otime)
961 .field("sem_pad1", &sem_pad1)
962 .field("sem_ctime", &sem_ctime)
963 .field("sem_pad2", &sem_pad2)
964 .field("sem_pad3", &sem_pad3)
965 .finish()
966 }
967 }
968 impl ::hash::Hash for semid_ds {
969 fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
970 let sem_perm = self.sem_perm;
971 let sem_base = self.sem_base;
972 let sem_nsems = self.sem_nsems;
973 let sem_otime = self.sem_otime;
974 let sem_pad1 = self.sem_pad1;
975 let sem_ctime = self.sem_ctime;
976 let sem_pad2 = self.sem_pad2;
977 let sem_pad3 = self.sem_pad3;
978 sem_perm.hash(state);
979 sem_base.hash(state);
980 sem_nsems.hash(state);
981 sem_otime.hash(state);
982 sem_pad1.hash(state);
983 sem_ctime.hash(state);
984 sem_pad2.hash(state);
985 sem_pad3.hash(state);
986 }
987 }
988
989 impl PartialEq for shmid_ds {
990 fn eq(&self, other: &shmid_ds) -> bool {
991 let shm_perm = self.shm_perm;
992 let other_shm_perm = other.shm_perm;
993 shm_perm == other_shm_perm
994 && self.shm_segsz == other.shm_segsz
995 && self.shm_lpid == other.shm_lpid
996 && self.shm_cpid == other.shm_cpid
997 && self.shm_nattch == other.shm_nattch
998 && self.shm_atime == other.shm_atime
999 && self.shm_dtime == other.shm_dtime
1000 && self.shm_ctime == other.shm_ctime
1001 && self.shm_internal == other.shm_internal
1002 }
1003 }
1004 impl Eq for shmid_ds {}
1005 impl ::fmt::Debug for shmid_ds {
1006 fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
1007 let shm_perm = self.shm_perm;
1008 let shm_segsz = self.shm_segsz;
1009 let shm_lpid = self.shm_lpid;
1010 let shm_cpid = self.shm_cpid;
1011 let shm_nattch = self.shm_nattch;
1012 let shm_atime = self.shm_atime;
1013 let shm_dtime = self.shm_dtime;
1014 let shm_ctime = self.shm_ctime;
1015 let shm_internal = self.shm_internal;
1016 f.debug_struct("shmid_ds")
1017 .field("shm_perm", &shm_perm)
1018 .field("shm_segsz", &shm_segsz)
1019 .field("shm_lpid", &shm_lpid)
1020 .field("shm_cpid", &shm_cpid)
1021 .field("shm_nattch", &shm_nattch)
1022 .field("shm_atime", &shm_atime)
1023 .field("shm_dtime", &shm_dtime)
1024 .field("shm_ctime", &shm_ctime)
1025 .field("shm_internal", &shm_internal)
1026 .finish()
1027 }
1028 }
1029 impl ::hash::Hash for shmid_ds {
1030 fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
1031 let shm_perm = self.shm_perm;
1032 let shm_segsz = self.shm_segsz;
1033 let shm_lpid = self.shm_lpid;
1034 let shm_cpid = self.shm_cpid;
1035 let shm_nattch = self.shm_nattch;
1036 let shm_atime = self.shm_atime;
1037 let shm_dtime = self.shm_dtime;
1038 let shm_ctime = self.shm_ctime;
1039 let shm_internal = self.shm_internal;
1040 shm_perm.hash(state);
1041 shm_segsz.hash(state);
1042 shm_lpid.hash(state);
1043 shm_cpid.hash(state);
1044 shm_nattch.hash(state);
1045 shm_atime.hash(state);
1046 shm_dtime.hash(state);
1047 shm_ctime.hash(state);
1048 shm_internal.hash(state);
1049 }
1050 }
1051
1052 impl PartialEq for proc_threadinfo {
1053 fn eq(&self, other: &proc_threadinfo) -> bool {
1054 self.pth_user_time == other.pth_user_time
1055 && self.pth_system_time == other.pth_system_time
1056 && self.pth_cpu_usage == other.pth_cpu_usage
1057 && self.pth_policy == other.pth_policy
1058 && self.pth_run_state == other.pth_run_state
1059 && self.pth_flags == other.pth_flags
1060 && self.pth_sleep_time == other.pth_sleep_time
1061 && self.pth_curpri == other.pth_curpri
1062 && self.pth_priority == other.pth_priority
1063 && self.pth_maxpriority == other.pth_maxpriority
1064 && self.pth_name
1065 .iter()
1066 .zip(other.pth_name.iter())
1067 .all(|(a,b)| a == b)
1068 }
1069 }
1070 impl Eq for proc_threadinfo {}
1071 impl ::fmt::Debug for proc_threadinfo {
1072 fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
1073 f.debug_struct("proc_threadinfo")
1074 .field("pth_user_time", &self.pth_user_time)
1075 .field("pth_system_time", &self.pth_system_time)
1076 .field("pth_cpu_usage", &self.pth_cpu_usage)
1077 .field("pth_policy", &self.pth_policy)
1078 .field("pth_run_state", &self.pth_run_state)
1079 .field("pth_flags", &self.pth_flags)
1080 .field("pth_sleep_time", &self.pth_sleep_time)
1081 .field("pth_curpri", &self.pth_curpri)
1082 .field("pth_priority", &self.pth_priority)
1083 .field("pth_maxpriority", &self.pth_maxpriority)
1084 // FIXME: .field("pth_name", &self.pth_name)
1085 .finish()
1086 }
1087 }
1088 impl ::hash::Hash for proc_threadinfo {
1089 fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
1090 self.pth_user_time.hash(state);
1091 self.pth_system_time.hash(state);
1092 self.pth_cpu_usage.hash(state);
1093 self.pth_policy.hash(state);
1094 self.pth_run_state.hash(state);
1095 self.pth_flags.hash(state);
1096 self.pth_sleep_time.hash(state);
1097 self.pth_curpri.hash(state);
1098 self.pth_priority.hash(state);
1099 self.pth_maxpriority.hash(state);
1100 self.pth_name.hash(state);
1101 }
1102 }
1103
1104 impl PartialEq for statfs {
1105 fn eq(&self, other: &statfs) -> bool {
1106 self.f_bsize == other.f_bsize
1107 && self.f_iosize == other.f_iosize
1108 && self.f_blocks == other.f_blocks
1109 && self.f_bfree == other.f_bfree
1110 && self.f_bavail == other.f_bavail
1111 && self.f_files == other.f_files
1112 && self.f_ffree == other.f_ffree
1113 && self.f_fsid == other.f_fsid
1114 && self.f_owner == other.f_owner
1115 && self.f_flags == other.f_flags
1116 && self.f_fssubtype == other.f_fssubtype
1117 && self.f_fstypename == other.f_fstypename
1118 && self.f_type == other.f_type
1119 && self
1120 .f_mntonname
1121 .iter()
1122 .zip(other.f_mntonname.iter())
1123 .all(|(a,b)| a == b)
1124 && self
1125 .f_mntfromname
1126 .iter()
1127 .zip(other.f_mntfromname.iter())
1128 .all(|(a,b)| a == b)
1129 && self.f_reserved == other.f_reserved
1130 }
1131 }
1132
1133 impl Eq for statfs {}
1134 impl ::fmt::Debug for statfs {
1135 fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
1136 f.debug_struct("statfs")
1137 .field("f_bsize", &self.f_bsize)
1138 .field("f_iosize", &self.f_iosize)
1139 .field("f_blocks", &self.f_blocks)
1140 .field("f_bfree", &self.f_bfree)
1141 .field("f_bavail", &self.f_bavail)
1142 .field("f_files", &self.f_files)
1143 .field("f_ffree", &self.f_ffree)
1144 .field("f_fsid", &self.f_fsid)
1145 .field("f_owner", &self.f_owner)
1146 .field("f_flags", &self.f_flags)
1147 .field("f_fssubtype", &self.f_fssubtype)
1148 .field("f_fstypename", &self.f_fstypename)
1149 .field("f_type", &self.f_type)
1150 // FIXME: .field("f_mntonname", &self.f_mntonname)
1151 // FIXME: .field("f_mntfromname", &self.f_mntfromname)
1152 .field("f_reserved", &self.f_reserved)
1153 .finish()
1154 }
1155 }
1156
1157 impl ::hash::Hash for statfs {
1158 fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
1159 self.f_bsize.hash(state);
1160 self.f_iosize.hash(state);
1161 self.f_blocks.hash(state);
1162 self.f_bfree.hash(state);
1163 self.f_bavail.hash(state);
1164 self.f_files.hash(state);
1165 self.f_ffree.hash(state);
1166 self.f_fsid.hash(state);
1167 self.f_owner.hash(state);
1168 self.f_flags.hash(state);
1169 self.f_fssubtype.hash(state);
1170 self.f_fstypename.hash(state);
1171 self.f_type.hash(state);
1172 self.f_mntonname.hash(state);
1173 self.f_mntfromname.hash(state);
1174 self.f_reserved.hash(state);
1175 }
1176 }
1177
1178 impl PartialEq for dirent {
1179 fn eq(&self, other: &dirent) -> bool {
1180 self.d_ino == other.d_ino
1181 && self.d_seekoff == other.d_seekoff
1182 && self.d_reclen == other.d_reclen
1183 && self.d_namlen == other.d_namlen
1184 && self.d_type == other.d_type
1185 && self
1186 .d_name
1187 .iter()
1188 .zip(other.d_name.iter())
1189 .all(|(a,b)| a == b)
1190 }
1191 }
1192 impl Eq for dirent {}
1193 impl ::fmt::Debug for dirent {
1194 fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
1195 f.debug_struct("dirent")
1196 .field("d_ino", &self.d_ino)
1197 .field("d_seekoff", &self.d_seekoff)
1198 .field("d_reclen", &self.d_reclen)
1199 .field("d_namlen", &self.d_namlen)
1200 .field("d_type", &self.d_type)
1201 // FIXME: .field("d_name", &self.d_name)
1202 .finish()
1203 }
1204 }
1205 impl ::hash::Hash for dirent {
1206 fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
1207 self.d_ino.hash(state);
1208 self.d_seekoff.hash(state);
1209 self.d_reclen.hash(state);
1210 self.d_namlen.hash(state);
1211 self.d_type.hash(state);
1212 self.d_name.hash(state);
1213 }
1214 }
1215 impl PartialEq for pthread_rwlock_t {
1216 fn eq(&self, other: &pthread_rwlock_t) -> bool {
1217 self.__sig == other.__sig
1218 && self.
1219 __opaque
1220 .iter()
1221 .zip(other.__opaque.iter())
1222 .all(|(a,b)| a == b)
1223 }
1224 }
1225 impl Eq for pthread_rwlock_t {}
1226 impl ::fmt::Debug for pthread_rwlock_t {
1227 fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
1228 f.debug_struct("pthread_rwlock_t")
1229 .field("__sig", &self.__sig)
1230 // FIXME: .field("__opaque", &self.__opaque)
1231 .finish()
1232 }
1233 }
1234 impl ::hash::Hash for pthread_rwlock_t {
1235 fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
1236 self.__sig.hash(state);
1237 self.__opaque.hash(state);
1238 }
1239 }
1240
1241 impl PartialEq for pthread_mutex_t {
1242 fn eq(&self, other: &pthread_mutex_t) -> bool {
1243 self.__sig == other.__sig
1244 && self.
1245 __opaque
1246 .iter()
1247 .zip(other.__opaque.iter())
1248 .all(|(a,b)| a == b)
1249 }
1250 }
1251
1252 impl Eq for pthread_mutex_t {}
1253
1254 impl ::fmt::Debug for pthread_mutex_t {
1255 fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
1256 f.debug_struct("pthread_mutex_t")
1257 .field("__sig", &self.__sig)
1258 // FIXME: .field("__opaque", &self.__opaque)
1259 .finish()
1260 }
1261 }
1262
1263 impl ::hash::Hash for pthread_mutex_t {
1264 fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
1265 self.__sig.hash(state);
1266 self.__opaque.hash(state);
1267 }
1268 }
1269
1270 impl PartialEq for pthread_cond_t {
1271 fn eq(&self, other: &pthread_cond_t) -> bool {
1272 self.__sig == other.__sig
1273 && self.
1274 __opaque
1275 .iter()
1276 .zip(other.__opaque.iter())
1277 .all(|(a,b)| a == b)
1278 }
1279 }
1280
1281 impl Eq for pthread_cond_t {}
1282
1283 impl ::fmt::Debug for pthread_cond_t {
1284 fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
1285 f.debug_struct("pthread_cond_t")
1286 .field("__sig", &self.__sig)
1287 // FIXME: .field("__opaque", &self.__opaque)
1288 .finish()
1289 }
1290 }
1291
1292 impl ::hash::Hash for pthread_cond_t {
1293 fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
1294 self.__sig.hash(state);
1295 self.__opaque.hash(state);
1296 }
1297 }
1298
1299 impl PartialEq for sockaddr_storage {
1300 fn eq(&self, other: &sockaddr_storage) -> bool {
1301 self.ss_len == other.ss_len
1302 && self.ss_family == other.ss_family
1303 && self
1304 .__ss_pad1
1305 .iter()
1306 .zip(other.__ss_pad1.iter())
1307 .all(|(a, b)| a == b)
1308 && self.__ss_align == other.__ss_align
1309 && self
1310 .__ss_pad2
1311 .iter()
1312 .zip(other.__ss_pad2.iter())
1313 .all(|(a, b)| a == b)
1314 }
1315 }
1316
1317 impl Eq for sockaddr_storage {}
1318
1319 impl ::fmt::Debug for sockaddr_storage {
1320 fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
1321 f.debug_struct("sockaddr_storage")
1322 .field("ss_len", &self.ss_len)
1323 .field("ss_family", &self.ss_family)
1324 .field("__ss_pad1", &self.__ss_pad1)
1325 .field("__ss_align", &self.__ss_align)
1326 // FIXME: .field("__ss_pad2", &self.__ss_pad2)
1327 .finish()
1328 }
1329 }
1330
1331 impl ::hash::Hash for sockaddr_storage {
1332 fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
1333 self.ss_len.hash(state);
1334 self.ss_family.hash(state);
1335 self.__ss_pad1.hash(state);
1336 self.__ss_align.hash(state);
1337 self.__ss_pad2.hash(state);
1338 }
1339 }
1340
1341 impl PartialEq for utmpx {
1342 fn eq(&self, other: &utmpx) -> bool {
1343 self.ut_user
1344 .iter()
1345 .zip(other.ut_user.iter())
1346 .all(|(a,b)| a == b)
1347 && self.ut_id == other.ut_id
1348 && self.ut_line == other.ut_line
1349 && self.ut_pid == other.ut_pid
1350 && self.ut_type == other.ut_type
1351 && self.ut_tv == other.ut_tv
1352 && self
1353 .ut_host
1354 .iter()
1355 .zip(other.ut_host.iter())
1356 .all(|(a,b)| a == b)
1357 && self.ut_pad == other.ut_pad
1358 }
1359 }
1360
1361 impl Eq for utmpx {}
1362
1363 impl ::fmt::Debug for utmpx {
1364 fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
1365 f.debug_struct("utmpx")
1366 // FIXME: .field("ut_user", &self.ut_user)
1367 .field("ut_id", &self.ut_id)
1368 .field("ut_line", &self.ut_line)
1369 .field("ut_pid", &self.ut_pid)
1370 .field("ut_type", &self.ut_type)
1371 .field("ut_tv", &self.ut_tv)
1372 // FIXME: .field("ut_host", &self.ut_host)
1373 .field("ut_pad", &self.ut_pad)
1374 .finish()
1375 }
1376 }
1377
1378 impl ::hash::Hash for utmpx {
1379 fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
1380 self.ut_user.hash(state);
1381 self.ut_id.hash(state);
1382 self.ut_line.hash(state);
1383 self.ut_pid.hash(state);
1384 self.ut_type.hash(state);
1385 self.ut_tv.hash(state);
1386 self.ut_host.hash(state);
1387 self.ut_pad.hash(state);
1388 }
1389 }
1390
1391 impl PartialEq for sigevent {
1392 fn eq(&self, other: &sigevent) -> bool {
1393 self.sigev_notify == other.sigev_notify
1394 && self.sigev_signo == other.sigev_signo
1395 && self.sigev_value == other.sigev_value
1396 && self.sigev_notify_attributes
1397 == other.sigev_notify_attributes
1398 }
1399 }
1400
1401 impl Eq for sigevent {}
1402
1403 impl ::fmt::Debug for sigevent {
1404 fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
1405 f.debug_struct("sigevent")
1406 .field("sigev_notify", &self.sigev_notify)
1407 .field("sigev_signo", &self.sigev_signo)
1408 .field("sigev_value", &self.sigev_value)
1409 .field("sigev_notify_attributes",
1410 &self.sigev_notify_attributes)
1411 .finish()
1412 }
1413 }
1414
1415 impl ::hash::Hash for sigevent {
1416 fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
1417 self.sigev_notify.hash(state);
1418 self.sigev_signo.hash(state);
1419 self.sigev_value.hash(state);
1420 self.sigev_notify_attributes.hash(state);
1421 }
1422 }
1423
1424 impl PartialEq for processor_cpu_load_info {
1425 fn eq(&self, other: &processor_cpu_load_info) -> bool {
1426 self.cpu_ticks == other.cpu_ticks
1427 }
1428 }
1429 impl Eq for processor_cpu_load_info {}
1430 impl ::fmt::Debug for processor_cpu_load_info {
1431 fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
1432 f.debug_struct("processor_cpu_load_info")
1433 .field("cpu_ticks", &self.cpu_ticks)
1434 .finish()
1435 }
1436 }
1437 impl ::hash::Hash for processor_cpu_load_info {
1438 fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
1439 self.cpu_ticks.hash(state);
1440 }
1441 }
1442
1443 impl PartialEq for processor_basic_info {
1444 fn eq(&self, other: &processor_basic_info) -> bool {
1445 self.cpu_type == other.cpu_type
1446 && self.cpu_subtype == other.cpu_subtype
1447 && self.running == other.running
1448 && self.slot_num == other.slot_num
1449 && self.is_master == other.is_master
1450 }
1451 }
1452 impl Eq for processor_basic_info {}
1453 impl ::fmt::Debug for processor_basic_info {
1454 fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
1455 f.debug_struct("processor_basic_info")
1456 .field("cpu_type", &self.cpu_type)
1457 .field("cpu_subtype", &self.cpu_subtype)
1458 .field("running", &self.running)
1459 .field("slot_num", &self.slot_num)
1460 .field("is_master", &self.is_master)
1461 .finish()
1462 }
1463 }
1464 impl ::hash::Hash for processor_basic_info {
1465 fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
1466 self.cpu_type.hash(state);
1467 self.cpu_subtype.hash(state);
1468 self.running.hash(state);
1469 self.slot_num.hash(state);
1470 self.is_master.hash(state);
1471 }
1472 }
1473
1474 impl PartialEq for processor_set_basic_info {
1475 fn eq(&self, other: &processor_set_basic_info) -> bool {
1476 self.processor_count == other.processor_count
1477 && self.default_policy == other.default_policy
1478 }
1479 }
1480 impl Eq for processor_set_basic_info {}
1481 impl ::fmt::Debug for processor_set_basic_info {
1482 fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
1483 f.debug_struct("processor_set_basic_info")
1484 .field("processor_count", &self.processor_count)
1485 .field("default_policy", &self.default_policy)
1486 .finish()
1487 }
1488 }
1489 impl ::hash::Hash for processor_set_basic_info {
1490 fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
1491 self.processor_count.hash(state);
1492 self.default_policy.hash(state);
1493 }
1494 }
1495
1496 impl PartialEq for processor_set_load_info {
1497 fn eq(&self, other: &processor_set_load_info) -> bool {
1498 self.task_count == other.task_count
1499 && self.thread_count == other.thread_count
1500 && self.load_average == other.load_average
1501 && self.mach_factor == other.mach_factor
1502 }
1503 }
1504 impl Eq for processor_set_load_info {}
1505 impl ::fmt::Debug for processor_set_load_info {
1506 fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
1507 f.debug_struct("processor_set_load_info")
1508 .field("task_count", &self.task_count)
1509 .field("thread_count", &self.thread_count)
1510 .field("load_average", &self.load_average)
1511 .field("mach_factor", &self.mach_factor)
1512 .finish()
1513 }
1514 }
1515 impl ::hash::Hash for processor_set_load_info {
1516 fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
1517 self.task_count.hash(state);
1518 self.thread_count.hash(state);
1519 self.load_average.hash(state);
1520 self.mach_factor.hash(state);
1521 }
1522 }
1523 }
1524 }
1525
1526 pub const _UTX_USERSIZE: usize = 256;
1527 pub const _UTX_LINESIZE: usize = 32;
1528 pub const _UTX_IDSIZE: usize = 4;
1529 pub const _UTX_HOSTSIZE: usize = 256;
1530
1531 pub const EMPTY: ::c_short = 0;
1532 pub const RUN_LVL: ::c_short = 1;
1533 pub const BOOT_TIME: ::c_short = 2;
1534 pub const OLD_TIME: ::c_short = 3;
1535 pub const NEW_TIME: ::c_short = 4;
1536 pub const INIT_PROCESS: ::c_short = 5;
1537 pub const LOGIN_PROCESS: ::c_short = 6;
1538 pub const USER_PROCESS: ::c_short = 7;
1539 pub const DEAD_PROCESS: ::c_short = 8;
1540 pub const ACCOUNTING: ::c_short = 9;
1541 pub const SIGNATURE: ::c_short = 10;
1542 pub const SHUTDOWN_TIME: ::c_short = 11;
1543
1544 pub const LC_COLLATE_MASK: ::c_int = 1 << 0;
1545 pub const LC_CTYPE_MASK: ::c_int = 1 << 1;
1546 pub const LC_MESSAGES_MASK: ::c_int = 1 << 2;
1547 pub const LC_MONETARY_MASK: ::c_int = 1 << 3;
1548 pub const LC_NUMERIC_MASK: ::c_int = 1 << 4;
1549 pub const LC_TIME_MASK: ::c_int = 1 << 5;
1550 pub const LC_ALL_MASK: ::c_int = LC_COLLATE_MASK
1551 | LC_CTYPE_MASK
1552 | LC_MESSAGES_MASK
1553 | LC_MONETARY_MASK
1554 | LC_NUMERIC_MASK
1555 | LC_TIME_MASK;
1556
1557 pub const CODESET: ::nl_item = 0;
1558 pub const D_T_FMT: ::nl_item = 1;
1559 pub const D_FMT: ::nl_item = 2;
1560 pub const T_FMT: ::nl_item = 3;
1561 pub const T_FMT_AMPM: ::nl_item = 4;
1562 pub const AM_STR: ::nl_item = 5;
1563 pub const PM_STR: ::nl_item = 6;
1564
1565 pub const DAY_1: ::nl_item = 7;
1566 pub const DAY_2: ::nl_item = 8;
1567 pub const DAY_3: ::nl_item = 9;
1568 pub const DAY_4: ::nl_item = 10;
1569 pub const DAY_5: ::nl_item = 11;
1570 pub const DAY_6: ::nl_item = 12;
1571 pub const DAY_7: ::nl_item = 13;
1572
1573 pub const ABDAY_1: ::nl_item = 14;
1574 pub const ABDAY_2: ::nl_item = 15;
1575 pub const ABDAY_3: ::nl_item = 16;
1576 pub const ABDAY_4: ::nl_item = 17;
1577 pub const ABDAY_5: ::nl_item = 18;
1578 pub const ABDAY_6: ::nl_item = 19;
1579 pub const ABDAY_7: ::nl_item = 20;
1580
1581 pub const MON_1: ::nl_item = 21;
1582 pub const MON_2: ::nl_item = 22;
1583 pub const MON_3: ::nl_item = 23;
1584 pub const MON_4: ::nl_item = 24;
1585 pub const MON_5: ::nl_item = 25;
1586 pub const MON_6: ::nl_item = 26;
1587 pub const MON_7: ::nl_item = 27;
1588 pub const MON_8: ::nl_item = 28;
1589 pub const MON_9: ::nl_item = 29;
1590 pub const MON_10: ::nl_item = 30;
1591 pub const MON_11: ::nl_item = 31;
1592 pub const MON_12: ::nl_item = 32;
1593
1594 pub const ABMON_1: ::nl_item = 33;
1595 pub const ABMON_2: ::nl_item = 34;
1596 pub const ABMON_3: ::nl_item = 35;
1597 pub const ABMON_4: ::nl_item = 36;
1598 pub const ABMON_5: ::nl_item = 37;
1599 pub const ABMON_6: ::nl_item = 38;
1600 pub const ABMON_7: ::nl_item = 39;
1601 pub const ABMON_8: ::nl_item = 40;
1602 pub const ABMON_9: ::nl_item = 41;
1603 pub const ABMON_10: ::nl_item = 42;
1604 pub const ABMON_11: ::nl_item = 43;
1605 pub const ABMON_12: ::nl_item = 44;
1606
1607 pub const CLOCK_REALTIME: ::clockid_t = 0;
1608 pub const CLOCK_MONOTONIC: ::clockid_t = 6;
1609 pub const CLOCK_PROCESS_CPUTIME_ID: ::clockid_t = 12;
1610 pub const CLOCK_THREAD_CPUTIME_ID: ::clockid_t = 16;
1611
1612 pub const ERA: ::nl_item = 45;
1613 pub const ERA_D_FMT: ::nl_item = 46;
1614 pub const ERA_D_T_FMT: ::nl_item = 47;
1615 pub const ERA_T_FMT: ::nl_item = 48;
1616 pub const ALT_DIGITS: ::nl_item = 49;
1617
1618 pub const RADIXCHAR: ::nl_item = 50;
1619 pub const THOUSEP: ::nl_item = 51;
1620
1621 pub const YESEXPR: ::nl_item = 52;
1622 pub const NOEXPR: ::nl_item = 53;
1623
1624 pub const YESSTR: ::nl_item = 54;
1625 pub const NOSTR: ::nl_item = 55;
1626
1627 pub const CRNCYSTR: ::nl_item = 56;
1628
1629 pub const D_MD_ORDER: ::nl_item = 57;
1630
1631 pub const EXIT_FAILURE: ::c_int = 1;
1632 pub const EXIT_SUCCESS: ::c_int = 0;
1633 pub const RAND_MAX: ::c_int = 2147483647;
1634 pub const EOF: ::c_int = -1;
1635 pub const SEEK_SET: ::c_int = 0;
1636 pub const SEEK_CUR: ::c_int = 1;
1637 pub const SEEK_END: ::c_int = 2;
1638 pub const _IOFBF: ::c_int = 0;
1639 pub const _IONBF: ::c_int = 2;
1640 pub const _IOLBF: ::c_int = 1;
1641 pub const BUFSIZ: ::c_uint = 1024;
1642 pub const FOPEN_MAX: ::c_uint = 20;
1643 pub const FILENAME_MAX: ::c_uint = 1024;
1644 pub const L_tmpnam: ::c_uint = 1024;
1645 pub const TMP_MAX: ::c_uint = 308915776;
1646 pub const _PC_LINK_MAX: ::c_int = 1;
1647 pub const _PC_MAX_CANON: ::c_int = 2;
1648 pub const _PC_MAX_INPUT: ::c_int = 3;
1649 pub const _PC_NAME_MAX: ::c_int = 4;
1650 pub const _PC_PATH_MAX: ::c_int = 5;
1651 pub const _PC_PIPE_BUF: ::c_int = 6;
1652 pub const _PC_CHOWN_RESTRICTED: ::c_int = 7;
1653 pub const _PC_NO_TRUNC: ::c_int = 8;
1654 pub const _PC_VDISABLE: ::c_int = 9;
1655 pub const O_DSYNC: ::c_int = 0x400000;
1656 pub const O_NOCTTY: ::c_int = 0x20000;
1657 pub const O_CLOEXEC: ::c_int = 0x1000000;
1658 pub const O_DIRECTORY: ::c_int = 0x100000;
1659 pub const O_SYMLINK: ::c_int = 0x200000;
1660 pub const S_IFIFO: mode_t = 4096;
1661 pub const S_IFCHR: mode_t = 8192;
1662 pub const S_IFBLK: mode_t = 24576;
1663 pub const S_IFDIR: mode_t = 16384;
1664 pub const S_IFREG: mode_t = 32768;
1665 pub const S_IFLNK: mode_t = 40960;
1666 pub const S_IFSOCK: mode_t = 49152;
1667 pub const S_IFMT: mode_t = 61440;
1668 pub const S_IEXEC: mode_t = 64;
1669 pub const S_IWRITE: mode_t = 128;
1670 pub const S_IREAD: mode_t = 256;
1671 pub const S_IRWXU: mode_t = 448;
1672 pub const S_IXUSR: mode_t = 64;
1673 pub const S_IWUSR: mode_t = 128;
1674 pub const S_IRUSR: mode_t = 256;
1675 pub const S_IRWXG: mode_t = 56;
1676 pub const S_IXGRP: mode_t = 8;
1677 pub const S_IWGRP: mode_t = 16;
1678 pub const S_IRGRP: mode_t = 32;
1679 pub const S_IRWXO: mode_t = 7;
1680 pub const S_IXOTH: mode_t = 1;
1681 pub const S_IWOTH: mode_t = 2;
1682 pub const S_IROTH: mode_t = 4;
1683 pub const F_OK: ::c_int = 0;
1684 pub const R_OK: ::c_int = 4;
1685 pub const W_OK: ::c_int = 2;
1686 pub const X_OK: ::c_int = 1;
1687 pub const STDIN_FILENO: ::c_int = 0;
1688 pub const STDOUT_FILENO: ::c_int = 1;
1689 pub const STDERR_FILENO: ::c_int = 2;
1690 pub const F_LOCK: ::c_int = 1;
1691 pub const F_TEST: ::c_int = 3;
1692 pub const F_TLOCK: ::c_int = 2;
1693 pub const F_ULOCK: ::c_int = 0;
1694 pub const F_GETLK: ::c_int = 7;
1695 pub const F_SETLK: ::c_int = 8;
1696 pub const F_SETLKW: ::c_int = 9;
1697 pub const SIGHUP: ::c_int = 1;
1698 pub const SIGINT: ::c_int = 2;
1699 pub const SIGQUIT: ::c_int = 3;
1700 pub const SIGILL: ::c_int = 4;
1701 pub const SIGABRT: ::c_int = 6;
1702 pub const SIGEMT: ::c_int = 7;
1703 pub const SIGFPE: ::c_int = 8;
1704 pub const SIGKILL: ::c_int = 9;
1705 pub const SIGSEGV: ::c_int = 11;
1706 pub const SIGPIPE: ::c_int = 13;
1707 pub const SIGALRM: ::c_int = 14;
1708 pub const SIGTERM: ::c_int = 15;
1709
1710 pub const PROT_NONE: ::c_int = 0;
1711 pub const PROT_READ: ::c_int = 1;
1712 pub const PROT_WRITE: ::c_int = 2;
1713 pub const PROT_EXEC: ::c_int = 4;
1714
1715 pub const PT_TRACE_ME: ::c_int = 0;
1716 pub const PT_READ_I: ::c_int = 1;
1717 pub const PT_READ_D: ::c_int = 2;
1718 pub const PT_READ_U: ::c_int = 3;
1719 pub const PT_WRITE_I: ::c_int = 4;
1720 pub const PT_WRITE_D: ::c_int = 5;
1721 pub const PT_WRITE_U: ::c_int = 6;
1722 pub const PT_CONTINUE: ::c_int = 7;
1723 pub const PT_KILL: ::c_int = 8;
1724 pub const PT_STEP: ::c_int = 9;
1725 pub const PT_ATTACH: ::c_int = 10;
1726 pub const PT_DETACH: ::c_int = 11;
1727 pub const PT_SIGEXC: ::c_int = 12;
1728 pub const PT_THUPDATE: ::c_int = 13;
1729 pub const PT_ATTACHEXC: ::c_int = 14;
1730
1731 pub const PT_FORCEQUOTA: ::c_int = 30;
1732 pub const PT_DENY_ATTACH: ::c_int = 31;
1733 pub const PT_FIRSTMACH: ::c_int = 32;
1734
1735 pub const MAP_FILE: ::c_int = 0x0000;
1736 pub const MAP_SHARED: ::c_int = 0x0001;
1737 pub const MAP_PRIVATE: ::c_int = 0x0002;
1738 pub const MAP_FIXED: ::c_int = 0x0010;
1739 pub const MAP_ANON: ::c_int = 0x1000;
1740 pub const MAP_ANONYMOUS: ::c_int = MAP_ANON;
1741
1742 pub const CPU_STATE_USER: ::c_int = 0;
1743 pub const CPU_STATE_SYSTEM: ::c_int = 1;
1744 pub const CPU_STATE_IDLE: ::c_int = 2;
1745 pub const CPU_STATE_NICE: ::c_int = 3;
1746 pub const CPU_STATE_MAX: ::c_int = 4;
1747
1748 pub const PROCESSOR_BASIC_INFO: ::c_int = 1;
1749 pub const PROCESSOR_CPU_LOAD_INFO: ::c_int = 2;
1750 pub const PROCESSOR_PM_REGS_INFO: ::c_int = 0x10000001;
1751 pub const PROCESSOR_TEMPERATURE: ::c_int = 0x10000002;
1752 pub const PROCESSOR_SET_LOAD_INFO: ::c_int = 4;
1753 pub const PROCESSOR_SET_BASIC_INFO: ::c_int = 5;
1754
1755 deprecated_mach! {
1756 pub const VM_FLAGS_FIXED: ::c_int = 0x0000;
1757 pub const VM_FLAGS_ANYWHERE: ::c_int = 0x0001;
1758 pub const VM_FLAGS_PURGABLE: ::c_int = 0x0002;
1759 pub const VM_FLAGS_RANDOM_ADDR: ::c_int = 0x0008;
1760 pub const VM_FLAGS_NO_CACHE: ::c_int = 0x0010;
1761 pub const VM_FLAGS_RESILIENT_CODESIGN: ::c_int = 0x0020;
1762 pub const VM_FLAGS_RESILIENT_MEDIA: ::c_int = 0x0040;
1763 pub const VM_FLAGS_OVERWRITE: ::c_int = 0x4000;
1764 pub const VM_FLAGS_SUPERPAGE_MASK: ::c_int = 0x70000;
1765 pub const VM_FLAGS_RETURN_DATA_ADDR: ::c_int = 0x100000;
1766 pub const VM_FLAGS_RETURN_4K_DATA_ADDR: ::c_int = 0x800000;
1767 pub const VM_FLAGS_ALIAS_MASK: ::c_int = 0xFF000000;
1768 pub const VM_FLAGS_USER_ALLOCATE: ::c_int = 0xff07401f;
1769 pub const VM_FLAGS_USER_MAP: ::c_int = 0xff97401f;
1770 pub const VM_FLAGS_USER_REMAP: ::c_int = VM_FLAGS_FIXED |
1771 VM_FLAGS_ANYWHERE |
1772 VM_FLAGS_RANDOM_ADDR |
1773 VM_FLAGS_OVERWRITE |
1774 VM_FLAGS_RETURN_DATA_ADDR |
1775 VM_FLAGS_RESILIENT_CODESIGN;
1776
1777 pub const VM_FLAGS_SUPERPAGE_SHIFT: ::c_int = 16;
1778 pub const SUPERPAGE_NONE: ::c_int = 0;
1779 pub const SUPERPAGE_SIZE_ANY: ::c_int = 1;
1780 pub const VM_FLAGS_SUPERPAGE_NONE: ::c_int = SUPERPAGE_NONE <<
1781 VM_FLAGS_SUPERPAGE_SHIFT;
1782 pub const VM_FLAGS_SUPERPAGE_SIZE_ANY: ::c_int = SUPERPAGE_SIZE_ANY <<
1783 VM_FLAGS_SUPERPAGE_SHIFT;
1784 pub const SUPERPAGE_SIZE_2MB: ::c_int = 2;
1785 pub const VM_FLAGS_SUPERPAGE_SIZE_2MB: ::c_int = SUPERPAGE_SIZE_2MB <<
1786 VM_FLAGS_SUPERPAGE_SHIFT;
1787
1788 pub const VM_MEMORY_MALLOC: ::c_int = 1;
1789 pub const VM_MEMORY_MALLOC_SMALL: ::c_int = 2;
1790 pub const VM_MEMORY_MALLOC_LARGE: ::c_int = 3;
1791 pub const VM_MEMORY_MALLOC_HUGE: ::c_int = 4;
1792 pub const VM_MEMORY_SBRK: ::c_int = 5;
1793 pub const VM_MEMORY_REALLOC: ::c_int = 6;
1794 pub const VM_MEMORY_MALLOC_TINY: ::c_int = 7;
1795 pub const VM_MEMORY_MALLOC_LARGE_REUSABLE: ::c_int = 8;
1796 pub const VM_MEMORY_MALLOC_LARGE_REUSED: ::c_int = 9;
1797 pub const VM_MEMORY_ANALYSIS_TOOL: ::c_int = 10;
1798 pub const VM_MEMORY_MALLOC_NANO: ::c_int = 11;
1799 pub const VM_MEMORY_MACH_MSG: ::c_int = 20;
1800 pub const VM_MEMORY_IOKIT: ::c_int = 21;
1801 pub const VM_MEMORY_STACK: ::c_int = 30;
1802 pub const VM_MEMORY_GUARD: ::c_int = 31;
1803 pub const VM_MEMORY_SHARED_PMAP: ::c_int = 32;
1804 pub const VM_MEMORY_DYLIB: ::c_int = 33;
1805 pub const VM_MEMORY_OBJC_DISPATCHERS: ::c_int = 34;
1806 pub const VM_MEMORY_UNSHARED_PMAP: ::c_int = 35;
1807 pub const VM_MEMORY_APPKIT: ::c_int = 40;
1808 pub const VM_MEMORY_FOUNDATION: ::c_int = 41;
1809 pub const VM_MEMORY_COREGRAPHICS: ::c_int = 42;
1810 pub const VM_MEMORY_CORESERVICES: ::c_int = 43;
1811 pub const VM_MEMORY_CARBON: ::c_int = VM_MEMORY_CORESERVICES;
1812 pub const VM_MEMORY_JAVA: ::c_int = 44;
1813 pub const VM_MEMORY_COREDATA: ::c_int = 45;
1814 pub const VM_MEMORY_COREDATA_OBJECTIDS: ::c_int = 46;
1815 pub const VM_MEMORY_ATS: ::c_int = 50;
1816 pub const VM_MEMORY_LAYERKIT: ::c_int = 51;
1817 pub const VM_MEMORY_CGIMAGE: ::c_int = 52;
1818 pub const VM_MEMORY_TCMALLOC: ::c_int = 53;
1819 pub const VM_MEMORY_COREGRAPHICS_DATA: ::c_int = 54;
1820 pub const VM_MEMORY_COREGRAPHICS_SHARED: ::c_int = 55;
1821 pub const VM_MEMORY_COREGRAPHICS_FRAMEBUFFERS: ::c_int = 56;
1822 pub const VM_MEMORY_COREGRAPHICS_BACKINGSTORES: ::c_int = 57;
1823 pub const VM_MEMORY_COREGRAPHICS_XALLOC: ::c_int = 58;
1824 pub const VM_MEMORY_COREGRAPHICS_MISC: ::c_int = VM_MEMORY_COREGRAPHICS;
1825 pub const VM_MEMORY_DYLD: ::c_int = 60;
1826 pub const VM_MEMORY_DYLD_MALLOC: ::c_int = 61;
1827 pub const VM_MEMORY_SQLITE: ::c_int = 62;
1828 pub const VM_MEMORY_JAVASCRIPT_CORE: ::c_int = 63;
1829 pub const VM_MEMORY_JAVASCRIPT_JIT_EXECUTABLE_ALLOCATOR: ::c_int = 64;
1830 pub const VM_MEMORY_JAVASCRIPT_JIT_REGISTER_FILE: ::c_int = 65;
1831 pub const VM_MEMORY_GLSL: ::c_int = 66;
1832 pub const VM_MEMORY_OPENCL: ::c_int = 67;
1833 pub const VM_MEMORY_COREIMAGE: ::c_int = 68;
1834 pub const VM_MEMORY_WEBCORE_PURGEABLE_BUFFERS: ::c_int = 69;
1835 pub const VM_MEMORY_IMAGEIO: ::c_int = 70;
1836 pub const VM_MEMORY_COREPROFILE: ::c_int = 71;
1837 pub const VM_MEMORY_ASSETSD: ::c_int = 72;
1838 pub const VM_MEMORY_OS_ALLOC_ONCE: ::c_int = 73;
1839 pub const VM_MEMORY_LIBDISPATCH: ::c_int = 74;
1840 pub const VM_MEMORY_ACCELERATE: ::c_int = 75;
1841 pub const VM_MEMORY_COREUI: ::c_int = 76;
1842 pub const VM_MEMORY_COREUIFILE: ::c_int = 77;
1843 pub const VM_MEMORY_GENEALOGY: ::c_int = 78;
1844 pub const VM_MEMORY_RAWCAMERA: ::c_int = 79;
1845 pub const VM_MEMORY_CORPSEINFO: ::c_int = 80;
1846 pub const VM_MEMORY_ASL: ::c_int = 81;
1847 pub const VM_MEMORY_SWIFT_RUNTIME: ::c_int = 82;
1848 pub const VM_MEMORY_SWIFT_METADATA: ::c_int = 83;
1849 pub const VM_MEMORY_DHMM: ::c_int = 84;
1850 pub const VM_MEMORY_SCENEKIT: ::c_int = 86;
1851 pub const VM_MEMORY_SKYWALK: ::c_int = 87;
1852 pub const VM_MEMORY_APPLICATION_SPECIFIC_1: ::c_int = 240;
1853 pub const VM_MEMORY_APPLICATION_SPECIFIC_16: ::c_int = 255;
1854 }
1855
1856 pub const MAP_FAILED: *mut ::c_void = !0 as *mut ::c_void;
1857
1858 pub const MCL_CURRENT: ::c_int = 0x0001;
1859 pub const MCL_FUTURE: ::c_int = 0x0002;
1860
1861 pub const MS_ASYNC: ::c_int = 0x0001;
1862 pub const MS_INVALIDATE: ::c_int = 0x0002;
1863 pub const MS_SYNC: ::c_int = 0x0010;
1864
1865 pub const MS_KILLPAGES: ::c_int = 0x0004;
1866 pub const MS_DEACTIVATE: ::c_int = 0x0008;
1867
1868 pub const EPERM: ::c_int = 1;
1869 pub const ENOENT: ::c_int = 2;
1870 pub const ESRCH: ::c_int = 3;
1871 pub const EINTR: ::c_int = 4;
1872 pub const EIO: ::c_int = 5;
1873 pub const ENXIO: ::c_int = 6;
1874 pub const E2BIG: ::c_int = 7;
1875 pub const ENOEXEC: ::c_int = 8;
1876 pub const EBADF: ::c_int = 9;
1877 pub const ECHILD: ::c_int = 10;
1878 pub const EDEADLK: ::c_int = 11;
1879 pub const ENOMEM: ::c_int = 12;
1880 pub const EACCES: ::c_int = 13;
1881 pub const EFAULT: ::c_int = 14;
1882 pub const ENOTBLK: ::c_int = 15;
1883 pub const EBUSY: ::c_int = 16;
1884 pub const EEXIST: ::c_int = 17;
1885 pub const EXDEV: ::c_int = 18;
1886 pub const ENODEV: ::c_int = 19;
1887 pub const ENOTDIR: ::c_int = 20;
1888 pub const EISDIR: ::c_int = 21;
1889 pub const EINVAL: ::c_int = 22;
1890 pub const ENFILE: ::c_int = 23;
1891 pub const EMFILE: ::c_int = 24;
1892 pub const ENOTTY: ::c_int = 25;
1893 pub const ETXTBSY: ::c_int = 26;
1894 pub const EFBIG: ::c_int = 27;
1895 pub const ENOSPC: ::c_int = 28;
1896 pub const ESPIPE: ::c_int = 29;
1897 pub const EROFS: ::c_int = 30;
1898 pub const EMLINK: ::c_int = 31;
1899 pub const EPIPE: ::c_int = 32;
1900 pub const EDOM: ::c_int = 33;
1901 pub const ERANGE: ::c_int = 34;
1902 pub const EAGAIN: ::c_int = 35;
1903 pub const EWOULDBLOCK: ::c_int = EAGAIN;
1904 pub const EINPROGRESS: ::c_int = 36;
1905 pub const EALREADY: ::c_int = 37;
1906 pub const ENOTSOCK: ::c_int = 38;
1907 pub const EDESTADDRREQ: ::c_int = 39;
1908 pub const EMSGSIZE: ::c_int = 40;
1909 pub const EPROTOTYPE: ::c_int = 41;
1910 pub const ENOPROTOOPT: ::c_int = 42;
1911 pub const EPROTONOSUPPORT: ::c_int = 43;
1912 pub const ESOCKTNOSUPPORT: ::c_int = 44;
1913 pub const ENOTSUP: ::c_int = 45;
1914 pub const EPFNOSUPPORT: ::c_int = 46;
1915 pub const EAFNOSUPPORT: ::c_int = 47;
1916 pub const EADDRINUSE: ::c_int = 48;
1917 pub const EADDRNOTAVAIL: ::c_int = 49;
1918 pub const ENETDOWN: ::c_int = 50;
1919 pub const ENETUNREACH: ::c_int = 51;
1920 pub const ENETRESET: ::c_int = 52;
1921 pub const ECONNABORTED: ::c_int = 53;
1922 pub const ECONNRESET: ::c_int = 54;
1923 pub const ENOBUFS: ::c_int = 55;
1924 pub const EISCONN: ::c_int = 56;
1925 pub const ENOTCONN: ::c_int = 57;
1926 pub const ESHUTDOWN: ::c_int = 58;
1927 pub const ETOOMANYREFS: ::c_int = 59;
1928 pub const ETIMEDOUT: ::c_int = 60;
1929 pub const ECONNREFUSED: ::c_int = 61;
1930 pub const ELOOP: ::c_int = 62;
1931 pub const ENAMETOOLONG: ::c_int = 63;
1932 pub const EHOSTDOWN: ::c_int = 64;
1933 pub const EHOSTUNREACH: ::c_int = 65;
1934 pub const ENOTEMPTY: ::c_int = 66;
1935 pub const EPROCLIM: ::c_int = 67;
1936 pub const EUSERS: ::c_int = 68;
1937 pub const EDQUOT: ::c_int = 69;
1938 pub const ESTALE: ::c_int = 70;
1939 pub const EREMOTE: ::c_int = 71;
1940 pub const EBADRPC: ::c_int = 72;
1941 pub const ERPCMISMATCH: ::c_int = 73;
1942 pub const EPROGUNAVAIL: ::c_int = 74;
1943 pub const EPROGMISMATCH: ::c_int = 75;
1944 pub const EPROCUNAVAIL: ::c_int = 76;
1945 pub const ENOLCK: ::c_int = 77;
1946 pub const ENOSYS: ::c_int = 78;
1947 pub const EFTYPE: ::c_int = 79;
1948 pub const EAUTH: ::c_int = 80;
1949 pub const ENEEDAUTH: ::c_int = 81;
1950 pub const EPWROFF: ::c_int = 82;
1951 pub const EDEVERR: ::c_int = 83;
1952 pub const EOVERFLOW: ::c_int = 84;
1953 pub const EBADEXEC: ::c_int = 85;
1954 pub const EBADARCH: ::c_int = 86;
1955 pub const ESHLIBVERS: ::c_int = 87;
1956 pub const EBADMACHO: ::c_int = 88;
1957 pub const ECANCELED: ::c_int = 89;
1958 pub const EIDRM: ::c_int = 90;
1959 pub const ENOMSG: ::c_int = 91;
1960 pub const EILSEQ: ::c_int = 92;
1961 pub const ENOATTR: ::c_int = 93;
1962 pub const EBADMSG: ::c_int = 94;
1963 pub const EMULTIHOP: ::c_int = 95;
1964 pub const ENODATA: ::c_int = 96;
1965 pub const ENOLINK: ::c_int = 97;
1966 pub const ENOSR: ::c_int = 98;
1967 pub const ENOSTR: ::c_int = 99;
1968 pub const EPROTO: ::c_int = 100;
1969 pub const ETIME: ::c_int = 101;
1970 pub const EOPNOTSUPP: ::c_int = 102;
1971 pub const ENOPOLICY: ::c_int = 103;
1972 pub const ENOTRECOVERABLE: ::c_int = 104;
1973 pub const EOWNERDEAD: ::c_int = 105;
1974 pub const EQFULL: ::c_int = 106;
1975 pub const ELAST: ::c_int = 106;
1976
1977 pub const EAI_AGAIN: ::c_int = 2;
1978 pub const EAI_BADFLAGS: ::c_int = 3;
1979 pub const EAI_FAIL: ::c_int = 4;
1980 pub const EAI_FAMILY: ::c_int = 5;
1981 pub const EAI_MEMORY: ::c_int = 6;
1982 pub const EAI_NODATA: ::c_int = 7;
1983 pub const EAI_NONAME: ::c_int = 8;
1984 pub const EAI_SERVICE: ::c_int = 9;
1985 pub const EAI_SOCKTYPE: ::c_int = 10;
1986 pub const EAI_SYSTEM: ::c_int = 11;
1987 pub const EAI_OVERFLOW: ::c_int = 14;
1988
1989 pub const F_DUPFD: ::c_int = 0;
1990 pub const F_DUPFD_CLOEXEC: ::c_int = 67;
1991 pub const F_GETFD: ::c_int = 1;
1992 pub const F_SETFD: ::c_int = 2;
1993 pub const F_GETFL: ::c_int = 3;
1994 pub const F_SETFL: ::c_int = 4;
1995 pub const F_PREALLOCATE: ::c_int = 42;
1996 pub const F_RDADVISE: ::c_int = 44;
1997 pub const F_RDAHEAD: ::c_int = 45;
1998 pub const F_NOCACHE: ::c_int = 48;
1999 pub const F_GETPATH: ::c_int = 50;
2000 pub const F_FULLFSYNC: ::c_int = 51;
2001 pub const F_FREEZE_FS: ::c_int = 53;
2002 pub const F_THAW_FS: ::c_int = 54;
2003 pub const F_GLOBAL_NOCACHE: ::c_int = 55;
2004 pub const F_NODIRECT: ::c_int = 62;
2005
2006 pub const F_ALLOCATECONTIG: ::c_uint = 0x02;
2007 pub const F_ALLOCATEALL: ::c_uint = 0x04;
2008
2009 pub const F_PEOFPOSMODE: ::c_int = 3;
2010 pub const F_VOLPOSMODE: ::c_int = 4;
2011
2012 pub const AT_FDCWD: ::c_int = -2;
2013 pub const AT_EACCESS: ::c_int = 0x0010;
2014 pub const AT_SYMLINK_NOFOLLOW: ::c_int = 0x0020;
2015 pub const AT_SYMLINK_FOLLOW: ::c_int = 0x0040;
2016 pub const AT_REMOVEDIR: ::c_int = 0x0080;
2017
2018 pub const TIOCMODG: ::c_ulong = 0x40047403;
2019 pub const TIOCMODS: ::c_ulong = 0x80047404;
2020 pub const TIOCM_LE: ::c_int = 0x1;
2021 pub const TIOCM_DTR: ::c_int = 0x2;
2022 pub const TIOCM_RTS: ::c_int = 0x4;
2023 pub const TIOCM_ST: ::c_int = 0x8;
2024 pub const TIOCM_SR: ::c_int = 0x10;
2025 pub const TIOCM_CTS: ::c_int = 0x20;
2026 pub const TIOCM_CAR: ::c_int = 0x40;
2027 pub const TIOCM_CD: ::c_int = 0x40;
2028 pub const TIOCM_RNG: ::c_int = 0x80;
2029 pub const TIOCM_RI: ::c_int = 0x80;
2030 pub const TIOCM_DSR: ::c_int = 0x100;
2031 pub const TIOCEXCL: ::c_int = 0x2000740d;
2032 pub const TIOCNXCL: ::c_int = 0x2000740e;
2033 pub const TIOCFLUSH: ::c_ulong = 0x80047410;
2034 pub const TIOCGETD: ::c_ulong = 0x4004741a;
2035 pub const TIOCSETD: ::c_ulong = 0x8004741b;
2036 pub const TIOCIXON: ::c_uint = 0x20007481;
2037 pub const TIOCIXOFF: ::c_uint = 0x20007480;
2038 pub const TIOCSDTR: ::c_uint = 0x20007479;
2039 pub const TIOCCDTR: ::c_uint = 0x20007478;
2040 pub const TIOCGPGRP: ::c_ulong = 0x40047477;
2041 pub const TIOCSPGRP: ::c_ulong = 0x80047476;
2042 pub const TIOCOUTQ: ::c_ulong = 0x40047473;
2043 pub const TIOCSTI: ::c_ulong = 0x80017472;
2044 pub const TIOCNOTTY: ::c_uint = 0x20007471;
2045 pub const TIOCPKT: ::c_ulong = 0x80047470;
2046 pub const TIOCPKT_DATA: ::c_int = 0x0;
2047 pub const TIOCPKT_FLUSHREAD: ::c_int = 0x1;
2048 pub const TIOCPKT_FLUSHWRITE: ::c_int = 0x2;
2049 pub const TIOCPKT_STOP: ::c_int = 0x4;
2050 pub const TIOCPKT_START: ::c_int = 0x8;
2051 pub const TIOCPKT_NOSTOP: ::c_int = 0x10;
2052 pub const TIOCPKT_DOSTOP: ::c_int = 0x20;
2053 pub const TIOCPKT_IOCTL: ::c_int = 0x40;
2054 pub const TIOCSTOP: ::c_uint = 0x2000746f;
2055 pub const TIOCSTART: ::c_uint = 0x2000746e;
2056 pub const TIOCMSET: ::c_ulong = 0x8004746d;
2057 pub const TIOCMBIS: ::c_ulong = 0x8004746c;
2058 pub const TIOCMBIC: ::c_ulong = 0x8004746b;
2059 pub const TIOCMGET: ::c_ulong = 0x4004746a;
2060 pub const TIOCREMOTE: ::c_ulong = 0x80047469;
2061 pub const TIOCGWINSZ: ::c_ulong = 0x40087468;
2062 pub const TIOCSWINSZ: ::c_ulong = 0x80087467;
2063 pub const TIOCUCNTL: ::c_ulong = 0x80047466;
2064 pub const TIOCSTAT: ::c_uint = 0x20007465;
2065 pub const TIOCSCONS: ::c_uint = 0x20007463;
2066 pub const TIOCCONS: ::c_ulong = 0x80047462;
2067 pub const TIOCSCTTY: ::c_uint = 0x20007461;
2068 pub const TIOCEXT: ::c_ulong = 0x80047460;
2069 pub const TIOCSIG: ::c_uint = 0x2000745f;
2070 pub const TIOCDRAIN: ::c_uint = 0x2000745e;
2071 pub const TIOCMSDTRWAIT: ::c_ulong = 0x8004745b;
2072 pub const TIOCMGDTRWAIT: ::c_ulong = 0x4004745a;
2073 pub const TIOCSDRAINWAIT: ::c_ulong = 0x80047457;
2074 pub const TIOCGDRAINWAIT: ::c_ulong = 0x40047456;
2075 pub const TIOCDSIMICROCODE: ::c_uint = 0x20007455;
2076 pub const TIOCPTYGRANT: ::c_uint = 0x20007454;
2077 pub const TIOCPTYGNAME: ::c_uint = 0x40807453;
2078 pub const TIOCPTYUNLK: ::c_uint = 0x20007452;
2079
2080 pub const BIOCGRSIG: ::c_ulong = 0x40044272;
2081 pub const BIOCSRSIG: ::c_ulong = 0x80044273;
2082 pub const BIOCSDLT: ::c_ulong = 0x80044278;
2083 pub const BIOCGSEESENT: ::c_ulong = 0x40044276;
2084 pub const BIOCSSEESENT: ::c_ulong = 0x80044277;
2085 pub const BIOCGDLTLIST: ::c_ulong = 0xc00c4279;
2086
2087 pub const FIODTYPE: ::c_ulong = 0x4004667a;
2088
2089 pub const B0: speed_t = 0;
2090 pub const B50: speed_t = 50;
2091 pub const B75: speed_t = 75;
2092 pub const B110: speed_t = 110;
2093 pub const B134: speed_t = 134;
2094 pub const B150: speed_t = 150;
2095 pub const B200: speed_t = 200;
2096 pub const B300: speed_t = 300;
2097 pub const B600: speed_t = 600;
2098 pub const B1200: speed_t = 1200;
2099 pub const B1800: speed_t = 1800;
2100 pub const B2400: speed_t = 2400;
2101 pub const B4800: speed_t = 4800;
2102 pub const B9600: speed_t = 9600;
2103 pub const B19200: speed_t = 19200;
2104 pub const B38400: speed_t = 38400;
2105 pub const B7200: speed_t = 7200;
2106 pub const B14400: speed_t = 14400;
2107 pub const B28800: speed_t = 28800;
2108 pub const B57600: speed_t = 57600;
2109 pub const B76800: speed_t = 76800;
2110 pub const B115200: speed_t = 115200;
2111 pub const B230400: speed_t = 230400;
2112 pub const EXTA: speed_t = 19200;
2113 pub const EXTB: speed_t = 38400;
2114
2115 pub const SIGTRAP: ::c_int = 5;
2116
2117 pub const GLOB_APPEND: ::c_int = 0x0001;
2118 pub const GLOB_DOOFFS: ::c_int = 0x0002;
2119 pub const GLOB_ERR: ::c_int = 0x0004;
2120 pub const GLOB_MARK: ::c_int = 0x0008;
2121 pub const GLOB_NOCHECK: ::c_int = 0x0010;
2122 pub const GLOB_NOSORT: ::c_int = 0x0020;
2123 pub const GLOB_NOESCAPE: ::c_int = 0x2000;
2124
2125 pub const GLOB_NOSPACE: ::c_int = -1;
2126 pub const GLOB_ABORTED: ::c_int = -2;
2127 pub const GLOB_NOMATCH: ::c_int = -3;
2128
2129 pub const POSIX_MADV_NORMAL: ::c_int = 0;
2130 pub const POSIX_MADV_RANDOM: ::c_int = 1;
2131 pub const POSIX_MADV_SEQUENTIAL: ::c_int = 2;
2132 pub const POSIX_MADV_WILLNEED: ::c_int = 3;
2133 pub const POSIX_MADV_DONTNEED: ::c_int = 4;
2134
2135 pub const _SC_IOV_MAX: ::c_int = 56;
2136 pub const _SC_GETGR_R_SIZE_MAX: ::c_int = 70;
2137 pub const _SC_GETPW_R_SIZE_MAX: ::c_int = 71;
2138 pub const _SC_LOGIN_NAME_MAX: ::c_int = 73;
2139 pub const _SC_MQ_PRIO_MAX: ::c_int = 75;
2140 pub const _SC_THREAD_ATTR_STACKADDR: ::c_int = 82;
2141 pub const _SC_THREAD_ATTR_STACKSIZE: ::c_int = 83;
2142 pub const _SC_THREAD_DESTRUCTOR_ITERATIONS: ::c_int = 85;
2143 pub const _SC_THREAD_KEYS_MAX: ::c_int = 86;
2144 pub const _SC_THREAD_PRIO_INHERIT: ::c_int = 87;
2145 pub const _SC_THREAD_PRIO_PROTECT: ::c_int = 88;
2146 pub const _SC_THREAD_PRIORITY_SCHEDULING: ::c_int = 89;
2147 pub const _SC_THREAD_PROCESS_SHARED: ::c_int = 90;
2148 pub const _SC_THREAD_SAFE_FUNCTIONS: ::c_int = 91;
2149 pub const _SC_THREAD_STACK_MIN: ::c_int = 93;
2150 pub const _SC_THREAD_THREADS_MAX: ::c_int = 94;
2151 pub const _SC_THREADS: ::c_int = 96;
2152 pub const _SC_TTY_NAME_MAX: ::c_int = 101;
2153 pub const _SC_ATEXIT_MAX: ::c_int = 107;
2154 pub const _SC_XOPEN_CRYPT: ::c_int = 108;
2155 pub const _SC_XOPEN_ENH_I18N: ::c_int = 109;
2156 pub const _SC_XOPEN_LEGACY: ::c_int = 110;
2157 pub const _SC_XOPEN_REALTIME: ::c_int = 111;
2158 pub const _SC_XOPEN_REALTIME_THREADS: ::c_int = 112;
2159 pub const _SC_XOPEN_SHM: ::c_int = 113;
2160 pub const _SC_XOPEN_UNIX: ::c_int = 115;
2161 pub const _SC_XOPEN_VERSION: ::c_int = 116;
2162 pub const _SC_XOPEN_XCU_VERSION: ::c_int = 121;
2163 pub const _SC_PHYS_PAGES: ::c_int = 200;
2164
2165 pub const PTHREAD_PROCESS_PRIVATE: ::c_int = 2;
2166 pub const PTHREAD_PROCESS_SHARED: ::c_int = 1;
2167 pub const PTHREAD_CREATE_JOINABLE: ::c_int = 1;
2168 pub const PTHREAD_CREATE_DETACHED: ::c_int = 2;
2169 #[cfg(target_arch = "aarch64")]
2170 pub const PTHREAD_STACK_MIN: ::size_t = 16384;
2171 #[cfg(not(target_arch = "aarch64"))]
2172 pub const PTHREAD_STACK_MIN: ::size_t = 8192;
2173
2174 pub const RLIMIT_CPU: ::c_int = 0;
2175 pub const RLIMIT_FSIZE: ::c_int = 1;
2176 pub const RLIMIT_DATA: ::c_int = 2;
2177 pub const RLIMIT_STACK: ::c_int = 3;
2178 pub const RLIMIT_CORE: ::c_int = 4;
2179 pub const RLIMIT_AS: ::c_int = 5;
2180 pub const RLIMIT_RSS: ::c_int = RLIMIT_AS;
2181 pub const RLIMIT_MEMLOCK: ::c_int = 6;
2182 pub const RLIMIT_NPROC: ::c_int = 7;
2183 pub const RLIMIT_NOFILE: ::c_int = 8;
2184 #[deprecated(since = "0.2.64", note = "Not stable across OS versions")]
2185 pub const RLIM_NLIMITS: ::c_int = 9;
2186 pub const _RLIMIT_POSIX_FLAG: ::c_int = 0x1000;
2187
2188 pub const RLIM_INFINITY: rlim_t = 0x7fff_ffff_ffff_ffff;
2189
2190 pub const RUSAGE_SELF: ::c_int = 0;
2191 pub const RUSAGE_CHILDREN: ::c_int = -1;
2192
2193 pub const MADV_NORMAL: ::c_int = 0;
2194 pub const MADV_RANDOM: ::c_int = 1;
2195 pub const MADV_SEQUENTIAL: ::c_int = 2;
2196 pub const MADV_WILLNEED: ::c_int = 3;
2197 pub const MADV_DONTNEED: ::c_int = 4;
2198 pub const MADV_FREE: ::c_int = 5;
2199 pub const MADV_ZERO_WIRED_PAGES: ::c_int = 6;
2200 pub const MADV_FREE_REUSABLE: ::c_int = 7;
2201 pub const MADV_FREE_REUSE: ::c_int = 8;
2202 pub const MADV_CAN_REUSE: ::c_int = 9;
2203
2204 pub const MINCORE_INCORE: ::c_int = 0x1;
2205 pub const MINCORE_REFERENCED: ::c_int = 0x2;
2206 pub const MINCORE_MODIFIED: ::c_int = 0x4;
2207 pub const MINCORE_REFERENCED_OTHER: ::c_int = 0x8;
2208 pub const MINCORE_MODIFIED_OTHER: ::c_int = 0x10;
2209
2210 //
2211 // sys/netinet/in.h
2212 // Protocols (RFC 1700)
2213 // NOTE: These are in addition to the constants defined in src/unix/mod.rs
2214
2215 // IPPROTO_IP defined in src/unix/mod.rs
2216 /// IP6 hop-by-hop options
2217 pub const IPPROTO_HOPOPTS: ::c_int = 0;
2218 // IPPROTO_ICMP defined in src/unix/mod.rs
2219 /// group mgmt protocol
2220 pub const IPPROTO_IGMP: ::c_int = 2;
2221 /// gateway<sup>2</sup> (deprecated)
2222 pub const IPPROTO_GGP: ::c_int = 3;
2223 /// for compatibility
2224 pub const IPPROTO_IPIP: ::c_int = 4;
2225 // IPPROTO_TCP defined in src/unix/mod.rs
2226 /// Stream protocol II.
2227 pub const IPPROTO_ST: ::c_int = 7;
2228 /// exterior gateway protocol
2229 pub const IPPROTO_EGP: ::c_int = 8;
2230 /// private interior gateway
2231 pub const IPPROTO_PIGP: ::c_int = 9;
2232 /// BBN RCC Monitoring
2233 pub const IPPROTO_RCCMON: ::c_int = 10;
2234 /// network voice protocol
2235 pub const IPPROTO_NVPII: ::c_int = 11;
2236 /// pup
2237 pub const IPPROTO_PUP: ::c_int = 12;
2238 /// Argus
2239 pub const IPPROTO_ARGUS: ::c_int = 13;
2240 /// EMCON
2241 pub const IPPROTO_EMCON: ::c_int = 14;
2242 /// Cross Net Debugger
2243 pub const IPPROTO_XNET: ::c_int = 15;
2244 /// Chaos
2245 pub const IPPROTO_CHAOS: ::c_int = 16;
2246 // IPPROTO_UDP defined in src/unix/mod.rs
2247 /// Multiplexing
2248 pub const IPPROTO_MUX: ::c_int = 18;
2249 /// DCN Measurement Subsystems
2250 pub const IPPROTO_MEAS: ::c_int = 19;
2251 /// Host Monitoring
2252 pub const IPPROTO_HMP: ::c_int = 20;
2253 /// Packet Radio Measurement
2254 pub const IPPROTO_PRM: ::c_int = 21;
2255 /// xns idp
2256 pub const IPPROTO_IDP: ::c_int = 22;
2257 /// Trunk-1
2258 pub const IPPROTO_TRUNK1: ::c_int = 23;
2259 /// Trunk-2
2260 pub const IPPROTO_TRUNK2: ::c_int = 24;
2261 /// Leaf-1
2262 pub const IPPROTO_LEAF1: ::c_int = 25;
2263 /// Leaf-2
2264 pub const IPPROTO_LEAF2: ::c_int = 26;
2265 /// Reliable Data
2266 pub const IPPROTO_RDP: ::c_int = 27;
2267 /// Reliable Transaction
2268 pub const IPPROTO_IRTP: ::c_int = 28;
2269 /// tp-4 w/ class negotiation
2270 pub const IPPROTO_TP: ::c_int = 29;
2271 /// Bulk Data Transfer
2272 pub const IPPROTO_BLT: ::c_int = 30;
2273 /// Network Services
2274 pub const IPPROTO_NSP: ::c_int = 31;
2275 /// Merit Internodal
2276 pub const IPPROTO_INP: ::c_int = 32;
2277 /// Sequential Exchange
2278 pub const IPPROTO_SEP: ::c_int = 33;
2279 /// Third Party Connect
2280 pub const IPPROTO_3PC: ::c_int = 34;
2281 /// InterDomain Policy Routing
2282 pub const IPPROTO_IDPR: ::c_int = 35;
2283 /// XTP
2284 pub const IPPROTO_XTP: ::c_int = 36;
2285 /// Datagram Delivery
2286 pub const IPPROTO_DDP: ::c_int = 37;
2287 /// Control Message Transport
2288 pub const IPPROTO_CMTP: ::c_int = 38;
2289 /// TP++ Transport
2290 pub const IPPROTO_TPXX: ::c_int = 39;
2291 /// IL transport protocol
2292 pub const IPPROTO_IL: ::c_int = 40;
2293 // IPPROTO_IPV6 defined in src/unix/mod.rs
2294 /// Source Demand Routing
2295 pub const IPPROTO_SDRP: ::c_int = 42;
2296 /// IP6 routing header
2297 pub const IPPROTO_ROUTING: ::c_int = 43;
2298 /// IP6 fragmentation header
2299 pub const IPPROTO_FRAGMENT: ::c_int = 44;
2300 /// InterDomain Routing
2301 pub const IPPROTO_IDRP: ::c_int = 45;
2302 /// resource reservation
2303 pub const IPPROTO_RSVP: ::c_int = 46;
2304 /// General Routing Encap.
2305 pub const IPPROTO_GRE: ::c_int = 47;
2306 /// Mobile Host Routing
2307 pub const IPPROTO_MHRP: ::c_int = 48;
2308 /// BHA
2309 pub const IPPROTO_BHA: ::c_int = 49;
2310 /// IP6 Encap Sec. Payload
2311 pub const IPPROTO_ESP: ::c_int = 50;
2312 /// IP6 Auth Header
2313 pub const IPPROTO_AH: ::c_int = 51;
2314 /// Integ. Net Layer Security
2315 pub const IPPROTO_INLSP: ::c_int = 52;
2316 /// IP with encryption
2317 pub const IPPROTO_SWIPE: ::c_int = 53;
2318 /// Next Hop Resolution
2319 pub const IPPROTO_NHRP: ::c_int = 54;
2320 /* 55-57: Unassigned */
2321 // IPPROTO_ICMPV6 defined in src/unix/mod.rs
2322 /// IP6 no next header
2323 pub const IPPROTO_NONE: ::c_int = 59;
2324 /// IP6 destination option
2325 pub const IPPROTO_DSTOPTS: ::c_int = 60;
2326 /// any host internal protocol
2327 pub const IPPROTO_AHIP: ::c_int = 61;
2328 /// CFTP
2329 pub const IPPROTO_CFTP: ::c_int = 62;
2330 /// "hello" routing protocol
2331 pub const IPPROTO_HELLO: ::c_int = 63;
2332 /// SATNET/Backroom EXPAK
2333 pub const IPPROTO_SATEXPAK: ::c_int = 64;
2334 /// Kryptolan
2335 pub const IPPROTO_KRYPTOLAN: ::c_int = 65;
2336 /// Remote Virtual Disk
2337 pub const IPPROTO_RVD: ::c_int = 66;
2338 /// Pluribus Packet Core
2339 pub const IPPROTO_IPPC: ::c_int = 67;
2340 /// Any distributed FS
2341 pub const IPPROTO_ADFS: ::c_int = 68;
2342 /// Satnet Monitoring
2343 pub const IPPROTO_SATMON: ::c_int = 69;
2344 /// VISA Protocol
2345 pub const IPPROTO_VISA: ::c_int = 70;
2346 /// Packet Core Utility
2347 pub const IPPROTO_IPCV: ::c_int = 71;
2348 /// Comp. Prot. Net. Executive
2349 pub const IPPROTO_CPNX: ::c_int = 72;
2350 /// Comp. Prot. HeartBeat
2351 pub const IPPROTO_CPHB: ::c_int = 73;
2352 /// Wang Span Network
2353 pub const IPPROTO_WSN: ::c_int = 74;
2354 /// Packet Video Protocol
2355 pub const IPPROTO_PVP: ::c_int = 75;
2356 /// BackRoom SATNET Monitoring
2357 pub const IPPROTO_BRSATMON: ::c_int = 76;
2358 /// Sun net disk proto (temp.)
2359 pub const IPPROTO_ND: ::c_int = 77;
2360 /// WIDEBAND Monitoring
2361 pub const IPPROTO_WBMON: ::c_int = 78;
2362 /// WIDEBAND EXPAK
2363 pub const IPPROTO_WBEXPAK: ::c_int = 79;
2364 /// ISO cnlp
2365 pub const IPPROTO_EON: ::c_int = 80;
2366 /// VMTP
2367 pub const IPPROTO_VMTP: ::c_int = 81;
2368 /// Secure VMTP
2369 pub const IPPROTO_SVMTP: ::c_int = 82;
2370 /// Banyon VINES
2371 pub const IPPROTO_VINES: ::c_int = 83;
2372 /// TTP
2373 pub const IPPROTO_TTP: ::c_int = 84;
2374 /// NSFNET-IGP
2375 pub const IPPROTO_IGP: ::c_int = 85;
2376 /// dissimilar gateway prot.
2377 pub const IPPROTO_DGP: ::c_int = 86;
2378 /// TCF
2379 pub const IPPROTO_TCF: ::c_int = 87;
2380 /// Cisco/GXS IGRP
2381 pub const IPPROTO_IGRP: ::c_int = 88;
2382 /// OSPFIGP
2383 pub const IPPROTO_OSPFIGP: ::c_int = 89;
2384 /// Strite RPC protocol
2385 pub const IPPROTO_SRPC: ::c_int = 90;
2386 /// Locus Address Resoloution
2387 pub const IPPROTO_LARP: ::c_int = 91;
2388 /// Multicast Transport
2389 pub const IPPROTO_MTP: ::c_int = 92;
2390 /// AX.25 Frames
2391 pub const IPPROTO_AX25: ::c_int = 93;
2392 /// IP encapsulated in IP
2393 pub const IPPROTO_IPEIP: ::c_int = 94;
2394 /// Mobile Int.ing control
2395 pub const IPPROTO_MICP: ::c_int = 95;
2396 /// Semaphore Comm. security
2397 pub const IPPROTO_SCCSP: ::c_int = 96;
2398 /// Ethernet IP encapsulation
2399 pub const IPPROTO_ETHERIP: ::c_int = 97;
2400 /// encapsulation header
2401 pub const IPPROTO_ENCAP: ::c_int = 98;
2402 /// any private encr. scheme
2403 pub const IPPROTO_APES: ::c_int = 99;
2404 /// GMTP
2405 pub const IPPROTO_GMTP: ::c_int = 100;
2406
2407 /* 101-254: Partly Unassigned */
2408 /// Protocol Independent Mcast
2409 pub const IPPROTO_PIM: ::c_int = 103;
2410 /// payload compression (IPComp)
2411 pub const IPPROTO_IPCOMP: ::c_int = 108;
2412 /// PGM
2413 pub const IPPROTO_PGM: ::c_int = 113;
2414 /// SCTP
2415 pub const IPPROTO_SCTP: ::c_int = 132;
2416
2417 /* 255: Reserved */
2418 /* BSD Private, local use, namespace incursion */
2419 /// divert pseudo-protocol
2420 pub const IPPROTO_DIVERT: ::c_int = 254;
2421 /// raw IP packet
2422 pub const IPPROTO_RAW: ::c_int = 255;
2423 pub const IPPROTO_MAX: ::c_int = 256;
2424 /// last return value of *_input(), meaning "all job for this pkt is done".
2425 pub const IPPROTO_DONE: ::c_int = 257;
2426
2427 pub const AF_UNSPEC: ::c_int = 0;
2428 pub const AF_LOCAL: ::c_int = 1;
2429 pub const AF_UNIX: ::c_int = AF_LOCAL;
2430 pub const AF_INET: ::c_int = 2;
2431 pub const AF_IMPLINK: ::c_int = 3;
2432 pub const AF_PUP: ::c_int = 4;
2433 pub const AF_CHAOS: ::c_int = 5;
2434 pub const AF_NS: ::c_int = 6;
2435 pub const AF_ISO: ::c_int = 7;
2436 pub const AF_OSI: ::c_int = AF_ISO;
2437 pub const AF_ECMA: ::c_int = 8;
2438 pub const AF_DATAKIT: ::c_int = 9;
2439 pub const AF_CCITT: ::c_int = 10;
2440 pub const AF_SNA: ::c_int = 11;
2441 pub const AF_DECnet: ::c_int = 12;
2442 pub const AF_DLI: ::c_int = 13;
2443 pub const AF_LAT: ::c_int = 14;
2444 pub const AF_HYLINK: ::c_int = 15;
2445 pub const AF_APPLETALK: ::c_int = 16;
2446 pub const AF_ROUTE: ::c_int = 17;
2447 pub const AF_LINK: ::c_int = 18;
2448 pub const pseudo_AF_XTP: ::c_int = 19;
2449 pub const AF_COIP: ::c_int = 20;
2450 pub const AF_CNT: ::c_int = 21;
2451 pub const pseudo_AF_RTIP: ::c_int = 22;
2452 pub const AF_IPX: ::c_int = 23;
2453 pub const AF_SIP: ::c_int = 24;
2454 pub const pseudo_AF_PIP: ::c_int = 25;
2455 pub const AF_ISDN: ::c_int = 28;
2456 pub const AF_E164: ::c_int = AF_ISDN;
2457 pub const pseudo_AF_KEY: ::c_int = 29;
2458 pub const AF_INET6: ::c_int = 30;
2459 pub const AF_NATM: ::c_int = 31;
2460 pub const AF_SYSTEM: ::c_int = 32;
2461 pub const AF_NETBIOS: ::c_int = 33;
2462 pub const AF_PPP: ::c_int = 34;
2463 pub const pseudo_AF_HDRCMPLT: ::c_int = 35;
2464 pub const AF_SYS_CONTROL: ::c_int = 2;
2465
2466 pub const SYSPROTO_EVENT: ::c_int = 1;
2467 pub const SYSPROTO_CONTROL: ::c_int = 2;
2468
2469 pub const PF_UNSPEC: ::c_int = AF_UNSPEC;
2470 pub const PF_LOCAL: ::c_int = AF_LOCAL;
2471 pub const PF_UNIX: ::c_int = PF_LOCAL;
2472 pub const PF_INET: ::c_int = AF_INET;
2473 pub const PF_IMPLINK: ::c_int = AF_IMPLINK;
2474 pub const PF_PUP: ::c_int = AF_PUP;
2475 pub const PF_CHAOS: ::c_int = AF_CHAOS;
2476 pub const PF_NS: ::c_int = AF_NS;
2477 pub const PF_ISO: ::c_int = AF_ISO;
2478 pub const PF_OSI: ::c_int = AF_ISO;
2479 pub const PF_ECMA: ::c_int = AF_ECMA;
2480 pub const PF_DATAKIT: ::c_int = AF_DATAKIT;
2481 pub const PF_CCITT: ::c_int = AF_CCITT;
2482 pub const PF_SNA: ::c_int = AF_SNA;
2483 pub const PF_DECnet: ::c_int = AF_DECnet;
2484 pub const PF_DLI: ::c_int = AF_DLI;
2485 pub const PF_LAT: ::c_int = AF_LAT;
2486 pub const PF_HYLINK: ::c_int = AF_HYLINK;
2487 pub const PF_APPLETALK: ::c_int = AF_APPLETALK;
2488 pub const PF_ROUTE: ::c_int = AF_ROUTE;
2489 pub const PF_LINK: ::c_int = AF_LINK;
2490 pub const PF_XTP: ::c_int = pseudo_AF_XTP;
2491 pub const PF_COIP: ::c_int = AF_COIP;
2492 pub const PF_CNT: ::c_int = AF_CNT;
2493 pub const PF_SIP: ::c_int = AF_SIP;
2494 pub const PF_IPX: ::c_int = AF_IPX;
2495 pub const PF_RTIP: ::c_int = pseudo_AF_RTIP;
2496 pub const PF_PIP: ::c_int = pseudo_AF_PIP;
2497 pub const PF_ISDN: ::c_int = AF_ISDN;
2498 pub const PF_KEY: ::c_int = pseudo_AF_KEY;
2499 pub const PF_INET6: ::c_int = AF_INET6;
2500 pub const PF_NATM: ::c_int = AF_NATM;
2501 pub const PF_SYSTEM: ::c_int = AF_SYSTEM;
2502 pub const PF_NETBIOS: ::c_int = AF_NETBIOS;
2503 pub const PF_PPP: ::c_int = AF_PPP;
2504
2505 pub const NET_RT_DUMP: ::c_int = 1;
2506 pub const NET_RT_FLAGS: ::c_int = 2;
2507 pub const NET_RT_IFLIST: ::c_int = 3;
2508
2509 pub const SOMAXCONN: ::c_int = 128;
2510
2511 pub const SOCK_MAXADDRLEN: ::c_int = 255;
2512
2513 pub const SOCK_STREAM: ::c_int = 1;
2514 pub const SOCK_DGRAM: ::c_int = 2;
2515 pub const SOCK_RAW: ::c_int = 3;
2516 pub const SOCK_RDM: ::c_int = 4;
2517 pub const SOCK_SEQPACKET: ::c_int = 5;
2518 pub const IP_TTL: ::c_int = 4;
2519 pub const IP_HDRINCL: ::c_int = 2;
2520 pub const IP_RECVDSTADDR: ::c_int = 7;
2521 pub const IP_ADD_MEMBERSHIP: ::c_int = 12;
2522 pub const IP_DROP_MEMBERSHIP: ::c_int = 13;
2523 pub const IP_RECVIF: ::c_int = 20;
2524 pub const IP_BOUND_IF: ::c_int = 25;
2525 pub const IP_PKTINFO: ::c_int = 26;
2526 pub const IP_RECVTOS: ::c_int = 27;
2527 pub const IPV6_JOIN_GROUP: ::c_int = 12;
2528 pub const IPV6_LEAVE_GROUP: ::c_int = 13;
2529 pub const IPV6_CHECKSUM: ::c_int = 26;
2530 pub const IPV6_RECVTCLASS: ::c_int = 35;
2531 pub const IPV6_TCLASS: ::c_int = 36;
2532 pub const IPV6_PKTINFO: ::c_int = 46;
2533 pub const IPV6_HOPLIMIT: ::c_int = 47;
2534 pub const IPV6_RECVPKTINFO: ::c_int = 61;
2535
2536 pub const TCP_NOPUSH: ::c_int = 4;
2537 pub const TCP_NOOPT: ::c_int = 8;
2538 pub const TCP_KEEPALIVE: ::c_int = 0x10;
2539 pub const TCP_KEEPINTVL: ::c_int = 0x101;
2540 pub const TCP_KEEPCNT: ::c_int = 0x102;
2541 /// Enable/Disable TCP Fastopen on this socket
2542 pub const TCP_FASTOPEN: ::c_int = 0x105;
2543
2544 pub const SOL_LOCAL: ::c_int = 0;
2545
2546 pub const LOCAL_PEERCRED: ::c_int = 0x001;
2547 pub const LOCAL_PEERPID: ::c_int = 0x002;
2548 pub const LOCAL_PEEREPID: ::c_int = 0x003;
2549 pub const LOCAL_PEERUUID: ::c_int = 0x004;
2550 pub const LOCAL_PEEREUUID: ::c_int = 0x005;
2551
2552 pub const SOL_SOCKET: ::c_int = 0xffff;
2553
2554 pub const SO_DEBUG: ::c_int = 0x01;
2555 pub const SO_ACCEPTCONN: ::c_int = 0x0002;
2556 pub const SO_REUSEADDR: ::c_int = 0x0004;
2557 pub const SO_KEEPALIVE: ::c_int = 0x0008;
2558 pub const SO_DONTROUTE: ::c_int = 0x0010;
2559 pub const SO_BROADCAST: ::c_int = 0x0020;
2560 pub const SO_USELOOPBACK: ::c_int = 0x0040;
2561 pub const SO_LINGER: ::c_int = 0x0080;
2562 pub const SO_OOBINLINE: ::c_int = 0x0100;
2563 pub const SO_REUSEPORT: ::c_int = 0x0200;
2564 pub const SO_TIMESTAMP: ::c_int = 0x0400;
2565 pub const SO_TIMESTAMP_MONOTONIC: ::c_int = 0x0800;
2566 pub const SO_DONTTRUNC: ::c_int = 0x2000;
2567 pub const SO_WANTMORE: ::c_int = 0x4000;
2568 pub const SO_WANTOOBFLAG: ::c_int = 0x8000;
2569 pub const SO_SNDBUF: ::c_int = 0x1001;
2570 pub const SO_RCVBUF: ::c_int = 0x1002;
2571 pub const SO_SNDLOWAT: ::c_int = 0x1003;
2572 pub const SO_RCVLOWAT: ::c_int = 0x1004;
2573 pub const SO_SNDTIMEO: ::c_int = 0x1005;
2574 pub const SO_RCVTIMEO: ::c_int = 0x1006;
2575 pub const SO_ERROR: ::c_int = 0x1007;
2576 pub const SO_TYPE: ::c_int = 0x1008;
2577 pub const SO_LABEL: ::c_int = 0x1010;
2578 pub const SO_PEERLABEL: ::c_int = 0x1011;
2579 pub const SO_NREAD: ::c_int = 0x1020;
2580 pub const SO_NKE: ::c_int = 0x1021;
2581 pub const SO_NOSIGPIPE: ::c_int = 0x1022;
2582 pub const SO_NOADDRERR: ::c_int = 0x1023;
2583 pub const SO_NWRITE: ::c_int = 0x1024;
2584 pub const SO_REUSESHAREUID: ::c_int = 0x1025;
2585 pub const SO_NOTIFYCONFLICT: ::c_int = 0x1026;
2586 pub const SO_LINGER_SEC: ::c_int = 0x1080;
2587 pub const SO_RANDOMPORT: ::c_int = 0x1082;
2588 pub const SO_NP_EXTENSIONS: ::c_int = 0x1083;
2589
2590 pub const MSG_OOB: ::c_int = 0x1;
2591 pub const MSG_PEEK: ::c_int = 0x2;
2592 pub const MSG_DONTROUTE: ::c_int = 0x4;
2593 pub const MSG_EOR: ::c_int = 0x8;
2594 pub const MSG_TRUNC: ::c_int = 0x10;
2595 pub const MSG_CTRUNC: ::c_int = 0x20;
2596 pub const MSG_WAITALL: ::c_int = 0x40;
2597 pub const MSG_DONTWAIT: ::c_int = 0x80;
2598 pub const MSG_EOF: ::c_int = 0x100;
2599 pub const MSG_FLUSH: ::c_int = 0x400;
2600 pub const MSG_HOLD: ::c_int = 0x800;
2601 pub const MSG_SEND: ::c_int = 0x1000;
2602 pub const MSG_HAVEMORE: ::c_int = 0x2000;
2603 pub const MSG_RCVMORE: ::c_int = 0x4000;
2604 // pub const MSG_COMPAT: ::c_int = 0x8000;
2605
2606 pub const SCM_TIMESTAMP: ::c_int = 0x02;
2607 pub const SCM_CREDS: ::c_int = 0x03;
2608
2609 // https://github.com/aosm/xnu/blob/master/bsd/net/if.h#L140-L156
2610 pub const IFF_UP: ::c_int = 0x1; // interface is up
2611 pub const IFF_BROADCAST: ::c_int = 0x2; // broadcast address valid
2612 pub const IFF_DEBUG: ::c_int = 0x4; // turn on debugging
2613 pub const IFF_LOOPBACK: ::c_int = 0x8; // is a loopback net
2614 pub const IFF_POINTOPOINT: ::c_int = 0x10; // interface is point-to-point link
2615 pub const IFF_NOTRAILERS: ::c_int = 0x20; // obsolete: avoid use of trailers
2616 pub const IFF_RUNNING: ::c_int = 0x40; // resources allocated
2617 pub const IFF_NOARP: ::c_int = 0x80; // no address resolution protocol
2618 pub const IFF_PROMISC: ::c_int = 0x100; // receive all packets
2619 pub const IFF_ALLMULTI: ::c_int = 0x200; // receive all multicast packets
2620 pub const IFF_OACTIVE: ::c_int = 0x400; // transmission in progress
2621 pub const IFF_SIMPLEX: ::c_int = 0x800; // can't hear own transmissions
2622 pub const IFF_LINK0: ::c_int = 0x1000; // per link layer defined bit
2623 pub const IFF_LINK1: ::c_int = 0x2000; // per link layer defined bit
2624 pub const IFF_LINK2: ::c_int = 0x4000; // per link layer defined bit
2625 pub const IFF_ALTPHYS: ::c_int = IFF_LINK2; // use alternate physical connection
2626 pub const IFF_MULTICAST: ::c_int = 0x8000; // supports multicast
2627
2628 pub const SHUT_RD: ::c_int = 0;
2629 pub const SHUT_WR: ::c_int = 1;
2630 pub const SHUT_RDWR: ::c_int = 2;
2631
2632 pub const SAE_ASSOCID_ANY: ::sae_associd_t = 0;
2633 /// ((sae_associd_t)(-1ULL))
2634 pub const SAE_ASSOCID_ALL: ::sae_associd_t = 0xffffffff;
2635
2636 pub const SAE_CONNID_ANY: ::sae_connid_t = 0;
2637 /// ((sae_connid_t)(-1ULL))
2638 pub const SAE_CONNID_ALL: ::sae_connid_t = 0xffffffff;
2639
2640 // connectx() flag parameters
2641
2642 /// resume connect() on read/write
2643 pub const CONNECT_RESUME_ON_READ_WRITE: ::c_uint = 0x1;
2644 /// data is idempotent
2645 pub const CONNECT_DATA_IDEMPOTENT: ::c_uint = 0x2;
2646 /// data includes security that replaces the TFO-cookie
2647 pub const CONNECT_DATA_AUTHENTICATED: ::c_uint = 0x4;
2648
2649 pub const LOCK_SH: ::c_int = 1;
2650 pub const LOCK_EX: ::c_int = 2;
2651 pub const LOCK_NB: ::c_int = 4;
2652 pub const LOCK_UN: ::c_int = 8;
2653
2654 pub const MAP_COPY: ::c_int = 0x0002;
2655 pub const MAP_RENAME: ::c_int = 0x0020;
2656 pub const MAP_NORESERVE: ::c_int = 0x0040;
2657 pub const MAP_NOEXTEND: ::c_int = 0x0100;
2658 pub const MAP_HASSEMAPHORE: ::c_int = 0x0200;
2659 pub const MAP_NOCACHE: ::c_int = 0x0400;
2660 pub const MAP_JIT: ::c_int = 0x0800;
2661
2662 pub const _SC_ARG_MAX: ::c_int = 1;
2663 pub const _SC_CHILD_MAX: ::c_int = 2;
2664 pub const _SC_CLK_TCK: ::c_int = 3;
2665 pub const _SC_NGROUPS_MAX: ::c_int = 4;
2666 pub const _SC_OPEN_MAX: ::c_int = 5;
2667 pub const _SC_JOB_CONTROL: ::c_int = 6;
2668 pub const _SC_SAVED_IDS: ::c_int = 7;
2669 pub const _SC_VERSION: ::c_int = 8;
2670 pub const _SC_BC_BASE_MAX: ::c_int = 9;
2671 pub const _SC_BC_DIM_MAX: ::c_int = 10;
2672 pub const _SC_BC_SCALE_MAX: ::c_int = 11;
2673 pub const _SC_BC_STRING_MAX: ::c_int = 12;
2674 pub const _SC_COLL_WEIGHTS_MAX: ::c_int = 13;
2675 pub const _SC_EXPR_NEST_MAX: ::c_int = 14;
2676 pub const _SC_LINE_MAX: ::c_int = 15;
2677 pub const _SC_RE_DUP_MAX: ::c_int = 16;
2678 pub const _SC_2_VERSION: ::c_int = 17;
2679 pub const _SC_2_C_BIND: ::c_int = 18;
2680 pub const _SC_2_C_DEV: ::c_int = 19;
2681 pub const _SC_2_CHAR_TERM: ::c_int = 20;
2682 pub const _SC_2_FORT_DEV: ::c_int = 21;
2683 pub const _SC_2_FORT_RUN: ::c_int = 22;
2684 pub const _SC_2_LOCALEDEF: ::c_int = 23;
2685 pub const _SC_2_SW_DEV: ::c_int = 24;
2686 pub const _SC_2_UPE: ::c_int = 25;
2687 pub const _SC_STREAM_MAX: ::c_int = 26;
2688 pub const _SC_TZNAME_MAX: ::c_int = 27;
2689 pub const _SC_ASYNCHRONOUS_IO: ::c_int = 28;
2690 pub const _SC_PAGESIZE: ::c_int = 29;
2691 pub const _SC_MEMLOCK: ::c_int = 30;
2692 pub const _SC_MEMLOCK_RANGE: ::c_int = 31;
2693 pub const _SC_MEMORY_PROTECTION: ::c_int = 32;
2694 pub const _SC_MESSAGE_PASSING: ::c_int = 33;
2695 pub const _SC_PRIORITIZED_IO: ::c_int = 34;
2696 pub const _SC_PRIORITY_SCHEDULING: ::c_int = 35;
2697 pub const _SC_REALTIME_SIGNALS: ::c_int = 36;
2698 pub const _SC_SEMAPHORES: ::c_int = 37;
2699 pub const _SC_FSYNC: ::c_int = 38;
2700 pub const _SC_SHARED_MEMORY_OBJECTS: ::c_int = 39;
2701 pub const _SC_SYNCHRONIZED_IO: ::c_int = 40;
2702 pub const _SC_TIMERS: ::c_int = 41;
2703 pub const _SC_AIO_LISTIO_MAX: ::c_int = 42;
2704 pub const _SC_AIO_MAX: ::c_int = 43;
2705 pub const _SC_AIO_PRIO_DELTA_MAX: ::c_int = 44;
2706 pub const _SC_DELAYTIMER_MAX: ::c_int = 45;
2707 pub const _SC_MQ_OPEN_MAX: ::c_int = 46;
2708 pub const _SC_MAPPED_FILES: ::c_int = 47;
2709 pub const _SC_RTSIG_MAX: ::c_int = 48;
2710 pub const _SC_SEM_NSEMS_MAX: ::c_int = 49;
2711 pub const _SC_SEM_VALUE_MAX: ::c_int = 50;
2712 pub const _SC_SIGQUEUE_MAX: ::c_int = 51;
2713 pub const _SC_TIMER_MAX: ::c_int = 52;
2714 pub const _SC_NPROCESSORS_CONF: ::c_int = 57;
2715 pub const _SC_NPROCESSORS_ONLN: ::c_int = 58;
2716 pub const _SC_2_PBS: ::c_int = 59;
2717 pub const _SC_2_PBS_ACCOUNTING: ::c_int = 60;
2718 pub const _SC_2_PBS_CHECKPOINT: ::c_int = 61;
2719 pub const _SC_2_PBS_LOCATE: ::c_int = 62;
2720 pub const _SC_2_PBS_MESSAGE: ::c_int = 63;
2721 pub const _SC_2_PBS_TRACK: ::c_int = 64;
2722 pub const _SC_ADVISORY_INFO: ::c_int = 65;
2723 pub const _SC_BARRIERS: ::c_int = 66;
2724 pub const _SC_CLOCK_SELECTION: ::c_int = 67;
2725 pub const _SC_CPUTIME: ::c_int = 68;
2726 pub const _SC_FILE_LOCKING: ::c_int = 69;
2727 pub const _SC_HOST_NAME_MAX: ::c_int = 72;
2728 pub const _SC_MONOTONIC_CLOCK: ::c_int = 74;
2729 pub const _SC_READER_WRITER_LOCKS: ::c_int = 76;
2730 pub const _SC_REGEXP: ::c_int = 77;
2731 pub const _SC_SHELL: ::c_int = 78;
2732 pub const _SC_SPAWN: ::c_int = 79;
2733 pub const _SC_SPIN_LOCKS: ::c_int = 80;
2734 pub const _SC_SPORADIC_SERVER: ::c_int = 81;
2735 pub const _SC_THREAD_CPUTIME: ::c_int = 84;
2736 pub const _SC_THREAD_SPORADIC_SERVER: ::c_int = 92;
2737 pub const _SC_TIMEOUTS: ::c_int = 95;
2738 pub const _SC_TRACE: ::c_int = 97;
2739 pub const _SC_TRACE_EVENT_FILTER: ::c_int = 98;
2740 pub const _SC_TRACE_INHERIT: ::c_int = 99;
2741 pub const _SC_TRACE_LOG: ::c_int = 100;
2742 pub const _SC_TYPED_MEMORY_OBJECTS: ::c_int = 102;
2743 pub const _SC_V6_ILP32_OFF32: ::c_int = 103;
2744 pub const _SC_V6_ILP32_OFFBIG: ::c_int = 104;
2745 pub const _SC_V6_LP64_OFF64: ::c_int = 105;
2746 pub const _SC_V6_LPBIG_OFFBIG: ::c_int = 106;
2747 pub const _SC_IPV6: ::c_int = 118;
2748 pub const _SC_RAW_SOCKETS: ::c_int = 119;
2749 pub const _SC_SYMLOOP_MAX: ::c_int = 120;
2750 pub const _SC_PAGE_SIZE: ::c_int = _SC_PAGESIZE;
2751 pub const _SC_XOPEN_STREAMS: ::c_int = 114;
2752 pub const _SC_XBS5_ILP32_OFF32: ::c_int = 122;
2753 pub const _SC_XBS5_ILP32_OFFBIG: ::c_int = 123;
2754 pub const _SC_XBS5_LP64_OFF64: ::c_int = 124;
2755 pub const _SC_XBS5_LPBIG_OFFBIG: ::c_int = 125;
2756 pub const _SC_SS_REPL_MAX: ::c_int = 126;
2757 pub const _SC_TRACE_EVENT_NAME_MAX: ::c_int = 127;
2758 pub const _SC_TRACE_NAME_MAX: ::c_int = 128;
2759 pub const _SC_TRACE_SYS_MAX: ::c_int = 129;
2760 pub const _SC_TRACE_USER_EVENT_MAX: ::c_int = 130;
2761 pub const _SC_PASS_MAX: ::c_int = 131;
2762
2763 pub const PTHREAD_MUTEX_NORMAL: ::c_int = 0;
2764 pub const PTHREAD_MUTEX_ERRORCHECK: ::c_int = 1;
2765 pub const PTHREAD_MUTEX_RECURSIVE: ::c_int = 2;
2766 pub const PTHREAD_MUTEX_DEFAULT: ::c_int = PTHREAD_MUTEX_NORMAL;
2767 pub const _PTHREAD_MUTEX_SIG_init: ::c_long = 0x32AAABA7;
2768 pub const _PTHREAD_COND_SIG_init: ::c_long = 0x3CB0B1BB;
2769 pub const _PTHREAD_RWLOCK_SIG_init: ::c_long = 0x2DA8B3B4;
2770 pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = pthread_mutex_t {
2771 __sig: _PTHREAD_MUTEX_SIG_init,
2772 __opaque: [0; __PTHREAD_MUTEX_SIZE__],
2773 };
2774 pub const PTHREAD_COND_INITIALIZER: pthread_cond_t = pthread_cond_t {
2775 __sig: _PTHREAD_COND_SIG_init,
2776 __opaque: [0; __PTHREAD_COND_SIZE__],
2777 };
2778 pub const PTHREAD_RWLOCK_INITIALIZER: pthread_rwlock_t = pthread_rwlock_t {
2779 __sig: _PTHREAD_RWLOCK_SIG_init,
2780 __opaque: [0; __PTHREAD_RWLOCK_SIZE__],
2781 };
2782
2783 pub const MINSIGSTKSZ: ::size_t = 32768;
2784 pub const SIGSTKSZ: ::size_t = 131072;
2785
2786 pub const FD_SETSIZE: usize = 1024;
2787
2788 pub const ST_NOSUID: ::c_ulong = 2;
2789
2790 pub const EVFILT_READ: i16 = -1;
2791 pub const EVFILT_WRITE: i16 = -2;
2792 pub const EVFILT_AIO: i16 = -3;
2793 pub const EVFILT_VNODE: i16 = -4;
2794 pub const EVFILT_PROC: i16 = -5;
2795 pub const EVFILT_SIGNAL: i16 = -6;
2796 pub const EVFILT_TIMER: i16 = -7;
2797 pub const EVFILT_MACHPORT: i16 = -8;
2798 pub const EVFILT_FS: i16 = -9;
2799 pub const EVFILT_USER: i16 = -10;
2800 pub const EVFILT_VM: i16 = -12;
2801
2802 pub const EV_ADD: u16 = 0x1;
2803 pub const EV_DELETE: u16 = 0x2;
2804 pub const EV_ENABLE: u16 = 0x4;
2805 pub const EV_DISABLE: u16 = 0x8;
2806 pub const EV_ONESHOT: u16 = 0x10;
2807 pub const EV_CLEAR: u16 = 0x20;
2808 pub const EV_RECEIPT: u16 = 0x40;
2809 pub const EV_DISPATCH: u16 = 0x80;
2810 pub const EV_FLAG0: u16 = 0x1000;
2811 pub const EV_POLL: u16 = 0x1000;
2812 pub const EV_FLAG1: u16 = 0x2000;
2813 pub const EV_OOBAND: u16 = 0x2000;
2814 pub const EV_ERROR: u16 = 0x4000;
2815 pub const EV_EOF: u16 = 0x8000;
2816 pub const EV_SYSFLAGS: u16 = 0xf000;
2817
2818 pub const NOTE_TRIGGER: u32 = 0x01000000;
2819 pub const NOTE_FFNOP: u32 = 0x00000000;
2820 pub const NOTE_FFAND: u32 = 0x40000000;
2821 pub const NOTE_FFOR: u32 = 0x80000000;
2822 pub const NOTE_FFCOPY: u32 = 0xc0000000;
2823 pub const NOTE_FFCTRLMASK: u32 = 0xc0000000;
2824 pub const NOTE_FFLAGSMASK: u32 = 0x00ffffff;
2825 pub const NOTE_LOWAT: u32 = 0x00000001;
2826 pub const NOTE_DELETE: u32 = 0x00000001;
2827 pub const NOTE_WRITE: u32 = 0x00000002;
2828 pub const NOTE_EXTEND: u32 = 0x00000004;
2829 pub const NOTE_ATTRIB: u32 = 0x00000008;
2830 pub const NOTE_LINK: u32 = 0x00000010;
2831 pub const NOTE_RENAME: u32 = 0x00000020;
2832 pub const NOTE_REVOKE: u32 = 0x00000040;
2833 pub const NOTE_NONE: u32 = 0x00000080;
2834 pub const NOTE_EXIT: u32 = 0x80000000;
2835 pub const NOTE_FORK: u32 = 0x40000000;
2836 pub const NOTE_EXEC: u32 = 0x20000000;
2837 #[doc(hidden)]
2838 #[deprecated(since = "0.2.49", note = "Deprecated since MacOSX 10.9")]
2839 pub const NOTE_REAP: u32 = 0x10000000;
2840 pub const NOTE_SIGNAL: u32 = 0x08000000;
2841 pub const NOTE_EXITSTATUS: u32 = 0x04000000;
2842 pub const NOTE_EXIT_DETAIL: u32 = 0x02000000;
2843 pub const NOTE_PDATAMASK: u32 = 0x000fffff;
2844 pub const NOTE_PCTRLMASK: u32 = 0xfff00000;
2845 #[doc(hidden)]
2846 #[deprecated(since = "0.2.49", note = "Deprecated since MacOSX 10.9")]
2847 pub const NOTE_EXIT_REPARENTED: u32 = 0x00080000;
2848 pub const NOTE_EXIT_DETAIL_MASK: u32 = 0x00070000;
2849 pub const NOTE_EXIT_DECRYPTFAIL: u32 = 0x00010000;
2850 pub const NOTE_EXIT_MEMORY: u32 = 0x00020000;
2851 pub const NOTE_EXIT_CSERROR: u32 = 0x00040000;
2852 pub const NOTE_VM_PRESSURE: u32 = 0x80000000;
2853 pub const NOTE_VM_PRESSURE_TERMINATE: u32 = 0x40000000;
2854 pub const NOTE_VM_PRESSURE_SUDDEN_TERMINATE: u32 = 0x20000000;
2855 pub const NOTE_VM_ERROR: u32 = 0x10000000;
2856 pub const NOTE_SECONDS: u32 = 0x00000001;
2857 pub const NOTE_USECONDS: u32 = 0x00000002;
2858 pub const NOTE_NSECONDS: u32 = 0x00000004;
2859 pub const NOTE_ABSOLUTE: u32 = 0x00000008;
2860 pub const NOTE_LEEWAY: u32 = 0x00000010;
2861 pub const NOTE_CRITICAL: u32 = 0x00000020;
2862 pub const NOTE_BACKGROUND: u32 = 0x00000040;
2863 pub const NOTE_TRACK: u32 = 0x00000001;
2864 pub const NOTE_TRACKERR: u32 = 0x00000002;
2865 pub const NOTE_CHILD: u32 = 0x00000004;
2866
2867 pub const OCRNL: ::tcflag_t = 0x00000010;
2868 pub const ONOCR: ::tcflag_t = 0x00000020;
2869 pub const ONLRET: ::tcflag_t = 0x00000040;
2870 pub const OFILL: ::tcflag_t = 0x00000080;
2871 pub const NLDLY: ::tcflag_t = 0x00000300;
2872 pub const TABDLY: ::tcflag_t = 0x00000c04;
2873 pub const CRDLY: ::tcflag_t = 0x00003000;
2874 pub const FFDLY: ::tcflag_t = 0x00004000;
2875 pub const BSDLY: ::tcflag_t = 0x00008000;
2876 pub const VTDLY: ::tcflag_t = 0x00010000;
2877 pub const OFDEL: ::tcflag_t = 0x00020000;
2878
2879 pub const NL0: ::tcflag_t = 0x00000000;
2880 pub const NL1: ::tcflag_t = 0x00000100;
2881 pub const TAB0: ::tcflag_t = 0x00000000;
2882 pub const TAB1: ::tcflag_t = 0x00000400;
2883 pub const TAB2: ::tcflag_t = 0x00000800;
2884 pub const CR0: ::tcflag_t = 0x00000000;
2885 pub const CR1: ::tcflag_t = 0x00001000;
2886 pub const CR2: ::tcflag_t = 0x00002000;
2887 pub const CR3: ::tcflag_t = 0x00003000;
2888 pub const FF0: ::tcflag_t = 0x00000000;
2889 pub const FF1: ::tcflag_t = 0x00004000;
2890 pub const BS0: ::tcflag_t = 0x00000000;
2891 pub const BS1: ::tcflag_t = 0x00008000;
2892 pub const TAB3: ::tcflag_t = 0x00000004;
2893 pub const VT0: ::tcflag_t = 0x00000000;
2894 pub const VT1: ::tcflag_t = 0x00010000;
2895 pub const IUTF8: ::tcflag_t = 0x00004000;
2896 pub const CRTSCTS: ::tcflag_t = 0x00030000;
2897
2898 pub const NI_MAXHOST: ::socklen_t = 1025;
2899 pub const NI_MAXSERV: ::socklen_t = 32;
2900 pub const NI_NOFQDN: ::c_int = 0x00000001;
2901 pub const NI_NUMERICHOST: ::c_int = 0x00000002;
2902 pub const NI_NAMEREQD: ::c_int = 0x00000004;
2903 pub const NI_NUMERICSERV: ::c_int = 0x00000008;
2904 pub const NI_NUMERICSCOPE: ::c_int = 0x00000100;
2905 pub const NI_DGRAM: ::c_int = 0x00000010;
2906
2907 pub const Q_GETQUOTA: ::c_int = 0x300;
2908 pub const Q_SETQUOTA: ::c_int = 0x400;
2909
2910 pub const RENAME_SWAP: ::c_uint = 0x00000002;
2911 pub const RENAME_EXCL: ::c_uint = 0x00000004;
2912
2913 pub const RTLD_LOCAL: ::c_int = 0x4;
2914 pub const RTLD_FIRST: ::c_int = 0x100;
2915 pub const RTLD_NODELETE: ::c_int = 0x80;
2916 pub const RTLD_NOLOAD: ::c_int = 0x10;
2917 pub const RTLD_GLOBAL: ::c_int = 0x8;
2918
2919 pub const _WSTOPPED: ::c_int = 0o177;
2920
2921 pub const LOG_NETINFO: ::c_int = 12 << 3;
2922 pub const LOG_REMOTEAUTH: ::c_int = 13 << 3;
2923 pub const LOG_INSTALL: ::c_int = 14 << 3;
2924 pub const LOG_RAS: ::c_int = 15 << 3;
2925 pub const LOG_LAUNCHD: ::c_int = 24 << 3;
2926 pub const LOG_NFACILITIES: ::c_int = 25;
2927
2928 pub const CTLTYPE: ::c_int = 0xf;
2929 pub const CTLTYPE_NODE: ::c_int = 1;
2930 pub const CTLTYPE_INT: ::c_int = 2;
2931 pub const CTLTYPE_STRING: ::c_int = 3;
2932 pub const CTLTYPE_QUAD: ::c_int = 4;
2933 pub const CTLTYPE_OPAQUE: ::c_int = 5;
2934 pub const CTLTYPE_STRUCT: ::c_int = CTLTYPE_OPAQUE;
2935 pub const CTLFLAG_RD: ::c_int = 0x80000000;
2936 pub const CTLFLAG_WR: ::c_int = 0x40000000;
2937 pub const CTLFLAG_RW: ::c_int = CTLFLAG_RD | CTLFLAG_WR;
2938 pub const CTLFLAG_NOLOCK: ::c_int = 0x20000000;
2939 pub const CTLFLAG_ANYBODY: ::c_int = 0x10000000;
2940 pub const CTLFLAG_SECURE: ::c_int = 0x08000000;
2941 pub const CTLFLAG_MASKED: ::c_int = 0x04000000;
2942 pub const CTLFLAG_NOAUTO: ::c_int = 0x02000000;
2943 pub const CTLFLAG_KERN: ::c_int = 0x01000000;
2944 pub const CTLFLAG_LOCKED: ::c_int = 0x00800000;
2945 pub const CTLFLAG_OID2: ::c_int = 0x00400000;
2946 pub const CTL_UNSPEC: ::c_int = 0;
2947 pub const CTL_KERN: ::c_int = 1;
2948 pub const CTL_VM: ::c_int = 2;
2949 pub const CTL_VFS: ::c_int = 3;
2950 pub const CTL_NET: ::c_int = 4;
2951 pub const CTL_DEBUG: ::c_int = 5;
2952 pub const CTL_HW: ::c_int = 6;
2953 pub const CTL_MACHDEP: ::c_int = 7;
2954 pub const CTL_USER: ::c_int = 8;
2955 pub const CTL_MAXID: ::c_int = 9;
2956 pub const KERN_OSTYPE: ::c_int = 1;
2957 pub const KERN_OSRELEASE: ::c_int = 2;
2958 pub const KERN_OSREV: ::c_int = 3;
2959 pub const KERN_VERSION: ::c_int = 4;
2960 pub const KERN_MAXVNODES: ::c_int = 5;
2961 pub const KERN_MAXPROC: ::c_int = 6;
2962 pub const KERN_MAXFILES: ::c_int = 7;
2963 pub const KERN_ARGMAX: ::c_int = 8;
2964 pub const KERN_SECURELVL: ::c_int = 9;
2965 pub const KERN_HOSTNAME: ::c_int = 10;
2966 pub const KERN_HOSTID: ::c_int = 11;
2967 pub const KERN_CLOCKRATE: ::c_int = 12;
2968 pub const KERN_VNODE: ::c_int = 13;
2969 pub const KERN_PROC: ::c_int = 14;
2970 pub const KERN_FILE: ::c_int = 15;
2971 pub const KERN_PROF: ::c_int = 16;
2972 pub const KERN_POSIX1: ::c_int = 17;
2973 pub const KERN_NGROUPS: ::c_int = 18;
2974 pub const KERN_JOB_CONTROL: ::c_int = 19;
2975 pub const KERN_SAVED_IDS: ::c_int = 20;
2976 pub const KERN_BOOTTIME: ::c_int = 21;
2977 pub const KERN_NISDOMAINNAME: ::c_int = 22;
2978 pub const KERN_DOMAINNAME: ::c_int = KERN_NISDOMAINNAME;
2979 pub const KERN_MAXPARTITIONS: ::c_int = 23;
2980 pub const KERN_KDEBUG: ::c_int = 24;
2981 pub const KERN_UPDATEINTERVAL: ::c_int = 25;
2982 pub const KERN_OSRELDATE: ::c_int = 26;
2983 pub const KERN_NTP_PLL: ::c_int = 27;
2984 pub const KERN_BOOTFILE: ::c_int = 28;
2985 pub const KERN_MAXFILESPERPROC: ::c_int = 29;
2986 pub const KERN_MAXPROCPERUID: ::c_int = 30;
2987 pub const KERN_DUMPDEV: ::c_int = 31;
2988 pub const KERN_IPC: ::c_int = 32;
2989 pub const KERN_DUMMY: ::c_int = 33;
2990 pub const KERN_PS_STRINGS: ::c_int = 34;
2991 pub const KERN_USRSTACK32: ::c_int = 35;
2992 pub const KERN_LOGSIGEXIT: ::c_int = 36;
2993 pub const KERN_SYMFILE: ::c_int = 37;
2994 pub const KERN_PROCARGS: ::c_int = 38;
2995 pub const KERN_NETBOOT: ::c_int = 40;
2996 pub const KERN_SYSV: ::c_int = 42;
2997 pub const KERN_AFFINITY: ::c_int = 43;
2998 pub const KERN_TRANSLATE: ::c_int = 44;
2999 pub const KERN_CLASSIC: ::c_int = KERN_TRANSLATE;
3000 pub const KERN_EXEC: ::c_int = 45;
3001 pub const KERN_CLASSICHANDLER: ::c_int = KERN_EXEC;
3002 pub const KERN_AIOMAX: ::c_int = 46;
3003 pub const KERN_AIOPROCMAX: ::c_int = 47;
3004 pub const KERN_AIOTHREADS: ::c_int = 48;
3005 pub const KERN_COREFILE: ::c_int = 50;
3006 pub const KERN_COREDUMP: ::c_int = 51;
3007 pub const KERN_SUGID_COREDUMP: ::c_int = 52;
3008 pub const KERN_PROCDELAYTERM: ::c_int = 53;
3009 pub const KERN_SHREG_PRIVATIZABLE: ::c_int = 54;
3010 pub const KERN_LOW_PRI_WINDOW: ::c_int = 56;
3011 pub const KERN_LOW_PRI_DELAY: ::c_int = 57;
3012 pub const KERN_POSIX: ::c_int = 58;
3013 pub const KERN_USRSTACK64: ::c_int = 59;
3014 pub const KERN_NX_PROTECTION: ::c_int = 60;
3015 pub const KERN_TFP: ::c_int = 61;
3016 pub const KERN_PROCNAME: ::c_int = 62;
3017 pub const KERN_THALTSTACK: ::c_int = 63;
3018 pub const KERN_SPECULATIVE_READS: ::c_int = 64;
3019 pub const KERN_OSVERSION: ::c_int = 65;
3020 pub const KERN_SAFEBOOT: ::c_int = 66;
3021 pub const KERN_RAGEVNODE: ::c_int = 68;
3022 pub const KERN_TTY: ::c_int = 69;
3023 pub const KERN_CHECKOPENEVT: ::c_int = 70;
3024 pub const KERN_THREADNAME: ::c_int = 71;
3025 pub const KERN_MAXID: ::c_int = 72;
3026 pub const KERN_RAGE_PROC: ::c_int = 1;
3027 pub const KERN_RAGE_THREAD: ::c_int = 2;
3028 pub const KERN_UNRAGE_PROC: ::c_int = 3;
3029 pub const KERN_UNRAGE_THREAD: ::c_int = 4;
3030 pub const KERN_OPENEVT_PROC: ::c_int = 1;
3031 pub const KERN_UNOPENEVT_PROC: ::c_int = 2;
3032 pub const KERN_TFP_POLICY: ::c_int = 1;
3033 pub const KERN_TFP_POLICY_DENY: ::c_int = 0;
3034 pub const KERN_TFP_POLICY_DEFAULT: ::c_int = 2;
3035 pub const KERN_KDEFLAGS: ::c_int = 1;
3036 pub const KERN_KDDFLAGS: ::c_int = 2;
3037 pub const KERN_KDENABLE: ::c_int = 3;
3038 pub const KERN_KDSETBUF: ::c_int = 4;
3039 pub const KERN_KDGETBUF: ::c_int = 5;
3040 pub const KERN_KDSETUP: ::c_int = 6;
3041 pub const KERN_KDREMOVE: ::c_int = 7;
3042 pub const KERN_KDSETREG: ::c_int = 8;
3043 pub const KERN_KDGETREG: ::c_int = 9;
3044 pub const KERN_KDREADTR: ::c_int = 10;
3045 pub const KERN_KDPIDTR: ::c_int = 11;
3046 pub const KERN_KDTHRMAP: ::c_int = 12;
3047 pub const KERN_KDPIDEX: ::c_int = 14;
3048 pub const KERN_KDSETRTCDEC: ::c_int = 15;
3049 pub const KERN_KDGETENTROPY: ::c_int = 16;
3050 pub const KERN_KDWRITETR: ::c_int = 17;
3051 pub const KERN_KDWRITEMAP: ::c_int = 18;
3052 #[doc(hidden)]
3053 #[deprecated(since = "0.2.49", note = "Removed in MacOSX 10.12")]
3054 pub const KERN_KDENABLE_BG_TRACE: ::c_int = 19;
3055 #[doc(hidden)]
3056 #[deprecated(since = "0.2.49", note = "Removed in MacOSX 10.12")]
3057 pub const KERN_KDDISABLE_BG_TRACE: ::c_int = 20;
3058 pub const KERN_KDREADCURTHRMAP: ::c_int = 21;
3059 pub const KERN_KDSET_TYPEFILTER: ::c_int = 22;
3060 pub const KERN_KDBUFWAIT: ::c_int = 23;
3061 pub const KERN_KDCPUMAP: ::c_int = 24;
3062 pub const KERN_PROC_ALL: ::c_int = 0;
3063 pub const KERN_PROC_PID: ::c_int = 1;
3064 pub const KERN_PROC_PGRP: ::c_int = 2;
3065 pub const KERN_PROC_SESSION: ::c_int = 3;
3066 pub const KERN_PROC_TTY: ::c_int = 4;
3067 pub const KERN_PROC_UID: ::c_int = 5;
3068 pub const KERN_PROC_RUID: ::c_int = 6;
3069 pub const KERN_PROC_LCID: ::c_int = 7;
3070 pub const KERN_SUCCESS: ::c_int = 0;
3071 pub const KERN_INVALID_ADDRESS: ::c_int = 1;
3072 pub const KERN_PROTECTION_FAILURE: ::c_int = 2;
3073 pub const KERN_NO_SPACE: ::c_int = 3;
3074 pub const KERN_INVALID_ARGUMENT: ::c_int = 4;
3075 pub const KERN_FAILURE: ::c_int = 5;
3076 pub const KERN_RESOURCE_SHORTAGE: ::c_int = 6;
3077 pub const KERN_NOT_RECEIVER: ::c_int = 7;
3078 pub const KERN_NO_ACCESS: ::c_int = 8;
3079 pub const KERN_MEMORY_FAILURE: ::c_int = 9;
3080 pub const KERN_MEMORY_ERROR: ::c_int = 10;
3081 pub const KERN_ALREADY_IN_SET: ::c_int = 11;
3082 pub const KERN_NOT_IN_SET: ::c_int = 12;
3083 pub const KERN_NAME_EXISTS: ::c_int = 13;
3084 pub const KERN_ABORTED: ::c_int = 14;
3085 pub const KERN_INVALID_NAME: ::c_int = 15;
3086 pub const KERN_INVALID_TASK: ::c_int = 16;
3087 pub const KERN_INVALID_RIGHT: ::c_int = 17;
3088 pub const KERN_INVALID_VALUE: ::c_int = 18;
3089 pub const KERN_UREFS_OVERFLOW: ::c_int = 19;
3090 pub const KERN_INVALID_CAPABILITY: ::c_int = 20;
3091 pub const KERN_RIGHT_EXISTS: ::c_int = 21;
3092 pub const KERN_INVALID_HOST: ::c_int = 22;
3093 pub const KERN_MEMORY_PRESENT: ::c_int = 23;
3094 pub const KERN_MEMORY_DATA_MOVED: ::c_int = 24;
3095 pub const KERN_MEMORY_RESTART_COPY: ::c_int = 25;
3096 pub const KERN_INVALID_PROCESSOR_SET: ::c_int = 26;
3097 pub const KERN_POLICY_LIMIT: ::c_int = 27;
3098 pub const KERN_INVALID_POLICY: ::c_int = 28;
3099 pub const KERN_INVALID_OBJECT: ::c_int = 29;
3100 pub const KERN_ALREADY_WAITING: ::c_int = 30;
3101 pub const KERN_DEFAULT_SET: ::c_int = 31;
3102 pub const KERN_EXCEPTION_PROTECTED: ::c_int = 32;
3103 pub const KERN_INVALID_LEDGER: ::c_int = 33;
3104 pub const KERN_INVALID_MEMORY_CONTROL: ::c_int = 34;
3105 pub const KERN_INVALID_SECURITY: ::c_int = 35;
3106 pub const KERN_NOT_DEPRESSED: ::c_int = 36;
3107 pub const KERN_TERMINATED: ::c_int = 37;
3108 pub const KERN_LOCK_SET_DESTROYED: ::c_int = 38;
3109 pub const KERN_LOCK_UNSTABLE: ::c_int = 39;
3110 pub const KERN_LOCK_OWNED: ::c_int = 40;
3111 pub const KERN_LOCK_OWNED_SELF: ::c_int = 41;
3112 pub const KERN_SEMAPHORE_DESTROYED: ::c_int = 42;
3113 pub const KERN_RPC_SERVER_TERMINATED: ::c_int = 43;
3114 pub const KERN_RPC_TERMINATE_ORPHAN: ::c_int = 44;
3115 pub const KERN_RPC_CONTINUE_ORPHAN: ::c_int = 45;
3116 pub const KERN_NOT_SUPPORTED: ::c_int = 46;
3117 pub const KERN_NODE_DOWN: ::c_int = 47;
3118 pub const KERN_NOT_WAITING: ::c_int = 48;
3119 pub const KERN_OPERATION_TIMED_OUT: ::c_int = 49;
3120 pub const KERN_CODESIGN_ERROR: ::c_int = 50;
3121 pub const KERN_POLICY_STATIC: ::c_int = 51;
3122 pub const KERN_INSUFFICIENT_BUFFER_SIZE: ::c_int = 52;
3123 pub const KIPC_MAXSOCKBUF: ::c_int = 1;
3124 pub const KIPC_SOCKBUF_WASTE: ::c_int = 2;
3125 pub const KIPC_SOMAXCONN: ::c_int = 3;
3126 pub const KIPC_MAX_LINKHDR: ::c_int = 4;
3127 pub const KIPC_MAX_PROTOHDR: ::c_int = 5;
3128 pub const KIPC_MAX_HDR: ::c_int = 6;
3129 pub const KIPC_MAX_DATALEN: ::c_int = 7;
3130 pub const KIPC_MBSTAT: ::c_int = 8;
3131 pub const KIPC_NMBCLUSTERS: ::c_int = 9;
3132 pub const KIPC_SOQLIMITCOMPAT: ::c_int = 10;
3133 pub const VM_METER: ::c_int = 1;
3134 pub const VM_LOADAVG: ::c_int = 2;
3135 pub const VM_MACHFACTOR: ::c_int = 4;
3136 pub const VM_SWAPUSAGE: ::c_int = 5;
3137 pub const VM_MAXID: ::c_int = 6;
3138 pub const HW_MACHINE: ::c_int = 1;
3139 pub const HW_MODEL: ::c_int = 2;
3140 pub const HW_NCPU: ::c_int = 3;
3141 pub const HW_BYTEORDER: ::c_int = 4;
3142 pub const HW_PHYSMEM: ::c_int = 5;
3143 pub const HW_USERMEM: ::c_int = 6;
3144 pub const HW_PAGESIZE: ::c_int = 7;
3145 pub const HW_DISKNAMES: ::c_int = 8;
3146 pub const HW_DISKSTATS: ::c_int = 9;
3147 pub const HW_EPOCH: ::c_int = 10;
3148 pub const HW_FLOATINGPT: ::c_int = 11;
3149 pub const HW_MACHINE_ARCH: ::c_int = 12;
3150 pub const HW_VECTORUNIT: ::c_int = 13;
3151 pub const HW_BUS_FREQ: ::c_int = 14;
3152 pub const HW_CPU_FREQ: ::c_int = 15;
3153 pub const HW_CACHELINE: ::c_int = 16;
3154 pub const HW_L1ICACHESIZE: ::c_int = 17;
3155 pub const HW_L1DCACHESIZE: ::c_int = 18;
3156 pub const HW_L2SETTINGS: ::c_int = 19;
3157 pub const HW_L2CACHESIZE: ::c_int = 20;
3158 pub const HW_L3SETTINGS: ::c_int = 21;
3159 pub const HW_L3CACHESIZE: ::c_int = 22;
3160 pub const HW_TB_FREQ: ::c_int = 23;
3161 pub const HW_MEMSIZE: ::c_int = 24;
3162 pub const HW_AVAILCPU: ::c_int = 25;
3163 pub const HW_TARGET: ::c_int = 26;
3164 pub const HW_PRODUCT: ::c_int = 27;
3165 pub const HW_MAXID: ::c_int = 28;
3166 pub const USER_CS_PATH: ::c_int = 1;
3167 pub const USER_BC_BASE_MAX: ::c_int = 2;
3168 pub const USER_BC_DIM_MAX: ::c_int = 3;
3169 pub const USER_BC_SCALE_MAX: ::c_int = 4;
3170 pub const USER_BC_STRING_MAX: ::c_int = 5;
3171 pub const USER_COLL_WEIGHTS_MAX: ::c_int = 6;
3172 pub const USER_EXPR_NEST_MAX: ::c_int = 7;
3173 pub const USER_LINE_MAX: ::c_int = 8;
3174 pub const USER_RE_DUP_MAX: ::c_int = 9;
3175 pub const USER_POSIX2_VERSION: ::c_int = 10;
3176 pub const USER_POSIX2_C_BIND: ::c_int = 11;
3177 pub const USER_POSIX2_C_DEV: ::c_int = 12;
3178 pub const USER_POSIX2_CHAR_TERM: ::c_int = 13;
3179 pub const USER_POSIX2_FORT_DEV: ::c_int = 14;
3180 pub const USER_POSIX2_FORT_RUN: ::c_int = 15;
3181 pub const USER_POSIX2_LOCALEDEF: ::c_int = 16;
3182 pub const USER_POSIX2_SW_DEV: ::c_int = 17;
3183 pub const USER_POSIX2_UPE: ::c_int = 18;
3184 pub const USER_STREAM_MAX: ::c_int = 19;
3185 pub const USER_TZNAME_MAX: ::c_int = 20;
3186 pub const USER_MAXID: ::c_int = 21;
3187 pub const CTL_DEBUG_NAME: ::c_int = 0;
3188 pub const CTL_DEBUG_VALUE: ::c_int = 1;
3189 pub const CTL_DEBUG_MAXID: ::c_int = 20;
3190
3191 pub const PRIO_DARWIN_THREAD: ::c_int = 3;
3192 pub const PRIO_DARWIN_PROCESS: ::c_int = 4;
3193 pub const PRIO_DARWIN_BG: ::c_int = 0x1000;
3194 pub const PRIO_DARWIN_NONUI: ::c_int = 0x1001;
3195
3196 pub const SEM_FAILED: *mut sem_t = -1isize as *mut ::sem_t;
3197
3198 pub const AI_PASSIVE: ::c_int = 0x00000001;
3199 pub const AI_CANONNAME: ::c_int = 0x00000002;
3200 pub const AI_NUMERICHOST: ::c_int = 0x00000004;
3201 pub const AI_NUMERICSERV: ::c_int = 0x00001000;
3202 pub const AI_MASK: ::c_int =
3203 AI_PASSIVE | AI_CANONNAME | AI_NUMERICHOST | AI_NUMERICSERV | AI_ADDRCONFIG;
3204 pub const AI_ALL: ::c_int = 0x00000100;
3205 pub const AI_V4MAPPED_CFG: ::c_int = 0x00000200;
3206 pub const AI_ADDRCONFIG: ::c_int = 0x00000400;
3207 pub const AI_V4MAPPED: ::c_int = 0x00000800;
3208 pub const AI_DEFAULT: ::c_int = AI_V4MAPPED_CFG | AI_ADDRCONFIG;
3209 pub const AI_UNUSABLE: ::c_int = 0x10000000;
3210
3211 pub const SIGEV_NONE: ::c_int = 0;
3212 pub const SIGEV_SIGNAL: ::c_int = 1;
3213 pub const SIGEV_THREAD: ::c_int = 3;
3214
3215 pub const AIO_CANCELED: ::c_int = 2;
3216 pub const AIO_NOTCANCELED: ::c_int = 4;
3217 pub const AIO_ALLDONE: ::c_int = 1;
3218 #[deprecated(
3219 since = "0.2.64",
3220 note = "Can vary at runtime. Use sysconf(3) instead"
3221 )]
3222 pub const AIO_LISTIO_MAX: ::c_int = 16;
3223 pub const LIO_NOP: ::c_int = 0;
3224 pub const LIO_WRITE: ::c_int = 2;
3225 pub const LIO_READ: ::c_int = 1;
3226 pub const LIO_WAIT: ::c_int = 2;
3227 pub const LIO_NOWAIT: ::c_int = 1;
3228
3229 pub const WEXITED: ::c_int = 0x00000004;
3230 pub const WSTOPPED: ::c_int = 0x00000008;
3231 pub const WCONTINUED: ::c_int = 0x00000010;
3232 pub const WNOWAIT: ::c_int = 0x00000020;
3233
3234 pub const P_ALL: idtype_t = 0;
3235 pub const P_PID: idtype_t = 1;
3236 pub const P_PGID: idtype_t = 2;
3237
3238 pub const UTIME_OMIT: c_long = -2;
3239 pub const UTIME_NOW: c_long = -1;
3240
3241 pub const XATTR_NOFOLLOW: ::c_int = 0x0001;
3242 pub const XATTR_CREATE: ::c_int = 0x0002;
3243 pub const XATTR_REPLACE: ::c_int = 0x0004;
3244 pub const XATTR_NOSECURITY: ::c_int = 0x0008;
3245 pub const XATTR_NODEFAULT: ::c_int = 0x0010;
3246 pub const XATTR_SHOWCOMPRESSION: ::c_int = 0x0020;
3247
3248 pub const NET_RT_IFLIST2: ::c_int = 0x0006;
3249
3250 // net/route.h
3251 pub const RTF_UP: ::c_int = 0x1;
3252 pub const RTF_GATEWAY: ::c_int = 0x2;
3253 pub const RTF_HOST: ::c_int = 0x4;
3254 pub const RTF_REJECT: ::c_int = 0x8;
3255 pub const RTF_DYNAMIC: ::c_int = 0x10;
3256 pub const RTF_MODIFIED: ::c_int = 0x20;
3257 pub const RTF_DONE: ::c_int = 0x40;
3258 pub const RTF_DELCLONE: ::c_int = 0x80;
3259 pub const RTF_CLONING: ::c_int = 0x100;
3260 pub const RTF_XRESOLVE: ::c_int = 0x200;
3261 pub const RTF_LLINFO: ::c_int = 0x400;
3262 pub const RTF_STATIC: ::c_int = 0x800;
3263 pub const RTF_BLACKHOLE: ::c_int = 0x1000;
3264 pub const RTF_NOIFREF: ::c_int = 0x2000;
3265 pub const RTF_PROTO2: ::c_int = 0x4000;
3266 pub const RTF_PROTO1: ::c_int = 0x8000;
3267 pub const RTF_PRCLONING: ::c_int = 0x10000;
3268 pub const RTF_WASCLONED: ::c_int = 0x20000;
3269 pub const RTF_PROTO3: ::c_int = 0x40000;
3270 pub const RTF_PINNED: ::c_int = 0x100000;
3271 pub const RTF_LOCAL: ::c_int = 0x200000;
3272 pub const RTF_BROADCAST: ::c_int = 0x400000;
3273 pub const RTF_MULTICAST: ::c_int = 0x800000;
3274 pub const RTF_IFSCOPE: ::c_int = 0x1000000;
3275 pub const RTF_CONDEMNED: ::c_int = 0x2000000;
3276 pub const RTF_IFREF: ::c_int = 0x4000000;
3277 pub const RTF_PROXY: ::c_int = 0x8000000;
3278 pub const RTF_ROUTER: ::c_int = 0x10000000;
3279
3280 pub const RTM_VERSION: ::c_int = 5;
3281
3282 // Message types
3283 pub const RTM_ADD: ::c_int = 0x1;
3284 pub const RTM_DELETE: ::c_int = 0x2;
3285 pub const RTM_CHANGE: ::c_int = 0x3;
3286 pub const RTM_GET: ::c_int = 0x4;
3287 pub const RTM_LOSING: ::c_int = 0x5;
3288 pub const RTM_REDIRECT: ::c_int = 0x6;
3289 pub const RTM_MISS: ::c_int = 0x7;
3290 pub const RTM_LOCK: ::c_int = 0x8;
3291 pub const RTM_OLDADD: ::c_int = 0x9;
3292 pub const RTM_OLDDEL: ::c_int = 0xa;
3293 pub const RTM_RESOLVE: ::c_int = 0xb;
3294 pub const RTM_NEWADDR: ::c_int = 0xc;
3295 pub const RTM_DELADDR: ::c_int = 0xd;
3296 pub const RTM_IFINFO: ::c_int = 0xe;
3297 pub const RTM_NEWMADDR: ::c_int = 0xf;
3298 pub const RTM_DELMADDR: ::c_int = 0x10;
3299 pub const RTM_IFINFO2: ::c_int = 0x12;
3300 pub const RTM_NEWMADDR2: ::c_int = 0x13;
3301 pub const RTM_GET2: ::c_int = 0x14;
3302
3303 // Bitmask values for rtm_inits and rmx_locks.
3304 pub const RTV_MTU: ::c_int = 0x1;
3305 pub const RTV_HOPCOUNT: ::c_int = 0x2;
3306 pub const RTV_EXPIRE: ::c_int = 0x4;
3307 pub const RTV_RPIPE: ::c_int = 0x8;
3308 pub const RTV_SPIPE: ::c_int = 0x10;
3309 pub const RTV_SSTHRESH: ::c_int = 0x20;
3310 pub const RTV_RTT: ::c_int = 0x40;
3311 pub const RTV_RTTVAR: ::c_int = 0x80;
3312
3313 // Bitmask values for rtm_addrs.
3314 pub const RTA_DST: ::c_int = 0x1;
3315 pub const RTA_GATEWAY: ::c_int = 0x2;
3316 pub const RTA_NETMASK: ::c_int = 0x4;
3317 pub const RTA_GENMASK: ::c_int = 0x8;
3318 pub const RTA_IFP: ::c_int = 0x10;
3319 pub const RTA_IFA: ::c_int = 0x20;
3320 pub const RTA_AUTHOR: ::c_int = 0x40;
3321 pub const RTA_BRD: ::c_int = 0x80;
3322
3323 // Index offsets for sockaddr array for alternate internal encoding.
3324 pub const RTAX_DST: ::c_int = 0;
3325 pub const RTAX_GATEWAY: ::c_int = 1;
3326 pub const RTAX_NETMASK: ::c_int = 2;
3327 pub const RTAX_GENMASK: ::c_int = 3;
3328 pub const RTAX_IFP: ::c_int = 4;
3329 pub const RTAX_IFA: ::c_int = 5;
3330 pub const RTAX_AUTHOR: ::c_int = 6;
3331 pub const RTAX_BRD: ::c_int = 7;
3332 pub const RTAX_MAX: ::c_int = 8;
3333
3334 pub const KERN_PROCARGS2: ::c_int = 49;
3335
3336 pub const PROC_PIDTASKALLINFO: ::c_int = 2;
3337 pub const PROC_PIDTASKINFO: ::c_int = 4;
3338 pub const PROC_PIDTHREADINFO: ::c_int = 5;
3339 pub const MAXCOMLEN: usize = 16;
3340 pub const MAXTHREADNAMESIZE: usize = 64;
3341
3342 pub const XUCRED_VERSION: ::c_uint = 0;
3343
3344 pub const LC_SEGMENT: u32 = 0x1;
3345 pub const LC_SEGMENT_64: u32 = 0x19;
3346
3347 pub const MH_MAGIC: u32 = 0xfeedface;
3348 pub const MH_MAGIC_64: u32 = 0xfeedfacf;
3349
3350 // net/if_utun.h
3351 pub const UTUN_OPT_FLAGS: ::c_int = 1;
3352 pub const UTUN_OPT_IFNAME: ::c_int = 2;
3353
3354 // net/bpf.h
3355 pub const DLT_NULL: ::c_uint = 0; // no link-layer encapsulation
3356 pub const DLT_EN10MB: ::c_uint = 1; // Ethernet (10Mb)
3357 pub const DLT_EN3MB: ::c_uint = 2; // Experimental Ethernet (3Mb)
3358 pub const DLT_AX25: ::c_uint = 3; // Amateur Radio AX.25
3359 pub const DLT_PRONET: ::c_uint = 4; // Proteon ProNET Token Ring
3360 pub const DLT_CHAOS: ::c_uint = 5; // Chaos
3361 pub const DLT_IEEE802: ::c_uint = 6; // IEEE 802 Networks
3362 pub const DLT_ARCNET: ::c_uint = 7; // ARCNET
3363 pub const DLT_SLIP: ::c_uint = 8; // Serial Line IP
3364 pub const DLT_PPP: ::c_uint = 9; // Point-to-point Protocol
3365 pub const DLT_FDDI: ::c_uint = 10; // FDDI
3366 pub const DLT_ATM_RFC1483: ::c_uint = 11; // LLC/SNAP encapsulated atm
3367 pub const DLT_RAW: ::c_uint = 12; // raw IP
3368 pub const DLT_LOOP: ::c_uint = 108;
3369
3370 // https://github.com/apple/darwin-xnu/blob/master/bsd/net/bpf.h#L100
3371 // sizeof(i32)
3372 pub const BPF_ALIGNMENT: ::c_int = 4;
3373
3374 // sys/mount.h
3375 pub const MNT_NODEV: ::c_int = 0x00000010;
3376 pub const MNT_UNION: ::c_int = 0x00000020;
3377 pub const MNT_CPROTECT: ::c_int = 0x00000080;
3378
3379 // MAC labeled / "quarantined" flag
3380 pub const MNT_QUARANTINE: ::c_int = 0x00000400;
3381
3382 // Flags set by internal operations.
3383 pub const MNT_LOCAL: ::c_int = 0x00001000;
3384 pub const MNT_QUOTA: ::c_int = 0x00002000;
3385 pub const MNT_ROOTFS: ::c_int = 0x00004000;
3386 pub const MNT_DOVOLFS: ::c_int = 0x00008000;
3387
3388 pub const MNT_DONTBROWSE: ::c_int = 0x00100000;
3389 pub const MNT_IGNORE_OWNERSHIP: ::c_int = 0x00200000;
3390 pub const MNT_AUTOMOUNTED: ::c_int = 0x00400000;
3391 pub const MNT_JOURNALED: ::c_int = 0x00800000;
3392 pub const MNT_NOUSERXATTR: ::c_int = 0x01000000;
3393 pub const MNT_DEFWRITE: ::c_int = 0x02000000;
3394 pub const MNT_MULTILABEL: ::c_int = 0x04000000;
3395 pub const MNT_NOATIME: ::c_int = 0x10000000;
3396 pub const MNT_SNAPSHOT: ::c_int = 0x40000000;
3397
3398 // External filesystem command modifier flags.
3399 pub const MNT_NOBLOCK: ::c_int = 0x00020000;
3400
3401 // sys/spawn.h:
3402 pub const POSIX_SPAWN_RESETIDS: ::c_int = 0x01;
3403 pub const POSIX_SPAWN_SETPGROUP: ::c_int = 0x02;
3404 pub const POSIX_SPAWN_SETSIGDEF: ::c_int = 0x04;
3405 pub const POSIX_SPAWN_SETSIGMASK: ::c_int = 0x08;
3406 pub const POSIX_SPAWN_SETEXEC: ::c_int = 0x40;
3407 pub const POSIX_SPAWN_START_SUSPENDED: ::c_int = 0x80;
3408 pub const POSIX_SPAWN_CLOEXEC_DEFAULT: ::c_int = 0x4000;
3409
3410 // sys/ipc.h:
3411 pub const IPC_CREAT: ::c_int = 0x200;
3412 pub const IPC_EXCL: ::c_int = 0x400;
3413 pub const IPC_NOWAIT: ::c_int = 0x800;
3414 pub const IPC_PRIVATE: key_t = 0;
3415
3416 pub const IPC_RMID: ::c_int = 0;
3417 pub const IPC_SET: ::c_int = 1;
3418 pub const IPC_STAT: ::c_int = 2;
3419
3420 pub const IPC_R: ::c_int = 0x100;
3421 pub const IPC_W: ::c_int = 0x80;
3422 pub const IPC_M: ::c_int = 0x1000;
3423
3424 // sys/sem.h
3425 pub const SEM_UNDO: ::c_int = 0o10000;
3426
3427 pub const GETNCNT: ::c_int = 3;
3428 pub const GETPID: ::c_int = 4;
3429 pub const GETVAL: ::c_int = 5;
3430 pub const GETALL: ::c_int = 6;
3431 pub const GETZCNT: ::c_int = 7;
3432 pub const SETVAL: ::c_int = 8;
3433 pub const SETALL: ::c_int = 9;
3434
3435 // sys/shm.h
3436 pub const SHM_RDONLY: ::c_int = 0x1000;
3437 pub const SHM_RND: ::c_int = 0x2000;
3438 #[cfg(target_arch = "aarch64")]
3439 pub const SHMLBA: ::c_int = 16 * 1024;
3440 #[cfg(not(target_arch = "aarch64"))]
3441 pub const SHMLBA: ::c_int = 4096;
3442 pub const SHM_R: ::c_int = IPC_R;
3443 pub const SHM_W: ::c_int = IPC_W;
3444
3445 // Flags for chflags(2)
3446 pub const UF_SETTABLE: ::c_uint = 0x0000ffff;
3447 pub const UF_NODUMP: ::c_uint = 0x00000001;
3448 pub const UF_IMMUTABLE: ::c_uint = 0x00000002;
3449 pub const UF_APPEND: ::c_uint = 0x00000004;
3450 pub const UF_OPAQUE: ::c_uint = 0x00000008;
3451 pub const UF_COMPRESSED: ::c_uint = 0x00000020;
3452 pub const UF_TRACKED: ::c_uint = 0x00000040;
3453 pub const SF_SETTABLE: ::c_uint = 0xffff0000;
3454 pub const SF_ARCHIVED: ::c_uint = 0x00010000;
3455 pub const SF_IMMUTABLE: ::c_uint = 0x00020000;
3456 pub const SF_APPEND: ::c_uint = 0x00040000;
3457 pub const UF_HIDDEN: ::c_uint = 0x00008000;
3458
3459 //<sys/timex.h>
3460 pub const NTP_API: ::c_int = 4;
3461 pub const MAXPHASE: ::c_long = 500000000;
3462 pub const MAXFREQ: ::c_long = 500000;
3463 pub const MINSEC: ::c_int = 256;
3464 pub const MAXSEC: ::c_int = 2048;
3465 pub const NANOSECOND: ::c_long = 1000000000;
3466 pub const SCALE_PPM: ::c_int = 65;
3467 pub const MAXTC: ::c_int = 10;
3468 pub const MOD_OFFSET: ::c_uint = 0x0001;
3469 pub const MOD_FREQUENCY: ::c_uint = 0x0002;
3470 pub const MOD_MAXERROR: ::c_uint = 0x0004;
3471 pub const MOD_ESTERROR: ::c_uint = 0x0008;
3472 pub const MOD_STATUS: ::c_uint = 0x0010;
3473 pub const MOD_TIMECONST: ::c_uint = 0x0020;
3474 pub const MOD_PPSMAX: ::c_uint = 0x0040;
3475 pub const MOD_TAI: ::c_uint = 0x0080;
3476 pub const MOD_MICRO: ::c_uint = 0x1000;
3477 pub const MOD_NANO: ::c_uint = 0x2000;
3478 pub const MOD_CLKB: ::c_uint = 0x4000;
3479 pub const MOD_CLKA: ::c_uint = 0x8000;
3480 pub const STA_PLL: ::c_int = 0x0001;
3481 pub const STA_PPSFREQ: ::c_int = 0x0002;
3482 pub const STA_PPSTIME: ::c_int = 0x0004;
3483 pub const STA_FLL: ::c_int = 0x0008;
3484 pub const STA_INS: ::c_int = 0x0010;
3485 pub const STA_DEL: ::c_int = 0x0020;
3486 pub const STA_UNSYNC: ::c_int = 0x0040;
3487 pub const STA_FREQHOLD: ::c_int = 0x0080;
3488 pub const STA_PPSSIGNAL: ::c_int = 0x0100;
3489 pub const STA_PPSJITTER: ::c_int = 0x0200;
3490 pub const STA_PPSWANDER: ::c_int = 0x0400;
3491 pub const STA_PPSERROR: ::c_int = 0x0800;
3492 pub const STA_CLOCKERR: ::c_int = 0x1000;
3493 pub const STA_NANO: ::c_int = 0x2000;
3494 pub const STA_MODE: ::c_int = 0x4000;
3495 pub const STA_CLK: ::c_int = 0x8000;
3496 pub const STA_RONLY: ::c_int = STA_PPSSIGNAL
3497 | STA_PPSJITTER
3498 | STA_PPSWANDER
3499 | STA_PPSERROR
3500 | STA_CLOCKERR
3501 | STA_NANO
3502 | STA_MODE
3503 | STA_CLK;
3504 pub const TIME_OK: ::c_int = 0;
3505 pub const TIME_INS: ::c_int = 1;
3506 pub const TIME_DEL: ::c_int = 2;
3507 pub const TIME_OOP: ::c_int = 3;
3508 pub const TIME_WAIT: ::c_int = 4;
3509 pub const TIME_ERROR: ::c_int = 5;
3510
3511 // <sys/mount.h>
3512 pub const MNT_WAIT: ::c_int = 1;
3513 pub const MNT_NOWAIT: ::c_int = 2;
3514
3515 // <mach/thread_policy.h>
3516 pub const THREAD_STANDARD_POLICY: ::c_int = 1;
3517 pub const THREAD_STANDARD_POLICY_COUNT: ::c_int = 0;
3518 pub const THREAD_EXTENDED_POLICY: ::c_int = 1;
3519 pub const THREAD_TIME_CONSTRAINT_POLICY: ::c_int = 2;
3520 pub const THREAD_PRECEDENCE_POLICY: ::c_int = 3;
3521 pub const THREAD_AFFINITY_POLICY: ::c_int = 4;
3522 pub const THREAD_AFFINITY_TAG_NULL: ::c_int = 0;
3523 pub const THREAD_BACKGROUND_POLICY: ::c_int = 5;
3524 pub const THREAD_BACKGROUND_POLICY_DARWIN_BG: ::c_int = 0x1000;
3525 pub const THREAD_LATENCY_QOS_POLICY: ::c_int = 7;
3526 pub const THREAD_THROUGHPUT_QOS_POLICY: ::c_int = 8;
3527
3528 // CommonCrypto/CommonCryptoError.h
3529 pub const kCCSuccess: i32 = 0;
3530 pub const kCCParamError: i32 = -4300;
3531 pub const kCCBufferTooSmall: i32 = -4301;
3532 pub const kCCMemoryFailure: i32 = -4302;
3533 pub const kCCAlignmentError: i32 = -4303;
3534 pub const kCCDecodeError: i32 = -4304;
3535 pub const kCCUnimplemented: i32 = -4305;
3536 pub const kCCOverflow: i32 = -4306;
3537 pub const kCCRNGFailure: i32 = -4307;
3538 pub const kCCUnspecifiedError: i32 = -4308;
3539 pub const kCCCallSequenceError: i32 = -4309;
3540 pub const kCCKeySizeError: i32 = -4310;
3541 pub const kCCInvalidKey: i32 = -4311;
3542
3543 cfg_if! {
3544 if #[cfg(libc_const_extern_fn)] {
3545 const fn __DARWIN_ALIGN32(p: usize) -> usize {
3546 const __DARWIN_ALIGNBYTES32: usize = ::mem::size_of::<u32>() - 1;
3547 p + __DARWIN_ALIGNBYTES32 & !__DARWIN_ALIGNBYTES32
3548 }
3549 } else if #[cfg(libc_const_size_of)] {
3550 fn __DARWIN_ALIGN32(p: usize) -> usize {
3551 const __DARWIN_ALIGNBYTES32: usize = ::mem::size_of::<u32>() - 1;
3552 p + __DARWIN_ALIGNBYTES32 & !__DARWIN_ALIGNBYTES32
3553 }
3554 pub const THREAD_EXTENDED_POLICY_COUNT: mach_msg_type_number_t =
3555 (::mem::size_of::<thread_extended_policy_data_t>() / ::mem::size_of::<integer_t>())
3556 as mach_msg_type_number_t;
3557 pub const THREAD_TIME_CONSTRAINT_POLICY_COUNT: mach_msg_type_number_t =
3558 (::mem::size_of::<thread_time_constraint_policy_data_t>() /
3559 ::mem::size_of::<integer_t>()) as mach_msg_type_number_t;
3560 pub const THREAD_PRECEDENCE_POLICY_COUNT: mach_msg_type_number_t =
3561 (::mem::size_of::<thread_precedence_policy_data_t>() / ::mem::size_of::<integer_t>())
3562 as mach_msg_type_number_t;
3563 pub const THREAD_AFFINITY_POLICY_COUNT: mach_msg_type_number_t =
3564 (::mem::size_of::<thread_affinity_policy_data_t>() / ::mem::size_of::<integer_t>())
3565 as mach_msg_type_number_t;
3566 pub const THREAD_BACKGROUND_POLICY_COUNT: mach_msg_type_number_t =
3567 (::mem::size_of::<thread_background_policy_data_t>() / ::mem::size_of::<integer_t>())
3568 as mach_msg_type_number_t;
3569 pub const THREAD_LATENCY_QOS_POLICY_COUNT: mach_msg_type_number_t =
3570 (::mem::size_of::<thread_latency_qos_policy_data_t>() / ::mem::size_of::<integer_t>())
3571 as mach_msg_type_number_t;
3572 pub const THREAD_THROUGHPUT_QOS_POLICY_COUNT: mach_msg_type_number_t =
3573 (::mem::size_of::<thread_throughput_qos_policy_data_t>() /
3574 ::mem::size_of::<integer_t>()) as mach_msg_type_number_t;
3575 } else {
3576 fn __DARWIN_ALIGN32(p: usize) -> usize {
3577 let __DARWIN_ALIGNBYTES32: usize = ::mem::size_of::<u32>() - 1;
3578 p + __DARWIN_ALIGNBYTES32 & !__DARWIN_ALIGNBYTES32
3579 }
3580 pub const THREAD_EXTENDED_POLICY_COUNT: mach_msg_type_number_t = 1;
3581 pub const THREAD_TIME_CONSTRAINT_POLICY_COUNT: mach_msg_type_number_t = 4;
3582 pub const THREAD_PRECEDENCE_POLICY_COUNT: mach_msg_type_number_t = 1;
3583 pub const THREAD_AFFINITY_POLICY_COUNT: mach_msg_type_number_t = 1;
3584 pub const THREAD_BACKGROUND_POLICY_COUNT: mach_msg_type_number_t = 1;
3585 pub const THREAD_LATENCY_QOS_POLICY_COUNT: mach_msg_type_number_t = 1;
3586 pub const THREAD_THROUGHPUT_QOS_POLICY_COUNT: mach_msg_type_number_t = 1;
3587 }
3588 }
3589
3590 f! {
3591 pub fn CMSG_NXTHDR(mhdr: *const ::msghdr,
3592 cmsg: *const ::cmsghdr) -> *mut ::cmsghdr {
3593 if cmsg.is_null() {
3594 return ::CMSG_FIRSTHDR(mhdr);
3595 };
3596 let cmsg_len = (*cmsg).cmsg_len as usize;
3597 let next = cmsg as usize + __DARWIN_ALIGN32(cmsg_len as usize);
3598 let max = (*mhdr).msg_control as usize
3599 + (*mhdr).msg_controllen as usize;
3600 if next + __DARWIN_ALIGN32(::mem::size_of::<::cmsghdr>()) > max {
3601 0 as *mut ::cmsghdr
3602 } else {
3603 next as *mut ::cmsghdr
3604 }
3605 }
3606
3607 pub fn CMSG_DATA(cmsg: *const ::cmsghdr) -> *mut ::c_uchar {
3608 (cmsg as *mut ::c_uchar)
3609 .offset(__DARWIN_ALIGN32(::mem::size_of::<::cmsghdr>()) as isize)
3610 }
3611
3612 pub {const} fn CMSG_SPACE(length: ::c_uint) -> ::c_uint {
3613 (__DARWIN_ALIGN32(::mem::size_of::<::cmsghdr>())
3614 + __DARWIN_ALIGN32(length as usize))
3615 as ::c_uint
3616 }
3617
3618 pub fn CMSG_LEN(length: ::c_uint) -> ::c_uint {
3619 (__DARWIN_ALIGN32(::mem::size_of::<::cmsghdr>()) + length as usize)
3620 as ::c_uint
3621 }
3622
3623 pub {const} fn VM_MAKE_TAG(id: u8) -> u32 {
3624 (id as u32) << 24u32
3625 }
3626 }
3627
3628 safe_f! {
3629 pub {const} fn WSTOPSIG(status: ::c_int) -> ::c_int {
3630 status >> 8
3631 }
3632
3633 pub {const} fn _WSTATUS(status: ::c_int) -> ::c_int {
3634 status & 0x7f
3635 }
3636
3637 pub {const} fn WIFCONTINUED(status: ::c_int) -> bool {
3638 _WSTATUS(status) == _WSTOPPED && WSTOPSIG(status) == 0x13
3639 }
3640
3641 pub {const} fn WIFSIGNALED(status: ::c_int) -> bool {
3642 _WSTATUS(status) != _WSTOPPED && _WSTATUS(status) != 0
3643 }
3644
3645 pub {const} fn WIFSTOPPED(status: ::c_int) -> bool {
3646 _WSTATUS(status) == _WSTOPPED && WSTOPSIG(status) != 0x13
3647 }
3648 }
3649
3650 extern "C" {
3651 pub fn setgrent();
3652 #[doc(hidden)]
3653 #[deprecated(since = "0.2.49", note = "Deprecated in MacOSX 10.5")]
3654 #[cfg_attr(not(target_arch = "aarch64"), link_name = "daemon$1050")]
3655 pub fn daemon(nochdir: ::c_int, noclose: ::c_int) -> ::c_int;
3656 #[doc(hidden)]
3657 #[deprecated(since = "0.2.49", note = "Deprecated in MacOSX 10.10")]
3658 pub fn sem_destroy(sem: *mut sem_t) -> ::c_int;
3659 #[doc(hidden)]
3660 #[deprecated(since = "0.2.49", note = "Deprecated in MacOSX 10.10")]
3661 pub fn sem_init(sem: *mut sem_t, pshared: ::c_int, value: ::c_uint) -> ::c_int;
3662 pub fn aio_read(aiocbp: *mut aiocb) -> ::c_int;
3663 pub fn aio_write(aiocbp: *mut aiocb) -> ::c_int;
3664 pub fn aio_fsync(op: ::c_int, aiocbp: *mut aiocb) -> ::c_int;
3665 pub fn aio_error(aiocbp: *const aiocb) -> ::c_int;
3666 pub fn aio_return(aiocbp: *mut aiocb) -> ::ssize_t;
3667 #[cfg_attr(
3668 all(target_os = "macos", target_arch = "x86"),
3669 link_name = "aio_suspend$UNIX2003"
3670 )]
3671 pub fn aio_suspend(
3672 aiocb_list: *const *const aiocb,
3673 nitems: ::c_int,
3674 timeout: *const ::timespec,
3675 ) -> ::c_int;
3676 pub fn aio_cancel(fd: ::c_int, aiocbp: *mut aiocb) -> ::c_int;
3677 pub fn chflags(path: *const ::c_char, flags: ::c_uint) -> ::c_int;
3678 pub fn fchflags(fd: ::c_int, flags: ::c_uint) -> ::c_int;
3679 pub fn clock_getres(clk_id: ::clockid_t, tp: *mut ::timespec) -> ::c_int;
3680 pub fn clock_gettime(clk_id: ::clockid_t, tp: *mut ::timespec) -> ::c_int;
3681 pub fn lio_listio(
3682 mode: ::c_int,
3683 aiocb_list: *const *mut aiocb,
3684 nitems: ::c_int,
3685 sevp: *mut sigevent,
3686 ) -> ::c_int;
3687
3688 pub fn dirfd(dirp: *mut ::DIR) -> ::c_int;
3689
3690 pub fn lutimes(file: *const ::c_char, times: *const ::timeval) -> ::c_int;
3691
3692 pub fn gettimeofday(tp: *mut ::timeval, tz: *mut ::c_void) -> ::c_int;
3693 pub fn getutxent() -> *mut utmpx;
3694 pub fn getutxid(ut: *const utmpx) -> *mut utmpx;
3695 pub fn getutxline(ut: *const utmpx) -> *mut utmpx;
3696 pub fn pututxline(ut: *const utmpx) -> *mut utmpx;
3697 pub fn setutxent();
3698 pub fn endutxent();
3699 pub fn utmpxname(file: *const ::c_char) -> ::c_int;
3700
3701 pub fn getnameinfo(
3702 sa: *const ::sockaddr,
3703 salen: ::socklen_t,
3704 host: *mut ::c_char,
3705 hostlen: ::socklen_t,
3706 serv: *mut ::c_char,
3707 sevlen: ::socklen_t,
3708 flags: ::c_int,
3709 ) -> ::c_int;
3710 pub fn mincore(addr: *const ::c_void, len: ::size_t, vec: *mut ::c_char) -> ::c_int;
3711 pub fn sysctlnametomib(
3712 name: *const ::c_char,
3713 mibp: *mut ::c_int,
3714 sizep: *mut ::size_t,
3715 ) -> ::c_int;
3716 #[cfg_attr(
3717 all(target_os = "macos", target_arch = "x86"),
3718 link_name = "mprotect$UNIX2003"
3719 )]
3720 pub fn mprotect(addr: *mut ::c_void, len: ::size_t, prot: ::c_int) -> ::c_int;
3721 pub fn semget(key: key_t, nsems: ::c_int, semflg: ::c_int) -> ::c_int;
3722 #[cfg_attr(
3723 all(target_os = "macos", target_arch = "x86"),
3724 link_name = "semctl$UNIX2003"
3725 )]
3726 pub fn semctl(semid: ::c_int, semnum: ::c_int, cmd: ::c_int, ...) -> ::c_int;
3727 pub fn semop(semid: ::c_int, sops: *mut sembuf, nsops: ::size_t) -> ::c_int;
3728 pub fn shm_open(name: *const ::c_char, oflag: ::c_int, ...) -> ::c_int;
3729 pub fn ftok(pathname: *const c_char, proj_id: ::c_int) -> key_t;
3730 pub fn shmat(shmid: ::c_int, shmaddr: *const ::c_void, shmflg: ::c_int) -> *mut ::c_void;
3731 pub fn shmdt(shmaddr: *const ::c_void) -> ::c_int;
3732 #[cfg_attr(
3733 all(target_os = "macos", target_arch = "x86"),
3734 link_name = "shmctl$UNIX2003"
3735 )]
3736 pub fn shmctl(shmid: ::c_int, cmd: ::c_int, buf: *mut ::shmid_ds) -> ::c_int;
3737 pub fn shmget(key: key_t, size: ::size_t, shmflg: ::c_int) -> ::c_int;
3738 pub fn sysctl(
3739 name: *mut ::c_int,
3740 namelen: ::c_uint,
3741 oldp: *mut ::c_void,
3742 oldlenp: *mut ::size_t,
3743 newp: *mut ::c_void,
3744 newlen: ::size_t,
3745 ) -> ::c_int;
3746 pub fn sysctlbyname(
3747 name: *const ::c_char,
3748 oldp: *mut ::c_void,
3749 oldlenp: *mut ::size_t,
3750 newp: *mut ::c_void,
3751 newlen: ::size_t,
3752 ) -> ::c_int;
3753 #[deprecated(since = "0.2.55", note = "Use the mach crate")]
3754 pub fn mach_absolute_time() -> u64;
3755 #[deprecated(since = "0.2.55", note = "Use the mach crate")]
3756 #[allow(deprecated)]
3757 pub fn mach_timebase_info(info: *mut ::mach_timebase_info) -> ::c_int;
3758 pub fn mach_host_self() -> mach_port_t;
3759 pub fn mach_thread_self() -> mach_port_t;
3760 pub fn pthread_setname_np(name: *const ::c_char) -> ::c_int;
3761 pub fn pthread_getname_np(thread: ::pthread_t, name: *mut ::c_char, len: ::size_t) -> ::c_int;
3762 pub fn pthread_from_mach_thread_np(port: ::mach_port_t) -> ::pthread_t;
3763 pub fn pthread_get_stackaddr_np(thread: ::pthread_t) -> *mut ::c_void;
3764 pub fn pthread_get_stacksize_np(thread: ::pthread_t) -> ::size_t;
3765 pub fn pthread_condattr_setpshared(attr: *mut pthread_condattr_t, pshared: ::c_int) -> ::c_int;
3766 pub fn pthread_condattr_getpshared(
3767 attr: *const pthread_condattr_t,
3768 pshared: *mut ::c_int,
3769 ) -> ::c_int;
3770 pub fn pthread_mutexattr_setpshared(
3771 attr: *mut pthread_mutexattr_t,
3772 pshared: ::c_int,
3773 ) -> ::c_int;
3774 pub fn pthread_mutexattr_getpshared(
3775 attr: *const pthread_mutexattr_t,
3776 pshared: *mut ::c_int,
3777 ) -> ::c_int;
3778 pub fn pthread_rwlockattr_getpshared(
3779 attr: *const pthread_rwlockattr_t,
3780 val: *mut ::c_int,
3781 ) -> ::c_int;
3782 pub fn pthread_rwlockattr_setpshared(attr: *mut pthread_rwlockattr_t, val: ::c_int) -> ::c_int;
3783 pub fn pthread_threadid_np(thread: ::pthread_t, thread_id: *mut u64) -> ::c_int;
3784 pub fn pthread_attr_set_qos_class_np(
3785 attr: *mut pthread_attr_t,
3786 class: qos_class_t,
3787 priority: ::c_int,
3788 ) -> ::c_int;
3789 pub fn pthread_attr_get_qos_class_np(
3790 attr: *mut pthread_attr_t,
3791 class: *mut qos_class_t,
3792 priority: *mut ::c_int,
3793 ) -> ::c_int;
3794 pub fn pthread_set_qos_class_self_np(class: qos_class_t, priority: ::c_int) -> ::c_int;
3795 pub fn pthread_get_qos_class_np(
3796 thread: ::pthread_t,
3797 class: *mut qos_class_t,
3798 priority: *mut ::c_int,
3799 ) -> ::c_int;
3800 pub fn pthread_attr_getschedparam(
3801 attr: *const ::pthread_attr_t,
3802 param: *mut sched_param,
3803 ) -> ::c_int;
3804 pub fn pthread_attr_setschedparam(
3805 attr: *mut ::pthread_attr_t,
3806 param: *const sched_param,
3807 ) -> ::c_int;
3808 pub fn pthread_getschedparam(
3809 thread: ::pthread_t,
3810 policy: *mut ::c_int,
3811 param: *mut sched_param,
3812 ) -> ::c_int;
3813 pub fn pthread_setschedparam(
3814 thread: ::pthread_t,
3815 policy: ::c_int,
3816 param: *const sched_param,
3817 ) -> ::c_int;
3818 pub fn sched_get_priority_min(policy: ::c_int) -> ::c_int;
3819 pub fn sched_get_priority_max(policy: ::c_int) -> ::c_int;
3820 pub fn thread_policy_set(
3821 thread: thread_t,
3822 flavor: thread_policy_flavor_t,
3823 policy_info: thread_policy_t,
3824 count: mach_msg_type_number_t,
3825 ) -> kern_return_t;
3826 pub fn thread_policy_get(
3827 thread: thread_t,
3828 flavor: thread_policy_flavor_t,
3829 policy_info: thread_policy_t,
3830 count: *mut mach_msg_type_number_t,
3831 get_default: *mut boolean_t,
3832 ) -> kern_return_t;
3833 pub fn __error() -> *mut ::c_int;
3834 pub fn backtrace(buf: *mut *mut ::c_void, sz: ::c_int) -> ::c_int;
3835 #[cfg_attr(
3836 all(target_os = "macos", not(target_arch = "aarch64")),
3837 link_name = "statfs$INODE64"
3838 )]
3839 pub fn statfs(path: *const ::c_char, buf: *mut statfs) -> ::c_int;
3840 #[cfg_attr(
3841 all(target_os = "macos", not(target_arch = "aarch64")),
3842 link_name = "fstatfs$INODE64"
3843 )]
3844 pub fn fstatfs(fd: ::c_int, buf: *mut statfs) -> ::c_int;
3845 pub fn kevent(
3846 kq: ::c_int,
3847 changelist: *const ::kevent,
3848 nchanges: ::c_int,
3849 eventlist: *mut ::kevent,
3850 nevents: ::c_int,
3851 timeout: *const ::timespec,
3852 ) -> ::c_int;
3853 pub fn kevent64(
3854 kq: ::c_int,
3855 changelist: *const ::kevent64_s,
3856 nchanges: ::c_int,
3857 eventlist: *mut ::kevent64_s,
3858 nevents: ::c_int,
3859 flags: ::c_uint,
3860 timeout: *const ::timespec,
3861 ) -> ::c_int;
3862 pub fn mount(
3863 src: *const ::c_char,
3864 target: *const ::c_char,
3865 flags: ::c_int,
3866 data: *mut ::c_void,
3867 ) -> ::c_int;
3868 pub fn ptrace(request: ::c_int, pid: ::pid_t, addr: *mut ::c_char, data: ::c_int) -> ::c_int;
3869 pub fn quotactl(
3870 special: *const ::c_char,
3871 cmd: ::c_int,
3872 id: ::c_int,
3873 data: *mut ::c_char,
3874 ) -> ::c_int;
3875 pub fn sethostname(name: *const ::c_char, len: ::c_int) -> ::c_int;
3876 pub fn sendfile(
3877 fd: ::c_int,
3878 s: ::c_int,
3879 offset: ::off_t,
3880 len: *mut ::off_t,
3881 hdtr: *mut ::sf_hdtr,
3882 flags: ::c_int,
3883 ) -> ::c_int;
3884 pub fn futimens(fd: ::c_int, times: *const ::timespec) -> ::c_int;
3885 pub fn utimensat(
3886 dirfd: ::c_int,
3887 path: *const ::c_char,
3888 times: *const ::timespec,
3889 flag: ::c_int,
3890 ) -> ::c_int;
3891 pub fn openpty(
3892 amaster: *mut ::c_int,
3893 aslave: *mut ::c_int,
3894 name: *mut ::c_char,
3895 termp: *mut termios,
3896 winp: *mut ::winsize,
3897 ) -> ::c_int;
3898 pub fn forkpty(
3899 amaster: *mut ::c_int,
3900 name: *mut ::c_char,
3901 termp: *mut termios,
3902 winp: *mut ::winsize,
3903 ) -> ::pid_t;
3904 pub fn login_tty(fd: ::c_int) -> ::c_int;
3905 pub fn duplocale(base: ::locale_t) -> ::locale_t;
3906 pub fn freelocale(loc: ::locale_t) -> ::c_int;
3907 pub fn localeconv_l(loc: ::locale_t) -> *mut lconv;
3908 pub fn newlocale(mask: ::c_int, locale: *const ::c_char, base: ::locale_t) -> ::locale_t;
3909 pub fn uselocale(loc: ::locale_t) -> ::locale_t;
3910 pub fn querylocale(mask: ::c_int, loc: ::locale_t) -> *const ::c_char;
3911 pub fn getpriority(which: ::c_int, who: ::id_t) -> ::c_int;
3912 pub fn setpriority(which: ::c_int, who: ::id_t, prio: ::c_int) -> ::c_int;
3913 pub fn getdomainname(name: *mut ::c_char, len: ::c_int) -> ::c_int;
3914 pub fn setdomainname(name: *const ::c_char, len: ::c_int) -> ::c_int;
3915 pub fn preadv(fd: ::c_int, iov: *const ::iovec, iovcnt: ::c_int, offset: ::off_t) -> ::ssize_t;
3916 pub fn pwritev(fd: ::c_int, iov: *const ::iovec, iovcnt: ::c_int, offset: ::off_t)
3917 -> ::ssize_t;
3918 pub fn getxattr(
3919 path: *const ::c_char,
3920 name: *const ::c_char,
3921 value: *mut ::c_void,
3922 size: ::size_t,
3923 position: u32,
3924 flags: ::c_int,
3925 ) -> ::ssize_t;
3926 pub fn fgetxattr(
3927 filedes: ::c_int,
3928 name: *const ::c_char,
3929 value: *mut ::c_void,
3930 size: ::size_t,
3931 position: u32,
3932 flags: ::c_int,
3933 ) -> ::ssize_t;
3934 pub fn setxattr(
3935 path: *const ::c_char,
3936 name: *const ::c_char,
3937 value: *const ::c_void,
3938 size: ::size_t,
3939 position: u32,
3940 flags: ::c_int,
3941 ) -> ::c_int;
3942 pub fn fsetxattr(
3943 filedes: ::c_int,
3944 name: *const ::c_char,
3945 value: *const ::c_void,
3946 size: ::size_t,
3947 position: u32,
3948 flags: ::c_int,
3949 ) -> ::c_int;
3950 pub fn listxattr(
3951 path: *const ::c_char,
3952 list: *mut ::c_char,
3953 size: ::size_t,
3954 flags: ::c_int,
3955 ) -> ::ssize_t;
3956 pub fn flistxattr(
3957 filedes: ::c_int,
3958 list: *mut ::c_char,
3959 size: ::size_t,
3960 flags: ::c_int,
3961 ) -> ::ssize_t;
3962 pub fn removexattr(path: *const ::c_char, name: *const ::c_char, flags: ::c_int) -> ::c_int;
3963 pub fn renamex_np(from: *const ::c_char, to: *const ::c_char, flags: ::c_uint) -> ::c_int;
3964 pub fn renameatx_np(
3965 fromfd: ::c_int,
3966 from: *const ::c_char,
3967 tofd: ::c_int,
3968 to: *const ::c_char,
3969 flags: ::c_uint,
3970 ) -> ::c_int;
3971 pub fn fremovexattr(filedes: ::c_int, name: *const ::c_char, flags: ::c_int) -> ::c_int;
3972
3973 pub fn getgrouplist(
3974 name: *const ::c_char,
3975 basegid: ::c_int,
3976 groups: *mut ::c_int,
3977 ngroups: *mut ::c_int,
3978 ) -> ::c_int;
3979 pub fn initgroups(user: *const ::c_char, basegroup: ::c_int) -> ::c_int;
3980
3981 #[cfg_attr(
3982 all(target_os = "macos", target_arch = "x86"),
3983 link_name = "waitid$UNIX2003"
3984 )]
3985 pub fn waitid(idtype: idtype_t, id: id_t, infop: *mut ::siginfo_t, options: ::c_int)
3986 -> ::c_int;
3987 pub fn brk(addr: *const ::c_void) -> *mut ::c_void;
3988 pub fn sbrk(increment: ::c_int) -> *mut ::c_void;
3989 pub fn settimeofday(tv: *const ::timeval, tz: *const ::timezone) -> ::c_int;
3990 #[deprecated(since = "0.2.55", note = "Use the mach crate")]
3991 pub fn _dyld_image_count() -> u32;
3992 #[deprecated(since = "0.2.55", note = "Use the mach crate")]
3993 #[allow(deprecated)]
3994 pub fn _dyld_get_image_header(image_index: u32) -> *const mach_header;
3995 #[deprecated(since = "0.2.55", note = "Use the mach crate")]
3996 pub fn _dyld_get_image_vmaddr_slide(image_index: u32) -> ::intptr_t;
3997 #[deprecated(since = "0.2.55", note = "Use the mach crate")]
3998 pub fn _dyld_get_image_name(image_index: u32) -> *const ::c_char;
3999
4000 pub fn posix_spawn(
4001 pid: *mut ::pid_t,
4002 path: *const ::c_char,
4003 file_actions: *const ::posix_spawn_file_actions_t,
4004 attrp: *const ::posix_spawnattr_t,
4005 argv: *const *mut ::c_char,
4006 envp: *const *mut ::c_char,
4007 ) -> ::c_int;
4008 pub fn posix_spawnp(
4009 pid: *mut ::pid_t,
4010 file: *const ::c_char,
4011 file_actions: *const ::posix_spawn_file_actions_t,
4012 attrp: *const ::posix_spawnattr_t,
4013 argv: *const *mut ::c_char,
4014 envp: *const *mut ::c_char,
4015 ) -> ::c_int;
4016 pub fn posix_spawnattr_init(attr: *mut posix_spawnattr_t) -> ::c_int;
4017 pub fn posix_spawnattr_destroy(attr: *mut posix_spawnattr_t) -> ::c_int;
4018 pub fn posix_spawnattr_getsigdefault(
4019 attr: *const posix_spawnattr_t,
4020 default: *mut ::sigset_t,
4021 ) -> ::c_int;
4022 pub fn posix_spawnattr_setsigdefault(
4023 attr: *mut posix_spawnattr_t,
4024 default: *const ::sigset_t,
4025 ) -> ::c_int;
4026 pub fn posix_spawnattr_getsigmask(
4027 attr: *const posix_spawnattr_t,
4028 default: *mut ::sigset_t,
4029 ) -> ::c_int;
4030 pub fn posix_spawnattr_setsigmask(
4031 attr: *mut posix_spawnattr_t,
4032 default: *const ::sigset_t,
4033 ) -> ::c_int;
4034 pub fn posix_spawnattr_getflags(
4035 attr: *const posix_spawnattr_t,
4036 flags: *mut ::c_short,
4037 ) -> ::c_int;
4038 pub fn posix_spawnattr_setflags(attr: *mut posix_spawnattr_t, flags: ::c_short) -> ::c_int;
4039 pub fn posix_spawnattr_getpgroup(
4040 attr: *const posix_spawnattr_t,
4041 flags: *mut ::pid_t,
4042 ) -> ::c_int;
4043 pub fn posix_spawnattr_setpgroup(attr: *mut posix_spawnattr_t, flags: ::pid_t) -> ::c_int;
4044
4045 pub fn posix_spawn_file_actions_init(actions: *mut posix_spawn_file_actions_t) -> ::c_int;
4046 pub fn posix_spawn_file_actions_destroy(actions: *mut posix_spawn_file_actions_t) -> ::c_int;
4047 pub fn posix_spawn_file_actions_addopen(
4048 actions: *mut posix_spawn_file_actions_t,
4049 fd: ::c_int,
4050 path: *const ::c_char,
4051 oflag: ::c_int,
4052 mode: ::mode_t,
4053 ) -> ::c_int;
4054 pub fn posix_spawn_file_actions_addclose(
4055 actions: *mut posix_spawn_file_actions_t,
4056 fd: ::c_int,
4057 ) -> ::c_int;
4058 pub fn posix_spawn_file_actions_adddup2(
4059 actions: *mut posix_spawn_file_actions_t,
4060 fd: ::c_int,
4061 newfd: ::c_int,
4062 ) -> ::c_int;
4063 pub fn uname(buf: *mut ::utsname) -> ::c_int;
4064
4065 pub fn connectx(
4066 socket: ::c_int,
4067 endpoints: *const sa_endpoints_t,
4068 associd: sae_associd_t,
4069 flags: ::c_uint,
4070 iov: *const ::iovec,
4071 iovcnt: ::c_uint,
4072 len: *mut ::size_t,
4073 connid: *mut sae_connid_t,
4074 ) -> ::c_int;
4075 pub fn disconnectx(socket: ::c_int, associd: sae_associd_t, connid: sae_connid_t) -> ::c_int;
4076
4077 pub fn ntp_adjtime(buf: *mut timex) -> ::c_int;
4078 pub fn ntp_gettime(buf: *mut ntptimeval) -> ::c_int;
4079
4080 #[cfg_attr(
4081 all(target_os = "macos", not(target_arch = "aarch64")),
4082 link_name = "getmntinfo$INODE64"
4083 )]
4084 pub fn getmntinfo(mntbufp: *mut *mut statfs, flags: ::c_int) -> ::c_int;
4085 #[cfg_attr(
4086 all(target_os = "macos", not(target_arch = "aarch64")),
4087 link_name = "getfsstat$INODE64"
4088 )]
4089 pub fn getfsstat(mntbufp: *mut statfs, bufsize: ::c_int, flags: ::c_int) -> ::c_int;
4090
4091 // Copy-on-write functions.
4092 // According to the man page `flags` is an `int` but in the header
4093 // this is a `uint32_t`.
4094 pub fn clonefile(src: *const ::c_char, dst: *const ::c_char, flags: u32) -> ::c_int;
4095 pub fn clonefileat(
4096 src_dirfd: ::c_int,
4097 src: *const ::c_char,
4098 dst_dirfd: ::c_int,
4099 dst: *const ::c_char,
4100 flags: u32,
4101 ) -> ::c_int;
4102 pub fn fclonefileat(
4103 srcfd: ::c_int,
4104 dst_dirfd: ::c_int,
4105 dst: *const ::c_char,
4106 flags: u32,
4107 ) -> ::c_int;
4108
4109 // Added in macOS 10.13
4110 // ISO/IEC 9899:2011 ("ISO C11") K.3.7.4.1
4111 pub fn memset_s(s: *mut ::c_void, smax: ::size_t, c: ::c_int, n: ::size_t) -> ::c_int;
4112 // Added in macOS 10.5
4113 pub fn memset_pattern4(b: *mut ::c_void, pattern4: *const ::c_void, len: ::size_t);
4114 pub fn memset_pattern8(b: *mut ::c_void, pattern8: *const ::c_void, len: ::size_t);
4115 pub fn memset_pattern16(b: *mut ::c_void, pattern16: *const ::c_void, len: ::size_t);
4116
4117 pub fn mstats() -> mstats;
4118 pub fn malloc_printf(format: *const ::c_char, ...);
4119 pub fn malloc_zone_check(zone: *mut ::malloc_zone_t) -> ::boolean_t;
4120 pub fn malloc_zone_print(zone: *mut ::malloc_zone_t, verbose: ::boolean_t);
4121 pub fn malloc_zone_statistics(zone: *mut ::malloc_zone_t, stats: *mut malloc_statistics_t);
4122 pub fn malloc_zone_log(zone: *mut ::malloc_zone_t, address: *mut ::c_void);
4123 pub fn malloc_zone_print_ptr_info(ptr: *mut ::c_void);
4124 pub fn malloc_default_zone() -> *mut ::malloc_zone_t;
4125 pub fn malloc_zone_from_ptr(ptr: *const ::c_void) -> *mut ::malloc_zone_t;
4126 pub fn malloc_zone_malloc(zone: *mut ::malloc_zone_t, size: ::size_t) -> *mut ::c_void;
4127 pub fn malloc_zone_valloc(zone: *mut ::malloc_zone_t, size: ::size_t) -> *mut ::c_void;
4128 pub fn malloc_zone_calloc(
4129 zone: *mut ::malloc_zone_t,
4130 num_items: ::size_t,
4131 size: ::size_t,
4132 ) -> *mut ::c_void;
4133 pub fn malloc_zone_realloc(
4134 zone: *mut ::malloc_zone_t,
4135 ptr: *mut ::c_void,
4136 size: ::size_t,
4137 ) -> *mut ::c_void;
4138 pub fn malloc_zone_free(zone: *mut ::malloc_zone_t, ptr: *mut ::c_void);
4139
4140 pub fn proc_listpids(
4141 t: u32,
4142 typeinfo: u32,
4143 buffer: *mut ::c_void,
4144 buffersize: ::c_int,
4145 ) -> ::c_int;
4146 pub fn proc_listallpids(buffer: *mut ::c_void, buffersize: ::c_int) -> ::c_int;
4147 pub fn proc_listpgrppids(
4148 pgrpid: ::pid_t,
4149 buffer: *mut ::c_void,
4150 buffersize: ::c_int,
4151 ) -> ::c_int;
4152 pub fn proc_listchildpids(ppid: ::pid_t, buffer: *mut ::c_void, buffersize: ::c_int)
4153 -> ::c_int;
4154 pub fn proc_pidinfo(
4155 pid: ::c_int,
4156 flavor: ::c_int,
4157 arg: u64,
4158 buffer: *mut ::c_void,
4159 buffersize: ::c_int,
4160 ) -> ::c_int;
4161 pub fn proc_pidfdinfo(
4162 pid: ::c_int,
4163 fd: ::c_int,
4164 flavor: ::c_int,
4165 buffer: *mut ::c_void,
4166 buffersize: ::c_int,
4167 ) -> ::c_int;
4168 pub fn proc_pidfileportinfo(
4169 pid: ::c_int,
4170 fileport: u32,
4171 flavor: ::c_int,
4172 buffer: *mut ::c_void,
4173 buffersize: ::c_int,
4174 ) -> ::c_int;
4175 pub fn proc_pidpath(pid: ::c_int, buffer: *mut ::c_void, buffersize: u32) -> ::c_int;
4176 pub fn proc_name(pid: ::c_int, buffer: *mut ::c_void, buffersize: u32) -> ::c_int;
4177 pub fn proc_regionfilename(
4178 pid: ::c_int,
4179 address: u64,
4180 buffer: *mut ::c_void,
4181 buffersize: u32,
4182 ) -> ::c_int;
4183 pub fn proc_libversion(major: *mut ::c_int, mintor: *mut ::c_int) -> ::c_int;
4184 /// # Notes
4185 ///
4186 /// `id` is of type [`uuid_t`].
4187 pub fn gethostuuid(id: *mut u8, timeout: *const ::timespec) -> ::c_int;
4188
4189 pub fn CCRandomGenerateBytes(bytes: *mut ::c_void, size: ::size_t) -> ::CCRNGStatus;
4190
4191 pub fn _NSGetExecutablePath(buf: *mut ::c_char, bufsize: *mut u32) -> ::c_int;
4192 }
4193
4194 cfg_if! {
4195 if #[cfg(target_os = "macos")] {
4196 extern "C" {
4197 pub fn memmem(
4198 haystack: *const ::c_void,
4199 haystacklen: ::size_t,
4200 needle: *const ::c_void,
4201 needlelen: ::size_t,
4202 ) -> *mut ::c_void;
4203 }
4204 }
4205 }
4206
4207 #[link(name = "iconv")]
4208 extern "C" {
4209 pub fn iconv_open(tocode: *const ::c_char, fromcode: *const ::c_char) -> iconv_t;
4210 pub fn iconv(
4211 cd: iconv_t,
4212 inbuf: *mut *mut ::c_char,
4213 inbytesleft: *mut ::size_t,
4214 outbuf: *mut *mut ::c_char,
4215 outbytesleft: *mut ::size_t,
4216 ) -> ::size_t;
4217 pub fn iconv_close(cd: iconv_t) -> ::c_int;
4218 }
4219
4220 cfg_if! {
4221 if #[cfg(any(target_arch = "arm", target_arch = "x86"))] {
4222 mod b32;
4223 pub use self::b32::*;
4224 } else if #[cfg(any(target_arch = "x86_64", target_arch = "aarch64"))] {
4225 mod b64;
4226 pub use self::b64::*;
4227 } else {
4228 // Unknown target_arch
4229 }
4230 }