]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
basic: port various pidfd/pidref helpers to PIDFD_GET_INFO and PIDFD_GET_*_NAMESPACE...
authorLennart Poettering <lennart@poettering.net>
Mon, 6 Jan 2025 10:23:08 +0000 (11:23 +0100)
committerGitHub <noreply@github.com>
Mon, 6 Jan 2025 10:23:08 +0000 (11:23 +0100)
Supersedes #35308 (cherry-picked one commit and replaced the rest)

(I left a few comments that's folded by GitHub. Please make sure to
check them too.)

1  2 
src/basic/cgroup-util.c
src/basic/cgroup-util.h
src/libsystemd/sd-login/sd-login.c
src/nspawn/nspawn.c

index 25dcab91fc59a16019d3a605799c9a4c590dec5d,1d2faa7393f5a7de2ab4bfa56e2d335d41d314a8..a5b9829f94e674c730f4ecabac21ccbcdad23c55
@@@ -839,9 -860,11 +860,13 @@@ int cg_pidref_get_path(const char *cont
  
          if (!pidref_is_set(pidref))
                  return -ESRCH;
 +        if (pidref_is_remote(pidref))
 +                return -EREMOTE;
  
+         // XXX: Ideally we'd use pidfd_get_cgroupid() + cg_path_from_cgroupid() here, to extract this
+         // bit of information from pidfd directly. However, the latter requires privilege and it's
+         // not entirely clear how to handle cgroups from outer namespace.
          r = cg_pid_get_path(controller, pidref->pid, &path);
          if (r < 0)
                  return r;
Simple merge
Simple merge
Simple merge