[PATCH v2 05/13] Update PIDFD_* constants for Linux 7.1

Adhemerval Zanella <[email protected]>
Newsgroups gmane.comp.lib.glibc.alpha
Message-ID <[email protected]>
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.
---
 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 02c2b08d28e..93c7defcac3 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 73ea28e3b4a..3c92917cb63 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'
-- 
2.43.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.