Debian Codegraph @

third_party/rust/libc/src/unix/bsd/apple/mod.rs

raw
1 //! Apple (ios/darwin)-specific definitions
2 //!
3 //! This covers *-apple-* triples currently
4
5 use crate::prelude::*;
6 use crate::{cmsghdr, off_t};
7
8 pub type wchar_t = i32;
9 pub type clock_t = c_ulong;
10 pub type time_t = c_long;
11 pub type suseconds_t = i32;
12 pub type dev_t = i32;
13 pub type ino_t = u64;
14 pub type mode_t = u16;
15 pub type nlink_t = u16;
16 pub type blksize_t = i32;
17 pub type rlim_t = u64;
18 pub type pthread_key_t = c_ulong;
19 pub type sigset_t = u32;
20 pub type clockid_t = c_uint;
21 pub type fsblkcnt_t = c_uint;
22 pub type fsfilcnt_t = c_uint;
23 pub type speed_t = c_ulong;
24 pub type tcflag_t = c_ulong;
25 pub type nl_item = c_int;
26 pub type id_t = c_uint;
27 pub type sem_t = c_int;
28 pub type idtype_t = c_uint;
29 pub type integer_t = c_int;
30 pub type cpu_type_t = integer_t;
31 pub type cpu_subtype_t = integer_t;
32 pub type natural_t = u32;
33 pub type mach_msg_type_number_t = natural_t;
34 pub type kern_return_t = c_int;
35 pub type uuid_t = [u8; 16];
36 pub type task_info_t = *mut integer_t;
37 pub type host_info_t = *mut integer_t;
38 pub type task_flavor_t = natural_t;
39 pub type rusage_info_t = *mut c_void;
40 pub type vm_offset_t = crate::uintptr_t;
41 pub type vm_size_t = crate::uintptr_t;
42 pub type vm_address_t = vm_offset_t;
43 pub type quad_t = i64;
44 pub type u_quad_t = u64;
45
46 pub type posix_spawnattr_t = *mut c_void;
47 pub type posix_spawn_file_actions_t = *mut c_void;
48 pub type key_t = c_int;
49 pub type shmatt_t = c_ushort;
50
51 pub type sae_associd_t = u32;
52 pub type sae_connid_t = u32;
53
54 pub type mach_port_t = c_uint;
55 pub type host_t = c_uint;
56 pub type host_flavor_t = integer_t;
57 pub type host_info64_t = *mut integer_t;
58 pub type processor_flavor_t = c_int;
59 pub type thread_flavor_t = natural_t;
60 pub type thread_inspect_t = crate::mach_port_t;
61 pub type thread_act_t = crate::mach_port_t;
62 pub type thread_act_array_t = *mut crate::thread_act_t;
63 pub type policy_t = c_int;
64 pub type mach_error_t = crate::kern_return_t;
65 pub type mach_vm_address_t = u64;
66 pub type mach_vm_offset_t = u64;
67 pub type mach_vm_size_t = u64;
68 pub type vm_map_t = crate::mach_port_t;
69 pub type mem_entry_name_port_t = crate::mach_port_t;
70 pub type memory_object_t = crate::mach_port_t;
71 pub type memory_object_offset_t = c_ulonglong;
72 pub type vm_inherit_t = c_uint;
73 pub type vm_prot_t = c_int;
74
75 pub type ledger_t = crate::mach_port_t;
76 pub type ledger_array_t = *mut crate::ledger_t;
77
78 pub type iconv_t = *mut c_void;
79
80 // mach/host_info.h
81 pub type host_cpu_load_info_t = *mut host_cpu_load_info;
82 pub type host_cpu_load_info_data_t = host_cpu_load_info;
83
84 // mach/processor_info.h
85 pub type processor_cpu_load_info_t = *mut processor_cpu_load_info;
86 pub type processor_cpu_load_info_data_t = processor_cpu_load_info;
87 pub type processor_basic_info_t = *mut processor_basic_info;
88 pub type processor_basic_info_data_t = processor_basic_info;
89 pub type processor_set_basic_info_data_t = processor_set_basic_info;
90 pub type processor_set_basic_info_t = *mut processor_set_basic_info;
91 pub type processor_set_load_info_data_t = processor_set_load_info;
92 pub type processor_set_load_info_t = *mut processor_set_load_info;
93 pub type processor_info_t = *mut integer_t;
94 pub type processor_info_array_t = *mut integer_t;
95
96 pub type mach_task_basic_info_data_t = mach_task_basic_info;
97 pub type mach_task_basic_info_t = *mut mach_task_basic_info;
98 pub type task_thread_times_info_data_t = task_thread_times_info;
99 pub type task_thread_times_info_t = *mut task_thread_times_info;
100
101 pub type thread_info_t = *mut integer_t;
102 pub type thread_basic_info_t = *mut thread_basic_info;
103 pub type thread_basic_info_data_t = thread_basic_info;
104 pub type thread_identifier_info_t = *mut thread_identifier_info;
105 pub type thread_identifier_info_data_t = thread_identifier_info;
106 pub type thread_extended_info_t = *mut thread_extended_info;
107 pub type thread_extended_info_data_t = thread_extended_info;
108
109 pub type thread_t = crate::mach_port_t;
110 pub type thread_policy_flavor_t = natural_t;
111 pub type thread_policy_t = *mut integer_t;
112 pub type thread_latency_qos_t = integer_t;
113 pub type thread_throughput_qos_t = integer_t;
114 pub type thread_standard_policy_data_t = thread_standard_policy;
115 pub type thread_standard_policy_t = *mut thread_standard_policy;
116 pub type thread_extended_policy_data_t = thread_extended_policy;
117 pub type thread_extended_policy_t = *mut thread_extended_policy;
118 pub type thread_time_constraint_policy_data_t = thread_time_constraint_policy;
119 pub type thread_time_constraint_policy_t = *mut thread_time_constraint_policy;
120 pub type thread_precedence_policy_data_t = thread_precedence_policy;
121 pub type thread_precedence_policy_t = *mut thread_precedence_policy;
122 pub type thread_affinity_policy_data_t = thread_affinity_policy;
123 pub type thread_affinity_policy_t = *mut thread_affinity_policy;
124 pub type thread_background_policy_data_t = thread_background_policy;
125 pub type thread_background_policy_t = *mut thread_background_policy;
126 pub type thread_latency_qos_policy_data_t = thread_latency_qos_policy;
127 pub type thread_latency_qos_policy_t = *mut thread_latency_qos_policy;
128 pub type thread_throughput_qos_policy_data_t = thread_throughput_qos_policy;
129 pub type thread_throughput_qos_policy_t = *mut thread_throughput_qos_policy;
130
131 pub type pthread_introspection_hook_t =
132 extern "C" fn(event: c_uint, thread: crate::pthread_t, addr: *mut c_void, size: size_t);
133 pub type pthread_jit_write_callback_t = Option<extern "C" fn(ctx: *mut c_void) -> c_int>;
134
135 pub type os_clockid_t = u32;
136
137 pub type os_sync_wait_on_address_flags_t = u32;
138 pub type os_sync_wake_by_address_flags_t = u32;
139
140 pub type os_unfair_lock = os_unfair_lock_s;
141 pub type os_unfair_lock_t = *mut os_unfair_lock;
142
143 pub type os_log_t = *mut c_void;
144 pub type os_log_type_t = u8;
145 pub type os_signpost_id_t = u64;
146 pub type os_signpost_type_t = u8;
147
148 pub type vm_statistics_t = *mut vm_statistics;
149 pub type vm_statistics_data_t = vm_statistics;
150 pub type vm_statistics64_t = *mut vm_statistics64;
151 pub type vm_statistics64_data_t = vm_statistics64;
152
153 pub type task_t = crate::mach_port_t;
154 pub type task_inspect_t = crate::mach_port_t;
155
156 pub type sysdir_search_path_enumeration_state = c_uint;
157
158 pub type CCStatus = i32;
159 pub type CCCryptorStatus = i32;
160 pub type CCRNGStatus = crate::CCCryptorStatus;
161
162 pub type copyfile_state_t = *mut c_void;
163 pub type copyfile_flags_t = u32;
164 pub type copyfile_callback_t = Option<
165 extern "C" fn(
166 c_int,
167 c_int,
168 copyfile_state_t,
169 *const c_char,
170 *const c_char,
171 *mut c_void,
172 ) -> c_int,
173 >;
174
175 pub type attrgroup_t = u32;
176 pub type vol_capabilities_set_t = [u32; 4];
177
178 deprecated_mach! {
179 pub type mach_timebase_info_data_t = mach_timebase_info;
180 }
181
182 #[cfg_attr(feature = "extra_traits", derive(Debug))]
183 pub enum timezone {}
184 impl Copy for timezone {}
185 impl Clone for timezone {
186 fn clone(&self) -> timezone {
187 *self
188 }
189 }
190
191 #[cfg_attr(feature = "extra_traits", derive(Debug))]
192 #[repr(u32)]
193 pub enum qos_class_t {
194 QOS_CLASS_USER_INTERACTIVE = 0x21,
195 QOS_CLASS_USER_INITIATED = 0x19,
196 QOS_CLASS_DEFAULT = 0x15,
197 QOS_CLASS_UTILITY = 0x11,
198 QOS_CLASS_BACKGROUND = 0x09,
199 QOS_CLASS_UNSPECIFIED = 0x00,
200 }
201 impl Copy for qos_class_t {}
202 impl Clone for qos_class_t {
203 fn clone(&self) -> qos_class_t {
204 *self
205 }
206 }
207
208 #[cfg_attr(feature = "extra_traits", derive(Debug))]
209 #[repr(u32)]
210 pub enum sysdir_search_path_directory_t {
211 SYSDIR_DIRECTORY_APPLICATION = 1,
212 SYSDIR_DIRECTORY_DEMO_APPLICATION = 2,
213 SYSDIR_DIRECTORY_DEVELOPER_APPLICATION = 3,
214 SYSDIR_DIRECTORY_ADMIN_APPLICATION = 4,
215 SYSDIR_DIRECTORY_LIBRARY = 5,
216 SYSDIR_DIRECTORY_DEVELOPER = 6,
217 SYSDIR_DIRECTORY_USER = 7,
218 SYSDIR_DIRECTORY_DOCUMENTATION = 8,
219 SYSDIR_DIRECTORY_DOCUMENT = 9,
220 SYSDIR_DIRECTORY_CORESERVICE = 10,
221 SYSDIR_DIRECTORY_AUTOSAVED_INFORMATION = 11,
222 SYSDIR_DIRECTORY_DESKTOP = 12,
223 SYSDIR_DIRECTORY_CACHES = 13,
224 SYSDIR_DIRECTORY_APPLICATION_SUPPORT = 14,
225 SYSDIR_DIRECTORY_DOWNLOADS = 15,
226 SYSDIR_DIRECTORY_INPUT_METHODS = 16,
227 SYSDIR_DIRECTORY_MOVIES = 17,
228 SYSDIR_DIRECTORY_MUSIC = 18,
229 SYSDIR_DIRECTORY_PICTURES = 19,
230 SYSDIR_DIRECTORY_PRINTER_DESCRIPTION = 20,
231 SYSDIR_DIRECTORY_SHARED_PUBLIC = 21,
232 SYSDIR_DIRECTORY_PREFERENCE_PANES = 22,
233 SYSDIR_DIRECTORY_ALL_APPLICATIONS = 100,
234 SYSDIR_DIRECTORY_ALL_LIBRARIES = 101,
235 }
236 impl Copy for sysdir_search_path_directory_t {}
237 impl Clone for sysdir_search_path_directory_t {
238 fn clone(&self) -> sysdir_search_path_directory_t {
239 *self
240 }
241 }
242
243 #[cfg_attr(feature = "extra_traits", derive(Debug))]
244 #[repr(u32)]
245 pub enum sysdir_search_path_domain_mask_t {
246 SYSDIR_DOMAIN_MASK_USER = (1 << 0),
247 SYSDIR_DOMAIN_MASK_LOCAL = (1 << 1),
248 SYSDIR_DOMAIN_MASK_NETWORK = (1 << 2),
249 SYSDIR_DOMAIN_MASK_SYSTEM = (1 << 3),
250 SYSDIR_DOMAIN_MASK_ALL = 0x0ffff,
251 }
252 impl Copy for sysdir_search_path_domain_mask_t {}
253 impl Clone for sysdir_search_path_domain_mask_t {
254 fn clone(&self) -> sysdir_search_path_domain_mask_t {
255 *self
256 }
257 }
258
259 s! {
260 pub struct ip_mreq {
261 pub imr_multiaddr: in_addr,
262 pub imr_interface: in_addr,
263 }
264
265 pub struct ip_mreqn {
266 pub imr_multiaddr: in_addr,
267 pub imr_address: in_addr,
268 pub imr_ifindex: c_int,
269 }
270
271 pub struct ip_mreq_source {
272 pub imr_multiaddr: in_addr,
273 pub imr_sourceaddr: in_addr,
274 pub imr_interface: in_addr,
275 }
276
277 pub struct aiocb {
278 pub aio_fildes: c_int,
279 pub aio_offset: off_t,
280 pub aio_buf: *mut c_void,
281 pub aio_nbytes: size_t,
282 pub aio_reqprio: c_int,
283 pub aio_sigevent: sigevent,
284 pub aio_lio_opcode: c_int,
285 }
286
287 pub struct glob_t {
288 pub gl_pathc: size_t,
289 __unused1: c_int,
290 pub gl_offs: size_t,
291 __unused2: c_int,
292 pub gl_pathv: *mut *mut c_char,
293
294 __unused3: *mut c_void,
295
296 __unused4: *mut c_void,
297 __unused5: *mut c_void,
298 __unused6: *mut c_void,
299 __unused7: *mut c_void,
300 __unused8: *mut c_void,
301 }
302
303 pub struct addrinfo {
304 pub ai_flags: c_int,
305 pub ai_family: c_int,
306 pub ai_socktype: c_int,
307 pub ai_protocol: c_int,
308 pub ai_addrlen: crate::socklen_t,
309 pub ai_canonname: *mut c_char,
310 pub ai_addr: *mut crate::sockaddr,
311 pub ai_next: *mut addrinfo,
312 }
313
314 #[deprecated(since = "0.2.55", note = "Use the `mach2` crate instead")]
315 pub struct mach_timebase_info {
316 pub numer: u32,
317 pub denom: u32,
318 }
319
320 pub struct stat {
321 pub st_dev: dev_t,
322 pub st_mode: mode_t,
323 pub st_nlink: nlink_t,
324 pub st_ino: ino_t,
325 pub st_uid: crate::uid_t,
326 pub st_gid: crate::gid_t,
327 pub st_rdev: dev_t,
328 pub st_atime: time_t,
329 pub st_atime_nsec: c_long,
330 pub st_mtime: time_t,
331 pub st_mtime_nsec: c_long,
332 pub st_ctime: time_t,
333 pub st_ctime_nsec: c_long,
334 pub st_birthtime: time_t,
335 pub st_birthtime_nsec: c_long,
336 pub st_size: off_t,
337 pub st_blocks: crate::blkcnt_t,
338 pub st_blksize: blksize_t,
339 pub st_flags: u32,
340 pub st_gen: u32,
341 pub st_lspare: i32,
342 pub st_qspare: [i64; 2],
343 }
344
345 pub struct pthread_mutexattr_t {
346 __sig: c_long,
347 __opaque: [u8; 8],
348 }
349
350 pub struct pthread_condattr_t {
351 __sig: c_long,
352 __opaque: [u8; __PTHREAD_CONDATTR_SIZE__],
353 }
354
355 pub struct pthread_rwlockattr_t {
356 __sig: c_long,
357 __opaque: [u8; __PTHREAD_RWLOCKATTR_SIZE__],
358 }
359
360 pub struct siginfo_t {
361 pub si_signo: c_int,
362 pub si_errno: c_int,
363 pub si_code: c_int,
364 pub si_pid: crate::pid_t,
365 pub si_uid: crate::uid_t,
366 pub si_status: c_int,
367 pub si_addr: *mut c_void,
368 //Requires it to be union for tests
369 //pub si_value: crate::sigval,
370 _pad: [usize; 9],
371 }
372
373 pub struct sigaction {
374 // FIXME(union): this field is actually a union
375 pub sa_sigaction: crate::sighandler_t,
376 pub sa_mask: sigset_t,
377 pub sa_flags: c_int,
378 }
379
380 pub struct stack_t {
381 pub ss_sp: *mut c_void,
382 pub ss_size: size_t,
383 pub ss_flags: c_int,
384 }
385
386 pub struct fstore_t {
387 pub fst_flags: c_uint,
388 pub fst_posmode: c_int,
389 pub fst_offset: off_t,
390 pub fst_length: off_t,
391 pub fst_bytesalloc: off_t,
392 }
393
394 pub struct fpunchhole_t {
395 pub fp_flags: c_uint, /* unused */
396 pub reserved: c_uint, /* (to maintain 8-byte alignment) */
397 pub fp_offset: off_t, /* IN: start of the region */
398 pub fp_length: off_t, /* IN: size of the region */
399 }
400
401 pub struct ftrimactivefile_t {
402 pub fta_offset: off_t,
403 pub fta_length: off_t,
404 }
405
406 pub struct fspecread_t {
407 pub fsr_flags: c_uint,
408 pub reserved: c_uint,
409 pub fsr_offset: off_t,
410 pub fsr_length: off_t,
411 }
412
413 pub struct radvisory {
414 pub ra_offset: off_t,
415 pub ra_count: c_int,
416 }
417
418 pub struct statvfs {
419 pub f_bsize: c_ulong,
420 pub f_frsize: c_ulong,
421 pub f_blocks: crate::fsblkcnt_t,
422 pub f_bfree: crate::fsblkcnt_t,
423 pub f_bavail: crate::fsblkcnt_t,
424 pub f_files: crate::fsfilcnt_t,
425 pub f_ffree: crate::fsfilcnt_t,
426 pub f_favail: crate::fsfilcnt_t,
427 pub f_fsid: c_ulong,
428 pub f_flag: c_ulong,
429 pub f_namemax: c_ulong,
430 }
431
432 pub struct Dl_info {
433 pub dli_fname: *const c_char,
434 pub dli_fbase: *mut c_void,
435 pub dli_sname: *const c_char,
436 pub dli_saddr: *mut c_void,
437 }
438
439 pub struct sockaddr_in {
440 pub sin_len: u8,
441 pub sin_family: crate::sa_family_t,
442 pub sin_port: crate::in_port_t,
443 pub sin_addr: crate::in_addr,
444 pub sin_zero: [c_char; 8],
445 }
446
447 pub struct kevent64_s {
448 pub ident: u64,
449 pub filter: i16,
450 pub flags: u16,
451 pub fflags: u32,
452 pub data: i64,
453 pub udata: u64,
454 pub ext: [u64; 2],
455 }
456
457 pub struct dqblk {
458 pub dqb_bhardlimit: u64,
459 pub dqb_bsoftlimit: u64,
460 pub dqb_curbytes: u64,
461 pub dqb_ihardlimit: u32,
462 pub dqb_isoftlimit: u32,
463 pub dqb_curinodes: u32,
464 pub dqb_btime: u32,
465 pub dqb_itime: u32,
466 pub dqb_id: u32,
467 pub dqb_spare: [u32; 4],
468 }
469
470 pub struct if_msghdr {
471 pub ifm_msglen: c_ushort,
472 pub ifm_version: c_uchar,
473 pub ifm_type: c_uchar,
474 pub ifm_addrs: c_int,
475 pub ifm_flags: c_int,
476 pub ifm_index: c_ushort,
477 pub ifm_data: if_data,
478 }
479
480 pub struct ifa_msghdr {
481 pub ifam_msglen: c_ushort,
482 pub ifam_version: c_uchar,
483 pub ifam_type: c_uchar,
484 pub ifam_addrs: c_int,
485 pub ifam_flags: c_int,
486 pub ifam_index: c_ushort,
487 pub ifam_metric: c_int,
488 }
489
490 pub struct ifma_msghdr {
491 pub ifmam_msglen: c_ushort,
492 pub ifmam_version: c_uchar,
493 pub ifmam_type: c_uchar,
494 pub ifmam_addrs: c_int,
495 pub ifmam_flags: c_int,
496 pub ifmam_index: c_ushort,
497 }
498
499 pub struct ifma_msghdr2 {
500 pub ifmam_msglen: c_ushort,
501 pub ifmam_version: c_uchar,
502 pub ifmam_type: c_uchar,
503 pub ifmam_addrs: c_int,
504 pub ifmam_flags: c_int,
505 pub ifmam_index: c_ushort,
506 pub ifmam_refcount: i32,
507 }
508
509 pub struct rt_metrics {
510 pub rmx_locks: u32,
511 pub rmx_mtu: u32,
512 pub rmx_hopcount: u32,
513 pub rmx_expire: i32,
514 pub rmx_recvpipe: u32,
515 pub rmx_sendpipe: u32,
516 pub rmx_ssthresh: u32,
517 pub rmx_rtt: u32,
518 pub rmx_rttvar: u32,
519 pub rmx_pksent: u32,
520 /// This field does not exist anymore, the u32 is now part of a resized
521 /// `rmx_filler` array.
522 pub rmx_state: u32,
523 pub rmx_filler: [u32; 3],
524 }
525
526 pub struct rt_msghdr {
527 pub rtm_msglen: c_ushort,
528 pub rtm_version: c_uchar,
529 pub rtm_type: c_uchar,
530 pub rtm_index: c_ushort,
531 pub rtm_flags: c_int,
532 pub rtm_addrs: c_int,
533 pub rtm_pid: crate::pid_t,
534 pub rtm_seq: c_int,
535 pub rtm_errno: c_int,
536 pub rtm_use: c_int,
537 pub rtm_inits: u32,
538 pub rtm_rmx: rt_metrics,
539 }
540
541 pub struct rt_msghdr2 {
542 pub rtm_msglen: c_ushort,
543 pub rtm_version: c_uchar,
544 pub rtm_type: c_uchar,
545 pub rtm_index: c_ushort,
546 pub rtm_flags: c_int,
547 pub rtm_addrs: c_int,
548 pub rtm_refcnt: i32,
549 pub rtm_parentflags: c_int,
550 pub rtm_reserved: c_int,
551 pub rtm_use: c_int,
552 pub rtm_inits: u32,
553 pub rtm_rmx: rt_metrics,
554 }
555
556 pub struct termios {
557 pub c_iflag: crate::tcflag_t,
558 pub c_oflag: crate::tcflag_t,
559 pub c_cflag: crate::tcflag_t,
560 pub c_lflag: crate::tcflag_t,
561 pub c_cc: [crate::cc_t; crate::NCCS],
562 pub c_ispeed: crate::speed_t,
563 pub c_ospeed: crate::speed_t,
564 }
565
566 pub struct flock {
567 pub l_start: off_t,
568 pub l_len: off_t,
569 pub l_pid: crate::pid_t,
570 pub l_type: c_short,
571 pub l_whence: c_short,
572 }
573
574 pub struct sf_hdtr {
575 pub headers: *mut crate::iovec,
576 pub hdr_cnt: c_int,
577 pub trailers: *mut crate::iovec,
578 pub trl_cnt: c_int,
579 }
580
581 pub struct lconv {
582 pub decimal_point: *mut c_char,
583 pub thousands_sep: *mut c_char,
584 pub grouping: *mut c_char,
585 pub int_curr_symbol: *mut c_char,
586 pub currency_symbol: *mut c_char,
587 pub mon_decimal_point: *mut c_char,
588 pub mon_thousands_sep: *mut c_char,
589 pub mon_grouping: *mut c_char,
590 pub positive_sign: *mut c_char,
591 pub negative_sign: *mut c_char,
592 pub int_frac_digits: c_char,
593 pub frac_digits: c_char,
594 pub p_cs_precedes: c_char,
595 pub p_sep_by_space: c_char,
596 pub n_cs_precedes: c_char,
597 pub n_sep_by_space: c_char,
598 pub p_sign_posn: c_char,
599 pub n_sign_posn: c_char,
600 pub int_p_cs_precedes: c_char,
601 pub int_n_cs_precedes: c_char,
602 pub int_p_sep_by_space: c_char,
603 pub int_n_sep_by_space: c_char,
604 pub int_p_sign_posn: c_char,
605 pub int_n_sign_posn: c_char,
606 }
607
608 pub struct proc_taskinfo {
609 pub pti_virtual_size: u64,
610 pub pti_resident_size: u64,
611 pub pti_total_user: u64,
612 pub pti_total_system: u64,
613 pub pti_threads_user: u64,
614 pub pti_threads_system: u64,
615 pub pti_policy: i32,
616 pub pti_faults: i32,
617 pub pti_pageins: i32,
618 pub pti_cow_faults: i32,
619 pub pti_messages_sent: i32,
620 pub pti_messages_received: i32,
621 pub pti_syscalls_mach: i32,
622 pub pti_syscalls_unix: i32,
623 pub pti_csw: i32,
624 pub pti_threadnum: i32,
625 pub pti_numrunning: i32,
626 pub pti_priority: i32,
627 }
628
629 pub struct proc_bsdinfo {
630 pub pbi_flags: u32,
631 pub pbi_status: u32,
632 pub pbi_xstatus: u32,
633 pub pbi_pid: u32,
634 pub pbi_ppid: u32,
635 pub pbi_uid: crate::uid_t,
636 pub pbi_gid: crate::gid_t,
637 pub pbi_ruid: crate::uid_t,
638 pub pbi_rgid: crate::gid_t,
639 pub pbi_svuid: crate::uid_t,
640 pub pbi_svgid: crate::gid_t,
641 pub rfu_1: u32,
642 pub pbi_comm: [c_char; MAXCOMLEN],
643 pub pbi_name: [c_char; 32], // MAXCOMLEN * 2, but macro isn't happy...
644 pub pbi_nfiles: u32,
645 pub pbi_pgid: u32,
646 pub pbi_pjobc: u32,
647 pub e_tdev: u32,
648 pub e_tpgid: u32,
649 pub pbi_nice: i32,
650 pub pbi_start_tvsec: u64,
651 pub pbi_start_tvusec: u64,
652 }
653
654 pub struct proc_taskallinfo {
655 pub pbsd: proc_bsdinfo,
656 pub ptinfo: proc_taskinfo,
657 }
658
659 pub struct xsw_usage {
660 pub xsu_total: u64,
661 pub xsu_avail: u64,
662 pub xsu_used: u64,
663 pub xsu_pagesize: u32,
664 pub xsu_encrypted: crate::boolean_t,
665 }
666
667 pub struct xucred {
668 pub cr_version: c_uint,
669 pub cr_uid: crate::uid_t,
670 pub cr_ngroups: c_short,
671 pub cr_groups: [crate::gid_t; 16],
672 }
673
674 #[deprecated(since = "0.2.55", note = "Use the `mach2` crate instead")]
675 pub struct mach_header {
676 pub magic: u32,
677 pub cputype: cpu_type_t,
678 pub cpusubtype: cpu_subtype_t,
679 pub filetype: u32,
680 pub ncmds: u32,
681 pub sizeofcmds: u32,
682 pub flags: u32,
683 }
684
685 #[deprecated(since = "0.2.55", note = "Use the `mach2` crate instead")]
686 pub struct mach_header_64 {
687 pub magic: u32,
688 pub cputype: cpu_type_t,
689 pub cpusubtype: cpu_subtype_t,
690 pub filetype: u32,
691 pub ncmds: u32,
692 pub sizeofcmds: u32,
693 pub flags: u32,
694 pub reserved: u32,
695 }
696
697 pub struct segment_command {
698 pub cmd: u32,
699 pub cmdsize: u32,
700 pub segname: [c_char; 16],
701 pub vmaddr: u32,
702 pub vmsize: u32,
703 pub fileoff: u32,
704 pub filesize: u32,
705 pub maxprot: vm_prot_t,
706 pub initprot: vm_prot_t,
707 pub nsects: u32,
708 pub flags: u32,
709 }
710
711 pub struct segment_command_64 {
712 pub cmd: u32,
713 pub cmdsize: u32,
714 pub segname: [c_char; 16],
715 pub vmaddr: u64,
716 pub vmsize: u64,
717 pub fileoff: u64,
718 pub filesize: u64,
719 pub maxprot: vm_prot_t,
720 pub initprot: vm_prot_t,
721 pub nsects: u32,
722 pub flags: u32,
723 }
724
725 pub struct load_command {
726 pub cmd: u32,
727 pub cmdsize: u32,
728 }
729
730 pub struct sockaddr_dl {
731 pub sdl_len: c_uchar,
732 pub sdl_family: c_uchar,
733 pub sdl_index: c_ushort,
734 pub sdl_type: c_uchar,
735 pub sdl_nlen: c_uchar,
736 pub sdl_alen: c_uchar,
737 pub sdl_slen: c_uchar,
738 pub sdl_data: [c_char; 12],
739 }
740
741 pub struct sockaddr_inarp {
742 pub sin_len: c_uchar,
743 pub sin_family: c_uchar,
744 pub sin_port: c_ushort,
745 pub sin_addr: crate::in_addr,
746 pub sin_srcaddr: crate::in_addr,
747 pub sin_tos: c_ushort,
748 pub sin_other: c_ushort,
749 }
750
751 pub struct sockaddr_ctl {
752 pub sc_len: c_uchar,
753 pub sc_family: c_uchar,
754 pub ss_sysaddr: u16,
755 pub sc_id: u32,
756 pub sc_unit: u32,
757 pub sc_reserved: [u32; 5],
758 }
759
760 pub struct in_pktinfo {
761 pub ipi_ifindex: c_uint,
762 pub ipi_spec_dst: crate::in_addr,
763 pub ipi_addr: crate::in_addr,
764 }
765
766 pub struct in6_pktinfo {
767 pub ipi6_addr: crate::in6_addr,
768 pub ipi6_ifindex: c_uint,
769 }
770
771 // sys/ipc.h:
772
773 pub struct ipc_perm {
774 pub uid: crate::uid_t,
775 pub gid: crate::gid_t,
776 pub cuid: crate::uid_t,
777 pub cgid: crate::gid_t,
778 pub mode: crate::mode_t,
779 pub _seq: c_ushort,
780 pub _key: crate::key_t,
781 }
782
783 // sys/sem.h
784
785 pub struct sembuf {
786 pub sem_num: c_ushort,
787 pub sem_op: c_short,
788 pub sem_flg: c_short,
789 }
790
791 // sys/shm.h
792
793 pub struct arphdr {
794 pub ar_hrd: u16,
795 pub ar_pro: u16,
796 pub ar_hln: u8,
797 pub ar_pln: u8,
798 pub ar_op: u16,
799 }
800
801 pub struct in_addr {
802 pub s_addr: crate::in_addr_t,
803 }
804
805 // net/ndrv.h
806 pub struct sockaddr_ndrv {
807 pub snd_len: c_uchar,
808 pub snd_family: c_uchar,
809 pub snd_name: [c_uchar; crate::IFNAMSIZ],
810 }
811
812 // sys/socket.h
813
814 pub struct sa_endpoints_t {
815 pub sae_srcif: c_uint, // optional source interface
816 pub sae_srcaddr: *const crate::sockaddr, // optional source address
817 pub sae_srcaddrlen: crate::socklen_t, // size of source address
818 pub sae_dstaddr: *const crate::sockaddr, // destination address
819 pub sae_dstaddrlen: crate::socklen_t, // size of destination address
820 }
821
822 pub struct timex {
823 pub modes: c_uint,
824 pub offset: c_long,
825 pub freq: c_long,
826 pub maxerror: c_long,
827 pub esterror: c_long,
828 pub status: c_int,
829 pub constant: c_long,
830 pub precision: c_long,
831 pub tolerance: c_long,
832 pub ppsfreq: c_long,
833 pub jitter: c_long,
834 pub shift: c_int,
835 pub stabil: c_long,
836 pub jitcnt: c_long,
837 pub calcnt: c_long,
838 pub errcnt: c_long,
839 pub stbcnt: c_long,
840 }
841
842 pub struct ntptimeval {
843 pub time: crate::timespec,
844 pub maxerror: c_long,
845 pub esterror: c_long,
846 pub tai: c_long,
847 pub time_state: c_int,
848 }
849
850 pub struct thread_standard_policy {
851 pub no_data: natural_t,
852 }
853
854 pub struct thread_extended_policy {
855 pub timeshare: boolean_t,
856 }
857
858 pub struct thread_time_constraint_policy {
859 pub period: u32,
860 pub computation: u32,
861 pub constraint: u32,
862 pub preemptible: boolean_t,
863 }
864
865 pub struct thread_precedence_policy {
866 pub importance: integer_t,
867 }
868
869 pub struct thread_affinity_policy {
870 pub affinity_tag: integer_t,
871 }
872
873 pub struct thread_background_policy {
874 pub priority: integer_t,
875 }
876
877 pub struct thread_latency_qos_policy {
878 pub thread_latency_qos_tier: thread_latency_qos_t,
879 }
880
881 pub struct thread_throughput_qos_policy {
882 pub thread_throughput_qos_tier: thread_throughput_qos_t,
883 }
884
885 // malloc/malloc.h
886 pub struct malloc_statistics_t {
887 pub blocks_in_use: c_uint,
888 pub size_in_use: size_t,
889 pub max_size_in_use: size_t,
890 pub size_allocated: size_t,
891 }
892
893 pub struct mstats {
894 pub bytes_total: size_t,
895 pub chunks_used: size_t,
896 pub bytes_used: size_t,
897 pub chunks_free: size_t,
898 pub bytes_free: size_t,
899 }
900
901 pub struct vm_range_t {
902 pub address: crate::vm_address_t,
903 pub size: crate::vm_size_t,
904 }
905
906 // sched.h
907 pub struct sched_param {
908 pub sched_priority: c_int,
909 __opaque: [c_char; 4],
910 }
911
912 pub struct vinfo_stat {
913 pub vst_dev: u32,
914 pub vst_mode: u16,
915 pub vst_nlink: u16,
916 pub vst_ino: u64,
917 pub vst_uid: crate::uid_t,
918 pub vst_gid: crate::gid_t,
919 pub vst_atime: i64,
920 pub vst_atimensec: i64,
921 pub vst_mtime: i64,
922 pub vst_mtimensec: i64,
923 pub vst_ctime: i64,
924 pub vst_ctimensec: i64,
925 pub vst_birthtime: i64,
926 pub vst_birthtimensec: i64,
927 pub vst_size: off_t,
928 pub vst_blocks: i64,
929 pub vst_blksize: i32,
930 pub vst_flags: u32,
931 pub vst_gen: u32,
932 pub vst_rdev: u32,
933 pub vst_qspare: [i64; 2],
934 }
935
936 pub struct vnode_info {
937 pub vi_stat: vinfo_stat,
938 pub vi_type: c_int,
939 pub vi_pad: c_int,
940 pub vi_fsid: crate::fsid_t,
941 }
942
943 pub struct vnode_info_path {
944 pub vip_vi: vnode_info,
945 // Normally it's `vip_path: [c_char; MAXPATHLEN]` but because libc supports an old rustc
946 // version, we go around this limitation like this.
947 pub vip_path: [[c_char; 32]; 32],
948 }
949
950 pub struct proc_vnodepathinfo {
951 pub pvi_cdir: vnode_info_path,
952 pub pvi_rdir: vnode_info_path,
953 }
954
955 pub struct vm_statistics {
956 pub free_count: natural_t,
957 pub active_count: natural_t,
958 pub inactive_count: natural_t,
959 pub wire_count: natural_t,
960 pub zero_fill_count: natural_t,
961 pub reactivations: natural_t,
962 pub pageins: natural_t,
963 pub pageouts: natural_t,
964 pub faults: natural_t,
965 pub cow_faults: natural_t,
966 pub lookups: natural_t,
967 pub hits: natural_t,
968 pub purgeable_count: natural_t,
969 pub purges: natural_t,
970 pub speculative_count: natural_t,
971 }
972
973 pub struct task_thread_times_info {
974 pub user_time: time_value_t,
975 pub system_time: time_value_t,
976 }
977
978 pub struct rusage_info_v0 {
979 pub ri_uuid: [u8; 16],
980 pub ri_user_time: u64,
981 pub ri_system_time: u64,
982 pub ri_pkg_idle_wkups: u64,
983 pub ri_interrupt_wkups: u64,
984 pub ri_pageins: u64,
985 pub ri_wired_size: u64,
986 pub ri_resident_size: u64,
987 pub ri_phys_footprint: u64,
988 pub ri_proc_start_abstime: u64,
989 pub ri_proc_exit_abstime: u64,
990 }
991
992 pub struct rusage_info_v1 {
993 pub ri_uuid: [u8; 16],
994 pub ri_user_time: u64,
995 pub ri_system_time: u64,
996 pub ri_pkg_idle_wkups: u64,
997 pub ri_interrupt_wkups: u64,
998 pub ri_pageins: u64,
999 pub ri_wired_size: u64,
1000 pub ri_resident_size: u64,
1001 pub ri_phys_footprint: u64,
1002 pub ri_proc_start_abstime: u64,
1003 pub ri_proc_exit_abstime: u64,
1004 pub ri_child_user_time: u64,
1005 pub ri_child_system_time: u64,
1006 pub ri_child_pkg_idle_wkups: u64,
1007 pub ri_child_interrupt_wkups: u64,
1008 pub ri_child_pageins: u64,
1009 pub ri_child_elapsed_abstime: u64,
1010 }
1011
1012 pub struct rusage_info_v2 {
1013 pub ri_uuid: [u8; 16],
1014 pub ri_user_time: u64,
1015 pub ri_system_time: u64,
1016 pub ri_pkg_idle_wkups: u64,
1017 pub ri_interrupt_wkups: u64,
1018 pub ri_pageins: u64,
1019 pub ri_wired_size: u64,
1020 pub ri_resident_size: u64,
1021 pub ri_phys_footprint: u64,
1022 pub ri_proc_start_abstime: u64,
1023 pub ri_proc_exit_abstime: u64,
1024 pub ri_child_user_time: u64,
1025 pub ri_child_system_time: u64,
1026 pub ri_child_pkg_idle_wkups: u64,
1027 pub ri_child_interrupt_wkups: u64,
1028 pub ri_child_pageins: u64,
1029 pub ri_child_elapsed_abstime: u64,
1030 pub ri_diskio_bytesread: u64,
1031 pub ri_diskio_byteswritten: u64,
1032 }
1033
1034 pub struct rusage_info_v3 {
1035 pub ri_uuid: [u8; 16],
1036 pub ri_user_time: u64,
1037 pub ri_system_time: u64,
1038 pub ri_pkg_idle_wkups: u64,
1039 pub ri_interrupt_wkups: u64,
1040 pub ri_pageins: u64,
1041 pub ri_wired_size: u64,
1042 pub ri_resident_size: u64,
1043 pub ri_phys_footprint: u64,
1044 pub ri_proc_start_abstime: u64,
1045 pub ri_proc_exit_abstime: u64,
1046 pub ri_child_user_time: u64,
1047 pub ri_child_system_time: u64,
1048 pub ri_child_pkg_idle_wkups: u64,
1049 pub ri_child_interrupt_wkups: u64,
1050 pub ri_child_pageins: u64,
1051 pub ri_child_elapsed_abstime: u64,
1052 pub ri_diskio_bytesread: u64,
1053 pub ri_diskio_byteswritten: u64,
1054 pub ri_cpu_time_qos_default: u64,
1055 pub ri_cpu_time_qos_maintenance: u64,
1056 pub ri_cpu_time_qos_background: u64,
1057 pub ri_cpu_time_qos_utility: u64,
1058 pub ri_cpu_time_qos_legacy: u64,
1059 pub ri_cpu_time_qos_user_initiated: u64,
1060 pub ri_cpu_time_qos_user_interactive: u64,
1061 pub ri_billed_system_time: u64,
1062 pub ri_serviced_system_time: u64,
1063 }
1064
1065 pub struct rusage_info_v4 {
1066 pub ri_uuid: [u8; 16],
1067 pub ri_user_time: u64,
1068 pub ri_system_time: u64,
1069 pub ri_pkg_idle_wkups: u64,
1070 pub ri_interrupt_wkups: u64,
1071 pub ri_pageins: u64,
1072 pub ri_wired_size: u64,
1073 pub ri_resident_size: u64,
1074 pub ri_phys_footprint: u64,
1075 pub ri_proc_start_abstime: u64,
1076 pub ri_proc_exit_abstime: u64,
1077 pub ri_child_user_time: u64,
1078 pub ri_child_system_time: u64,
1079 pub ri_child_pkg_idle_wkups: u64,
1080 pub ri_child_interrupt_wkups: u64,
1081 pub ri_child_pageins: u64,
1082 pub ri_child_elapsed_abstime: u64,
1083 pub ri_diskio_bytesread: u64,
1084 pub ri_diskio_byteswritten: u64,
1085 pub ri_cpu_time_qos_default: u64,
1086 pub ri_cpu_time_qos_maintenance: u64,
1087 pub ri_cpu_time_qos_background: u64,
1088 pub ri_cpu_time_qos_utility: u64,
1089 pub ri_cpu_time_qos_legacy: u64,
1090 pub ri_cpu_time_qos_user_initiated: u64,
1091 pub ri_cpu_time_qos_user_interactive: u64,
1092 pub ri_billed_system_time: u64,
1093 pub ri_serviced_system_time: u64,
1094 pub ri_logical_writes: u64,
1095 pub ri_lifetime_max_phys_footprint: u64,
1096 pub ri_instructions: u64,
1097 pub ri_cycles: u64,
1098 pub ri_billed_energy: u64,
1099 pub ri_serviced_energy: u64,
1100 pub ri_interval_max_phys_footprint: u64,
1101 pub ri_runnable_time: u64,
1102 }
1103
1104 pub struct image_offset {
1105 pub uuid: crate::uuid_t,
1106 pub offset: u32,
1107 }
1108
1109 pub struct attrlist {
1110 pub bitmapcount: c_ushort,
1111 pub reserved: u16,
1112 pub commonattr: attrgroup_t,
1113 pub volattr: attrgroup_t,
1114 pub dirattr: attrgroup_t,
1115 pub fileattr: attrgroup_t,
1116 pub forkattr: attrgroup_t,
1117 }
1118
1119 pub struct attrreference_t {
1120 pub attr_dataoffset: i32,
1121 pub attr_length: u32,
1122 }
1123
1124 pub struct vol_capabilities_attr_t {
1125 pub capabilities: vol_capabilities_set_t,
1126 pub valid: vol_capabilities_set_t,
1127 }
1128
1129 pub struct attribute_set_t {
1130 pub commonattr: attrgroup_t,
1131 pub volattr: attrgroup_t,
1132 pub dirattr: attrgroup_t,
1133 pub fileattr: attrgroup_t,
1134 pub forkattr: attrgroup_t,
1135 }
1136
1137 pub struct vol_attributes_attr_t {
1138 pub validattr: attribute_set_t,
1139 pub nativeattr: attribute_set_t,
1140 }
1141
1142 #[repr(align(8))]
1143 pub struct tcp_connection_info {
1144 pub tcpi_state: u8,
1145 pub tcpi_snd_wscale: u8,
1146 pub tcpi_rcv_wscale: u8,
1147 __pad1: u8,
1148 pub tcpi_options: u32,
1149 pub tcpi_flags: u32,
1150 pub tcpi_rto: u32,
1151 pub tcpi_maxseg: u32,
1152 pub tcpi_snd_ssthresh: u32,
1153 pub tcpi_snd_cwnd: u32,
1154 pub tcpi_snd_wnd: u32,
1155 pub tcpi_snd_sbbytes: u32,
1156 pub tcpi_rcv_wnd: u32,
1157 pub tcpi_rttcur: u32,
1158 pub tcpi_srtt: u32,
1159 pub tcpi_rttvar: u32,
1160 pub tcpi_tfo_cookie_req: u32,
1161 pub tcpi_tfo_cookie_rcv: u32,
1162 pub tcpi_tfo_syn_loss: u32,
1163 pub tcpi_tfo_syn_data_sent: u32,
1164 pub tcpi_tfo_syn_data_acked: u32,
1165 pub tcpi_tfo_syn_data_rcv: u32,
1166 pub tcpi_tfo_cookie_req_rcv: u32,
1167 pub tcpi_tfo_cookie_sent: u32,
1168 pub tcpi_tfo_cookie_invalid: u32,
1169 pub tcpi_tfo_cookie_wrong: u32,
1170 pub tcpi_tfo_no_cookie_rcv: u32,
1171 pub tcpi_tfo_heuristics_disable: u32,
1172 pub tcpi_tfo_send_blackhole: u32,
1173 pub tcpi_tfo_recv_blackhole: u32,
1174 pub tcpi_tfo_onebyte_proxy: u32,
1175 __pad2: u32,
1176 pub tcpi_txpackets: u64,
1177 pub tcpi_txbytes: u64,
1178 pub tcpi_txretransmitbytes: u64,
1179 pub tcpi_rxpackets: u64,
1180 pub tcpi_rxbytes: u64,
1181 pub tcpi_rxoutoforderbytes: u64,
1182 pub tcpi_rxretransmitpackets: u64,
1183 }
1184
1185 pub struct in6_addrlifetime {
1186 pub ia6t_expire: time_t,
1187 pub ia6t_preferred: time_t,
1188 pub ia6t_vltime: u32,
1189 pub ia6t_pltime: u32,
1190 }
1191
1192 pub struct in6_ifstat {
1193 pub ifs6_in_receive: crate::u_quad_t,
1194 pub ifs6_in_hdrerr: crate::u_quad_t,
1195 pub ifs6_in_toobig: crate::u_quad_t,
1196 pub ifs6_in_noroute: crate::u_quad_t,
1197 pub ifs6_in_addrerr: crate::u_quad_t,
1198 pub ifs6_in_protounknown: crate::u_quad_t,
1199 pub ifs6_in_truncated: crate::u_quad_t,
1200 pub ifs6_in_discard: crate::u_quad_t,
1201 pub ifs6_in_deliver: crate::u_quad_t,
1202 pub ifs6_out_forward: crate::u_quad_t,
1203 pub ifs6_out_request: crate::u_quad_t,
1204 pub ifs6_out_discard: crate::u_quad_t,
1205 pub ifs6_out_fragok: crate::u_quad_t,
1206 pub ifs6_out_fragfail: crate::u_quad_t,
1207 pub ifs6_out_fragcreat: crate::u_quad_t,
1208 pub ifs6_reass_reqd: crate::u_quad_t,
1209 pub ifs6_reass_ok: crate::u_quad_t,
1210 pub ifs6_atmfrag_rcvd: crate::u_quad_t,
1211 pub ifs6_reass_fail: crate::u_quad_t,
1212 pub ifs6_in_mcast: crate::u_quad_t,
1213 pub ifs6_out_mcast: crate::u_quad_t,
1214 pub ifs6_cantfoward_icmp6: crate::u_quad_t,
1215 pub ifs6_addr_expiry_cnt: crate::u_quad_t,
1216 pub ifs6_pfx_expiry_cnt: crate::u_quad_t,
1217 pub ifs6_defrtr_expiry_cnt: crate::u_quad_t,
1218 }
1219
1220 pub struct icmp6_ifstat {
1221 pub ifs6_in_msg: crate::u_quad_t,
1222 pub ifs6_in_error: crate::u_quad_t,
1223 pub ifs6_in_dstunreach: crate::u_quad_t,
1224 pub ifs6_in_adminprohib: crate::u_quad_t,
1225 pub ifs6_in_timeexceed: crate::u_quad_t,
1226 pub ifs6_in_paramprob: crate::u_quad_t,
1227 pub ifs6_in_pkttoobig: crate::u_quad_t,
1228 pub ifs6_in_echo: crate::u_quad_t,
1229 pub ifs6_in_echoreply: crate::u_quad_t,
1230 pub ifs6_in_routersolicit: crate::u_quad_t,
1231 pub ifs6_in_routeradvert: crate::u_quad_t,
1232 pub ifs6_in_neighborsolicit: crate::u_quad_t,
1233 pub ifs6_in_neighboradvert: crate::u_quad_t,
1234 pub ifs6_in_redirect: crate::u_quad_t,
1235 pub ifs6_in_mldquery: crate::u_quad_t,
1236 pub ifs6_in_mldreport: crate::u_quad_t,
1237 pub ifs6_in_mlddone: crate::u_quad_t,
1238 pub ifs6_out_msg: crate::u_quad_t,
1239 pub ifs6_out_error: crate::u_quad_t,
1240 pub ifs6_out_dstunreach: crate::u_quad_t,
1241 pub ifs6_out_adminprohib: crate::u_quad_t,
1242 pub ifs6_out_timeexceed: crate::u_quad_t,
1243 pub ifs6_out_paramprob: crate::u_quad_t,
1244 pub ifs6_out_pkttoobig: crate::u_quad_t,
1245 pub ifs6_out_echo: crate::u_quad_t,
1246 pub ifs6_out_echoreply: crate::u_quad_t,
1247 pub ifs6_out_routersolicit: crate::u_quad_t,
1248 pub ifs6_out_routeradvert: crate::u_quad_t,
1249 pub ifs6_out_neighborsolicit: crate::u_quad_t,
1250 pub ifs6_out_neighboradvert: crate::u_quad_t,
1251 pub ifs6_out_redirect: crate::u_quad_t,
1252 pub ifs6_out_mldquery: crate::u_quad_t,
1253 pub ifs6_out_mldreport: crate::u_quad_t,
1254 pub ifs6_out_mlddone: crate::u_quad_t,
1255 }
1256
1257 // mach/host_info.h
1258 pub struct host_cpu_load_info {
1259 pub cpu_ticks: [crate::natural_t; CPU_STATE_MAX as usize],
1260 }
1261
1262 // net/if_mib.h
1263 pub struct ifmibdata {
1264 /// Name of interface
1265 pub ifmd_name: [c_char; crate::IFNAMSIZ],
1266 /// Number of promiscuous listeners
1267 pub ifmd_pcount: c_uint,
1268 /// Interface flags
1269 pub ifmd_flags: c_uint,
1270 /// Instantaneous length of send queue
1271 pub ifmd_snd_len: c_uint,
1272 /// Maximum length of send queue
1273 pub ifmd_snd_maxlen: c_uint,
1274 /// Number of drops in send queue
1275 pub ifmd_snd_drops: c_uint,
1276 /// For future expansion
1277 pub ifmd_filler: [c_uint; 4],
1278 /// Generic information and statistics
1279 pub ifmd_data: if_data64,
1280 }
1281
1282 pub struct ifs_iso_8802_3 {
1283 pub dot3StatsAlignmentErrors: u32,
1284 pub dot3StatsFCSErrors: u32,
1285 pub dot3StatsSingleCollisionFrames: u32,
1286 pub dot3StatsMultipleCollisionFrames: u32,
1287 pub dot3StatsSQETestErrors: u32,
1288 pub dot3StatsDeferredTransmissions: u32,
1289 pub dot3StatsLateCollisions: u32,
1290 pub dot3StatsExcessiveCollisions: u32,
1291 pub dot3StatsInternalMacTransmitErrors: u32,
1292 pub dot3StatsCarrierSenseErrors: u32,
1293 pub dot3StatsFrameTooLongs: u32,
1294 pub dot3StatsInternalMacReceiveErrors: u32,
1295 pub dot3StatsEtherChipSet: u32,
1296 pub dot3StatsMissedFrames: u32,
1297 pub dot3StatsCollFrequencies: [u32; 16],
1298 pub dot3Compliance: u32,
1299 }
1300
1301 // kern_control.h
1302 pub struct ctl_info {
1303 pub ctl_id: u32,
1304 pub ctl_name: [c_char; MAX_KCTL_NAME],
1305 }
1306
1307 // sys/proc_info.h
1308 pub struct proc_fdinfo {
1309 pub proc_fd: i32,
1310 pub proc_fdtype: u32,
1311 }
1312 }
1313
1314 s_no_extra_traits! {
1315 #[repr(packed(4))]
1316 pub struct ifconf {
1317 pub ifc_len: c_int,
1318 pub ifc_ifcu: __c_anonymous_ifc_ifcu,
1319 }
1320
1321 #[repr(packed(4))]
1322 pub struct kevent {
1323 pub ident: crate::uintptr_t,
1324 pub filter: i16,
1325 pub flags: u16,
1326 pub fflags: u32,
1327 pub data: intptr_t,
1328 pub udata: *mut c_void,
1329 }
1330
1331 #[repr(packed(4))]
1332 pub struct semid_ds {
1333 // Note the manpage shows different types than the system header.
1334 pub sem_perm: ipc_perm,
1335 pub sem_base: i32,
1336 pub sem_nsems: c_ushort,
1337 pub sem_otime: crate::time_t,
1338 pub sem_pad1: i32,
1339 pub sem_ctime: crate::time_t,
1340 pub sem_pad2: i32,
1341 pub sem_pad3: [i32; 4],
1342 }
1343
1344 #[repr(packed(4))]
1345 pub struct shmid_ds {
1346 pub shm_perm: ipc_perm,
1347 pub shm_segsz: size_t,
1348 pub shm_lpid: crate::pid_t,
1349 pub shm_cpid: crate::pid_t,
1350 pub shm_nattch: crate::shmatt_t,
1351 pub shm_atime: crate::time_t, // FIXME(macos): 64-bit wrong align => wrong offset
1352 pub shm_dtime: crate::time_t, // FIXME(macos): 64-bit wrong align => wrong offset
1353 pub shm_ctime: crate::time_t, // FIXME(macos): 64-bit wrong align => wrong offset
1354 // FIXME: 64-bit wrong align => wrong offset:
1355 pub shm_internal: *mut c_void,
1356 }
1357
1358 pub struct proc_threadinfo {
1359 pub pth_user_time: u64,
1360 pub pth_system_time: u64,
1361 pub pth_cpu_usage: i32,
1362 pub pth_policy: i32,
1363 pub pth_run_state: i32,
1364 pub pth_flags: i32,
1365 pub pth_sleep_time: i32,
1366 pub pth_curpri: i32,
1367 pub pth_priority: i32,
1368 pub pth_maxpriority: i32,
1369 pub pth_name: [c_char; MAXTHREADNAMESIZE],
1370 }
1371
1372 pub struct statfs {
1373 pub f_bsize: u32,
1374 pub f_iosize: i32,
1375 pub f_blocks: u64,
1376 pub f_bfree: u64,
1377 pub f_bavail: u64,
1378 pub f_files: u64,
1379 pub f_ffree: u64,
1380 pub f_fsid: crate::fsid_t,
1381 pub f_owner: crate::uid_t,
1382 pub f_type: u32,
1383 pub f_flags: u32,
1384 pub f_fssubtype: u32,
1385 pub f_fstypename: [c_char; 16],
1386 pub f_mntonname: [c_char; 1024],
1387 pub f_mntfromname: [c_char; 1024],
1388 pub f_flags_ext: u32,
1389 pub f_reserved: [u32; 7],
1390 }
1391
1392 pub struct dirent {
1393 pub d_ino: u64,
1394 pub d_seekoff: u64,
1395 pub d_reclen: u16,
1396 pub d_namlen: u16,
1397 pub d_type: u8,
1398 pub d_name: [c_char; 1024],
1399 }
1400
1401 pub struct pthread_rwlock_t {
1402 __sig: c_long,
1403 __opaque: [u8; __PTHREAD_RWLOCK_SIZE__],
1404 }
1405
1406 pub struct pthread_mutex_t {
1407 __sig: c_long,
1408 __opaque: [u8; __PTHREAD_MUTEX_SIZE__],
1409 }
1410
1411 pub struct pthread_cond_t {
1412 __sig: c_long,
1413 __opaque: [u8; __PTHREAD_COND_SIZE__],
1414 }
1415
1416 pub struct sockaddr_storage {
1417 pub ss_len: u8,
1418 pub ss_family: crate::sa_family_t,
1419 __ss_pad1: [u8; 6],
1420 __ss_align: i64,
1421 __ss_pad2: [u8; 112],
1422 }
1423
1424 pub struct utmpx {
1425 pub ut_user: [c_char; _UTX_USERSIZE],
1426 pub ut_id: [c_char; _UTX_IDSIZE],
1427 pub ut_line: [c_char; _UTX_LINESIZE],
1428 pub ut_pid: crate::pid_t,
1429 pub ut_type: c_short,
1430 pub ut_tv: crate::timeval,
1431 pub ut_host: [c_char; _UTX_HOSTSIZE],
1432 ut_pad: [u32; 16],
1433 }
1434
1435 pub struct sigevent {
1436 pub sigev_notify: c_int,
1437 pub sigev_signo: c_int,
1438 pub sigev_value: crate::sigval,
1439 __unused1: *mut c_void, //actually a function pointer
1440 pub sigev_notify_attributes: *mut crate::pthread_attr_t,
1441 }
1442
1443 pub struct processor_cpu_load_info {
1444 pub cpu_ticks: [c_uint; CPU_STATE_MAX as usize],
1445 }
1446
1447 pub struct processor_basic_info {
1448 pub cpu_type: cpu_type_t,
1449 pub cpu_subtype: cpu_subtype_t,
1450 pub running: crate::boolean_t,
1451 pub slot_num: c_int,
1452 pub is_master: crate::boolean_t,
1453 }
1454
1455 pub struct processor_set_basic_info {
1456 pub processor_count: c_int,
1457 pub default_policy: c_int,
1458 }
1459
1460 pub struct processor_set_load_info {
1461 pub task_count: c_int,
1462 pub thread_count: c_int,
1463 pub load_average: integer_t,
1464 pub mach_factor: integer_t,
1465 }
1466
1467 pub struct time_value_t {
1468 pub seconds: integer_t,
1469 pub microseconds: integer_t,
1470 }
1471
1472 pub struct thread_basic_info {
1473 pub user_time: time_value_t,
1474 pub system_time: time_value_t,
1475 pub cpu_usage: crate::integer_t,
1476 pub policy: crate::policy_t,
1477 pub run_state: crate::integer_t,
1478 pub flags: crate::integer_t,
1479 pub suspend_count: crate::integer_t,
1480 pub sleep_time: crate::integer_t,
1481 }
1482
1483 pub struct thread_identifier_info {
1484 pub thread_id: u64,
1485 pub thread_handle: u64,
1486 pub dispatch_qaddr: u64,
1487 }
1488
1489 pub struct thread_extended_info {
1490 pub pth_user_time: u64,
1491 pub pth_system_time: u64,
1492 pub pth_cpu_usage: i32,
1493 pub pth_policy: i32,
1494 pub pth_run_state: i32,
1495 pub pth_flags: i32,
1496 pub pth_sleep_time: i32,
1497 pub pth_curpri: i32,
1498 pub pth_priority: i32,
1499 pub pth_maxpriority: i32,
1500 pub pth_name: [c_char; MAXTHREADNAMESIZE],
1501 }
1502
1503 #[repr(packed(4))]
1504 pub struct if_data64 {
1505 pub ifi_type: c_uchar,
1506 pub ifi_typelen: c_uchar,
1507 pub ifi_physical: c_uchar,
1508 pub ifi_addrlen: c_uchar,
1509 pub ifi_hdrlen: c_uchar,
1510 pub ifi_recvquota: c_uchar,
1511 pub ifi_xmitquota: c_uchar,
1512 pub ifi_unused1: c_uchar,
1513 pub ifi_mtu: u32,
1514 pub ifi_metric: u32,
1515 pub ifi_baudrate: u64,
1516 pub ifi_ipackets: u64,
1517 pub ifi_ierrors: u64,
1518 pub ifi_opackets: u64,
1519 pub ifi_oerrors: u64,
1520 pub ifi_collisions: u64,
1521 pub ifi_ibytes: u64,
1522 pub ifi_obytes: u64,
1523 pub ifi_imcasts: u64,
1524 pub ifi_omcasts: u64,
1525 pub ifi_iqdrops: u64,
1526 pub ifi_noproto: u64,
1527 pub ifi_recvtiming: u32,
1528 pub ifi_xmittiming: u32,
1529 #[cfg(target_pointer_width = "32")]
1530 pub ifi_lastchange: crate::timeval,
1531 #[cfg(not(target_pointer_width = "32"))]
1532 pub ifi_lastchange: timeval32,
1533 }
1534
1535 #[repr(packed(4))]
1536 pub struct if_msghdr2 {
1537 pub ifm_msglen: c_ushort,
1538 pub ifm_version: c_uchar,
1539 pub ifm_type: c_uchar,
1540 pub ifm_addrs: c_int,
1541 pub ifm_flags: c_int,
1542 pub ifm_index: c_ushort,
1543 pub ifm_snd_len: c_int,
1544 pub ifm_snd_maxlen: c_int,
1545 pub ifm_snd_drops: c_int,
1546 pub ifm_timer: c_int,
1547 pub ifm_data: if_data64,
1548 }
1549
1550 #[repr(packed(8))]
1551 pub struct vm_statistics64 {
1552 pub free_count: natural_t,
1553 pub active_count: natural_t,
1554 pub inactive_count: natural_t,
1555 pub wire_count: natural_t,
1556 pub zero_fill_count: u64,
1557 pub reactivations: u64,
1558 pub pageins: u64,
1559 pub pageouts: u64,
1560 pub faults: u64,
1561 pub cow_faults: u64,
1562 pub lookups: u64,
1563 pub hits: u64,
1564 pub purges: u64,
1565 pub purgeable_count: natural_t,
1566 pub speculative_count: natural_t,
1567 pub decompressions: u64,
1568 pub compressions: u64,
1569 pub swapins: u64,
1570 pub swapouts: u64,
1571 pub compressor_page_count: natural_t,
1572 pub throttled_count: natural_t,
1573 pub external_page_count: natural_t,
1574 pub internal_page_count: natural_t,
1575 pub total_uncompressed_pages_in_compressor: u64,
1576 }
1577
1578 #[repr(packed(4))]
1579 pub struct mach_task_basic_info {
1580 pub virtual_size: mach_vm_size_t,
1581 pub resident_size: mach_vm_size_t,
1582 pub resident_size_max: mach_vm_size_t,
1583 pub user_time: time_value_t,
1584 pub system_time: time_value_t,
1585 pub policy: crate::policy_t,
1586 pub suspend_count: integer_t,
1587 }
1588
1589 #[repr(packed(4))]
1590 pub struct log2phys {
1591 pub l2p_flags: c_uint,
1592 pub l2p_contigbytes: off_t,
1593 pub l2p_devoffset: off_t,
1594 }
1595
1596 pub struct os_unfair_lock_s {
1597 _os_unfair_lock_opaque: u32,
1598 }
1599
1600 #[repr(packed(1))]
1601 pub struct sockaddr_vm {
1602 pub svm_len: c_uchar,
1603 pub svm_family: crate::sa_family_t,
1604 pub svm_reserved1: c_ushort,
1605 pub svm_port: c_uint,
1606 pub svm_cid: c_uint,
1607 }
1608
1609 pub struct ifdevmtu {
1610 pub ifdm_current: c_int,
1611 pub ifdm_min: c_int,
1612 pub ifdm_max: c_int,
1613 }
1614
1615 pub union __c_anonymous_ifk_data {
1616 pub ifk_ptr: *mut c_void,
1617 pub ifk_value: c_int,
1618 }
1619
1620 #[repr(packed(4))]
1621 pub struct ifkpi {
1622 pub ifk_module_id: c_uint,
1623 pub ifk_type: c_uint,
1624 pub ifk_data: __c_anonymous_ifk_data,
1625 }
1626
1627 pub union __c_anonymous_ifr_ifru {
1628 pub ifru_addr: crate::sockaddr,
1629 pub ifru_dstaddr: crate::sockaddr,
1630 pub ifru_broadaddr: crate::sockaddr,
1631 pub ifru_flags: c_short,
1632 pub ifru_metrics: c_int,
1633 pub ifru_mtu: c_int,
1634 pub ifru_phys: c_int,
1635 pub ifru_media: c_int,
1636 pub ifru_intval: c_int,
1637 pub ifru_data: *mut c_char,
1638 pub ifru_devmtu: ifdevmtu,
1639 pub ifru_kpi: ifkpi,
1640 pub ifru_wake_flags: u32,
1641 pub ifru_route_refcnt: u32,
1642 pub ifru_cap: [c_int; 2],
1643 pub ifru_functional_type: u32,
1644 }
1645
1646 pub struct ifreq {
1647 pub ifr_name: [c_char; crate::IFNAMSIZ],
1648 pub ifr_ifru: __c_anonymous_ifr_ifru,
1649 }
1650
1651 pub union __c_anonymous_ifc_ifcu {
1652 pub ifcu_buf: *mut c_char,
1653 pub ifcu_req: *mut ifreq,
1654 }
1655
1656 pub union __c_anonymous_ifr_ifru6 {
1657 pub ifru_addr: crate::sockaddr_in6,
1658 pub ifru_dstaddr: crate::sockaddr_in6,
1659 pub ifru_flags: c_int,
1660 pub ifru_flags6: c_int,
1661 pub ifru_metrics: c_int,
1662 pub ifru_intval: c_int,
1663 pub ifru_data: *mut c_char,
1664 pub ifru_lifetime: in6_addrlifetime,
1665 pub ifru_stat: in6_ifstat,
1666 pub ifru_icmp6stat: icmp6_ifstat,
1667 pub ifru_scope_id: [u32; SCOPE6_ID_MAX],
1668 }
1669
1670 pub struct in6_ifreq {
1671 pub ifr_name: [c_char; crate::IFNAMSIZ],
1672 pub ifr_ifru: __c_anonymous_ifr_ifru6,
1673 }
1674 }
1675
1676 impl siginfo_t {
1677 pub unsafe fn si_addr(&self) -> *mut c_void {
1678 self.si_addr
1679 }
1680
1681 pub unsafe fn si_value(&self) -> crate::sigval {
1682 #[repr(C)]
1683 struct siginfo_timer {
1684 _si_signo: c_int,
1685 _si_errno: c_int,
1686 _si_code: c_int,
1687 _si_pid: crate::pid_t,
1688 _si_uid: crate::uid_t,
1689 _si_status: c_int,
1690 _si_addr: *mut c_void,
1691 si_value: crate::sigval,
1692 }
1693
1694 (*(self as *const siginfo_t as *const siginfo_timer)).si_value
1695 }
1696
1697 pub unsafe fn si_pid(&self) -> crate::pid_t {
1698 self.si_pid
1699 }
1700
1701 pub unsafe fn si_uid(&self) -> crate::uid_t {
1702 self.si_uid
1703 }
1704
1705 pub unsafe fn si_status(&self) -> c_int {
1706 self.si_status
1707 }
1708 }
1709
1710 s_no_extra_traits! {
1711 pub union semun {
1712 pub val: c_int,
1713 pub buf: *mut semid_ds,
1714 pub array: *mut c_ushort,
1715 }
1716 }
1717
1718 cfg_if! {
1719 if #[cfg(feature = "extra_traits")] {
1720 impl PartialEq for semun {
1721 fn eq(&self, other: &semun) -> bool {
1722 unsafe { self.val == other.val }
1723 }
1724 }
1725 impl Eq for semun {}
1726 impl hash::Hash for semun {
1727 fn hash<H: hash::Hasher>(&self, state: &mut H) {
1728 unsafe { self.val.hash(state) };
1729 }
1730 }
1731 }
1732 }
1733
1734 cfg_if! {
1735 if #[cfg(feature = "extra_traits")] {
1736 impl PartialEq for ifconf
1737 where
1738 Self: Copy,
1739 {
1740 fn eq(&self, other: &Self) -> bool {
1741 let len_ptr1 = core::ptr::addr_of!(self.ifc_len);
1742 let len_ptr2 = core::ptr::addr_of!(other.ifc_len);
1743 let ifcu_ptr1 = core::ptr::addr_of!(self.ifc_ifcu);
1744 let ifcu_ptr2 = core::ptr::addr_of!(other.ifc_ifcu);
1745
1746 // SAFETY: `ifconf` implements `Copy` so the reads are valid
1747 let len1 = unsafe { len_ptr1.read_unaligned() };
1748 let len2 = unsafe { len_ptr2.read_unaligned() };
1749 let ifcu1 = unsafe { ifcu_ptr1.read_unaligned() };
1750 let ifcu2 = unsafe { ifcu_ptr2.read_unaligned() };
1751
1752 len1 == len2 && ifcu1 == ifcu2
1753 }
1754 }
1755 impl Eq for ifconf {}
1756 impl fmt::Debug for ifconf {
1757 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
1758 f.debug_struct("ifconf").finish_non_exhaustive()
1759 }
1760 }
1761
1762 impl PartialEq for kevent {
1763 fn eq(&self, other: &kevent) -> bool {
1764 self.ident == other.ident
1765 && self.filter == other.filter
1766 && self.flags == other.flags
1767 && self.fflags == other.fflags
1768 && self.data == other.data
1769 && self.udata == other.udata
1770 }
1771 }
1772 impl Eq for kevent {}
1773 impl fmt::Debug for kevent {
1774 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
1775 let ident = self.ident;
1776 let filter = self.filter;
1777 let flags = self.flags;
1778 let fflags = self.fflags;
1779 let data = self.data;
1780 let udata = self.udata;
1781 f.debug_struct("kevent")
1782 .field("ident", &ident)
1783 .field("filter", &filter)
1784 .field("flags", &flags)
1785 .field("fflags", &fflags)
1786 .field("data", &data)
1787 .field("udata", &udata)
1788 .finish()
1789 }
1790 }
1791 impl hash::Hash for kevent {
1792 fn hash<H: hash::Hasher>(&self, state: &mut H) {
1793 let ident = self.ident;
1794 let filter = self.filter;
1795 let flags = self.flags;
1796 let fflags = self.fflags;
1797 let data = self.data;
1798 let udata = self.udata;
1799 ident.hash(state);
1800 filter.hash(state);
1801 flags.hash(state);
1802 fflags.hash(state);
1803 data.hash(state);
1804 udata.hash(state);
1805 }
1806 }
1807
1808 impl PartialEq for semid_ds {
1809 fn eq(&self, other: &semid_ds) -> bool {
1810 let sem_perm = self.sem_perm;
1811 let sem_pad3 = self.sem_pad3;
1812 let other_sem_perm = other.sem_perm;
1813 let other_sem_pad3 = other.sem_pad3;
1814 sem_perm == other_sem_perm
1815 && self.sem_base == other.sem_base
1816 && self.sem_nsems == other.sem_nsems
1817 && self.sem_otime == other.sem_otime
1818 && self.sem_pad1 == other.sem_pad1
1819 && self.sem_ctime == other.sem_ctime
1820 && self.sem_pad2 == other.sem_pad2
1821 && sem_pad3 == other_sem_pad3
1822 }
1823 }
1824 impl Eq for semid_ds {}
1825 impl fmt::Debug for semid_ds {
1826 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
1827 let sem_perm = self.sem_perm;
1828 let sem_base = self.sem_base;
1829 let sem_nsems = self.sem_nsems;
1830 let sem_otime = self.sem_otime;
1831 let sem_pad1 = self.sem_pad1;
1832 let sem_ctime = self.sem_ctime;
1833 let sem_pad2 = self.sem_pad2;
1834 let sem_pad3 = self.sem_pad3;
1835 f.debug_struct("semid_ds")
1836 .field("sem_perm", &sem_perm)
1837 .field("sem_base", &sem_base)
1838 .field("sem_nsems", &sem_nsems)
1839 .field("sem_otime", &sem_otime)
1840 .field("sem_pad1", &sem_pad1)
1841 .field("sem_ctime", &sem_ctime)
1842 .field("sem_pad2", &sem_pad2)
1843 .field("sem_pad3", &sem_pad3)
1844 .finish()
1845 }
1846 }
1847 impl hash::Hash for semid_ds {
1848 fn hash<H: hash::Hasher>(&self, state: &mut H) {
1849 let sem_perm = self.sem_perm;
1850 let sem_base = self.sem_base;
1851 let sem_nsems = self.sem_nsems;
1852 let sem_otime = self.sem_otime;
1853 let sem_pad1 = self.sem_pad1;
1854 let sem_ctime = self.sem_ctime;
1855 let sem_pad2 = self.sem_pad2;
1856 let sem_pad3 = self.sem_pad3;
1857 sem_perm.hash(state);
1858 sem_base.hash(state);
1859 sem_nsems.hash(state);
1860 sem_otime.hash(state);
1861 sem_pad1.hash(state);
1862 sem_ctime.hash(state);
1863 sem_pad2.hash(state);
1864 sem_pad3.hash(state);
1865 }
1866 }
1867
1868 impl PartialEq for shmid_ds {
1869 fn eq(&self, other: &shmid_ds) -> bool {
1870 let shm_perm = self.shm_perm;
1871 let other_shm_perm = other.shm_perm;
1872 shm_perm == other_shm_perm
1873 && self.shm_segsz == other.shm_segsz
1874 && self.shm_lpid == other.shm_lpid
1875 && self.shm_cpid == other.shm_cpid
1876 && self.shm_nattch == other.shm_nattch
1877 && self.shm_atime == other.shm_atime
1878 && self.shm_dtime == other.shm_dtime
1879 && self.shm_ctime == other.shm_ctime
1880 && self.shm_internal == other.shm_internal
1881 }
1882 }
1883 impl Eq for shmid_ds {}
1884 impl fmt::Debug for shmid_ds {
1885 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
1886 let shm_perm = self.shm_perm;
1887 let shm_segsz = self.shm_segsz;
1888 let shm_lpid = self.shm_lpid;
1889 let shm_cpid = self.shm_cpid;
1890 let shm_nattch = self.shm_nattch;
1891 let shm_atime = self.shm_atime;
1892 let shm_dtime = self.shm_dtime;
1893 let shm_ctime = self.shm_ctime;
1894 let shm_internal = self.shm_internal;
1895 f.debug_struct("shmid_ds")
1896 .field("shm_perm", &shm_perm)
1897 .field("shm_segsz", &shm_segsz)
1898 .field("shm_lpid", &shm_lpid)
1899 .field("shm_cpid", &shm_cpid)
1900 .field("shm_nattch", &shm_nattch)
1901 .field("shm_atime", &shm_atime)
1902 .field("shm_dtime", &shm_dtime)
1903 .field("shm_ctime", &shm_ctime)
1904 .field("shm_internal", &shm_internal)
1905 .finish()
1906 }
1907 }
1908 impl hash::Hash for shmid_ds {
1909 fn hash<H: hash::Hasher>(&self, state: &mut H) {
1910 let shm_perm = self.shm_perm;
1911 let shm_segsz = self.shm_segsz;
1912 let shm_lpid = self.shm_lpid;
1913 let shm_cpid = self.shm_cpid;
1914 let shm_nattch = self.shm_nattch;
1915 let shm_atime = self.shm_atime;
1916 let shm_dtime = self.shm_dtime;
1917 let shm_ctime = self.shm_ctime;
1918 let shm_internal = self.shm_internal;
1919 shm_perm.hash(state);
1920 shm_segsz.hash(state);
1921 shm_lpid.hash(state);
1922 shm_cpid.hash(state);
1923 shm_nattch.hash(state);
1924 shm_atime.hash(state);
1925 shm_dtime.hash(state);
1926 shm_ctime.hash(state);
1927 shm_internal.hash(state);
1928 }
1929 }
1930
1931 impl PartialEq for proc_threadinfo {
1932 fn eq(&self, other: &proc_threadinfo) -> bool {
1933 self.pth_user_time == other.pth_user_time
1934 && self.pth_system_time == other.pth_system_time
1935 && self.pth_cpu_usage == other.pth_cpu_usage
1936 && self.pth_policy == other.pth_policy
1937 && self.pth_run_state == other.pth_run_state
1938 && self.pth_flags == other.pth_flags
1939 && self.pth_sleep_time == other.pth_sleep_time
1940 && self.pth_curpri == other.pth_curpri
1941 && self.pth_priority == other.pth_priority
1942 && self.pth_maxpriority == other.pth_maxpriority
1943 && self
1944 .pth_name
1945 .iter()
1946 .zip(other.pth_name.iter())
1947 .all(|(a, b)| a == b)
1948 }
1949 }
1950 impl Eq for proc_threadinfo {}
1951 impl fmt::Debug for proc_threadinfo {
1952 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
1953 f.debug_struct("proc_threadinfo")
1954 .field("pth_user_time", &self.pth_user_time)
1955 .field("pth_system_time", &self.pth_system_time)
1956 .field("pth_cpu_usage", &self.pth_cpu_usage)
1957 .field("pth_policy", &self.pth_policy)
1958 .field("pth_run_state", &self.pth_run_state)
1959 .field("pth_flags", &self.pth_flags)
1960 .field("pth_sleep_time", &self.pth_sleep_time)
1961 .field("pth_curpri", &self.pth_curpri)
1962 .field("pth_priority", &self.pth_priority)
1963 .field("pth_maxpriority", &self.pth_maxpriority)
1964 // FIXME(debug): .field("pth_name", &self.pth_name)
1965 .finish()
1966 }
1967 }
1968 impl hash::Hash for proc_threadinfo {
1969 fn hash<H: hash::Hasher>(&self, state: &mut H) {
1970 self.pth_user_time.hash(state);
1971 self.pth_system_time.hash(state);
1972 self.pth_cpu_usage.hash(state);
1973 self.pth_policy.hash(state);
1974 self.pth_run_state.hash(state);
1975 self.pth_flags.hash(state);
1976 self.pth_sleep_time.hash(state);
1977 self.pth_curpri.hash(state);
1978 self.pth_priority.hash(state);
1979 self.pth_maxpriority.hash(state);
1980 self.pth_name.hash(state);
1981 }
1982 }
1983
1984 impl PartialEq for statfs {
1985 fn eq(&self, other: &statfs) -> bool {
1986 self.f_bsize == other.f_bsize
1987 && self.f_iosize == other.f_iosize
1988 && self.f_blocks == other.f_blocks
1989 && self.f_bfree == other.f_bfree
1990 && self.f_bavail == other.f_bavail
1991 && self.f_files == other.f_files
1992 && self.f_ffree == other.f_ffree
1993 && self.f_fsid == other.f_fsid
1994 && self.f_owner == other.f_owner
1995 && self.f_flags == other.f_flags
1996 && self.f_fssubtype == other.f_fssubtype
1997 && self.f_fstypename == other.f_fstypename
1998 && self.f_type == other.f_type
1999 && self
2000 .f_mntonname
2001 .iter()
2002 .zip(other.f_mntonname.iter())
2003 .all(|(a, b)| a == b)
2004 && self
2005 .f_mntfromname
2006 .iter()
2007 .zip(other.f_mntfromname.iter())
2008 .all(|(a, b)| a == b)
2009 && self.f_reserved == other.f_reserved
2010 }
2011 }
2012
2013 impl Eq for statfs {}
2014 impl fmt::Debug for statfs {
2015 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
2016 f.debug_struct("statfs")
2017 .field("f_bsize", &self.f_bsize)
2018 .field("f_iosize", &self.f_iosize)
2019 .field("f_blocks", &self.f_blocks)
2020 .field("f_bfree", &self.f_bfree)
2021 .field("f_bavail", &self.f_bavail)
2022 .field("f_files", &self.f_files)
2023 .field("f_ffree", &self.f_ffree)
2024 .field("f_fsid", &self.f_fsid)
2025 .field("f_owner", &self.f_owner)
2026 .field("f_flags", &self.f_flags)
2027 .field("f_fssubtype", &self.f_fssubtype)
2028 .field("f_fstypename", &self.f_fstypename)
2029 .field("f_type", &self.f_type)
2030 // FIXME(debug): .field("f_mntonname", &self.f_mntonname)
2031 // FIXME(debug): .field("f_mntfromname", &self.f_mntfromname)
2032 .field("f_reserved", &self.f_reserved)
2033 .finish()
2034 }
2035 }
2036
2037 impl hash::Hash for statfs {
2038 fn hash<H: hash::Hasher>(&self, state: &mut H) {
2039 self.f_bsize.hash(state);
2040 self.f_iosize.hash(state);
2041 self.f_blocks.hash(state);
2042 self.f_bfree.hash(state);
2043 self.f_bavail.hash(state);
2044 self.f_files.hash(state);
2045 self.f_ffree.hash(state);
2046 self.f_fsid.hash(state);
2047 self.f_owner.hash(state);
2048 self.f_flags.hash(state);
2049 self.f_fssubtype.hash(state);
2050 self.f_fstypename.hash(state);
2051 self.f_type.hash(state);
2052 self.f_mntonname.hash(state);
2053 self.f_mntfromname.hash(state);
2054 self.f_reserved.hash(state);
2055 }
2056 }
2057
2058 impl PartialEq for dirent {
2059 fn eq(&self, other: &dirent) -> bool {
2060 self.d_ino == other.d_ino
2061 && self.d_seekoff == other.d_seekoff
2062 && self.d_reclen == other.d_reclen
2063 && self.d_namlen == other.d_namlen
2064 && self.d_type == other.d_type
2065 && self
2066 .d_name
2067 .iter()
2068 .zip(other.d_name.iter())
2069 .all(|(a, b)| a == b)
2070 }
2071 }
2072 impl Eq for dirent {}
2073 impl fmt::Debug for dirent {
2074 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
2075 f.debug_struct("dirent")
2076 .field("d_ino", &self.d_ino)
2077 .field("d_seekoff", &self.d_seekoff)
2078 .field("d_reclen", &self.d_reclen)
2079 .field("d_namlen", &self.d_namlen)
2080 .field("d_type", &self.d_type)
2081 // FIXME(debug): .field("d_name", &self.d_name)
2082 .finish()
2083 }
2084 }
2085 impl hash::Hash for dirent {
2086 fn hash<H: hash::Hasher>(&self, state: &mut H) {
2087 self.d_ino.hash(state);
2088 self.d_seekoff.hash(state);
2089 self.d_reclen.hash(state);
2090 self.d_namlen.hash(state);
2091 self.d_type.hash(state);
2092 self.d_name.hash(state);
2093 }
2094 }
2095 impl PartialEq for pthread_rwlock_t {
2096 fn eq(&self, other: &pthread_rwlock_t) -> bool {
2097 self.__sig == other.__sig
2098 && self
2099 .__opaque
2100 .iter()
2101 .zip(other.__opaque.iter())
2102 .all(|(a, b)| a == b)
2103 }
2104 }
2105 impl Eq for pthread_rwlock_t {}
2106 impl fmt::Debug for pthread_rwlock_t {
2107 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
2108 f.debug_struct("pthread_rwlock_t")
2109 .field("__sig", &self.__sig)
2110 // FIXME(debug): .field("__opaque", &self.__opaque)
2111 .finish()
2112 }
2113 }
2114 impl hash::Hash for pthread_rwlock_t {
2115 fn hash<H: hash::Hasher>(&self, state: &mut H) {
2116 self.__sig.hash(state);
2117 self.__opaque.hash(state);
2118 }
2119 }
2120
2121 impl PartialEq for pthread_mutex_t {
2122 fn eq(&self, other: &pthread_mutex_t) -> bool {
2123 self.__sig == other.__sig
2124 && self
2125 .__opaque
2126 .iter()
2127 .zip(other.__opaque.iter())
2128 .all(|(a, b)| a == b)
2129 }
2130 }
2131
2132 impl Eq for pthread_mutex_t {}
2133
2134 impl fmt::Debug for pthread_mutex_t {
2135 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
2136 f.debug_struct("pthread_mutex_t")
2137 .field("__sig", &self.__sig)
2138 // FIXME(debug): .field("__opaque", &self.__opaque)
2139 .finish()
2140 }
2141 }
2142
2143 impl hash::Hash for pthread_mutex_t {
2144 fn hash<H: hash::Hasher>(&self, state: &mut H) {
2145 self.__sig.hash(state);
2146 self.__opaque.hash(state);
2147 }
2148 }
2149
2150 impl PartialEq for pthread_cond_t {
2151 fn eq(&self, other: &pthread_cond_t) -> bool {
2152 self.__sig == other.__sig
2153 && self
2154 .__opaque
2155 .iter()
2156 .zip(other.__opaque.iter())
2157 .all(|(a, b)| a == b)
2158 }
2159 }
2160
2161 impl Eq for pthread_cond_t {}
2162
2163 impl fmt::Debug for pthread_cond_t {
2164 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
2165 f.debug_struct("pthread_cond_t")
2166 .field("__sig", &self.__sig)
2167 // FIXME(debug): .field("__opaque", &self.__opaque)
2168 .finish()
2169 }
2170 }
2171
2172 impl hash::Hash for pthread_cond_t {
2173 fn hash<H: hash::Hasher>(&self, state: &mut H) {
2174 self.__sig.hash(state);
2175 self.__opaque.hash(state);
2176 }
2177 }
2178
2179 impl PartialEq for sockaddr_storage {
2180 fn eq(&self, other: &sockaddr_storage) -> bool {
2181 self.ss_len == other.ss_len
2182 && self.ss_family == other.ss_family
2183 && self
2184 .__ss_pad1
2185 .iter()
2186 .zip(other.__ss_pad1.iter())
2187 .all(|(a, b)| a == b)
2188 && self.__ss_align == other.__ss_align
2189 && self
2190 .__ss_pad2
2191 .iter()
2192 .zip(other.__ss_pad2.iter())
2193 .all(|(a, b)| a == b)
2194 }
2195 }
2196
2197 impl Eq for sockaddr_storage {}
2198
2199 impl fmt::Debug for sockaddr_storage {
2200 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
2201 f.debug_struct("sockaddr_storage")
2202 .field("ss_len", &self.ss_len)
2203 .field("ss_family", &self.ss_family)
2204 .field("__ss_pad1", &self.__ss_pad1)
2205 .field("__ss_align", &self.__ss_align)
2206 // FIXME(debug): .field("__ss_pad2", &self.__ss_pad2)
2207 .finish()
2208 }
2209 }
2210
2211 impl hash::Hash for sockaddr_storage {
2212 fn hash<H: hash::Hasher>(&self, state: &mut H) {
2213 self.ss_len.hash(state);
2214 self.ss_family.hash(state);
2215 self.__ss_pad1.hash(state);
2216 self.__ss_align.hash(state);
2217 self.__ss_pad2.hash(state);
2218 }
2219 }
2220
2221 impl PartialEq for utmpx {
2222 fn eq(&self, other: &utmpx) -> bool {
2223 self.ut_user
2224 .iter()
2225 .zip(other.ut_user.iter())
2226 .all(|(a, b)| a == b)
2227 && self.ut_id == other.ut_id
2228 && self.ut_line == other.ut_line
2229 && self.ut_pid == other.ut_pid
2230 && self.ut_type == other.ut_type
2231 && self.ut_tv == other.ut_tv
2232 && self
2233 .ut_host
2234 .iter()
2235 .zip(other.ut_host.iter())
2236 .all(|(a, b)| a == b)
2237 && self.ut_pad == other.ut_pad
2238 }
2239 }
2240
2241 impl Eq for utmpx {}
2242
2243 impl fmt::Debug for utmpx {
2244 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
2245 f.debug_struct("utmpx")
2246 // FIXME(debug): .field("ut_user", &self.ut_user)
2247 .field("ut_id", &self.ut_id)
2248 .field("ut_line", &self.ut_line)
2249 .field("ut_pid", &self.ut_pid)
2250 .field("ut_type", &self.ut_type)
2251 .field("ut_tv", &self.ut_tv)
2252 // FIXME(debug): .field("ut_host", &self.ut_host)
2253 .field("ut_pad", &self.ut_pad)
2254 .finish()
2255 }
2256 }
2257
2258 impl hash::Hash for utmpx {
2259 fn hash<H: hash::Hasher>(&self, state: &mut H) {
2260 self.ut_user.hash(state);
2261 self.ut_id.hash(state);
2262 self.ut_line.hash(state);
2263 self.ut_pid.hash(state);
2264 self.ut_type.hash(state);
2265 self.ut_tv.hash(state);
2266 self.ut_host.hash(state);
2267 self.ut_pad.hash(state);
2268 }
2269 }
2270
2271 impl PartialEq for sigevent {
2272 fn eq(&self, other: &sigevent) -> bool {
2273 self.sigev_notify == other.sigev_notify
2274 && self.sigev_signo == other.sigev_signo
2275 && self.sigev_value == other.sigev_value
2276 && self.sigev_notify_attributes == other.sigev_notify_attributes
2277 }
2278 }
2279
2280 impl Eq for sigevent {}
2281
2282 impl fmt::Debug for sigevent {
2283 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
2284 f.debug_struct("sigevent")
2285 .field("sigev_notify", &self.sigev_notify)
2286 .field("sigev_signo", &self.sigev_signo)
2287 .field("sigev_value", &self.sigev_value)
2288 .field("sigev_notify_attributes", &self.sigev_notify_attributes)
2289 .finish()
2290 }
2291 }
2292
2293 impl hash::Hash for sigevent {
2294 fn hash<H: hash::Hasher>(&self, state: &mut H) {
2295 self.sigev_notify.hash(state);
2296 self.sigev_signo.hash(state);
2297 self.sigev_value.hash(state);
2298 self.sigev_notify_attributes.hash(state);
2299 }
2300 }
2301
2302 impl PartialEq for processor_cpu_load_info {
2303 fn eq(&self, other: &processor_cpu_load_info) -> bool {
2304 self.cpu_ticks == other.cpu_ticks
2305 }
2306 }
2307 impl Eq for processor_cpu_load_info {}
2308 impl fmt::Debug for processor_cpu_load_info {
2309 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
2310 f.debug_struct("processor_cpu_load_info")
2311 .field("cpu_ticks", &self.cpu_ticks)
2312 .finish()
2313 }
2314 }
2315 impl hash::Hash for processor_cpu_load_info {
2316 fn hash<H: hash::Hasher>(&self, state: &mut H) {
2317 self.cpu_ticks.hash(state);
2318 }
2319 }
2320
2321 impl PartialEq for processor_basic_info {
2322 fn eq(&self, other: &processor_basic_info) -> bool {
2323 self.cpu_type == other.cpu_type
2324 && self.cpu_subtype == other.cpu_subtype
2325 && self.running == other.running
2326 && self.slot_num == other.slot_num
2327 && self.is_master == other.is_master
2328 }
2329 }
2330 impl Eq for processor_basic_info {}
2331 impl fmt::Debug for processor_basic_info {
2332 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
2333 f.debug_struct("processor_basic_info")
2334 .field("cpu_type", &self.cpu_type)
2335 .field("cpu_subtype", &self.cpu_subtype)
2336 .field("running", &self.running)
2337 .field("slot_num", &self.slot_num)
2338 .field("is_master", &self.is_master)
2339 .finish()
2340 }
2341 }
2342 impl hash::Hash for processor_basic_info {
2343 fn hash<H: hash::Hasher>(&self, state: &mut H) {
2344 self.cpu_type.hash(state);
2345 self.cpu_subtype.hash(state);
2346 self.running.hash(state);
2347 self.slot_num.hash(state);
2348 self.is_master.hash(state);
2349 }
2350 }
2351
2352 impl PartialEq for processor_set_basic_info {
2353 fn eq(&self, other: &processor_set_basic_info) -> bool {
2354 self.processor_count == other.processor_count
2355 && self.default_policy == other.default_policy
2356 }
2357 }
2358 impl Eq for processor_set_basic_info {}
2359 impl fmt::Debug for processor_set_basic_info {
2360 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
2361 f.debug_struct("processor_set_basic_info")
2362 .field("processor_count", &self.processor_count)
2363 .field("default_policy", &self.default_policy)
2364 .finish()
2365 }
2366 }
2367 impl hash::Hash for processor_set_basic_info {
2368 fn hash<H: hash::Hasher>(&self, state: &mut H) {
2369 self.processor_count.hash(state);
2370 self.default_policy.hash(state);
2371 }
2372 }
2373
2374 impl PartialEq for processor_set_load_info {
2375 fn eq(&self, other: &processor_set_load_info) -> bool {
2376 self.task_count == other.task_count
2377 && self.thread_count == other.thread_count
2378 && self.load_average == other.load_average
2379 && self.mach_factor == other.mach_factor
2380 }
2381 }
2382 impl Eq for processor_set_load_info {}
2383 impl fmt::Debug for processor_set_load_info {
2384 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
2385 f.debug_struct("processor_set_load_info")
2386 .field("task_count", &self.task_count)
2387 .field("thread_count", &self.thread_count)
2388 .field("load_average", &self.load_average)
2389 .field("mach_factor", &self.mach_factor)
2390 .finish()
2391 }
2392 }
2393 impl hash::Hash for processor_set_load_info {
2394 fn hash<H: hash::Hasher>(&self, state: &mut H) {
2395 self.task_count.hash(state);
2396 self.thread_count.hash(state);
2397 self.load_average.hash(state);
2398 self.mach_factor.hash(state);
2399 }
2400 }
2401
2402 impl PartialEq for time_value_t {
2403 fn eq(&self, other: &time_value_t) -> bool {
2404 self.seconds == other.seconds && self.microseconds == other.microseconds
2405 }
2406 }
2407 impl Eq for time_value_t {}
2408 impl fmt::Debug for time_value_t {
2409 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
2410 f.debug_struct("time_value_t")
2411 .field("seconds", &self.seconds)
2412 .field("microseconds", &self.microseconds)
2413 .finish()
2414 }
2415 }
2416 impl hash::Hash for time_value_t {
2417 fn hash<H: hash::Hasher>(&self, state: &mut H) {
2418 self.seconds.hash(state);
2419 self.microseconds.hash(state);
2420 }
2421 }
2422 impl PartialEq for thread_basic_info {
2423 fn eq(&self, other: &thread_basic_info) -> bool {
2424 self.user_time == other.user_time
2425 && self.system_time == other.system_time
2426 && self.cpu_usage == other.cpu_usage
2427 && self.policy == other.policy
2428 && self.run_state == other.run_state
2429 && self.flags == other.flags
2430 && self.suspend_count == other.suspend_count
2431 && self.sleep_time == other.sleep_time
2432 }
2433 }
2434 impl Eq for thread_basic_info {}
2435 impl fmt::Debug for thread_basic_info {
2436 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
2437 f.debug_struct("thread_basic_info")
2438 .field("user_time", &self.user_time)
2439 .field("system_time", &self.system_time)
2440 .field("cpu_usage", &self.cpu_usage)
2441 .field("policy", &self.policy)
2442 .field("run_state", &self.run_state)
2443 .field("flags", &self.flags)
2444 .field("suspend_count", &self.suspend_count)
2445 .field("sleep_time", &self.sleep_time)
2446 .finish()
2447 }
2448 }
2449 impl hash::Hash for thread_basic_info {
2450 fn hash<H: hash::Hasher>(&self, state: &mut H) {
2451 self.user_time.hash(state);
2452 self.system_time.hash(state);
2453 self.cpu_usage.hash(state);
2454 self.policy.hash(state);
2455 self.run_state.hash(state);
2456 self.flags.hash(state);
2457 self.suspend_count.hash(state);
2458 self.sleep_time.hash(state);
2459 }
2460 }
2461 impl PartialEq for thread_extended_info {
2462 fn eq(&self, other: &thread_extended_info) -> bool {
2463 self.pth_user_time == other.pth_user_time
2464 && self.pth_system_time == other.pth_system_time
2465 && self.pth_cpu_usage == other.pth_cpu_usage
2466 && self.pth_policy == other.pth_policy
2467 && self.pth_run_state == other.pth_run_state
2468 && self.pth_flags == other.pth_flags
2469 && self.pth_sleep_time == other.pth_sleep_time
2470 && self.pth_curpri == other.pth_curpri
2471 && self.pth_priority == other.pth_priority
2472 && self.pth_maxpriority == other.pth_maxpriority
2473 && self
2474 .pth_name
2475 .iter()
2476 .zip(other.pth_name.iter())
2477 .all(|(a, b)| a == b)
2478 }
2479 }
2480 impl Eq for thread_extended_info {}
2481 impl fmt::Debug for thread_extended_info {
2482 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
2483 f.debug_struct("proc_threadinfo")
2484 .field("pth_user_time", &self.pth_user_time)
2485 .field("pth_system_time", &self.pth_system_time)
2486 .field("pth_cpu_usage", &self.pth_cpu_usage)
2487 .field("pth_policy", &self.pth_policy)
2488 .field("pth_run_state", &self.pth_run_state)
2489 .field("pth_flags", &self.pth_flags)
2490 .field("pth_sleep_time", &self.pth_sleep_time)
2491 .field("pth_curpri", &self.pth_curpri)
2492 .field("pth_priority", &self.pth_priority)
2493 .field("pth_maxpriority", &self.pth_maxpriority)
2494 // FIXME(debug): .field("pth_name", &self.pth_name)
2495 .finish()
2496 }
2497 }
2498 impl hash::Hash for thread_extended_info {
2499 fn hash<H: hash::Hasher>(&self, state: &mut H) {
2500 self.pth_user_time.hash(state);
2501 self.pth_system_time.hash(state);
2502 self.pth_cpu_usage.hash(state);
2503 self.pth_policy.hash(state);
2504 self.pth_run_state.hash(state);
2505 self.pth_flags.hash(state);
2506 self.pth_sleep_time.hash(state);
2507 self.pth_curpri.hash(state);
2508 self.pth_priority.hash(state);
2509 self.pth_maxpriority.hash(state);
2510 self.pth_name.hash(state);
2511 }
2512 }
2513 impl PartialEq for thread_identifier_info {
2514 fn eq(&self, other: &thread_identifier_info) -> bool {
2515 self.thread_id == other.thread_id
2516 && self.thread_handle == other.thread_handle
2517 && self.dispatch_qaddr == other.dispatch_qaddr
2518 }
2519 }
2520 impl Eq for thread_identifier_info {}
2521 impl fmt::Debug for thread_identifier_info {
2522 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
2523 f.debug_struct("thread_identifier_info")
2524 .field("thread_id", &self.thread_id)
2525 .field("thread_handle", &self.thread_handle)
2526 .field("dispatch_qaddr", &self.dispatch_qaddr)
2527 .finish()
2528 }
2529 }
2530 impl hash::Hash for thread_identifier_info {
2531 fn hash<H: hash::Hasher>(&self, state: &mut H) {
2532 self.thread_id.hash(state);
2533 self.thread_handle.hash(state);
2534 self.dispatch_qaddr.hash(state);
2535 }
2536 }
2537 impl PartialEq for if_data64 {
2538 fn eq(&self, other: &if_data64) -> bool {
2539 self.ifi_type == other.ifi_type
2540 && self.ifi_typelen == other.ifi_typelen
2541 && self.ifi_physical == other.ifi_physical
2542 && self.ifi_addrlen == other.ifi_addrlen
2543 && self.ifi_hdrlen == other.ifi_hdrlen
2544 && self.ifi_recvquota == other.ifi_recvquota
2545 && self.ifi_xmitquota == other.ifi_xmitquota
2546 && self.ifi_unused1 == other.ifi_unused1
2547 && self.ifi_mtu == other.ifi_mtu
2548 && self.ifi_metric == other.ifi_metric
2549 && self.ifi_baudrate == other.ifi_baudrate
2550 && self.ifi_ipackets == other.ifi_ipackets
2551 && self.ifi_ierrors == other.ifi_ierrors
2552 && self.ifi_opackets == other.ifi_opackets
2553 && self.ifi_oerrors == other.ifi_oerrors
2554 && self.ifi_collisions == other.ifi_collisions
2555 && self.ifi_ibytes == other.ifi_ibytes
2556 && self.ifi_obytes == other.ifi_obytes
2557 && self.ifi_imcasts == other.ifi_imcasts
2558 && self.ifi_omcasts == other.ifi_omcasts
2559 && self.ifi_iqdrops == other.ifi_iqdrops
2560 && self.ifi_noproto == other.ifi_noproto
2561 && self.ifi_recvtiming == other.ifi_recvtiming
2562 && self.ifi_xmittiming == other.ifi_xmittiming
2563 && self.ifi_lastchange == other.ifi_lastchange
2564 }
2565 }
2566 impl Eq for if_data64 {}
2567 impl fmt::Debug for if_data64 {
2568 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
2569 let ifi_type = self.ifi_type;
2570 let ifi_typelen = self.ifi_typelen;
2571 let ifi_physical = self.ifi_physical;
2572 let ifi_addrlen = self.ifi_addrlen;
2573 let ifi_hdrlen = self.ifi_hdrlen;
2574 let ifi_recvquota = self.ifi_recvquota;
2575 let ifi_xmitquota = self.ifi_xmitquota;
2576 let ifi_unused1 = self.ifi_unused1;
2577 let ifi_mtu = self.ifi_mtu;
2578 let ifi_metric = self.ifi_metric;
2579 let ifi_baudrate = self.ifi_baudrate;
2580 let ifi_ipackets = self.ifi_ipackets;
2581 let ifi_ierrors = self.ifi_ierrors;
2582 let ifi_opackets = self.ifi_opackets;
2583 let ifi_oerrors = self.ifi_oerrors;
2584 let ifi_collisions = self.ifi_collisions;
2585 let ifi_ibytes = self.ifi_ibytes;
2586 let ifi_obytes = self.ifi_obytes;
2587 let ifi_imcasts = self.ifi_imcasts;
2588 let ifi_omcasts = self.ifi_omcasts;
2589 let ifi_iqdrops = self.ifi_iqdrops;
2590 let ifi_noproto = self.ifi_noproto;
2591 let ifi_recvtiming = self.ifi_recvtiming;
2592 let ifi_xmittiming = self.ifi_xmittiming;
2593 let ifi_lastchange = self.ifi_lastchange;
2594 f.debug_struct("if_data64")
2595 .field("ifi_type", &ifi_type)
2596 .field("ifi_typelen", &ifi_typelen)
2597 .field("ifi_physical", &ifi_physical)
2598 .field("ifi_addrlen", &ifi_addrlen)
2599 .field("ifi_hdrlen", &ifi_hdrlen)
2600 .field("ifi_recvquota", &ifi_recvquota)
2601 .field("ifi_xmitquota", &ifi_xmitquota)
2602 .field("ifi_unused1", &ifi_unused1)
2603 .field("ifi_mtu", &ifi_mtu)
2604 .field("ifi_metric", &ifi_metric)
2605 .field("ifi_baudrate", &ifi_baudrate)
2606 .field("ifi_ipackets", &ifi_ipackets)
2607 .field("ifi_ierrors", &ifi_ierrors)
2608 .field("ifi_opackets", &ifi_opackets)
2609 .field("ifi_oerrors", &ifi_oerrors)
2610 .field("ifi_collisions", &ifi_collisions)
2611 .field("ifi_ibytes", &ifi_ibytes)
2612 .field("ifi_obytes", &ifi_obytes)
2613 .field("ifi_imcasts", &ifi_imcasts)
2614 .field("ifi_omcasts", &ifi_omcasts)
2615 .field("ifi_iqdrops", &ifi_iqdrops)
2616 .field("ifi_noproto", &ifi_noproto)
2617 .field("ifi_recvtiming", &ifi_recvtiming)
2618 .field("ifi_xmittiming", &ifi_xmittiming)
2619 .field("ifi_lastchange", &ifi_lastchange)
2620 .finish()
2621 }
2622 }
2623 impl hash::Hash for if_data64 {
2624 fn hash<H: hash::Hasher>(&self, state: &mut H) {
2625 let ifi_type = self.ifi_type;
2626 let ifi_typelen = self.ifi_typelen;
2627 let ifi_physical = self.ifi_physical;
2628 let ifi_addrlen = self.ifi_addrlen;
2629 let ifi_hdrlen = self.ifi_hdrlen;
2630 let ifi_recvquota = self.ifi_recvquota;
2631 let ifi_xmitquota = self.ifi_xmitquota;
2632 let ifi_unused1 = self.ifi_unused1;
2633 let ifi_mtu = self.ifi_mtu;
2634 let ifi_metric = self.ifi_metric;
2635 let ifi_baudrate = self.ifi_baudrate;
2636 let ifi_ipackets = self.ifi_ipackets;
2637 let ifi_ierrors = self.ifi_ierrors;
2638 let ifi_opackets = self.ifi_opackets;
2639 let ifi_oerrors = self.ifi_oerrors;
2640 let ifi_collisions = self.ifi_collisions;
2641 let ifi_ibytes = self.ifi_ibytes;
2642 let ifi_obytes = self.ifi_obytes;
2643 let ifi_imcasts = self.ifi_imcasts;
2644 let ifi_omcasts = self.ifi_omcasts;
2645 let ifi_iqdrops = self.ifi_iqdrops;
2646 let ifi_noproto = self.ifi_noproto;
2647 let ifi_recvtiming = self.ifi_recvtiming;
2648 let ifi_xmittiming = self.ifi_xmittiming;
2649 let ifi_lastchange = self.ifi_lastchange;
2650 ifi_type.hash(state);
2651 ifi_typelen.hash(state);
2652 ifi_physical.hash(state);
2653 ifi_addrlen.hash(state);
2654 ifi_hdrlen.hash(state);
2655 ifi_recvquota.hash(state);
2656 ifi_xmitquota.hash(state);
2657 ifi_unused1.hash(state);
2658 ifi_mtu.hash(state);
2659 ifi_metric.hash(state);
2660 ifi_baudrate.hash(state);
2661 ifi_ipackets.hash(state);
2662 ifi_ierrors.hash(state);
2663 ifi_opackets.hash(state);
2664 ifi_oerrors.hash(state);
2665 ifi_collisions.hash(state);
2666 ifi_ibytes.hash(state);
2667 ifi_obytes.hash(state);
2668 ifi_imcasts.hash(state);
2669 ifi_omcasts.hash(state);
2670 ifi_iqdrops.hash(state);
2671 ifi_noproto.hash(state);
2672 ifi_recvtiming.hash(state);
2673 ifi_xmittiming.hash(state);
2674 ifi_lastchange.hash(state);
2675 }
2676 }
2677 impl PartialEq for if_msghdr2 {
2678 fn eq(&self, other: &if_msghdr2) -> bool {
2679 self.ifm_msglen == other.ifm_msglen
2680 && self.ifm_version == other.ifm_version
2681 && self.ifm_type == other.ifm_type
2682 && self.ifm_addrs == other.ifm_addrs
2683 && self.ifm_flags == other.ifm_flags
2684 && self.ifm_index == other.ifm_index
2685 && self.ifm_snd_len == other.ifm_snd_len
2686 && self.ifm_snd_maxlen == other.ifm_snd_maxlen
2687 && self.ifm_snd_drops == other.ifm_snd_drops
2688 && self.ifm_timer == other.ifm_timer
2689 && self.ifm_data == other.ifm_data
2690 }
2691 }
2692 impl Eq for if_msghdr2 {}
2693 impl fmt::Debug for if_msghdr2 {
2694 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
2695 let ifm_msglen = self.ifm_msglen;
2696 let ifm_version = self.ifm_version;
2697 let ifm_type = self.ifm_type;
2698 let ifm_addrs = self.ifm_addrs;
2699 let ifm_flags = self.ifm_flags;
2700 let ifm_index = self.ifm_index;
2701 let ifm_snd_len = self.ifm_snd_len;
2702 let ifm_snd_maxlen = self.ifm_snd_maxlen;
2703 let ifm_snd_drops = self.ifm_snd_drops;
2704 let ifm_timer = self.ifm_timer;
2705 let ifm_data = self.ifm_data;
2706 f.debug_struct("if_msghdr2")
2707 .field("ifm_msglen", &ifm_msglen)
2708 .field("ifm_version", &ifm_version)
2709 .field("ifm_type", &ifm_type)
2710 .field("ifm_addrs", &ifm_addrs)
2711 .field("ifm_flags", &ifm_flags)
2712 .field("ifm_index", &ifm_index)
2713 .field("ifm_snd_len", &ifm_snd_len)
2714 .field("ifm_snd_maxlen", &ifm_snd_maxlen)
2715 .field("ifm_snd_drops", &ifm_snd_drops)
2716 .field("ifm_timer", &ifm_timer)
2717 .field("ifm_data", &ifm_data)
2718 .finish()
2719 }
2720 }
2721 impl hash::Hash for if_msghdr2 {
2722 fn hash<H: hash::Hasher>(&self, state: &mut H) {
2723 let ifm_msglen = self.ifm_msglen;
2724 let ifm_version = self.ifm_version;
2725 let ifm_type = self.ifm_type;
2726 let ifm_addrs = self.ifm_addrs;
2727 let ifm_flags = self.ifm_flags;
2728 let ifm_index = self.ifm_index;
2729 let ifm_snd_len = self.ifm_snd_len;
2730 let ifm_snd_maxlen = self.ifm_snd_maxlen;
2731 let ifm_snd_drops = self.ifm_snd_drops;
2732 let ifm_timer = self.ifm_timer;
2733 let ifm_data = self.ifm_data;
2734 ifm_msglen.hash(state);
2735 ifm_version.hash(state);
2736 ifm_type.hash(state);
2737 ifm_addrs.hash(state);
2738 ifm_flags.hash(state);
2739 ifm_index.hash(state);
2740 ifm_snd_len.hash(state);
2741 ifm_snd_maxlen.hash(state);
2742 ifm_snd_drops.hash(state);
2743 ifm_timer.hash(state);
2744 ifm_data.hash(state);
2745 }
2746 }
2747 impl PartialEq for vm_statistics64 {
2748 fn eq(&self, other: &vm_statistics64) -> bool {
2749 // Otherwise rustfmt crashes...
2750 let total_uncompressed = self.total_uncompressed_pages_in_compressor;
2751 self.free_count == other.free_count
2752 && self.active_count == other.active_count
2753 && self.inactive_count == other.inactive_count
2754 && self.wire_count == other.wire_count
2755 && self.zero_fill_count == other.zero_fill_count
2756 && self.reactivations == other.reactivations
2757 && self.pageins == other.pageins
2758 && self.pageouts == other.pageouts
2759 && self.faults == other.faults
2760 && self.cow_faults == other.cow_faults
2761 && self.lookups == other.lookups
2762 && self.hits == other.hits
2763 && self.purges == other.purges
2764 && self.purgeable_count == other.purgeable_count
2765 && self.speculative_count == other.speculative_count
2766 && self.decompressions == other.decompressions
2767 && self.compressions == other.compressions
2768 && self.swapins == other.swapins
2769 && self.swapouts == other.swapouts
2770 && self.compressor_page_count == other.compressor_page_count
2771 && self.throttled_count == other.throttled_count
2772 && self.external_page_count == other.external_page_count
2773 && self.internal_page_count == other.internal_page_count
2774 && total_uncompressed == other.total_uncompressed_pages_in_compressor
2775 }
2776 }
2777 impl Eq for vm_statistics64 {}
2778 impl fmt::Debug for vm_statistics64 {
2779 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
2780 let free_count = self.free_count;
2781 let active_count = self.active_count;
2782 let inactive_count = self.inactive_count;
2783 let wire_count = self.wire_count;
2784 let zero_fill_count = self.zero_fill_count;
2785 let reactivations = self.reactivations;
2786 let pageins = self.pageins;
2787 let pageouts = self.pageouts;
2788 let faults = self.faults;
2789 let cow_faults = self.cow_faults;
2790 let lookups = self.lookups;
2791 let hits = self.hits;
2792 let purges = self.purges;
2793 let purgeable_count = self.purgeable_count;
2794 let speculative_count = self.speculative_count;
2795 let decompressions = self.decompressions;
2796 let compressions = self.compressions;
2797 let swapins = self.swapins;
2798 let swapouts = self.swapouts;
2799 let compressor_page_count = self.compressor_page_count;
2800 let throttled_count = self.throttled_count;
2801 let external_page_count = self.external_page_count;
2802 let internal_page_count = self.internal_page_count;
2803 // Otherwise rustfmt crashes...
2804 let total_uncompressed = self.total_uncompressed_pages_in_compressor;
2805 f.debug_struct("vm_statistics64")
2806 .field("free_count", &free_count)
2807 .field("active_count", &active_count)
2808 .field("inactive_count", &inactive_count)
2809 .field("wire_count", &wire_count)
2810 .field("zero_fill_count", &zero_fill_count)
2811 .field("reactivations", &reactivations)
2812 .field("pageins", &pageins)
2813 .field("pageouts", &pageouts)
2814 .field("faults", &faults)
2815 .field("cow_faults", &cow_faults)
2816 .field("lookups", &lookups)
2817 .field("hits", &hits)
2818 .field("purges", &purges)
2819 .field("purgeable_count", &purgeable_count)
2820 .field("speculative_count", &speculative_count)
2821 .field("decompressions", &decompressions)
2822 .field("compressions", &compressions)
2823 .field("swapins", &swapins)
2824 .field("swapouts", &swapouts)
2825 .field("compressor_page_count", &compressor_page_count)
2826 .field("throttled_count", &throttled_count)
2827 .field("external_page_count", &external_page_count)
2828 .field("internal_page_count", &internal_page_count)
2829 .field(
2830 "total_uncompressed_pages_in_compressor",
2831 &total_uncompressed,
2832 )
2833 .finish()
2834 }
2835 }
2836 impl hash::Hash for vm_statistics64 {
2837 fn hash<H: hash::Hasher>(&self, state: &mut H) {
2838 let free_count = self.free_count;
2839 let active_count = self.active_count;
2840 let inactive_count = self.inactive_count;
2841 let wire_count = self.wire_count;
2842 let zero_fill_count = self.zero_fill_count;
2843 let reactivations = self.reactivations;
2844 let pageins = self.pageins;
2845 let pageouts = self.pageouts;
2846 let faults = self.faults;
2847 let cow_faults = self.cow_faults;
2848 let lookups = self.lookups;
2849 let hits = self.hits;
2850 let purges = self.purges;
2851 let purgeable_count = self.purgeable_count;
2852 let speculative_count = self.speculative_count;
2853 let decompressions = self.decompressions;
2854 let compressions = self.compressions;
2855 let swapins = self.swapins;
2856 let swapouts = self.swapouts;
2857 let compressor_page_count = self.compressor_page_count;
2858 let throttled_count = self.throttled_count;
2859 let external_page_count = self.external_page_count;
2860 let internal_page_count = self.internal_page_count;
2861 // Otherwise rustfmt crashes...
2862 let total_uncompressed = self.total_uncompressed_pages_in_compressor;
2863 free_count.hash(state);
2864 active_count.hash(state);
2865 inactive_count.hash(state);
2866 wire_count.hash(state);
2867 zero_fill_count.hash(state);
2868 reactivations.hash(state);
2869 pageins.hash(state);
2870 pageouts.hash(state);
2871 faults.hash(state);
2872 cow_faults.hash(state);
2873 lookups.hash(state);
2874 hits.hash(state);
2875 purges.hash(state);
2876 purgeable_count.hash(state);
2877 speculative_count.hash(state);
2878 decompressions.hash(state);
2879 compressions.hash(state);
2880 swapins.hash(state);
2881 swapouts.hash(state);
2882 compressor_page_count.hash(state);
2883 throttled_count.hash(state);
2884 external_page_count.hash(state);
2885 internal_page_count.hash(state);
2886 total_uncompressed.hash(state);
2887 }
2888 }
2889
2890 impl PartialEq for mach_task_basic_info {
2891 fn eq(&self, other: &mach_task_basic_info) -> bool {
2892 self.virtual_size == other.virtual_size
2893 && self.resident_size == other.resident_size
2894 && self.resident_size_max == other.resident_size_max
2895 && self.user_time == other.user_time
2896 && self.system_time == other.system_time
2897 && self.policy == other.policy
2898 && self.suspend_count == other.suspend_count
2899 }
2900 }
2901 impl Eq for mach_task_basic_info {}
2902 impl fmt::Debug for mach_task_basic_info {
2903 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
2904 let virtual_size = self.virtual_size;
2905 let resident_size = self.resident_size;
2906 let resident_size_max = self.resident_size_max;
2907 let user_time = self.user_time;
2908 let system_time = self.system_time;
2909 let policy = self.policy;
2910 let suspend_count = self.suspend_count;
2911 f.debug_struct("mach_task_basic_info")
2912 .field("virtual_size", &virtual_size)
2913 .field("resident_size", &resident_size)
2914 .field("resident_size_max", &resident_size_max)
2915 .field("user_time", &user_time)
2916 .field("system_time", &system_time)
2917 .field("policy", &policy)
2918 .field("suspend_count", &suspend_count)
2919 .finish()
2920 }
2921 }
2922 impl hash::Hash for mach_task_basic_info {
2923 fn hash<H: hash::Hasher>(&self, state: &mut H) {
2924 let virtual_size = self.virtual_size;
2925 let resident_size = self.resident_size;
2926 let resident_size_max = self.resident_size_max;
2927 let user_time = self.user_time;
2928 let system_time = self.system_time;
2929 let policy = self.policy;
2930 let suspend_count = self.suspend_count;
2931 virtual_size.hash(state);
2932 resident_size.hash(state);
2933 resident_size_max.hash(state);
2934 user_time.hash(state);
2935 system_time.hash(state);
2936 policy.hash(state);
2937 suspend_count.hash(state);
2938 }
2939 }
2940
2941 impl PartialEq for log2phys {
2942 fn eq(&self, other: &log2phys) -> bool {
2943 self.l2p_flags == other.l2p_flags
2944 && self.l2p_contigbytes == other.l2p_contigbytes
2945 && self.l2p_devoffset == other.l2p_devoffset
2946 }
2947 }
2948 impl Eq for log2phys {}
2949 impl fmt::Debug for log2phys {
2950 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
2951 let l2p_flags = self.l2p_flags;
2952 let l2p_contigbytes = self.l2p_contigbytes;
2953 let l2p_devoffset = self.l2p_devoffset;
2954 f.debug_struct("log2phys")
2955 .field("l2p_flags", &l2p_flags)
2956 .field("l2p_contigbytes", &l2p_contigbytes)
2957 .field("l2p_devoffset", &l2p_devoffset)
2958 .finish()
2959 }
2960 }
2961 impl hash::Hash for log2phys {
2962 fn hash<H: hash::Hasher>(&self, state: &mut H) {
2963 let l2p_flags = self.l2p_flags;
2964 let l2p_contigbytes = self.l2p_contigbytes;
2965 let l2p_devoffset = self.l2p_devoffset;
2966 l2p_flags.hash(state);
2967 l2p_contigbytes.hash(state);
2968 l2p_devoffset.hash(state);
2969 }
2970 }
2971 impl PartialEq for os_unfair_lock {
2972 fn eq(&self, other: &os_unfair_lock) -> bool {
2973 self._os_unfair_lock_opaque == other._os_unfair_lock_opaque
2974 }
2975 }
2976
2977 impl Eq for os_unfair_lock {}
2978
2979 impl fmt::Debug for os_unfair_lock {
2980 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
2981 f.debug_struct("os_unfair_lock")
2982 .field("_os_unfair_lock_opaque", &self._os_unfair_lock_opaque)
2983 .finish()
2984 }
2985 }
2986
2987 impl hash::Hash for os_unfair_lock {
2988 fn hash<H: hash::Hasher>(&self, state: &mut H) {
2989 self._os_unfair_lock_opaque.hash(state);
2990 }
2991 }
2992
2993 impl PartialEq for sockaddr_vm {
2994 fn eq(&self, other: &sockaddr_vm) -> bool {
2995 self.svm_len == other.svm_len
2996 && self.svm_family == other.svm_family
2997 && self.svm_reserved1 == other.svm_reserved1
2998 && self.svm_port == other.svm_port
2999 && self.svm_cid == other.svm_cid
3000 }
3001 }
3002
3003 impl Eq for sockaddr_vm {}
3004
3005 impl fmt::Debug for sockaddr_vm {
3006 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
3007 let svm_len = self.svm_len;
3008 let svm_family = self.svm_family;
3009 let svm_reserved1 = self.svm_reserved1;
3010 let svm_port = self.svm_port;
3011 let svm_cid = self.svm_cid;
3012
3013 f.debug_struct("sockaddr_vm")
3014 .field("svm_len", &svm_len)
3015 .field("svm_family", &svm_family)
3016 .field("svm_reserved1", &svm_reserved1)
3017 .field("svm_port", &svm_port)
3018 .field("svm_cid", &svm_cid)
3019 .finish()
3020 }
3021 }
3022
3023 impl hash::Hash for sockaddr_vm {
3024 fn hash<H: hash::Hasher>(&self, state: &mut H) {
3025 let svm_len = self.svm_len;
3026 let svm_family = self.svm_family;
3027 let svm_reserved1 = self.svm_reserved1;
3028 let svm_port = self.svm_port;
3029 let svm_cid = self.svm_cid;
3030
3031 svm_len.hash(state);
3032 svm_family.hash(state);
3033 svm_reserved1.hash(state);
3034 svm_port.hash(state);
3035 svm_cid.hash(state);
3036 }
3037 }
3038
3039 impl PartialEq for ifdevmtu {
3040 fn eq(&self, other: &ifdevmtu) -> bool {
3041 self.ifdm_current == other.ifdm_current
3042 && self.ifdm_min == other.ifdm_min
3043 && self.ifdm_max == other.ifdm_max
3044 }
3045 }
3046
3047 impl Eq for ifdevmtu {}
3048
3049 impl fmt::Debug for ifdevmtu {
3050 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
3051 f.debug_struct("ifdevmtu")
3052 .field("ifdm_current", &self.ifdm_current)
3053 .field("ifdm_min", &self.ifdm_min)
3054 .field("ifdm_max", &self.ifdm_max)
3055 .finish()
3056 }
3057 }
3058
3059 impl hash::Hash for ifdevmtu {
3060 fn hash<H: hash::Hasher>(&self, state: &mut H) {
3061 self.ifdm_current.hash(state);
3062 self.ifdm_min.hash(state);
3063 self.ifdm_max.hash(state);
3064 }
3065 }
3066
3067 impl PartialEq for __c_anonymous_ifk_data {
3068 fn eq(&self, other: &__c_anonymous_ifk_data) -> bool {
3069 unsafe { self.ifk_ptr == other.ifk_ptr && self.ifk_value == other.ifk_value }
3070 }
3071 }
3072
3073 impl Eq for __c_anonymous_ifk_data {}
3074 impl hash::Hash for __c_anonymous_ifk_data {
3075 fn hash<H: hash::Hasher>(&self, state: &mut H) {
3076 unsafe {
3077 self.ifk_ptr.hash(state);
3078 self.ifk_value.hash(state);
3079 }
3080 }
3081 }
3082
3083 impl PartialEq for ifkpi {
3084 fn eq(&self, other: &ifkpi) -> bool {
3085 self.ifk_module_id == other.ifk_module_id && self.ifk_type == other.ifk_type
3086 }
3087 }
3088
3089 impl Eq for ifkpi {}
3090
3091 impl fmt::Debug for ifkpi {
3092 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
3093 f.debug_struct("ifkpi")
3094 .field("ifk_module_id", &self.ifk_module_id)
3095 .field("ifk_type", &self.ifk_type)
3096 .finish()
3097 }
3098 }
3099
3100 impl hash::Hash for ifkpi {
3101 fn hash<H: hash::Hasher>(&self, state: &mut H) {
3102 self.ifk_module_id.hash(state);
3103 self.ifk_type.hash(state);
3104 }
3105 }
3106
3107 impl PartialEq for __c_anonymous_ifr_ifru {
3108 fn eq(&self, other: &__c_anonymous_ifr_ifru) -> bool {
3109 unsafe {
3110 self.ifru_addr == other.ifru_addr
3111 && self.ifru_dstaddr == other.ifru_dstaddr
3112 && self.ifru_broadaddr == other.ifru_broadaddr
3113 && self.ifru_flags == other.ifru_flags
3114 && self.ifru_metrics == other.ifru_metrics
3115 && self.ifru_mtu == other.ifru_mtu
3116 && self.ifru_phys == other.ifru_phys
3117 && self.ifru_media == other.ifru_media
3118 && self.ifru_intval == other.ifru_intval
3119 && self.ifru_data == other.ifru_data
3120 && self.ifru_devmtu == other.ifru_devmtu
3121 && self.ifru_kpi == other.ifru_kpi
3122 && self.ifru_wake_flags == other.ifru_wake_flags
3123 && self.ifru_route_refcnt == other.ifru_route_refcnt
3124 && self
3125 .ifru_cap
3126 .iter()
3127 .zip(other.ifru_cap.iter())
3128 .all(|(a, b)| a == b)
3129 && self.ifru_functional_type == other.ifru_functional_type
3130 }
3131 }
3132 }
3133
3134 impl Eq for __c_anonymous_ifr_ifru {}
3135
3136 impl hash::Hash for __c_anonymous_ifr_ifru {
3137 fn hash<H: hash::Hasher>(&self, state: &mut H) {
3138 unsafe {
3139 self.ifru_addr.hash(state);
3140 self.ifru_dstaddr.hash(state);
3141 self.ifru_broadaddr.hash(state);
3142 self.ifru_flags.hash(state);
3143 self.ifru_metrics.hash(state);
3144 self.ifru_mtu.hash(state);
3145 self.ifru_phys.hash(state);
3146 self.ifru_media.hash(state);
3147 self.ifru_intval.hash(state);
3148 self.ifru_data.hash(state);
3149 self.ifru_devmtu.hash(state);
3150 self.ifru_kpi.hash(state);
3151 self.ifru_wake_flags.hash(state);
3152 self.ifru_route_refcnt.hash(state);
3153 self.ifru_cap.hash(state);
3154 self.ifru_functional_type.hash(state);
3155 }
3156 }
3157 }
3158
3159 impl PartialEq for ifreq {
3160 fn eq(&self, other: &ifreq) -> bool {
3161 self.ifr_name == other.ifr_name && self.ifr_ifru == other.ifr_ifru
3162 }
3163 }
3164
3165 impl Eq for ifreq {}
3166
3167 impl fmt::Debug for ifreq {
3168 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
3169 f.debug_struct("ifreq")
3170 .field("ifr_name", &self.ifr_name)
3171 .field("ifr_ifru", &self.ifr_ifru)
3172 .finish()
3173 }
3174 }
3175
3176 impl hash::Hash for ifreq {
3177 fn hash<H: hash::Hasher>(&self, state: &mut H) {
3178 self.ifr_name.hash(state);
3179 self.ifr_ifru.hash(state);
3180 }
3181 }
3182
3183 impl Eq for __c_anonymous_ifc_ifcu {}
3184
3185 impl PartialEq for __c_anonymous_ifc_ifcu {
3186 fn eq(&self, other: &__c_anonymous_ifc_ifcu) -> bool {
3187 unsafe { self.ifcu_buf == other.ifcu_buf && self.ifcu_req == other.ifcu_req }
3188 }
3189 }
3190
3191 impl hash::Hash for __c_anonymous_ifc_ifcu {
3192 fn hash<H: hash::Hasher>(&self, state: &mut H) {
3193 unsafe { self.ifcu_buf.hash(state) };
3194 unsafe { self.ifcu_req.hash(state) };
3195 }
3196 }
3197
3198 impl PartialEq for __c_anonymous_ifr_ifru6 {
3199 fn eq(&self, other: &__c_anonymous_ifr_ifru6) -> bool {
3200 unsafe {
3201 self.ifru_addr == other.ifru_addr
3202 && self.ifru_dstaddr == other.ifru_dstaddr
3203 && self.ifru_flags == other.ifru_flags
3204 && self.ifru_flags6 == other.ifru_flags6
3205 && self.ifru_metrics == other.ifru_metrics
3206 && self.ifru_intval == other.ifru_intval
3207 && self.ifru_data == other.ifru_data
3208 && self
3209 .ifru_scope_id
3210 .iter()
3211 .zip(other.ifru_scope_id.iter())
3212 .all(|(a, b)| a == b)
3213 }
3214 }
3215 }
3216
3217 impl Eq for __c_anonymous_ifr_ifru6 {}
3218
3219 impl hash::Hash for __c_anonymous_ifr_ifru6 {
3220 fn hash<H: hash::Hasher>(&self, state: &mut H) {
3221 unsafe {
3222 self.ifru_addr.hash(state);
3223 self.ifru_dstaddr.hash(state);
3224 self.ifru_flags.hash(state);
3225 self.ifru_flags6.hash(state);
3226 self.ifru_metrics.hash(state);
3227 self.ifru_intval.hash(state);
3228 self.ifru_data.hash(state);
3229 self.ifru_scope_id.hash(state);
3230 }
3231 }
3232 }
3233
3234 impl PartialEq for in6_ifreq {
3235 fn eq(&self, other: &in6_ifreq) -> bool {
3236 self.ifr_name == other.ifr_name && self.ifr_ifru == other.ifr_ifru
3237 }
3238 }
3239
3240 impl Eq for in6_ifreq {}
3241
3242 impl fmt::Debug for in6_ifreq {
3243 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
3244 f.debug_struct("in6_ifreq")
3245 .field("ifr_name", &self.ifr_name)
3246 .field("ifr_ifru", &self.ifr_ifru)
3247 .finish()
3248 }
3249 }
3250 }
3251 }
3252
3253 pub const _UTX_USERSIZE: usize = 256;
3254 pub const _UTX_LINESIZE: usize = 32;
3255 pub const _UTX_IDSIZE: usize = 4;
3256 pub const _UTX_HOSTSIZE: usize = 256;
3257
3258 pub const EMPTY: c_short = 0;
3259 pub const RUN_LVL: c_short = 1;
3260 pub const BOOT_TIME: c_short = 2;
3261 pub const OLD_TIME: c_short = 3;
3262 pub const NEW_TIME: c_short = 4;
3263 pub const INIT_PROCESS: c_short = 5;
3264 pub const LOGIN_PROCESS: c_short = 6;
3265 pub const USER_PROCESS: c_short = 7;
3266 pub const DEAD_PROCESS: c_short = 8;
3267 pub const ACCOUNTING: c_short = 9;
3268 pub const SIGNATURE: c_short = 10;
3269 pub const SHUTDOWN_TIME: c_short = 11;
3270
3271 pub const LC_COLLATE_MASK: c_int = 1 << 0;
3272 pub const LC_CTYPE_MASK: c_int = 1 << 1;
3273 pub const LC_MESSAGES_MASK: c_int = 1 << 2;
3274 pub const LC_MONETARY_MASK: c_int = 1 << 3;
3275 pub const LC_NUMERIC_MASK: c_int = 1 << 4;
3276 pub const LC_TIME_MASK: c_int = 1 << 5;
3277 pub const LC_ALL_MASK: c_int = LC_COLLATE_MASK
3278 | LC_CTYPE_MASK
3279 | LC_MESSAGES_MASK
3280 | LC_MONETARY_MASK
3281 | LC_NUMERIC_MASK
3282 | LC_TIME_MASK;
3283
3284 pub const CODESET: crate::nl_item = 0;
3285 pub const D_T_FMT: crate::nl_item = 1;
3286 pub const D_FMT: crate::nl_item = 2;
3287 pub const T_FMT: crate::nl_item = 3;
3288 pub const T_FMT_AMPM: crate::nl_item = 4;
3289 pub const AM_STR: crate::nl_item = 5;
3290 pub const PM_STR: crate::nl_item = 6;
3291
3292 pub const DAY_1: crate::nl_item = 7;
3293 pub const DAY_2: crate::nl_item = 8;
3294 pub const DAY_3: crate::nl_item = 9;
3295 pub const DAY_4: crate::nl_item = 10;
3296 pub const DAY_5: crate::nl_item = 11;
3297 pub const DAY_6: crate::nl_item = 12;
3298 pub const DAY_7: crate::nl_item = 13;
3299
3300 pub const ABDAY_1: crate::nl_item = 14;
3301 pub const ABDAY_2: crate::nl_item = 15;
3302 pub const ABDAY_3: crate::nl_item = 16;
3303 pub const ABDAY_4: crate::nl_item = 17;
3304 pub const ABDAY_5: crate::nl_item = 18;
3305 pub const ABDAY_6: crate::nl_item = 19;
3306 pub const ABDAY_7: crate::nl_item = 20;
3307
3308 pub const MON_1: crate::nl_item = 21;
3309 pub const MON_2: crate::nl_item = 22;
3310 pub const MON_3: crate::nl_item = 23;
3311 pub const MON_4: crate::nl_item = 24;
3312 pub const MON_5: crate::nl_item = 25;
3313 pub const MON_6: crate::nl_item = 26;
3314 pub const MON_7: crate::nl_item = 27;
3315 pub const MON_8: crate::nl_item = 28;
3316 pub const MON_9: crate::nl_item = 29;
3317 pub const MON_10: crate::nl_item = 30;
3318 pub const MON_11: crate::nl_item = 31;
3319 pub const MON_12: crate::nl_item = 32;
3320
3321 pub const ABMON_1: crate::nl_item = 33;
3322 pub const ABMON_2: crate::nl_item = 34;
3323 pub const ABMON_3: crate::nl_item = 35;
3324 pub const ABMON_4: crate::nl_item = 36;
3325 pub const ABMON_5: crate::nl_item = 37;
3326 pub const ABMON_6: crate::nl_item = 38;
3327 pub const ABMON_7: crate::nl_item = 39;
3328 pub const ABMON_8: crate::nl_item = 40;
3329 pub const ABMON_9: crate::nl_item = 41;
3330 pub const ABMON_10: crate::nl_item = 42;
3331 pub const ABMON_11: crate::nl_item = 43;
3332 pub const ABMON_12: crate::nl_item = 44;
3333
3334 pub const CLOCK_REALTIME: crate::clockid_t = 0;
3335 pub const CLOCK_MONOTONIC_RAW: crate::clockid_t = 4;
3336 pub const CLOCK_MONOTONIC_RAW_APPROX: crate::clockid_t = 5;
3337 pub const CLOCK_MONOTONIC: crate::clockid_t = 6;
3338 pub const CLOCK_UPTIME_RAW: crate::clockid_t = 8;
3339 pub const CLOCK_UPTIME_RAW_APPROX: crate::clockid_t = 9;
3340 pub const CLOCK_PROCESS_CPUTIME_ID: crate::clockid_t = 12;
3341 pub const CLOCK_THREAD_CPUTIME_ID: crate::clockid_t = 16;
3342
3343 pub const ERA: crate::nl_item = 45;
3344 pub const ERA_D_FMT: crate::nl_item = 46;
3345 pub const ERA_D_T_FMT: crate::nl_item = 47;
3346 pub const ERA_T_FMT: crate::nl_item = 48;
3347 pub const ALT_DIGITS: crate::nl_item = 49;
3348
3349 pub const RADIXCHAR: crate::nl_item = 50;
3350 pub const THOUSEP: crate::nl_item = 51;
3351
3352 pub const YESEXPR: crate::nl_item = 52;
3353 pub const NOEXPR: crate::nl_item = 53;
3354
3355 pub const YESSTR: crate::nl_item = 54;
3356 pub const NOSTR: crate::nl_item = 55;
3357
3358 pub const CRNCYSTR: crate::nl_item = 56;
3359
3360 pub const D_MD_ORDER: crate::nl_item = 57;
3361
3362 pub const EXIT_FAILURE: c_int = 1;
3363 pub const EXIT_SUCCESS: c_int = 0;
3364 pub const RAND_MAX: c_int = 2147483647;
3365 pub const EOF: c_int = -1;
3366 pub const SEEK_SET: c_int = 0;
3367 pub const SEEK_CUR: c_int = 1;
3368 pub const SEEK_END: c_int = 2;
3369 pub const SEEK_HOLE: c_int = 3;
3370 pub const SEEK_DATA: c_int = 4;
3371 pub const _IOFBF: c_int = 0;
3372 pub const _IONBF: c_int = 2;
3373 pub const _IOLBF: c_int = 1;
3374 pub const BUFSIZ: c_uint = 1024;
3375 pub const FOPEN_MAX: c_uint = 20;
3376 pub const FILENAME_MAX: c_uint = 1024;
3377 pub const L_tmpnam: c_uint = 1024;
3378 pub const TMP_MAX: c_uint = 308915776;
3379 pub const _PC_LINK_MAX: c_int = 1;
3380 pub const _PC_MAX_CANON: c_int = 2;
3381 pub const _PC_MAX_INPUT: c_int = 3;
3382 pub const _PC_NAME_MAX: c_int = 4;
3383 pub const _PC_PATH_MAX: c_int = 5;
3384 pub const _PC_PIPE_BUF: c_int = 6;
3385 pub const _PC_CHOWN_RESTRICTED: c_int = 7;
3386 pub const _PC_NO_TRUNC: c_int = 8;
3387 pub const _PC_VDISABLE: c_int = 9;
3388 pub const _PC_NAME_CHARS_MAX: c_int = 10;
3389 pub const _PC_CASE_SENSITIVE: c_int = 11;
3390 pub const _PC_CASE_PRESERVING: c_int = 12;
3391 pub const _PC_EXTENDED_SECURITY_NP: c_int = 13;
3392 pub const _PC_AUTH_OPAQUE_NP: c_int = 14;
3393 pub const _PC_2_SYMLINKS: c_int = 15;
3394 pub const _PC_ALLOC_SIZE_MIN: c_int = 16;
3395 pub const _PC_ASYNC_IO: c_int = 17;
3396 pub const _PC_FILESIZEBITS: c_int = 18;
3397 pub const _PC_PRIO_IO: c_int = 19;
3398 pub const _PC_REC_INCR_XFER_SIZE: c_int = 20;
3399 pub const _PC_REC_MAX_XFER_SIZE: c_int = 21;
3400 pub const _PC_REC_MIN_XFER_SIZE: c_int = 22;
3401 pub const _PC_REC_XFER_ALIGN: c_int = 23;
3402 pub const _PC_SYMLINK_MAX: c_int = 24;
3403 pub const _PC_SYNC_IO: c_int = 25;
3404 pub const _PC_XATTR_SIZE_BITS: c_int = 26;
3405 pub const _PC_MIN_HOLE_SIZE: c_int = 27;
3406 pub const O_EVTONLY: c_int = 0x00008000;
3407 pub const O_NOCTTY: c_int = 0x00020000;
3408 pub const O_DIRECTORY: c_int = 0x00100000;
3409 pub const O_SYMLINK: c_int = 0x00200000;
3410 pub const O_DSYNC: c_int = 0x00400000;
3411 pub const O_CLOEXEC: c_int = 0x01000000;
3412 pub const O_NOFOLLOW_ANY: c_int = 0x20000000;
3413 pub const O_EXEC: c_int = 0x40000000;
3414 pub const O_SEARCH: c_int = O_EXEC | O_DIRECTORY;
3415 pub const S_IFIFO: mode_t = 0o1_0000;
3416 pub const S_IFCHR: mode_t = 0o2_0000;
3417 pub const S_IFBLK: mode_t = 0o6_0000;
3418 pub const S_IFDIR: mode_t = 0o4_0000;
3419 pub const S_IFREG: mode_t = 0o10_0000;
3420 pub const S_IFLNK: mode_t = 0o12_0000;
3421 pub const S_IFSOCK: mode_t = 0o14_0000;
3422 pub const S_IFMT: mode_t = 0o17_0000;
3423 pub const S_IEXEC: mode_t = 0o0100;
3424 pub const S_IWRITE: mode_t = 0o0200;
3425 pub const S_IREAD: mode_t = 0o0400;
3426 pub const S_IRWXU: mode_t = 0o0700;
3427 pub const S_IXUSR: mode_t = 0o0100;
3428 pub const S_IWUSR: mode_t = 0o0200;
3429 pub const S_IRUSR: mode_t = 0o0400;
3430 pub const S_IRWXG: mode_t = 0o0070;
3431 pub const S_IXGRP: mode_t = 0o0010;
3432 pub const S_IWGRP: mode_t = 0o0020;
3433 pub const S_IRGRP: mode_t = 0o0040;
3434 pub const S_IRWXO: mode_t = 0o0007;
3435 pub const S_IXOTH: mode_t = 0o0001;
3436 pub const S_IWOTH: mode_t = 0o0002;
3437 pub const S_IROTH: mode_t = 0o0004;
3438 pub const F_OK: c_int = 0;
3439 pub const R_OK: c_int = 4;
3440 pub const W_OK: c_int = 2;
3441 pub const X_OK: c_int = 1;
3442 pub const STDIN_FILENO: c_int = 0;
3443 pub const STDOUT_FILENO: c_int = 1;
3444 pub const STDERR_FILENO: c_int = 2;
3445 pub const F_LOCK: c_int = 1;
3446 pub const F_TEST: c_int = 3;
3447 pub const F_TLOCK: c_int = 2;
3448 pub const F_ULOCK: c_int = 0;
3449 pub const F_GETLK: c_int = 7;
3450 pub const F_SETLK: c_int = 8;
3451 pub const F_SETLKW: c_int = 9;
3452 pub const SIGHUP: c_int = 1;
3453 pub const SIGINT: c_int = 2;
3454 pub const SIGQUIT: c_int = 3;
3455 pub const SIGILL: c_int = 4;
3456 pub const SIGABRT: c_int = 6;
3457 pub const SIGEMT: c_int = 7;
3458 pub const SIGFPE: c_int = 8;
3459 pub const SIGKILL: c_int = 9;
3460 pub const SIGSEGV: c_int = 11;
3461 pub const SIGPIPE: c_int = 13;
3462 pub const SIGALRM: c_int = 14;
3463 pub const SIGTERM: c_int = 15;
3464
3465 pub const PROT_NONE: c_int = 0;
3466 pub const PROT_READ: c_int = 1;
3467 pub const PROT_WRITE: c_int = 2;
3468 pub const PROT_EXEC: c_int = 4;
3469
3470 pub const PT_TRACE_ME: c_int = 0;
3471 pub const PT_READ_I: c_int = 1;
3472 pub const PT_READ_D: c_int = 2;
3473 pub const PT_READ_U: c_int = 3;
3474 pub const PT_WRITE_I: c_int = 4;
3475 pub const PT_WRITE_D: c_int = 5;
3476 pub const PT_WRITE_U: c_int = 6;
3477 pub const PT_CONTINUE: c_int = 7;
3478 pub const PT_KILL: c_int = 8;
3479 pub const PT_STEP: c_int = 9;
3480 pub const PT_ATTACH: c_int = 10;
3481 pub const PT_DETACH: c_int = 11;
3482 pub const PT_SIGEXC: c_int = 12;
3483 pub const PT_THUPDATE: c_int = 13;
3484 pub const PT_ATTACHEXC: c_int = 14;
3485
3486 pub const PT_FORCEQUOTA: c_int = 30;
3487 pub const PT_DENY_ATTACH: c_int = 31;
3488 pub const PT_FIRSTMACH: c_int = 32;
3489
3490 pub const MAP_FILE: c_int = 0x0000;
3491 pub const MAP_SHARED: c_int = 0x0001;
3492 pub const MAP_PRIVATE: c_int = 0x0002;
3493 pub const MAP_FIXED: c_int = 0x0010;
3494 pub const MAP_ANON: c_int = 0x1000;
3495 pub const MAP_ANONYMOUS: c_int = MAP_ANON;
3496
3497 pub const CPU_STATE_USER: c_int = 0;
3498 pub const CPU_STATE_SYSTEM: c_int = 1;
3499 pub const CPU_STATE_IDLE: c_int = 2;
3500 pub const CPU_STATE_NICE: c_int = 3;
3501 pub const CPU_STATE_MAX: c_int = 4;
3502
3503 pub const PROCESSOR_BASIC_INFO: c_int = 1;
3504 pub const PROCESSOR_CPU_LOAD_INFO: c_int = 2;
3505 pub const PROCESSOR_PM_REGS_INFO: c_int = 0x10000001;
3506 pub const PROCESSOR_TEMPERATURE: c_int = 0x10000002;
3507 pub const PROCESSOR_SET_LOAD_INFO: c_int = 4;
3508 pub const PROCESSOR_SET_BASIC_INFO: c_int = 5;
3509
3510 deprecated_mach! {
3511 pub const VM_FLAGS_FIXED: c_int = 0x0000;
3512 pub const VM_FLAGS_ANYWHERE: c_int = 0x0001;
3513 pub const VM_FLAGS_PURGABLE: c_int = 0x0002;
3514 pub const VM_FLAGS_RANDOM_ADDR: c_int = 0x0008;
3515 pub const VM_FLAGS_NO_CACHE: c_int = 0x0010;
3516 pub const VM_FLAGS_RESILIENT_CODESIGN: c_int = 0x0020;
3517 pub const VM_FLAGS_RESILIENT_MEDIA: c_int = 0x0040;
3518 pub const VM_FLAGS_OVERWRITE: c_int = 0x4000;
3519 pub const VM_FLAGS_SUPERPAGE_MASK: c_int = 0x70000;
3520 pub const VM_FLAGS_RETURN_DATA_ADDR: c_int = 0x100000;
3521 pub const VM_FLAGS_RETURN_4K_DATA_ADDR: c_int = 0x800000;
3522 pub const VM_FLAGS_ALIAS_MASK: c_int = 0xFF000000;
3523 pub const VM_FLAGS_USER_ALLOCATE: c_int = 0xff07401f;
3524 pub const VM_FLAGS_USER_MAP: c_int = 0xff97401f;
3525 pub const VM_FLAGS_USER_REMAP: c_int = VM_FLAGS_FIXED
3526 | VM_FLAGS_ANYWHERE
3527 | VM_FLAGS_RANDOM_ADDR
3528 | VM_FLAGS_OVERWRITE
3529 | VM_FLAGS_RETURN_DATA_ADDR
3530 | VM_FLAGS_RESILIENT_CODESIGN;
3531
3532 pub const VM_FLAGS_SUPERPAGE_SHIFT: c_int = 16;
3533 pub const SUPERPAGE_NONE: c_int = 0;
3534 pub const SUPERPAGE_SIZE_ANY: c_int = 1;
3535 pub const VM_FLAGS_SUPERPAGE_NONE: c_int = SUPERPAGE_NONE << VM_FLAGS_SUPERPAGE_SHIFT;
3536 pub const VM_FLAGS_SUPERPAGE_SIZE_ANY: c_int = SUPERPAGE_SIZE_ANY << VM_FLAGS_SUPERPAGE_SHIFT;
3537 pub const SUPERPAGE_SIZE_2MB: c_int = 2;
3538 pub const VM_FLAGS_SUPERPAGE_SIZE_2MB: c_int = SUPERPAGE_SIZE_2MB << VM_FLAGS_SUPERPAGE_SHIFT;
3539
3540 pub const VM_MEMORY_MALLOC: c_int = 1;
3541 pub const VM_MEMORY_MALLOC_SMALL: c_int = 2;
3542 pub const VM_MEMORY_MALLOC_LARGE: c_int = 3;
3543 pub const VM_MEMORY_MALLOC_HUGE: c_int = 4;
3544 pub const VM_MEMORY_SBRK: c_int = 5;
3545 pub const VM_MEMORY_REALLOC: c_int = 6;
3546 pub const VM_MEMORY_MALLOC_TINY: c_int = 7;
3547 pub const VM_MEMORY_MALLOC_LARGE_REUSABLE: c_int = 8;
3548 pub const VM_MEMORY_MALLOC_LARGE_REUSED: c_int = 9;
3549 pub const VM_MEMORY_ANALYSIS_TOOL: c_int = 10;
3550 pub const VM_MEMORY_MALLOC_NANO: c_int = 11;
3551 pub const VM_MEMORY_MACH_MSG: c_int = 20;
3552 pub const VM_MEMORY_IOKIT: c_int = 21;
3553 pub const VM_MEMORY_STACK: c_int = 30;
3554 pub const VM_MEMORY_GUARD: c_int = 31;
3555 pub const VM_MEMORY_SHARED_PMAP: c_int = 32;
3556 pub const VM_MEMORY_DYLIB: c_int = 33;
3557 pub const VM_MEMORY_OBJC_DISPATCHERS: c_int = 34;
3558 pub const VM_MEMORY_UNSHARED_PMAP: c_int = 35;
3559 pub const VM_MEMORY_APPKIT: c_int = 40;
3560 pub const VM_MEMORY_FOUNDATION: c_int = 41;
3561 pub const VM_MEMORY_COREGRAPHICS: c_int = 42;
3562 pub const VM_MEMORY_CORESERVICES: c_int = 43;
3563 pub const VM_MEMORY_CARBON: c_int = VM_MEMORY_CORESERVICES;
3564 pub const VM_MEMORY_JAVA: c_int = 44;
3565 pub const VM_MEMORY_COREDATA: c_int = 45;
3566 pub const VM_MEMORY_COREDATA_OBJECTIDS: c_int = 46;
3567 pub const VM_MEMORY_ATS: c_int = 50;
3568 pub const VM_MEMORY_LAYERKIT: c_int = 51;
3569 pub const VM_MEMORY_CGIMAGE: c_int = 52;
3570 pub const VM_MEMORY_TCMALLOC: c_int = 53;
3571 pub const VM_MEMORY_COREGRAPHICS_DATA: c_int = 54;
3572 pub const VM_MEMORY_COREGRAPHICS_SHARED: c_int = 55;
3573 pub const VM_MEMORY_COREGRAPHICS_FRAMEBUFFERS: c_int = 56;
3574 pub const VM_MEMORY_COREGRAPHICS_BACKINGSTORES: c_int = 57;
3575 pub const VM_MEMORY_COREGRAPHICS_XALLOC: c_int = 58;
3576 pub const VM_MEMORY_COREGRAPHICS_MISC: c_int = VM_MEMORY_COREGRAPHICS;
3577 pub const VM_MEMORY_DYLD: c_int = 60;
3578 pub const VM_MEMORY_DYLD_MALLOC: c_int = 61;
3579 pub const VM_MEMORY_SQLITE: c_int = 62;
3580 pub const VM_MEMORY_JAVASCRIPT_CORE: c_int = 63;
3581 pub const VM_MEMORY_JAVASCRIPT_JIT_EXECUTABLE_ALLOCATOR: c_int = 64;
3582 pub const VM_MEMORY_JAVASCRIPT_JIT_REGISTER_FILE: c_int = 65;
3583 pub const VM_MEMORY_GLSL: c_int = 66;
3584 pub const VM_MEMORY_OPENCL: c_int = 67;
3585 pub const VM_MEMORY_COREIMAGE: c_int = 68;
3586 pub const VM_MEMORY_WEBCORE_PURGEABLE_BUFFERS: c_int = 69;
3587 pub const VM_MEMORY_IMAGEIO: c_int = 70;
3588 pub const VM_MEMORY_COREPROFILE: c_int = 71;
3589 pub const VM_MEMORY_ASSETSD: c_int = 72;
3590 pub const VM_MEMORY_OS_ALLOC_ONCE: c_int = 73;
3591 pub const VM_MEMORY_LIBDISPATCH: c_int = 74;
3592 pub const VM_MEMORY_ACCELERATE: c_int = 75;
3593 pub const VM_MEMORY_COREUI: c_int = 76;
3594 pub const VM_MEMORY_COREUIFILE: c_int = 77;
3595 pub const VM_MEMORY_GENEALOGY: c_int = 78;
3596 pub const VM_MEMORY_RAWCAMERA: c_int = 79;
3597 pub const VM_MEMORY_CORPSEINFO: c_int = 80;
3598 pub const VM_MEMORY_ASL: c_int = 81;
3599 pub const VM_MEMORY_SWIFT_RUNTIME: c_int = 82;
3600 pub const VM_MEMORY_SWIFT_METADATA: c_int = 83;
3601 pub const VM_MEMORY_DHMM: c_int = 84;
3602 pub const VM_MEMORY_SCENEKIT: c_int = 86;
3603 pub const VM_MEMORY_SKYWALK: c_int = 87;
3604 pub const VM_MEMORY_APPLICATION_SPECIFIC_1: c_int = 240;
3605 pub const VM_MEMORY_APPLICATION_SPECIFIC_16: c_int = 255;
3606 }
3607
3608 pub const MAP_FAILED: *mut c_void = !0 as *mut c_void;
3609
3610 pub const MCL_CURRENT: c_int = 0x0001;
3611 pub const MCL_FUTURE: c_int = 0x0002;
3612
3613 pub const MS_ASYNC: c_int = 0x0001;
3614 pub const MS_INVALIDATE: c_int = 0x0002;
3615 pub const MS_SYNC: c_int = 0x0010;
3616
3617 pub const MS_KILLPAGES: c_int = 0x0004;
3618 pub const MS_DEACTIVATE: c_int = 0x0008;
3619
3620 pub const EPERM: c_int = 1;
3621 pub const ENOENT: c_int = 2;
3622 pub const ESRCH: c_int = 3;
3623 pub const EINTR: c_int = 4;
3624 pub const EIO: c_int = 5;
3625 pub const ENXIO: c_int = 6;
3626 pub const E2BIG: c_int = 7;
3627 pub const ENOEXEC: c_int = 8;
3628 pub const EBADF: c_int = 9;
3629 pub const ECHILD: c_int = 10;
3630 pub const EDEADLK: c_int = 11;
3631 pub const ENOMEM: c_int = 12;
3632 pub const EACCES: c_int = 13;
3633 pub const EFAULT: c_int = 14;
3634 pub const ENOTBLK: c_int = 15;
3635 pub const EBUSY: c_int = 16;
3636 pub const EEXIST: c_int = 17;
3637 pub const EXDEV: c_int = 18;
3638 pub const ENODEV: c_int = 19;
3639 pub const ENOTDIR: c_int = 20;
3640 pub const EISDIR: c_int = 21;
3641 pub const EINVAL: c_int = 22;
3642 pub const ENFILE: c_int = 23;
3643 pub const EMFILE: c_int = 24;
3644 pub const ENOTTY: c_int = 25;
3645 pub const ETXTBSY: c_int = 26;
3646 pub const EFBIG: c_int = 27;
3647 pub const ENOSPC: c_int = 28;
3648 pub const ESPIPE: c_int = 29;
3649 pub const EROFS: c_int = 30;
3650 pub const EMLINK: c_int = 31;
3651 pub const EPIPE: c_int = 32;
3652 pub const EDOM: c_int = 33;
3653 pub const ERANGE: c_int = 34;
3654 pub const EAGAIN: c_int = 35;
3655 pub const EWOULDBLOCK: c_int = EAGAIN;
3656 pub const EINPROGRESS: c_int = 36;
3657 pub const EALREADY: c_int = 37;
3658 pub const ENOTSOCK: c_int = 38;
3659 pub const EDESTADDRREQ: c_int = 39;
3660 pub const EMSGSIZE: c_int = 40;
3661 pub const EPROTOTYPE: c_int = 41;
3662 pub const ENOPROTOOPT: c_int = 42;
3663 pub const EPROTONOSUPPORT: c_int = 43;
3664 pub const ESOCKTNOSUPPORT: c_int = 44;
3665 pub const ENOTSUP: c_int = 45;
3666 pub const EPFNOSUPPORT: c_int = 46;
3667 pub const EAFNOSUPPORT: c_int = 47;
3668 pub const EADDRINUSE: c_int = 48;
3669 pub const EADDRNOTAVAIL: c_int = 49;
3670 pub const ENETDOWN: c_int = 50;
3671 pub const ENETUNREACH: c_int = 51;
3672 pub const ENETRESET: c_int = 52;
3673 pub const ECONNABORTED: c_int = 53;
3674 pub const ECONNRESET: c_int = 54;
3675 pub const ENOBUFS: c_int = 55;
3676 pub const EISCONN: c_int = 56;
3677 pub const ENOTCONN: c_int = 57;
3678 pub const ESHUTDOWN: c_int = 58;
3679 pub const ETOOMANYREFS: c_int = 59;
3680 pub const ETIMEDOUT: c_int = 60;
3681 pub const ECONNREFUSED: c_int = 61;
3682 pub const ELOOP: c_int = 62;
3683 pub const ENAMETOOLONG: c_int = 63;
3684 pub const EHOSTDOWN: c_int = 64;
3685 pub const EHOSTUNREACH: c_int = 65;
3686 pub const ENOTEMPTY: c_int = 66;
3687 pub const EPROCLIM: c_int = 67;
3688 pub const EUSERS: c_int = 68;
3689 pub const EDQUOT: c_int = 69;
3690 pub const ESTALE: c_int = 70;
3691 pub const EREMOTE: c_int = 71;
3692 pub const EBADRPC: c_int = 72;
3693 pub const ERPCMISMATCH: c_int = 73;
3694 pub const EPROGUNAVAIL: c_int = 74;
3695 pub const EPROGMISMATCH: c_int = 75;
3696 pub const EPROCUNAVAIL: c_int = 76;
3697 pub const ENOLCK: c_int = 77;
3698 pub const ENOSYS: c_int = 78;
3699 pub const EFTYPE: c_int = 79;
3700 pub const EAUTH: c_int = 80;
3701 pub const ENEEDAUTH: c_int = 81;
3702 pub const EPWROFF: c_int = 82;
3703 pub const EDEVERR: c_int = 83;
3704 pub const EOVERFLOW: c_int = 84;
3705 pub const EBADEXEC: c_int = 85;
3706 pub const EBADARCH: c_int = 86;
3707 pub const ESHLIBVERS: c_int = 87;
3708 pub const EBADMACHO: c_int = 88;
3709 pub const ECANCELED: c_int = 89;
3710 pub const EIDRM: c_int = 90;
3711 pub const ENOMSG: c_int = 91;
3712 pub const EILSEQ: c_int = 92;
3713 pub const ENOATTR: c_int = 93;
3714 pub const EBADMSG: c_int = 94;
3715 pub const EMULTIHOP: c_int = 95;
3716 pub const ENODATA: c_int = 96;
3717 pub const ENOLINK: c_int = 97;
3718 pub const ENOSR: c_int = 98;
3719 pub const ENOSTR: c_int = 99;
3720 pub const EPROTO: c_int = 100;
3721 pub const ETIME: c_int = 101;
3722 pub const EOPNOTSUPP: c_int = 102;
3723 pub const ENOPOLICY: c_int = 103;
3724 pub const ENOTRECOVERABLE: c_int = 104;
3725 pub const EOWNERDEAD: c_int = 105;
3726 pub const EQFULL: c_int = 106;
3727 pub const ELAST: c_int = 106;
3728
3729 pub const EAI_AGAIN: c_int = 2;
3730 pub const EAI_BADFLAGS: c_int = 3;
3731 pub const EAI_FAIL: c_int = 4;
3732 pub const EAI_FAMILY: c_int = 5;
3733 pub const EAI_MEMORY: c_int = 6;
3734 pub const EAI_NODATA: c_int = 7;
3735 pub const EAI_NONAME: c_int = 8;
3736 pub const EAI_SERVICE: c_int = 9;
3737 pub const EAI_SOCKTYPE: c_int = 10;
3738 pub const EAI_SYSTEM: c_int = 11;
3739 pub const EAI_OVERFLOW: c_int = 14;
3740
3741 pub const F_DUPFD: c_int = 0;
3742 pub const F_DUPFD_CLOEXEC: c_int = 67;
3743 pub const F_GETFD: c_int = 1;
3744 pub const F_SETFD: c_int = 2;
3745 pub const F_GETFL: c_int = 3;
3746 pub const F_SETFL: c_int = 4;
3747 pub const F_PREALLOCATE: c_int = 42;
3748 pub const F_RDADVISE: c_int = 44;
3749 pub const F_RDAHEAD: c_int = 45;
3750 pub const F_NOCACHE: c_int = 48;
3751 pub const F_LOG2PHYS: c_int = 49;
3752 pub const F_GETPATH: c_int = 50;
3753 pub const F_FULLFSYNC: c_int = 51;
3754 pub const F_FREEZE_FS: c_int = 53;
3755 pub const F_THAW_FS: c_int = 54;
3756 pub const F_GLOBAL_NOCACHE: c_int = 55;
3757 pub const F_NODIRECT: c_int = 62;
3758 pub const F_LOG2PHYS_EXT: c_int = 65;
3759 pub const F_BARRIERFSYNC: c_int = 85;
3760 // See https://github.com/apple/darwin-xnu/blob/main/bsd/sys/fcntl.h
3761 pub const F_OFD_SETLK: c_int = 90; /* Acquire or release open file description lock */
3762 pub const F_OFD_SETLKW: c_int = 91; /* (as F_OFD_SETLK but blocking if conflicting lock) */
3763 pub const F_OFD_GETLK: c_int = 92; /* Examine OFD lock */
3764 pub const F_PUNCHHOLE: c_int = 99;
3765 pub const F_TRIM_ACTIVE_FILE: c_int = 100;
3766 pub const F_SPECULATIVE_READ: c_int = 101;
3767 pub const F_GETPATH_NOFIRMLINK: c_int = 102;
3768 pub const F_TRANSFEREXTENTS: c_int = 110;
3769
3770 pub const F_ALLOCATECONTIG: c_uint = 0x02;
3771 pub const F_ALLOCATEALL: c_uint = 0x04;
3772 pub const F_ALLOCATEPERSIST: c_uint = 0x08;
3773
3774 pub const F_PEOFPOSMODE: c_int = 3;
3775 pub const F_VOLPOSMODE: c_int = 4;
3776
3777 pub const AT_FDCWD: c_int = -2;
3778 pub const AT_EACCESS: c_int = 0x0010;
3779 pub const AT_SYMLINK_NOFOLLOW: c_int = 0x0020;
3780 pub const AT_SYMLINK_FOLLOW: c_int = 0x0040;
3781 pub const AT_REMOVEDIR: c_int = 0x0080;
3782
3783 pub const PTHREAD_INTROSPECTION_THREAD_CREATE: c_uint = 1;
3784 pub const PTHREAD_INTROSPECTION_THREAD_START: c_uint = 2;
3785 pub const PTHREAD_INTROSPECTION_THREAD_TERMINATE: c_uint = 3;
3786 pub const PTHREAD_INTROSPECTION_THREAD_DESTROY: c_uint = 4;
3787
3788 pub const TIOCMODG: c_ulong = 0x40047403;
3789 pub const TIOCMODS: c_ulong = 0x80047404;
3790 pub const TIOCM_LE: c_int = 0x1;
3791 pub const TIOCM_DTR: c_int = 0x2;
3792 pub const TIOCM_RTS: c_int = 0x4;
3793 pub const TIOCM_ST: c_int = 0x8;
3794 pub const TIOCM_SR: c_int = 0x10;
3795 pub const TIOCM_CTS: c_int = 0x20;
3796 pub const TIOCM_CAR: c_int = 0x40;
3797 pub const TIOCM_CD: c_int = 0x40;
3798 pub const TIOCM_RNG: c_int = 0x80;
3799 pub const TIOCM_RI: c_int = 0x80;
3800 pub const TIOCM_DSR: c_int = 0x100;
3801 pub const TIOCEXCL: c_int = 0x2000740d;
3802 pub const TIOCNXCL: c_int = 0x2000740e;
3803 pub const TIOCFLUSH: c_ulong = 0x80047410;
3804 pub const TIOCGETD: c_ulong = 0x4004741a;
3805 pub const TIOCSETD: c_ulong = 0x8004741b;
3806 pub const TIOCIXON: c_uint = 0x20007481;
3807 pub const TIOCIXOFF: c_uint = 0x20007480;
3808 pub const TIOCSDTR: c_uint = 0x20007479;
3809 pub const TIOCCDTR: c_uint = 0x20007478;
3810 pub const TIOCGPGRP: c_ulong = 0x40047477;
3811 pub const TIOCSPGRP: c_ulong = 0x80047476;
3812 pub const TIOCOUTQ: c_ulong = 0x40047473;
3813 pub const TIOCSTI: c_ulong = 0x80017472;
3814 pub const TIOCNOTTY: c_uint = 0x20007471;
3815 pub const TIOCPKT: c_ulong = 0x80047470;
3816 pub const TIOCPKT_DATA: c_int = 0x0;
3817 pub const TIOCPKT_FLUSHREAD: c_int = 0x1;
3818 pub const TIOCPKT_FLUSHWRITE: c_int = 0x2;
3819 pub const TIOCPKT_STOP: c_int = 0x4;
3820 pub const TIOCPKT_START: c_int = 0x8;
3821 pub const TIOCPKT_NOSTOP: c_int = 0x10;
3822 pub const TIOCPKT_DOSTOP: c_int = 0x20;
3823 pub const TIOCPKT_IOCTL: c_int = 0x40;
3824 pub const TIOCSTOP: c_uint = 0x2000746f;
3825 pub const TIOCSTART: c_uint = 0x2000746e;
3826 pub const TIOCMSET: c_ulong = 0x8004746d;
3827 pub const TIOCMBIS: c_ulong = 0x8004746c;
3828 pub const TIOCMBIC: c_ulong = 0x8004746b;
3829 pub const TIOCMGET: c_ulong = 0x4004746a;
3830 pub const TIOCREMOTE: c_ulong = 0x80047469;
3831 pub const TIOCGWINSZ: c_ulong = 0x40087468;
3832 pub const TIOCSWINSZ: c_ulong = 0x80087467;
3833 pub const TIOCUCNTL: c_ulong = 0x80047466;
3834 pub const TIOCSTAT: c_uint = 0x20007465;
3835 pub const TIOCSCONS: c_uint = 0x20007463;
3836 pub const TIOCCONS: c_ulong = 0x80047462;
3837 pub const TIOCSCTTY: c_uint = 0x20007461;
3838 pub const TIOCEXT: c_ulong = 0x80047460;
3839 pub const TIOCSIG: c_uint = 0x2000745f;
3840 pub const TIOCDRAIN: c_uint = 0x2000745e;
3841 pub const TIOCMSDTRWAIT: c_ulong = 0x8004745b;
3842 pub const TIOCMGDTRWAIT: c_ulong = 0x4004745a;
3843 pub const TIOCSDRAINWAIT: c_ulong = 0x80047457;
3844 pub const TIOCGDRAINWAIT: c_ulong = 0x40047456;
3845 pub const TIOCDSIMICROCODE: c_uint = 0x20007455;
3846 pub const TIOCPTYGRANT: c_uint = 0x20007454;
3847 pub const TIOCPTYGNAME: c_uint = 0x40807453;
3848 pub const TIOCPTYUNLK: c_uint = 0x20007452;
3849
3850 pub const BIOCGRSIG: c_ulong = 0x40044272;
3851 pub const BIOCSRSIG: c_ulong = 0x80044273;
3852 pub const BIOCSDLT: c_ulong = 0x80044278;
3853 pub const BIOCGSEESENT: c_ulong = 0x40044276;
3854 pub const BIOCSSEESENT: c_ulong = 0x80044277;
3855 pub const BIOCGDLTLIST: c_ulong = 0xc00c4279;
3856
3857 pub const FIODTYPE: c_ulong = 0x4004667a;
3858
3859 pub const B0: speed_t = 0;
3860 pub const B50: speed_t = 50;
3861 pub const B75: speed_t = 75;
3862 pub const B110: speed_t = 110;
3863 pub const B134: speed_t = 134;
3864 pub const B150: speed_t = 150;
3865 pub const B200: speed_t = 200;
3866 pub const B300: speed_t = 300;
3867 pub const B600: speed_t = 600;
3868 pub const B1200: speed_t = 1200;
3869 pub const B1800: speed_t = 1800;
3870 pub const B2400: speed_t = 2400;
3871 pub const B4800: speed_t = 4800;
3872 pub const B9600: speed_t = 9600;
3873 pub const B19200: speed_t = 19200;
3874 pub const B38400: speed_t = 38400;
3875 pub const B7200: speed_t = 7200;
3876 pub const B14400: speed_t = 14400;
3877 pub const B28800: speed_t = 28800;
3878 pub const B57600: speed_t = 57600;
3879 pub const B76800: speed_t = 76800;
3880 pub const B115200: speed_t = 115200;
3881 pub const B230400: speed_t = 230400;
3882 pub const EXTA: speed_t = 19200;
3883 pub const EXTB: speed_t = 38400;
3884
3885 pub const SIGTRAP: c_int = 5;
3886
3887 pub const GLOB_APPEND: c_int = 0x0001;
3888 pub const GLOB_DOOFFS: c_int = 0x0002;
3889 pub const GLOB_ERR: c_int = 0x0004;
3890 pub const GLOB_MARK: c_int = 0x0008;
3891 pub const GLOB_NOCHECK: c_int = 0x0010;
3892 pub const GLOB_NOSORT: c_int = 0x0020;
3893 pub const GLOB_NOESCAPE: c_int = 0x2000;
3894
3895 pub const GLOB_NOSPACE: c_int = -1;
3896 pub const GLOB_ABORTED: c_int = -2;
3897 pub const GLOB_NOMATCH: c_int = -3;
3898
3899 pub const POSIX_MADV_NORMAL: c_int = 0;
3900 pub const POSIX_MADV_RANDOM: c_int = 1;
3901 pub const POSIX_MADV_SEQUENTIAL: c_int = 2;
3902 pub const POSIX_MADV_WILLNEED: c_int = 3;
3903 pub const POSIX_MADV_DONTNEED: c_int = 4;
3904
3905 pub const _SC_IOV_MAX: c_int = 56;
3906 pub const _SC_GETGR_R_SIZE_MAX: c_int = 70;
3907 pub const _SC_GETPW_R_SIZE_MAX: c_int = 71;
3908 pub const _SC_LOGIN_NAME_MAX: c_int = 73;
3909 pub const _SC_MQ_PRIO_MAX: c_int = 75;
3910 pub const _SC_THREAD_ATTR_STACKADDR: c_int = 82;
3911 pub const _SC_THREAD_ATTR_STACKSIZE: c_int = 83;
3912 pub const _SC_THREAD_DESTRUCTOR_ITERATIONS: c_int = 85;
3913 pub const _SC_THREAD_KEYS_MAX: c_int = 86;
3914 pub const _SC_THREAD_PRIO_INHERIT: c_int = 87;
3915 pub const _SC_THREAD_PRIO_PROTECT: c_int = 88;
3916 pub const _SC_THREAD_PRIORITY_SCHEDULING: c_int = 89;
3917 pub const _SC_THREAD_PROCESS_SHARED: c_int = 90;
3918 pub const _SC_THREAD_SAFE_FUNCTIONS: c_int = 91;
3919 pub const _SC_THREAD_STACK_MIN: c_int = 93;
3920 pub const _SC_THREAD_THREADS_MAX: c_int = 94;
3921 pub const _SC_THREADS: c_int = 96;
3922 pub const _SC_TTY_NAME_MAX: c_int = 101;
3923 pub const _SC_ATEXIT_MAX: c_int = 107;
3924 pub const _SC_XOPEN_CRYPT: c_int = 108;
3925 pub const _SC_XOPEN_ENH_I18N: c_int = 109;
3926 pub const _SC_XOPEN_LEGACY: c_int = 110;
3927 pub const _SC_XOPEN_REALTIME: c_int = 111;
3928 pub const _SC_XOPEN_REALTIME_THREADS: c_int = 112;
3929 pub const _SC_XOPEN_SHM: c_int = 113;
3930 pub const _SC_XOPEN_UNIX: c_int = 115;
3931 pub const _SC_XOPEN_VERSION: c_int = 116;
3932 pub const _SC_XOPEN_XCU_VERSION: c_int = 121;
3933 pub const _SC_PHYS_PAGES: c_int = 200;
3934
3935 pub const PTHREAD_PROCESS_PRIVATE: c_int = 2;
3936 pub const PTHREAD_PROCESS_SHARED: c_int = 1;
3937 pub const PTHREAD_CREATE_JOINABLE: c_int = 1;
3938 pub const PTHREAD_CREATE_DETACHED: c_int = 2;
3939 pub const PTHREAD_INHERIT_SCHED: c_int = 1;
3940 pub const PTHREAD_EXPLICIT_SCHED: c_int = 2;
3941 pub const PTHREAD_CANCEL_ENABLE: c_int = 0x01;
3942 pub const PTHREAD_CANCEL_DISABLE: c_int = 0x00;
3943 pub const PTHREAD_CANCEL_DEFERRED: c_int = 0x02;
3944 pub const PTHREAD_CANCEL_ASYNCHRONOUS: c_int = 0x00;
3945 pub const PTHREAD_CANCELED: *mut c_void = 1 as *mut c_void;
3946 pub const PTHREAD_SCOPE_SYSTEM: c_int = 1;
3947 pub const PTHREAD_SCOPE_PROCESS: c_int = 2;
3948 pub const PTHREAD_PRIO_NONE: c_int = 0;
3949 pub const PTHREAD_PRIO_INHERIT: c_int = 1;
3950 pub const PTHREAD_PRIO_PROTECT: c_int = 2;
3951
3952 #[cfg(target_arch = "aarch64")]
3953 pub const PTHREAD_STACK_MIN: size_t = 16384;
3954 #[cfg(not(target_arch = "aarch64"))]
3955 pub const PTHREAD_STACK_MIN: size_t = 8192;
3956
3957 pub const RLIMIT_CPU: c_int = 0;
3958 pub const RLIMIT_FSIZE: c_int = 1;
3959 pub const RLIMIT_DATA: c_int = 2;
3960 pub const RLIMIT_STACK: c_int = 3;
3961 pub const RLIMIT_CORE: c_int = 4;
3962 pub const RLIMIT_AS: c_int = 5;
3963 pub const RLIMIT_RSS: c_int = RLIMIT_AS;
3964 pub const RLIMIT_MEMLOCK: c_int = 6;
3965 pub const RLIMIT_NPROC: c_int = 7;
3966 pub const RLIMIT_NOFILE: c_int = 8;
3967 #[deprecated(since = "0.2.64", note = "Not stable across OS versions")]
3968 pub const RLIM_NLIMITS: c_int = 9;
3969 pub const _RLIMIT_POSIX_FLAG: c_int = 0x1000;
3970
3971 pub const RLIM_INFINITY: rlim_t = 0x7fff_ffff_ffff_ffff;
3972
3973 pub const RUSAGE_SELF: c_int = 0;
3974 pub const RUSAGE_CHILDREN: c_int = -1;
3975
3976 pub const MADV_NORMAL: c_int = 0;
3977 pub const MADV_RANDOM: c_int = 1;
3978 pub const MADV_SEQUENTIAL: c_int = 2;
3979 pub const MADV_WILLNEED: c_int = 3;
3980 pub const MADV_DONTNEED: c_int = 4;
3981 pub const MADV_FREE: c_int = 5;
3982 pub const MADV_ZERO_WIRED_PAGES: c_int = 6;
3983 pub const MADV_FREE_REUSABLE: c_int = 7;
3984 pub const MADV_FREE_REUSE: c_int = 8;
3985 pub const MADV_CAN_REUSE: c_int = 9;
3986
3987 pub const MINCORE_INCORE: c_int = 0x1;
3988 pub const MINCORE_REFERENCED: c_int = 0x2;
3989 pub const MINCORE_MODIFIED: c_int = 0x4;
3990 pub const MINCORE_REFERENCED_OTHER: c_int = 0x8;
3991 pub const MINCORE_MODIFIED_OTHER: c_int = 0x10;
3992
3993 pub const CTLIOCGINFO: c_ulong = 0xc0644e03;
3994
3995 //
3996 // sys/netinet/in.h
3997 // Protocols (RFC 1700)
3998 // NOTE: These are in addition to the constants defined in src/unix/mod.rs
3999
4000 // IPPROTO_IP defined in src/unix/mod.rs
4001 /// IP6 hop-by-hop options
4002 pub const IPPROTO_HOPOPTS: c_int = 0;
4003 // IPPROTO_ICMP defined in src/unix/mod.rs
4004 /// group mgmt protocol
4005 pub const IPPROTO_IGMP: c_int = 2;
4006 /// gateway<sup>2</sup> (deprecated)
4007 pub const IPPROTO_GGP: c_int = 3;
4008 /// for compatibility
4009 pub const IPPROTO_IPIP: c_int = 4;
4010 // IPPROTO_TCP defined in src/unix/mod.rs
4011 /// Stream protocol II.
4012 pub const IPPROTO_ST: c_int = 7;
4013 /// exterior gateway protocol
4014 pub const IPPROTO_EGP: c_int = 8;
4015 /// private interior gateway
4016 pub const IPPROTO_PIGP: c_int = 9;
4017 /// BBN RCC Monitoring
4018 pub const IPPROTO_RCCMON: c_int = 10;
4019 /// network voice protocol
4020 pub const IPPROTO_NVPII: c_int = 11;
4021 /// pup
4022 pub const IPPROTO_PUP: c_int = 12;
4023 /// Argus
4024 pub const IPPROTO_ARGUS: c_int = 13;
4025 /// EMCON
4026 pub const IPPROTO_EMCON: c_int = 14;
4027 /// Cross Net Debugger
4028 pub const IPPROTO_XNET: c_int = 15;
4029 /// Chaos
4030 pub const IPPROTO_CHAOS: c_int = 16;
4031 // IPPROTO_UDP defined in src/unix/mod.rs
4032 /// Multiplexing
4033 pub const IPPROTO_MUX: c_int = 18;
4034 /// DCN Measurement Subsystems
4035 pub const IPPROTO_MEAS: c_int = 19;
4036 /// Host Monitoring
4037 pub const IPPROTO_HMP: c_int = 20;
4038 /// Packet Radio Measurement
4039 pub const IPPROTO_PRM: c_int = 21;
4040 /// xns idp
4041 pub const IPPROTO_IDP: c_int = 22;
4042 /// Trunk-1
4043 pub const IPPROTO_TRUNK1: c_int = 23;
4044 /// Trunk-2
4045 pub const IPPROTO_TRUNK2: c_int = 24;
4046 /// Leaf-1
4047 pub const IPPROTO_LEAF1: c_int = 25;
4048 /// Leaf-2
4049 pub const IPPROTO_LEAF2: c_int = 26;
4050 /// Reliable Data
4051 pub const IPPROTO_RDP: c_int = 27;
4052 /// Reliable Transaction
4053 pub const IPPROTO_IRTP: c_int = 28;
4054 /// tp-4 w/ class negotiation
4055 pub const IPPROTO_TP: c_int = 29;
4056 /// Bulk Data Transfer
4057 pub const IPPROTO_BLT: c_int = 30;
4058 /// Network Services
4059 pub const IPPROTO_NSP: c_int = 31;
4060 /// Merit Internodal
4061 pub const IPPROTO_INP: c_int = 32;
4062 /// Sequential Exchange
4063 pub const IPPROTO_SEP: c_int = 33;
4064 /// Third Party Connect
4065 pub const IPPROTO_3PC: c_int = 34;
4066 /// InterDomain Policy Routing
4067 pub const IPPROTO_IDPR: c_int = 35;
4068 /// XTP
4069 pub const IPPROTO_XTP: c_int = 36;
4070 /// Datagram Delivery
4071 pub const IPPROTO_DDP: c_int = 37;
4072 /// Control Message Transport
4073 pub const IPPROTO_CMTP: c_int = 38;
4074 /// TP++ Transport
4075 pub const IPPROTO_TPXX: c_int = 39;
4076 /// IL transport protocol
4077 pub const IPPROTO_IL: c_int = 40;
4078 // IPPROTO_IPV6 defined in src/unix/mod.rs
4079 /// Source Demand Routing
4080 pub const IPPROTO_SDRP: c_int = 42;
4081 /// IP6 routing header
4082 pub const IPPROTO_ROUTING: c_int = 43;
4083 /// IP6 fragmentation header
4084 pub const IPPROTO_FRAGMENT: c_int = 44;
4085 /// InterDomain Routing
4086 pub const IPPROTO_IDRP: c_int = 45;
4087 /// resource reservation
4088 pub const IPPROTO_RSVP: c_int = 46;
4089 /// General Routing Encap.
4090 pub const IPPROTO_GRE: c_int = 47;
4091 /// Mobile Host Routing
4092 pub const IPPROTO_MHRP: c_int = 48;
4093 /// BHA
4094 pub const IPPROTO_BHA: c_int = 49;
4095 /// IP6 Encap Sec. Payload
4096 pub const IPPROTO_ESP: c_int = 50;
4097 /// IP6 Auth Header
4098 pub const IPPROTO_AH: c_int = 51;
4099 /// Integ. Net Layer Security
4100 pub const IPPROTO_INLSP: c_int = 52;
4101 /// IP with encryption
4102 pub const IPPROTO_SWIPE: c_int = 53;
4103 /// Next Hop Resolution
4104 pub const IPPROTO_NHRP: c_int = 54;
4105 /* 55-57: Unassigned */
4106 // IPPROTO_ICMPV6 defined in src/unix/mod.rs
4107 /// IP6 no next header
4108 pub const IPPROTO_NONE: c_int = 59;
4109 /// IP6 destination option
4110 pub const IPPROTO_DSTOPTS: c_int = 60;
4111 /// any host internal protocol
4112 pub const IPPROTO_AHIP: c_int = 61;
4113 /// CFTP
4114 pub const IPPROTO_CFTP: c_int = 62;
4115 /// "hello" routing protocol
4116 pub const IPPROTO_HELLO: c_int = 63;
4117 /// SATNET/Backroom EXPAK
4118 pub const IPPROTO_SATEXPAK: c_int = 64;
4119 /// Kryptolan
4120 pub const IPPROTO_KRYPTOLAN: c_int = 65;
4121 /// Remote Virtual Disk
4122 pub const IPPROTO_RVD: c_int = 66;
4123 /// Pluribus Packet Core
4124 pub const IPPROTO_IPPC: c_int = 67;
4125 /// Any distributed FS
4126 pub const IPPROTO_ADFS: c_int = 68;
4127 /// Satnet Monitoring
4128 pub const IPPROTO_SATMON: c_int = 69;
4129 /// VISA Protocol
4130 pub const IPPROTO_VISA: c_int = 70;
4131 /// Packet Core Utility
4132 pub const IPPROTO_IPCV: c_int = 71;
4133 /// Comp. Prot. Net. Executive
4134 pub const IPPROTO_CPNX: c_int = 72;
4135 /// Comp. Prot. HeartBeat
4136 pub const IPPROTO_CPHB: c_int = 73;
4137 /// Wang Span Network
4138 pub const IPPROTO_WSN: c_int = 74;
4139 /// Packet Video Protocol
4140 pub const IPPROTO_PVP: c_int = 75;
4141 /// BackRoom SATNET Monitoring
4142 pub const IPPROTO_BRSATMON: c_int = 76;
4143 /// Sun net disk proto (temp.)
4144 pub const IPPROTO_ND: c_int = 77;
4145 /// WIDEBAND Monitoring
4146 pub const IPPROTO_WBMON: c_int = 78;
4147 /// WIDEBAND EXPAK
4148 pub const IPPROTO_WBEXPAK: c_int = 79;
4149 /// ISO cnlp
4150 pub const IPPROTO_EON: c_int = 80;
4151 /// VMTP
4152 pub const IPPROTO_VMTP: c_int = 81;
4153 /// Secure VMTP
4154 pub const IPPROTO_SVMTP: c_int = 82;
4155 /// Banyon VINES
4156 pub const IPPROTO_VINES: c_int = 83;
4157 /// TTP
4158 pub const IPPROTO_TTP: c_int = 84;
4159 /// NSFNET-IGP
4160 pub const IPPROTO_IGP: c_int = 85;
4161 /// dissimilar gateway prot.
4162 pub const IPPROTO_DGP: c_int = 86;
4163 /// TCF
4164 pub const IPPROTO_TCF: c_int = 87;
4165 /// Cisco/GXS IGRP
4166 pub const IPPROTO_IGRP: c_int = 88;
4167 /// OSPFIGP
4168 pub const IPPROTO_OSPFIGP: c_int = 89;
4169 /// Strite RPC protocol
4170 pub const IPPROTO_SRPC: c_int = 90;
4171 /// Locus Address Resoloution
4172 pub const IPPROTO_LARP: c_int = 91;
4173 /// Multicast Transport
4174 pub const IPPROTO_MTP: c_int = 92;
4175 /// AX.25 Frames
4176 pub const IPPROTO_AX25: c_int = 93;
4177 /// IP encapsulated in IP
4178 pub const IPPROTO_IPEIP: c_int = 94;
4179 /// Mobile Int.ing control
4180 pub const IPPROTO_MICP: c_int = 95;
4181 /// Semaphore Comm. security
4182 pub const IPPROTO_SCCSP: c_int = 96;
4183 /// Ethernet IP encapsulation
4184 pub const IPPROTO_ETHERIP: c_int = 97;
4185 /// encapsulation header
4186 pub const IPPROTO_ENCAP: c_int = 98;
4187 /// any private encr. scheme
4188 pub const IPPROTO_APES: c_int = 99;
4189 /// GMTP
4190 pub const IPPROTO_GMTP: c_int = 100;
4191
4192 /* 101-254: Partly Unassigned */
4193 /// Protocol Independent Mcast
4194 pub const IPPROTO_PIM: c_int = 103;
4195 /// payload compression (IPComp)
4196 pub const IPPROTO_IPCOMP: c_int = 108;
4197 /// PGM
4198 pub const IPPROTO_PGM: c_int = 113;
4199 /// SCTP
4200 pub const IPPROTO_SCTP: c_int = 132;
4201
4202 /* 255: Reserved */
4203 /* BSD Private, local use, namespace incursion */
4204 /// divert pseudo-protocol
4205 pub const IPPROTO_DIVERT: c_int = 254;
4206 /// raw IP packet
4207 pub const IPPROTO_RAW: c_int = 255;
4208 pub const IPPROTO_MAX: c_int = 256;
4209 /// last return value of *_input(), meaning "all job for this pkt is done".
4210 pub const IPPROTO_DONE: c_int = 257;
4211
4212 pub const AF_UNSPEC: c_int = 0;
4213 pub const AF_LOCAL: c_int = 1;
4214 pub const AF_UNIX: c_int = AF_LOCAL;
4215 pub const AF_INET: c_int = 2;
4216 pub const AF_IMPLINK: c_int = 3;
4217 pub const AF_PUP: c_int = 4;
4218 pub const AF_CHAOS: c_int = 5;
4219 pub const AF_NS: c_int = 6;
4220 pub const AF_ISO: c_int = 7;
4221 pub const AF_OSI: c_int = AF_ISO;
4222 pub const AF_ECMA: c_int = 8;
4223 pub const AF_DATAKIT: c_int = 9;
4224 pub const AF_CCITT: c_int = 10;
4225 pub const AF_SNA: c_int = 11;
4226 pub const AF_DECnet: c_int = 12;
4227 pub const AF_DLI: c_int = 13;
4228 pub const AF_LAT: c_int = 14;
4229 pub const AF_HYLINK: c_int = 15;
4230 pub const AF_APPLETALK: c_int = 16;
4231 pub const AF_ROUTE: c_int = 17;
4232 pub const AF_LINK: c_int = 18;
4233 pub const pseudo_AF_XTP: c_int = 19;
4234 pub const AF_COIP: c_int = 20;
4235 pub const AF_CNT: c_int = 21;
4236 pub const pseudo_AF_RTIP: c_int = 22;
4237 pub const AF_IPX: c_int = 23;
4238 pub const AF_SIP: c_int = 24;
4239 pub const pseudo_AF_PIP: c_int = 25;
4240 pub const AF_NDRV: c_int = 27;
4241 pub const AF_ISDN: c_int = 28;
4242 pub const AF_E164: c_int = AF_ISDN;
4243 pub const pseudo_AF_KEY: c_int = 29;
4244 pub const AF_INET6: c_int = 30;
4245 pub const AF_NATM: c_int = 31;
4246 pub const AF_SYSTEM: c_int = 32;
4247 pub const AF_NETBIOS: c_int = 33;
4248 pub const AF_PPP: c_int = 34;
4249 pub const pseudo_AF_HDRCMPLT: c_int = 35;
4250 pub const AF_IEEE80211: c_int = 37;
4251 pub const AF_UTUN: c_int = 38;
4252 pub const AF_VSOCK: c_int = 40;
4253 pub const AF_SYS_CONTROL: c_int = 2;
4254
4255 pub const SYSPROTO_EVENT: c_int = 1;
4256 pub const SYSPROTO_CONTROL: c_int = 2;
4257
4258 pub const PF_UNSPEC: c_int = AF_UNSPEC;
4259 pub const PF_LOCAL: c_int = AF_LOCAL;
4260 pub const PF_UNIX: c_int = PF_LOCAL;
4261 pub const PF_INET: c_int = AF_INET;
4262 pub const PF_IMPLINK: c_int = AF_IMPLINK;
4263 pub const PF_PUP: c_int = AF_PUP;
4264 pub const PF_CHAOS: c_int = AF_CHAOS;
4265 pub const PF_NS: c_int = AF_NS;
4266 pub const PF_ISO: c_int = AF_ISO;
4267 pub const PF_OSI: c_int = AF_ISO;
4268 pub const PF_ECMA: c_int = AF_ECMA;
4269 pub const PF_DATAKIT: c_int = AF_DATAKIT;
4270 pub const PF_CCITT: c_int = AF_CCITT;
4271 pub const PF_SNA: c_int = AF_SNA;
4272 pub const PF_DECnet: c_int = AF_DECnet;
4273 pub const PF_DLI: c_int = AF_DLI;
4274 pub const PF_LAT: c_int = AF_LAT;
4275 pub const PF_HYLINK: c_int = AF_HYLINK;
4276 pub const PF_APPLETALK: c_int = AF_APPLETALK;
4277 pub const PF_ROUTE: c_int = AF_ROUTE;
4278 pub const PF_LINK: c_int = AF_LINK;
4279 pub const PF_XTP: c_int = pseudo_AF_XTP;
4280 pub const PF_COIP: c_int = AF_COIP;
4281 pub const PF_CNT: c_int = AF_CNT;
4282 pub const PF_SIP: c_int = AF_SIP;
4283 pub const PF_IPX: c_int = AF_IPX;
4284 pub const PF_RTIP: c_int = pseudo_AF_RTIP;
4285 pub const PF_PIP: c_int = pseudo_AF_PIP;
4286 pub const PF_NDRV: c_int = AF_NDRV;
4287 pub const PF_ISDN: c_int = AF_ISDN;
4288 pub const PF_KEY: c_int = pseudo_AF_KEY;
4289 pub const PF_INET6: c_int = AF_INET6;
4290 pub const PF_NATM: c_int = AF_NATM;
4291 pub const PF_SYSTEM: c_int = AF_SYSTEM;
4292 pub const PF_NETBIOS: c_int = AF_NETBIOS;
4293 pub const PF_PPP: c_int = AF_PPP;
4294 pub const PF_VSOCK: c_int = AF_VSOCK;
4295
4296 pub const NET_RT_DUMP: c_int = 1;
4297 pub const NET_RT_FLAGS: c_int = 2;
4298 pub const NET_RT_IFLIST: c_int = 3;
4299
4300 pub const SOMAXCONN: c_int = 128;
4301
4302 pub const SOCK_MAXADDRLEN: c_int = 255;
4303
4304 pub const SOCK_STREAM: c_int = 1;
4305 pub const SOCK_DGRAM: c_int = 2;
4306 pub const SOCK_RAW: c_int = 3;
4307 pub const SOCK_RDM: c_int = 4;
4308 pub const SOCK_SEQPACKET: c_int = 5;
4309 pub const IP_TTL: c_int = 4;
4310 pub const IP_HDRINCL: c_int = 2;
4311 pub const IP_RECVDSTADDR: c_int = 7;
4312 pub const IP_ADD_MEMBERSHIP: c_int = 12;
4313 pub const IP_DROP_MEMBERSHIP: c_int = 13;
4314 pub const IP_RECVIF: c_int = 20;
4315 pub const IP_RECVTTL: c_int = 24;
4316 pub const IP_BOUND_IF: c_int = 25;
4317 pub const IP_PKTINFO: c_int = 26;
4318 pub const IP_RECVTOS: c_int = 27;
4319 pub const IP_DONTFRAG: c_int = 28;
4320 pub const IPV6_JOIN_GROUP: c_int = 12;
4321 pub const IPV6_LEAVE_GROUP: c_int = 13;
4322 pub const IPV6_CHECKSUM: c_int = 26;
4323 pub const IPV6_RECVTCLASS: c_int = 35;
4324 pub const IPV6_TCLASS: c_int = 36;
4325 pub const IPV6_RECVHOPLIMIT: c_int = 37;
4326 pub const IPV6_PKTINFO: c_int = 46;
4327 pub const IPV6_HOPLIMIT: c_int = 47;
4328 pub const IPV6_RECVPKTINFO: c_int = 61;
4329 pub const IP_ADD_SOURCE_MEMBERSHIP: c_int = 70;
4330 pub const IP_DROP_SOURCE_MEMBERSHIP: c_int = 71;
4331 pub const IP_BLOCK_SOURCE: c_int = 72;
4332 pub const IP_UNBLOCK_SOURCE: c_int = 73;
4333 pub const IPV6_BOUND_IF: c_int = 125;
4334
4335 pub const TCP_NOPUSH: c_int = 4;
4336 pub const TCP_NOOPT: c_int = 8;
4337 pub const TCP_KEEPALIVE: c_int = 0x10;
4338 pub const TCP_KEEPINTVL: c_int = 0x101;
4339 pub const TCP_KEEPCNT: c_int = 0x102;
4340 /// Enable/Disable TCP Fastopen on this socket
4341 pub const TCP_FASTOPEN: c_int = 0x105;
4342 pub const TCP_CONNECTION_INFO: c_int = 0x106;
4343
4344 pub const SOL_LOCAL: c_int = 0;
4345
4346 /// Retrieve peer credentials.
4347 pub const LOCAL_PEERCRED: c_int = 0x001;
4348 /// Retrieve peer PID.
4349 pub const LOCAL_PEERPID: c_int = 0x002;
4350 /// Retrieve effective peer PID.
4351 pub const LOCAL_PEEREPID: c_int = 0x003;
4352 /// Retrieve peer UUID.
4353 pub const LOCAL_PEERUUID: c_int = 0x004;
4354 /// Retrieve effective peer UUID.
4355 pub const LOCAL_PEEREUUID: c_int = 0x005;
4356 /// Retrieve peer audit token.
4357 pub const LOCAL_PEERTOKEN: c_int = 0x006;
4358
4359 pub const SOL_SOCKET: c_int = 0xffff;
4360
4361 pub const SO_DEBUG: c_int = 0x01;
4362 pub const SO_ACCEPTCONN: c_int = 0x0002;
4363 pub const SO_REUSEADDR: c_int = 0x0004;
4364 pub const SO_KEEPALIVE: c_int = 0x0008;
4365 pub const SO_DONTROUTE: c_int = 0x0010;
4366 pub const SO_BROADCAST: c_int = 0x0020;
4367 pub const SO_USELOOPBACK: c_int = 0x0040;
4368 pub const SO_LINGER: c_int = 0x0080;
4369 pub const SO_OOBINLINE: c_int = 0x0100;
4370 pub const SO_REUSEPORT: c_int = 0x0200;
4371 pub const SO_TIMESTAMP: c_int = 0x0400;
4372 pub const SO_TIMESTAMP_MONOTONIC: c_int = 0x0800;
4373 pub const SO_DONTTRUNC: c_int = 0x2000;
4374 pub const SO_WANTMORE: c_int = 0x4000;
4375 pub const SO_WANTOOBFLAG: c_int = 0x8000;
4376 pub const SO_SNDBUF: c_int = 0x1001;
4377 pub const SO_RCVBUF: c_int = 0x1002;
4378 pub const SO_SNDLOWAT: c_int = 0x1003;
4379 pub const SO_RCVLOWAT: c_int = 0x1004;
4380 pub const SO_SNDTIMEO: c_int = 0x1005;
4381 pub const SO_RCVTIMEO: c_int = 0x1006;
4382 pub const SO_ERROR: c_int = 0x1007;
4383 pub const SO_TYPE: c_int = 0x1008;
4384 pub const SO_LABEL: c_int = 0x1010;
4385 pub const SO_PEERLABEL: c_int = 0x1011;
4386 pub const SO_NREAD: c_int = 0x1020;
4387 pub const SO_NKE: c_int = 0x1021;
4388 pub const SO_NOSIGPIPE: c_int = 0x1022;
4389 pub const SO_NOADDRERR: c_int = 0x1023;
4390 pub const SO_NWRITE: c_int = 0x1024;
4391 pub const SO_REUSESHAREUID: c_int = 0x1025;
4392 pub const SO_NOTIFYCONFLICT: c_int = 0x1026;
4393 pub const SO_LINGER_SEC: c_int = 0x1080;
4394 pub const SO_RANDOMPORT: c_int = 0x1082;
4395 pub const SO_NP_EXTENSIONS: c_int = 0x1083;
4396
4397 pub const MSG_OOB: c_int = 0x1;
4398 pub const MSG_PEEK: c_int = 0x2;
4399 pub const MSG_DONTROUTE: c_int = 0x4;
4400 pub const MSG_EOR: c_int = 0x8;
4401 pub const MSG_TRUNC: c_int = 0x10;
4402 pub const MSG_CTRUNC: c_int = 0x20;
4403 pub const MSG_WAITALL: c_int = 0x40;
4404 pub const MSG_DONTWAIT: c_int = 0x80;
4405 pub const MSG_EOF: c_int = 0x100;
4406 pub const MSG_FLUSH: c_int = 0x400;
4407 pub const MSG_HOLD: c_int = 0x800;
4408 pub const MSG_SEND: c_int = 0x1000;
4409 pub const MSG_HAVEMORE: c_int = 0x2000;
4410 pub const MSG_RCVMORE: c_int = 0x4000;
4411 pub const MSG_NEEDSA: c_int = 0x10000;
4412 pub const MSG_NOSIGNAL: c_int = 0x80000;
4413
4414 pub const SCM_TIMESTAMP: c_int = 0x02;
4415 pub const SCM_CREDS: c_int = 0x03;
4416
4417 // https://github.com/aosm/xnu/blob/HEAD/bsd/net/if.h#L140-L156
4418 pub const IFF_UP: c_int = 0x1; // interface is up
4419 pub const IFF_BROADCAST: c_int = 0x2; // broadcast address valid
4420 pub const IFF_DEBUG: c_int = 0x4; // turn on debugging
4421 pub const IFF_LOOPBACK: c_int = 0x8; // is a loopback net
4422 pub const IFF_POINTOPOINT: c_int = 0x10; // interface is point-to-point link
4423 pub const IFF_NOTRAILERS: c_int = 0x20; // obsolete: avoid use of trailers
4424 pub const IFF_RUNNING: c_int = 0x40; // resources allocated
4425 pub const IFF_NOARP: c_int = 0x80; // no address resolution protocol
4426 pub const IFF_PROMISC: c_int = 0x100; // receive all packets
4427 pub const IFF_ALLMULTI: c_int = 0x200; // receive all multicast packets
4428 pub const IFF_OACTIVE: c_int = 0x400; // transmission in progress
4429 pub const IFF_SIMPLEX: c_int = 0x800; // can't hear own transmissions
4430 pub const IFF_LINK0: c_int = 0x1000; // per link layer defined bit
4431 pub const IFF_LINK1: c_int = 0x2000; // per link layer defined bit
4432 pub const IFF_LINK2: c_int = 0x4000; // per link layer defined bit
4433 pub const IFF_ALTPHYS: c_int = IFF_LINK2; // use alternate physical connection
4434 pub const IFF_MULTICAST: c_int = 0x8000; // supports multicast
4435
4436 pub const SCOPE6_ID_MAX: size_t = 16;
4437
4438 pub const SHUT_RD: c_int = 0;
4439 pub const SHUT_WR: c_int = 1;
4440 pub const SHUT_RDWR: c_int = 2;
4441
4442 pub const SAE_ASSOCID_ANY: crate::sae_associd_t = 0;
4443 /// ((sae_associd_t)(-1ULL))
4444 pub const SAE_ASSOCID_ALL: crate::sae_associd_t = 0xffffffff;
4445
4446 pub const SAE_CONNID_ANY: crate::sae_connid_t = 0;
4447 /// ((sae_connid_t)(-1ULL))
4448 pub const SAE_CONNID_ALL: crate::sae_connid_t = 0xffffffff;
4449
4450 // connectx() flag parameters
4451
4452 /// resume connect() on read/write
4453 pub const CONNECT_RESUME_ON_READ_WRITE: c_uint = 0x1;
4454 /// data is idempotent
4455 pub const CONNECT_DATA_IDEMPOTENT: c_uint = 0x2;
4456 /// data includes security that replaces the TFO-cookie
4457 pub const CONNECT_DATA_AUTHENTICATED: c_uint = 0x4;
4458
4459 pub const LOCK_SH: c_int = 1;
4460 pub const LOCK_EX: c_int = 2;
4461 pub const LOCK_NB: c_int = 4;
4462 pub const LOCK_UN: c_int = 8;
4463
4464 pub const MAP_COPY: c_int = 0x0002;
4465 pub const MAP_RENAME: c_int = 0x0020;
4466 pub const MAP_NORESERVE: c_int = 0x0040;
4467 pub const MAP_NOEXTEND: c_int = 0x0100;
4468 pub const MAP_HASSEMAPHORE: c_int = 0x0200;
4469 pub const MAP_NOCACHE: c_int = 0x0400;
4470 pub const MAP_JIT: c_int = 0x0800;
4471
4472 pub const _SC_ARG_MAX: c_int = 1;
4473 pub const _SC_CHILD_MAX: c_int = 2;
4474 pub const _SC_CLK_TCK: c_int = 3;
4475 pub const _SC_NGROUPS_MAX: c_int = 4;
4476 pub const _SC_OPEN_MAX: c_int = 5;
4477 pub const _SC_JOB_CONTROL: c_int = 6;
4478 pub const _SC_SAVED_IDS: c_int = 7;
4479 pub const _SC_VERSION: c_int = 8;
4480 pub const _SC_BC_BASE_MAX: c_int = 9;
4481 pub const _SC_BC_DIM_MAX: c_int = 10;
4482 pub const _SC_BC_SCALE_MAX: c_int = 11;
4483 pub const _SC_BC_STRING_MAX: c_int = 12;
4484 pub const _SC_COLL_WEIGHTS_MAX: c_int = 13;
4485 pub const _SC_EXPR_NEST_MAX: c_int = 14;
4486 pub const _SC_LINE_MAX: c_int = 15;
4487 pub const _SC_RE_DUP_MAX: c_int = 16;
4488 pub const _SC_2_VERSION: c_int = 17;
4489 pub const _SC_2_C_BIND: c_int = 18;
4490 pub const _SC_2_C_DEV: c_int = 19;
4491 pub const _SC_2_CHAR_TERM: c_int = 20;
4492 pub const _SC_2_FORT_DEV: c_int = 21;
4493 pub const _SC_2_FORT_RUN: c_int = 22;
4494 pub const _SC_2_LOCALEDEF: c_int = 23;
4495 pub const _SC_2_SW_DEV: c_int = 24;
4496 pub const _SC_2_UPE: c_int = 25;
4497 pub const _SC_STREAM_MAX: c_int = 26;
4498 pub const _SC_TZNAME_MAX: c_int = 27;
4499 pub const _SC_ASYNCHRONOUS_IO: c_int = 28;
4500 pub const _SC_PAGESIZE: c_int = 29;
4501 pub const _SC_MEMLOCK: c_int = 30;
4502 pub const _SC_MEMLOCK_RANGE: c_int = 31;
4503 pub const _SC_MEMORY_PROTECTION: c_int = 32;
4504 pub const _SC_MESSAGE_PASSING: c_int = 33;
4505 pub const _SC_PRIORITIZED_IO: c_int = 34;
4506 pub const _SC_PRIORITY_SCHEDULING: c_int = 35;
4507 pub const _SC_REALTIME_SIGNALS: c_int = 36;
4508 pub const _SC_SEMAPHORES: c_int = 37;
4509 pub const _SC_FSYNC: c_int = 38;
4510 pub const _SC_SHARED_MEMORY_OBJECTS: c_int = 39;
4511 pub const _SC_SYNCHRONIZED_IO: c_int = 40;
4512 pub const _SC_TIMERS: c_int = 41;
4513 pub const _SC_AIO_LISTIO_MAX: c_int = 42;
4514 pub const _SC_AIO_MAX: c_int = 43;
4515 pub const _SC_AIO_PRIO_DELTA_MAX: c_int = 44;
4516 pub const _SC_DELAYTIMER_MAX: c_int = 45;
4517 pub const _SC_MQ_OPEN_MAX: c_int = 46;
4518 pub const _SC_MAPPED_FILES: c_int = 47;
4519 pub const _SC_RTSIG_MAX: c_int = 48;
4520 pub const _SC_SEM_NSEMS_MAX: c_int = 49;
4521 pub const _SC_SEM_VALUE_MAX: c_int = 50;
4522 pub const _SC_SIGQUEUE_MAX: c_int = 51;
4523 pub const _SC_TIMER_MAX: c_int = 52;
4524 pub const _SC_NPROCESSORS_CONF: c_int = 57;
4525 pub const _SC_NPROCESSORS_ONLN: c_int = 58;
4526 pub const _SC_2_PBS: c_int = 59;
4527 pub const _SC_2_PBS_ACCOUNTING: c_int = 60;
4528 pub const _SC_2_PBS_CHECKPOINT: c_int = 61;
4529 pub const _SC_2_PBS_LOCATE: c_int = 62;
4530 pub const _SC_2_PBS_MESSAGE: c_int = 63;
4531 pub const _SC_2_PBS_TRACK: c_int = 64;
4532 pub const _SC_ADVISORY_INFO: c_int = 65;
4533 pub const _SC_BARRIERS: c_int = 66;
4534 pub const _SC_CLOCK_SELECTION: c_int = 67;
4535 pub const _SC_CPUTIME: c_int = 68;
4536 pub const _SC_FILE_LOCKING: c_int = 69;
4537 pub const _SC_HOST_NAME_MAX: c_int = 72;
4538 pub const _SC_MONOTONIC_CLOCK: c_int = 74;
4539 pub const _SC_READER_WRITER_LOCKS: c_int = 76;
4540 pub const _SC_REGEXP: c_int = 77;
4541 pub const _SC_SHELL: c_int = 78;
4542 pub const _SC_SPAWN: c_int = 79;
4543 pub const _SC_SPIN_LOCKS: c_int = 80;
4544 pub const _SC_SPORADIC_SERVER: c_int = 81;
4545 pub const _SC_THREAD_CPUTIME: c_int = 84;
4546 pub const _SC_THREAD_SPORADIC_SERVER: c_int = 92;
4547 pub const _SC_TIMEOUTS: c_int = 95;
4548 pub const _SC_TRACE: c_int = 97;
4549 pub const _SC_TRACE_EVENT_FILTER: c_int = 98;
4550 pub const _SC_TRACE_INHERIT: c_int = 99;
4551 pub const _SC_TRACE_LOG: c_int = 100;
4552 pub const _SC_TYPED_MEMORY_OBJECTS: c_int = 102;
4553 pub const _SC_V6_ILP32_OFF32: c_int = 103;
4554 pub const _SC_V6_ILP32_OFFBIG: c_int = 104;
4555 pub const _SC_V6_LP64_OFF64: c_int = 105;
4556 pub const _SC_V6_LPBIG_OFFBIG: c_int = 106;
4557 pub const _SC_IPV6: c_int = 118;
4558 pub const _SC_RAW_SOCKETS: c_int = 119;
4559 pub const _SC_SYMLOOP_MAX: c_int = 120;
4560 pub const _SC_PAGE_SIZE: c_int = _SC_PAGESIZE;
4561 pub const _SC_XOPEN_STREAMS: c_int = 114;
4562 pub const _SC_XBS5_ILP32_OFF32: c_int = 122;
4563 pub const _SC_XBS5_ILP32_OFFBIG: c_int = 123;
4564 pub const _SC_XBS5_LP64_OFF64: c_int = 124;
4565 pub const _SC_XBS5_LPBIG_OFFBIG: c_int = 125;
4566 pub const _SC_SS_REPL_MAX: c_int = 126;
4567 pub const _SC_TRACE_EVENT_NAME_MAX: c_int = 127;
4568 pub const _SC_TRACE_NAME_MAX: c_int = 128;
4569 pub const _SC_TRACE_SYS_MAX: c_int = 129;
4570 pub const _SC_TRACE_USER_EVENT_MAX: c_int = 130;
4571 pub const _SC_PASS_MAX: c_int = 131;
4572 // `confstr` keys (only the values guaranteed by `man confstr`).
4573 pub const _CS_PATH: c_int = 1;
4574 pub const _CS_DARWIN_USER_DIR: c_int = 65536;
4575 pub const _CS_DARWIN_USER_TEMP_DIR: c_int = 65537;
4576 pub const _CS_DARWIN_USER_CACHE_DIR: c_int = 65538;
4577
4578 pub const PTHREAD_MUTEX_NORMAL: c_int = 0;
4579 pub const PTHREAD_MUTEX_ERRORCHECK: c_int = 1;
4580 pub const PTHREAD_MUTEX_RECURSIVE: c_int = 2;
4581 pub const PTHREAD_MUTEX_DEFAULT: c_int = PTHREAD_MUTEX_NORMAL;
4582 pub const _PTHREAD_MUTEX_SIG_init: c_long = 0x32AAABA7;
4583 pub const _PTHREAD_COND_SIG_init: c_long = 0x3CB0B1BB;
4584 pub const _PTHREAD_RWLOCK_SIG_init: c_long = 0x2DA8B3B4;
4585 pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = pthread_mutex_t {
4586 __sig: _PTHREAD_MUTEX_SIG_init,
4587 __opaque: [0; __PTHREAD_MUTEX_SIZE__],
4588 };
4589 pub const PTHREAD_COND_INITIALIZER: pthread_cond_t = pthread_cond_t {
4590 __sig: _PTHREAD_COND_SIG_init,
4591 __opaque: [0; __PTHREAD_COND_SIZE__],
4592 };
4593 pub const PTHREAD_RWLOCK_INITIALIZER: pthread_rwlock_t = pthread_rwlock_t {
4594 __sig: _PTHREAD_RWLOCK_SIG_init,
4595 __opaque: [0; __PTHREAD_RWLOCK_SIZE__],
4596 };
4597
4598 pub const OS_UNFAIR_LOCK_INIT: os_unfair_lock = os_unfair_lock {
4599 _os_unfair_lock_opaque: 0,
4600 };
4601
4602 pub const OS_LOG_TYPE_DEFAULT: crate::os_log_type_t = 0x00;
4603 pub const OS_LOG_TYPE_INFO: crate::os_log_type_t = 0x01;
4604 pub const OS_LOG_TYPE_DEBUG: crate::os_log_type_t = 0x02;
4605 pub const OS_LOG_TYPE_ERROR: crate::os_log_type_t = 0x10;
4606 pub const OS_LOG_TYPE_FAULT: crate::os_log_type_t = 0x11;
4607
4608 pub const OS_SIGNPOST_EVENT: crate::os_signpost_type_t = 0x00;
4609 pub const OS_SIGNPOST_INTERVAL_BEGIN: crate::os_signpost_type_t = 0x01;
4610 pub const OS_SIGNPOST_INTERVAL_END: crate::os_signpost_type_t = 0x02;
4611
4612 pub const MINSIGSTKSZ: size_t = 32768;
4613 pub const SIGSTKSZ: size_t = 131072;
4614
4615 pub const FD_SETSIZE: usize = 1024;
4616
4617 pub const ST_NOSUID: c_ulong = 2;
4618
4619 pub const SCHED_OTHER: c_int = 1;
4620 pub const SCHED_FIFO: c_int = 4;
4621 pub const SCHED_RR: c_int = 2;
4622
4623 pub const EVFILT_READ: i16 = -1;
4624 pub const EVFILT_WRITE: i16 = -2;
4625 pub const EVFILT_AIO: i16 = -3;
4626 pub const EVFILT_VNODE: i16 = -4;
4627 pub const EVFILT_PROC: i16 = -5;
4628 pub const EVFILT_SIGNAL: i16 = -6;
4629 pub const EVFILT_TIMER: i16 = -7;
4630 pub const EVFILT_MACHPORT: i16 = -8;
4631 pub const EVFILT_FS: i16 = -9;
4632 pub const EVFILT_USER: i16 = -10;
4633 pub const EVFILT_VM: i16 = -12;
4634
4635 pub const EV_ADD: u16 = 0x1;
4636 pub const EV_DELETE: u16 = 0x2;
4637 pub const EV_ENABLE: u16 = 0x4;
4638 pub const EV_DISABLE: u16 = 0x8;
4639 pub const EV_ONESHOT: u16 = 0x10;
4640 pub const EV_CLEAR: u16 = 0x20;
4641 pub const EV_RECEIPT: u16 = 0x40;
4642 pub const EV_DISPATCH: u16 = 0x80;
4643 pub const EV_FLAG0: u16 = 0x1000;
4644 pub const EV_POLL: u16 = 0x1000;
4645 pub const EV_FLAG1: u16 = 0x2000;
4646 pub const EV_OOBAND: u16 = 0x2000;
4647 pub const EV_ERROR: u16 = 0x4000;
4648 pub const EV_EOF: u16 = 0x8000;
4649 pub const EV_SYSFLAGS: u16 = 0xf000;
4650
4651 pub const NOTE_TRIGGER: u32 = 0x01000000;
4652 pub const NOTE_FFNOP: u32 = 0x00000000;
4653 pub const NOTE_FFAND: u32 = 0x40000000;
4654 pub const NOTE_FFOR: u32 = 0x80000000;
4655 pub const NOTE_FFCOPY: u32 = 0xc0000000;
4656 pub const NOTE_FFCTRLMASK: u32 = 0xc0000000;
4657 pub const NOTE_FFLAGSMASK: u32 = 0x00ffffff;
4658 pub const NOTE_LOWAT: u32 = 0x00000001;
4659 pub const NOTE_DELETE: u32 = 0x00000001;
4660 pub const NOTE_WRITE: u32 = 0x00000002;
4661 pub const NOTE_EXTEND: u32 = 0x00000004;
4662 pub const NOTE_ATTRIB: u32 = 0x00000008;
4663 pub const NOTE_LINK: u32 = 0x00000010;
4664 pub const NOTE_RENAME: u32 = 0x00000020;
4665 pub const NOTE_REVOKE: u32 = 0x00000040;
4666 pub const NOTE_NONE: u32 = 0x00000080;
4667 pub const NOTE_EXIT: u32 = 0x80000000;
4668 pub const NOTE_FORK: u32 = 0x40000000;
4669 pub const NOTE_EXEC: u32 = 0x20000000;
4670 #[doc(hidden)]
4671 #[deprecated(since = "0.2.49", note = "Deprecated since MacOSX 10.9")]
4672 pub const NOTE_REAP: u32 = 0x10000000;
4673 pub const NOTE_SIGNAL: u32 = 0x08000000;
4674 pub const NOTE_EXITSTATUS: u32 = 0x04000000;
4675 pub const NOTE_EXIT_DETAIL: u32 = 0x02000000;
4676 pub const NOTE_PDATAMASK: u32 = 0x000fffff;
4677 pub const NOTE_PCTRLMASK: u32 = 0xfff00000;
4678 #[doc(hidden)]
4679 #[deprecated(since = "0.2.49", note = "Deprecated since MacOSX 10.9")]
4680 pub const NOTE_EXIT_REPARENTED: u32 = 0x00080000;
4681 pub const NOTE_EXIT_DETAIL_MASK: u32 = 0x00070000;
4682 pub const NOTE_EXIT_DECRYPTFAIL: u32 = 0x00010000;
4683 pub const NOTE_EXIT_MEMORY: u32 = 0x00020000;
4684 pub const NOTE_EXIT_CSERROR: u32 = 0x00040000;
4685 pub const NOTE_VM_PRESSURE: u32 = 0x80000000;
4686 pub const NOTE_VM_PRESSURE_TERMINATE: u32 = 0x40000000;
4687 pub const NOTE_VM_PRESSURE_SUDDEN_TERMINATE: u32 = 0x20000000;
4688 pub const NOTE_VM_ERROR: u32 = 0x10000000;
4689 pub const NOTE_SECONDS: u32 = 0x00000001;
4690 pub const NOTE_USECONDS: u32 = 0x00000002;
4691 pub const NOTE_NSECONDS: u32 = 0x00000004;
4692 pub const NOTE_ABSOLUTE: u32 = 0x00000008;
4693 pub const NOTE_LEEWAY: u32 = 0x00000010;
4694 pub const NOTE_CRITICAL: u32 = 0x00000020;
4695 pub const NOTE_BACKGROUND: u32 = 0x00000040;
4696 pub const NOTE_MACH_CONTINUOUS_TIME: u32 = 0x00000080;
4697 pub const NOTE_MACHTIME: u32 = 0x00000100;
4698 pub const NOTE_TRACK: u32 = 0x00000001;
4699 pub const NOTE_TRACKERR: u32 = 0x00000002;
4700 pub const NOTE_CHILD: u32 = 0x00000004;
4701
4702 pub const OCRNL: crate::tcflag_t = 0x00000010;
4703 pub const ONOCR: crate::tcflag_t = 0x00000020;
4704 pub const ONLRET: crate::tcflag_t = 0x00000040;
4705 pub const OFILL: crate::tcflag_t = 0x00000080;
4706 pub const NLDLY: crate::tcflag_t = 0x00000300;
4707 pub const TABDLY: crate::tcflag_t = 0x00000c04;
4708 pub const CRDLY: crate::tcflag_t = 0x00003000;
4709 pub const FFDLY: crate::tcflag_t = 0x00004000;
4710 pub const BSDLY: crate::tcflag_t = 0x00008000;
4711 pub const VTDLY: crate::tcflag_t = 0x00010000;
4712 pub const OFDEL: crate::tcflag_t = 0x00020000;
4713
4714 pub const NL0: crate::tcflag_t = 0x00000000;
4715 pub const NL1: crate::tcflag_t = 0x00000100;
4716 pub const TAB0: crate::tcflag_t = 0x00000000;
4717 pub const TAB1: crate::tcflag_t = 0x00000400;
4718 pub const TAB2: crate::tcflag_t = 0x00000800;
4719 pub const CR0: crate::tcflag_t = 0x00000000;
4720 pub const CR1: crate::tcflag_t = 0x00001000;
4721 pub const CR2: crate::tcflag_t = 0x00002000;
4722 pub const CR3: crate::tcflag_t = 0x00003000;
4723 pub const FF0: crate::tcflag_t = 0x00000000;
4724 pub const FF1: crate::tcflag_t = 0x00004000;
4725 pub const BS0: crate::tcflag_t = 0x00000000;
4726 pub const BS1: crate::tcflag_t = 0x00008000;
4727 pub const TAB3: crate::tcflag_t = 0x00000004;
4728 pub const VT0: crate::tcflag_t = 0x00000000;
4729 pub const VT1: crate::tcflag_t = 0x00010000;
4730 pub const IUTF8: crate::tcflag_t = 0x00004000;
4731 pub const CRTSCTS: crate::tcflag_t = 0x00030000;
4732
4733 pub const NI_MAXHOST: crate::socklen_t = 1025;
4734 pub const NI_MAXSERV: crate::socklen_t = 32;
4735 pub const NI_NOFQDN: c_int = 0x00000001;
4736 pub const NI_NUMERICHOST: c_int = 0x00000002;
4737 pub const NI_NAMEREQD: c_int = 0x00000004;
4738 pub const NI_NUMERICSERV: c_int = 0x00000008;
4739 pub const NI_NUMERICSCOPE: c_int = 0x00000100;
4740 pub const NI_DGRAM: c_int = 0x00000010;
4741
4742 pub const Q_GETQUOTA: c_int = 0x300;
4743 pub const Q_SETQUOTA: c_int = 0x400;
4744
4745 pub const RENAME_SWAP: c_uint = 0x00000002;
4746 pub const RENAME_EXCL: c_uint = 0x00000004;
4747
4748 pub const RTLD_LOCAL: c_int = 0x4;
4749 pub const RTLD_FIRST: c_int = 0x100;
4750 pub const RTLD_NODELETE: c_int = 0x80;
4751 pub const RTLD_NOLOAD: c_int = 0x10;
4752 pub const RTLD_GLOBAL: c_int = 0x8;
4753 pub const RTLD_MAIN_ONLY: *mut c_void = -5isize as *mut c_void;
4754
4755 pub const _WSTOPPED: c_int = 0o177;
4756
4757 pub const LOG_NETINFO: c_int = 12 << 3;
4758 pub const LOG_REMOTEAUTH: c_int = 13 << 3;
4759 pub const LOG_INSTALL: c_int = 14 << 3;
4760 pub const LOG_RAS: c_int = 15 << 3;
4761 pub const LOG_LAUNCHD: c_int = 24 << 3;
4762 pub const LOG_NFACILITIES: c_int = 25;
4763
4764 pub const CTLTYPE: c_int = 0xf;
4765 pub const CTLTYPE_NODE: c_int = 1;
4766 pub const CTLTYPE_INT: c_int = 2;
4767 pub const CTLTYPE_STRING: c_int = 3;
4768 pub const CTLTYPE_QUAD: c_int = 4;
4769 pub const CTLTYPE_OPAQUE: c_int = 5;
4770 pub const CTLTYPE_STRUCT: c_int = CTLTYPE_OPAQUE;
4771 pub const CTLFLAG_RD: c_int = 0x80000000;
4772 pub const CTLFLAG_WR: c_int = 0x40000000;
4773 pub const CTLFLAG_RW: c_int = CTLFLAG_RD | CTLFLAG_WR;
4774 pub const CTLFLAG_NOLOCK: c_int = 0x20000000;
4775 pub const CTLFLAG_ANYBODY: c_int = 0x10000000;
4776 pub const CTLFLAG_SECURE: c_int = 0x08000000;
4777 pub const CTLFLAG_MASKED: c_int = 0x04000000;
4778 pub const CTLFLAG_NOAUTO: c_int = 0x02000000;
4779 pub const CTLFLAG_KERN: c_int = 0x01000000;
4780 pub const CTLFLAG_LOCKED: c_int = 0x00800000;
4781 pub const CTLFLAG_OID2: c_int = 0x00400000;
4782 pub const CTL_UNSPEC: c_int = 0;
4783 pub const CTL_KERN: c_int = 1;
4784 pub const CTL_VM: c_int = 2;
4785 pub const CTL_VFS: c_int = 3;
4786 pub const CTL_NET: c_int = 4;
4787 pub const CTL_DEBUG: c_int = 5;
4788 pub const CTL_HW: c_int = 6;
4789 pub const CTL_MACHDEP: c_int = 7;
4790 pub const CTL_USER: c_int = 8;
4791 pub const CTL_MAXID: c_int = 9;
4792 pub const KERN_OSTYPE: c_int = 1;
4793 pub const KERN_OSRELEASE: c_int = 2;
4794 pub const KERN_OSREV: c_int = 3;
4795 pub const KERN_VERSION: c_int = 4;
4796 pub const KERN_MAXVNODES: c_int = 5;
4797 pub const KERN_MAXPROC: c_int = 6;
4798 pub const KERN_MAXFILES: c_int = 7;
4799 pub const KERN_ARGMAX: c_int = 8;
4800 pub const KERN_SECURELVL: c_int = 9;
4801 pub const KERN_HOSTNAME: c_int = 10;
4802 pub const KERN_HOSTID: c_int = 11;
4803 pub const KERN_CLOCKRATE: c_int = 12;
4804 pub const KERN_VNODE: c_int = 13;
4805 pub const KERN_PROC: c_int = 14;
4806 pub const KERN_FILE: c_int = 15;
4807 pub const KERN_PROF: c_int = 16;
4808 pub const KERN_POSIX1: c_int = 17;
4809 pub const KERN_NGROUPS: c_int = 18;
4810 pub const KERN_JOB_CONTROL: c_int = 19;
4811 pub const KERN_SAVED_IDS: c_int = 20;
4812 pub const KERN_BOOTTIME: c_int = 21;
4813 pub const KERN_NISDOMAINNAME: c_int = 22;
4814 pub const KERN_DOMAINNAME: c_int = KERN_NISDOMAINNAME;
4815 pub const KERN_MAXPARTITIONS: c_int = 23;
4816 pub const KERN_KDEBUG: c_int = 24;
4817 pub const KERN_UPDATEINTERVAL: c_int = 25;
4818 pub const KERN_OSRELDATE: c_int = 26;
4819 pub const KERN_NTP_PLL: c_int = 27;
4820 pub const KERN_BOOTFILE: c_int = 28;
4821 pub const KERN_MAXFILESPERPROC: c_int = 29;
4822 pub const KERN_MAXPROCPERUID: c_int = 30;
4823 pub const KERN_DUMPDEV: c_int = 31;
4824 pub const KERN_IPC: c_int = 32;
4825 pub const KERN_DUMMY: c_int = 33;
4826 pub const KERN_PS_STRINGS: c_int = 34;
4827 pub const KERN_USRSTACK32: c_int = 35;
4828 pub const KERN_LOGSIGEXIT: c_int = 36;
4829 pub const KERN_SYMFILE: c_int = 37;
4830 pub const KERN_PROCARGS: c_int = 38;
4831 pub const KERN_NETBOOT: c_int = 40;
4832 pub const KERN_SYSV: c_int = 42;
4833 pub const KERN_AFFINITY: c_int = 43;
4834 pub const KERN_TRANSLATE: c_int = 44;
4835 pub const KERN_CLASSIC: c_int = KERN_TRANSLATE;
4836 pub const KERN_EXEC: c_int = 45;
4837 pub const KERN_CLASSICHANDLER: c_int = KERN_EXEC;
4838 pub const KERN_AIOMAX: c_int = 46;
4839 pub const KERN_AIOPROCMAX: c_int = 47;
4840 pub const KERN_AIOTHREADS: c_int = 48;
4841 pub const KERN_COREFILE: c_int = 50;
4842 pub const KERN_COREDUMP: c_int = 51;
4843 pub const KERN_SUGID_COREDUMP: c_int = 52;
4844 pub const KERN_PROCDELAYTERM: c_int = 53;
4845 pub const KERN_SHREG_PRIVATIZABLE: c_int = 54;
4846 pub const KERN_LOW_PRI_WINDOW: c_int = 56;
4847 pub const KERN_LOW_PRI_DELAY: c_int = 57;
4848 pub const KERN_POSIX: c_int = 58;
4849 pub const KERN_USRSTACK64: c_int = 59;
4850 pub const KERN_NX_PROTECTION: c_int = 60;
4851 pub const KERN_TFP: c_int = 61;
4852 pub const KERN_PROCNAME: c_int = 62;
4853 pub const KERN_THALTSTACK: c_int = 63;
4854 pub const KERN_SPECULATIVE_READS: c_int = 64;
4855 pub const KERN_OSVERSION: c_int = 65;
4856 pub const KERN_SAFEBOOT: c_int = 66;
4857 pub const KERN_RAGEVNODE: c_int = 68;
4858 pub const KERN_TTY: c_int = 69;
4859 pub const KERN_CHECKOPENEVT: c_int = 70;
4860 pub const KERN_THREADNAME: c_int = 71;
4861 pub const KERN_MAXID: c_int = 72;
4862 pub const KERN_RAGE_PROC: c_int = 1;
4863 pub const KERN_RAGE_THREAD: c_int = 2;
4864 pub const KERN_UNRAGE_PROC: c_int = 3;
4865 pub const KERN_UNRAGE_THREAD: c_int = 4;
4866 pub const KERN_OPENEVT_PROC: c_int = 1;
4867 pub const KERN_UNOPENEVT_PROC: c_int = 2;
4868 pub const KERN_TFP_POLICY: c_int = 1;
4869 pub const KERN_TFP_POLICY_DENY: c_int = 0;
4870 pub const KERN_TFP_POLICY_DEFAULT: c_int = 2;
4871 pub const KERN_KDEFLAGS: c_int = 1;
4872 pub const KERN_KDDFLAGS: c_int = 2;
4873 pub const KERN_KDENABLE: c_int = 3;
4874 pub const KERN_KDSETBUF: c_int = 4;
4875 pub const KERN_KDGETBUF: c_int = 5;
4876 pub const KERN_KDSETUP: c_int = 6;
4877 pub const KERN_KDREMOVE: c_int = 7;
4878 pub const KERN_KDSETREG: c_int = 8;
4879 pub const KERN_KDGETREG: c_int = 9;
4880 pub const KERN_KDREADTR: c_int = 10;
4881 pub const KERN_KDPIDTR: c_int = 11;
4882 pub const KERN_KDTHRMAP: c_int = 12;
4883 pub const KERN_KDPIDEX: c_int = 14;
4884 pub const KERN_KDSETRTCDEC: c_int = 15;
4885 pub const KERN_KDGETENTROPY: c_int = 16;
4886 pub const KERN_KDWRITETR: c_int = 17;
4887 pub const KERN_KDWRITEMAP: c_int = 18;
4888 #[doc(hidden)]
4889 #[deprecated(since = "0.2.49", note = "Removed in MacOSX 10.12")]
4890 pub const KERN_KDENABLE_BG_TRACE: c_int = 19;
4891 #[doc(hidden)]
4892 #[deprecated(since = "0.2.49", note = "Removed in MacOSX 10.12")]
4893 pub const KERN_KDDISABLE_BG_TRACE: c_int = 20;
4894 pub const KERN_KDREADCURTHRMAP: c_int = 21;
4895 pub const KERN_KDSET_TYPEFILTER: c_int = 22;
4896 pub const KERN_KDBUFWAIT: c_int = 23;
4897 pub const KERN_KDCPUMAP: c_int = 24;
4898 pub const KERN_PROC_ALL: c_int = 0;
4899 pub const KERN_PROC_PID: c_int = 1;
4900 pub const KERN_PROC_PGRP: c_int = 2;
4901 pub const KERN_PROC_SESSION: c_int = 3;
4902 pub const KERN_PROC_TTY: c_int = 4;
4903 pub const KERN_PROC_UID: c_int = 5;
4904 pub const KERN_PROC_RUID: c_int = 6;
4905 pub const KERN_PROC_LCID: c_int = 7;
4906 pub const KERN_SUCCESS: c_int = 0;
4907 pub const KERN_INVALID_ADDRESS: c_int = 1;
4908 pub const KERN_PROTECTION_FAILURE: c_int = 2;
4909 pub const KERN_NO_SPACE: c_int = 3;
4910 pub const KERN_INVALID_ARGUMENT: c_int = 4;
4911 pub const KERN_FAILURE: c_int = 5;
4912 pub const KERN_RESOURCE_SHORTAGE: c_int = 6;
4913 pub const KERN_NOT_RECEIVER: c_int = 7;
4914 pub const KERN_NO_ACCESS: c_int = 8;
4915 pub const KERN_MEMORY_FAILURE: c_int = 9;
4916 pub const KERN_MEMORY_ERROR: c_int = 10;
4917 pub const KERN_ALREADY_IN_SET: c_int = 11;
4918 pub const KERN_NOT_IN_SET: c_int = 12;
4919 pub const KERN_NAME_EXISTS: c_int = 13;
4920 pub const KERN_ABORTED: c_int = 14;
4921 pub const KERN_INVALID_NAME: c_int = 15;
4922 pub const KERN_INVALID_TASK: c_int = 16;
4923 pub const KERN_INVALID_RIGHT: c_int = 17;
4924 pub const KERN_INVALID_VALUE: c_int = 18;
4925 pub const KERN_UREFS_OVERFLOW: c_int = 19;
4926 pub const KERN_INVALID_CAPABILITY: c_int = 20;
4927 pub const KERN_RIGHT_EXISTS: c_int = 21;
4928 pub const KERN_INVALID_HOST: c_int = 22;
4929 pub const KERN_MEMORY_PRESENT: c_int = 23;
4930 pub const KERN_MEMORY_DATA_MOVED: c_int = 24;
4931 pub const KERN_MEMORY_RESTART_COPY: c_int = 25;
4932 pub const KERN_INVALID_PROCESSOR_SET: c_int = 26;
4933 pub const KERN_POLICY_LIMIT: c_int = 27;
4934 pub const KERN_INVALID_POLICY: c_int = 28;
4935 pub const KERN_INVALID_OBJECT: c_int = 29;
4936 pub const KERN_ALREADY_WAITING: c_int = 30;
4937 pub const KERN_DEFAULT_SET: c_int = 31;
4938 pub const KERN_EXCEPTION_PROTECTED: c_int = 32;
4939 pub const KERN_INVALID_LEDGER: c_int = 33;
4940 pub const KERN_INVALID_MEMORY_CONTROL: c_int = 34;
4941 pub const KERN_INVALID_SECURITY: c_int = 35;
4942 pub const KERN_NOT_DEPRESSED: c_int = 36;
4943 pub const KERN_TERMINATED: c_int = 37;
4944 pub const KERN_LOCK_SET_DESTROYED: c_int = 38;
4945 pub const KERN_LOCK_UNSTABLE: c_int = 39;
4946 pub const KERN_LOCK_OWNED: c_int = 40;
4947 pub const KERN_LOCK_OWNED_SELF: c_int = 41;
4948 pub const KERN_SEMAPHORE_DESTROYED: c_int = 42;
4949 pub const KERN_RPC_SERVER_TERMINATED: c_int = 43;
4950 pub const KERN_RPC_TERMINATE_ORPHAN: c_int = 44;
4951 pub const KERN_RPC_CONTINUE_ORPHAN: c_int = 45;
4952 pub const KERN_NOT_SUPPORTED: c_int = 46;
4953 pub const KERN_NODE_DOWN: c_int = 47;
4954 pub const KERN_NOT_WAITING: c_int = 48;
4955 pub const KERN_OPERATION_TIMED_OUT: c_int = 49;
4956 pub const KERN_CODESIGN_ERROR: c_int = 50;
4957 pub const KERN_POLICY_STATIC: c_int = 51;
4958 pub const KERN_INSUFFICIENT_BUFFER_SIZE: c_int = 52;
4959 pub const KIPC_MAXSOCKBUF: c_int = 1;
4960 pub const KIPC_SOCKBUF_WASTE: c_int = 2;
4961 pub const KIPC_SOMAXCONN: c_int = 3;
4962 pub const KIPC_MAX_LINKHDR: c_int = 4;
4963 pub const KIPC_MAX_PROTOHDR: c_int = 5;
4964 pub const KIPC_MAX_HDR: c_int = 6;
4965 pub const KIPC_MAX_DATALEN: c_int = 7;
4966 pub const KIPC_MBSTAT: c_int = 8;
4967 pub const KIPC_NMBCLUSTERS: c_int = 9;
4968 pub const KIPC_SOQLIMITCOMPAT: c_int = 10;
4969 pub const VM_METER: c_int = 1;
4970 pub const VM_LOADAVG: c_int = 2;
4971 pub const VM_MACHFACTOR: c_int = 4;
4972 pub const VM_SWAPUSAGE: c_int = 5;
4973 pub const VM_MAXID: c_int = 6;
4974 pub const VM_PROT_NONE: crate::vm_prot_t = 0x00;
4975 pub const VM_PROT_READ: crate::vm_prot_t = 0x01;
4976 pub const VM_PROT_WRITE: crate::vm_prot_t = 0x02;
4977 pub const VM_PROT_EXECUTE: crate::vm_prot_t = 0x04;
4978 pub const MEMORY_OBJECT_NULL: crate::memory_object_t = 0;
4979 pub const HW_MACHINE: c_int = 1;
4980 pub const HW_MODEL: c_int = 2;
4981 pub const HW_NCPU: c_int = 3;
4982 pub const HW_BYTEORDER: c_int = 4;
4983 pub const HW_PHYSMEM: c_int = 5;
4984 pub const HW_USERMEM: c_int = 6;
4985 pub const HW_PAGESIZE: c_int = 7;
4986 pub const HW_DISKNAMES: c_int = 8;
4987 pub const HW_DISKSTATS: c_int = 9;
4988 pub const HW_EPOCH: c_int = 10;
4989 pub const HW_FLOATINGPT: c_int = 11;
4990 pub const HW_MACHINE_ARCH: c_int = 12;
4991 pub const HW_VECTORUNIT: c_int = 13;
4992 pub const HW_BUS_FREQ: c_int = 14;
4993 pub const HW_CPU_FREQ: c_int = 15;
4994 pub const HW_CACHELINE: c_int = 16;
4995 pub const HW_L1ICACHESIZE: c_int = 17;
4996 pub const HW_L1DCACHESIZE: c_int = 18;
4997 pub const HW_L2SETTINGS: c_int = 19;
4998 pub const HW_L2CACHESIZE: c_int = 20;
4999 pub const HW_L3SETTINGS: c_int = 21;
5000 pub const HW_L3CACHESIZE: c_int = 22;
5001 pub const HW_TB_FREQ: c_int = 23;
5002 pub const HW_MEMSIZE: c_int = 24;
5003 pub const HW_AVAILCPU: c_int = 25;
5004 pub const HW_TARGET: c_int = 26;
5005 pub const HW_PRODUCT: c_int = 27;
5006 pub const HW_MAXID: c_int = 28;
5007 pub const USER_CS_PATH: c_int = 1;
5008 pub const USER_BC_BASE_MAX: c_int = 2;
5009 pub const USER_BC_DIM_MAX: c_int = 3;
5010 pub const USER_BC_SCALE_MAX: c_int = 4;
5011 pub const USER_BC_STRING_MAX: c_int = 5;
5012 pub const USER_COLL_WEIGHTS_MAX: c_int = 6;
5013 pub const USER_EXPR_NEST_MAX: c_int = 7;
5014 pub const USER_LINE_MAX: c_int = 8;
5015 pub const USER_RE_DUP_MAX: c_int = 9;
5016 pub const USER_POSIX2_VERSION: c_int = 10;
5017 pub const USER_POSIX2_C_BIND: c_int = 11;
5018 pub const USER_POSIX2_C_DEV: c_int = 12;
5019 pub const USER_POSIX2_CHAR_TERM: c_int = 13;
5020 pub const USER_POSIX2_FORT_DEV: c_int = 14;
5021 pub const USER_POSIX2_FORT_RUN: c_int = 15;
5022 pub const USER_POSIX2_LOCALEDEF: c_int = 16;
5023 pub const USER_POSIX2_SW_DEV: c_int = 17;
5024 pub const USER_POSIX2_UPE: c_int = 18;
5025 pub const USER_STREAM_MAX: c_int = 19;
5026 pub const USER_TZNAME_MAX: c_int = 20;
5027 pub const USER_MAXID: c_int = 21;
5028 pub const CTL_DEBUG_NAME: c_int = 0;
5029 pub const CTL_DEBUG_VALUE: c_int = 1;
5030 pub const CTL_DEBUG_MAXID: c_int = 20;
5031
5032 pub const PRIO_DARWIN_THREAD: c_int = 3;
5033 pub const PRIO_DARWIN_PROCESS: c_int = 4;
5034 pub const PRIO_DARWIN_BG: c_int = 0x1000;
5035 pub const PRIO_DARWIN_NONUI: c_int = 0x1001;
5036
5037 pub const SEM_FAILED: *mut sem_t = -1isize as *mut crate::sem_t;
5038
5039 pub const AI_PASSIVE: c_int = 0x00000001;
5040 pub const AI_CANONNAME: c_int = 0x00000002;
5041 pub const AI_NUMERICHOST: c_int = 0x00000004;
5042 pub const AI_NUMERICSERV: c_int = 0x00001000;
5043 pub const AI_MASK: c_int =
5044 AI_PASSIVE | AI_CANONNAME | AI_NUMERICHOST | AI_NUMERICSERV | AI_ADDRCONFIG;
5045 pub const AI_ALL: c_int = 0x00000100;
5046 pub const AI_V4MAPPED_CFG: c_int = 0x00000200;
5047 pub const AI_ADDRCONFIG: c_int = 0x00000400;
5048 pub const AI_V4MAPPED: c_int = 0x00000800;
5049 pub const AI_DEFAULT: c_int = AI_V4MAPPED_CFG | AI_ADDRCONFIG;
5050 pub const AI_UNUSABLE: c_int = 0x10000000;
5051
5052 pub const SIGEV_NONE: c_int = 0;
5053 pub const SIGEV_SIGNAL: c_int = 1;
5054 pub const SIGEV_THREAD: c_int = 3;
5055
5056 pub const AIO_CANCELED: c_int = 2;
5057 pub const AIO_NOTCANCELED: c_int = 4;
5058 pub const AIO_ALLDONE: c_int = 1;
5059 #[deprecated(
5060 since = "0.2.64",
5061 note = "Can vary at runtime. Use sysconf(3) instead"
5062 )]
5063 pub const AIO_LISTIO_MAX: c_int = 16;
5064 pub const LIO_NOP: c_int = 0;
5065 pub const LIO_WRITE: c_int = 2;
5066 pub const LIO_READ: c_int = 1;
5067 pub const LIO_WAIT: c_int = 2;
5068 pub const LIO_NOWAIT: c_int = 1;
5069
5070 pub const WEXITED: c_int = 0x00000004;
5071 pub const WSTOPPED: c_int = 0x00000008;
5072 pub const WCONTINUED: c_int = 0x00000010;
5073 pub const WNOWAIT: c_int = 0x00000020;
5074
5075 pub const P_ALL: idtype_t = 0;
5076 pub const P_PID: idtype_t = 1;
5077 pub const P_PGID: idtype_t = 2;
5078
5079 pub const UTIME_OMIT: c_long = -2;
5080 pub const UTIME_NOW: c_long = -1;
5081
5082 pub const XATTR_NOFOLLOW: c_int = 0x0001;
5083 pub const XATTR_CREATE: c_int = 0x0002;
5084 pub const XATTR_REPLACE: c_int = 0x0004;
5085 pub const XATTR_NOSECURITY: c_int = 0x0008;
5086 pub const XATTR_NODEFAULT: c_int = 0x0010;
5087 pub const XATTR_SHOWCOMPRESSION: c_int = 0x0020;
5088
5089 pub const NET_RT_IFLIST2: c_int = 0x0006;
5090
5091 // net/route.h
5092 pub const RTF_DELCLONE: c_int = 0x80;
5093 pub const RTF_CLONING: c_int = 0x100;
5094 pub const RTF_XRESOLVE: c_int = 0x200;
5095 pub const RTF_LLINFO: c_int = 0x400;
5096 pub const RTF_NOIFREF: c_int = 0x2000;
5097 pub const RTF_PRCLONING: c_int = 0x10000;
5098 pub const RTF_WASCLONED: c_int = 0x20000;
5099 pub const RTF_PROTO3: c_int = 0x40000;
5100 pub const RTF_PINNED: c_int = 0x100000;
5101 pub const RTF_LOCAL: c_int = 0x200000;
5102 pub const RTF_BROADCAST: c_int = 0x400000;
5103 pub const RTF_MULTICAST: c_int = 0x800000;
5104 pub const RTF_IFSCOPE: c_int = 0x1000000;
5105 pub const RTF_CONDEMNED: c_int = 0x2000000;
5106 pub const RTF_IFREF: c_int = 0x4000000;
5107 pub const RTF_PROXY: c_int = 0x8000000;
5108 pub const RTF_ROUTER: c_int = 0x10000000;
5109 pub const RTF_DEAD: c_int = 0x20000000;
5110 pub const RTF_GLOBAL: c_int = 0x40000000;
5111
5112 pub const RTM_VERSION: c_int = 5;
5113
5114 // Message types
5115 pub const RTM_LOCK: c_int = 0x8;
5116 pub const RTM_OLDADD: c_int = 0x9;
5117 pub const RTM_OLDDEL: c_int = 0xa;
5118 pub const RTM_RESOLVE: c_int = 0xb;
5119 pub const RTM_NEWADDR: c_int = 0xc;
5120 pub const RTM_DELADDR: c_int = 0xd;
5121 pub const RTM_IFINFO: c_int = 0xe;
5122 pub const RTM_NEWMADDR: c_int = 0xf;
5123 pub const RTM_DELMADDR: c_int = 0x10;
5124 pub const RTM_IFINFO2: c_int = 0x12;
5125 pub const RTM_NEWMADDR2: c_int = 0x13;
5126 pub const RTM_GET2: c_int = 0x14;
5127
5128 // Bitmask values for rtm_inits and rmx_locks.
5129 pub const RTV_MTU: c_int = 0x1;
5130 pub const RTV_HOPCOUNT: c_int = 0x2;
5131 pub const RTV_EXPIRE: c_int = 0x4;
5132 pub const RTV_RPIPE: c_int = 0x8;
5133 pub const RTV_SPIPE: c_int = 0x10;
5134 pub const RTV_SSTHRESH: c_int = 0x20;
5135 pub const RTV_RTT: c_int = 0x40;
5136 pub const RTV_RTTVAR: c_int = 0x80;
5137
5138 pub const RTAX_MAX: c_int = 8;
5139
5140 pub const KERN_PROCARGS2: c_int = 49;
5141
5142 pub const PROC_PIDTASKALLINFO: c_int = 2;
5143 pub const PROC_PIDTBSDINFO: c_int = 3;
5144 pub const PROC_PIDTASKINFO: c_int = 4;
5145 pub const PROC_PIDTHREADINFO: c_int = 5;
5146 pub const PROC_PIDVNODEPATHINFO: c_int = 9;
5147 pub const PROC_PIDPATHINFO_MAXSIZE: c_int = 4096;
5148
5149 pub const PROC_PIDLISTFDS: c_int = 1;
5150 pub const PROC_PIDLISTFD_SIZE: c_int = mem::size_of::<proc_fdinfo>() as c_int;
5151 pub const PROX_FDTYPE_ATALK: c_int = 0;
5152 pub const PROX_FDTYPE_VNODE: c_int = 1;
5153 pub const PROX_FDTYPE_SOCKET: c_int = 2;
5154 pub const PROX_FDTYPE_PSHM: c_int = 3;
5155 pub const PROX_FDTYPE_PSEM: c_int = 4;
5156 pub const PROX_FDTYPE_KQUEUE: c_int = 5;
5157 pub const PROX_FDTYPE_PIPE: c_int = 6;
5158 pub const PROX_FDTYPE_FSEVENTS: c_int = 7;
5159 pub const PROX_FDTYPE_NETPOLICY: c_int = 9;
5160 pub const PROX_FDTYPE_CHANNEL: c_int = 10;
5161 pub const PROX_FDTYPE_NEXUS: c_int = 11;
5162
5163 pub const PROC_CSM_ALL: c_uint = 0x0001;
5164 pub const PROC_CSM_NOSMT: c_uint = 0x0002;
5165 pub const PROC_CSM_TECS: c_uint = 0x0004;
5166 pub const MAXCOMLEN: usize = 16;
5167 pub const MAXTHREADNAMESIZE: usize = 64;
5168
5169 pub const XUCRED_VERSION: c_uint = 0;
5170
5171 pub const LC_SEGMENT: u32 = 0x1;
5172 pub const LC_SEGMENT_64: u32 = 0x19;
5173
5174 pub const MH_MAGIC: u32 = 0xfeedface;
5175 pub const MH_MAGIC_64: u32 = 0xfeedfacf;
5176
5177 // net/if_utun.h
5178 pub const UTUN_OPT_FLAGS: c_int = 1;
5179 pub const UTUN_OPT_IFNAME: c_int = 2;
5180
5181 // net/bpf.h
5182 pub const DLT_NULL: c_uint = 0; // no link-layer encapsulation
5183 pub const DLT_EN10MB: c_uint = 1; // Ethernet (10Mb)
5184 pub const DLT_EN3MB: c_uint = 2; // Experimental Ethernet (3Mb)
5185 pub const DLT_AX25: c_uint = 3; // Amateur Radio AX.25
5186 pub const DLT_PRONET: c_uint = 4; // Proteon ProNET Token Ring
5187 pub const DLT_CHAOS: c_uint = 5; // Chaos
5188 pub const DLT_IEEE802: c_uint = 6; // IEEE 802 Networks
5189 pub const DLT_ARCNET: c_uint = 7; // ARCNET
5190 pub const DLT_SLIP: c_uint = 8; // Serial Line IP
5191 pub const DLT_PPP: c_uint = 9; // Point-to-point Protocol
5192 pub const DLT_FDDI: c_uint = 10; // FDDI
5193 pub const DLT_ATM_RFC1483: c_uint = 11; // LLC/SNAP encapsulated atm
5194 pub const DLT_RAW: c_uint = 12; // raw IP
5195 pub const DLT_LOOP: c_uint = 108;
5196
5197 // https://github.com/apple/darwin-xnu/blob/HEAD/bsd/net/bpf.h#L100
5198 // sizeof(i32)
5199 pub const BPF_ALIGNMENT: c_int = 4;
5200
5201 // sys/mount.h
5202 pub const MNT_NODEV: c_int = 0x00000010;
5203 pub const MNT_UNION: c_int = 0x00000020;
5204 pub const MNT_CPROTECT: c_int = 0x00000080;
5205
5206 // MAC labeled / "quarantined" flag
5207 pub const MNT_QUARANTINE: c_int = 0x00000400;
5208
5209 // Flags set by internal operations.
5210 pub const MNT_LOCAL: c_int = 0x00001000;
5211 pub const MNT_QUOTA: c_int = 0x00002000;
5212 pub const MNT_ROOTFS: c_int = 0x00004000;
5213 pub const MNT_DOVOLFS: c_int = 0x00008000;
5214
5215 pub const MNT_DONTBROWSE: c_int = 0x00100000;
5216 pub const MNT_IGNORE_OWNERSHIP: c_int = 0x00200000;
5217 pub const MNT_AUTOMOUNTED: c_int = 0x00400000;
5218 pub const MNT_JOURNALED: c_int = 0x00800000;
5219 pub const MNT_NOUSERXATTR: c_int = 0x01000000;
5220 pub const MNT_DEFWRITE: c_int = 0x02000000;
5221 pub const MNT_MULTILABEL: c_int = 0x04000000;
5222 pub const MNT_NOATIME: c_int = 0x10000000;
5223 pub const MNT_SNAPSHOT: c_int = 0x40000000;
5224
5225 // External filesystem command modifier flags.
5226 pub const MNT_NOBLOCK: c_int = 0x00020000;
5227
5228 // sys/spawn.h:
5229 // DIFF(main): changed to `c_short` in f62eb023ab
5230 pub const POSIX_SPAWN_RESETIDS: c_int = 0x0001;
5231 pub const POSIX_SPAWN_SETPGROUP: c_int = 0x0002;
5232 pub const POSIX_SPAWN_SETSIGDEF: c_int = 0x0004;
5233 pub const POSIX_SPAWN_SETSIGMASK: c_int = 0x0008;
5234 pub const POSIX_SPAWN_SETEXEC: c_int = 0x0040;
5235 pub const POSIX_SPAWN_START_SUSPENDED: c_int = 0x0080;
5236 pub const POSIX_SPAWN_CLOEXEC_DEFAULT: c_int = 0x4000;
5237
5238 // sys/ipc.h:
5239 pub const IPC_CREAT: c_int = 0x200;
5240 pub const IPC_EXCL: c_int = 0x400;
5241 pub const IPC_NOWAIT: c_int = 0x800;
5242 pub const IPC_PRIVATE: key_t = 0;
5243
5244 pub const IPC_RMID: c_int = 0;
5245 pub const IPC_SET: c_int = 1;
5246 pub const IPC_STAT: c_int = 2;
5247
5248 pub const IPC_R: c_int = 0x100;
5249 pub const IPC_W: c_int = 0x80;
5250 pub const IPC_M: c_int = 0x1000;
5251
5252 // sys/sem.h
5253 pub const SEM_UNDO: c_int = 0o10000;
5254
5255 pub const GETNCNT: c_int = 3;
5256 pub const GETPID: c_int = 4;
5257 pub const GETVAL: c_int = 5;
5258 pub const GETALL: c_int = 6;
5259 pub const GETZCNT: c_int = 7;
5260 pub const SETVAL: c_int = 8;
5261 pub const SETALL: c_int = 9;
5262
5263 // sys/shm.h
5264 pub const SHM_RDONLY: c_int = 0x1000;
5265 pub const SHM_RND: c_int = 0x2000;
5266 #[cfg(target_arch = "aarch64")]
5267 pub const SHMLBA: c_int = 16 * 1024;
5268 #[cfg(not(target_arch = "aarch64"))]
5269 pub const SHMLBA: c_int = 4096;
5270 pub const SHM_R: c_int = IPC_R;
5271 pub const SHM_W: c_int = IPC_W;
5272
5273 // Flags for chflags(2)
5274 pub const UF_SETTABLE: c_uint = 0x0000ffff;
5275 pub const UF_NODUMP: c_uint = 0x00000001;
5276 pub const UF_IMMUTABLE: c_uint = 0x00000002;
5277 pub const UF_APPEND: c_uint = 0x00000004;
5278 pub const UF_OPAQUE: c_uint = 0x00000008;
5279 pub const UF_COMPRESSED: c_uint = 0x00000020;
5280 pub const UF_TRACKED: c_uint = 0x00000040;
5281 pub const SF_SETTABLE: c_uint = 0xffff0000;
5282 pub const SF_ARCHIVED: c_uint = 0x00010000;
5283 pub const SF_IMMUTABLE: c_uint = 0x00020000;
5284 pub const SF_APPEND: c_uint = 0x00040000;
5285 pub const UF_HIDDEN: c_uint = 0x00008000;
5286
5287 //<sys/timex.h>
5288 pub const NTP_API: c_int = 4;
5289 pub const MAXPHASE: c_long = 500000000;
5290 pub const MAXFREQ: c_long = 500000;
5291 pub const MINSEC: c_int = 256;
5292 pub const MAXSEC: c_int = 2048;
5293 pub const NANOSECOND: c_long = 1000000000;
5294 pub const SCALE_PPM: c_int = 65;
5295 pub const MAXTC: c_int = 10;
5296 pub const MOD_OFFSET: c_uint = 0x0001;
5297 pub const MOD_FREQUENCY: c_uint = 0x0002;
5298 pub const MOD_MAXERROR: c_uint = 0x0004;
5299 pub const MOD_ESTERROR: c_uint = 0x0008;
5300 pub const MOD_STATUS: c_uint = 0x0010;
5301 pub const MOD_TIMECONST: c_uint = 0x0020;
5302 pub const MOD_PPSMAX: c_uint = 0x0040;
5303 pub const MOD_TAI: c_uint = 0x0080;
5304 pub const MOD_MICRO: c_uint = 0x1000;
5305 pub const MOD_NANO: c_uint = 0x2000;
5306 pub const MOD_CLKB: c_uint = 0x4000;
5307 pub const MOD_CLKA: c_uint = 0x8000;
5308 pub const STA_PLL: c_int = 0x0001;
5309 pub const STA_PPSFREQ: c_int = 0x0002;
5310 pub const STA_PPSTIME: c_int = 0x0004;
5311 pub const STA_FLL: c_int = 0x0008;
5312 pub const STA_INS: c_int = 0x0010;
5313 pub const STA_DEL: c_int = 0x0020;
5314 pub const STA_UNSYNC: c_int = 0x0040;
5315 pub const STA_FREQHOLD: c_int = 0x0080;
5316 pub const STA_PPSSIGNAL: c_int = 0x0100;
5317 pub const STA_PPSJITTER: c_int = 0x0200;
5318 pub const STA_PPSWANDER: c_int = 0x0400;
5319 pub const STA_PPSERROR: c_int = 0x0800;
5320 pub const STA_CLOCKERR: c_int = 0x1000;
5321 pub const STA_NANO: c_int = 0x2000;
5322 pub const STA_MODE: c_int = 0x4000;
5323 pub const STA_CLK: c_int = 0x8000;
5324 pub const STA_RONLY: c_int = STA_PPSSIGNAL
5325 | STA_PPSJITTER
5326 | STA_PPSWANDER
5327 | STA_PPSERROR
5328 | STA_CLOCKERR
5329 | STA_NANO
5330 | STA_MODE
5331 | STA_CLK;
5332 pub const TIME_OK: c_int = 0;
5333 pub const TIME_INS: c_int = 1;
5334 pub const TIME_DEL: c_int = 2;
5335 pub const TIME_OOP: c_int = 3;
5336 pub const TIME_WAIT: c_int = 4;
5337 pub const TIME_ERROR: c_int = 5;
5338
5339 // <sys/mount.h>
5340 pub const MNT_WAIT: c_int = 1;
5341 pub const MNT_NOWAIT: c_int = 2;
5342
5343 // <mach/thread_policy.h>
5344 pub const THREAD_STANDARD_POLICY: c_int = 1;
5345 pub const THREAD_STANDARD_POLICY_COUNT: c_int = 0;
5346 pub const THREAD_EXTENDED_POLICY: c_int = 1;
5347 pub const THREAD_TIME_CONSTRAINT_POLICY: c_int = 2;
5348 pub const THREAD_PRECEDENCE_POLICY: c_int = 3;
5349 pub const THREAD_AFFINITY_POLICY: c_int = 4;
5350 pub const THREAD_AFFINITY_TAG_NULL: c_int = 0;
5351 pub const THREAD_BACKGROUND_POLICY: c_int = 5;
5352 pub const THREAD_BACKGROUND_POLICY_DARWIN_BG: c_int = 0x1000;
5353 pub const THREAD_LATENCY_QOS_POLICY: c_int = 7;
5354 pub const THREAD_THROUGHPUT_QOS_POLICY: c_int = 8;
5355
5356 // <mach/thread_info.h>
5357 pub const TH_STATE_RUNNING: c_int = 1;
5358 pub const TH_STATE_STOPPED: c_int = 2;
5359 pub const TH_STATE_WAITING: c_int = 3;
5360 pub const TH_STATE_UNINTERRUPTIBLE: c_int = 4;
5361 pub const TH_STATE_HALTED: c_int = 5;
5362 pub const TH_FLAGS_SWAPPED: c_int = 0x1;
5363 pub const TH_FLAGS_IDLE: c_int = 0x2;
5364 pub const TH_FLAGS_GLOBAL_FORCED_IDLE: c_int = 0x4;
5365 pub const THREAD_BASIC_INFO: c_int = 3;
5366 pub const THREAD_IDENTIFIER_INFO: c_int = 4;
5367 pub const THREAD_EXTENDED_INFO: c_int = 5;
5368
5369 // CommonCrypto/CommonCryptoError.h
5370 pub const kCCSuccess: i32 = 0;
5371 pub const kCCParamError: i32 = -4300;
5372 pub const kCCBufferTooSmall: i32 = -4301;
5373 pub const kCCMemoryFailure: i32 = -4302;
5374 pub const kCCAlignmentError: i32 = -4303;
5375 pub const kCCDecodeError: i32 = -4304;
5376 pub const kCCUnimplemented: i32 = -4305;
5377 pub const kCCOverflow: i32 = -4306;
5378 pub const kCCRNGFailure: i32 = -4307;
5379 pub const kCCUnspecifiedError: i32 = -4308;
5380 pub const kCCCallSequenceError: i32 = -4309;
5381 pub const kCCKeySizeError: i32 = -4310;
5382 pub const kCCInvalidKey: i32 = -4311;
5383
5384 // mach/host_info.h
5385 pub const HOST_LOAD_INFO: i32 = 1;
5386 pub const HOST_VM_INFO: i32 = 2;
5387 pub const HOST_CPU_LOAD_INFO: i32 = 3;
5388 pub const HOST_VM_INFO64: i32 = 4;
5389 pub const HOST_EXTMOD_INFO64: i32 = 5;
5390 pub const HOST_EXPIRED_TASK_INFO: i32 = 6;
5391
5392 // mach/vm_statistics.h
5393 pub const VM_PAGE_QUERY_PAGE_PRESENT: i32 = 0x1;
5394 pub const VM_PAGE_QUERY_PAGE_FICTITIOUS: i32 = 0x2;
5395 pub const VM_PAGE_QUERY_PAGE_REF: i32 = 0x4;
5396 pub const VM_PAGE_QUERY_PAGE_DIRTY: i32 = 0x8;
5397 pub const VM_PAGE_QUERY_PAGE_PAGED_OUT: i32 = 0x10;
5398 pub const VM_PAGE_QUERY_PAGE_COPIED: i32 = 0x20;
5399 pub const VM_PAGE_QUERY_PAGE_SPECULATIVE: i32 = 0x40;
5400 pub const VM_PAGE_QUERY_PAGE_EXTERNAL: i32 = 0x80;
5401 pub const VM_PAGE_QUERY_PAGE_CS_VALIDATED: i32 = 0x100;
5402 pub const VM_PAGE_QUERY_PAGE_CS_TAINTED: i32 = 0x200;
5403 pub const VM_PAGE_QUERY_PAGE_CS_NX: i32 = 0x400;
5404
5405 // mach/task_info.h
5406 pub const TASK_THREAD_TIMES_INFO: u32 = 3;
5407 pub const HOST_CPU_LOAD_INFO_COUNT: u32 = 4;
5408 pub const MACH_TASK_BASIC_INFO: u32 = 20;
5409
5410 pub const MACH_PORT_NULL: i32 = 0;
5411
5412 pub const RUSAGE_INFO_V0: c_int = 0;
5413 pub const RUSAGE_INFO_V1: c_int = 1;
5414 pub const RUSAGE_INFO_V2: c_int = 2;
5415 pub const RUSAGE_INFO_V3: c_int = 3;
5416 pub const RUSAGE_INFO_V4: c_int = 4;
5417
5418 // copyfile.h
5419 pub const COPYFILE_ACL: crate::copyfile_flags_t = 1 << 0;
5420 pub const COPYFILE_STAT: crate::copyfile_flags_t = 1 << 1;
5421 pub const COPYFILE_XATTR: crate::copyfile_flags_t = 1 << 2;
5422 pub const COPYFILE_DATA: crate::copyfile_flags_t = 1 << 3;
5423 pub const COPYFILE_SECURITY: crate::copyfile_flags_t = COPYFILE_STAT | COPYFILE_ACL;
5424 pub const COPYFILE_METADATA: crate::copyfile_flags_t = COPYFILE_SECURITY | COPYFILE_XATTR;
5425 pub const COPYFILE_RECURSIVE: crate::copyfile_flags_t = 1 << 15;
5426 pub const COPYFILE_CHECK: crate::copyfile_flags_t = 1 << 16;
5427 pub const COPYFILE_EXCL: crate::copyfile_flags_t = 1 << 17;
5428 pub const COPYFILE_NOFOLLOW_SRC: crate::copyfile_flags_t = 1 << 18;
5429 pub const COPYFILE_NOFOLLOW_DST: crate::copyfile_flags_t = 1 << 19;
5430 pub const COPYFILE_MOVE: crate::copyfile_flags_t = 1 << 20;
5431 pub const COPYFILE_UNLINK: crate::copyfile_flags_t = 1 << 21;
5432 pub const COPYFILE_NOFOLLOW: crate::copyfile_flags_t =
5433 COPYFILE_NOFOLLOW_SRC | COPYFILE_NOFOLLOW_DST;
5434 pub const COPYFILE_PACK: crate::copyfile_flags_t = 1 << 22;
5435 pub const COPYFILE_UNPACK: crate::copyfile_flags_t = 1 << 23;
5436 pub const COPYFILE_CLONE: crate::copyfile_flags_t = 1 << 24;
5437 pub const COPYFILE_CLONE_FORCE: crate::copyfile_flags_t = 1 << 25;
5438 pub const COPYFILE_RUN_IN_PLACE: crate::copyfile_flags_t = 1 << 26;
5439 pub const COPYFILE_DATA_SPARSE: crate::copyfile_flags_t = 1 << 27;
5440 pub const COPYFILE_PRESERVE_DST_TRACKED: crate::copyfile_flags_t = 1 << 28;
5441 pub const COPYFILE_VERBOSE: crate::copyfile_flags_t = 1 << 30;
5442 pub const COPYFILE_RECURSE_ERROR: c_int = 0;
5443 pub const COPYFILE_RECURSE_FILE: c_int = 1;
5444 pub const COPYFILE_RECURSE_DIR: c_int = 2;
5445 pub const COPYFILE_RECURSE_DIR_CLEANUP: c_int = 3;
5446 pub const COPYFILE_COPY_DATA: c_int = 4;
5447 pub const COPYFILE_COPY_XATTR: c_int = 5;
5448 pub const COPYFILE_START: c_int = 1;
5449 pub const COPYFILE_FINISH: c_int = 2;
5450 pub const COPYFILE_ERR: c_int = 3;
5451 pub const COPYFILE_PROGRESS: c_int = 4;
5452 pub const COPYFILE_CONTINUE: c_int = 0;
5453 pub const COPYFILE_SKIP: c_int = 1;
5454 pub const COPYFILE_QUIT: c_int = 2;
5455 pub const COPYFILE_STATE_SRC_FD: c_int = 1;
5456 pub const COPYFILE_STATE_SRC_FILENAME: c_int = 2;
5457 pub const COPYFILE_STATE_DST_FD: c_int = 3;
5458 pub const COPYFILE_STATE_DST_FILENAME: c_int = 4;
5459 pub const COPYFILE_STATE_QUARANTINE: c_int = 5;
5460 pub const COPYFILE_STATE_STATUS_CB: c_int = 6;
5461 pub const COPYFILE_STATE_STATUS_CTX: c_int = 7;
5462 pub const COPYFILE_STATE_COPIED: c_int = 8;
5463 pub const COPYFILE_STATE_XATTRNAME: c_int = 9;
5464 pub const COPYFILE_STATE_WAS_CLONED: c_int = 10;
5465 pub const COPYFILE_STATE_SRC_BSIZE: c_int = 11;
5466 pub const COPYFILE_STATE_DST_BSIZE: c_int = 12;
5467 pub const COPYFILE_STATE_BSIZE: c_int = 13;
5468
5469 // <sys/attr.h>
5470 pub const ATTR_BIT_MAP_COUNT: c_ushort = 5;
5471 pub const FSOPT_NOFOLLOW: u32 = 0x1;
5472 pub const FSOPT_NOFOLLOW_ANY: u32 = 0x800;
5473 pub const FSOPT_REPORT_FULLSIZE: u32 = 0x4;
5474 pub const FSOPT_PACK_INVAL_ATTRS: u32 = 0x8;
5475 pub const FSOPT_ATTR_CMN_EXTENDED: u32 = 0x20;
5476 pub const FSOPT_RETURN_REALDEV: u32 = 0x200;
5477 pub const ATTR_CMN_NAME: attrgroup_t = 0x00000001;
5478 pub const ATTR_CMN_DEVID: attrgroup_t = 0x00000002;
5479 pub const ATTR_CMN_FSID: attrgroup_t = 0x00000004;
5480 pub const ATTR_CMN_OBJTYPE: attrgroup_t = 0x00000008;
5481 pub const ATTR_CMN_OBJTAG: attrgroup_t = 0x00000010;
5482 pub const ATTR_CMN_OBJID: attrgroup_t = 0x00000020;
5483 pub const ATTR_CMN_OBJPERMANENTID: attrgroup_t = 0x00000040;
5484 pub const ATTR_CMN_PAROBJID: attrgroup_t = 0x00000080;
5485 pub const ATTR_CMN_SCRIPT: attrgroup_t = 0x00000100;
5486 pub const ATTR_CMN_CRTIME: attrgroup_t = 0x00000200;
5487 pub const ATTR_CMN_MODTIME: attrgroup_t = 0x00000400;
5488 pub const ATTR_CMN_CHGTIME: attrgroup_t = 0x00000800;
5489 pub const ATTR_CMN_ACCTIME: attrgroup_t = 0x00001000;
5490 pub const ATTR_CMN_BKUPTIME: attrgroup_t = 0x00002000;
5491 pub const ATTR_CMN_FNDRINFO: attrgroup_t = 0x00004000;
5492 pub const ATTR_CMN_OWNERID: attrgroup_t = 0x00008000;
5493 pub const ATTR_CMN_GRPID: attrgroup_t = 0x00010000;
5494 pub const ATTR_CMN_ACCESSMASK: attrgroup_t = 0x00020000;
5495 pub const ATTR_CMN_FLAGS: attrgroup_t = 0x00040000;
5496 pub const ATTR_CMN_GEN_COUNT: attrgroup_t = 0x00080000;
5497 pub const ATTR_CMN_DOCUMENT_ID: attrgroup_t = 0x00100000;
5498 pub const ATTR_CMN_USERACCESS: attrgroup_t = 0x00200000;
5499 pub const ATTR_CMN_EXTENDED_SECURITY: attrgroup_t = 0x00400000;
5500 pub const ATTR_CMN_UUID: attrgroup_t = 0x00800000;
5501 pub const ATTR_CMN_GRPUUID: attrgroup_t = 0x01000000;
5502 pub const ATTR_CMN_FILEID: attrgroup_t = 0x02000000;
5503 pub const ATTR_CMN_PARENTID: attrgroup_t = 0x04000000;
5504 pub const ATTR_CMN_FULLPATH: attrgroup_t = 0x08000000;
5505 pub const ATTR_CMN_ADDEDTIME: attrgroup_t = 0x10000000;
5506 pub const ATTR_CMN_DATA_PROTECT_FLAGS: attrgroup_t = 0x40000000;
5507 pub const ATTR_CMN_RETURNED_ATTRS: attrgroup_t = 0x80000000;
5508 pub const ATTR_VOL_FSTYPE: attrgroup_t = 0x00000001;
5509 pub const ATTR_VOL_SIGNATURE: attrgroup_t = 0x00000002;
5510 pub const ATTR_VOL_SIZE: attrgroup_t = 0x00000004;
5511 pub const ATTR_VOL_SPACEFREE: attrgroup_t = 0x00000008;
5512 pub const ATTR_VOL_SPACEAVAIL: attrgroup_t = 0x00000010;
5513 pub const ATTR_VOL_MINALLOCATION: attrgroup_t = 0x00000020;
5514 pub const ATTR_VOL_ALLOCATIONCLUMP: attrgroup_t = 0x00000040;
5515 pub const ATTR_VOL_IOBLOCKSIZE: attrgroup_t = 0x00000080;
5516 pub const ATTR_VOL_OBJCOUNT: attrgroup_t = 0x00000100;
5517 pub const ATTR_VOL_FILECOUNT: attrgroup_t = 0x00000200;
5518 pub const ATTR_VOL_DIRCOUNT: attrgroup_t = 0x00000400;
5519 pub const ATTR_VOL_MAXOBJCOUNT: attrgroup_t = 0x00000800;
5520 pub const ATTR_VOL_MOUNTPOINT: attrgroup_t = 0x00001000;
5521 pub const ATTR_VOL_NAME: attrgroup_t = 0x00002000;
5522 pub const ATTR_VOL_MOUNTFLAGS: attrgroup_t = 0x00004000;
5523 pub const ATTR_VOL_MOUNTEDDEVICE: attrgroup_t = 0x00008000;
5524 pub const ATTR_VOL_ENCODINGSUSED: attrgroup_t = 0x00010000;
5525 pub const ATTR_VOL_CAPABILITIES: attrgroup_t = 0x00020000;
5526 pub const ATTR_VOL_UUID: attrgroup_t = 0x00040000;
5527 pub const ATTR_VOL_SPACEUSED: attrgroup_t = 0x00800000;
5528 pub const ATTR_VOL_QUOTA_SIZE: attrgroup_t = 0x10000000;
5529 pub const ATTR_VOL_RESERVED_SIZE: attrgroup_t = 0x20000000;
5530 pub const ATTR_VOL_ATTRIBUTES: attrgroup_t = 0x40000000;
5531 pub const ATTR_VOL_INFO: attrgroup_t = 0x80000000;
5532 pub const ATTR_DIR_LINKCOUNT: attrgroup_t = 0x00000001;
5533 pub const ATTR_DIR_ENTRYCOUNT: attrgroup_t = 0x00000002;
5534 pub const ATTR_DIR_MOUNTSTATUS: attrgroup_t = 0x00000004;
5535 pub const ATTR_DIR_ALLOCSIZE: attrgroup_t = 0x00000008;
5536 pub const ATTR_DIR_IOBLOCKSIZE: attrgroup_t = 0x00000010;
5537 pub const ATTR_DIR_DATALENGTH: attrgroup_t = 0x00000020;
5538 pub const ATTR_FILE_LINKCOUNT: attrgroup_t = 0x00000001;
5539 pub const ATTR_FILE_TOTALSIZE: attrgroup_t = 0x00000002;
5540 pub const ATTR_FILE_ALLOCSIZE: attrgroup_t = 0x00000004;
5541 pub const ATTR_FILE_IOBLOCKSIZE: attrgroup_t = 0x00000008;
5542 pub const ATTR_FILE_DEVTYPE: attrgroup_t = 0x00000020;
5543 pub const ATTR_FILE_FORKCOUNT: attrgroup_t = 0x00000080;
5544 pub const ATTR_FILE_FORKLIST: attrgroup_t = 0x00000100;
5545 pub const ATTR_FILE_DATALENGTH: attrgroup_t = 0x00000200;
5546 pub const ATTR_FILE_DATAALLOCSIZE: attrgroup_t = 0x00000400;
5547 pub const ATTR_FILE_RSRCLENGTH: attrgroup_t = 0x00001000;
5548 pub const ATTR_FILE_RSRCALLOCSIZE: attrgroup_t = 0x00002000;
5549 pub const ATTR_CMNEXT_RELPATH: attrgroup_t = 0x00000004;
5550 pub const ATTR_CMNEXT_PRIVATESIZE: attrgroup_t = 0x00000008;
5551 pub const ATTR_CMNEXT_LINKID: attrgroup_t = 0x00000010;
5552 pub const ATTR_CMNEXT_NOFIRMLINKPATH: attrgroup_t = 0x00000020;
5553 pub const ATTR_CMNEXT_REALDEVID: attrgroup_t = 0x00000040;
5554 pub const ATTR_CMNEXT_REALFSID: attrgroup_t = 0x00000080;
5555 pub const ATTR_CMNEXT_CLONEID: attrgroup_t = 0x00000100;
5556 pub const ATTR_CMNEXT_EXT_FLAGS: attrgroup_t = 0x00000200;
5557 pub const ATTR_CMNEXT_RECURSIVE_GENCOUNT: attrgroup_t = 0x00000400;
5558 pub const DIR_MNTSTATUS_MNTPOINT: u32 = 0x1;
5559 pub const VOL_CAPABILITIES_FORMAT: usize = 0;
5560 pub const VOL_CAPABILITIES_INTERFACES: usize = 1;
5561 pub const VOL_CAP_FMT_PERSISTENTOBJECTIDS: attrgroup_t = 0x00000001;
5562 pub const VOL_CAP_FMT_SYMBOLICLINKS: attrgroup_t = 0x00000002;
5563 pub const VOL_CAP_FMT_HARDLINKS: attrgroup_t = 0x00000004;
5564 pub const VOL_CAP_FMT_JOURNAL: attrgroup_t = 0x00000008;
5565 pub const VOL_CAP_FMT_JOURNAL_ACTIVE: attrgroup_t = 0x00000010;
5566 pub const VOL_CAP_FMT_NO_ROOT_TIMES: attrgroup_t = 0x00000020;
5567 pub const VOL_CAP_FMT_SPARSE_FILES: attrgroup_t = 0x00000040;
5568 pub const VOL_CAP_FMT_ZERO_RUNS: attrgroup_t = 0x00000080;
5569 pub const VOL_CAP_FMT_CASE_SENSITIVE: attrgroup_t = 0x00000100;
5570 pub const VOL_CAP_FMT_CASE_PRESERVING: attrgroup_t = 0x00000200;
5571 pub const VOL_CAP_FMT_FAST_STATFS: attrgroup_t = 0x00000400;
5572 pub const VOL_CAP_FMT_2TB_FILESIZE: attrgroup_t = 0x00000800;
5573 pub const VOL_CAP_FMT_OPENDENYMODES: attrgroup_t = 0x00001000;
5574 pub const VOL_CAP_FMT_HIDDEN_FILES: attrgroup_t = 0x00002000;
5575 pub const VOL_CAP_FMT_PATH_FROM_ID: attrgroup_t = 0x00004000;
5576 pub const VOL_CAP_FMT_NO_VOLUME_SIZES: attrgroup_t = 0x00008000;
5577 pub const VOL_CAP_FMT_DECMPFS_COMPRESSION: attrgroup_t = 0x00010000;
5578 pub const VOL_CAP_FMT_64BIT_OBJECT_IDS: attrgroup_t = 0x00020000;
5579 pub const VOL_CAP_FMT_DIR_HARDLINKS: attrgroup_t = 0x00040000;
5580 pub const VOL_CAP_FMT_DOCUMENT_ID: attrgroup_t = 0x00080000;
5581 pub const VOL_CAP_FMT_WRITE_GENERATION_COUNT: attrgroup_t = 0x00100000;
5582 pub const VOL_CAP_FMT_NO_IMMUTABLE_FILES: attrgroup_t = 0x00200000;
5583 pub const VOL_CAP_FMT_NO_PERMISSIONS: attrgroup_t = 0x00400000;
5584 pub const VOL_CAP_FMT_SHARED_SPACE: attrgroup_t = 0x00800000;
5585 pub const VOL_CAP_FMT_VOL_GROUPS: attrgroup_t = 0x01000000;
5586 pub const VOL_CAP_FMT_SEALED: attrgroup_t = 0x02000000;
5587 pub const VOL_CAP_INT_SEARCHFS: attrgroup_t = 0x00000001;
5588 pub const VOL_CAP_INT_ATTRLIST: attrgroup_t = 0x00000002;
5589 pub const VOL_CAP_INT_NFSEXPORT: attrgroup_t = 0x00000004;
5590 pub const VOL_CAP_INT_READDIRATTR: attrgroup_t = 0x00000008;
5591 pub const VOL_CAP_INT_EXCHANGEDATA: attrgroup_t = 0x00000010;
5592 pub const VOL_CAP_INT_COPYFILE: attrgroup_t = 0x00000020;
5593 pub const VOL_CAP_INT_ALLOCATE: attrgroup_t = 0x00000040;
5594 pub const VOL_CAP_INT_VOL_RENAME: attrgroup_t = 0x00000080;
5595 pub const VOL_CAP_INT_ADVLOCK: attrgroup_t = 0x00000100;
5596 pub const VOL_CAP_INT_FLOCK: attrgroup_t = 0x00000200;
5597 pub const VOL_CAP_INT_EXTENDED_SECURITY: attrgroup_t = 0x00000400;
5598 pub const VOL_CAP_INT_USERACCESS: attrgroup_t = 0x00000800;
5599 pub const VOL_CAP_INT_MANLOCK: attrgroup_t = 0x00001000;
5600 pub const VOL_CAP_INT_NAMEDSTREAMS: attrgroup_t = 0x00002000;
5601 pub const VOL_CAP_INT_EXTENDED_ATTR: attrgroup_t = 0x00004000;
5602 pub const VOL_CAP_INT_CLONE: attrgroup_t = 0x00010000;
5603 pub const VOL_CAP_INT_SNAPSHOT: attrgroup_t = 0x00020000;
5604 pub const VOL_CAP_INT_RENAME_SWAP: attrgroup_t = 0x00040000;
5605 pub const VOL_CAP_INT_RENAME_EXCL: attrgroup_t = 0x00080000;
5606 pub const VOL_CAP_INT_RENAME_OPENFAIL: attrgroup_t = 0x00100000;
5607
5608 // os/clock.h
5609 pub const OS_CLOCK_MACH_ABSOLUTE_TIME: os_clockid_t = 32;
5610
5611 // os/os_sync_wait_on_address.h
5612 pub const OS_SYNC_WAIT_ON_ADDRESS_NONE: os_sync_wait_on_address_flags_t = 0x00000000;
5613 pub const OS_SYNC_WAIT_ON_ADDRESS_SHARED: os_sync_wait_on_address_flags_t = 0x00000001;
5614 pub const OS_SYNC_WAKE_BY_ADDRESS_NONE: os_sync_wake_by_address_flags_t = 0x00000000;
5615 pub const OS_SYNC_WAKE_BY_ADDRESS_SHARED: os_sync_wake_by_address_flags_t = 0x00000001;
5616
5617 // <proc.h>
5618 /// Process being created by fork.
5619 pub const SIDL: u32 = 1;
5620 /// Currently runnable.
5621 pub const SRUN: u32 = 2;
5622 /// Sleeping on an address.
5623 pub const SSLEEP: u32 = 3;
5624 /// Process debugging or suspension.
5625 pub const SSTOP: u32 = 4;
5626 /// Awaiting collection by parent.
5627 pub const SZOMB: u32 = 5;
5628
5629 // sys/vsock.h
5630 pub const VMADDR_CID_ANY: c_uint = 0xFFFFFFFF;
5631 pub const VMADDR_CID_HYPERVISOR: c_uint = 0;
5632 pub const VMADDR_CID_RESERVED: c_uint = 1;
5633 pub const VMADDR_CID_HOST: c_uint = 2;
5634 pub const VMADDR_PORT_ANY: c_uint = 0xFFFFFFFF;
5635
5636 const fn __DARWIN_ALIGN32(p: usize) -> usize {
5637 const __DARWIN_ALIGNBYTES32: usize = mem::size_of::<u32>() - 1;
5638 p + __DARWIN_ALIGNBYTES32 & !__DARWIN_ALIGNBYTES32
5639 }
5640
5641 pub const THREAD_EXTENDED_POLICY_COUNT: mach_msg_type_number_t =
5642 (mem::size_of::<thread_extended_policy_data_t>() / mem::size_of::<integer_t>())
5643 as mach_msg_type_number_t;
5644 pub const THREAD_TIME_CONSTRAINT_POLICY_COUNT: mach_msg_type_number_t =
5645 (mem::size_of::<thread_time_constraint_policy_data_t>() / mem::size_of::<integer_t>())
5646 as mach_msg_type_number_t;
5647 pub const THREAD_PRECEDENCE_POLICY_COUNT: mach_msg_type_number_t =
5648 (mem::size_of::<thread_precedence_policy_data_t>() / mem::size_of::<integer_t>())
5649 as mach_msg_type_number_t;
5650 pub const THREAD_AFFINITY_POLICY_COUNT: mach_msg_type_number_t =
5651 (mem::size_of::<thread_affinity_policy_data_t>() / mem::size_of::<integer_t>())
5652 as mach_msg_type_number_t;
5653 pub const THREAD_BACKGROUND_POLICY_COUNT: mach_msg_type_number_t =
5654 (mem::size_of::<thread_background_policy_data_t>() / mem::size_of::<integer_t>())
5655 as mach_msg_type_number_t;
5656 pub const THREAD_LATENCY_QOS_POLICY_COUNT: mach_msg_type_number_t =
5657 (mem::size_of::<thread_latency_qos_policy_data_t>() / mem::size_of::<integer_t>())
5658 as mach_msg_type_number_t;
5659 pub const THREAD_THROUGHPUT_QOS_POLICY_COUNT: mach_msg_type_number_t =
5660 (mem::size_of::<thread_throughput_qos_policy_data_t>() / mem::size_of::<integer_t>())
5661 as mach_msg_type_number_t;
5662 pub const THREAD_BASIC_INFO_COUNT: mach_msg_type_number_t =
5663 (mem::size_of::<thread_basic_info_data_t>() / mem::size_of::<integer_t>())
5664 as mach_msg_type_number_t;
5665 pub const THREAD_IDENTIFIER_INFO_COUNT: mach_msg_type_number_t =
5666 (mem::size_of::<thread_identifier_info_data_t>() / mem::size_of::<integer_t>())
5667 as mach_msg_type_number_t;
5668 pub const THREAD_EXTENDED_INFO_COUNT: mach_msg_type_number_t =
5669 (mem::size_of::<thread_extended_info_data_t>() / mem::size_of::<integer_t>())
5670 as mach_msg_type_number_t;
5671
5672 pub const TASK_THREAD_TIMES_INFO_COUNT: u32 =
5673 (mem::size_of::<task_thread_times_info_data_t>() / mem::size_of::<natural_t>()) as u32;
5674 pub const MACH_TASK_BASIC_INFO_COUNT: u32 =
5675 (mem::size_of::<mach_task_basic_info_data_t>() / mem::size_of::<natural_t>()) as u32;
5676 pub const HOST_VM_INFO64_COUNT: mach_msg_type_number_t = (mem::size_of::<vm_statistics64_data_t>()
5677 / mem::size_of::<integer_t>())
5678 as mach_msg_type_number_t;
5679
5680 // bsd/net/if_mib.h
5681 /// Non-interface-specific
5682 pub const IFMIB_SYSTEM: c_int = 1;
5683 /// Per-interface data table
5684 pub const IFMIB_IFDATA: c_int = 2;
5685 /// All interfaces data at once
5686 pub const IFMIB_IFALLDATA: c_int = 3;
5687
5688 /// Generic stats for all kinds of ifaces
5689 pub const IFDATA_GENERAL: c_int = 1;
5690 /// Specific to the type of interface
5691 pub const IFDATA_LINKSPECIFIC: c_int = 2;
5692 /// Addresses assigned to interface
5693 pub const IFDATA_ADDRS: c_int = 3;
5694 /// Multicast addresses assigned to interface
5695 pub const IFDATA_MULTIADDRS: c_int = 4;
5696
5697 /// Number of interfaces configured
5698 pub const IFMIB_IFCOUNT: c_int = 1;
5699
5700 /// Functions not specific to a type of iface
5701 pub const NETLINK_GENERIC: c_int = 0;
5702
5703 pub const DOT3COMPLIANCE_STATS: c_int = 1;
5704 pub const DOT3COMPLIANCE_COLLS: c_int = 2;
5705
5706 // kern_control.h
5707 pub const MAX_KCTL_NAME: usize = 96;
5708
5709 f! {
5710 pub fn CMSG_NXTHDR(mhdr: *const crate::msghdr, cmsg: *const cmsghdr) -> *mut cmsghdr {
5711 if cmsg.is_null() {
5712 return crate::CMSG_FIRSTHDR(mhdr);
5713 };
5714 let cmsg_len = (*cmsg).cmsg_len as usize;
5715 let next = cmsg as usize + __DARWIN_ALIGN32(cmsg_len);
5716 let max = (*mhdr).msg_control as usize + (*mhdr).msg_controllen as usize;
5717 if next + __DARWIN_ALIGN32(mem::size_of::<cmsghdr>()) > max {
5718 core::ptr::null_mut()
5719 } else {
5720 next as *mut cmsghdr
5721 }
5722 }
5723
5724 pub fn CMSG_DATA(cmsg: *const cmsghdr) -> *mut c_uchar {
5725 (cmsg as *mut c_uchar).add(__DARWIN_ALIGN32(mem::size_of::<cmsghdr>()))
5726 }
5727
5728 pub {const} fn CMSG_SPACE(length: c_uint) -> c_uint {
5729 (__DARWIN_ALIGN32(mem::size_of::<cmsghdr>()) + __DARWIN_ALIGN32(length as usize)) as c_uint
5730 }
5731
5732 pub {const} fn CMSG_LEN(length: c_uint) -> c_uint {
5733 (__DARWIN_ALIGN32(mem::size_of::<cmsghdr>()) + length as usize) as c_uint
5734 }
5735
5736 pub {const} fn VM_MAKE_TAG(id: u8) -> u32 {
5737 (id as u32) << 24u32
5738 }
5739 }
5740
5741 safe_f! {
5742 pub {const} fn WSTOPSIG(status: c_int) -> c_int {
5743 status >> 8
5744 }
5745
5746 pub {const} fn _WSTATUS(status: c_int) -> c_int {
5747 status & 0x7f
5748 }
5749
5750 pub {const} fn WIFCONTINUED(status: c_int) -> bool {
5751 _WSTATUS(status) == _WSTOPPED && WSTOPSIG(status) == 0x13
5752 }
5753
5754 pub {const} fn WIFSIGNALED(status: c_int) -> bool {
5755 _WSTATUS(status) != _WSTOPPED && _WSTATUS(status) != 0
5756 }
5757
5758 pub {const} fn WIFSTOPPED(status: c_int) -> bool {
5759 _WSTATUS(status) == _WSTOPPED && WSTOPSIG(status) != 0x13
5760 }
5761
5762 pub {const} fn makedev(major: i32, minor: i32) -> dev_t {
5763 (major << 24) | minor
5764 }
5765
5766 pub {const} fn major(dev: dev_t) -> i32 {
5767 (dev >> 24) & 0xff
5768 }
5769
5770 pub {const} fn minor(dev: dev_t) -> i32 {
5771 dev & 0xffffff
5772 }
5773 }
5774
5775 extern "C" {
5776 pub fn setgrent();
5777 #[doc(hidden)]
5778 #[deprecated(since = "0.2.49", note = "Deprecated in MacOSX 10.5")]
5779 #[cfg_attr(not(target_arch = "aarch64"), link_name = "daemon$1050")]
5780 pub fn daemon(nochdir: c_int, noclose: c_int) -> c_int;
5781 #[doc(hidden)]
5782 #[deprecated(since = "0.2.49", note = "Deprecated in MacOSX 10.10")]
5783 pub fn sem_destroy(sem: *mut sem_t) -> c_int;
5784 #[doc(hidden)]
5785 #[deprecated(since = "0.2.49", note = "Deprecated in MacOSX 10.10")]
5786 pub fn sem_init(sem: *mut sem_t, pshared: c_int, value: c_uint) -> c_int;
5787 pub fn aio_read(aiocbp: *mut aiocb) -> c_int;
5788 pub fn aio_write(aiocbp: *mut aiocb) -> c_int;
5789 pub fn aio_fsync(op: c_int, aiocbp: *mut aiocb) -> c_int;
5790 pub fn aio_error(aiocbp: *const aiocb) -> c_int;
5791 pub fn aio_return(aiocbp: *mut aiocb) -> ssize_t;
5792 #[cfg_attr(
5793 all(target_os = "macos", target_arch = "x86"),
5794 link_name = "aio_suspend$UNIX2003"
5795 )]
5796 pub fn aio_suspend(
5797 aiocb_list: *const *const aiocb,
5798 nitems: c_int,
5799 timeout: *const crate::timespec,
5800 ) -> c_int;
5801 pub fn aio_cancel(fd: c_int, aiocbp: *mut aiocb) -> c_int;
5802 pub fn chflags(path: *const c_char, flags: c_uint) -> c_int;
5803 pub fn fchflags(fd: c_int, flags: c_uint) -> c_int;
5804 pub fn clock_getres(clk_id: crate::clockid_t, tp: *mut crate::timespec) -> c_int;
5805 pub fn clock_gettime(clk_id: crate::clockid_t, tp: *mut crate::timespec) -> c_int;
5806 pub fn lio_listio(
5807 mode: c_int,
5808 aiocb_list: *const *mut aiocb,
5809 nitems: c_int,
5810 sevp: *mut sigevent,
5811 ) -> c_int;
5812
5813 pub fn dirfd(dirp: *mut crate::DIR) -> c_int;
5814
5815 pub fn lutimes(file: *const c_char, times: *const crate::timeval) -> c_int;
5816
5817 pub fn gettimeofday(tp: *mut crate::timeval, tz: *mut c_void) -> c_int;
5818 pub fn getutxent() -> *mut utmpx;
5819 pub fn getutxid(ut: *const utmpx) -> *mut utmpx;
5820 pub fn getutxline(ut: *const utmpx) -> *mut utmpx;
5821 pub fn pututxline(ut: *const utmpx) -> *mut utmpx;
5822 pub fn setutxent();
5823 pub fn endutxent();
5824 pub fn utmpxname(file: *const c_char) -> c_int;
5825
5826 pub fn asctime(tm: *const crate::tm) -> *mut c_char;
5827 pub fn ctime(clock: *const time_t) -> *mut c_char;
5828 pub fn getdate(datestr: *const c_char) -> *mut crate::tm;
5829 pub fn strptime(
5830 buf: *const c_char,
5831 format: *const c_char,
5832 timeptr: *mut crate::tm,
5833 ) -> *mut c_char;
5834 pub fn asctime_r(tm: *const crate::tm, result: *mut c_char) -> *mut c_char;
5835 pub fn ctime_r(clock: *const time_t, result: *mut c_char) -> *mut c_char;
5836
5837 pub fn getnameinfo(
5838 sa: *const crate::sockaddr,
5839 salen: crate::socklen_t,
5840 host: *mut c_char,
5841 hostlen: crate::socklen_t,
5842 serv: *mut c_char,
5843 servlen: crate::socklen_t,
5844 flags: c_int,
5845 ) -> c_int;
5846 pub fn mincore(addr: *const c_void, len: size_t, vec: *mut c_char) -> c_int;
5847 pub fn sysctlnametomib(name: *const c_char, mibp: *mut c_int, sizep: *mut size_t) -> c_int;
5848 #[cfg_attr(
5849 all(target_os = "macos", target_arch = "x86"),
5850 link_name = "mprotect$UNIX2003"
5851 )]
5852 pub fn mprotect(addr: *mut c_void, len: size_t, prot: c_int) -> c_int;
5853 pub fn semget(key: key_t, nsems: c_int, semflg: c_int) -> c_int;
5854 #[cfg_attr(
5855 all(target_os = "macos", target_arch = "x86"),
5856 link_name = "semctl$UNIX2003"
5857 )]
5858 pub fn semctl(semid: c_int, semnum: c_int, cmd: c_int, ...) -> c_int;
5859 pub fn semop(semid: c_int, sops: *mut sembuf, nsops: size_t) -> c_int;
5860 pub fn shm_open(name: *const c_char, oflag: c_int, ...) -> c_int;
5861 pub fn ftok(pathname: *const c_char, proj_id: c_int) -> key_t;
5862 pub fn shmat(shmid: c_int, shmaddr: *const c_void, shmflg: c_int) -> *mut c_void;
5863 pub fn shmdt(shmaddr: *const c_void) -> c_int;
5864 #[cfg_attr(
5865 all(target_os = "macos", target_arch = "x86"),
5866 link_name = "shmctl$UNIX2003"
5867 )]
5868 pub fn shmctl(shmid: c_int, cmd: c_int, buf: *mut crate::shmid_ds) -> c_int;
5869 pub fn shmget(key: key_t, size: size_t, shmflg: c_int) -> c_int;
5870 pub fn sysctl(
5871 name: *mut c_int,
5872 namelen: c_uint,
5873 oldp: *mut c_void,
5874 oldlenp: *mut size_t,
5875 newp: *mut c_void,
5876 newlen: size_t,
5877 ) -> c_int;
5878 pub fn sysctlbyname(
5879 name: *const c_char,
5880 oldp: *mut c_void,
5881 oldlenp: *mut size_t,
5882 newp: *mut c_void,
5883 newlen: size_t,
5884 ) -> c_int;
5885 #[deprecated(since = "0.2.55", note = "Use the `mach2` crate instead")]
5886 pub fn mach_absolute_time() -> u64;
5887 #[deprecated(since = "0.2.55", note = "Use the `mach2` crate instead")]
5888 #[allow(deprecated)]
5889 pub fn mach_timebase_info(info: *mut crate::mach_timebase_info) -> c_int;
5890 #[deprecated(since = "0.2.55", note = "Use the `mach2` crate instead")]
5891 pub fn mach_host_self() -> mach_port_t;
5892 #[deprecated(since = "0.2.55", note = "Use the `mach2` crate instead")]
5893 pub fn mach_thread_self() -> mach_port_t;
5894 pub fn pthread_once(
5895 once_control: *mut crate::pthread_once_t,
5896 init_routine: Option<unsafe extern "C" fn()>,
5897 ) -> c_int;
5898 pub fn pthread_attr_getinheritsched(
5899 attr: *const crate::pthread_attr_t,
5900 inheritsched: *mut c_int,
5901 ) -> c_int;
5902 pub fn pthread_attr_getschedpolicy(
5903 attr: *const crate::pthread_attr_t,
5904 policy: *mut c_int,
5905 ) -> c_int;
5906 pub fn pthread_attr_getscope(
5907 attr: *const crate::pthread_attr_t,
5908 contentionscope: *mut c_int,
5909 ) -> c_int;
5910 pub fn pthread_attr_getstackaddr(
5911 attr: *const crate::pthread_attr_t,
5912 stackaddr: *mut *mut c_void,
5913 ) -> c_int;
5914 pub fn pthread_attr_getdetachstate(
5915 attr: *const crate::pthread_attr_t,
5916 detachstate: *mut c_int,
5917 ) -> c_int;
5918 pub fn pthread_attr_setinheritsched(
5919 attr: *mut crate::pthread_attr_t,
5920 inheritsched: c_int,
5921 ) -> c_int;
5922 pub fn pthread_attr_setschedpolicy(attr: *mut crate::pthread_attr_t, policy: c_int) -> c_int;
5923 pub fn pthread_attr_setscope(attr: *mut crate::pthread_attr_t, contentionscope: c_int)
5924 -> c_int;
5925 pub fn pthread_attr_setstackaddr(
5926 attr: *mut crate::pthread_attr_t,
5927 stackaddr: *mut c_void,
5928 ) -> c_int;
5929 pub fn pthread_setname_np(name: *const c_char) -> c_int;
5930 pub fn pthread_getname_np(thread: crate::pthread_t, name: *mut c_char, len: size_t) -> c_int;
5931 pub fn pthread_mach_thread_np(thread: crate::pthread_t) -> crate::mach_port_t;
5932 pub fn pthread_from_mach_thread_np(port: crate::mach_port_t) -> crate::pthread_t;
5933 pub fn pthread_create_from_mach_thread(
5934 thread: *mut crate::pthread_t,
5935 attr: *const crate::pthread_attr_t,
5936 f: extern "C" fn(*mut c_void) -> *mut c_void,
5937 value: *mut c_void,
5938 ) -> c_int;
5939 pub fn pthread_stack_frame_decode_np(
5940 frame_addr: crate::uintptr_t,
5941 return_addr: *mut crate::uintptr_t,
5942 ) -> crate::uintptr_t;
5943 pub fn pthread_get_stackaddr_np(thread: crate::pthread_t) -> *mut c_void;
5944 pub fn pthread_get_stacksize_np(thread: crate::pthread_t) -> size_t;
5945 pub fn pthread_condattr_setpshared(attr: *mut pthread_condattr_t, pshared: c_int) -> c_int;
5946 pub fn pthread_condattr_getpshared(
5947 attr: *const pthread_condattr_t,
5948 pshared: *mut c_int,
5949 ) -> c_int;
5950 pub fn pthread_main_np() -> c_int;
5951 pub fn pthread_mutexattr_setpshared(attr: *mut pthread_mutexattr_t, pshared: c_int) -> c_int;
5952 pub fn pthread_mutexattr_getpshared(
5953 attr: *const pthread_mutexattr_t,
5954 pshared: *mut c_int,
5955 ) -> c_int;
5956 pub fn pthread_rwlockattr_getpshared(
5957 attr: *const pthread_rwlockattr_t,
5958 val: *mut c_int,
5959 ) -> c_int;
5960 pub fn pthread_rwlockattr_setpshared(attr: *mut pthread_rwlockattr_t, val: c_int) -> c_int;
5961 pub fn pthread_threadid_np(thread: crate::pthread_t, thread_id: *mut u64) -> c_int;
5962 pub fn pthread_attr_set_qos_class_np(
5963 attr: *mut pthread_attr_t,
5964 class: qos_class_t,
5965 priority: c_int,
5966 ) -> c_int;
5967 pub fn pthread_attr_get_qos_class_np(
5968 attr: *mut pthread_attr_t,
5969 class: *mut qos_class_t,
5970 priority: *mut c_int,
5971 ) -> c_int;
5972 pub fn pthread_set_qos_class_self_np(class: qos_class_t, priority: c_int) -> c_int;
5973 pub fn pthread_get_qos_class_np(
5974 thread: crate::pthread_t,
5975 class: *mut qos_class_t,
5976 priority: *mut c_int,
5977 ) -> c_int;
5978 pub fn pthread_attr_getschedparam(
5979 attr: *const crate::pthread_attr_t,
5980 param: *mut sched_param,
5981 ) -> c_int;
5982 pub fn pthread_attr_setschedparam(
5983 attr: *mut crate::pthread_attr_t,
5984 param: *const sched_param,
5985 ) -> c_int;
5986 pub fn pthread_getschedparam(
5987 thread: crate::pthread_t,
5988 policy: *mut c_int,
5989 param: *mut sched_param,
5990 ) -> c_int;
5991 pub fn pthread_setschedparam(
5992 thread: crate::pthread_t,
5993 policy: c_int,
5994 param: *const sched_param,
5995 ) -> c_int;
5996
5997 // Available from Big Sur
5998 pub fn pthread_introspection_hook_install(
5999 hook: crate::pthread_introspection_hook_t,
6000 ) -> crate::pthread_introspection_hook_t;
6001 pub fn pthread_introspection_setspecific_np(
6002 thread: crate::pthread_t,
6003 key: crate::pthread_key_t,
6004 value: *const c_void,
6005 ) -> c_int;
6006 pub fn pthread_introspection_getspecific_np(
6007 thread: crate::pthread_t,
6008 key: crate::pthread_key_t,
6009 ) -> *mut c_void;
6010 pub fn pthread_jit_write_protect_np(enabled: c_int);
6011 pub fn pthread_jit_write_protect_supported_np() -> c_int;
6012 // An array of pthread_jit_write_with_callback_np must declare
6013 // the list of callbacks e.g.
6014 // #[link_section = "__DATA_CONST,__pth_jit_func"]
6015 // static callbacks: [libc::pthread_jit_write_callback_t; 2] = [native_jit_write_cb,
6016 // std::mem::transmute::<libc::pthread_jit_write_callback_t>(std::ptr::null())];
6017 // (a handy PTHREAD_JIT_WRITE_CALLBACK_NP macro for other languages).
6018 pub fn pthread_jit_write_with_callback_np(
6019 callback: crate::pthread_jit_write_callback_t,
6020 ctx: *mut c_void,
6021 ) -> c_int;
6022 pub fn pthread_jit_write_freeze_callbacks_np();
6023 pub fn pthread_cpu_number_np(cpu_number_out: *mut size_t) -> c_int;
6024
6025 // Available starting with macOS 14.4.
6026 pub fn os_sync_wait_on_address(
6027 addr: *mut c_void,
6028 value: u64,
6029 size: size_t,
6030 flags: os_sync_wait_on_address_flags_t,
6031 ) -> c_int;
6032 pub fn os_sync_wait_on_address_with_deadline(
6033 addr: *mut c_void,
6034 value: u64,
6035 size: size_t,
6036 flags: os_sync_wait_on_address_flags_t,
6037 clockid: os_clockid_t,
6038 deadline: u64,
6039 ) -> c_int;
6040 pub fn os_sync_wait_on_address_with_timeout(
6041 addr: *mut c_void,
6042 value: u64,
6043 size: size_t,
6044 flags: os_sync_wait_on_address_flags_t,
6045 clockid: os_clockid_t,
6046 timeout_ns: u64,
6047 ) -> c_int;
6048 pub fn os_sync_wake_by_address_any(
6049 addr: *mut c_void,
6050 size: size_t,
6051 flags: os_sync_wake_by_address_flags_t,
6052 ) -> c_int;
6053 pub fn os_sync_wake_by_address_all(
6054 addr: *mut c_void,
6055 size: size_t,
6056 flags: os_sync_wake_by_address_flags_t,
6057 ) -> c_int;
6058
6059 pub fn os_unfair_lock_lock(lock: os_unfair_lock_t);
6060 pub fn os_unfair_lock_trylock(lock: os_unfair_lock_t) -> bool;
6061 pub fn os_unfair_lock_unlock(lock: os_unfair_lock_t);
6062 pub fn os_unfair_lock_assert_owner(lock: os_unfair_lock_t);
6063 pub fn os_unfair_lock_assert_not_owner(lock: os_unfair_lock_t);
6064
6065 pub fn os_log_create(subsystem: *const c_char, category: *const c_char) -> crate::os_log_t;
6066 pub fn os_log_type_enabled(oslog: crate::os_log_t, tpe: crate::os_log_type_t) -> bool;
6067 pub fn os_signpost_id_make_with_pointer(
6068 log: crate::os_log_t,
6069 ptr: *const c_void,
6070 ) -> crate::os_signpost_id_t;
6071 pub fn os_signpost_id_generate(log: crate::os_log_t) -> crate::os_signpost_id_t;
6072 pub fn os_signpost_enabled(log: crate::os_log_t) -> bool;
6073
6074 pub fn thread_policy_set(
6075 thread: thread_t,
6076 flavor: thread_policy_flavor_t,
6077 policy_info: thread_policy_t,
6078 count: mach_msg_type_number_t,
6079 ) -> kern_return_t;
6080 pub fn thread_policy_get(
6081 thread: thread_t,
6082 flavor: thread_policy_flavor_t,
6083 policy_info: thread_policy_t,
6084 count: *mut mach_msg_type_number_t,
6085 get_default: *mut boolean_t,
6086 ) -> kern_return_t;
6087 pub fn thread_info(
6088 target_act: thread_inspect_t,
6089 flavor: thread_flavor_t,
6090 thread_info_out: thread_info_t,
6091 thread_info_outCnt: *mut mach_msg_type_number_t,
6092 ) -> kern_return_t;
6093 #[cfg_attr(doc, doc(alias = "__errno_location"))]
6094 #[cfg_attr(doc, doc(alias = "errno"))]
6095 pub fn __error() -> *mut c_int;
6096 pub fn backtrace(buf: *mut *mut c_void, sz: c_int) -> c_int;
6097 pub fn backtrace_symbols(addrs: *const *mut c_void, sz: c_int) -> *mut *mut c_char;
6098 pub fn backtrace_symbols_fd(addrs: *const *mut c_void, sz: c_int, fd: c_int);
6099 pub fn backtrace_from_fp(startfp: *mut c_void, array: *mut *mut c_void, size: c_int) -> c_int;
6100 pub fn backtrace_image_offsets(
6101 array: *const *mut c_void,
6102 image_offsets: *mut image_offset,
6103 size: c_int,
6104 );
6105 pub fn backtrace_async(array: *mut *mut c_void, length: size_t, task_id: *mut u32) -> size_t;
6106 #[cfg_attr(
6107 all(target_os = "macos", not(target_arch = "aarch64")),
6108 link_name = "statfs$INODE64"
6109 )]
6110 pub fn statfs(path: *const c_char, buf: *mut statfs) -> c_int;
6111 #[cfg_attr(
6112 all(target_os = "macos", not(target_arch = "aarch64")),
6113 link_name = "fstatfs$INODE64"
6114 )]
6115 pub fn fstatfs(fd: c_int, buf: *mut statfs) -> c_int;
6116 pub fn kevent(
6117 kq: c_int,
6118 changelist: *const crate::kevent,
6119 nchanges: c_int,
6120 eventlist: *mut crate::kevent,
6121 nevents: c_int,
6122 timeout: *const crate::timespec,
6123 ) -> c_int;
6124 pub fn kevent64(
6125 kq: c_int,
6126 changelist: *const crate::kevent64_s,
6127 nchanges: c_int,
6128 eventlist: *mut crate::kevent64_s,
6129 nevents: c_int,
6130 flags: c_uint,
6131 timeout: *const crate::timespec,
6132 ) -> c_int;
6133 pub fn mount(
6134 src: *const c_char,
6135 target: *const c_char,
6136 flags: c_int,
6137 data: *mut c_void,
6138 ) -> c_int;
6139 pub fn fmount(src: *const c_char, fd: c_int, flags: c_int, data: *mut c_void) -> c_int;
6140 pub fn ptrace(request: c_int, pid: crate::pid_t, addr: *mut c_char, data: c_int) -> c_int;
6141 pub fn quotactl(special: *const c_char, cmd: c_int, id: c_int, data: *mut c_char) -> c_int;
6142 pub fn sethostname(name: *const c_char, len: c_int) -> c_int;
6143 pub fn sendfile(
6144 fd: c_int,
6145 s: c_int,
6146 offset: off_t,
6147 len: *mut off_t,
6148 hdtr: *mut crate::sf_hdtr,
6149 flags: c_int,
6150 ) -> c_int;
6151 pub fn futimens(fd: c_int, times: *const crate::timespec) -> c_int;
6152 pub fn utimensat(
6153 dirfd: c_int,
6154 path: *const c_char,
6155 times: *const crate::timespec,
6156 flag: c_int,
6157 ) -> c_int;
6158 pub fn openpty(
6159 amaster: *mut c_int,
6160 aslave: *mut c_int,
6161 name: *mut c_char,
6162 termp: *mut termios,
6163 winp: *mut crate::winsize,
6164 ) -> c_int;
6165 pub fn forkpty(
6166 amaster: *mut c_int,
6167 name: *mut c_char,
6168 termp: *mut termios,
6169 winp: *mut crate::winsize,
6170 ) -> crate::pid_t;
6171 pub fn login_tty(fd: c_int) -> c_int;
6172 pub fn duplocale(base: crate::locale_t) -> crate::locale_t;
6173 pub fn freelocale(loc: crate::locale_t) -> c_int;
6174 pub fn localeconv_l(loc: crate::locale_t) -> *mut lconv;
6175 pub fn newlocale(mask: c_int, locale: *const c_char, base: crate::locale_t) -> crate::locale_t;
6176 pub fn uselocale(loc: crate::locale_t) -> crate::locale_t;
6177 pub fn querylocale(mask: c_int, loc: crate::locale_t) -> *const c_char;
6178 pub fn getpriority(which: c_int, who: crate::id_t) -> c_int;
6179 pub fn setpriority(which: c_int, who: crate::id_t, prio: c_int) -> c_int;
6180 pub fn getdomainname(name: *mut c_char, len: c_int) -> c_int;
6181 pub fn setdomainname(name: *const c_char, len: c_int) -> c_int;
6182 pub fn preadv(fd: c_int, iov: *const crate::iovec, iovcnt: c_int, offset: off_t) -> ssize_t;
6183 pub fn pwritev(fd: c_int, iov: *const crate::iovec, iovcnt: c_int, offset: off_t) -> ssize_t;
6184 pub fn getxattr(
6185 path: *const c_char,
6186 name: *const c_char,
6187 value: *mut c_void,
6188 size: size_t,
6189 position: u32,
6190 flags: c_int,
6191 ) -> ssize_t;
6192 pub fn fgetxattr(
6193 filedes: c_int,
6194 name: *const c_char,
6195 value: *mut c_void,
6196 size: size_t,
6197 position: u32,
6198 flags: c_int,
6199 ) -> ssize_t;
6200 pub fn setxattr(
6201 path: *const c_char,
6202 name: *const c_char,
6203 value: *const c_void,
6204 size: size_t,
6205 position: u32,
6206 flags: c_int,
6207 ) -> c_int;
6208 pub fn fsetxattr(
6209 filedes: c_int,
6210 name: *const c_char,
6211 value: *const c_void,
6212 size: size_t,
6213 position: u32,
6214 flags: c_int,
6215 ) -> c_int;
6216 pub fn listxattr(path: *const c_char, list: *mut c_char, size: size_t, flags: c_int)
6217 -> ssize_t;
6218 pub fn flistxattr(filedes: c_int, list: *mut c_char, size: size_t, flags: c_int) -> ssize_t;
6219 pub fn removexattr(path: *const c_char, name: *const c_char, flags: c_int) -> c_int;
6220 pub fn renamex_np(from: *const c_char, to: *const c_char, flags: c_uint) -> c_int;
6221 pub fn renameatx_np(
6222 fromfd: c_int,
6223 from: *const c_char,
6224 tofd: c_int,
6225 to: *const c_char,
6226 flags: c_uint,
6227 ) -> c_int;
6228 pub fn fremovexattr(filedes: c_int, name: *const c_char, flags: c_int) -> c_int;
6229
6230 pub fn getgrouplist(
6231 name: *const c_char,
6232 basegid: c_int,
6233 groups: *mut c_int,
6234 ngroups: *mut c_int,
6235 ) -> c_int;
6236 pub fn initgroups(user: *const c_char, basegroup: c_int) -> c_int;
6237
6238 #[cfg_attr(
6239 all(target_os = "macos", target_arch = "x86"),
6240 link_name = "waitid$UNIX2003"
6241 )]
6242 pub fn waitid(
6243 idtype: idtype_t,
6244 id: id_t,
6245 infop: *mut crate::siginfo_t,
6246 options: c_int,
6247 ) -> c_int;
6248 pub fn brk(addr: *const c_void) -> *mut c_void;
6249 pub fn sbrk(increment: c_int) -> *mut c_void;
6250 pub fn settimeofday(tv: *const crate::timeval, tz: *const crate::timezone) -> c_int;
6251 #[deprecated(since = "0.2.55", note = "Use the `mach2` crate instead")]
6252 pub fn _dyld_image_count() -> u32;
6253 #[deprecated(since = "0.2.55", note = "Use the `mach2` crate instead")]
6254 #[allow(deprecated)]
6255 pub fn _dyld_get_image_header(image_index: u32) -> *const mach_header;
6256 #[deprecated(since = "0.2.55", note = "Use the `mach2` crate instead")]
6257 pub fn _dyld_get_image_vmaddr_slide(image_index: u32) -> intptr_t;
6258 #[deprecated(since = "0.2.55", note = "Use the `mach2` crate instead")]
6259 pub fn _dyld_get_image_name(image_index: u32) -> *const c_char;
6260
6261 pub fn posix_spawn(
6262 pid: *mut crate::pid_t,
6263 path: *const c_char,
6264 file_actions: *const crate::posix_spawn_file_actions_t,
6265 attrp: *const crate::posix_spawnattr_t,
6266 argv: *const *mut c_char,
6267 envp: *const *mut c_char,
6268 ) -> c_int;
6269 pub fn posix_spawnp(
6270 pid: *mut crate::pid_t,
6271 file: *const c_char,
6272 file_actions: *const crate::posix_spawn_file_actions_t,
6273 attrp: *const crate::posix_spawnattr_t,
6274 argv: *const *mut c_char,
6275 envp: *const *mut c_char,
6276 ) -> c_int;
6277 pub fn posix_spawnattr_init(attr: *mut posix_spawnattr_t) -> c_int;
6278 pub fn posix_spawnattr_destroy(attr: *mut posix_spawnattr_t) -> c_int;
6279 pub fn posix_spawnattr_getsigdefault(
6280 attr: *const posix_spawnattr_t,
6281 default: *mut crate::sigset_t,
6282 ) -> c_int;
6283 pub fn posix_spawnattr_setsigdefault(
6284 attr: *mut posix_spawnattr_t,
6285 default: *const crate::sigset_t,
6286 ) -> c_int;
6287 pub fn posix_spawnattr_getsigmask(
6288 attr: *const posix_spawnattr_t,
6289 default: *mut crate::sigset_t,
6290 ) -> c_int;
6291 pub fn posix_spawnattr_setsigmask(
6292 attr: *mut posix_spawnattr_t,
6293 default: *const crate::sigset_t,
6294 ) -> c_int;
6295 pub fn posix_spawnattr_getflags(attr: *const posix_spawnattr_t, flags: *mut c_short) -> c_int;
6296 pub fn posix_spawnattr_setflags(attr: *mut posix_spawnattr_t, flags: c_short) -> c_int;
6297 pub fn posix_spawnattr_getpgroup(
6298 attr: *const posix_spawnattr_t,
6299 flags: *mut crate::pid_t,
6300 ) -> c_int;
6301 pub fn posix_spawnattr_setpgroup(attr: *mut posix_spawnattr_t, flags: crate::pid_t) -> c_int;
6302 pub fn posix_spawnattr_setarchpref_np(
6303 attr: *mut posix_spawnattr_t,
6304 count: size_t,
6305 pref: *mut crate::cpu_type_t,
6306 subpref: *mut crate::cpu_subtype_t,
6307 ocount: *mut size_t,
6308 ) -> c_int;
6309 pub fn posix_spawnattr_getarchpref_np(
6310 attr: *const posix_spawnattr_t,
6311 count: size_t,
6312 pref: *mut crate::cpu_type_t,
6313 subpref: *mut crate::cpu_subtype_t,
6314 ocount: *mut size_t,
6315 ) -> c_int;
6316 pub fn posix_spawnattr_getbinpref_np(
6317 attr: *const posix_spawnattr_t,
6318 count: size_t,
6319 pref: *mut crate::cpu_type_t,
6320 ocount: *mut size_t,
6321 ) -> c_int;
6322 pub fn posix_spawnattr_setbinpref_np(
6323 attr: *mut posix_spawnattr_t,
6324 count: size_t,
6325 pref: *mut crate::cpu_type_t,
6326 ocount: *mut size_t,
6327 ) -> c_int;
6328 pub fn posix_spawnattr_set_qos_class_np(
6329 attr: *mut posix_spawnattr_t,
6330 qos_class: crate::qos_class_t,
6331 ) -> c_int;
6332 pub fn posix_spawnattr_get_qos_class_np(
6333 attr: *const posix_spawnattr_t,
6334 qos_class: *mut crate::qos_class_t,
6335 ) -> c_int;
6336
6337 pub fn posix_spawn_file_actions_init(actions: *mut posix_spawn_file_actions_t) -> c_int;
6338 pub fn posix_spawn_file_actions_destroy(actions: *mut posix_spawn_file_actions_t) -> c_int;
6339 pub fn posix_spawn_file_actions_addopen(
6340 actions: *mut posix_spawn_file_actions_t,
6341 fd: c_int,
6342 path: *const c_char,
6343 oflag: c_int,
6344 mode: crate::mode_t,
6345 ) -> c_int;
6346 pub fn posix_spawn_file_actions_addclose(
6347 actions: *mut posix_spawn_file_actions_t,
6348 fd: c_int,
6349 ) -> c_int;
6350 pub fn posix_spawn_file_actions_adddup2(
6351 actions: *mut posix_spawn_file_actions_t,
6352 fd: c_int,
6353 newfd: c_int,
6354 ) -> c_int;
6355 pub fn uname(buf: *mut crate::utsname) -> c_int;
6356
6357 pub fn connectx(
6358 socket: c_int,
6359 endpoints: *const sa_endpoints_t,
6360 associd: sae_associd_t,
6361 flags: c_uint,
6362 iov: *const crate::iovec,
6363 iovcnt: c_uint,
6364 len: *mut size_t,
6365 connid: *mut sae_connid_t,
6366 ) -> c_int;
6367 pub fn disconnectx(socket: c_int, associd: sae_associd_t, connid: sae_connid_t) -> c_int;
6368
6369 pub fn ntp_adjtime(buf: *mut timex) -> c_int;
6370 pub fn ntp_gettime(buf: *mut ntptimeval) -> c_int;
6371
6372 #[cfg_attr(
6373 all(target_os = "macos", not(target_arch = "aarch64")),
6374 link_name = "getmntinfo$INODE64"
6375 )]
6376 pub fn getmntinfo(mntbufp: *mut *mut statfs, flags: c_int) -> c_int;
6377 #[cfg_attr(
6378 all(target_os = "macos", not(target_arch = "aarch64")),
6379 link_name = "getfsstat$INODE64"
6380 )]
6381 pub fn getfsstat(mntbufp: *mut statfs, bufsize: c_int, flags: c_int) -> c_int;
6382
6383 // Copy-on-write functions.
6384 // According to the man page `flags` is an `int` but in the header
6385 // this is a `uint32_t`.
6386 pub fn clonefile(src: *const c_char, dst: *const c_char, flags: u32) -> c_int;
6387 pub fn clonefileat(
6388 src_dirfd: c_int,
6389 src: *const c_char,
6390 dst_dirfd: c_int,
6391 dst: *const c_char,
6392 flags: u32,
6393 ) -> c_int;
6394 pub fn fclonefileat(srcfd: c_int, dst_dirfd: c_int, dst: *const c_char, flags: u32) -> c_int;
6395
6396 pub fn copyfile(
6397 from: *const c_char,
6398 to: *const c_char,
6399 state: copyfile_state_t,
6400 flags: copyfile_flags_t,
6401 ) -> c_int;
6402 pub fn fcopyfile(
6403 from: c_int,
6404 to: c_int,
6405 state: copyfile_state_t,
6406 flags: copyfile_flags_t,
6407 ) -> c_int;
6408 pub fn copyfile_state_free(s: copyfile_state_t) -> c_int;
6409 pub fn copyfile_state_alloc() -> copyfile_state_t;
6410 pub fn copyfile_state_get(s: copyfile_state_t, flags: u32, dst: *mut c_void) -> c_int;
6411 pub fn copyfile_state_set(s: copyfile_state_t, flags: u32, src: *const c_void) -> c_int;
6412
6413 pub fn mach_error_string(error_value: crate::mach_error_t) -> *mut c_char;
6414
6415 // Added in macOS 10.13
6416 // ISO/IEC 9899:2011 ("ISO C11") K.3.7.4.1
6417 pub fn memset_s(s: *mut c_void, smax: size_t, c: c_int, n: size_t) -> c_int;
6418 // Added in macOS 10.5
6419 pub fn memset_pattern4(b: *mut c_void, pattern4: *const c_void, len: size_t);
6420 pub fn memset_pattern8(b: *mut c_void, pattern8: *const c_void, len: size_t);
6421 pub fn memset_pattern16(b: *mut c_void, pattern16: *const c_void, len: size_t);
6422
6423 // Inherited from BSD but available from Big Sur only
6424 pub fn strtonum(
6425 __numstr: *const c_char,
6426 __minval: c_longlong,
6427 __maxval: c_longlong,
6428 errstrp: *mut *const c_char,
6429 ) -> c_longlong;
6430
6431 pub fn mstats() -> mstats;
6432 pub fn malloc_printf(format: *const c_char, ...);
6433 pub fn malloc_zone_check(zone: *mut crate::malloc_zone_t) -> crate::boolean_t;
6434 pub fn malloc_zone_print(zone: *mut crate::malloc_zone_t, verbose: crate::boolean_t);
6435 pub fn malloc_zone_statistics(zone: *mut crate::malloc_zone_t, stats: *mut malloc_statistics_t);
6436 pub fn malloc_zone_log(zone: *mut crate::malloc_zone_t, address: *mut c_void);
6437 pub fn malloc_zone_print_ptr_info(ptr: *mut c_void);
6438 pub fn malloc_default_zone() -> *mut crate::malloc_zone_t;
6439 pub fn malloc_zone_from_ptr(ptr: *const c_void) -> *mut crate::malloc_zone_t;
6440 pub fn malloc_zone_malloc(zone: *mut crate::malloc_zone_t, size: size_t) -> *mut c_void;
6441 pub fn malloc_zone_valloc(zone: *mut crate::malloc_zone_t, size: size_t) -> *mut c_void;
6442 pub fn malloc_zone_calloc(
6443 zone: *mut crate::malloc_zone_t,
6444 num_items: size_t,
6445 size: size_t,
6446 ) -> *mut c_void;
6447 pub fn malloc_zone_realloc(
6448 zone: *mut crate::malloc_zone_t,
6449 ptr: *mut c_void,
6450 size: size_t,
6451 ) -> *mut c_void;
6452 pub fn malloc_zone_free(zone: *mut crate::malloc_zone_t, ptr: *mut c_void);
6453
6454 pub fn proc_listpids(t: u32, typeinfo: u32, buffer: *mut c_void, buffersize: c_int) -> c_int;
6455 pub fn proc_listallpids(buffer: *mut c_void, buffersize: c_int) -> c_int;
6456 pub fn proc_listpgrppids(pgrpid: crate::pid_t, buffer: *mut c_void, buffersize: c_int)
6457 -> c_int;
6458 pub fn proc_listchildpids(ppid: crate::pid_t, buffer: *mut c_void, buffersize: c_int) -> c_int;
6459 pub fn proc_pidinfo(
6460 pid: c_int,
6461 flavor: c_int,
6462 arg: u64,
6463 buffer: *mut c_void,
6464 buffersize: c_int,
6465 ) -> c_int;
6466 pub fn proc_pidfdinfo(
6467 pid: c_int,
6468 fd: c_int,
6469 flavor: c_int,
6470 buffer: *mut c_void,
6471 buffersize: c_int,
6472 ) -> c_int;
6473 pub fn proc_pidfileportinfo(
6474 pid: c_int,
6475 fileport: u32,
6476 flavor: c_int,
6477 buffer: *mut c_void,
6478 buffersize: c_int,
6479 ) -> c_int;
6480 pub fn proc_pidpath(pid: c_int, buffer: *mut c_void, buffersize: u32) -> c_int;
6481 pub fn proc_name(pid: c_int, buffer: *mut c_void, buffersize: u32) -> c_int;
6482 pub fn proc_regionfilename(
6483 pid: c_int,
6484 address: u64,
6485 buffer: *mut c_void,
6486 buffersize: u32,
6487 ) -> c_int;
6488 pub fn proc_kmsgbuf(buffer: *mut c_void, buffersize: u32) -> c_int;
6489 pub fn proc_libversion(major: *mut c_int, minor: *mut c_int) -> c_int;
6490 pub fn proc_pid_rusage(pid: c_int, flavor: c_int, buffer: *mut rusage_info_t) -> c_int;
6491
6492 // Available from Big Sur
6493 pub fn proc_set_no_smt() -> c_int;
6494 pub fn proc_setthread_no_smt() -> c_int;
6495 pub fn proc_set_csm(flags: u32) -> c_int;
6496 pub fn proc_setthread_csm(flags: u32) -> c_int;
6497 /// # Notes
6498 ///
6499 /// `id` is of type [`uuid_t`].
6500 pub fn gethostuuid(id: *mut u8, timeout: *const crate::timespec) -> c_int;
6501
6502 pub fn gethostid() -> c_long;
6503 pub fn sethostid(hostid: c_long);
6504
6505 pub fn CCRandomGenerateBytes(bytes: *mut c_void, size: size_t) -> crate::CCRNGStatus;
6506 pub fn getentropy(buf: *mut c_void, buflen: size_t) -> c_int;
6507
6508 // FIXME(1.0): should this actually be deprecated?
6509 #[deprecated(since = "0.2.55", note = "Use the `mach2` crate instead")]
6510 pub fn _NSGetExecutablePath(buf: *mut c_char, bufsize: *mut u32) -> c_int;
6511
6512 // crt_externs.h
6513 pub fn _NSGetArgv() -> *mut *mut *mut c_char;
6514 pub fn _NSGetArgc() -> *mut c_int;
6515 pub fn _NSGetEnviron() -> *mut *mut *mut c_char;
6516 pub fn _NSGetProgname() -> *mut *mut c_char;
6517
6518 #[deprecated(since = "0.2.55", note = "Use the `mach2` crate instead")]
6519 pub fn mach_vm_map(
6520 target_task: crate::vm_map_t,
6521 address: *mut crate::mach_vm_address_t,
6522 size: crate::mach_vm_size_t,
6523 mask: crate::mach_vm_offset_t,
6524 flags: c_int,
6525 object: crate::mem_entry_name_port_t,
6526 offset: crate::memory_object_offset_t,
6527 copy: crate::boolean_t,
6528 cur_protection: crate::vm_prot_t,
6529 max_protection: crate::vm_prot_t,
6530 inheritance: crate::vm_inherit_t,
6531 ) -> crate::kern_return_t;
6532
6533 pub fn vm_allocate(
6534 target_task: vm_map_t,
6535 address: *mut vm_address_t,
6536 size: vm_size_t,
6537 flags: c_int,
6538 ) -> crate::kern_return_t;
6539
6540 pub fn vm_deallocate(
6541 target_task: vm_map_t,
6542 address: vm_address_t,
6543 size: vm_size_t,
6544 ) -> crate::kern_return_t;
6545
6546 pub fn host_statistics64(
6547 host_priv: host_t,
6548 flavor: host_flavor_t,
6549 host_info64_out: host_info64_t,
6550 host_info64_outCnt: *mut mach_msg_type_number_t,
6551 ) -> crate::kern_return_t;
6552 pub fn host_processor_info(
6553 host: host_t,
6554 flavor: processor_flavor_t,
6555 out_processor_count: *mut natural_t,
6556 out_processor_info: *mut processor_info_array_t,
6557 out_processor_infoCnt: *mut mach_msg_type_number_t,
6558 ) -> crate::kern_return_t;
6559
6560 #[deprecated(since = "0.2.55", note = "Use the `mach2` crate instead")]
6561 pub static mut mach_task_self_: crate::mach_port_t;
6562 pub fn task_for_pid(
6563 host: crate::mach_port_t,
6564 pid: crate::pid_t,
6565 task: *mut crate::mach_port_t,
6566 ) -> crate::kern_return_t;
6567 pub fn task_info(
6568 host: crate::mach_port_t,
6569 flavor: task_flavor_t,
6570 task_info_out: task_info_t,
6571 task_info_count: *mut mach_msg_type_number_t,
6572 ) -> crate::kern_return_t;
6573 pub fn task_create(
6574 target_task: crate::task_t,
6575 ledgers: crate::ledger_array_t,
6576 ledgersCnt: crate::mach_msg_type_number_t,
6577 inherit_memory: crate::boolean_t,
6578 child_task: *mut crate::task_t,
6579 ) -> crate::kern_return_t;
6580 pub fn task_terminate(target_task: crate::task_t) -> crate::kern_return_t;
6581 pub fn task_threads(
6582 target_task: crate::task_inspect_t,
6583 act_list: *mut crate::thread_act_array_t,
6584 act_listCnt: *mut crate::mach_msg_type_number_t,
6585 ) -> crate::kern_return_t;
6586 pub fn host_statistics(
6587 host_priv: host_t,
6588 flavor: host_flavor_t,
6589 host_info_out: host_info_t,
6590 host_info_outCnt: *mut mach_msg_type_number_t,
6591 ) -> crate::kern_return_t;
6592
6593 // sysdir.h
6594 pub fn sysdir_start_search_path_enumeration(
6595 dir: sysdir_search_path_directory_t,
6596 domainMask: sysdir_search_path_domain_mask_t,
6597 ) -> crate::sysdir_search_path_enumeration_state;
6598 pub fn sysdir_get_next_search_path_enumeration(
6599 state: crate::sysdir_search_path_enumeration_state,
6600 path: *mut c_char,
6601 ) -> crate::sysdir_search_path_enumeration_state;
6602
6603 pub static vm_page_size: vm_size_t;
6604
6605 pub fn getattrlist(
6606 path: *const c_char,
6607 attrList: *mut c_void,
6608 attrBuf: *mut c_void,
6609 attrBufSize: size_t,
6610 options: u32,
6611 ) -> c_int;
6612 pub fn fgetattrlist(
6613 fd: c_int,
6614 attrList: *mut c_void,
6615 attrBuf: *mut c_void,
6616 attrBufSize: size_t,
6617 options: u32,
6618 ) -> c_int;
6619 pub fn getattrlistat(
6620 fd: c_int,
6621 path: *const c_char,
6622 attrList: *mut c_void,
6623 attrBuf: *mut c_void,
6624 attrBufSize: size_t,
6625 options: c_ulong,
6626 ) -> c_int;
6627 pub fn setattrlist(
6628 path: *const c_char,
6629 attrList: *mut c_void,
6630 attrBuf: *mut c_void,
6631 attrBufSize: size_t,
6632 options: u32,
6633 ) -> c_int;
6634 pub fn fsetattrlist(
6635 fd: c_int,
6636 attrList: *mut c_void,
6637 attrBuf: *mut c_void,
6638 attrBufSize: size_t,
6639 options: u32,
6640 ) -> c_int;
6641 pub fn setattrlistat(
6642 dir_fd: c_int,
6643 path: *const c_char,
6644 attrList: *mut c_void,
6645 attrBuf: *mut c_void,
6646 attrBufSize: size_t,
6647 options: u32,
6648 ) -> c_int;
6649 pub fn getattrlistbulk(
6650 dirfd: c_int,
6651 attrList: *mut c_void,
6652 attrBuf: *mut c_void,
6653 attrBufSize: size_t,
6654 options: u64,
6655 ) -> c_int;
6656
6657 pub fn malloc_size(ptr: *const c_void) -> size_t;
6658 pub fn malloc_good_size(size: size_t) -> size_t;
6659
6660 pub fn dirname(path: *mut c_char) -> *mut c_char;
6661 pub fn basename(path: *mut c_char) -> *mut c_char;
6662
6663 pub fn mkfifoat(dirfd: c_int, pathname: *const c_char, mode: crate::mode_t) -> c_int;
6664 pub fn mknodat(dirfd: c_int, pathname: *const c_char, mode: crate::mode_t, dev: dev_t)
6665 -> c_int;
6666 pub fn freadlink(fd: c_int, buf: *mut c_char, size: size_t) -> c_int;
6667 pub fn execvP(
6668 file: *const c_char,
6669 search_path: *const c_char,
6670 argv: *const *mut c_char,
6671 ) -> c_int;
6672 }
6673
6674 #[allow(deprecated)]
6675 #[deprecated(since = "0.2.55", note = "Use the `mach2` crate instead")]
6676 pub unsafe fn mach_task_self() -> crate::mach_port_t {
6677 mach_task_self_
6678 }
6679
6680 cfg_if! {
6681 if #[cfg(target_os = "macos")] {
6682 extern "C" {
6683 pub fn clock_settime(clock_id: crate::clockid_t, tp: *const crate::timespec) -> c_int;
6684 }
6685 }
6686 }
6687 cfg_if! {
6688 if #[cfg(any(
6689 target_os = "macos",
6690 target_os = "ios",
6691 target_os = "tvos",
6692 target_os = "visionos"
6693 ))] {
6694 extern "C" {
6695 pub fn memmem(
6696 haystack: *const c_void,
6697 haystacklen: size_t,
6698 needle: *const c_void,
6699 needlelen: size_t,
6700 ) -> *mut c_void;
6701 pub fn task_set_info(
6702 target_task: crate::task_t,
6703 flavor: crate::task_flavor_t,
6704 task_info_in: crate::task_info_t,
6705 task_info_inCnt: crate::mach_msg_type_number_t,
6706 ) -> crate::kern_return_t;
6707 }
6708 }
6709 }
6710
6711 // These require a dependency on `libiconv`, and including this when built as
6712 // part of `std` means every Rust program gets it. Ideally we would have a link
6713 // modifier to only include these if they are used, but we do not.
6714 #[deprecated(note = "Will be removed in 1.0 to avoid the `iconv` dependency")]
6715 #[cfg_attr(not(feature = "rustc-dep-of-std"), link(name = "iconv"))]
6716 extern "C" {
6717 pub fn iconv_open(tocode: *const c_char, fromcode: *const c_char) -> iconv_t;
6718 pub fn iconv(
6719 cd: iconv_t,
6720 inbuf: *mut *mut c_char,
6721 inbytesleft: *mut size_t,
6722 outbuf: *mut *mut c_char,
6723 outbytesleft: *mut size_t,
6724 ) -> size_t;
6725 pub fn iconv_close(cd: iconv_t) -> c_int;
6726 }
6727
6728 cfg_if! {
6729 if #[cfg(target_pointer_width = "32")] {
6730 mod b32;
6731 pub use self::b32::*;
6732 } else if #[cfg(target_pointer_width = "64")] {
6733 mod b64;
6734 pub use self::b64::*;
6735 } else {
6736 // Unknown target_arch
6737 }
6738 }