52 lines
1.2 KiB
Text
52 lines
1.2 KiB
Text
$NetBSD: patch-aa,v 1.6 2006/06/19 19:32:41 joerg Exp $
|
|
|
|
--- hot-babe.c.orig 2004-12-05 22:59:38.000000000 +0000
|
|
+++ hot-babe.c
|
|
@@ -29,6 +29,12 @@
|
|
#endif
|
|
#endif
|
|
|
|
+#if defined(__sun)
|
|
+# include <inttypes.h>
|
|
+# include <sys/loadavg.h>
|
|
+# define u_int64_t uint64_t
|
|
+#endif
|
|
+
|
|
/* x11 includes */
|
|
#include <gdk/gdk.h>
|
|
#include <gdk/gdkx.h>
|
|
@@ -68,20 +74,15 @@ typedef struct
|
|
|
|
HotBabeData bm;
|
|
|
|
-#if 0
|
|
+#if defined(__NetBSD__) || defined(__sun) || defined(__DragonFly__)
|
|
/* FIXME New BSD and Solaris code.. to check.
|
|
* doesn't work with Linux (getloadavg return 1.000) */
|
|
static int system_cpu(void)
|
|
{
|
|
- int rc;
|
|
- double loadavg[15];
|
|
- rc=getloadavg(loadavg, 1);
|
|
- while( rc-- )
|
|
- printf( "load = %f\n", loadavg[rc] );
|
|
- rc=100*loadavg[0];
|
|
- return rc;
|
|
+ double loadavg;
|
|
+ return ((getloadavg(&loadavg, 1) == -1) ? 0 : (100 * loadavg));
|
|
}
|
|
-#endif
|
|
+#elif defined(__linux__) || defined(__FreeBSD__)
|
|
|
|
/* returns current CPU load in percent, 0 to 256 */
|
|
static int system_cpu(void)
|
|
@@ -144,6 +145,9 @@ static int system_cpu(void)
|
|
|
|
return cpuload;
|
|
}
|
|
+#else
|
|
+# error Unknown operating system.
|
|
+#endif
|
|
|
|
GdkPixmap *pixmap;
|
|
GdkGC *gc;
|