diff options
author | Dan Moschuk <dan@FreeBSD.org> | 2001-08-11 20:18:19 +0000 |
---|---|---|
committer | Dan Moschuk <dan@FreeBSD.org> | 2001-08-11 20:18:19 +0000 |
commit | 90246d357c5ef9e3289ec2b7ca51da9a7382fbcb (patch) | |
tree | 963d597bb387d653f391172759900e84bd196f37 /x11-wm/epplets/files/patch-ad | |
parent | Update to 20010812, just a minor update. (diff) |
Make some of the linux-centric epplets work.
Submitted by: Chris McDermott <cmc@groupofnine.org>
Unresponsive: nakai
Notes
Notes:
svn path=/head/; revision=46092
Diffstat (limited to 'x11-wm/epplets/files/patch-ad')
-rw-r--r-- | x11-wm/epplets/files/patch-ad | 70 |
1 files changed, 67 insertions, 3 deletions
diff --git a/x11-wm/epplets/files/patch-ad b/x11-wm/epplets/files/patch-ad index 39abe3c18191..ba9cd874c724 100644 --- a/x11-wm/epplets/files/patch-ad +++ b/x11-wm/epplets/files/patch-ad @@ -1,6 +1,70 @@ ---- epplets/E-Load.c.orig Thu Jan 13 15:01:17 2000 -+++ epplets/E-Load.c Thu Jan 13 15:01:37 2000 -@@ -95,7 +95,7 @@ +--- epplets/E-Load.c.orig Fri Nov 19 13:46:24 1999 ++++ epplets/E-Load.c Fri Aug 3 18:45:55 2001 +@@ -1,11 +1,17 @@ + #include "config.h" + #include "epplet.h" + +-#ifdef HAVE_LIBGTOP ++#ifdef __FreeBSD__ ++ ++#include <sys/sysctl.h> ++ ++#elif defined(HAVE_LIBGTOP) ++ + #include <glibtop.h> + #include <glibtop/loadavg.h> + #include <glibtop/cpu.h> + #include "proc.h" ++ + #endif + + int cpus = 0; +@@ -20,7 +26,22 @@ + static void + cb_timer(void *data) + { +-#ifdef HAVE_LIBGTOP ++#ifdef __FreeBSD__ ++ ++ double val; ++ ++ if(getloadavg(&val, 1) == -1) ++ return; ++ ++ val *= 20; ++ ++ if(val > 100) ++ val = 100; ++ ++ load_val[0] = val; ++ Epplet_gadget_data_changed(load[0]); ++ ++#elif defined(HAVE_LIBGTOP) + + /* libgtop only handles total load, not per-CPU load */ + +@@ -89,13 +110,27 @@ + int + count_cpus(void) + { +-#ifdef HAVE_LIBGTOP ++#ifdef __FreeBSD__ ++ ++ int ncpu, mib[2]; ++ size_t size; ++ ++ mib[0] = CTL_HW; ++ mib[1] = HW_NCPU; ++ size = sizeof(ncpu); ++ ++ if(sysctl(mib, 2, &ncpu, &size, NULL, 0) == -1) ++ return 1; ++ ++ return ncpu; ++ ++#elif HAVE_LIBGTOP + int i,c = 0; + int bits; glibtop_cpu cpu; glibtop_get_cpu (&cpu); |