summaryrefslogtreecommitdiffstats
path: root/vendor/rustix/src/backend/libc/event
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 18:31:44 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 18:31:44 +0000
commitc23a457e72abe608715ac76f076f47dc42af07a5 (patch)
tree2772049aaf84b5c9d0ed12ec8d86812f7a7904b6 /vendor/rustix/src/backend/libc/event
parentReleasing progress-linux version 1.73.0+dfsg1-1~progress7.99u1. (diff)
downloadrustc-c23a457e72abe608715ac76f076f47dc42af07a5.tar.xz
rustc-c23a457e72abe608715ac76f076f47dc42af07a5.zip
Merging upstream version 1.74.1+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/rustix/src/backend/libc/event')
-rw-r--r--vendor/rustix/src/backend/libc/event/epoll.rs26
-rw-r--r--vendor/rustix/src/backend/libc/event/mod.rs2
-rw-r--r--vendor/rustix/src/backend/libc/event/poll_fd.rs9
-rw-r--r--vendor/rustix/src/backend/libc/event/syscalls.rs26
-rw-r--r--vendor/rustix/src/backend/libc/event/types.rs22
5 files changed, 61 insertions, 24 deletions
diff --git a/vendor/rustix/src/backend/libc/event/epoll.rs b/vendor/rustix/src/backend/libc/event/epoll.rs
index c59a38cd4..a6087a167 100644
--- a/vendor/rustix/src/backend/libc/event/epoll.rs
+++ b/vendor/rustix/src/backend/libc/event/epoll.rs
@@ -92,6 +92,9 @@ bitflags! {
pub struct CreateFlags: u32 {
/// `EPOLL_CLOEXEC`
const CLOEXEC = bitcast!(c::EPOLL_CLOEXEC);
+
+ /// <https://docs.rs/bitflags/latest/bitflags/#externally-defined-flags>
+ const _ = !0;
}
}
@@ -145,6 +148,9 @@ bitflags! {
/// `EPOLLEXCLUSIVE`
#[cfg(not(target_os = "android"))]
const EXCLUSIVE = bitcast!(c::EPOLLEXCLUSIVE);
+
+ /// <https://docs.rs/bitflags/latest/bitflags/#externally-defined-flags>
+ const _ = !0;
}
}
@@ -160,11 +166,11 @@ pub fn create(flags: CreateFlags) -> io::Result<OwnedFd> {
unsafe { ret_owned_fd(c::epoll_create1(bitflags_bits!(flags))) }
}
-/// `epoll_ctl(self, EPOLL_CTL_ADD, data, event)`—Adds an element to an
-/// epoll object.
+/// `epoll_ctl(self, EPOLL_CTL_ADD, data, event)`—Adds an element to an epoll
+/// object.
///
-/// This registers interest in any of the events set in `events` occurring
-/// on the file descriptor associated with `data`.
+/// This registers interest in any of the events set in `events` occurring on
+/// the file descriptor associated with `data`.
///
/// If [`delete`] is not called on the I/O source passed into this function
/// before the I/O source is `close`d, then the `epoll` will act as if the I/O
@@ -198,8 +204,8 @@ pub fn add(
}
}
-/// `epoll_ctl(self, EPOLL_CTL_MOD, target, event)`—Modifies an element in
-/// a given epoll object.
+/// `epoll_ctl(self, EPOLL_CTL_MOD, target, event)`—Modifies an element in a
+/// given epoll object.
///
/// This sets the events of interest with `target` to `events`.
#[doc(alias = "epoll_ctl")]
@@ -229,8 +235,8 @@ pub fn modify(
}
}
-/// `epoll_ctl(self, EPOLL_CTL_DEL, target, NULL)`—Removes an element in
-/// a given epoll object.
+/// `epoll_ctl(self, EPOLL_CTL_DEL, target, NULL)`—Removes an element in a
+/// given epoll object.
#[doc(alias = "epoll_ctl")]
pub fn delete(epoll: impl AsFd, source: impl AsFd) -> io::Result<()> {
// SAFETY: We're calling `epoll_ctl` via FFI and we know how it
@@ -341,8 +347,8 @@ impl EventData {
/// Return the value as a `u64`.
///
- /// If the stored value was a pointer, the pointer is zero-extended to
- /// a `u64`.
+ /// If the stored value was a pointer, the pointer is zero-extended to a
+ /// `u64`.
#[inline]
pub fn u64(self) -> u64 {
unsafe { self.as_u64 }
diff --git a/vendor/rustix/src/backend/libc/event/mod.rs b/vendor/rustix/src/backend/libc/event/mod.rs
index 6aed4612a..44e8a090a 100644
--- a/vendor/rustix/src/backend/libc/event/mod.rs
+++ b/vendor/rustix/src/backend/libc/event/mod.rs
@@ -5,5 +5,5 @@ pub(crate) mod types;
#[cfg_attr(windows, path = "windows_syscalls.rs")]
pub(crate) mod syscalls;
-#[cfg(linux_kernel)]
+#[cfg(all(feature = "alloc", linux_kernel))]
pub mod epoll;
diff --git a/vendor/rustix/src/backend/libc/event/poll_fd.rs b/vendor/rustix/src/backend/libc/event/poll_fd.rs
index a06812aaa..3f795d5aa 100644
--- a/vendor/rustix/src/backend/libc/event/poll_fd.rs
+++ b/vendor/rustix/src/backend/libc/event/poll_fd.rs
@@ -47,6 +47,9 @@ bitflags! {
not(any(target_arch = "sparc", target_arch = "sparc64"))),
)]
const RDHUP = c::POLLRDHUP;
+
+ /// <https://docs.rs/bitflags/latest/bitflags/#externally-defined-flags>
+ const _ = !0;
}
}
@@ -112,7 +115,7 @@ impl<'fd> PollFd<'fd> {
/// Returns the ready events.
#[inline]
pub fn revents(&self) -> PollFlags {
- // Use `unwrap()` here because in theory we know we know all the bits
+ // Use `.unwrap()` here because in theory we know we know all the bits
// the OS might set here, but OS's have added extensions in the past.
PollFlags::from_bits(self.pollfd.revents).unwrap()
}
@@ -123,7 +126,7 @@ impl<'fd> AsFd for PollFd<'fd> {
#[inline]
fn as_fd(&self) -> BorrowedFd<'_> {
// SAFETY: Our constructors and `set_fd` require `pollfd.fd` to be
- // valid for the `fd lifetime.
+ // valid for the `'fd` lifetime.
unsafe { BorrowedFd::borrow_raw(self.pollfd.fd) }
}
}
@@ -133,7 +136,7 @@ impl<'fd> AsSocket for PollFd<'fd> {
#[inline]
fn as_socket(&self) -> BorrowedFd<'_> {
// SAFETY: Our constructors and `set_fd` require `pollfd.fd` to be
- // valid for the `fd lifetime.
+ // valid for the `'fd` lifetime.
unsafe { BorrowedFd::borrow_raw(self.pollfd.fd as RawFd) }
}
}
diff --git a/vendor/rustix/src/backend/libc/event/syscalls.rs b/vendor/rustix/src/backend/libc/event/syscalls.rs
index eac88d4bb..f2dcdf5ad 100644
--- a/vendor/rustix/src/backend/libc/event/syscalls.rs
+++ b/vendor/rustix/src/backend/libc/event/syscalls.rs
@@ -5,7 +5,7 @@ use crate::backend::conv::ret_c_int;
#[cfg(any(apple, netbsdlike, target_os = "dragonfly", target_os = "solaris"))]
use crate::backend::conv::ret_owned_fd;
use crate::event::PollFd;
-#[cfg(any(linux_kernel, bsd, solarish))]
+#[cfg(any(linux_kernel, bsd, solarish, target_os = "espidf"))]
use crate::fd::OwnedFd;
use crate::io;
#[cfg(any(bsd, solarish))]
@@ -15,12 +15,22 @@ use {
crate::backend::conv::ret, crate::event::port::Event, crate::utils::as_mut_ptr,
core::ptr::null_mut,
};
-#[cfg(any(linux_kernel, target_os = "freebsd", target_os = "illumos"))]
+#[cfg(any(
+ linux_kernel,
+ target_os = "freebsd",
+ target_os = "illumos",
+ target_os = "espidf"
+))]
use {crate::backend::conv::ret_owned_fd, crate::event::EventfdFlags};
-#[cfg(bsd)]
+#[cfg(all(feature = "alloc", bsd))]
use {crate::event::kqueue::Event, crate::utils::as_ptr, core::ptr::null};
-#[cfg(any(linux_kernel, target_os = "freebsd", target_os = "illumos"))]
+#[cfg(any(
+ linux_kernel,
+ target_os = "freebsd",
+ target_os = "illumos",
+ target_os = "espidf"
+))]
pub(crate) fn eventfd(initval: u32, flags: EventfdFlags) -> io::Result<OwnedFd> {
#[cfg(linux_kernel)]
unsafe {
@@ -45,18 +55,18 @@ pub(crate) fn eventfd(initval: u32, flags: EventfdFlags) -> io::Result<OwnedFd>
ret_owned_fd(eventfd(initval, bitflags_bits!(flags)))
}
- #[cfg(target_os = "illumos")]
+ #[cfg(any(target_os = "illumos", target_os = "espidf"))]
unsafe {
ret_owned_fd(c::eventfd(initval, bitflags_bits!(flags)))
}
}
-#[cfg(bsd)]
+#[cfg(all(feature = "alloc", bsd))]
pub(crate) fn kqueue() -> io::Result<OwnedFd> {
unsafe { ret_owned_fd(c::kqueue()) }
}
-#[cfg(bsd)]
+#[cfg(all(feature = "alloc", bsd))]
pub(crate) unsafe fn kevent(
kq: BorrowedFd<'_>,
changelist: &[Event],
@@ -137,7 +147,7 @@ pub(crate) fn port_get(
Ok(Event(unsafe { event.assume_init() }))
}
-#[cfg(solarish)]
+#[cfg(all(feature = "alloc", solarish))]
pub(crate) fn port_getn(
port: BorrowedFd<'_>,
timeout: Option<&mut c::timespec>,
diff --git a/vendor/rustix/src/backend/libc/event/types.rs b/vendor/rustix/src/backend/libc/event/types.rs
index 632b1be63..af052a434 100644
--- a/vendor/rustix/src/backend/libc/event/types.rs
+++ b/vendor/rustix/src/backend/libc/event/types.rs
@@ -1,7 +1,19 @@
#[cfg(any(linux_kernel, target_os = "freebsd", target_os = "illumos"))]
-use {crate::backend::c, bitflags::bitflags};
+use crate::backend::c;
+#[cfg(any(
+ linux_kernel,
+ target_os = "freebsd",
+ target_os = "illumos",
+ target_os = "espidf"
+))]
+use bitflags::bitflags;
-#[cfg(any(linux_kernel, target_os = "freebsd", target_os = "illumos"))]
+#[cfg(any(
+ linux_kernel,
+ target_os = "freebsd",
+ target_os = "illumos",
+ target_os = "espidf"
+))]
bitflags! {
/// `EFD_*` flags for use with [`eventfd`].
///
@@ -10,10 +22,16 @@ bitflags! {
#[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
pub struct EventfdFlags: u32 {
/// `EFD_CLOEXEC`
+ #[cfg(not(target_os = "espidf"))]
const CLOEXEC = bitcast!(c::EFD_CLOEXEC);
/// `EFD_NONBLOCK`
+ #[cfg(not(target_os = "espidf"))]
const NONBLOCK = bitcast!(c::EFD_NONBLOCK);
/// `EFD_SEMAPHORE`
+ #[cfg(not(target_os = "espidf"))]
const SEMAPHORE = bitcast!(c::EFD_SEMAPHORE);
+
+ /// <https://docs.rs/bitflags/latest/bitflags/#externally-defined-flags>
+ const _ = !0;
}
}