summaryrefslogtreecommitdiff
path: root/packages/matchbox-panel
diff options
context:
space:
mode:
authorKoen Kooi <koen@openembedded.org>2005-12-21 10:41:59 +0000
committerOpenEmbedded Project <openembedded-devel@lists.openembedded.org>2005-12-21 10:41:59 +0000
commit472002ebecd6baa892afa5b7879570980b32eb2b (patch)
tree7aad4e4b84b4d836534ee8f51960310745bad8d8 /packages/matchbox-panel
parent816098f75a6cccca39de67e70b9453f78500cb75 (diff)
matchbox-panel 0.9.2: update system monitor patch
Diffstat (limited to 'packages/matchbox-panel')
-rw-r--r--packages/matchbox-panel/matchbox-panel-0.9.2/kernel2.6.patch171
-rw-r--r--packages/matchbox-panel/matchbox-panel_0.9.2.bb2
2 files changed, 86 insertions, 87 deletions
diff --git a/packages/matchbox-panel/matchbox-panel-0.9.2/kernel2.6.patch b/packages/matchbox-panel/matchbox-panel-0.9.2/kernel2.6.patch
index 0cea66645d..f849c8a41e 100644
--- a/packages/matchbox-panel/matchbox-panel-0.9.2/kernel2.6.patch
+++ b/packages/matchbox-panel/matchbox-panel-0.9.2/kernel2.6.patch
@@ -1,15 +1,24 @@
--- matchbox-panel-0.9.2/applets/mb-applet-system-monitor.c.old 2005-03-20 18:43:31.000000000 +0100
-+++ matchbox-panel-0.9.2/applets/mb-applet-system-monitor.c 2005-12-19 22:50:54.000000000 +0100
-@@ -112,70 +112,165 @@
++++ matchbox-panel-0.9.2/applets/mb-applet-system-monitor.c 2005-12-21 10:24:18.000000000 +0100
+@@ -37,6 +37,11 @@
+ # define _(text) (text)
+ #endif
+
++#include <linux/version.h>
++#ifndef KERNEL_VERSION
++#define KERNEL_VERSION(a,b,c) (((a) << 16) | ((b) << 8) | (c))
++#endif
++
+ #ifdef MB_HAVE_PNG
+ #define IMG_EXT "png"
+ #else
+@@ -112,71 +117,148 @@
int system_memory(void)
{
- u_int64_t my_mem_used, my_mem_max;
- u_int64_t my_swap_max;
-+ FILE * osrelease;
-+ char kernelversion[90] = "0", kernelcut[90] = "0";
-+ int kernellength = 3;
-
+-
- static int mem_delay = 0;
- FILE *mem;
- static u_int64_t total, used, mfree, shared, buffers, cached,
@@ -24,12 +33,9 @@
- fprintf(stderr, "mb-applet-system-monitor: failed to open /proc/meminfo. Exiting.\n");
- exit(1);
- }
-+ osrelease = fopen("/proc/sys/kernel/osrelease","r");
-
-+ fscanf (osrelease, "%s", kernelversion);
-
-+ strncpy(kernelcut, kernelversion, kernellength);
-
+-
+-
+-
- fgets(not_needed, 2048, mem);
-
- /*
@@ -72,78 +78,13 @@
- }
- /* nothing new */
- return 0;
--}
-+ if ((strcmp (kernelcut, "2.4")) == 0)
-+ {
-+ static u_int64_t total, used, mfree, shared, buffers, cached,
-+ cache_total, cache_used;
-+
-+ u_int64_t my_mem_used, my_mem_max;
-+ u_int64_t my_swap_max;
-+
-+ static int mem_delay = 0;
-+ FILE *mem;
-+
-+ /* put this in permanent storage instead of stack */
-+ static char not_needed[2048];
-+
-+ if (mem_delay-- <= 0) {
-+ if ((mem = fopen("/proc/meminfo", "r")) == NULL) {
-+ fprintf(stderr, "mb-applet-system-monitor: failed to open /proc/meminfo. Exiting.\n");
-+ exit(1);
-+ }
-+
-+ fgets(not_needed, 2048, mem);
-+
-+ /*
-+ total: used: free: shared: buffers: cached:
-+ */
-+ fscanf(mem, "%*s %Ld %Ld %Ld %Ld %Ld %Ld", &total, &used, &mfree,
-+ &shared, &buffers, &cached);
-+
-+ fscanf(mem, "%*s %Ld %Ld", &cache_total, &cache_used);
-+
-+ fclose(mem);
-+
-+ mem_delay = 25;
-+
-+ /* calculate it */
-+ my_mem_max = total;
-+ my_swap_max = cache_total;
-+
-+ my_mem_used = cache_used + used - cached - buffers;
-+
-+ /* No swap on ipaq
-+ if (my_mem_used > my_mem_max) {
-+ my_swap_used = my_mem_used - my_mem_max;
-+ my_mem_used = my_mem_max;
-+ } else {
-+ my_swap_used = 0;
-+ }
-+ */
-+
-+ msd.mem_used = my_mem_used;
-+ msd.mem_max = my_mem_max;
-+ //msd.swap_used = my_swap_used;
-+ //msd.swap_max = my_swap_max;
-+
-+ msd.mem_percent = (100 * msd.mem_used) / msd.mem_max;
-+ //msd.swap_percent = (100 * msd.swap_used) / msd.swap_max;
-+
-+ /* memory info changed - update things */
-+ return 1;
-+ }
-+ /* nothing new */
-+ return 0;
-+ }
-+ else if ((strcmp (kernelcut, "2.6")) == 0)
-+ {
++ #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
+ u_int64_t total, mfree, buffers, cached, used, shared,
+ cache_total, cache_free, cache_used;
+
+ u_int64_t my_mem_used, my_mem_max;
+ u_int64_t my_swap_max;
-
++
+ static int mem_delay = 0;
+ FILE *mem;
+
@@ -215,13 +156,71 @@
+ }
+ /* nothing new */
+ return 0;
-+ }
-+ else
-+ {
-+ printf("unsupported kernel version\n");
-+ exit(1);
-+ }
-+}
++ #else
++ static u_int64_t total, used, mfree, shared, buffers, cached,
++ cache_total, cache_used;
++
++ u_int64_t my_mem_used, my_mem_max;
++ u_int64_t my_swap_max;
++
++ static int mem_delay = 0;
++ FILE *mem;
++
++ /* put this in permanent storage instead of stack */
++ static char not_needed[2048];
++
++ if (mem_delay-- <= 0) {
++ if ((mem = fopen("/proc/meminfo", "r")) == NULL) {
++ fprintf(stderr, "mb-applet-system-monitor: failed to open /proc/meminfo. Exiting.\n");
++ exit(1);
++ }
++
++ fgets(not_needed, 2048, mem);
++
++ /*
++ total: used: free: shared: buffers: cached:
++ */
++ fscanf(mem, "%*s %Ld %Ld %Ld %Ld %Ld %Ld", &total, &used, &mfree,
++ &shared, &buffers, &cached);
++
++ fscanf(mem, "%*s %Ld %Ld", &cache_total, &cache_used);
++
++ fclose(mem);
++
++ mem_delay = 25;
++
++ /* calculate it */
++ my_mem_max = total;
++ my_swap_max = cache_total;
++
++ my_mem_used = cache_used + used - cached - buffers;
++
++ /* No swap on ipaq
++ if (my_mem_used > my_mem_max) {
++ my_swap_used = my_mem_used - my_mem_max;
++ my_mem_used = my_mem_max;
++ } else {
++ my_swap_used = 0;
++ }
++ */
++
++ msd.mem_used = my_mem_used;
++ msd.mem_max = my_mem_max;
++ //msd.swap_used = my_swap_used;
++ //msd.swap_max = my_swap_max;
++
++ msd.mem_percent = (100 * msd.mem_used) / msd.mem_max;
++ //msd.swap_percent = (100 * msd.swap_used) / msd.swap_max;
++
++ /* memory info changed - update things */
++ return 1;
++ }
++ /* nothing new */
++ return 0;
++ #endif
+ }
+-
void
paint_callback (MBTrayApp *app, Drawable drw )
+ {
diff --git a/packages/matchbox-panel/matchbox-panel_0.9.2.bb b/packages/matchbox-panel/matchbox-panel_0.9.2.bb
index 026907bcb1..90797cf853 100644
--- a/packages/matchbox-panel/matchbox-panel_0.9.2.bb
+++ b/packages/matchbox-panel/matchbox-panel_0.9.2.bb
@@ -1,6 +1,6 @@
include matchbox-panel.inc
-PR="r4"
+PR="r5"
SRC_URI = "http://projects.o-hand.com/matchbox/sources/${PN}/0.9/${PN}-${PV}.tar.gz \
file://add_hostap.patch;patch=1 \
file://kernel2.6.patch;patch=1"