Add a new sysctl, debug.ktr.clear. If you write a non-zero value to this

sysctl then it will clear the KTR buffer.  Note that if you have active
KTR traces at the same time as a clear operation the behavior is undefined,
though it shouldn't panic.
This commit is contained in:
John Baldwin 2006-01-27 22:17:31 +00:00
parent b5b86d9583
commit bef4bf1adf
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=154933

View File

@ -100,6 +100,26 @@ SYSCTL_INT(_debug_ktr, OID_AUTO, version, CTLFLAG_RD, &ktr_version, 0, "");
volatile int ktr_idx = 0;
struct ktr_entry ktr_buf[KTR_ENTRIES];
static int
sysctl_debug_ktr_clear(SYSCTL_HANDLER_ARGS)
{
int clear, error;
clear = 0;
error = sysctl_handle_int(oidp, &clear, 0, req);
if (error || !req->newptr)
return (error);
if (clear) {
bzero(ktr_buf, sizeof(ktr_buf));
ktr_idx = 0;
}
return (error);
}
SYSCTL_PROC(_debug_ktr, OID_AUTO, clear, CTLTYPE_INT|CTLFLAG_RW, 0, 0,
sysctl_debug_ktr_clear, "I", "Clear KTR Buffer");
#ifdef KTR_VERBOSE
int ktr_verbose = KTR_VERBOSE;
TUNABLE_INT("debug.ktr.verbose", &ktr_verbose);