summaryrefslogtreecommitdiffstats
path: root/sys/kern
diff options
context:
space:
mode:
authortmm <tmm@FreeBSD.org>2001-06-01 13:23:28 +0000
committertmm <tmm@FreeBSD.org>2001-06-01 13:23:28 +0000
commit9ce8a6234736b0446ecc22b1092f693c658a25be (patch)
treedfa10a376890935609a85e9cf3ff54855c2ff66c /sys/kern
parent831472121170bbeebce019cd7be85fb15d34bd31 (diff)
downloadFreeBSD-src-9ce8a6234736b0446ecc22b1092f693c658a25be.zip
FreeBSD-src-9ce8a6234736b0446ecc22b1092f693c658a25be.tar.gz
Clean up the code exporting interrupt statistics via sysctl a bit:
- move the sysctl code to kern_intr.c - do not use INTRCNT_COUNT, but rather eintrcnt - intrcnt to determine the length of the intrcnt array - move the declarations of intrnames, eintrnames, intrcnt and eintrcnt from machine-dependent include files to sys/interrupt.h - remove the hw.nintr sysctl, it is not needed. - fix various style bugs Requested by: bde Reviewed by: bde (some time ago)
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/kern_intr.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/sys/kern/kern_intr.c b/sys/kern/kern_intr.c
index 5b376c1..59ef7ff 100644
--- a/sys/kern/kern_intr.c
+++ b/sys/kern/kern_intr.c
@@ -42,6 +42,7 @@
#include <sys/proc.h>
#include <sys/random.h>
#include <sys/resourcevar.h>
+#include <sys/sysctl.h>
#include <sys/unistd.h>
#include <sys/vmmeter.h>
#include <machine/atomic.h>
@@ -620,3 +621,32 @@ swi_net(void *dummy)
bits &= ~(1 << i);
}
}
+
+/*
+ * Sysctls used by systat and others: hw.intrnames and hw.intrcnt.
+ * The data for this machine dependent, and the declarations are in machine
+ * dependent code. The layout of intrnames and intrcnt however is machine
+ * independent.
+ *
+ * We do not know the length of intrcnt and intrnames at compile time, so
+ * calculate things at run time.
+ */
+static int
+sysctl_intrnames(SYSCTL_HANDLER_ARGS)
+{
+ return (sysctl_handle_opaque(oidp, intrnames, eintrnames - intrnames,
+ req));
+}
+
+SYSCTL_PROC(_hw, OID_AUTO, intrnames, CTLTYPE_OPAQUE | CTLFLAG_RD,
+ NULL, 0, sysctl_intrnames, "", "Interrupt Names");
+
+static int
+sysctl_intrcnt(SYSCTL_HANDLER_ARGS)
+{
+ return (sysctl_handle_opaque(oidp, intrcnt,
+ (char *)eintrcnt - (char *)intrcnt, req));
+}
+
+SYSCTL_PROC(_hw, OID_AUTO, intrcnt, CTLTYPE_OPAQUE | CTLFLAG_RD,
+ NULL, 0, sysctl_intrcnt, "", "Interrupt Counts");
OpenPOWER on IntegriCloud