openbsd-ports/devel/libgtop2/patches/patch-sysdeps_freebsd_cpu_c
2005-05-25 23:28:16 +00:00

48 lines
1.3 KiB
Plaintext

--- sysdeps/freebsd/cpu.c.orig Tue Mar 1 15:03:57 2005
+++ sysdeps/freebsd/cpu.c Mon Apr 11 19:56:33 2005
@@ -27,7 +27,7 @@
#include <glibtop_suid.h>
-#ifdef __NetBSD__
+#ifdef __NetBSD__ || defined(__OpenBSD__)
#include <sys/sched.h>
#endif
@@ -37,7 +37,7 @@ static const unsigned long _glibtop_sysd
(1L << GLIBTOP_CPU_IDLE) + (1L << GLIBTOP_CPU_FREQUENCY) +
(1L << GLIBTOP_CPU_IOWAIT);
-#ifndef KERN_CP_TIME
+#if !defined(KERN_CP_TIME) && !defined(KERN_CPTIME)
/* nlist structure for kernel access */
static struct nlist nlst [] = {
#ifdef __bsdi__
@@ -55,13 +55,16 @@ static int mib [] = { CTL_KERN, KERN_CLO
#ifdef KERN_CP_TIME
static int mib2 [] = { CTL_KERN, KERN_CP_TIME };
#endif
+#ifdef KERN_CPTIME
+static int mib2 [] = { CTL_KERN, KERN_CPTIME };
+#endif
/* Init function. */
void
glibtop_init_cpu_p (glibtop *server)
{
-#ifndef KERN_CP_TIME
+#if !defined(KERN_CP_TIME) && !defined(KERN_CPTIME)
if (kvm_nlist (server->machine.kd, nlst) < 0) {
glibtop_warn_io_r (server, "kvm_nlist (cpu)");
return;
@@ -94,7 +97,7 @@ glibtop_get_cpu_p (glibtop *server, glib
if (server->sysdeps.cpu == 0)
return;
-#ifdef KERN_CP_TIME
+#if defined(KERN_CP_TIME) || defined(KERN_CPTIME)
length = sizeof (cpts);
if (sysctl (mib2, mib_length, cpts, &length, NULL, 0)) {
glibtop_warn_io_r (server, "sysctl");