patches/gnome-applets-03-make-multiload-network-available.diff
author yippi
Mon, 27 Sep 2010 21:07:51 +0000
changeset 20108 51df67ca9307
parent 8937 580bdff6b114
permissions -rw-r--r--
I had these modules listed as being owned by me, but they are really owned by wangke, correcting.

--- gnome-applets-2.17.1/multiload/linux-proc.c	2006-12-31 10:07:39.000000000 +0800
+++ gnome-applets-2.17.1.mod/multiload/linux-proc.c	2007-01-09 19:15:24.881474000 +0800
@@ -115,6 +115,13 @@ GetDiskLoad (int Maximum, int data [3], 
 
 	read = write = 0;
 
+
+        /*
+          At the moment, Solaris can't get the read/write information for filesystem
+          so we would like to use disk to get them, later when some unstable interfaces
+          become statble or public, will use them
+        */
+        /*
 	mountentries = glibtop_get_mountlist (&mountlist, FALSE);
 
 	for (i = 0; i < mountlist.number; i++)
@@ -131,6 +138,10 @@ GetDiskLoad (int Maximum, int data [3], 
 	}
 
 	g_free(mountentries);
+        */
+        glibtop_fsusage fsusage;
+        glibtop_get_fsusage(&fsusage,"/"); /* "/" will not use, just as a input */
+        read = fsusage.read; write = fsusage.write;
 
 	readdiff  = read - lastread;
 	writediff = write - lastwrite;
@@ -300,7 +311,7 @@ GetNet (int Maximum, int data [5], LoadG
 	autoscaler_init(&scaler, 60, 501);
     }
 
-
+    netlist.flags = 1;
     devices = glibtop_get_netlist(&netlist);
 
     for(i = 0; i < netlist.number; ++i)
@@ -310,7 +321,12 @@ GetNet (int Maximum, int data [5], LoadG
 
 	glibtop_get_netload(&netload, devices[i]);
 
-	g_return_if_fail((netload.flags & needed_netload_flags) == needed_netload_flags);
+        /* this is not correct, because after run get netlist, there are lots of net devices,
+           not all of them meet the requirement of needed_netload_flags, but we don't need to
+           exit, we can just ignore them, and try to continue with the next one */
+        if ((netload.flags & needed_netload_flags) != needed_netload_flags)
+            continue;
+
 
 	if (!(netload.if_flags & (1L << GLIBTOP_IF_FLAGS_UP)))
 	    continue;