Skip to content

Commit 3e328bd

Browse files
committed
Auto merge of #2425 - devnexen:malloc_zone_apple_intel, r=Amanieu
apple add malloc_zone_t definition for x86_64 only.
2 parents dc34393 + caa06fa commit 3e328bd

File tree

5 files changed

+84
-2
lines changed

5 files changed

+84
-2
lines changed

libc-test/semver/macos-x86_64.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ __darwin_x86_exception_state64
33
__darwin_x86_float_state64
44
__darwin_x86_thread_state64
55
__darwin_xmm_reg
6+
malloc_introspection_t

src/unix/bsd/apple/b32/mod.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@ s! {
4343
pub bh_datalen: u32,
4444
pub bh_hdrlen: ::c_ushort,
4545
}
46+
47+
pub struct malloc_zone_t {
48+
__private: [::uintptr_t; 18], // FIXME: keeping private for now
49+
}
4650
}
4751

4852
s_no_extra_traits! {

src/unix/bsd/apple/b64/aarch64/mod.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
pub type boolean_t = ::c_int;
22

3+
s! {
4+
pub struct malloc_zone_t {
5+
__private: [::uintptr_t; 18], // FIXME: needs arm64 auth pointers support
6+
}
7+
}
8+
39
cfg_if! {
410
if #[cfg(libc_align)] {
511
mod align;

src/unix/bsd/apple/b64/x86_64/mod.rs

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,74 @@ s! {
102102
pub struct __darwin_xmm_reg {
103103
pub __xmm_reg: [::c_char; 16],
104104
}
105+
106+
pub struct malloc_introspection_t {
107+
_private: [::uintptr_t; 16], // FIXME: keeping private for now
108+
}
109+
110+
pub struct malloc_zone_t {
111+
_reserved1: *mut ::c_void,
112+
_reserved2: *mut ::c_void,
113+
pub size: Option<unsafe extern "C" fn(
114+
zone: *mut malloc_zone_t,
115+
ptr: *const ::c_void,
116+
) -> ::size_t>,
117+
pub malloc: Option<unsafe extern "C" fn(
118+
zone: *mut malloc_zone_t,
119+
size: ::size_t,
120+
) -> *mut ::c_void>,
121+
pub calloc: Option<unsafe extern "C" fn(
122+
zone: *mut malloc_zone_t,
123+
num_items: ::size_t,
124+
size: ::size_t,
125+
) -> *mut ::c_void>,
126+
pub valloc: Option<unsafe extern "C" fn(
127+
zone: *mut malloc_zone_t,
128+
size: ::size_t
129+
) -> *mut ::c_void>,
130+
pub free: Option<unsafe extern "C" fn(
131+
zone: *mut malloc_zone_t,
132+
ptr: *mut ::c_void
133+
)>,
134+
pub realloc: Option<unsafe extern "C" fn(
135+
zone: *mut malloc_zone_t,
136+
ptr: *mut ::c_void,
137+
size: ::size_t,
138+
) -> *mut ::c_void>,
139+
pub destroy: Option<unsafe extern "C" fn(zone: *mut malloc_zone_t)>,
140+
pub zone_name: *const ::c_char,
141+
pub batch_malloc: Option<unsafe extern "C" fn(
142+
zone: *mut malloc_zone_t,
143+
size: ::size_t,
144+
results: *mut *mut ::c_void,
145+
num_requested: ::c_uint,
146+
) -> ::c_uint>,
147+
pub batch_free: Option<unsafe extern "C" fn(
148+
zone: *mut malloc_zone_t,
149+
to_be_freed: *mut *mut ::c_void,
150+
num_to_be_freed: ::c_uint,
151+
)>,
152+
pub introspect: *mut malloc_introspection_t,
153+
pub version: ::c_uint,
154+
pub memalign: Option<unsafe extern "C" fn(
155+
zone: *mut malloc_zone_t,
156+
alignment: ::size_t,
157+
size: ::size_t,
158+
) -> *mut ::c_void>,
159+
pub free_definite_size: Option<unsafe extern "C" fn(
160+
zone: *mut malloc_zone_t,
161+
ptr: *mut ::c_void,
162+
size: ::size_t
163+
)>,
164+
pub pressure_relief: Option<unsafe extern "C" fn(
165+
zone: *mut malloc_zone_t,
166+
goal: ::size_t,
167+
) -> ::size_t>,
168+
pub claimed_address: Option<unsafe extern "C" fn(
169+
zone: *mut malloc_zone_t,
170+
ptr: *mut ::c_void,
171+
) -> ::boolean_t>,
172+
}
105173
}
106174

107175
cfg_if! {

src/unix/bsd/apple/mod.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,8 @@ pub type vm_statistics_data_t = vm_statistics;
117117
pub type vm_statistics64_t = *mut vm_statistics64;
118118
pub type vm_statistics64_data_t = vm_statistics64;
119119

120+
pub type task_t = mach_port_t;
121+
120122
pub type sysdir_search_path_enumeration_state = ::c_uint;
121123

122124
pub type CCStatus = i32;
@@ -741,8 +743,9 @@ s! {
741743
pub bytes_free: ::size_t,
742744
}
743745

744-
pub struct malloc_zone_t {
745-
__private: [::uintptr_t; 18], // FIXME: keeping private for now
746+
pub struct vm_range_t {
747+
pub address: ::vm_address_t,
748+
pub size: ::vm_size_t,
746749
}
747750

748751
// sched.h

0 commit comments

Comments
 (0)