]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
shared/condition: remove cgroup hierarchy check
authorMike Yuan <me@yhndnzj.com>
Fri, 11 Apr 2025 23:16:34 +0000 (01:16 +0200)
committerMike Yuan <me@yhndnzj.com>
Sun, 13 Apr 2025 16:09:04 +0000 (18:09 +0200)
src/shared/condition.c

index e6481c46417124c5ad3d4f3e9941874e86f3b959..cc9a65d2674cf6353a35f28a6bc58b95bd6e2f47 100644 (file)
@@ -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");