chore: checkpoint before Python removal

This commit is contained in:
2026-03-26 22:33:59 +00:00
parent 683cec9307
commit e568ddf82a
29972 changed files with 11269302 additions and 2 deletions

View File

@@ -0,0 +1,134 @@
//! Header: `uapi/linux/can.h`
pub(crate) mod bcm;
pub(crate) mod error;
pub(crate) mod j1939;
pub(crate) mod raw;
use crate::prelude::*;
pub const CAN_EFF_FLAG: canid_t = 0x80000000;
pub const CAN_RTR_FLAG: canid_t = 0x40000000;
pub const CAN_ERR_FLAG: canid_t = 0x20000000;
pub const CAN_SFF_MASK: canid_t = 0x000007FF;
pub const CAN_EFF_MASK: canid_t = 0x1FFFFFFF;
pub const CAN_ERR_MASK: canid_t = 0x1FFFFFFF;
pub const CANXL_PRIO_MASK: crate::canid_t = CAN_SFF_MASK;
pub type canid_t = u32;
pub const CAN_SFF_ID_BITS: c_int = 11;
pub const CAN_EFF_ID_BITS: c_int = 29;
pub const CANXL_PRIO_BITS: c_int = CAN_SFF_ID_BITS;
pub type can_err_mask_t = u32;
pub const CAN_MAX_DLC: c_int = 8;
pub const CAN_MAX_DLEN: usize = 8;
pub const CANFD_MAX_DLC: c_int = 15;
pub const CANFD_MAX_DLEN: usize = 64;
pub const CANXL_MIN_DLC: c_int = 0;
pub const CANXL_MAX_DLC: c_int = 2047;
pub const CANXL_MAX_DLC_MASK: c_int = 0x07FF;
pub const CANXL_MIN_DLEN: usize = 1;
pub const CANXL_MAX_DLEN: usize = 2048;
s! {
#[repr(align(8))]
pub struct can_frame {
pub can_id: canid_t,
// FIXME(1.0): this field was renamed to `len` in Linux 5.11
pub can_dlc: u8,
__pad: Padding<u8>,
__res0: u8,
pub len8_dlc: u8,
pub data: [u8; CAN_MAX_DLEN],
}
}
pub const CANFD_BRS: c_int = 0x01;
pub const CANFD_ESI: c_int = 0x02;
pub const CANFD_FDF: c_int = 0x04;
s! {
#[repr(align(8))]
pub struct canfd_frame {
pub can_id: canid_t,
pub len: u8,
pub flags: u8,
__res0: u8,
__res1: u8,
pub data: [u8; CANFD_MAX_DLEN],
}
}
pub const CANXL_XLF: c_int = 0x80;
pub const CANXL_SEC: c_int = 0x01;
s! {
pub struct canxl_frame {
pub prio: canid_t,
pub flags: u8,
pub sdt: u8,
pub len: u16,
pub af: u32,
pub data: [u8; CANXL_MAX_DLEN],
}
}
pub const CAN_MTU: usize = size_of::<can_frame>();
pub const CANFD_MTU: usize = size_of::<canfd_frame>();
pub const CANXL_MTU: usize = size_of::<canxl_frame>();
// FIXME(offset_of): use `core::mem::offset_of!` once that is available
// https://github.com/rust-lang/rfcs/pull/3308
// pub const CANXL_HDR_SIZE: usize = core::mem::offset_of!(canxl_frame, data);
pub const CANXL_HDR_SIZE: usize = 12;
pub const CANXL_MIN_MTU: usize = CANXL_HDR_SIZE + 64;
pub const CANXL_MAX_MTU: usize = CANXL_MTU;
pub const CAN_RAW: c_int = 1;
pub const CAN_BCM: c_int = 2;
pub const CAN_TP16: c_int = 3;
pub const CAN_TP20: c_int = 4;
pub const CAN_MCNET: c_int = 5;
pub const CAN_ISOTP: c_int = 6;
pub const CAN_J1939: c_int = 7;
pub const CAN_NPROTO: c_int = 8;
pub const SOL_CAN_BASE: c_int = 100;
s_no_extra_traits! {
pub struct sockaddr_can {
pub can_family: crate::sa_family_t,
pub can_ifindex: c_int,
pub can_addr: __c_anonymous_sockaddr_can_can_addr,
}
pub union __c_anonymous_sockaddr_can_can_addr {
pub tp: __c_anonymous_sockaddr_can_tp,
pub j1939: __c_anonymous_sockaddr_can_j1939,
}
}
s! {
pub struct __c_anonymous_sockaddr_can_tp {
pub rx_id: canid_t,
pub tx_id: canid_t,
}
pub struct __c_anonymous_sockaddr_can_j1939 {
pub name: u64,
pub pgn: u32,
pub addr: u8,
}
pub struct can_filter {
pub can_id: canid_t,
pub can_mask: canid_t,
}
}
pub const CAN_INV_FILTER: canid_t = 0x20000000;

View File

@@ -0,0 +1,52 @@
//! Header: `linux/can/bcm.h`
pub use crate::linux::can::*;
s! {
pub struct bcm_timeval {
pub tv_sec: c_long,
pub tv_usec: c_long,
}
pub struct bcm_msg_head {
pub opcode: u32,
pub flags: u32,
pub count: u32,
pub ival1: bcm_timeval,
pub ival2: bcm_timeval,
pub can_id: canid_t,
pub nframes: u32,
pub frames: [can_frame; 0],
}
}
c_enum! {
#[repr(u32)]
pub enum #anon {
pub TX_SETUP = 1,
pub TX_DELETE,
pub TX_READ,
pub TX_SEND,
pub RX_SETUP,
pub RX_DELETE,
pub RX_READ,
pub TX_STATUS,
pub TX_EXPIRED,
pub RX_STATUS,
pub RX_TIMEOUT,
pub RX_CHANGED,
}
}
pub const SETTIMER: u32 = 0x0001;
pub const STARTTIMER: u32 = 0x0002;
pub const TX_COUNTEVT: u32 = 0x0004;
pub const TX_ANNOUNCE: u32 = 0x0008;
pub const TX_CP_CAN_ID: u32 = 0x0010;
pub const RX_FILTER_ID: u32 = 0x0020;
pub const RX_CHECK_DLC: u32 = 0x0040;
pub const RX_NO_AUTOTIMER: u32 = 0x0080;
pub const RX_ANNOUNCE_RESUME: u32 = 0x0100;
pub const TX_RESET_MULTI_IDX: u32 = 0x0200;
pub const RX_RTR_FRAME: u32 = 0x0400;
pub const CAN_FD_FRAME: u32 = 0x0800;

View File

@@ -0,0 +1,73 @@
//! Header: `linux/can/error.h`
pub use crate::linux::can::*;
pub const CAN_ERR_DLC: c_int = 8;
pub const CAN_ERR_TX_TIMEOUT: c_uint = 0x00000001;
pub const CAN_ERR_LOSTARB: c_uint = 0x00000002;
pub const CAN_ERR_CRTL: c_uint = 0x00000004;
pub const CAN_ERR_PROT: c_uint = 0x00000008;
pub const CAN_ERR_TRX: c_uint = 0x00000010;
pub const CAN_ERR_ACK: c_uint = 0x00000020;
pub const CAN_ERR_BUSOFF: c_uint = 0x00000040;
pub const CAN_ERR_BUSERROR: c_uint = 0x00000080;
pub const CAN_ERR_RESTARTED: c_uint = 0x00000100;
pub const CAN_ERR_CNT: c_uint = 0x00000200;
pub const CAN_ERR_LOSTARB_UNSPEC: c_int = 0x00;
pub const CAN_ERR_CRTL_UNSPEC: c_int = 0x00;
pub const CAN_ERR_CRTL_RX_OVERFLOW: c_int = 0x01;
pub const CAN_ERR_CRTL_TX_OVERFLOW: c_int = 0x02;
pub const CAN_ERR_CRTL_RX_WARNING: c_int = 0x04;
pub const CAN_ERR_CRTL_TX_WARNING: c_int = 0x08;
pub const CAN_ERR_CRTL_RX_PASSIVE: c_int = 0x10;
pub const CAN_ERR_CRTL_TX_PASSIVE: c_int = 0x20;
pub const CAN_ERR_CRTL_ACTIVE: c_int = 0x40;
pub const CAN_ERR_PROT_UNSPEC: c_int = 0x00;
pub const CAN_ERR_PROT_BIT: c_int = 0x01;
pub const CAN_ERR_PROT_FORM: c_int = 0x02;
pub const CAN_ERR_PROT_STUFF: c_int = 0x04;
pub const CAN_ERR_PROT_BIT0: c_int = 0x08;
pub const CAN_ERR_PROT_BIT1: c_int = 0x10;
pub const CAN_ERR_PROT_OVERLOAD: c_int = 0x20;
pub const CAN_ERR_PROT_ACTIVE: c_int = 0x40;
pub const CAN_ERR_PROT_TX: c_int = 0x80;
pub const CAN_ERR_PROT_LOC_UNSPEC: c_int = 0x00;
pub const CAN_ERR_PROT_LOC_SOF: c_int = 0x03;
pub const CAN_ERR_PROT_LOC_ID28_21: c_int = 0x02;
pub const CAN_ERR_PROT_LOC_ID20_18: c_int = 0x06;
pub const CAN_ERR_PROT_LOC_SRTR: c_int = 0x04;
pub const CAN_ERR_PROT_LOC_IDE: c_int = 0x05;
pub const CAN_ERR_PROT_LOC_ID17_13: c_int = 0x07;
pub const CAN_ERR_PROT_LOC_ID12_05: c_int = 0x0F;
pub const CAN_ERR_PROT_LOC_ID04_00: c_int = 0x0E;
pub const CAN_ERR_PROT_LOC_RTR: c_int = 0x0C;
pub const CAN_ERR_PROT_LOC_RES1: c_int = 0x0D;
pub const CAN_ERR_PROT_LOC_RES0: c_int = 0x09;
pub const CAN_ERR_PROT_LOC_DLC: c_int = 0x0B;
pub const CAN_ERR_PROT_LOC_DATA: c_int = 0x0A;
pub const CAN_ERR_PROT_LOC_CRC_SEQ: c_int = 0x08;
pub const CAN_ERR_PROT_LOC_CRC_DEL: c_int = 0x18;
pub const CAN_ERR_PROT_LOC_ACK: c_int = 0x19;
pub const CAN_ERR_PROT_LOC_ACK_DEL: c_int = 0x1B;
pub const CAN_ERR_PROT_LOC_EOF: c_int = 0x1A;
pub const CAN_ERR_PROT_LOC_INTERM: c_int = 0x12;
pub const CAN_ERR_TRX_UNSPEC: c_int = 0x00;
pub const CAN_ERR_TRX_CANH_NO_WIRE: c_int = 0x04;
pub const CAN_ERR_TRX_CANH_SHORT_TO_BAT: c_int = 0x05;
pub const CAN_ERR_TRX_CANH_SHORT_TO_VCC: c_int = 0x06;
pub const CAN_ERR_TRX_CANH_SHORT_TO_GND: c_int = 0x07;
pub const CAN_ERR_TRX_CANL_NO_WIRE: c_int = 0x40;
pub const CAN_ERR_TRX_CANL_SHORT_TO_BAT: c_int = 0x50;
pub const CAN_ERR_TRX_CANL_SHORT_TO_VCC: c_int = 0x60;
pub const CAN_ERR_TRX_CANL_SHORT_TO_GND: c_int = 0x70;
pub const CAN_ERR_TRX_CANL_SHORT_TO_CANH: c_int = 0x80;
pub const CAN_ERROR_WARNING_THRESHOLD: c_int = 96;
pub const CAN_ERROR_PASSIVE_THRESHOLD: c_int = 128;
pub const CAN_BUS_OFF_THRESHOLD: c_int = 256;

View File

@@ -0,0 +1,60 @@
//! `linux/can/j1939.h`
pub use crate::linux::can::*;
pub const J1939_MAX_UNICAST_ADDR: c_uchar = 0xfd;
pub const J1939_IDLE_ADDR: c_uchar = 0xfe;
pub const J1939_NO_ADDR: c_uchar = 0xff;
pub const J1939_NO_NAME: c_ulong = 0;
pub const J1939_PGN_REQUEST: c_uint = 0x0ea00;
pub const J1939_PGN_ADDRESS_CLAIMED: c_uint = 0x0ee00;
pub const J1939_PGN_ADDRESS_COMMANDED: c_uint = 0x0fed8;
pub const J1939_PGN_PDU1_MAX: c_uint = 0x3ff00;
pub const J1939_PGN_MAX: c_uint = 0x3ffff;
pub const J1939_NO_PGN: c_uint = 0x40000;
pub type pgn_t = u32;
pub type priority_t = u8;
pub type name_t = u64;
pub const SOL_CAN_J1939: c_int = SOL_CAN_BASE + CAN_J1939;
// FIXME(cleanup): these could use c_enum if it can accept anonymous enums.
pub const SO_J1939_FILTER: c_int = 1;
pub const SO_J1939_PROMISC: c_int = 2;
pub const SO_J1939_SEND_PRIO: c_int = 3;
pub const SO_J1939_ERRQUEUE: c_int = 4;
pub const SCM_J1939_DEST_ADDR: c_int = 1;
pub const SCM_J1939_DEST_NAME: c_int = 2;
pub const SCM_J1939_PRIO: c_int = 3;
pub const SCM_J1939_ERRQUEUE: c_int = 4;
pub const J1939_NLA_PAD: c_int = 0;
pub const J1939_NLA_BYTES_ACKED: c_int = 1;
pub const J1939_NLA_TOTAL_SIZE: c_int = 2;
pub const J1939_NLA_PGN: c_int = 3;
pub const J1939_NLA_SRC_NAME: c_int = 4;
pub const J1939_NLA_DEST_NAME: c_int = 5;
pub const J1939_NLA_SRC_ADDR: c_int = 6;
pub const J1939_NLA_DEST_ADDR: c_int = 7;
pub const J1939_EE_INFO_NONE: c_int = 0;
pub const J1939_EE_INFO_TX_ABORT: c_int = 1;
pub const J1939_EE_INFO_RX_RTS: c_int = 2;
pub const J1939_EE_INFO_RX_DPO: c_int = 3;
pub const J1939_EE_INFO_RX_ABORT: c_int = 4;
s! {
pub struct j1939_filter {
pub name: name_t,
pub name_mask: name_t,
pub pgn: pgn_t,
pub pgn_mask: pgn_t,
pub addr: u8,
pub addr_mask: u8,
}
}
pub const J1939_FILTER_MAX: c_int = 512;

View File

@@ -0,0 +1,15 @@
//! Header: `linux/can/raw.h`
pub use crate::linux::can::*;
pub const SOL_CAN_RAW: c_int = SOL_CAN_BASE + CAN_RAW;
pub const CAN_RAW_FILTER_MAX: c_int = 512;
// FIXME(cleanup): use `c_enum!`, which needs to be adapted to allow omitting a type.
pub const CAN_RAW_FILTER: c_int = 1;
pub const CAN_RAW_ERR_FILTER: c_int = 2;
pub const CAN_RAW_LOOPBACK: c_int = 3;
pub const CAN_RAW_RECV_OWN_MSGS: c_int = 4;
pub const CAN_RAW_FD_FRAMES: c_int = 5;
pub const CAN_RAW_JOIN_FILTERS: c_int = 6;
pub const CAN_RAW_XL_FRAMES: c_int = 7;

View File

@@ -0,0 +1,69 @@
//! Header: `linux/keyctl.h`
pub const KEY_SPEC_THREAD_KEYRING: i32 = -1;
pub const KEY_SPEC_PROCESS_KEYRING: i32 = -2;
pub const KEY_SPEC_SESSION_KEYRING: i32 = -3;
pub const KEY_SPEC_USER_KEYRING: i32 = -4;
pub const KEY_SPEC_USER_SESSION_KEYRING: i32 = -5;
pub const KEY_SPEC_GROUP_KEYRING: i32 = -6;
pub const KEY_SPEC_REQKEY_AUTH_KEY: i32 = -7;
pub const KEY_SPEC_REQUESTOR_KEYRING: i32 = -8;
pub const KEY_REQKEY_DEFL_NO_CHANGE: i32 = -1;
pub const KEY_REQKEY_DEFL_DEFAULT: i32 = 0;
pub const KEY_REQKEY_DEFL_THREAD_KEYRING: i32 = 1;
pub const KEY_REQKEY_DEFL_PROCESS_KEYRING: i32 = 2;
pub const KEY_REQKEY_DEFL_SESSION_KEYRING: i32 = 3;
pub const KEY_REQKEY_DEFL_USER_KEYRING: i32 = 4;
pub const KEY_REQKEY_DEFL_USER_SESSION_KEYRING: i32 = 5;
pub const KEY_REQKEY_DEFL_GROUP_KEYRING: i32 = 6;
pub const KEY_REQKEY_DEFL_REQUESTOR_KEYRING: i32 = 7;
pub const KEYCTL_GET_KEYRING_ID: u32 = 0;
pub const KEYCTL_JOIN_SESSION_KEYRING: u32 = 1;
pub const KEYCTL_UPDATE: u32 = 2;
pub const KEYCTL_REVOKE: u32 = 3;
pub const KEYCTL_CHOWN: u32 = 4;
pub const KEYCTL_SETPERM: u32 = 5;
pub const KEYCTL_DESCRIBE: u32 = 6;
pub const KEYCTL_CLEAR: u32 = 7;
pub const KEYCTL_LINK: u32 = 8;
pub const KEYCTL_UNLINK: u32 = 9;
pub const KEYCTL_SEARCH: u32 = 10;
pub const KEYCTL_READ: u32 = 11;
pub const KEYCTL_INSTANTIATE: u32 = 12;
pub const KEYCTL_NEGATE: u32 = 13;
pub const KEYCTL_SET_REQKEY_KEYRING: u32 = 14;
pub const KEYCTL_SET_TIMEOUT: u32 = 15;
pub const KEYCTL_ASSUME_AUTHORITY: u32 = 16;
pub const KEYCTL_GET_SECURITY: u32 = 17;
pub const KEYCTL_SESSION_TO_PARENT: u32 = 18;
pub const KEYCTL_REJECT: u32 = 19;
pub const KEYCTL_INSTANTIATE_IOV: u32 = 20;
pub const KEYCTL_INVALIDATE: u32 = 21;
pub const KEYCTL_GET_PERSISTENT: u32 = 22;
pub const KEYCTL_DH_COMPUTE: u32 = 23;
pub const KEYCTL_PKEY_QUERY: u32 = 24;
pub const KEYCTL_PKEY_ENCRYPT: u32 = 25;
pub const KEYCTL_PKEY_DECRYPT: u32 = 26;
pub const KEYCTL_PKEY_SIGN: u32 = 27;
pub const KEYCTL_PKEY_VERIFY: u32 = 28;
pub const KEYCTL_RESTRICT_KEYRING: u32 = 29;
pub const KEYCTL_MOVE: u32 = 30;
pub const KEYCTL_CAPABILITIES: u32 = 31;
pub const KEYCTL_SUPPORTS_ENCRYPT: u32 = 0x01;
pub const KEYCTL_SUPPORTS_DECRYPT: u32 = 0x02;
pub const KEYCTL_SUPPORTS_SIGN: u32 = 0x04;
pub const KEYCTL_SUPPORTS_VERIFY: u32 = 0x08;
pub const KEYCTL_CAPS0_CAPABILITIES: u32 = 0x01;
pub const KEYCTL_CAPS0_PERSISTENT_KEYRINGS: u32 = 0x02;
pub const KEYCTL_CAPS0_DIFFIE_HELLMAN: u32 = 0x04;
pub const KEYCTL_CAPS0_PUBLIC_KEY: u32 = 0x08;
pub const KEYCTL_CAPS0_BIG_KEY: u32 = 0x10;
pub const KEYCTL_CAPS0_INVALIDATE: u32 = 0x20;
pub const KEYCTL_CAPS0_RESTRICT_KEYRING: u32 = 0x40;
pub const KEYCTL_CAPS0_MOVE: u32 = 0x80;
pub const KEYCTL_CAPS1_NS_KEYRING_NAME: u32 = 0x01;
pub const KEYCTL_CAPS1_NS_KEY_TAG: u32 = 0x02;

View File

@@ -0,0 +1,20 @@
//! Header: `uapi/linux/membarrier.h`
use crate::prelude::*;
c_enum! {
// FIXME(1.0): incorrect repr signedness, this should be removed in a breaking change.
#[repr(c_int)]
pub enum membarrier_cmd {
pub MEMBARRIER_CMD_QUERY = 0,
pub MEMBARRIER_CMD_GLOBAL = 1 << 0,
pub MEMBARRIER_CMD_GLOBAL_EXPEDITED = 1 << 1,
pub MEMBARRIER_CMD_REGISTER_GLOBAL_EXPEDITED = 1 << 2,
pub MEMBARRIER_CMD_PRIVATE_EXPEDITED = 1 << 3,
pub MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED = 1 << 4,
pub MEMBARRIER_CMD_PRIVATE_EXPEDITED_SYNC_CORE = 1 << 5,
pub MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED_SYNC_CORE = 1 << 6,
pub MEMBARRIER_CMD_PRIVATE_EXPEDITED_RSEQ = 1 << 7,
pub MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED_RSEQ = 1 << 8,
}
}

View File

@@ -0,0 +1,9 @@
//! Directory: `linux/`
//!
//! <https://github.com/torvalds/linux/tree/master/include/uapi/linux>
pub(crate) mod can;
pub(crate) mod keyctl;
pub(crate) mod membarrier;
pub(crate) mod netlink;
pub(crate) mod pidfd;

View File

@@ -0,0 +1,136 @@
//! Header: `uapi/linux/netlink.h`
use crate::prelude::*;
pub const NETLINK_ROUTE: c_int = 0;
pub const NETLINK_UNUSED: c_int = 1;
pub const NETLINK_USERSOCK: c_int = 2;
pub const NETLINK_FIREWALL: c_int = 3;
pub const NETLINK_SOCK_DIAG: c_int = 4;
pub const NETLINK_NFLOG: c_int = 5;
pub const NETLINK_XFRM: c_int = 6;
pub const NETLINK_SELINUX: c_int = 7;
pub const NETLINK_ISCSI: c_int = 8;
pub const NETLINK_AUDIT: c_int = 9;
pub const NETLINK_FIB_LOOKUP: c_int = 10;
pub const NETLINK_CONNECTOR: c_int = 11;
pub const NETLINK_NETFILTER: c_int = 12;
pub const NETLINK_IP6_FW: c_int = 13;
pub const NETLINK_DNRTMSG: c_int = 14;
pub const NETLINK_KOBJECT_UEVENT: c_int = 15;
pub const NETLINK_GENERIC: c_int = 16;
pub const NETLINK_SCSITRANSPORT: c_int = 18;
pub const NETLINK_ECRYPTFS: c_int = 19;
pub const NETLINK_RDMA: c_int = 20;
pub const NETLINK_CRYPTO: c_int = 21;
pub const NETLINK_INET_DIAG: c_int = NETLINK_SOCK_DIAG;
pub const MAX_LINKS: c_int = 32;
s! {
pub struct sockaddr_nl {
pub nl_family: crate::sa_family_t,
nl_pad: Padding<c_ushort>,
pub nl_pid: u32,
pub nl_groups: u32,
}
pub struct nlmsghdr {
pub nlmsg_len: u32,
pub nlmsg_type: u16,
pub nlmsg_flags: u16,
pub nlmsg_seq: u32,
pub nlmsg_pid: u32,
}
}
pub const NLM_F_REQUEST: c_int = 1;
pub const NLM_F_MULTI: c_int = 2;
pub const NLM_F_ACK: c_int = 4;
pub const NLM_F_ECHO: c_int = 8;
pub const NLM_F_DUMP_INTR: c_int = 16;
pub const NLM_F_DUMP_FILTERED: c_int = 32;
pub const NLM_F_ROOT: c_int = 0x100;
pub const NLM_F_MATCH: c_int = 0x200;
pub const NLM_F_ATOMIC: c_int = 0x400;
pub const NLM_F_DUMP: c_int = NLM_F_ROOT | NLM_F_MATCH;
pub const NLM_F_REPLACE: c_int = 0x100;
pub const NLM_F_EXCL: c_int = 0x200;
pub const NLM_F_CREATE: c_int = 0x400;
pub const NLM_F_APPEND: c_int = 0x800;
pub const NLM_F_NONREC: c_int = 0x100;
pub const NLM_F_CAPPED: c_int = 0x100;
pub const NLM_F_ACK_TLVS: c_int = 0x200;
pub const NLMSG_NOOP: c_int = 0x1;
pub const NLMSG_ERROR: c_int = 0x2;
pub const NLMSG_DONE: c_int = 0x3;
pub const NLMSG_OVERRUN: c_int = 0x4;
pub const NLMSG_MIN_TYPE: c_int = 0x10;
s! {
pub struct nlmsgerr {
pub error: c_int,
pub msg: nlmsghdr,
}
}
pub const NETLINK_ADD_MEMBERSHIP: c_int = 1;
pub const NETLINK_DROP_MEMBERSHIP: c_int = 2;
pub const NETLINK_PKTINFO: c_int = 3;
pub const NETLINK_BROADCAST_ERROR: c_int = 4;
pub const NETLINK_NO_ENOBUFS: c_int = 5;
pub const NETLINK_RX_RING: c_int = 6;
pub const NETLINK_TX_RING: c_int = 7;
pub const NETLINK_LISTEN_ALL_NSID: c_int = 8;
pub const NETLINK_LIST_MEMBERSHIPS: c_int = 9;
pub const NETLINK_CAP_ACK: c_int = 10;
pub const NETLINK_EXT_ACK: c_int = 11;
pub const NETLINK_GET_STRICT_CHK: c_int = 12;
s! {
pub struct nl_pktinfo {
pub group: u32,
}
pub struct nl_mmap_req {
pub nm_block_size: c_uint,
pub nm_block_nr: c_uint,
pub nm_frame_size: c_uint,
pub nm_frame_nr: c_uint,
}
pub struct nl_mmap_hdr {
pub nm_status: c_uint,
pub nm_len: c_uint,
pub nm_group: u32,
pub nm_pid: u32,
pub nm_uid: u32,
pub nm_gid: u32,
}
}
s! {
pub struct nlattr {
pub nla_len: u16,
pub nla_type: u16,
}
}
pub const NLA_F_NESTED: c_int = 1 << 15;
pub const NLA_F_NET_BYTEORDER: c_int = 1 << 14;
pub const NLA_TYPE_MASK: c_int = !(NLA_F_NESTED | NLA_F_NET_BYTEORDER);
pub const NLA_ALIGNTO: c_int = 4;
f! {
pub fn NLA_ALIGN(len: c_int) -> c_int {
return ((len) + NLA_ALIGNTO - 1) & !(NLA_ALIGNTO - 1);
}
}

View File

@@ -0,0 +1,59 @@
//! Header: `uapi/linux/pidfd.h`
use crate::prelude::*;
use crate::{
Ioctl,
_IO,
_IOWR,
};
/* Flags for pidfd_open(). */
pub const PIDFD_NONBLOCK: c_uint = crate::O_NONBLOCK as c_uint;
pub const PIDFD_THREAD: c_uint = crate::O_EXCL as c_uint;
/* Flags for pidfd_send_signal(). */
pub const PIDFD_SIGNAL_THREAD: c_uint = 1 << 0;
pub const PIDFD_SIGNAL_THREAD_GROUP: c_uint = 1 << 1;
pub const PIDFD_SIGNAL_PROCESS_GROUP: c_uint = 1 << 2;
/* Flags for pidfd_info. */
pub const PIDFD_INFO_PID: c_uint = 1 << 0;
pub const PIDFD_INFO_CREDS: c_uint = 1 << 1;
pub const PIDFD_INFO_CGROUPID: c_uint = 1 << 2;
pub const PIDFD_INFO_EXIT: c_uint = 1 << 3;
pub const PIDFD_INFO_SIZE_VER0: c_uint = 64;
s! {
#[non_exhaustive]
pub struct pidfd_info {
pub mask: crate::__u64,
pub cgroupid: crate::__u64,
pub pid: crate::__u32,
pub tgid: crate::__u32,
pub ppid: crate::__u32,
pub ruid: crate::__u32,
pub rgid: crate::__u32,
pub euid: crate::__u32,
pub egid: crate::__u32,
pub suid: crate::__u32,
pub sgid: crate::__u32,
pub fsuid: crate::__u32,
pub fsgid: crate::__u32,
pub exit_code: crate::__s32,
}
}
const PIDFS_IOCTL_MAGIC: c_uint = 0xFF;
pub const PIDFD_GET_CGROUP_NAMESPACE: Ioctl = _IO(PIDFS_IOCTL_MAGIC, 1);
pub const PIDFD_GET_IPC_NAMESPACE: Ioctl = _IO(PIDFS_IOCTL_MAGIC, 2);
pub const PIDFD_GET_MNT_NAMESPACE: Ioctl = _IO(PIDFS_IOCTL_MAGIC, 3);
pub const PIDFD_GET_NET_NAMESPACE: Ioctl = _IO(PIDFS_IOCTL_MAGIC, 4);
pub const PIDFD_GET_PID_NAMESPACE: Ioctl = _IO(PIDFS_IOCTL_MAGIC, 5);
pub const PIDFD_GET_PID_FOR_CHILDREN_NAMESPACE: Ioctl = _IO(PIDFS_IOCTL_MAGIC, 6);
pub const PIDFD_GET_TIME_NAMESPACE: Ioctl = _IO(PIDFS_IOCTL_MAGIC, 7);
pub const PIDFD_GET_TIME_FOR_CHILDREN_NAMESPACE: Ioctl = _IO(PIDFS_IOCTL_MAGIC, 8);
pub const PIDFD_GET_USER_NAMESPACE: Ioctl = _IO(PIDFS_IOCTL_MAGIC, 9);
pub const PIDFD_GET_UTS_NAMESPACE: Ioctl = _IO(PIDFS_IOCTL_MAGIC, 10);
pub const PIDFD_GET_INFO: Ioctl = _IOWR::<pidfd_info>(PIDFS_IOCTL_MAGIC, 11);

3
vendor/libc/src/new/linux_uapi/mod.rs vendored Normal file
View File

@@ -0,0 +1,3 @@
//! This directory maps to `include/uapi` in the Linux source tree.
pub(crate) mod linux;