xfce4-systemload-plugin/xfce4-systemload-plugin-0.4.2-fix-wrong-free-memory-value.patch
Christoph Wickert fcb805e531 - Bring back tooltips in GTK >= 2.16 (#508637, bugzilla.xfce.org #5175)
- Fix bar colors (#505214, bugzilla.xfce.org #1889)
- Fix wrong free memory value (bugzilla.xfce.org #4215)
2009-09-09 21:00:13 +00:00

42 lines
1.6 KiB
Diff

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;