Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 15 Mar 2005 23:39:58 GMT
From:      Peter Wemm <peter@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 73261 for review
Message-ID:  <200503152339.j2FNdwld011634@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=73261

Change 73261 by peter@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>



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200503152339.j2FNdwld011634>