diff options
Diffstat (limited to 'packages/matchbox-panel/matchbox-panel-0.9.2')
-rw-r--r-- | packages/matchbox-panel/matchbox-panel-0.9.2/system-monitor-crash-fix.patch | 72 |
1 files changed, 53 insertions, 19 deletions
diff --git a/packages/matchbox-panel/matchbox-panel-0.9.2/system-monitor-crash-fix.patch b/packages/matchbox-panel/matchbox-panel-0.9.2/system-monitor-crash-fix.patch index c9a49fb881..51c141db03 100644 --- a/packages/matchbox-panel/matchbox-panel-0.9.2/system-monitor-crash-fix.patch +++ b/packages/matchbox-panel/matchbox-panel-0.9.2/system-monitor-crash-fix.patch @@ -1,23 +1,46 @@ ---- matchbox-panel-0.9.2/applets/mb-applet-system-monitor.c.orig 2006-02-04 19:22:55.000000000 +0200 -+++ matchbox-panel-0.9.2/applets/mb-applet-system-monitor.c 2006-02-04 18:18:21.000000000 +0200 -@@ -37,6 +37,16 @@ +--- matchbox-panel-0.9.2/applets/mb-applet-system-monitor.c.orig 2006-02-07 20:08:09.000000000 +0200 ++++ matchbox-panel-0.9.2/applets/mb-applet-system-monitor.c 2006-02-07 20:53:20.000000000 +0200 +@@ -37,6 +37,7 @@ # define _(text) (text) #endif -+#ifdef HAVE_LINUX_VER_H -+#include <linux/version.h> -+#else -+#define LINUX_VERSION_CODE 0 -+#endif -+ -+#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 +122,83 @@ +@@ -66,8 +67,30 @@ + MBPixbufImage *ImgIcon = NULL, *ImgIconScaled = NULL, *ImgGraph = NULL; + + int GraphHeight = 0, GraphWidth = 0; +- + char *ThemeName; ++static int kernelver = 0; ++ ++/* returns 1 if the kernel version is 2.6, 0 otherwise */ ++int kernel_version(void) ++{ ++ float v_nr=0; ++ FILE *version; ++ ++ if ((version = fopen("/proc/version", "r")) == NULL) ++ { ++ fprintf(stderr, "mb-applet-system-monitor: failed to open /proc/version. Exiting\n"); ++ exit(1); ++ } ++ fscanf(version, "%*s %*s %f", &v_nr); ++ fclose(version); ++ ++ if (v_nr > 2.5) ++ return 1; ++ else ++ return 0; ++} ++ ++ + + /* returns current CPU load in percent, 0 to 100 */ + int system_cpu(void) +@@ -112,71 +135,86 @@ int system_memory(void) { @@ -94,14 +117,15 @@ - msd.mem_percent = (100 * msd.mem_used) / msd.mem_max; - //msd.swap_percent = (100 * msd.swap_used) / msd.swap_max; -- ++/*if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)*/ + - /* memory info changed - update things */ - return 1; - } - /* nothing new */ - return 0; -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) -+ ++ if(kernelver) ++ { + rewind (mem); + + fscanf (mem, "%*s %Ld %*s", &total); @@ -126,15 +150,16 @@ + shared = shared * 1024; + cache_total = cache_total * 1024; + cache_used = cache_total - (cache_free * 1024); -+#else ++ } ++else ++ { + /* + 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); -+ -+#endif ++ } + + fclose(mem); + @@ -159,3 +184,12 @@ void paint_callback (MBTrayApp *app, Drawable drw ) { +@@ -340,6 +378,8 @@ + &argc, + &argv ); + ++ kernelver = kernel_version(); ++ + msd.samples = 16; + + if (msd.load) { |