summaryrefslogtreecommitdiff
path: root/src/unix/bsd/apple/mod.rs
diff options
context:
space:
mode:
authorDavid CARLIER <devnexen@gmail.com>2021-10-15 19:30:38 +0100
committerDavid Carlier <devnexen@gmail.com>2021-10-15 20:18:48 +0100
commit7c2847927f6e65c131d61debcc83a74e7b9b36dc (patch)
tree5aad387b7d78e38b010532fc617dbee08459e967 /src/unix/bsd/apple/mod.rs
parent5b308d9ba98c215d9b320e962f25836af3fd17b6 (diff)
downloadrust-libc-7c2847927f6e65c131d61debcc83a74e7b9b36dc.tar.gz
apple introduces pthread introspection api
Diffstat (limited to 'src/unix/bsd/apple/mod.rs')
-rw-r--r--src/unix/bsd/apple/mod.rs23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/unix/bsd/apple/mod.rs b/src/unix/bsd/apple/mod.rs
index d1ac0c339a..51319a5b6d 100644
--- a/src/unix/bsd/apple/mod.rs
+++ b/src/unix/bsd/apple/mod.rs
@@ -112,6 +112,9 @@ pub type thread_latency_qos_policy_t = *mut thread_latency_qos_policy;
pub type thread_throughput_qos_policy_data_t = thread_throughput_qos_policy;
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 vm_statistics_t = *mut vm_statistics;
pub type vm_statistics_data_t = vm_statistics;
pub type vm_statistics64_t = *mut vm_statistics64;
@@ -2959,6 +2962,11 @@ pub const AT_SYMLINK_NOFOLLOW: ::c_int = 0x0020;
pub const AT_SYMLINK_FOLLOW: ::c_int = 0x0040;
pub const AT_REMOVEDIR: ::c_int = 0x0080;
+pub const PTHREAD_INTROSPECTION_THREAD_CREATE: ::c_uint = 1;
+pub const PTHREAD_INTROSPECTION_THREAD_START: ::c_uint = 2;
+pub const PTHREAD_INTROSPECTION_THREAD_TERMINATE: ::c_uint = 3;
+pub const PTHREAD_INTROSPECTION_THREAD_DESTROY: ::c_uint = 4;
+
pub const TIOCMODG: ::c_ulong = 0x40047403;
pub const TIOCMODS: ::c_ulong = 0x80047404;
pub const TIOCM_LE: ::c_int = 0x1;
@@ -4851,6 +4859,21 @@ extern "C" {
policy: ::c_int,
param: *const sched_param,
) -> ::c_int;
+
+ // Available from Big Sur
+ pub fn pthread_introspection_hook_install(
+ hook: ::pthread_introspection_hook_t,
+ ) -> ::pthread_introspection_hook_t;
+ pub fn pthread_introspection_setspecific_np(
+ thread: ::pthread_t,
+ key: ::pthread_key_t,
+ value: *const ::c_void,
+ ) -> ::c_int;
+ pub fn pthread_introspection_getspecific_np(
+ thread: ::pthread_t,
+ key: ::pthread_key_t,
+ ) -> *mut ::c_void;
+
pub fn thread_policy_set(
thread: thread_t,
flavor: thread_policy_flavor_t,