packages/matchbox-panel/matchbox-panel-0.9.2/system-monitor-crash-fix.patch
authorPhilippe De Swert <philippedeswert@scarlet.be>
Tue, 7 Feb 2006 19:23:36 +0000 (19:23 +0000)
committerOpenEmbedded Project <openembedded-devel@lists.openembedded.org>
Tue, 7 Feb 2006 19:23:36 +0000 (19:23 +0000)
* update patch to avoid compile time cpu selection
packages/matchbox-panel/matchbox-panel-0.9.2/matchbox-panel_0.9.2.bb
* bunp PR number

packages/matchbox-panel/matchbox-panel-0.9.2/system-monitor-crash-fix.patch
packages/matchbox-panel/matchbox-panel_0.9.2.bb

index c9a49fb..51c141d 100644 (file)
@@ -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)
  {
  
 -      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);
 +      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);
 +      
  void
  paint_callback (MBTrayApp *app, Drawable drw )
  {
+@@ -340,6 +378,8 @@
+                         &argc,
+                         &argv );  
++   kernelver = kernel_version();
++
+    msd.samples = 16;
+    
+    if (msd.load) {
index 4c03769..0e2ccf3 100644 (file)
@@ -1,6 +1,6 @@
 include matchbox-panel.inc
 
-PR="r9"
+PR="r10"
 SRC_URI = "http://projects.o-hand.com/matchbox/sources/${PN}/0.9/${PN}-${PV}.tar.gz \
            file://add_hostap.patch;patch=1 \
            http://handhelds.org/~pb/mb-panel-0.9.2-polling.patch;patch=1 \