Репозиторий Sisyphus
Последнее обновление: 1 октября 2023 | Пакетов: 18631 | Посещений: 37858639
en ru br
Репозитории ALT
5.1: 0.98p2-alt5
4.1: 0.98p2-alt5
4.0: 0.98p2-alt5
3.0: 0.98p2-alt3
www.altlinux.org/Changes

Группа :: Графические оболочки/Window Maker
Пакет: wmcube-gdk

 Главная   Изменения   Спек   Патчи   Sources   Загрузить   Gear   Bugs and FR  Repocop 

Патч: wmcube-gdk-0.98p2-alt-linux26.patch
Скачать


 wmcube.c |   29 +++++++++++++++++++++++------
 1 files changed, 23 insertions(+), 6 deletions(-)
diff --git a/wmcube.c b/wmcube.c
index dcc09c6..f8a8fe8 100644
--- a/wmcube.c
+++ b/wmcube.c
@@ -167,6 +167,7 @@ int show_load = 1;
 int use_nice = 1;
 int which_cpu = -1;
 int planesORlines = 1;
+int is_linux26 = 0;
 char *pname;
 
 float lum_vector[3] = { 0, 0, 100 };	/* Lightsource vector */
@@ -1397,6 +1398,7 @@ int init_calc_cpu()
     int i;
     char cpuid[6];
     char check_cpu[6];
+    unsigned long long softirq;
 
     sprintf(check_cpu, "cpu%d", which_cpu);
 
@@ -1405,12 +1407,18 @@ int init_calc_cpu()
 	return -1;
     }
 
-    if (which_cpu == -1)
+    is_linux26 = fscanf(fp, "%*s  %*u %*u %*u %*u %*u %*u %llu", &softirq);
+    rewind(fp);
+
+    if (which_cpu == -1) {
+        fclose(fp);
 	return 0;
+    }
 
     for (i = -2; i < which_cpu; i++) {
 	fscanf(fp, "%s", cpuid);
     }
+    fclose(fp);
 
     if (strcmp(check_cpu, cpuid) != 0) {
 	fprintf(stderr, "ERROR: could not read cpu-load on %s. Are you "
@@ -1422,22 +1430,31 @@ int init_calc_cpu()
 
 int calc_cpu_total()
 {
-    int total, used, t = 0, i;
-    static int previous_total = 0, previous_used = 0;
+    unsigned long long total, used;
+    int t = 0, i;
+    static unsigned long long previous_total = 0, previous_used = 0;
     char cpuid[6];
-    int cpu, nice, system, idle;
+    unsigned long long cpu, nice, system, idle, iowait, irq, softirq;
     FILE *fp;
 
     fp = fopen("/proc/stat", "rt");
 
     for (i = -2; i < which_cpu; i++) {
-	fscanf(fp, "%s %d %d %d %d", cpuid, &cpu, &nice, &system, &idle);
+        if(is_linux26) {
+	    fscanf(fp, "%s %llu %llu %llu %llu %llu %llu %llu",
+		   cpuid, &cpu, &nice, &system, &idle, &iowait, &irq, &softirq);
+	} else {
+	    fscanf(fp, "%s %llu %llu %llu %llu", cpuid, &cpu, &nice, &system, &idle);
+	}
     }
 
     fclose(fp);
 
     used = cpu + system + use_nice * nice;
-    total = used + idle + (1 - use_nice) * nice;
+    total = cpu + system + idle + nice;
+    if(is_linux26) {
+        total += iowait + irq + softirq;
+    }
 
     t = 100 * (double) (used - previous_used) / (double) (total -
 							  previous_total);
 
дизайн и разработка: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
текущий майнтейнер: Michael Shigorin