summaryrefslogtreecommitdiff
path: root/src/core/cgroup.c
diff options
context:
space:
mode:
authorSven Eden <yamakuzure@gmx.net>2017-03-10 08:33:22 +0100
committerSven Eden <yamakuzure@gmx.net>2017-03-14 10:23:22 +0100
commit34c7fcb14d705141c71b5b63a2f044a51ffbd92b (patch)
tree6e54cf6831207e49b9199e5d34e9384f8133a865 /src/core/cgroup.c
parent6156b4779584b4bf1dc973ce988a34a1bcae1db3 (diff)
Add mounting of a name=elogind cgroup if no init controller is found.
This is done for systems, which init systems are no cgroup controllers. One example is runit on Void Linux.
Diffstat (limited to 'src/core/cgroup.c')
-rw-r--r--src/core/cgroup.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/core/cgroup.c b/src/core/cgroup.c
index c0bfecbe8..567fe2d4d 100644
--- a/src/core/cgroup.c
+++ b/src/core/cgroup.c
@@ -1229,6 +1229,7 @@ int manager_setup_cgroup(Manager *m) {
r = cg_pid_get_path(ELOGIND_CGROUP_CONTROLLER, 0, &m->cgroup_root);
if (r < 0)
return log_error_errno(r, "Cannot determine cgroup we are running in: %m");
+
/// elogind does not support systemd scopes and slices
#if 0
/* Chop off the init scope, if we are already located in it */
@@ -1320,7 +1321,10 @@ int manager_setup_cgroup(Manager *m) {
scope_path = strjoina(m->cgroup_root, "/" SPECIAL_INIT_SCOPE);
r = cg_create_and_attach(ELOGIND_CGROUP_CONTROLLER, scope_path, 0);
#else
- if (streq(m->cgroup_root, "/elogind"))
+ if (streq(ELOGIND_CGROUP_CONTROLLER, "name=elogind"))
+ // we are our own cgroup controller
+ scope_path = strjoina("");
+ else if (streq(m->cgroup_root, "/elogind"))
// root already is our cgroup
scope_path = strjoina(m->cgroup_root);
else