From 0d72e6230358348a725928109540de85194c82d4 Mon Sep 17 00:00:00 2001 From: Chin-San Huang Date: Sat, 21 Jun 2008 09:44:59 +0000 Subject: - Update to 0.3.7. PR: ports/124815 Submitted by: chinsan Approved by: maintainer --- x11/lxpanel/files/patch-src-plugin-cpu-cpu.c | 87 ---------------------------- 1 file changed, 87 deletions(-) delete mode 100644 x11/lxpanel/files/patch-src-plugin-cpu-cpu.c (limited to 'x11/lxpanel/files/patch-src-plugin-cpu-cpu.c') diff --git a/x11/lxpanel/files/patch-src-plugin-cpu-cpu.c b/x11/lxpanel/files/patch-src-plugin-cpu-cpu.c deleted file mode 100644 index a3e060757fbd..000000000000 --- a/x11/lxpanel/files/patch-src-plugin-cpu-cpu.c +++ /dev/null @@ -1,87 +0,0 @@ ---- src/plugins/cpu/cpu.c.orig Sat Dec 23 17:32:42 2006 -+++ src/plugins/cpu/cpu.c Sat Dec 23 17:32:49 2006 -@@ -24,7 +24,15 @@ - #include - #include - #include --#include -+ -+#ifdef __FreeBSD__ -+# include -+# include -+# include -+#else -+# include -+#endif -+ - #include - #include - -@@ -61,6 +69,38 @@ - 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) -@@ -68,18 +108,28 @@ - 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 -+ - FILE *stat; - 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