[glibc] Update PIDFD_* constants for Linux 7.1

Adhemerval Zanella via Glibc-cvs <[email protected]> Fri, 3 Jul 2026 23:34:51 +0000 (GMT)
Newsgroups gmane.comp.lib.glibc.cvs
Message-ID <[email protected]>
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=b9476fa9aaed9c66b162ee3731983148b48c19da

commit b9476fa9aaed9c66b162ee3731983148b48c19da
Author: Adhemerval Zanella <[email protected]>
Date:   Fri Jul 3 11:46:31 2026 -0300

    Update PIDFD_* constants for Linux 7.1
    
    The pidfd_info interface was extended to report coredump information:
    
      * PIDFD_INFO_SUPPORTED_MASK, along with the supported_mask field, so
        userspace can check which flags the running kernel supports (commit
        dfd78546c95330db2252e0d7e937a15ab5eddb4e, Linux 6.19).
    
      * PIDFD_INFO_COREDUMP_SIGNAL, along with the coredump_signal field
        (commit 036375522be8425874e9e0f907c7127e315c7a52, Linux 6.19).
    
      * PIDFD_INFO_COREDUMP_CODE, along with the coredump_code field (commit
        701f7f4fbabbf4989ba6fbf033b160dd943221d5, Linux 7.1).
    
    The struct pidfd_info is extended accordingly and PIDFD_INFO_SIZE_VER1,
    PIDFD_INFO_SIZE_VER2, and PIDFD_INFO_SIZE_VER3 are added to reflect the
    new struct sizes.
    
    Reviewed-by: Florian Weimer <[email protected]>

Diff:
---
 sysdeps/unix/sysv/linux/sys/pidfd.h         | 17 ++++++++++++++++-
 sysdeps/unix/sysv/linux/tst-pidfd-consts.py |  2 +-
 2 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/sysdeps/unix/sysv/linux/sys/pidfd.h b/sysdeps/unix/sysv/linux/sys/pidfd.h
index 02c2b08d28..93c7defcac 100644
--- a/sysdeps/unix/sysv/linux/sys/pidfd.h
+++ b/sysdeps/unix/sysv/linux/sys/pidfd.h
@@ -61,6 +61,12 @@
 #define PIDFD_INFO_EXIT                       (1UL << 3)
 /* Only returned if requested. */
 #define PIDFD_INFO_COREDUMP                   (1UL << 4)
+/* Want/got supported mask flags */
+#define PIDFD_INFO_SUPPORTED_MASK             (1UL << 5)
+/* Always returned if PIDFD_INFO_COREDUMP is requested. */
+#define PIDFD_INFO_COREDUMP_SIGNAL            (1UL << 6)
+/* Always returned if PIDFD_INFO_COREDUMP is requested. */
+#define PIDFD_INFO_COREDUMP_CODE              (1UL << 7)
 
 
 /* Value for coredump_mask in pidfd_info.  Only valid if PIDFD_INFO_COREDUMP
@@ -92,11 +98,20 @@ struct pidfd_info
   __uint32_t fsgid;
   __int32_t  exit_code;
   __uint32_t coredump_mask;
-  __uint32_t __spare1;
+  __uint32_t coredump_signal;
+  __uint32_t coredump_code;
+  __uint32_t coredump_pad;
+  __uint64_t supported_mask;
 };
 
 /* sizeof first published struct */
 #define PIDFD_INFO_SIZE_VER0                  64
+/* sizeof second published struct */
+#define PIDFD_INFO_SIZE_VER1                  72
+/* sizeof third published struct */
+#define PIDFD_INFO_SIZE_VER2                  80
+/* sizeof fourth published struct */
+#define PIDFD_INFO_SIZE_VER3                  88
 
 #define PIDFD_GET_INFO                        _IOWR(PIDFS_IOCTL_MAGIC, 11, struct pidfd_info)
 
diff --git a/sysdeps/unix/sysv/linux/tst-pidfd-consts.py b/sysdeps/unix/sysv/linux/tst-pidfd-consts.py
index 73ea28e3b4..3c92917cb6 100644
--- a/sysdeps/unix/sysv/linux/tst-pidfd-consts.py
+++ b/sysdeps/unix/sysv/linux/tst-pidfd-consts.py
@@ -39,7 +39,7 @@ def main():
         sys.exit (77)
 
     linux_version_headers = glibcsyscalls.linux_kernel_version(args.cc)
-    linux_version_glibc = (6, 17)
+    linux_version_glibc = (7, 1)
     sys.exit(glibcextract.compare_macro_consts(
                 '#include <sys/pidfd.h>\n',
                 '#include <asm/fcntl.h>\n'