From 4c8a065e7f12122ecd7c721a647754b79cb856ed Mon Sep 17 00:00:00 2001 From: Beech Rintoul Date: Mon, 22 Nov 2010 11:35:55 +0000 Subject: Update to version 6.1 Numerous changes since last FreeBSD port version. See CHANGELOG from distfile for details. PR: 152338 Submitted by: Charlie Kester corky1951@comcast.net (maintainer) Approved by: itetcu --- x11/fbpanel/files/patch-cpu.c | 92 ------------------------------------------- 1 file changed, 92 deletions(-) delete mode 100644 x11/fbpanel/files/patch-cpu.c (limited to 'x11/fbpanel/files/patch-cpu.c') diff --git a/x11/fbpanel/files/patch-cpu.c b/x11/fbpanel/files/patch-cpu.c deleted file mode 100644 index b5cff0998335..000000000000 --- a/x11/fbpanel/files/patch-cpu.c +++ /dev/null @@ -1,92 +0,0 @@ ---- plugins/cpu.c~ Tue May 16 19:23:18 2006 -+++ plugins/cpu.c Tue May 16 19:00:07 2006 -@@ -18,14 +18,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 -+#else -+# include -+#endif - #include -+#include - - #include "plugin.h" - #include "panel.h" -@@ -60,6 +70,37 @@ - struct cpu_stat cpu_anterior; - } cpu_t; - -+#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 - - static int - cpu_update(cpu_t *c) -@@ -67,18 +108,24 @@ - int cpu_u=0, cpu_s=0, cpu_n=0, cpu_i=100; - unsigned int i; - struct cpu_stat cpu, cpu_r; -+#ifndef __FreeBSD__ - FILE *stat; -+#endif - float total; - - ENTER; - if(!c->pixmap) - RET(TRUE); - -+#ifdef __FreeBSD__ -+ get_procstat(&cpu.u, &cpu.n, &cpu.s, &cpu.i); -+#else - stat = fopen("/proc/stat", "r"); - if(!stat) - RET(TRUE); - fscanf(stat, "cpu %lu %lu %lu %lu", &cpu.u, &cpu.n, &cpu.s, &cpu.i); - fclose(stat); -+#endif - - cpu_r.u = cpu.u - c->cpu_anterior.u; - cpu_r.n = cpu.n - c->cpu_anterior.n; -- cgit v1.2.3