summaryrefslogtreecommitdiff
path: root/src/cgls.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2011-03-14 23:40:41 +0100
committerLennart Poettering <lennart@poettering.net>2011-03-14 23:40:41 +0100
commit1f16b4a6c496288aa62dc2ac973f88ca6c801b5d (patch)
treebf01dca983b2e5afbb809ca3ef52e5c6e5de1d5e /src/cgls.c
parent1f73f0f163eeb8a889e3799c0c63bcb437e531ac (diff)
cgls: by default start with group of PID 1
Diffstat (limited to 'src/cgls.c')
-rw-r--r--src/cgls.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/cgls.c b/src/cgls.c
index 93617ddc2f..6f083015ed 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);
}