From: Lennart Poettering Date: Wed, 8 Jan 2025 09:57:50 +0000 (+0100) Subject: pidref: drop support for kernels lacking waitid(P_PIDFD, …) X-Git-Tag: v258-rc1~1667^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F35918%2Fhead;p=thirdparty%2Fsystemd.git pidref: drop support for kernels lacking waitid(P_PIDFD, …) Our baseline is not 5.4, which is where P_PIDFD was introduced. --- diff --git a/src/basic/pidref.c b/src/basic/pidref.c index 53992aa3800..bc3e96f4266 100644 --- a/src/basic/pidref.c +++ b/src/basic/pidref.c @@ -401,22 +401,17 @@ int pidref_wait(const PidRef *pidref, siginfo_t *ret, int options) { return -ECHILD; siginfo_t si = {}; - - if (pidref->fd >= 0) { + if (pidref->fd >= 0) r = RET_NERRNO(waitid(P_PIDFD, pidref->fd, &si, options)); - if (r >= 0) { - if (ret) - *ret = si; - return r; - } - if (r != -EINVAL) /* P_PIDFD was added in kernel 5.4 only */ - return r; - } + else + r = RET_NERRNO(waitid(P_PID, pidref->pid, &si, options)); + if (r < 0) + return r; - r = RET_NERRNO(waitid(P_PID, pidref->pid, &si, options)); - if (r >= 0 && ret) + if (ret) *ret = si; - return r; + + return 0; } int pidref_wait_for_terminate(const PidRef *pidref, siginfo_t *ret) {