]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
cgroup-util: remove now unused cg_kernel_controllers()
authorMike Yuan <me@yhndnzj.com>
Sun, 16 Mar 2025 17:48:21 +0000 (18:48 +0100)
committerMike Yuan <me@yhndnzj.com>
Fri, 4 Apr 2025 12:36:14 +0000 (14:36 +0200)
src/basic/cgroup-util.c
src/basic/cgroup-util.h

index 0a46fba94577b56db5369ac42851a8c745d480d6..5d5635cbf98857f1d2be33ad25bfa104056ad6a9 100644 (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
index a6aa9337ad0332b52f4825231b0c5b48c845a90b..26a4fb5633babdc823832d96518df47118ebe7bd 100644 (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);