Sophie

Sophie

distrib > Mandriva > current > i586 > media > contrib-release-src > by-pkgid > 580b34bc7ec4b6172ce855f6a17e7832 > files > 2

xfce4-systemload-plugin-0.4.2-11mdv2010.1.src.rpm

diff -Nur -x '*.orig' -x '*~' xfce4-systemload-plugin-0.4.2/panel-plugin/memswap.c xfce4-systemload-plugin-0.4.2.new/panel-plugin/memswap.c
--- xfce4-systemload-plugin-0.4.2/panel-plugin/memswap.c	2007-01-17 19:01:09.000000000 +0100
+++ xfce4-systemload-plugin-0.4.2.new/panel-plugin/memswap.c	2008-03-08 12:16:34.000000000 +0100
@@ -48,6 +48,7 @@
 static unsigned long MTotal = 0;
 static unsigned long MFree = 0;
 static unsigned long MCached = 0;
+static unsigned long MBuffers = 0;
 static unsigned long MUsed = 0;
 static unsigned long STotal = 0;
 static unsigned long SFree = 0;
@@ -57,8 +58,8 @@
 {
     int fd;
     size_t n;
-    int o_MTotal, o_MFree, o_MCached, o_STotal, o_SFree;
-    char *b_MTotal, *b_MFree, *b_MCached, *b_STotal, *b_SFree;
+    int o_MTotal, o_MFree, o_MCached, o_MBuffers, o_STotal, o_SFree;
+    char *b_MTotal, *b_MFree, *b_MCached, *b_MBuffers, *b_STotal, *b_SFree;
 
     if ((fd = open("/proc/meminfo", O_RDONLY)) < 0)
     {
@@ -87,6 +88,10 @@
     if (b_MCached)
         o_MCached = sscanf(b_MCached + strlen("Cached"), ": %lu", &MCached);
 
+    b_MBuffers = strstr(MemInfoBuf, "Buffers");
+    if (b_MBuffers)
+        o_MBuffers = sscanf(b_MBuffers + strlen("Buffers"), ": %lu", &MBuffers);
+
     b_STotal = strstr(MemInfoBuf, "SwapTotal");
     if (b_STotal)
         o_STotal = sscanf(b_STotal + strlen("SwapTotal"), ": %lu", &STotal);
@@ -95,7 +100,7 @@
     if (b_SFree)
         o_SFree = sscanf(b_SFree + strlen("SwapFree"), ": %lu", &SFree);
 
-    MFree += MCached;
+    MFree = MFree + MCached + MBuffers;
     MUsed = MTotal - MFree;
     SUsed = STotal - SFree;
     *mem = MUsed * 100 / MTotal;