summaryrefslogtreecommitdiff
path: root/src/shared/cgroup-util.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2014-02-17 02:06:32 +0100
committerLennart Poettering <lennart@poettering.net>2014-02-17 15:49:21 +0100
commit03b90d4bade317c601bc22ccc700396ca6ba5a8e (patch)
tree558bcb521e25a5b26554be828d9c0be29a06ae41 /src/shared/cgroup-util.c
parent6d2357247b198314d972932415d65a42f83a9b6e (diff)
core: find the closest parent slice that has a specfic cgroup controller enabled when enabling/disabling cgroup controllers for units
Diffstat (limited to 'src/shared/cgroup-util.c')
-rw-r--r--src/shared/cgroup-util.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/shared/cgroup-util.c b/src/shared/cgroup-util.c
index 9692a07f56..1aa81c2cd1 100644
--- a/src/shared/cgroup-util.c
+++ b/src/shared/cgroup-util.c
@@ -1668,7 +1668,7 @@ int cg_attach_many_everywhere(CGroupControllerMask supported, const char *path,
return r;
}
-int cg_migrate_everywhere(CGroupControllerMask supported, const char *from, const char *to) {
+int cg_migrate_everywhere(CGroupControllerMask supported, const char *from, const char *to, cg_migrate_callback_t to_callback, void *userdata) {
CGroupControllerMask bit = 1;
const char *n;
int r;
@@ -1680,8 +1680,17 @@ int cg_migrate_everywhere(CGroupControllerMask supported, const char *from, cons
}
NULSTR_FOREACH(n, mask_names) {
- if (supported & bit)
- cg_migrate_recursive_fallback(SYSTEMD_CGROUP_CONTROLLER, to, n, to, false, false);
+ if (supported & bit) {
+ const char *p = NULL;
+
+ if (to_callback)
+ p = to_callback(bit, userdata);
+
+ if (!p)
+ p = to;
+
+ cg_migrate_recursive_fallback(SYSTEMD_CGROUP_CONTROLLER, to, n, p, false, false);
+ }
bit <<= 1;
}