[Midnightbsd-cvs] src [8286] trunk/sys: until now KTR_ENTRIES, which define the size of the circular buffer used in ktr(4) were constrained to be a power of 2.
laffer1 at midnightbsd.org
laffer1 at midnightbsd.org
Sat Sep 17 18:06:50 EDT 2016
Revision: 8286
http://svnweb.midnightbsd.org/src/?rev=8286
Author: laffer1
Date: 2016-09-17 18:06:50 -0400 (Sat, 17 Sep 2016)
Log Message:
-----------
until now KTR_ENTRIES, which define the size of the circular buffer used in ktr(4) were constrained to be a power of 2.
Modified Paths:
--------------
trunk/sys/conf/NOTES
trunk/sys/kern/kern_ktr.c
Modified: trunk/sys/conf/NOTES
===================================================================
--- trunk/sys/conf/NOTES 2016-09-17 22:06:03 UTC (rev 8285)
+++ trunk/sys/conf/NOTES 2016-09-17 22:06:50 UTC (rev 8286)
@@ -435,7 +435,7 @@
#
# KTR is a kernel tracing facility imported from BSD/OS. It is
# enabled with the KTR option. KTR_ENTRIES defines the number of
-# entries in the circular trace buffer; it must be a power of two.
+# entries in the circular trace buffer; it may be an arbitrary number.
# KTR_COMPILE defines the mask of events to compile into the kernel as
# defined by the KTR_* constants in <sys/ktr.h>. KTR_MASK defines the
# initial value of the ktr_mask variable which determines at runtime
Modified: trunk/sys/kern/kern_ktr.c
===================================================================
--- trunk/sys/kern/kern_ktr.c 2016-09-17 22:06:03 UTC (rev 8285)
+++ trunk/sys/kern/kern_ktr.c 2016-09-17 22:06:50 UTC (rev 8286)
@@ -283,7 +283,7 @@
{
do {
saveindex = ktr_idx;
- newindex = (saveindex + 1) & (KTR_ENTRIES - 1);
+ newindex = (saveindex + 1) % KTR_ENTRIES;
} while (atomic_cmpset_rel_int(&ktr_idx, saveindex, newindex) == 0);
entry = &ktr_buf[saveindex];
}
@@ -338,7 +338,7 @@
DB_SHOW_COMMAND(ktr, db_ktr_all)
{
- tstate.cur = (ktr_idx - 1) & (KTR_ENTRIES - 1);
+ tstate.cur = (ktr_idx - 1) % KTR_ENTRIES;
tstate.first = -1;
db_ktr_verbose = 0;
db_ktr_verbose |= (index(modif, 'v') != NULL) ? 2 : 0;
More information about the Midnightbsd-cvs
mailing list