From 46994ec2b14d3fedbf712dd2cfb405c47632d920 Mon Sep 17 00:00:00 2001 From: Mark Johnston Date: Fri, 28 Feb 2020 17:05:04 +0000 Subject: Fix standalone builds of systrace.ko after r357912. Sponsored by: The FreeBSD Foundation --- sys/kern/subr_syscall.c | 3 ++- sys/sys/sysent.h | 12 +++++++----- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/sys/kern/subr_syscall.c b/sys/kern/subr_syscall.c index e160e357924f..a67a0a28ba39 100644 --- a/sys/kern/subr_syscall.c +++ b/sys/kern/subr_syscall.c @@ -141,7 +141,8 @@ syscallenter(struct thread *td) /* Let system calls set td_errno directly. */ td->td_pflags &= ~TDP_NERRNO; - if (__predict_false(systrace_enabled || AUDIT_SYSCALL_ENTER(sa->code, td))) { + if (__predict_false(SYSTRACE_ENABLED() || + AUDIT_SYSCALL_ENTER(sa->code, td))) { #ifdef KDTRACE_HOOKS /* Give the syscall:::entry DTrace probe a chance to fire. */ if (__predict_false(sa->callp->sy_entry != 0)) diff --git a/sys/sys/sysent.h b/sys/sys/sysent.h index 76e69b52f98e..4986dd8c01c0 100644 --- a/sys/sys/sysent.h +++ b/sys/sys/sysent.h @@ -42,6 +42,7 @@ struct thread; struct ksiginfo; struct syscall_args; +#ifdef _KERNEL enum systrace_probe_t { SYSTRACE_ENTRY, SYSTRACE_RETURN, @@ -53,14 +54,15 @@ typedef void (*systrace_probe_func_t)(struct syscall_args *, enum systrace_probe_t, int); typedef void (*systrace_args_func_t)(int, void *, uint64_t *, int *); -#ifdef _KERNEL -#ifdef KDTRACE_HOOKS +extern systrace_probe_func_t systrace_probe_func; extern bool systrace_enabled; + +#ifdef KDTRACE_HOOKS +#define SYSTRACE_ENABLED() (systrace_enabled) #else -#define systrace_enabled 0 -#endif +#define SYSTRACE_ENABLED() (0) #endif -extern systrace_probe_func_t systrace_probe_func; +#endif /* _KERNEL */ struct sysent { /* system call table */ int sy_narg; /* number of arguments */ -- cgit v1.2.3