summaryrefslogtreecommitdiff
path: root/src/cgls/cgls.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2013-04-16 04:36:06 +0200
committerLennart Poettering <lennart@poettering.net>2013-04-16 04:41:21 +0200
commit7027ff61a34a12487712b382a061c654acc3a679 (patch)
tree05e9374a566d6accdd962dd4dc6d7076b9304122 /src/cgls/cgls.c
parentcec4ead904978b07db2154c618eeb48d3102da66 (diff)
nspawn: introduce the new /machine/ tree in the cgroup tree and move containers there
Containers will now carry a label (normally derived from the root directory name, but configurable by the user), and the container's root cgroup is /machine/<label>. This label is called "machine name", and can cover both containers and VMs (as soon as libvirt also makes use of /machine/). libsystemd-login can be used to query the machine name from a process. This patch also includes numerous clean-ups for the cgroup code.
Diffstat (limited to 'src/cgls/cgls.c')
-rw-r--r--src/cgls/cgls.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/src/cgls/cgls.c b/src/cgls/cgls.c
index e649b75df6..e01a7b13a1 100644
--- a/src/cgls/cgls.c
+++ b/src/cgls/cgls.c
@@ -171,19 +171,14 @@ int main(int argc, char *argv[]) {
arg_kernel_threads, output_flags);
} else {
char _cleanup_free_ *root = NULL;
- const char *t = NULL;
- r = cg_get_by_pid(SYSTEMD_CGROUP_CONTROLLER, 1, &root);
- if (r < 0)
- t = "/";
- else {
- if (endswith(root, "/system"))
- root[strlen(root)-7] = 0;
-
- t = root[0] ? root : "/";
+ r = cg_get_root_path(&root);
+ if (r < 0) {
+ log_error("Failed to get root path: %s", strerror(-r));
+ goto finish;
}
- r = show_cgroup(SYSTEMD_CGROUP_CONTROLLER, t, NULL, 0,
+ r = show_cgroup(SYSTEMD_CGROUP_CONTROLLER, root, NULL, 0,
arg_kernel_threads, output_flags);
}
}