summaryrefslogtreecommitdiffstats
path: root/src/shared
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2023-10-05 10:28:22 +0200
committerLennart Poettering <lennart@poettering.net>2023-10-05 11:11:04 +0200
commitbd1791b597e9e43cfc55441d67952854f68c3d4b (patch)
treea47236a4e0117480922990d00cddc595e69fee85 /src/shared
parentsd-boot: introduce and use efivar_unset() (diff)
downloadsystemd-bd1791b597e9e43cfc55441d67952854f68c3d4b.tar.xz
systemd-bd1791b597e9e43cfc55441d67952854f68c3d4b.zip
cgroup-util: drop "controller" argument from various cgroup helper calls
systemd's own cgroup hierarchy is special to us, we use it to actually manage processes. Because of that many calls tha apply to cgroups are only ever called with the SYSTEMD_CGROUP_CONTROLLER as controller argument. Let's hence remove the argument altogether. This in particular touches the kill and xattr routines. This changes no behaviour, we just drop an argument that is always set to the same value anyway. This is preparation to eventually getting rid of the cgroupvs1, because on cgroupvs2 the cgroup paths do not change for different controllers, there's only a single hierarchy there.
Diffstat (limited to 'src/shared')
-rw-r--r--src/shared/cgroup-setup.c2
-rw-r--r--src/shared/killall.c6
2 files changed, 3 insertions, 5 deletions
diff --git a/src/shared/cgroup-setup.c b/src/shared/cgroup-setup.c
index c35fd460bd..fac2e08afc 100644
--- a/src/shared/cgroup-setup.c
+++ b/src/shared/cgroup-setup.c
@@ -352,7 +352,7 @@ int cg_attach(const char *controller, const char *path, pid_t pid) {
xsprintf(c, PID_FMT "\n", pid);
r = write_string_file(fs, c, WRITE_STRING_FILE_DISABLE_BUFFER);
- if (r == -EOPNOTSUPP && cg_is_threaded(controller, path) > 0)
+ if (r == -EOPNOTSUPP && cg_is_threaded(path) > 0)
/* When the threaded mode is used, we cannot read/write the file. Let's return recognizable error. */
return -EUCLEAN;
if (r < 0)
diff --git a/src/shared/killall.c b/src/shared/killall.c
index 66acba5b09..1011cd83d3 100644
--- a/src/shared/killall.c
+++ b/src/shared/killall.c
@@ -56,12 +56,10 @@ static bool is_survivor_cgroup(pid_t pid) {
return false;
}
- r = cg_get_xattr_bool(SYSTEMD_CGROUP_CONTROLLER, cgroup_path, "user.survive_final_kill_signal");
+ r = cg_get_xattr_bool(cgroup_path, "user.survive_final_kill_signal");
/* user xattr support was added to kernel v5.7, try with the trusted namespace as a fallback */
if (ERRNO_IS_NEG_XATTR_ABSENT(r))
- r = cg_get_xattr_bool(SYSTEMD_CGROUP_CONTROLLER,
- cgroup_path,
- "trusted.survive_final_kill_signal");
+ r = cg_get_xattr_bool(cgroup_path, "trusted.survive_final_kill_signal");
if (r < 0)
log_debug_errno(r,
"Failed to get survive_final_kill_signal xattr of %s, ignoring: %m",