|
| 1 | +use crate::prelude::*; |
| 2 | +use crate::{ |
| 3 | + Ioctl, |
| 4 | + _IO, |
| 5 | + _IOWR, |
| 6 | +}; |
| 7 | + |
| 8 | +/* Flags for pidfd_open(). */ |
| 9 | +pub const PIDFD_NONBLOCK: c_uint = crate::O_NONBLOCK as c_uint; |
| 10 | +pub const PIDFD_THREAD: c_uint = crate::O_EXCL as c_uint; |
| 11 | + |
| 12 | +/* Flags for pidfd_send_signal(). */ |
| 13 | +pub const PIDFD_SIGNAL_THREAD: c_uint = 1 << 0; |
| 14 | +pub const PIDFD_SIGNAL_THREAD_GROUP: c_uint = 1 << 1; |
| 15 | +pub const PIDFD_SIGNAL_PROCESS_GROUP: c_uint = 1 << 2; |
| 16 | + |
| 17 | +/* Flags for pidfd_info. */ |
| 18 | +pub const PIDFD_INFO_PID: c_uint = 1 << 0; |
| 19 | +pub const PIDFD_INFO_CREDS: c_uint = 1 << 1; |
| 20 | +pub const PIDFD_INFO_CGROUPID: c_uint = 1 << 2; |
| 21 | +pub const PIDFD_INFO_EXIT: c_uint = 1 << 3; |
| 22 | +pub const PIDFD_INFO_COREDUMP: c_uint = 1 << 4; |
| 23 | +pub const PIDFD_INFO_SUPPORTED_MASK: c_uint = 1 << 5; |
| 24 | +pub const PIDFD_INFO_COREDUMP_SIGNAL: c_uint = 1 << 6; |
| 25 | + |
| 26 | +pub const PIDFD_INFO_SIZE_VER0: c_uint = 64; |
| 27 | +pub const PIDFD_INFO_SIZE_VER1: c_uint = 72; |
| 28 | +pub const PIDFD_INFO_SIZE_VER2: c_uint = 80; |
| 29 | + |
| 30 | +/* |
| 31 | + * Values for @coredump_mask in pidfd_info. |
| 32 | + * Only valid if PIDFD_INFO_COREDUMP is set in @mask. |
| 33 | + */ |
| 34 | +pub const PIDFD_COREDUMPED: c_uint = 1 << 0; |
| 35 | +pub const PIDFD_COREDUMP_SKIP: c_uint = 1 << 1; |
| 36 | +pub const PIDFD_COREDUMP_USER: c_uint = 1 << 2; |
| 37 | +pub const PIDFD_COREDUMP_ROOT: c_uint = 1 << 3; |
| 38 | + |
| 39 | +s! { |
| 40 | + #[non_exhaustive] |
| 41 | + pub struct pidfd_info { |
| 42 | + pub mask: crate::__u64, |
| 43 | + pub cgroupid: crate::__u64, |
| 44 | + pub pid: crate::__u32, |
| 45 | + pub tgid: crate::__u32, |
| 46 | + pub ppid: crate::__u32, |
| 47 | + pub ruid: crate::__u32, |
| 48 | + pub rgid: crate::__u32, |
| 49 | + pub euid: crate::__u32, |
| 50 | + pub egid: crate::__u32, |
| 51 | + pub suid: crate::__u32, |
| 52 | + pub sgid: crate::__u32, |
| 53 | + pub fsuid: crate::__u32, |
| 54 | + pub fsgid: crate::__u32, |
| 55 | + pub exit_code: crate::__s32, |
| 56 | + } |
| 57 | +} |
| 58 | + |
| 59 | +pub const PIDFS_IOCTL_MAGIC: c_uint = 0xFF; |
| 60 | + |
| 61 | +pub const PIDFD_GET_CGROUP_NAMESPACE: Ioctl = _IO(PIDFS_IOCTL_MAGIC, 1); |
| 62 | +pub const PIDFD_GET_IPC_NAMESPACE: Ioctl = _IO(PIDFS_IOCTL_MAGIC, 2); |
| 63 | +pub const PIDFD_GET_MNT_NAMESPACE: Ioctl = _IO(PIDFS_IOCTL_MAGIC, 3); |
| 64 | +pub const PIDFD_GET_NET_NAMESPACE: Ioctl = _IO(PIDFS_IOCTL_MAGIC, 4); |
| 65 | +pub const PIDFD_GET_PID_NAMESPACE: Ioctl = _IO(PIDFS_IOCTL_MAGIC, 5); |
| 66 | +pub const PIDFD_GET_PID_FOR_CHILDREN_NAMESPACE: Ioctl = _IO(PIDFS_IOCTL_MAGIC, 6); |
| 67 | +pub const PIDFD_GET_TIME_NAMESPACE: Ioctl = _IO(PIDFS_IOCTL_MAGIC, 7); |
| 68 | +pub const PIDFD_GET_TIME_FOR_CHILDREN_NAMESPACE: Ioctl = _IO(PIDFS_IOCTL_MAGIC, 8); |
| 69 | +pub const PIDFD_GET_USER_NAMESPACE: Ioctl = _IO(PIDFS_IOCTL_MAGIC, 9); |
| 70 | +pub const PIDFD_GET_UTS_NAMESPACE: Ioctl = _IO(PIDFS_IOCTL_MAGIC, 10); |
| 71 | +pub const PIDFD_GET_INFO: Ioctl = _IOWR::<pidfd_info>(PIDFS_IOCTL_MAGIC, 11); |
0 commit comments