From: Mike Yuan Date: Fri, 11 Apr 2025 23:16:34 +0000 (+0200) Subject: shared/condition: remove cgroup hierarchy check X-Git-Tag: v258-rc1~826^2~1 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=f74ca66e6833c340a1532578176e55cb494590d0;p=thirdparty%2Fsystemd.git shared/condition: remove cgroup hierarchy check --- diff --git a/src/shared/condition.c b/src/shared/condition.c index e6481c46417..cc9a65d2674 100644 --- a/src/shared/condition.c +++ b/src/shared/condition.c @@ -411,21 +411,17 @@ static int condition_test_user(Condition *c, char **env) { } static int condition_test_control_group_controller(Condition *c, char **env) { + CGroupMask system_mask, wanted_mask; int r; - CGroupMask system_mask, wanted_mask = 0; assert(c); assert(c->parameter); assert(c->type == CONDITION_CONTROL_GROUP_CONTROLLER); if (streq(c->parameter, "v2")) - return cg_all_unified(); - if (streq(c->parameter, "v1")) { - r = cg_all_unified(); - if (r < 0) - return r; - return !r; - } + return true; + if (streq(c->parameter, "v1")) + return false; r = cg_mask_supported(&system_mask); if (r < 0) @@ -437,7 +433,7 @@ static int condition_test_control_group_controller(Condition *c, char **env) { * mixed in with valid ones -- these are only assessed on the * validity of the valid controllers found. */ log_debug("Failed to parse cgroup string: %s", c->parameter); - return 1; + return true; } return FLAGS_SET(system_mask, wanted_mask); @@ -1085,14 +1081,6 @@ static int condition_test_psi(Condition *c, char **env) { if (!slice) return log_debug_errno(SYNTHETIC_ERRNO(EINVAL), "Failed to parse condition parameter %s.", c->parameter); - r = cg_all_unified(); - if (r < 0) - return log_debug_errno(r, "Failed to determine whether the unified cgroups hierarchy is used: %m"); - if (r == 0) { - log_debug("PSI condition check requires the unified cgroups hierarchy, skipping."); - return 1; - } - r = cg_mask_supported(&mask); if (r < 0) return log_debug_errno(r, "Failed to get supported cgroup controllers: %m");