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