[PATCH v2 05/13] Update PIDFD_* constants for Linux 7.1
Florian Weimer
fweimer@redhat.com
Fri Jul 3 18:01:16 GMT 2026
* Adhemerval Zanella:
> 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)
PIDFD_GET_INFO changes its value due to these changes, but the kernel
compensates for this. Looks okay.
Reviewed-by: Florian Weimer <fweimer@redhat.com>
Thanks,
Florian
More information about the Libc-alpha
mailing list