From: Lennart Poettering Date: Mon, 14 Mar 2011 22:40:41 +0000 (+0100) Subject: cgls: by default start with group of PID 1 X-Git-Tag: v21~81 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1f16b4a6c496288aa62dc2ac973f88ca6c801b5d;p=systemd cgls: by default start with group of PID 1 --- diff --git a/src/cgls.c b/src/cgls.c index 93617ddc..6f083015 100644 --- a/src/cgls.c +++ b/src/cgls.c @@ -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); }