#![allow(clippy::uninlined_format_args)]
use crate::{poll_t, O_CLOEXEC};
pub const EPOLL_CLOEXEC: i32 = O_CLOEXEC;
pub const EPOLL_CTL_ADD: i32 = 1;
pub const EPOLL_CTL_DEL: i32 = 2;
pub const EPOLL_CTL_MOD: i32 = 3;
pub const EPOLLIN: poll_t = 0x0000_0001;
pub const EPOLLPRI: poll_t = 0x0000_0002;
pub const EPOLLOUT: poll_t = 0x0000_0004;
pub const EPOLLERR: poll_t = 0x0000_0008;
pub const EPOLLHUP: poll_t = 0x0000_0010;
pub const EPOLLNVAL: poll_t = 0x0000_0020;
pub const EPOLLRDNORM: poll_t = 0x0000_0040;
pub const EPOLLRDBAND: poll_t = 0x0000_0080;
pub const EPOLLWRNORM: poll_t = 0x0000_0100;
pub const EPOLLWRBAND: poll_t = 0x0000_0200;
pub const EPOLLMSG: poll_t = 0x0000_0400;
pub const EPOLLRDHUP: poll_t = 0x0000_2000;
pub const EPOLLEXCLUSIVE: poll_t = 1 << 28;
pub const EPOLLWAKEUP: poll_t = 1 << 29;
pub const EPOLLONESHOT: poll_t = 1 << 30;
pub const EPOLLET: poll_t = 1 << 31;
#[repr(C)]
#[derive(Clone, Copy)]
pub union epoll_data_t {
pub ptr: usize,
pub fd: i32,
pub v_u32: u32,
pub v_u64: u64,
}
impl core::fmt::Debug for epoll_data_t {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
let val: u64 = unsafe { self.v_u64 };
write!(f, "epoll_data: {}", val)
}
}
impl Default for epoll_data_t {
fn default() -> Self {
Self { ptr: 0 }
}
}
#[repr(C)]
#[derive(Debug, Default, Clone, Copy)]
pub struct epoll_event_t {
pub events: poll_t,
pub data: epoll_data_t,
}