diff options
author | Sven Eden <yamakuzure@gmx.net> | 2018-06-20 19:13:05 +0200 |
---|---|---|
committer | Sven Eden <yamakuzure@gmx.net> | 2018-06-29 07:12:51 +0200 |
commit | f0a7917bc8ea0ba859e10093517e33f2bad78f10 (patch) | |
tree | 68dce7b70d5577a3f533a6119b8775701279055c /src/basic/cgroup-util.c | |
parent | 4f703de664738f58bc92834f2cd75234254eb07f (diff) |
Fix cgroup directory mounting:
A little misunderstanding has been fixed, and elogind now mounts the following
directories, if (and only if) it has to act as its own cgroups controller.
* -Ddefault-hierarchy=legacy : /sys/fs/cgroup as tmpfs
/sys/fs/cgroup/elogind as cgroup
* -Ddefault-hierarchy=hybrid : The same as with 'legacy', plus
/sys/fs/cgroup/unified as cgroup2
* -Ddefault-hierarchy=unified : /sys/fs/cgroup2 as cgroup2
Diffstat (limited to 'src/basic/cgroup-util.c')
-rw-r--r-- | src/basic/cgroup-util.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/basic/cgroup-util.c b/src/basic/cgroup-util.c index fa9275043..4fc542cc8 100644 --- a/src/basic/cgroup-util.c +++ b/src/basic/cgroup-util.c @@ -2740,8 +2740,10 @@ int cg_enable_everywhere(CGroupMask supported, CGroupMask mask, const char *p) { bool cg_is_unified_wanted(void) { static thread_local int wanted = -1; +#if 0 /// UNNEEDED by elogind int r; bool b; +#endif // 0 const bool is_default = DEFAULT_HIERARCHY == CGROUP_UNIFIED_ALL; /* If we have a cached value, return that. */ @@ -2757,9 +2759,11 @@ bool cg_is_unified_wanted(void) { /* Otherwise, let's see what the kernel command line has to say. * Since checking is expensive, cache a non-error result. */ r = proc_cmdline_get_bool("systemd.unified_cgroup_hierarchy", &b); -#endif // 0 return (wanted = r > 0 ? b : is_default); +#else + return is_default; +#endif // 0 } bool cg_is_legacy_wanted(void) { @@ -2781,8 +2785,10 @@ bool cg_is_legacy_wanted(void) { bool cg_is_hybrid_wanted(void) { static thread_local int wanted = -1; +#if 0 /// UNNEEDED by elogind int r; bool b; +#endif // 0 const bool is_default = DEFAULT_HIERARCHY >= CGROUP_UNIFIED_SYSTEMD; /* We default to true if the default is "hybrid", obviously, * but also when the default is "unified", because if we get @@ -2802,11 +2808,13 @@ bool cg_is_hybrid_wanted(void) { /* Otherwise, let's see what the kernel command line has to say. * Since checking is expensive, cache a non-error result. */ r = proc_cmdline_get_bool("systemd.legacy_systemd_cgroup_controller", &b); -#endif // 0 /* The meaning of the kernel option is reversed wrt. to the return value * of this function, hence the negation. */ return (wanted = r > 0 ? !b : is_default); +#else + return is_default; +#endif // 0 } #if 0 /// UNNEEDED by elogind |