shared/cgroup-setup: introduce cg_is_legacy_force_enabled

This commit is contained in:
Mike Yuan
2024-02-27 23:08:59 +08:00
parent fbc8d90bd5
commit f4f3efa4d7
2 changed files with 17 additions and 0 deletions
+16
View File
@@ -154,6 +154,22 @@ bool cg_is_hybrid_wanted(void) {
return (wanted = r > 0 ? !b : is_default);
}
bool cg_is_legacy_force_enabled(void) {
bool force;
if (!cg_is_legacy_wanted())
return false;
/* If in container, we have to follow host's cgroup hierarchy. */
if (detect_container() > 0)
return true;
if (proc_cmdline_get_bool("SYSTEMD_CGROUP_ENABLE_LEGACY_FORCE", /* flags = */ 0, &force) < 0)
return false;
return force;
}
int cg_weight_parse(const char *s, uint64_t *ret) {
uint64_t u;
int r;
+1
View File
@@ -10,6 +10,7 @@
bool cg_is_unified_wanted(void);
bool cg_is_legacy_wanted(void);
bool cg_is_hybrid_wanted(void);
bool cg_is_legacy_force_enabled(void);
int cg_weight_parse(const char *s, uint64_t *ret);
int cg_cpu_weight_parse(const char *s, uint64_t *ret);