[Pkg-wmaker-commits] [wmbubble] 38/207: Remove support for reading memory stats on linux 2.4; add support for 3.0

Doug Torrance dtorrance-guest at moszumanska.debian.org
Mon Aug 24 04:17:58 UTC 2015


This is an automated email from the git hooks/post-receive script.

dtorrance-guest pushed a commit to branch master
in repository wmbubble.

commit 7888f5cc9e7c4bfab77546248807c7f0c315d2ce
Author: Robert Jacobs <rnjacobs at mit.edu>
Date:   Fri Jul 29 13:51:04 2011 -0700

    Remove support for reading memory stats on linux 2.4; add support for 3.0
---
 bubblemon.c |  4 ++--
 sys_linux.c | 59 -----------------------------------------------------------
 2 files changed, 2 insertions(+), 61 deletions(-)

diff --git a/bubblemon.c b/bubblemon.c
index 6b610a0..439caa2 100644
--- a/bubblemon.c
+++ b/bubblemon.c
@@ -110,7 +110,7 @@ static int animate_correctly(void);
 static void draw_duck(int x, int y, int nr, int flipx, int flipy);
 static void duck_swimmer(int posy);
 
-#if defined(__FreeBSD__) || defined(__linux__)
+#ifdef __FreeBSD__
 extern int init_stuff();	/* defined in sys_{freebsd,linux}.c */
 #endif
 /* local prototypes end *INDENT-ON* */
@@ -356,7 +356,7 @@ int main(int argc, char **argv) {
 		exit(0);
 	}
 
-#if defined(__FreeBSD__) || defined(__linux__)
+#ifdef __FreeBSD__
 	if (init_stuff())
 		exit(-1);
 #endif
diff --git a/sys_linux.c b/sys_linux.c
index 6c6e741..d3dab7a 100644
--- a/sys_linux.c
+++ b/sys_linux.c
@@ -25,37 +25,6 @@
 
 extern BubbleMonData bm;
 
-#define LINUX_2_4 1
-#define LINUX_2_6 2
-
-static unsigned char ver;
-
-int init_stuff()
-{
-    struct utsname u;
-
-    ver = 0;
-    
-    if (uname(&u) == -1) {
-	puts("Error getting kernel version: uname returned -1");
-	return 1;
-    }
-
-    if (strncmp(u.release, "2.4", 3) == 0) {
-	ver = LINUX_2_4;
-    } else if ((strncmp(u.release, "2.5", 3) == 0) ||
-	    (strncmp(u.release, "2.6", 3) == 0)) {
-	ver = LINUX_2_6;
-    }
-
-    if (!ver) {
-	/* Default to Linux 2.4 format. */
-	ver = LINUX_2_4;
-    }
-
-    return 0;
-}
-
 /* returns current CPU load in percent, 0 to 100 */
 int system_cpu(void)
 {
@@ -116,7 +85,6 @@ void system_memory(void)
 
     /* we might as well get both swap and memory at the same time.
      * sure beats opening the same file twice */
-	if (ver == LINUX_2_6) {
 	    mem = fopen("/proc/meminfo", "r");
 	    memset(shit, 0, sizeof(shit));
 	    fread(shit, 2048, 1, mem);
@@ -149,33 +117,6 @@ void system_memory(void)
 		}
 	    }
 	    fclose(mem);
-	} else if (ver == LINUX_2_4) {
-	    mem = fopen("/proc/meminfo", "r");
-	    fgets(shit, 2048, mem);
-	
-	    fscanf(mem, "%*s %Ld %Ld %Ld %Ld %Ld %Ld", &aa, &ab, &ac,
-		&ad, &ae, &af);
-	    fscanf(mem, "%*s %Ld %Ld", &ag, &ah);
-	    fclose(mem);
-
-	    /* calculate it */
-	    my_mem_max = aa;	/* memory.total; */
-	    my_swap_max = ag;	/* swap.total; */
-
-	    my_mem_used = ah + ab - af - ae;	/* swap.used + memory.used - memory.cached - memory.buffer; */
-
-	    if (my_mem_used > my_mem_max) {
-		my_swap_used = my_mem_used - my_mem_max;
-		my_mem_used = my_mem_max;
-	    } else {
-		my_swap_used = 0;
-	    }
-
-	    bm.mem_used = my_mem_used;
-	    bm.mem_max = my_mem_max;
-	    bm.swap_used = my_swap_used;
-	    bm.swap_max = my_swap_max;
-	}
 }
 
 void system_loadavg(void)

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-wmaker/wmbubble.git



More information about the Pkg-wmaker-commits mailing list