cgroup-util: remove now unused cg_kernel_controllers()

This commit is contained in:
Mike Yuan
2025-03-16 18:48:21 +01:00
parent b26a994fb8
commit 2a010ef8fd
2 changed files with 0 additions and 55 deletions

View File

@@ -2078,59 +2078,6 @@ int cg_mask_supported(CGroupMask *ret) {
return cg_mask_supported_subtree(root, ret);
}
int cg_kernel_controllers(Set **ret) {
_cleanup_set_free_ Set *controllers = NULL;
_cleanup_fclose_ FILE *f = NULL;
int r;
assert(ret);
/* Determines the full list of kernel-known controllers. Might include controllers we don't actually support
* and controllers that aren't currently accessible (because not mounted). This does not include "name="
* pseudo-controllers. */
r = fopen_unlocked("/proc/cgroups", "re", &f);
if (r == -ENOENT) {
*ret = NULL;
return 0;
}
if (r < 0)
return r;
/* Ignore the header line */
(void) read_line(f, SIZE_MAX, NULL);
for (;;) {
_cleanup_free_ char *controller = NULL;
int enabled = 0;
if (fscanf(f, "%ms %*i %*i %i", &controller, &enabled) != 2) {
if (ferror(f))
return -errno;
if (feof(f))
break;
return -EBADMSG;
}
if (!enabled)
continue;
if (!cg_controller_is_valid(controller))
return -EBADMSG;
r = set_ensure_consume(&controllers, &string_hash_ops_free, TAKE_PTR(controller));
if (r < 0)
return r;
}
*ret = TAKE_PTR(controllers);
return 0;
}
/* The hybrid mode was initially implemented in v232 and simply mounted cgroup2 on
* /sys/fs/cgroup/systemd. This unfortunately broke other tools (such as docker) which expected the v1
* "name=systemd" hierarchy on /sys/fs/cgroup/systemd. From v233 and on, the hybrid mode mounts v2 on

View File

@@ -311,8 +311,6 @@ int cg_mask_supported_subtree(const char *root, CGroupMask *ret);
int cg_mask_from_string(const char *s, CGroupMask *ret);
int cg_mask_to_string(CGroupMask mask, char **ret);
int cg_kernel_controllers(Set **controllers);
bool cg_ns_supported(void);
bool cg_freezer_supported(void);
bool cg_kill_supported(void);