git: a58813fd701e - main - ktrace: Fix the build when options KTRACE is not configured

From: Mark Johnston <markj_at_FreeBSD.org>
Date: Sat, 09 Mar 2024 05:40:09 UTC
The branch main has been updated by markj:

URL: https://cgit.FreeBSD.org/src/commit/?id=a58813fd701ea4b248cca0dfab9971d863fbcf6a

commit a58813fd701ea4b248cca0dfab9971d863fbcf6a
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2024-03-09 05:11:01 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2024-03-09 05:33:55 +0000

    ktrace: Fix the build when options KTRACE is not configured
    
    MFC after:      1 week
    Reported by:    John Nielsen <lists@jnielsen.net>
---
 sys/kern/kern_condvar.c | 12 ++++++------
 sys/kern/kern_synch.c   |  6 +++---
 2 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/sys/kern/kern_condvar.c b/sys/kern/kern_condvar.c
index 0d470aeafcd5..a55863595ce2 100644
--- a/sys/kern/kern_condvar.c
+++ b/sys/kern/kern_condvar.c
@@ -37,13 +37,13 @@
 #include <sys/proc.h>
 #include <sys/kernel.h>
 #include <sys/ktr.h>
+#include <sys/ktrace.h>
 #include <sys/condvar.h>
 #include <sys/sched.h>
 #include <sys/signalvar.h>
 #include <sys/sleepqueue.h>
 #include <sys/resourcevar.h>
 #ifdef KTRACE
-#include <sys/ktrace.h>
 #include <sys/uio.h>
 #include <sys/user.h>
 #endif
@@ -112,7 +112,7 @@ _cv_wait(struct cv *cvp, struct lock_object *lock)
 	char wmesg[WMESGLEN + 1];
 #endif
 	struct lock_class *class;
-	struct thread *td;
+	struct thread *td __ktrace_used;
 	uintptr_t lock_state;
 
 	td = curthread;
@@ -174,7 +174,7 @@ _cv_wait_unlock(struct cv *cvp, struct lock_object *lock)
 	char wmesg[WMESGLEN + 1];
 #endif
 	struct lock_class *class;
-	struct thread *td;
+	struct thread *td __ktrace_used;
 
 	td = curthread;
 	CV_ASSERT(cvp, lock, td);
@@ -232,7 +232,7 @@ _cv_wait_sig(struct cv *cvp, struct lock_object *lock)
 	char wmesg[WMESGLEN + 1];
 #endif
 	struct lock_class *class;
-	struct thread *td;
+	struct thread *td __ktrace_used;
 	uintptr_t lock_state;
 	int rval;
 
@@ -301,7 +301,7 @@ _cv_timedwait_sbt(struct cv *cvp, struct lock_object *lock, sbintime_t sbt,
 	char wmesg[WMESGLEN + 1];
 #endif
 	struct lock_class *class;
-	struct thread *td;
+	struct thread *td __ktrace_used;
 	int lock_state, rval;
 
 	td = curthread;
@@ -371,7 +371,7 @@ _cv_timedwait_sig_sbt(struct cv *cvp, struct lock_object *lock,
 	char wmesg[WMESGLEN + 1];
 #endif
 	struct lock_class *class;
-	struct thread *td;
+	struct thread *td __ktrace_used;
 	int lock_state, rval;
 
 	td = curthread;
diff --git a/sys/kern/kern_synch.c b/sys/kern/kern_synch.c
index f12054a04b23..c7258b3cffa5 100644
--- a/sys/kern/kern_synch.c
+++ b/sys/kern/kern_synch.c
@@ -45,6 +45,7 @@
 #include <sys/kdb.h>
 #include <sys/kernel.h>
 #include <sys/ktr.h>
+#include <sys/ktrace.h>
 #include <sys/lock.h>
 #include <sys/mutex.h>
 #include <sys/proc.h>
@@ -60,7 +61,6 @@
 #include <sys/vmmeter.h>
 #ifdef KTRACE
 #include <sys/uio.h>
-#include <sys/ktrace.h>
 #endif
 #ifdef EPOCH_TRACE
 #include <sys/epoch.h>
@@ -131,7 +131,7 @@ int
 _sleep(const void *ident, struct lock_object *lock, int priority,
     const char *wmesg, sbintime_t sbt, sbintime_t pr, int flags)
 {
-	struct thread *td;
+	struct thread *td __ktrace_used;
 	struct lock_class *class;
 	uintptr_t lock_state;
 	int catch, pri, rval, sleepq_flags;
@@ -238,7 +238,7 @@ int
 msleep_spin_sbt(const void *ident, struct mtx *mtx, const char *wmesg,
     sbintime_t sbt, sbintime_t pr, int flags)
 {
-	struct thread *td;
+	struct thread *td __ktrace_used;
 	int rval;
 	WITNESS_SAVE_DECL(mtx);