chiark / gitweb /
cgtop: work even if not all cgroups are available
authorShawn Landden <shawnlandden@gmail.com>
Tue, 22 May 2012 05:54:41 +0000 (22:54 -0700)
committerLennart Poettering <lennart@poettering.net>
Tue, 29 May 2012 19:59:10 +0000 (21:59 +0200)
cgtop quits on startup if all the cgroup mounts it expects are not available.
Just continue without nonexistant ones.

src/cgtop/cgtop.c

index ddb5709..f988adb 100644 (file)
@@ -341,17 +341,22 @@ static int refresh(Hashmap *a, Hashmap *b, unsigned iteration) {
 
         r = refresh_one("name=systemd", "/", a, b, iteration, 0);
         if (r < 0)
-                return r;
-
+                if (r != -ENOENT)
+                    return r;
         r = refresh_one("cpuacct", "/", a, b, iteration, 0);
         if (r < 0)
-                return r;
-
+                if (r != -ENOENT)
+                    return r;
         r = refresh_one("memory", "/", a, b, iteration, 0);
         if (r < 0)
-                return r;
+                if (r != -ENOENT)
+                    return r;
 
-        return refresh_one("blkio", "/", a, b, iteration, 0);
+        r = refresh_one("blkio", "/", a, b, iteration, 0);
+        if (r < 0)
+                if (r != -ENOENT)
+                    return r;
+        return 0;
 }
 
 static int group_compare(const void*a, const void *b) {