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