aboutsummaryrefslogtreecommitdiffstats
path: root/x11/fbpanel
diff options
context:
space:
mode:
authorbsam <bsam@FreeBSD.org>2013-11-04 19:40:15 +0800
committerbsam <bsam@FreeBSD.org>2013-11-04 19:40:15 +0800
commita216b0f2cc5203fea9d0a8905014883e2dc02a04 (patch)
treeee49abc8346c9bcbbff91a6b7784c88d5f42e43d /x11/fbpanel
parent4dcf24d2f18caf8892698c94091fc3af1eea26eb (diff)
downloadfreebsd-ports-gnome-a216b0f2cc5203fea9d0a8905014883e2dc02a04.tar.gz
freebsd-ports-gnome-a216b0f2cc5203fea9d0a8905014883e2dc02a04.tar.zst
freebsd-ports-gnome-a216b0f2cc5203fea9d0a8905014883e2dc02a04.zip
. fix cpu plugin (core dumped without the fix);
. bump PORTREVISION; . take maintainership. Submitted by: bsam (me, via e-mail) Approved by: nemysis (former maintainer)
Diffstat (limited to 'x11/fbpanel')
-rw-r--r--x11/fbpanel/Makefile6
-rw-r--r--x11/fbpanel/files/patch-plugins__cpu__cpu.c59
2 files changed, 21 insertions, 44 deletions
diff --git a/x11/fbpanel/Makefile b/x11/fbpanel/Makefile
index 1ec9e7ebaf38..de9f771c7b49 100644
--- a/x11/fbpanel/Makefile
+++ b/x11/fbpanel/Makefile
@@ -3,13 +3,13 @@
PORTNAME= fbpanel
PORTVERSION= 6.1
-PORTREVISION= 2
+PORTREVISION= 3
CATEGORIES= x11
MASTER_SITES= SF
EXTRACT_SUFX= .tbz2
-MAINTAINER= nemysis@gmx.ch
-COMMENT= Lightweight, NETWM compliant X11 desktop panel
+MAINTAINER= bsam@FreeBSD.org
+COMMENT= Lightweight, NEtWM compliant X11 desktop panel
LICENSE= MIT
diff --git a/x11/fbpanel/files/patch-plugins__cpu__cpu.c b/x11/fbpanel/files/patch-plugins__cpu__cpu.c
index ed679d860e3a..8c50bd994d13 100644
--- a/x11/fbpanel/files/patch-plugins__cpu__cpu.c
+++ b/x11/fbpanel/files/patch-plugins__cpu__cpu.c
@@ -1,5 +1,5 @@
--- ./plugins/cpu/cpu.c.orig 2010-03-07 00:14:04.000000000 -0800
-+++ ./plugins/cpu/cpu.c 2010-11-17 11:06:07.000000000 -0800
++++ ./plugins/cpu/cpu.c 2013-11-04 01:56:23.388313800 +0400
@@ -18,9 +18,20 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
@@ -22,24 +22,7 @@
#include "misc.h"
#include "../chart/chart.h"
-@@ -29,9 +40,16 @@
- #include "dbg.h"
-
- /* cpu.c */
-+#if defined __FreeBSD__
-+struct cpu_stat {
-+ gulong u, n, s, i; // user, nice, system, idle
-+};
-+#else
- struct cpu_stat {
- gulong u, n, s, i, w; // user, nice, system, idle, wait
- };
-+#endif
-+
-
- typedef struct {
- chart_priv chart;
-@@ -84,6 +102,65 @@
+@@ -84,6 +102,59 @@
RET(TRUE);
}
@@ -47,11 +30,11 @@
+static int
+cpu_get_load(cpu_priv * c)
+{
-+ static int mib[2] = {-1, -1}, init = 0, j, realhz;
++ static int mib[2] = {-1, -1}, init = 0, j;
+ long ct[CPUSTATES];
+
+ gfloat a , b;
-+ struct cpu_stat cpu, cpu_diff;
++ struct cpu_stat cpu;
+ float total;
+ gchar buf[40];
+
@@ -59,19 +42,16 @@
+ total = 0;
+
+ if (init == 0) {
-+ struct clockinfo ci;
-+ j = sizeof(ci);
-+ if (sysctlbyname("kern.clockrate", &ci, &j, NULL, 0) == -1) {
-+ DBG("Couldn't get kern.clockrate");
-+ RET(FALSE);
-+ } else
-+ realhz = ci.stathz ? ci.stathz : ci.hz;
-+
+ j = 2;
+ if (sysctlnametomib("kern.cp_time", mib, &j) == -1) {
+ DBG("Couldn't get mib for kern.cp_time");
+ RET(FALSE);
+ }
++ c->cpu_prev.u = 0;
++ c->cpu_prev.n = 0;
++ c->cpu_prev.s = 0;
++ c->cpu_prev.i = 0;
++ c->cpu_prev.w = 0;
+ init = 1;
+ j = sizeof(ct);
+ }
@@ -79,20 +59,17 @@
+ DBG("Couldn't get cpu stats");
+ RET(FALSE);
+ }
-+ cpu.u = ct[CP_USER] / realhz;
-+ cpu.n = ct[CP_NICE] / realhz;
-+ cpu.s = ct[CP_SYS] / realhz;
-+ cpu.i = ct[CP_IDLE] / realhz;
+
-+ cpu_diff.u = cpu.u - c->cpu_prev.u;
-+ cpu_diff.n = cpu.n - c->cpu_prev.n;
-+ cpu_diff.s = cpu.s - c->cpu_prev.s;
-+ cpu_diff.i = cpu.i - c->cpu_prev.i;
-+ c->cpu_prev = cpu;
++ a = ct[CP_USER] + ct[CP_NICE] + ct[CP_SYS] + ct[CP_INTR] -
++ (c->cpu_prev.u + c->cpu_prev.n + c->cpu_prev.s + c->cpu_prev.i);
++ b = a + ct[CP_IDLE] - c->cpu_prev.w;
++ total = b ? (float)a / b : 1.0;
+
-+ a = cpu_diff.u + cpu_diff.n + cpu_diff.s;
-+ b = a + cpu_diff.i;
-+ total = b ? a / b : 1.0;
++ c->cpu_prev.u = ct[CP_USER];
++ c->cpu_prev.n = ct[CP_NICE];
++ c->cpu_prev.s = ct[CP_SYS] ;
++ c->cpu_prev.i = ct[CP_INTR];
++ c->cpu_prev.w = ct[CP_IDLE];
+
+end:
+ DBG("total=%f a=%f b=%f\n", total, a, b);