]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
core/cgroup: CGRuntime.cgroup_path indicates whether the cg is still alive
authorMike Yuan <me@yhndnzj.com>
Mon, 26 May 2025 20:46:17 +0000 (22:46 +0200)
committerMike Yuan <me@yhndnzj.com>
Mon, 26 May 2025 20:51:58 +0000 (22:51 +0200)
so drop redundant checks in attr getters. Memory and IO accounting
functions already follow this pattern.

src/core/cgroup.c

index ed5d0f975dded9e294eb978a420b1037c8135bc9..61ac5b6f449389a57bdc7b075fba6b3f0f5419b5 100644 (file)
@@ -3626,8 +3626,6 @@ static int unit_get_cpu_usage_raw(const Unit *u, const CGroupRuntime *crt, nsec_
         uint64_t us;
 
         r = cg_get_keyed_attribute("cpu", crt->cgroup_path, "cpu.stat", STRV_MAKE("usage_usec"), &val);
-        if (IN_SET(r, -ENOENT, -ENXIO))
-                return -ENODATA;
         if (r < 0)
                 return r;
 
@@ -4082,8 +4080,6 @@ static int unit_cgroup_freezer_kernel_state(Unit *u, FreezerState *ret) {
                         "cgroup.events",
                         STRV_MAKE("frozen"),
                         &val);
-        if (IN_SET(r, -ENOENT, -ENXIO))
-                return -ENODATA;
         if (r < 0)
                 return r;