From: Mike Yuan Date: Fri, 29 Nov 2024 16:13:18 +0000 (+0100) Subject: cgroup-util: explain why cg_pidref_get_path() cannot be ported over to pidfd helpers... X-Git-Tag: v258-rc1~1704^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F35242%2Fhead;p=thirdparty%2Fsystemd.git cgroup-util: explain why cg_pidref_get_path() cannot be ported over to pidfd helpers (yet) See also: https://github.com/systemd/systemd/pull/35242#issuecomment-2506686806 --- diff --git a/src/basic/cgroup-util.c b/src/basic/cgroup-util.c index 50f1f0e4df2..1d2faa7393f 100644 --- a/src/basic/cgroup-util.c +++ b/src/basic/cgroup-util.c @@ -861,6 +861,10 @@ int cg_pidref_get_path(const char *controller, const PidRef *pidref, char **ret_ if (!pidref_is_set(pidref)) return -ESRCH; + // 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;