Skip to main content

libc/unix/bsd/apple/
mod.rs

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