summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEvgeny Vereshchagin <evvers@ya.ru>2015-09-18 17:58:28 +0000
committerEvgeny Vereshchagin <evvers@ya.ru>2015-09-18 18:14:38 +0000
commit58033c91e3780e7db25c744e94928c554d5ceed3 (patch)
tree52035e7a44fd47254b4d5291769fef1b8046f22e
parent2b2eac39e889bdbcc6cbf44443f7682b3ac502f7 (diff)
cgls: show controller without args too
-rw-r--r--src/cgls/cgls.c16
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);
}