]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
pidref: drop support for kernels lacking waitid(P_PIDFD, …) 35918/head
authorLennart Poettering <lennart@poettering.net>
Wed, 8 Jan 2025 09:57:50 +0000 (10:57 +0100)
committerLennart Poettering <lennart@poettering.net>
Wed, 8 Jan 2025 13:51:19 +0000 (14:51 +0100)
Our baseline is not 5.4, which is where P_PIDFD was introduced.

src/basic/pidref.c

index 53992aa3800f30e5232a25ee72a33d2a0cf40c98..bc3e96f4266b42288041f95afc78d01c0eb99671 100644 (file)
@@ -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) {