]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
include: add coredump_code to struct pidfd_info
authorEmanuele Rocca <emanuele.rocca@arm.com>
Wed, 6 May 2026 15:43:58 +0000 (15:43 +0000)
committerEmanuele Rocca <emanuele.rocca@arm.com>
Tue, 19 May 2026 08:14:18 +0000 (08:14 +0000)
Linux v7.1 adds coredump_code to struct pidfd_info and defines a few new
constants. Reflect the changes in include/override/sys/pidfd.h too.

Stop including the libc version of sys/pidfd.h to be able to override the
definition of pidfd_info.

Signed-off-by: Emanuele Rocca <emanuele.rocca@arm.com>
src/include/override/sys/pidfd.h

index 0e9b2f39989d7ba15b517e0fe9e058b8e95b50cd..28fb75698ed383ba3ad99f9b5ed5f514bd17b377 100644 (file)
@@ -1,15 +1,6 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include <features.h>
-
-/* since glibc-2.36. Only descend into the next <sys/pidfd.h> on glibc — musl ships no such header,
- * and musl-gcc's -idirafter /usr/include would otherwise pull in glibc's copy (which depends on
- * __THROW and other glibc-isms) from the fallback path. */
-#if defined(__GLIBC__) && __has_include_next(<sys/pidfd.h>)
-#include_next <sys/pidfd.h>     /* IWYU pragma: export */
-#endif
-
 #include <linux/types.h>
 #include <signal.h>
 #include <sys/ioctl.h>
@@ -49,8 +40,14 @@ int pidfd_send_signal_shim(int fd, int sig, siginfo_t *info, unsigned flags);
 #define PIDFD_INFO_CGROUPID             (1UL << 2) /* Always returned if available, even if not requested */
 #define PIDFD_INFO_EXIT                 (1UL << 3) /* Only returned if requested. */
 #define PIDFD_INFO_COREDUMP             (1UL << 4) /* Only returned if requested. */
+#define PIDFD_INFO_SUPPORTED_MASK       (1UL << 5) /* Want/got supported mask flags */
+#define PIDFD_INFO_COREDUMP_SIGNAL      (1UL << 6) /* Always returned if PIDFD_INFO_COREDUMP is requested. */
+#define PIDFD_INFO_COREDUMP_CODE        (1UL << 7) /* Always returned if PIDFD_INFO_COREDUMP is requested. */
 
 #define PIDFD_INFO_SIZE_VER0            64 /* sizeof first published struct */
+#define PIDFD_INFO_SIZE_VER1            72 /* sizeof second published struct */
+#define PIDFD_INFO_SIZE_VER2            80 /* sizeof third published struct */
+#define PIDFD_INFO_SIZE_VER3            88 /* sizeof fourth published struct */
 
 /*
  * Values for @coredump_mask in pidfd_info.
@@ -105,8 +102,13 @@ struct pidfd_info {
         __u32 fsuid;
         __u32 fsgid;
         __s32 exit_code;     /* since kernel v6.15 (7477d7dce48a996ae4e4f0b5f7bd82de7ec9131b) */
-        __u32 coredump_mask; /* since kernel v6.16 (1d8db6fd698de1f73b1a7d72aea578fdd18d9a87) */
-        __u32 __spare1;
+        struct {             /* coredump info */
+                __u32 coredump_mask;   /* since kernel v6.16 (1d8db6fd698de1f73b1a7d72aea578fdd18d9a87) */
+                __u32 coredump_signal; /* since kernel v6.19 (036375522be8425874e9e0f907c7127e315c7a52) */
+                __u32 coredump_code;   /* since kernel v7.1 (701f7f4fbabbf4989ba6fbf033b160dd943221d5) */
+                __u32 coredump_pad;    /* since kernel v7.1 (701f7f4fbabbf4989ba6fbf033b160dd943221d5) */
+        };
+        __u64 supported_mask; /* Mask flags that this kernel supports */
 };
 
 #define PIDFD_GET_INFO          _IOWR(PIDFS_IOCTL_MAGIC, 11, struct pidfd_info)