Fix inverted test in ktrpoint(), NAMI traces weren't being generated.

Also inline the 'ktrace_on' part of the test.
This commit is contained in:
dsl 2007-08-27 13:33:45 +00:00
parent 862b664446
commit 31c3c56394
3 changed files with 15 additions and 12 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: kern_ktrace.c,v 1.125 2007/08/15 12:07:33 ad Exp $ */ /* $NetBSD: kern_ktrace.c,v 1.126 2007/08/27 13:33:45 dsl Exp $ */
/*- /*-
* Copyright (c) 2006, 2007 The NetBSD Foundation, Inc. * Copyright (c) 2006, 2007 The NetBSD Foundation, Inc.
@ -68,7 +68,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: kern_ktrace.c,v 1.125 2007/08/15 12:07:33 ad Exp $"); __KERNEL_RCSID(0, "$NetBSD: kern_ktrace.c,v 1.126 2007/08/27 13:33:45 dsl Exp $");
#include <sys/param.h> #include <sys/param.h>
#include <sys/systm.h> #include <sys/systm.h>
@ -905,12 +905,9 @@ ktr_csw(int out, int user)
} }
bool bool
ktrpoint(int fac) ktr_point(int fac_bit)
{ {
return curlwp->l_proc->p_traceflag & fac_bit;
if (__predict_false(ktrace_on))
return false;
return KTRPOINT(curlwp->l_proc, fac);
} }
int int

View File

@ -1,4 +1,4 @@
/* $NetBSD: kern_stub.c,v 1.3 2007/08/15 12:07:34 ad Exp $ */ /* $NetBSD: kern_stub.c,v 1.4 2007/08/27 13:33:45 dsl Exp $ */
/*- /*-
* Copyright (c) 2007 The NetBSD Foundation, Inc. * Copyright (c) 2007 The NetBSD Foundation, Inc.
@ -69,7 +69,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: kern_stub.c,v 1.3 2007/08/15 12:07:34 ad Exp $"); __KERNEL_RCSID(0, "$NetBSD: kern_stub.c,v 1.4 2007/08/27 13:33:45 dsl Exp $");
#include "opt_ptrace.h" #include "opt_ptrace.h"
#include "opt_ktrace.h" #include "opt_ktrace.h"
@ -117,7 +117,7 @@ __weak_alias(sys_utrace,sys_nosys);
int ktrace_on; /* Misc */ int ktrace_on; /* Misc */
__weak_alias(ktruser,enosys); __weak_alias(ktruser,enosys);
__weak_alias(ktrpoint,nullop); __weak_alias(ktr_point,nullop);
#endif /* KTRACE */ #endif /* KTRACE */
/* /*

View File

@ -1,4 +1,4 @@
/* $NetBSD: ktrace.h,v 1.49 2007/08/15 12:07:35 ad Exp $ */ /* $NetBSD: ktrace.h,v 1.50 2007/08/27 13:33:45 dsl Exp $ */
/* /*
* Copyright (c) 1988, 1993 * Copyright (c) 1988, 1993
@ -286,7 +286,7 @@ extern kmutex_t ktrace_lock;
extern int ktrace_on; extern int ktrace_on;
int ktruser(const char *, void *, size_t, int); int ktruser(const char *, void *, size_t, int);
bool ktrpoint(int); bool ktr_point(int);
void ktr_csw(int, int); void ktr_csw(int, int);
void ktr_emul(void); void ktr_emul(void);
@ -306,6 +306,12 @@ void ktr_mool(const void *, size_t, const void *);
void ktr_execarg(const void *, size_t); void ktr_execarg(const void *, size_t);
void ktr_execenv(const void *, size_t); void ktr_execenv(const void *, size_t);
static inline bool
ktrpoint(int fac)
{
return __predict_false(ktrace_on) && __predict_false(ktr_point(1 << fac));
}
static inline void static inline void
ktrcsw(int a, int b) ktrcsw(int a, int b)
{ {