From: Mike Yuan Date: Wed, 15 Jan 2025 21:05:56 +0000 (+0100) Subject: cgroup-util: drop cg_freezer_supported(), assume supported X-Git-Tag: v258-rc1~768^2~3 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=3c86a935ad2f88a83f1f465544cb0c8bdc288f4c;p=thirdparty%2Fsystemd.git cgroup-util: drop cg_freezer_supported(), assume supported --- diff --git a/src/basic/cgroup-util.c b/src/basic/cgroup-util.c index 4baadf0c6bf..a117dfcbf7e 100644 --- a/src/basic/cgroup-util.c +++ b/src/basic/cgroup-util.c @@ -254,22 +254,6 @@ bool cg_ns_supported(void) { return (supported = false); } -bool cg_freezer_supported(void) { - static thread_local int supported = -1; - - if (supported >= 0) - return supported; - - if (cg_all_unified() <= 0) - return (supported = false); - - if (access("/sys/fs/cgroup/init.scope/cgroup.freeze", F_OK) >= 0) - return (supported = true); - if (errno != ENOENT) - log_debug_errno(errno, "Failed to check whether cgroup freezer is available, assuming not: %m"); - return (supported = false); -} - bool cg_kill_supported(void) { static thread_local int supported = -1; diff --git a/src/basic/cgroup-util.h b/src/basic/cgroup-util.h index 26a4fb5633b..0fb6b7677d2 100644 --- a/src/basic/cgroup-util.h +++ b/src/basic/cgroup-util.h @@ -312,7 +312,6 @@ int cg_mask_from_string(const char *s, CGroupMask *ret); int cg_mask_to_string(CGroupMask mask, char **ret); bool cg_ns_supported(void); -bool cg_freezer_supported(void); bool cg_kill_supported(void); int cg_all_unified(void); diff --git a/src/core/cgroup.c b/src/core/cgroup.c index 30929ef5ebc..f2f313bc003 100644 --- a/src/core/cgroup.c +++ b/src/core/cgroup.c @@ -4386,9 +4386,6 @@ int unit_cgroup_freezer_action(Unit *u, FreezerAction action) { assert(action >= 0); assert(action < _FREEZER_ACTION_MAX); - if (!cg_freezer_supported()) - return 0; - unit_next_freezer_state(u, action, &next, &objective); CGroupRuntime *crt = unit_get_cgroup_runtime(u); diff --git a/src/core/unit.c b/src/core/unit.c index 75d5921faa4..65ca8ddcfb5 100644 --- a/src/core/unit.c +++ b/src/core/unit.c @@ -6296,7 +6296,7 @@ int unit_freezer_action(Unit *u, FreezerAction action) { assert(u); assert(IN_SET(action, FREEZER_FREEZE, FREEZER_THAW)); - if (!cg_freezer_supported() || !unit_can_freeze(u)) + if (!unit_can_freeze(u)) return -EOPNOTSUPP; if (u->job)