diff options
author | Lennart Poettering <lennart@poettering.net> | 2015-09-19 01:49:25 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2015-09-19 01:49:25 +0200 |
commit | dcc26ae383dd935afcbaa263f8db8ee5e1f03fbd (patch) | |
tree | 52035e7a44fd47254b4d5291769fef1b8046f22e /src | |
parent | 2b2eac39e889bdbcc6cbf44443f7682b3ac502f7 (diff) | |
parent | 58033c91e3780e7db25c744e94928c554d5ceed3 (diff) |
Merge pull request #1303 from evverx/show-controller
cgls: show controller without args too
Diffstat (limited to 'src')
-rw-r--r-- | src/cgls/cgls.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/src/cgls/cgls.c b/src/cgls/cgls.c index 4fb642e7b3..ec4215f741 100644 --- a/src/cgls/cgls.c +++ b/src/cgls/cgls.c @@ -165,6 +165,13 @@ static int get_cgroup_root(char **ret) { return 0; } +static void show_cg_info(const char *controller, const char *path) { + if (cg_unified() <= 0) + printf("Controller %s; ", controller); + printf("Control group %s:\n", isempty(path) ? "/" : path); + fflush(stdout); +} + int main(int argc, char *argv[]) { int r, output_flags; @@ -225,11 +232,7 @@ int main(int argc, char *argv[]) { } else path = root; - if (cg_unified() > 0) - printf("Control group %s:\n", path); - else - printf("Controller %s; control group %s:\n", controller, path); - fflush(stdout); + show_cg_info(controller, path); q = show_cgroup(controller, path, NULL, 0, arg_kernel_threads, output_flags); } @@ -266,8 +269,7 @@ int main(int argc, char *argv[]) { if (r < 0) goto finish; - printf("Control group %s:\n", isempty(root) ? "/" : root); - fflush(stdout); + show_cg_info(SYSTEMD_CGROUP_CONTROLLER, root); r = show_cgroup(SYSTEMD_CGROUP_CONTROLLER, root, NULL, 0, arg_kernel_threads, output_flags); } |