PERFORCE change 73261 for review
Peter Wemm
peter at FreeBSD.org
Tue Mar 15 15:39:59 PST 2005
http://perforce.freebsd.org/chv.cgi?CH=73261
Change 73261 by peter at peter_daintree on 2005/03/15 23:39:35
I'm ashamed, but this will do as an interim measure.
I feel a req->flags flag coming on.
Affected files ...
.. //depot/projects/hammer/sys/kern/kern_clock.c#23 edit
Differences ...
==== //depot/projects/hammer/sys/kern/kern_clock.c#23 (text+ko) ====
@@ -39,6 +39,7 @@
#include "opt_ntp.h"
#include "opt_watchdog.h"
+#include "opt_compat.h"
#include <sys/param.h>
#include <sys/systm.h>
@@ -79,8 +80,36 @@
/* Some of these don't belong here, but it's easiest to concentrate them. */
long cp_time[CPUSTATES];
-SYSCTL_OPAQUE(_kern, OID_AUTO, cp_time, CTLFLAG_RD, &cp_time, sizeof(cp_time),
- "LU", "CPU time statistics");
+#ifdef COMPAT_IA32
+extern struct sysentvec ia32_freebsd_sysvec;
+#endif
+
+static int
+sysctl_kern_cp_time(SYSCTL_HANDLER_ARGS)
+{
+ int error;
+#ifdef COMPAT_IA32
+ int i;
+ unsigned int cp_time32[CPUSTATES];
+
+ if (req->td->td_proc->p_sysent == &ia32_freebsd_sysvec) {
+ if (!req->oldptr)
+ return SYSCTL_OUT(req, 0, sizeof(cp_time32));
+ for (i = 0; i < CPUSTATES; i++)
+ cp_time32[i] = (unsigned int)cp_time[i];
+ error = SYSCTL_OUT(req, cp_time32, sizeof(cp_time32));
+ } else
+#endif
+ {
+ if (!req->oldptr)
+ return SYSCTL_OUT(req, 0, sizeof(cp_time));
+ error = SYSCTL_OUT(req, cp_time, sizeof(cp_time));
+ }
+ return error;
+}
+
+SYSCTL_PROC(_kern, OID_AUTO, cp_time, CTLTYPE_LONG|CTLFLAG_RD,
+ 0,0, sysctl_kern_cp_time, "LU", "CPU time statistics");
#ifdef SW_WATCHDOG
#include <sys/watchdog.h>
More information about the p4-projects
mailing list