Skip to main content

libc/unix/bsd/apple/
mod.rs

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