cgroup-util: drop cg_freezer_supported(), assume supported

This commit is contained in:
Mike Yuan
2025-04-21 16:29:40 +02:00
parent 399a358a38
commit 3c86a935ad
4 changed files with 1 additions and 21 deletions
-16
View File
@@ -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;
-1
View File
@@ -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);
-3
View File
@@ -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);
+1 -1
View File
@@ -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)