Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

apple add pthread_jit_write_callback_t api related. #2896

Merged
merged 1 commit into from Sep 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions libc-test/build.rs
Expand Up @@ -321,6 +321,9 @@ fn test_apple(target: &str) {
// close calls the close_nocancel system call
"close" => true,

// FIXME: remove once the target in CI is updated
"pthread_jit_write_freeze_callbacks_np" => true,

_ => false,
}
});
Expand Down
3 changes: 3 additions & 0 deletions libc-test/semver/apple.txt
Expand Up @@ -1905,8 +1905,11 @@ pthread_introspection_getspecific_np
pthread_introspection_hook_t
pthread_introspection_hook_install
pthread_introspection_setspecific_np
pthread_jit_write_callback_t
pthread_jit_write_freeze_callbacks_np
pthread_jit_write_protect_np
pthread_jit_write_protect_supported_np
pthread_jit_write_with_callback_np
pthread_setschedparam
pthread_cancel
pthread_condattr_getpshared
Expand Down
12 changes: 12 additions & 0 deletions src/unix/bsd/apple/mod.rs
Expand Up @@ -119,6 +119,7 @@ pub type thread_throughput_qos_policy_t = *mut thread_throughput_qos_policy;

pub type pthread_introspection_hook_t =
extern "C" fn(event: ::c_uint, thread: ::pthread_t, addr: *mut ::c_void, size: ::size_t);
pub type pthread_jit_write_callback_t = Option<extern "C" fn(ctx: *mut ::c_void) -> ::c_int>;

pub type vm_statistics_t = *mut vm_statistics;
pub type vm_statistics_data_t = vm_statistics;
Expand Down Expand Up @@ -5020,6 +5021,17 @@ extern "C" {
) -> *mut ::c_void;
pub fn pthread_jit_write_protect_np(enabled: ::c_int);
pub fn pthread_jit_write_protect_supported_np() -> ::c_int;
// An array of pthread_jit_write_with_callback_np must declare
// the list of callbacks e.g.
// #[link_section = "__DATA_CONST,__pth_jit_func"]
// static callbacks: [libc::pthread_jit_write_callback_t; 2] = [native_jit_write_cb,
// std::mem::transmute::<libc::pthread_jit_write_callback_t>(std::ptr::null())];
// (a handy PTHREAD_JIT_WRITE_CALLBACK_NP macro for other languages).
pub fn pthread_jit_write_with_callback_np(
callback: ::pthread_jit_write_callback_t,
ctx: *mut ::c_void,
) -> ::c_int;
pub fn pthread_jit_write_freeze_callbacks_np();
pub fn pthread_cpu_number_np(cpu_number_out: *mut ::size_t) -> ::c_int;

pub fn thread_policy_set(
Expand Down