$OpenBSD: patch-hot-babe_c,v 1.1.1.1 2004/12/25 10:34:14 alek Exp $
--- hot-babe.c.orig	Thu Dec 16 18:38:18 2004
+++ hot-babe.c	Thu Dec 16 18:42:12 2004
@@ -19,6 +19,14 @@
 #include <unistd.h>
 #include <stdlib.h>
 #include <string.h>
+#ifdef __OpenBSD__
+#include <sys/param.h>
+#include <sys/sched.h>
+#include <sys/sysctl.h>
+#include <sys/dkstat.h>
+#include <fcntl.h>
+#include <nlist.h>
+#endif
 #ifdef __FreeBSD__
 #include <sys/time.h>
 #include <sys/resource.h>
@@ -99,6 +107,13 @@ static int system_cpu(void)
   long cp_time[CPUSTATES];
   size_t len = sizeof(cp_time);
 #endif
+#ifdef __OpenBSD__
+  long load, total, oload, ototal;
+  long ab, ac, ad, ae, af;
+  long cp_time[CPUSTATES];
+  size_t len = sizeof(cp_time);
+  static int mib[] = { CTL_KERN, KERN_CPTIME };
+#endif
 
 #ifdef __linux__
   stat = fopen("/proc/stat", "r");
@@ -114,6 +129,16 @@ static int system_cpu(void)
   ad = cp_time[CP_SYS];
   ae = cp_time[CP_IDLE];
 #endif
+#ifdef __OpenBSD__
+  if (sysctl(mib, 2, &cp_time, &len, NULL, 0) < 0) {
+          (void)fprintf(stderr, "Cannot get kern.cp_time");
+  }
+  ab = cp_time[CP_USER];
+  ac = cp_time[CP_NICE];
+  ad = cp_time[CP_SYS];
+  ae = cp_time[CP_IDLE];
+  af = cp_time[CP_INTR];
+#endif
 
 
   /* Find out the CPU load */
@@ -122,6 +147,10 @@ static int system_cpu(void)
   load = ab + ad;  /* cpu.user + cpu.sys; */
   if(!bm.noNice) load += ac;
   total = ab + ac + ad + ae;  /* cpu.total; */
+#ifdef __OpenBSD__
+  load += af;
+  total += af;
+#endif
 
   i = bm.loadIndex;
   oload = bm.load[i];