apple add malloc_zone_t definition for x86_64 only.

This commit is contained in:
David Carlier 2021-09-26 15:30:58 +01:00
parent a128dcf577
commit caa06fac88
5 changed files with 84 additions and 2 deletions

View file

@ -3,3 +3,4 @@ __darwin_x86_exception_state64
__darwin_x86_float_state64
__darwin_x86_thread_state64
__darwin_xmm_reg
malloc_introspection_t

View file

@ -43,6 +43,10 @@ s! {
pub bh_datalen: u32,
pub bh_hdrlen: ::c_ushort,
}
pub struct malloc_zone_t {
__private: [::uintptr_t; 18], // FIXME: keeping private for now
}
}
s_no_extra_traits! {

View file

@ -1,5 +1,11 @@
pub type boolean_t = ::c_int;
s! {
pub struct malloc_zone_t {
__private: [::uintptr_t; 18], // FIXME: needs arm64 auth pointers support
}
}
cfg_if! {
if #[cfg(libc_align)] {
mod align;

View file

@ -102,6 +102,74 @@ s! {
pub struct __darwin_xmm_reg {
pub __xmm_reg: [::c_char; 16],
}
pub struct malloc_introspection_t {
_private: [::uintptr_t; 16], // FIXME: keeping private for now
}
pub struct malloc_zone_t {
_reserved1: *mut ::c_void,
_reserved2: *mut ::c_void,
pub size: Option<unsafe extern "C" fn(
zone: *mut malloc_zone_t,
ptr: *const ::c_void,
) -> ::size_t>,
pub malloc: Option<unsafe extern "C" fn(
zone: *mut malloc_zone_t,
size: ::size_t,
) -> *mut ::c_void>,
pub calloc: Option<unsafe extern "C" fn(
zone: *mut malloc_zone_t,
num_items: ::size_t,
size: ::size_t,
) -> *mut ::c_void>,
pub valloc: Option<unsafe extern "C" fn(
zone: *mut malloc_zone_t,
size: ::size_t
) -> *mut ::c_void>,
pub free: Option<unsafe extern "C" fn(
zone: *mut malloc_zone_t,
ptr: *mut ::c_void
)>,
pub realloc: Option<unsafe extern "C" fn(
zone: *mut malloc_zone_t,
ptr: *mut ::c_void,
size: ::size_t,
) -> *mut ::c_void>,
pub destroy: Option<unsafe extern "C" fn(zone: *mut malloc_zone_t)>,
pub zone_name: *const ::c_char,
pub batch_malloc: Option<unsafe extern "C" fn(
zone: *mut malloc_zone_t,
size: ::size_t,
results: *mut *mut ::c_void,
num_requested: ::c_uint,
) -> ::c_uint>,
pub batch_free: Option<unsafe extern "C" fn(
zone: *mut malloc_zone_t,
to_be_freed: *mut *mut ::c_void,
num_to_be_freed: ::c_uint,
)>,
pub introspect: *mut malloc_introspection_t,
pub version: ::c_uint,
pub memalign: Option<unsafe extern "C" fn(
zone: *mut malloc_zone_t,
alignment: ::size_t,
size: ::size_t,
) -> *mut ::c_void>,
pub free_definite_size: Option<unsafe extern "C" fn(
zone: *mut malloc_zone_t,
ptr: *mut ::c_void,
size: ::size_t
)>,
pub pressure_relief: Option<unsafe extern "C" fn(
zone: *mut malloc_zone_t,
goal: ::size_t,
) -> ::size_t>,
pub claimed_address: Option<unsafe extern "C" fn(
zone: *mut malloc_zone_t,
ptr: *mut ::c_void,
) -> ::boolean_t>,
}
}
cfg_if! {

View file

@ -117,6 +117,8 @@ pub type vm_statistics_data_t = vm_statistics;
pub type vm_statistics64_t = *mut vm_statistics64;
pub type vm_statistics64_data_t = vm_statistics64;
pub type task_t = mach_port_t;
pub type sysdir_search_path_enumeration_state = ::c_uint;
pub type CCStatus = i32;
@ -741,8 +743,9 @@ s! {
pub bytes_free: ::size_t,
}
pub struct malloc_zone_t {
__private: [::uintptr_t; 18], // FIXME: keeping private for now
pub struct vm_range_t {
pub address: ::vm_address_t,
pub size: ::vm_size_t,
}
// sched.h