]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
cgroup-util: remove now unused cg_read_event() 37624/head
authorMike Yuan <me@yhndnzj.com>
Mon, 26 May 2025 20:32:12 +0000 (22:32 +0200)
committerMike Yuan <me@yhndnzj.com>
Mon, 26 May 2025 20:59:48 +0000 (22:59 +0200)
cg_get_keyed_attribute() is a more generic version of this,
and cg_is_empty_recursive() was the only user of this function,
which got converted in the previous commit.

src/basic/cgroup-util.c
src/basic/cgroup-util.h

index 02398d074ad7d53cbc92373c4b595b2e7847e81b..4ceec690ab61dd260ab526bca5beb833f8617638 100644 (file)
@@ -198,47 +198,6 @@ int cg_read_pidref(FILE *f, PidRef *ret, CGroupFlags flags) {
         }
 }
 
-int cg_read_event(
-                const char *controller,
-                const char *path,
-                const char *event,
-                char **ret) {
-
-        _cleanup_free_ char *events = NULL, *content = NULL;
-        int r;
-
-        r = cg_get_path(controller, path, "cgroup.events", &events);
-        if (r < 0)
-                return r;
-
-        r = read_full_virtual_file(events, &content, NULL);
-        if (r < 0)
-                return r;
-
-        for (const char *p = content;;) {
-                _cleanup_free_ char *line = NULL, *key = NULL;
-                const char *q;
-
-                r = extract_first_word(&p, &line, "\n", 0);
-                if (r < 0)
-                        return r;
-                if (r == 0)
-                        return -ENOENT;
-
-                q = line;
-                r = extract_first_word(&q, &key, " ", 0);
-                if (r < 0)
-                        return r;
-                if (r == 0)
-                        return -EINVAL;
-
-                if (!streq(key, event))
-                        continue;
-
-                return strdup_to(ret, q);
-        }
-}
-
 bool cg_kill_supported(void) {
         static thread_local int supported = -1;
 
index 9f02e65410ae9fa0a562e65c15ddb7547b8bb5ac..27778dabedbb178792f17320dc81089c02d7d622 100644 (file)
@@ -188,7 +188,6 @@ typedef enum CGroupFlags {
 int cg_enumerate_processes(const char *controller, const char *path, FILE **ret);
 int cg_read_pid(FILE *f, pid_t *ret, CGroupFlags flags);
 int cg_read_pidref(FILE *f, PidRef *ret, CGroupFlags flags);
-int cg_read_event(const char *controller, const char *path, const char *event, char **ret);
 
 int cg_enumerate_subgroups(const char *controller, const char *path, DIR **ret);
 int cg_read_subgroup(DIR *d, char **ret);