#![allow(non_camel_case_types)]
use core::ffi;
pub type int = ffi::c_int;
pub type uint = ffi::c_uint;
pub type short = ffi::c_short;
pub type ushort = ffi::c_ushort;
pub type long = ffi::c_long;
pub type ulong = ffi::c_ulong;
pub type longlong = ffi::c_long;
pub type ulonglong = ffi::c_ulong;
pub type ssize_t = isize;
pub type size_t = usize;
pub type char = ffi::c_char;
pub type uchar = ffi::c_uchar;
pub type void = ffi::c_void;
pub type mode_t = uint;
pub type off_t = long;
pub type loff_t = ffi::c_longlong;
pub type pid_t = int;
#[repr(C)]
pub struct sockaddr {
pub family: sa_family_t,
data: [u8; 14],
}
#[repr(C, align(8))]
pub struct sockaddr_storage {
pub family: sa_family_t,
pub data: [u8; 128 - core::mem::size_of::<sa_family_t>()],
}
pub type socklen_t = int;
pub type uid_t = uint;
pub type gid_t = uint;
pub const SEEK_SET: int = 0;
pub const SEEK_CUR: int = 1;
pub const SEEK_END: int = 2;
pub const SEEK_DATA: int = 3;
pub const SEEK_HOLE: int = 4;
pub const O_ACCMODE: int = 0o00000003;
pub const O_RDONLY: int = 0o00000000;
pub const O_WRONLY: int = 0o00000001;
pub const O_RDWR: int = 0o00000002;
pub const O_CREAT: int = 0o00000100;
pub const O_EXCL: int = 0o00000200;
pub const O_NOCTTY: int = 0o00000400;
pub const O_TRUNC: int = 0o00001000;
pub const O_APPEND: int = 0o00002000;
pub const O_NONBLOCK: int = 0o00004000;
pub const O_DSYNC: int = 0o00010000;
pub const O_DIRECT: int = 0o00040000;
pub const O_LARGEFILE: int = 0o00100000;
pub const O_DIRECTORY: int = 0o00200000;
pub const O_NOFOLLOW: int = 0o00400000;
pub const O_NOATIME: int = 0o01000000;
pub const O_CLOEXEC: int = 0o02000000;
pub const O_SYNC: int = 0o04000000 | O_DSYNC;
pub const O_PATH: int = 0o010000000;
pub const O_TMPFILE: int = 0o020000000 | O_DIRECTORY;
pub const O_TMPFILE_MASK: int = 0o020000000 | O_DIRECTORY | O_CREAT;
pub const O_NDELAY: int = O_NONBLOCK;
pub const AT_FDCWD: int = -100;
pub const AT_EMPTY_PATH: int = 0x1000;
pub const AT_SYMLINK_NOFOLLOW: int = 0x100;
pub const AT_EACCESS: int = 0x200;
pub const AT_REMOVEDIR: int = 0x200;
pub const AT_SYMLINK_FOLLOW: int = 0x400;
pub const AT_NO_AUTOMOUNT: int = 0x800;
pub const AT_STATX_SYNC_TYPE: int = 0x6000;
pub const AT_STATX_SYNC_AS_STAT: int = 0x0000;
pub const AT_STATX_FORCE_SYNC: int = 0x2000;
pub const AT_STATX_DONT_SYNC: int = 0x4000;
pub const AT_RECURSIVE: int = 0x8000;
pub const AT_HANDLE_FID: int = AT_REMOVEDIR;
#[derive(Clone, Copy, Debug)]
#[repr(C)]
pub struct pollfd {
pub fd: int,
pub events: short,
pub revents: short,
}
pub type nfds_t = uint;
pub const POLLIN: short = 0x0001;
pub const POLLPRI: short = 0x0002;
pub const POLLOUT: short = 0x0004;
pub const POLLERR: short = 0x0008;
pub const POLLHUP: short = 0x0010;
pub const POLLNVAL: short = 0x0020;
#[derive(Clone, Copy, Debug)]
#[repr(C)]
pub struct iovec {
pub iov_base: *mut void,
pub iov_len: size_t,
}
#[derive(Clone, Copy, Debug)]
#[repr(C)]
pub struct epoll_event {
pub events: u32,
pub data: epoll_data,
}
#[derive(Clone, Copy)]
#[repr(C)]
pub union epoll_data {
pub ptr: *mut void,
pub fd: int,
pub u32: u32,
pub u64: u64,
}
impl core::fmt::Debug for epoll_data {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
f.debug_struct("epoll_data").finish_non_exhaustive()
}
}
#[derive(Clone, Copy, Debug)]
#[repr(C)]
pub struct flock {
pub l_type: short,
pub l_whence: short,
pub l_start: off_t,
pub l_len: off_t,
pub l_pid: pid_t,
}
pub type sa_family_t = ushort;
#[derive(Clone, Copy, Debug)]
#[repr(C)]
pub enum sock_type {
SOCK_STREAM = 1,
SOCK_DGRAM = 2,
SOCK_RAW = 3,
SOCK_RDM = 4,
SOCK_SEQPACKET = 5,
SOCK_DCCP = 6,
SOCK_PACKET = 10,
}
pub type time_t = long;
pub type suseconds_t = long;
#[derive(Clone, Copy, Debug)]
#[repr(C)]
pub struct timespec {
pub tv_sec: long,
pub tv_nsec: long,
}
#[derive(Clone, Copy, Debug)]
#[repr(C)]
pub struct timeval {
pub tv_sec: long,
pub tv_usec: suseconds_t,
}
#[derive(Debug)]
#[repr(C)]
pub struct linux_dirent {
pub d_ino: ulong,
pub d_off: ulong,
pub d_reclen: ushort,
pub d_name: [char],
}
pub type off64_t = longlong;
pub type ino64_t = ulonglong;
#[derive(Debug)]
#[repr(C)]
pub struct linux_dirent64 {
pub d_ino: ino64_t,
pub d_off: off64_t,
pub d_reclen: ushort,
pub d_type: uchar,
pub d_name: [char],
}
pub const DT_UNKNOWN: uchar = 0;
pub const DT_FIFO: uchar = 1;
pub const DT_CHR: uchar = 2;
pub const DT_DIR: uchar = 4;
pub const DT_BLK: uchar = 6;
pub const DT_REG: uchar = 8;
pub const DT_LNK: uchar = 10;
pub const DT_SOCK: uchar = 12;
pub const DT_WHT: uchar = 14;
#[repr(C)]
#[derive(Clone, Copy, Debug)]
pub struct statx {
pub stx_mask: u32,
pub stx_blksize: u32,
pub stx_attributes: u64,
pub stx_nlink: u32,
pub stx_uid: u32,
pub stx_gid: u32,
pub stx_mode: u16,
pub stx_ino: u64,
pub stx_size: u64,
pub stx_blocks: u64,
pub stx_attributes_mask: u64,
pub stx_atime: statx_timestamp,
pub stx_btime: statx_timestamp,
pub stx_ctime: statx_timestamp,
pub stx_mtime: statx_timestamp,
pub stx_rdev_major: u32,
pub stx_rdev_minor: u32,
pub stx_dev_major: u32,
pub stx_dev_minor: u32,
pub stx_mnt_id: u64,
pub stx_dio_mem_align: u32,
pub stx_dio_offset_align: u32,
}
#[repr(C)]
#[derive(Clone, Copy, Debug)]
pub struct statx_timestamp {
pub tv_sec: i64,
pub tv_nsec: u32,
}
pub const STATX_TYPE: u32 = 1;
pub const STATX_MODE: u32 = 2;
pub const STATX_NLINK: u32 = 4;
pub const STATX_UID: u32 = 8;
pub const STATX_GID: u32 = 0x10;
pub const STATX_ATIME: u32 = 0x20;
pub const STATX_MTIME: u32 = 0x40;
pub const STATX_CTIME: u32 = 0x80;
pub const STATX_INO: u32 = 0x100;
pub const STATX_SIZE: u32 = 0x200;
pub const STATX_BLOCKS: u32 = 0x400;
pub const STATX_BASIC_STATS: u32 = 0x7ff;
pub const STATX_BTIME: u32 = 0x800;
pub const STATX_ALL: u32 = 0xfff;
pub const STATX_ATTR_COMPRESSED: u64 = 0x4;
pub const STATX_ATTR_IMMUTABLE: u64 = 0x10;
pub const STATX_ATTR_APPEND: u64 = 0x20;
pub const STATX_ATTR_NODUMP: u64 = 0x40;
pub const STATX_ATTR_ENCRYPTED: u64 = 0x800;
pub const STATX_ATTR_AUTOMOUNT: u64 = 0x1000;
pub const STATX_ATTR_MOUNT_ROOT: u64 = 0x2000;
pub const STATX_ATTR_VERITY: u64 = 0x100000;
pub const STATX_ATTR_DAX: u64 = 0x200000;
#[derive(Clone, Copy, Debug)]
#[repr(C)]
pub struct io_uring_params {
pub sq_entries: u32,
pub cq_entries: u32,
pub flags: u32,
pub sq_thread_cpu: u32,
pub sq_thread_idle: u32,
pub features: u32,
pub wq_fd: u32,
pub resv: [u32; 3],
pub sq_off: io_sqring_offsets,
pub cq_off: io_cqring_offsets,
}
#[derive(Clone, Copy, Debug)]
#[repr(C)]
pub struct io_sqring_offsets {
pub head: u32,
pub tail: u32,
pub ring_mask: u32,
pub ring_entries: u32,
pub flags: u32,
pub dropped: u32,
pub array: u32,
pub resv: [u32; 3],
}
#[derive(Clone, Copy, Debug)]
#[repr(C)]
pub struct io_cqring_offsets {
pub head: u32,
pub tail: u32,
pub ring_mask: u32,
pub ring_entries: u32,
pub overflow: u32,
pub cqes: u32,
pub flags: u32,
pub resv: [u32; 3],
}
pub use crate::sigset::sigset_t;
#[allow(unused_imports)]
pub use crate::raw::types::*;
pub const FUTEX_WAIT: int = 0;
pub const FUTEX_WAKE: int = 1;
pub const FUTEX_FD: int = 2;
pub const FUTEX_REQUEUE: int = 3;
pub const FUTEX_CMP_REQUEUE: int = 4;
pub const FUTEX_WAKE_OP: int = 5;
pub const FUTEX_LOCK_PI: int = 6;
pub const FUTEX_UNLOCK_PI: int = 7;
pub const FUTEX_TRYLOCK_PI: int = 8;
pub const FUTEX_WAIT_BITSET: int = 9;
pub const FUTEX_PRIVATE: int = 128;
pub const FUTEX_CLOCK_REALTIME: int = 256;