diff options
author | Lennart Poettering <lennart@poettering.net> | 2013-04-16 04:36:06 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2013-04-16 04:41:21 +0200 |
commit | 7027ff61a34a12487712b382a061c654acc3a679 (patch) | |
tree | 05e9374a566d6accdd962dd4dc6d7076b9304122 /src/login/logind.c | |
parent | cec4ead904978b07db2154c618eeb48d3102da66 (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/login/logind.c')
-rw-r--r-- | src/login/logind.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/src/login/logind.c b/src/login/logind.c index aa3e5f0914..caed149ad6 100644 --- a/src/login/logind.c +++ b/src/login/logind.c @@ -1100,21 +1100,18 @@ int manager_get_user_by_cgroup(Manager *m, const char *cgroup, User **user) { } int manager_get_session_by_pid(Manager *m, pid_t pid, Session **session) { - char *p; + _cleanup_free_ char *p = NULL; int r; assert(m); assert(pid >= 1); assert(session); - r = cg_get_by_pid(SYSTEMD_CGROUP_CONTROLLER, pid, &p); + r = cg_pid_get_path(SYSTEMD_CGROUP_CONTROLLER, pid, &p); if (r < 0) return r; - r = manager_get_session_by_cgroup(m, p, session); - free(p); - - return r; + return manager_get_session_by_cgroup(m, p, session); } void manager_cgroup_notify_empty(Manager *m, const char *cgroup) { |