From f6ef35da61b49ccbd9920ed86200c27124471f41 Mon Sep 17 00:00:00 2001 From: auronandace Date: Sat, 23 May 2026 13:48:37 +0100 Subject: [PATCH] move sys_epoll constants and add some descriptions --- src/header/sys_epoll/cbindgen.toml | 2 +- src/header/sys_epoll/linux.rs | 20 ------------- src/header/sys_epoll/mod.rs | 45 ++++++++++++++++++++++++++---- src/header/sys_epoll/redox.rs | 20 ------------- 4 files changed, 40 insertions(+), 47 deletions(-) delete mode 100644 src/header/sys_epoll/linux.rs delete mode 100644 src/header/sys_epoll/redox.rs diff --git a/src/header/sys_epoll/cbindgen.toml b/src/header/sys_epoll/cbindgen.toml index 64ce6c75b7..dd614aaac1 100644 --- a/src/header/sys_epoll/cbindgen.toml +++ b/src/header/sys_epoll/cbindgen.toml @@ -1,5 +1,5 @@ sys_includes = ["signal.h"] -include_guard = "_SYS_EPOLL_H" +include_guard = "_RELIBC_SYS_EPOLL_H" language = "C" style = "Tag" no_includes = true diff --git a/src/header/sys_epoll/linux.rs b/src/header/sys_epoll/linux.rs deleted file mode 100644 index 89b5365017..0000000000 --- a/src/header/sys_epoll/linux.rs +++ /dev/null @@ -1,20 +0,0 @@ -use crate::platform::types::{c_int, c_uint}; - -pub const EPOLL_CLOEXEC: c_int = 0x8_0000; - -pub const EPOLLIN: c_uint = 0x001; -pub const EPOLLPRI: c_uint = 0x002; -pub const EPOLLOUT: c_uint = 0x004; -pub const EPOLLERR: c_uint = 0x008; -pub const EPOLLHUP: c_uint = 0x010; -pub const EPOLLNVAL: c_uint = 0x020; -pub const EPOLLRDNORM: c_uint = 0x040; -pub const EPOLLRDBAND: c_uint = 0x080; -pub const EPOLLWRNORM: c_uint = 0x100; -pub const EPOLLWRBAND: c_uint = 0x200; -pub const EPOLLMSG: c_uint = 0x400; -pub const EPOLLRDHUP: c_uint = 0x2000; -pub const EPOLLEXCLUSIVE: c_uint = 1 << 28; -pub const EPOLLWAKEUP: c_uint = 1 << 29; -pub const EPOLLONESHOT: c_uint = 1 << 30; -pub const EPOLLET: c_uint = 1 << 31; diff --git a/src/header/sys_epoll/mod.rs b/src/header/sys_epoll/mod.rs index 6b95726506..64b126fe0f 100644 --- a/src/header/sys_epoll/mod.rs +++ b/src/header/sys_epoll/mod.rs @@ -13,18 +13,51 @@ use crate::{ }, }; -pub use self::sys::*; - +/// Set the close-on-exec (`FD_CLOEXEC`) flag on the new file descriptor. #[cfg(target_os = "linux")] -#[path = "linux.rs"] -pub mod sys; +pub const EPOLL_CLOEXEC: c_int = 0x8_0000; +/// Set the close-on-exec (`FD_CLOEXEC`) flag on the new file descriptor. #[cfg(target_os = "redox")] -#[path = "redox.rs"] -pub mod sys; +pub const EPOLL_CLOEXEC: c_int = 0x0100_0000; +/// The associated file is available for read operations. +pub const EPOLLIN: c_uint = 0x001; +/// There is an exceptional condition on the file descriptor. +pub const EPOLLPRI: c_uint = 0x002; +/// The associated file is available for write operations. +pub const EPOLLOUT: c_uint = 0x004; +/// Error condition happened on the associated file descriptor. +pub const EPOLLERR: c_uint = 0x008; +/// Hang up happened onthe associated file descriptor. +pub const EPOLLHUP: c_uint = 0x010; +pub const EPOLLNVAL: c_uint = 0x020; +pub const EPOLLRDNORM: c_uint = 0x040; +pub const EPOLLRDBAND: c_uint = 0x080; +pub const EPOLLWRNORM: c_uint = 0x100; +pub const EPOLLWRBAND: c_uint = 0x200; +pub const EPOLLMSG: c_uint = 0x400; +/// Stream socket peer closed connection, or shut down writing half of +/// connection. +pub const EPOLLRDHUP: c_uint = 0x2000; +/// Sets an exclusive wakeup mode for the epoll file descriptor that is being +/// attached to the target file descriptor, `fd`. +pub const EPOLLEXCLUSIVE: c_uint = 1 << 28; +/// If `EPOLLONESHOT` and `EPOLLET` are clear and the process has the +/// `CAP_BLOCK_SUSPEND` capability, ensure that the system does not enter +/// "suspend" or "hibernate" while this event is pending or being processed. +pub const EPOLLWAKEUP: c_uint = 1 << 29; +/// Requests one-shot notification for the associated file descriptor. +pub const EPOLLONESHOT: c_uint = 1 << 30; +/// Requests edge-triggered notification for the associated file descriptor. +pub const EPOLLET: c_uint = 1 << 31; + +/// Add an entry to the interest list of the epoll file descriptor, `epfd`. pub const EPOLL_CTL_ADD: c_int = 1; +/// Remove (deregister) the target file descriptor `fd` from the interest list. pub const EPOLL_CTL_DEL: c_int = 2; +/// Change the settings associated with `fd` in the interest list to the new +/// settings specified in `event`. pub const EPOLL_CTL_MOD: c_int = 3; /// Non-POSIX, see . diff --git a/src/header/sys_epoll/redox.rs b/src/header/sys_epoll/redox.rs deleted file mode 100644 index dfaf15fd6d..0000000000 --- a/src/header/sys_epoll/redox.rs +++ /dev/null @@ -1,20 +0,0 @@ -use crate::platform::types::{c_int, c_uint}; - -pub const EPOLL_CLOEXEC: c_int = 0x0100_0000; - -pub const EPOLLIN: c_uint = 0x001; -pub const EPOLLPRI: c_uint = 0x002; -pub const EPOLLOUT: c_uint = 0x004; -pub const EPOLLERR: c_uint = 0x008; -pub const EPOLLHUP: c_uint = 0x010; -pub const EPOLLNVAL: c_uint = 0x020; -pub const EPOLLRDNORM: c_uint = 0x040; -pub const EPOLLRDBAND: c_uint = 0x080; -pub const EPOLLWRNORM: c_uint = 0x100; -pub const EPOLLWRBAND: c_uint = 0x200; -pub const EPOLLMSG: c_uint = 0x400; -pub const EPOLLRDHUP: c_uint = 0x2000; -pub const EPOLLEXCLUSIVE: c_uint = 1 << 28; -pub const EPOLLWAKEUP: c_uint = 1 << 29; -pub const EPOLLONESHOT: c_uint = 1 << 30; -pub const EPOLLET: c_uint = 1 << 31;