X-Git-Url: https://git.saurik.com/apple/xnu.git/blobdiff_plain/0a7de7458d150b5d4dffc935ba399be265ef0a1a..HEAD:/bsd/kern/kern_ktrace.c diff --git a/bsd/kern/kern_ktrace.c b/bsd/kern/kern_ktrace.c index 672bd151e..3f2a7ef0f 100644 --- a/bsd/kern/kern_ktrace.c +++ b/bsd/kern/kern_ktrace.c @@ -70,7 +70,8 @@ char *proc_name_address(void *p); kern_return_t ktrace_background_available_notify_user(void); -static lck_mtx_t *ktrace_mtx; +static LCK_GRP_DECLARE(ktrace_grp, "ktrace"); +static LCK_MTX_DECLARE(ktrace_mtx, &ktrace_grp); /* * The overall state of ktrace, whether it is unconfigured, in foreground mode, @@ -148,7 +149,7 @@ void ktrace_lock(void) { if (!ktrace_single_threaded) { - lck_mtx_lock(ktrace_mtx); + lck_mtx_lock(&ktrace_mtx); } } @@ -156,7 +157,7 @@ void ktrace_unlock(void) { if (!ktrace_single_threaded) { - lck_mtx_unlock(ktrace_mtx); + lck_mtx_unlock(&ktrace_mtx); } } @@ -164,7 +165,7 @@ void ktrace_assert_lock_held(void) { if (!ktrace_single_threaded) { - lck_mtx_assert(ktrace_mtx, LCK_MTX_ASSERT_OWNED); + lck_mtx_assert(&ktrace_mtx, LCK_MTX_ASSERT_OWNED); } } @@ -330,7 +331,7 @@ ktrace_disable(enum ktrace_state state_to_match) { if (ktrace_state == state_to_match) { kernel_debug_disable(); - kperf_sampling_disable(); + kperf_disable_sampling(); } } @@ -548,24 +549,3 @@ out: ktrace_unlock(); return ret; } - -/* This should only be called from the bootstrap thread. */ -void -ktrace_init(void) -{ - static lck_grp_attr_t *lock_grp_attr = NULL; - static lck_grp_t *lock_grp = NULL; - static bool initialized = false; - - if (initialized) { - return; - } - - lock_grp_attr = lck_grp_attr_alloc_init(); - lock_grp = lck_grp_alloc_init("ktrace", lock_grp_attr); - lck_grp_attr_free(lock_grp_attr); - - ktrace_mtx = lck_mtx_alloc_init(lock_grp, LCK_ATTR_NULL); - assert(ktrace_mtx != NULL);; - initialized = true; -}