From 5325dbfef1d901221f08601e8b9cce9cf880ab47 Mon Sep 17 00:00:00 2001 From: Kris Moore Date: Thu, 8 Sep 2011 21:56:10 +0000 Subject: - Update to 0.5.8 --- x11/lxpanel/files/patch-src-plugins-cpu-cpu.c | 93 --------------------------- 1 file changed, 93 deletions(-) delete mode 100644 x11/lxpanel/files/patch-src-plugins-cpu-cpu.c (limited to 'x11/lxpanel/files/patch-src-plugins-cpu-cpu.c') diff --git a/x11/lxpanel/files/patch-src-plugins-cpu-cpu.c b/x11/lxpanel/files/patch-src-plugins-cpu-cpu.c deleted file mode 100644 index 6ebfbc659690..000000000000 --- a/x11/lxpanel/files/patch-src-plugins-cpu-cpu.c +++ /dev/null @@ -1,93 +0,0 @@ ---- src/plugins/cpu/cpu.c.orig 2010-02-08 01:37:52.000000000 -0500 -+++ src/plugins/cpu/cpu.c 2010-09-24 12:30:27.856886131 -0400 -@@ -19,12 +19,24 @@ - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - */ --/*A little bug fixed by Mykola :) */ -+ -+/* -+ * A little bug fixed by Mykola :) -+ * FreeBSD support added by Andreas Wiese -+ */ -+ - - #include - #include - #include --#include -+#ifdef __FreeBSD__ -+# include -+# include -+# include -+# include -+#else -+# include -+#endif - #include - #include - -@@ -65,6 +77,39 @@ - static int cpu_constructor(Plugin * p, char ** fp); - static void cpu_destructor(Plugin * p); - -+#ifdef __FreeBSD__ -+static void -+get_procstat(unsigned long *u, unsigned long *n, unsigned long *s, -+ unsigned long *i) -+{ -+ static int mib[2] = { -1, -1 }, init = 0, j, realhz; -+ long ct[CPUSTATES]; -+ -+ -+ if(init == 0) { -+ struct clockinfo ci; -+ j = sizeof(ci); -+ sysctlbyname("kern.clockrate", &ci, &j, NULL, 0); -+ realhz = ci.stathz ? ci.stathz : ci.hz; -+ -+ j = 2; -+ sysctlnametomib("kern.cp_time", mib, &j); -+ -+ init = 1; -+ j = sizeof(ct); -+ } -+ -+ sysctl(mib, 2, ct, &j, NULL, 0); -+ *u = ct[CP_USER] / realhz; -+ *n = ct[CP_NICE] / realhz; -+ *s = ct[CP_SYS] / realhz; -+ *i = ct[CP_IDLE] / realhz; -+ -+ return; -+} -+#endif -+ -+ - /* Redraw after timer callback or resize. */ - static void redraw_pixmap(CPUPlugin * c) - { -@@ -99,11 +144,18 @@ - { - /* Open statistics file and scan out CPU usage. */ - struct cpu_stat cpu; -- FILE * stat = fopen("/proc/stat", "r"); -- if (stat == NULL) -- return TRUE; -- int fscanf_result = fscanf(stat, "cpu %lu %lu %lu %lu", &cpu.u, &cpu.n, &cpu.s, &cpu.i); -- fclose(stat); -+ FILE * stat; -+ -+ #ifdef __FreeBSD__ -+ get_procstat(&cpu.u, &cpu.n, &cpu.s, &cpu.i); -+ int fscanf_result = 4; -+ #else -+ stat = fopen("/proc/stat", "r"); -+ if (stat == NULL) -+ return TRUE; -+ int fscanf_result = fscanf(stat, "cpu %lu %lu %lu %lu", &cpu.u, &cpu.n, &cpu.s, &cpu.i); -+ fclose(stat); -+ #endif - - /* Ensure that fscanf succeeded. */ - if (fscanf_result == 4) -- cgit v1.2.3