[systemd-devel] [PATCH] cgtop: useful error messages when bootup fails

Shawn Landden shawnlandden at gmail.com
Mon May 21 22:59:26 PDT 2012


cgtop quits on startup if all the cgroup mounts it expects are not ready.
Provide user with some indication of why cgtop failed.
---
 src/cgtop/cgtop.c |    6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/cgtop/cgtop.c b/src/cgtop/cgtop.c
index ddb5709..744ddc3 100644
--- a/src/cgtop/cgtop.c
+++ b/src/cgtop/cgtop.c
@@ -341,14 +341,20 @@ static int refresh(Hashmap *a, Hashmap *b, unsigned iteration) {
 
         r = refresh_one("name=systemd", "/", a, b, iteration, 0);
         if (r < 0)
+                if (r == -ENOENT)
+                    log_error("Is /sys/fs/cgroup/systemd mounted?: %s", strerror(-r));
                 return r;
 
         r = refresh_one("cpuacct", "/", a, b, iteration, 0);
         if (r < 0)
+                if (r == -ENOENT)
+                    log_error("Is /sys/fs/cgroup/cpu,cpuacct mounted?: %s", strerror(-r));
                 return r;
 
         r = refresh_one("memory", "/", a, b, iteration, 0);
         if (r < 0)
+                if (r == -ENOENT)
+                    log_error("Is /sys/fs/cgroup/memory mounted?: %s", strerror(-r));
                 return r;
 
         return refresh_one("blkio", "/", a, b, iteration, 0);
-- 
1.7.9.5



More information about the systemd-devel mailing list