]> git.saurik.com Git - apple/xnu.git/blobdiff - bsd/kern/kern_ktrace.c
xnu-7195.101.1.tar.gz
[apple/xnu.git] / bsd / kern / kern_ktrace.c
index 672bd151ee5fa6753659db6d77148743a1a1a31e..3f2a7ef0f9b28f940ba85ed97de02f3dac91f686 100644 (file)
@@ -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;
-}