History

pidfs: allow to retrieve exit information

Some tools like systemd's jounral need to retrieve the exit and cgroup information after a process has already been reaped. This can e.g., happen when retrieving a pidfd via SCM_PIDFD or SCM_PEERPIDFD.

Christian Brauner committed 1 year ago

Commit 7477d7d1 parent 45135222 files · +70 −19Browse files

Showing the changes to include/uapi (1 of 2 files). Show all

Unified · Split

include/uapi/linux/pidfd.h+2−1
@@ -20,6 +20,7 @@ · 19 unmodified lines
2020 #define PIDFD_INFO_PID (1UL << 0) /* Always returned, even if not requested */
2121 #define PIDFD_INFO_CREDS (1UL << 1) /* Always returned, even if not requested */
2222 #define PIDFD_INFO_CGROUPID (1UL << 2) /* Always returned if available, even if not requested */
23+#define PIDFD_INFO_EXIT (1UL << 3) /* Only returned if requested. */
2324
2425 #define PIDFD_INFO_SIZE_VER0 64 /* sizeof first published struct */
2526
@@ -86,7 +87,7 @@ struct pidfd_info { · 60 unmodified lines
8687 __u32 sgid;
8788 __u32 fsuid;
8889 __u32 fsgid;
89− __u32 spare0[1];
90+ __s32 exit_code;
9091 };
9192
9293 #define PIDFS_IOCTL_MAGIC 0xFF