]> err.no Git - systemd/commitdiff
cgls: by default start with group of PID 1
authorLennart Poettering <lennart@poettering.net>
Mon, 14 Mar 2011 22:40:41 +0000 (23:40 +0100)
committerLennart Poettering <lennart@poettering.net>
Mon, 14 Mar 2011 22:40:41 +0000 (23:40 +0100)
src/cgls.c

index 93617ddc2fa6b77ad0df97c2bea4e57b1da416b1..6f083015edee6f83cd38019254037d1c23a65188 100644 (file)
@@ -106,8 +106,18 @@ int main(int argc, char *argv[]) {
                 if (path_startswith(p, "/sys/fs/cgroup")) {
                         printf("Working Directory %s:\n", p);
                         r = show_cgroup_by_path(p, NULL, 0);
-                } else
-                        r = show_cgroup(SYSTEMD_CGROUP_CONTROLLER, "/", NULL, 0);
+                } else {
+                        char *root = NULL;
+                        const char *t = NULL;
+
+                        if ((r = cg_get_by_pid(SYSTEMD_CGROUP_CONTROLLER, 1, &root)) < 0)
+                                t = "/";
+                        else
+                                t = root;
+
+                        r = show_cgroup(SYSTEMD_CGROUP_CONTROLLER, t, NULL, 0);
+                        free(root);
+                }
 
                 free(p);
         }