summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Birchinger <joker@gentoo.org>2004-05-22 03:04:35 +0000
committerChristian Birchinger <joker@gentoo.org>2004-05-22 03:04:35 +0000
commit62ebd1c98761e8fb468666b6c2d4839d5956f6dd (patch)
tree61133f0269cf4ba1d1455be628136bb4a76f1db4 /x11-plugins/wmmon/files
parentInitial verison. (Manifest recommit) (diff)
downloadgentoo-2-62ebd1c98761e8fb468666b6c2d4839d5956f6dd.tar.gz
gentoo-2-62ebd1c98761e8fb468666b6c2d4839d5956f6dd.tar.bz2
gentoo-2-62ebd1c98761e8fb468666b6c2d4839d5956f6dd.zip
Added a patch to make memory monitoring work with kernel 2.6
Diffstat (limited to 'x11-plugins/wmmon/files')
-rw-r--r--x11-plugins/wmmon/files/digest-wmmon-1.0_beta2-r21
-rw-r--r--x11-plugins/wmmon/files/wmmon-1.0_beta2-kernel26.patch121
2 files changed, 122 insertions, 0 deletions
diff --git a/x11-plugins/wmmon/files/digest-wmmon-1.0_beta2-r2 b/x11-plugins/wmmon/files/digest-wmmon-1.0_beta2-r2
new file mode 100644
index 000000000000..aa0d5acf08e0
--- /dev/null
+++ b/x11-plugins/wmmon/files/digest-wmmon-1.0_beta2-r2
@@ -0,0 +1 @@
+MD5 1b8c780b8c24a6958c69330fef4171df wmmon-1_0b2.tar.gz 21589
diff --git a/x11-plugins/wmmon/files/wmmon-1.0_beta2-kernel26.patch b/x11-plugins/wmmon/files/wmmon-1.0_beta2-kernel26.patch
new file mode 100644
index 000000000000..3b1234b4eb1c
--- /dev/null
+++ b/x11-plugins/wmmon/files/wmmon-1.0_beta2-kernel26.patch
@@ -0,0 +1,121 @@
+diff -ruN wmmon.app.orig/wmmon/Makefile wmmon.app/wmmon/Makefile
+--- wmmon.app.orig/wmmon/Makefile 1998-05-19 23:13:16.000000000 +0200
++++ wmmon.app/wmmon/Makefile 2004-05-22 04:27:19.000000000 +0200
+@@ -5,9 +5,8 @@
+ ../wmgeneral/misc.o \
+ ../wmgeneral/list.o
+
+-
+ .c.o:
+- cc -c -O2 -Wall $< -o $*.o
++ cc -c $(CFLAGS) $(DEFINES) -Wall $< -o $*.o
+
+ wmmon: $(OBJS)
+ cc -o wmmon $^ $(LIBDIR) $(LIBS)
+diff -ruN wmmon.app.orig/wmmon/wmmon.c wmmon.app/wmmon/wmmon.c
+--- wmmon.app.orig/wmmon/wmmon.c 1998-05-19 23:13:16.000000000 +0200
++++ wmmon.app/wmmon/wmmon.c 2004-05-22 04:29:39.000000000 +0200
+@@ -187,8 +187,7 @@
+
+ void update_stat_cpu(stat_dev *);
+ void update_stat_io(stat_dev *);
+-void update_stat_mem(stat_dev *st, stat_dev *st2);
+-void update_stat_swp(stat_dev *);
++void update_stat_mem_k26(stat_dev *st, stat_dev *st2);
+
+ void wmmon_routine(int argc, char **argv) {
+
+@@ -297,8 +296,7 @@
+ update_stat_io(&stat_device[1]);
+
+ if(stat_current == 2) {
+- update_stat_mem(&stat_device[2], &stat_device[3]);
+-// update_stat_swp(&stat_device[3]);
++ update_stat_mem_k26(&stat_device[2], &stat_device[3]);
+ }
+
+ if (stat_current < 2) {
+@@ -497,47 +495,56 @@
+ st->hisaddcnt += 1;
+ }
+
+-void update_stat_mem(stat_dev *st, stat_dev *st2) {
++void update_stat_mem_k26(stat_dev *st, stat_dev *st2) {
+
+ char temp[128];
+- unsigned long free, shared, buffers, cached;
++ unsigned long free, shared, buffers, cached, swap_free;
+
+ freopen("/proc/meminfo", "r", fp_meminfo);
+ while (fgets(temp, 128, fp_meminfo)) {
+- if (strstr(temp, "Mem:")) {
+- sscanf(temp, "Mem: %ld %ld %ld %ld %ld %ld",
+- &st->rt_idle, &st->rt_stat,
+- &free, &shared, &buffers, &cached);
+- st->rt_idle >>= 10;
+- st->rt_stat -= buffers+cached;
+- st->rt_stat >>= 10;
+-// break;
++ if (strstr(temp, "MemTotal:")) {
++ sscanf(temp, "MemTotal: %ld", &st->rt_idle);
++ continue;
+ }
+- if (strstr(temp, "Swap:")) {
+- sscanf(temp, "Swap: %ld %ld", &st2->rt_idle, &st2->rt_stat);
+- st2->rt_idle >>= 10;
+- st2->rt_stat >>= 10;
+- break;
++ if (strstr(temp, "MemFree:")) {
++ sscanf(temp, "MemFree: %ld", &free);
++ continue;
++ }
++ if (strstr(temp, "Buffers:")) {
++ sscanf(temp, "Buffers: %ld", &buffers);
++ continue;
++ }
++ if (strstr(temp, "Cached:")) {
++ sscanf(temp, "Cached: %ld", &cached);
++ continue;
++ }
++
++ if (strstr(temp, "SwapTotal:")) {
++ sscanf(temp, "SwapTotal: %ld", &st2->rt_idle);
++ continue;
++ }
++ if (strstr(temp, "SwapFree:")) {
++ sscanf(temp, "SwapFree: %ld", &swap_free);
++ continue;
+ }
+ }
+-}
+
+-void update_stat_swp(stat_dev *st) {
++ // used = total - free;
++ st->rt_stat = st->rt_idle - free;
++ st2->rt_stat = st2->rt_idle - swap_free;
+
+- char temp[128];
++ // ignore shared
++ shared = 0;
+
+- fseek(fp_meminfo, 0, SEEK_SET);
+- while (fgets(temp, 128, fp_meminfo)) {
+- if (strstr(temp, "Swap:")) {
+- sscanf(temp, "Swap: %ld %ld", &st->rt_idle, &st->rt_stat);
+- st->rt_idle >>= 10;
+- st->rt_stat >>= 10;
+- break;
+- }
+- }
++ st->rt_idle >>= 10;
++ st->rt_stat -= buffers+cached;
++ st->rt_stat >>= 10;
+
++ st2->rt_idle >>= 10;
++ st2->rt_stat >>= 10;
+ }
+
++
+ /*******************************************************************************\
+ |* get_statistics *|
+ \*******************************************************************************/