Rename Poller to PollHandle

This commit is contained in:
Ruihan Li
2024-10-24 17:45:47 +08:00
committed by Tate, Hongliang Tian
parent 44b55f2ccf
commit f12e502ab0
35 changed files with 85 additions and 81 deletions

View File

@ -7,7 +7,7 @@ use crate::{
events::IoEvents,
fs::inode_handle::FileIo,
prelude::*,
process::signal::{Pollable, Poller},
process::signal::{PollHandle, Pollable},
};
pub struct Null;
@ -28,7 +28,7 @@ impl Device for Null {
}
impl Pollable for Null {
fn poll(&self, mask: IoEvents, poller: Option<&mut Poller>) -> IoEvents {
fn poll(&self, mask: IoEvents, poller: Option<&mut PollHandle>) -> IoEvents {
let events = IoEvents::IN | IoEvents::OUT;
events & mask
}

View File

@ -16,7 +16,7 @@ use crate::{
get_current_userspace,
prelude::*,
process::{
signal::{Pollable, Pollee, Poller},
signal::{PollHandle, Pollable, Pollee},
JobControl, Terminal,
},
util::ring_buffer::RingBuffer,
@ -67,7 +67,11 @@ impl PtyMaster {
self.update_state(&input);
}
pub(super) fn slave_poll(&self, mask: IoEvents, mut poller: Option<&mut Poller>) -> IoEvents {
pub(super) fn slave_poll(
&self,
mask: IoEvents,
mut poller: Option<&mut PollHandle>,
) -> IoEvents {
let mut poll_status = IoEvents::empty();
let poll_in_mask = mask & IoEvents::IN;
@ -112,7 +116,7 @@ impl PtyMaster {
}
impl Pollable for PtyMaster {
fn poll(&self, mask: IoEvents, mut poller: Option<&mut Poller>) -> IoEvents {
fn poll(&self, mask: IoEvents, mut poller: Option<&mut PollHandle>) -> IoEvents {
let mut poll_status = IoEvents::empty();
let poll_in_mask = mask & IoEvents::IN;
@ -322,7 +326,7 @@ impl Terminal for PtySlave {
}
impl Pollable for PtySlave {
fn poll(&self, mask: IoEvents, poller: Option<&mut Poller>) -> IoEvents {
fn poll(&self, mask: IoEvents, poller: Option<&mut PollHandle>) -> IoEvents {
self.master().slave_poll(mask, poller)
}
}

View File

@ -9,7 +9,7 @@ use crate::{
inode_handle::FileIo,
},
prelude::*,
process::signal::{Pollable, Poller},
process::signal::{PollHandle, Pollable},
util::random::getrandom,
};
@ -38,7 +38,7 @@ impl Device for Random {
}
impl Pollable for Random {
fn poll(&self, mask: IoEvents, poller: Option<&mut Poller>) -> IoEvents {
fn poll(&self, mask: IoEvents, poller: Option<&mut PollHandle>) -> IoEvents {
let events = IoEvents::IN | IoEvents::OUT;
events & mask
}

View File

@ -8,7 +8,7 @@ use crate::{
error::Error,
events::IoEvents,
fs::{inode_handle::FileIo, utils::IoctlCmd},
process::signal::{Pollable, Poller},
process::signal::{PollHandle, Pollable},
};
const TDX_REPORTDATA_LEN: usize = 64;
@ -58,7 +58,7 @@ impl From<TdCallError> for Error {
}
impl Pollable for TdxGuest {
fn poll(&self, mask: IoEvents, _poller: Option<&mut Poller>) -> IoEvents {
fn poll(&self, mask: IoEvents, _poller: Option<&mut PollHandle>) -> IoEvents {
let events = IoEvents::IN | IoEvents::OUT;
events & mask
}

View File

@ -9,7 +9,7 @@ use crate::{
inode_handle::FileIo,
},
prelude::*,
process::signal::{Pollable, Poller},
process::signal::{PollHandle, Pollable},
};
/// Corresponds to `/dev/tty` in the file system. This device represents the controlling terminal
@ -41,7 +41,7 @@ impl Device for TtyDevice {
}
impl Pollable for TtyDevice {
fn poll(&self, mask: IoEvents, poller: Option<&mut Poller>) -> IoEvents {
fn poll(&self, mask: IoEvents, poller: Option<&mut PollHandle>) -> IoEvents {
IoEvents::empty()
}
}

View File

@ -16,7 +16,7 @@ use crate::{
process::signal::{
constants::{SIGINT, SIGQUIT},
signals::kernel::KernelSignal,
Pollable, Pollee, Poller,
PollHandle, Pollable, Pollee,
},
thread::work_queue::{submit_work_item, work_item::WorkItem, WorkPriority},
util::ring_buffer::RingBuffer,
@ -88,7 +88,7 @@ impl CurrentLine {
}
impl Pollable for LineDiscipline {
fn poll(&self, mask: IoEvents, poller: Option<&mut Poller>) -> IoEvents {
fn poll(&self, mask: IoEvents, poller: Option<&mut PollHandle>) -> IoEvents {
self.pollee.poll(mask, poller)
}
}

View File

@ -16,7 +16,7 @@ use crate::{
get_current_userspace,
prelude::*,
process::{
signal::{signals::kernel::KernelSignal, Pollable, Poller},
signal::{signals::kernel::KernelSignal, PollHandle, Pollable},
JobControl, Process, Terminal,
},
};
@ -73,7 +73,7 @@ impl Tty {
}
impl Pollable for Tty {
fn poll(&self, mask: IoEvents, poller: Option<&mut Poller>) -> IoEvents {
fn poll(&self, mask: IoEvents, poller: Option<&mut PollHandle>) -> IoEvents {
self.ldisc.poll(mask, poller)
}
}

View File

@ -9,7 +9,7 @@ use crate::{
inode_handle::FileIo,
},
prelude::*,
process::signal::{Pollable, Poller},
process::signal::{PollHandle, Pollable},
util::random::getrandom,
};
@ -38,7 +38,7 @@ impl Device for Urandom {
}
impl Pollable for Urandom {
fn poll(&self, mask: IoEvents, poller: Option<&mut Poller>) -> IoEvents {
fn poll(&self, mask: IoEvents, poller: Option<&mut PollHandle>) -> IoEvents {
let events = IoEvents::IN | IoEvents::OUT;
events & mask
}

View File

@ -7,7 +7,7 @@ use crate::{
events::IoEvents,
fs::inode_handle::FileIo,
prelude::*,
process::signal::{Pollable, Poller},
process::signal::{PollHandle, Pollable},
};
pub struct Zero;
@ -28,7 +28,7 @@ impl Device for Zero {
}
impl Pollable for Zero {
fn poll(&self, mask: IoEvents, poller: Option<&mut Poller>) -> IoEvents {
fn poll(&self, mask: IoEvents, poller: Option<&mut PollHandle>) -> IoEvents {
let events = IoEvents::IN | IoEvents::OUT;
events & mask
}

View File

@ -7,7 +7,7 @@ use super::*;
use crate::{
events::IoEvents,
fs::inode_handle::FileIo,
process::signal::{Pollable, Poller},
process::signal::{PollHandle, Pollable},
};
/// Same major number with Linux.
@ -182,7 +182,7 @@ impl Device for Inner {
}
impl Pollable for Inner {
fn poll(&self, mask: IoEvents, poller: Option<&mut Poller>) -> IoEvents {
fn poll(&self, mask: IoEvents, poller: Option<&mut PollHandle>) -> IoEvents {
IoEvents::empty()
}
}

View File

@ -8,7 +8,7 @@ use crate::{
device::PtySlave,
events::IoEvents,
fs::inode_handle::FileIo,
process::signal::{Pollable, Poller},
process::signal::{PollHandle, Pollable},
};
/// Same major number with Linux, the minor number is the index of slave.
@ -136,7 +136,7 @@ impl Inode for PtySlaveInode {
self.device.ioctl(cmd, arg)
}
fn poll(&self, mask: IoEvents, poller: Option<&mut Poller>) -> IoEvents {
fn poll(&self, mask: IoEvents, poller: Option<&mut PollHandle>) -> IoEvents {
self.device.poll(mask, poller)
}

View File

@ -16,7 +16,7 @@ use crate::{
file_handle::FileLike,
utils::{InodeMode, IoctlCmd, Metadata},
},
process::signal::{Pollable, Pollee, Poller},
process::signal::{PollHandle, Pollable, Pollee},
};
/// A file-like object that provides epoll API.
@ -326,7 +326,7 @@ impl EpollFile {
}
impl Pollable for EpollFile {
fn poll(&self, mask: IoEvents, poller: Option<&mut Poller>) -> IoEvents {
fn poll(&self, mask: IoEvents, poller: Option<&mut PollHandle>) -> IoEvents {
self.pollee.poll(mask, poller)
}
}

View File

@ -35,7 +35,7 @@ use crate::{
},
},
prelude::*,
process::{signal::Poller, Gid, Uid},
process::{signal::PollHandle, Gid, Uid},
vm::vmo::Vmo,
};
@ -1695,7 +1695,7 @@ impl Inode for ExfatInode {
Ok(())
}
fn poll(&self, mask: IoEvents, _poller: Option<&mut Poller>) -> IoEvents {
fn poll(&self, mask: IoEvents, _poller: Option<&mut PollHandle>) -> IoEvents {
let events = IoEvents::IN | IoEvents::OUT;
events & mask
}

View File

@ -77,7 +77,7 @@ impl Clone for InodeHandle<Rights> {
#[inherit_methods(from = "self.0")]
impl Pollable for InodeHandle<Rights> {
fn poll(&self, mask: IoEvents, poller: Option<&mut Poller>) -> IoEvents;
fn poll(&self, mask: IoEvents, poller: Option<&mut PollHandle>) -> IoEvents;
}
#[inherit_methods(from = "self.0")]

View File

@ -26,7 +26,7 @@ use crate::{
},
prelude::*,
process::{
signal::{Pollable, Poller},
signal::{PollHandle, Pollable},
Gid, Uid,
},
};
@ -189,7 +189,7 @@ impl InodeHandle_ {
Ok(read_cnt)
}
fn poll(&self, mask: IoEvents, poller: Option<&mut Poller>) -> IoEvents {
fn poll(&self, mask: IoEvents, poller: Option<&mut PollHandle>) -> IoEvents {
if let Some(ref file_io) = self.file_io {
return file_io.poll(mask, poller);
}

View File

@ -8,7 +8,7 @@ use super::{
use crate::{
events::IoEvents,
prelude::*,
process::signal::{Pollable, Poller},
process::signal::{PollHandle, Pollable},
};
pub struct NamedPipe {
@ -31,7 +31,7 @@ impl NamedPipe {
}
impl Pollable for NamedPipe {
fn poll(&self, _mask: IoEvents, _poller: Option<&mut Poller>) -> IoEvents {
fn poll(&self, _mask: IoEvents, _poller: Option<&mut PollHandle>) -> IoEvents {
warn!("Named pipe doesn't support poll now, return IoEvents::empty for now.");
IoEvents::empty()
}

View File

@ -10,7 +10,7 @@ use crate::{
events::{IoEvents, Observer},
prelude::*,
process::{
signal::{Pollable, Poller},
signal::{PollHandle, Pollable},
Gid, Uid,
},
time::clocks::RealTimeCoarseClock,
@ -53,7 +53,7 @@ impl PipeReader {
}
impl Pollable for PipeReader {
fn poll(&self, mask: IoEvents, poller: Option<&mut Poller>) -> IoEvents {
fn poll(&self, mask: IoEvents, poller: Option<&mut PollHandle>) -> IoEvents {
self.consumer.poll(mask, poller)
}
}
@ -138,7 +138,7 @@ impl PipeWriter {
}
impl Pollable for PipeWriter {
fn poll(&self, mask: IoEvents, poller: Option<&mut Poller>) -> IoEvents {
fn poll(&self, mask: IoEvents, poller: Option<&mut PollHandle>) -> IoEvents {
self.producer.poll(mask, poller)
}
}

View File

@ -28,7 +28,7 @@ use crate::{
},
},
prelude::*,
process::{signal::Poller, Gid, Uid},
process::{signal::PollHandle, Gid, Uid},
time::clocks::RealTimeCoarseClock,
vm::vmo::Vmo,
};
@ -1120,7 +1120,7 @@ impl Inode for RamInode {
}
}
fn poll(&self, mask: IoEvents, poller: Option<&mut Poller>) -> IoEvents {
fn poll(&self, mask: IoEvents, poller: Option<&mut PollHandle>) -> IoEvents {
if !self.typ.is_device() {
return (IoEvents::IN | IoEvents::OUT) & mask;
}

View File

@ -8,7 +8,7 @@ use aster_rights_proc::require;
use crate::{
events::{IoEvents, Observer},
prelude::*,
process::signal::{Pollee, Poller},
process::signal::{PollHandle, Pollee},
util::{
ring_buffer::{RbConsumer, RbProducer, RingBuffer},
MultiRead, MultiWrite,
@ -82,7 +82,7 @@ macro_rules! impl_common_methods_for_channel {
self.0.common.is_shutdown()
}
pub fn poll(&self, mask: IoEvents, poller: Option<&mut Poller>) -> IoEvents {
pub fn poll(&self, mask: IoEvents, poller: Option<&mut PollHandle>) -> IoEvents {
self.this_end().pollee.poll(mask, poller)
}

View File

@ -12,7 +12,7 @@ use crate::{
events::IoEvents,
fs::device::{Device, DeviceType},
prelude::*,
process::{signal::Poller, Gid, Uid},
process::{signal::PollHandle, Gid, Uid},
time::clocks::RealTimeCoarseClock,
vm::vmo::Vmo,
};
@ -398,7 +398,7 @@ pub trait Inode: Any + Sync + Send {
return_errno!(Errno::EOPNOTSUPP);
}
fn poll(&self, mask: IoEvents, _poller: Option<&mut Poller>) -> IoEvents {
fn poll(&self, mask: IoEvents, _poller: Option<&mut PollHandle>) -> IoEvents {
let events = IoEvents::IN | IoEvents::OUT;
events & mask
}

View File

@ -26,7 +26,7 @@ use crate::{
},
},
prelude::*,
process::signal::{Pollable, Pollee, Poller},
process::signal::{PollHandle, Pollable, Pollee},
util::{MultiRead, MultiWrite},
};
@ -209,7 +209,7 @@ impl DatagramSocket {
}
impl Pollable for DatagramSocket {
fn poll(&self, mask: IoEvents, poller: Option<&mut Poller>) -> IoEvents {
fn poll(&self, mask: IoEvents, poller: Option<&mut PollHandle>) -> IoEvents {
self.pollee.poll(mask, poller)
}
}

View File

@ -32,7 +32,7 @@ use crate::{
},
},
prelude::*,
process::signal::{Pollable, Pollee, Poller},
process::signal::{PollHandle, Pollable, Pollee},
util::{MultiRead, MultiWrite},
};
@ -376,7 +376,7 @@ impl StreamSocket {
}
impl Pollable for StreamSocket {
fn poll(&self, mask: IoEvents, poller: Option<&mut Poller>) -> IoEvents {
fn poll(&self, mask: IoEvents, poller: Option<&mut PollHandle>) -> IoEvents {
self.pollee.poll(mask, poller)
}
}

View File

@ -12,7 +12,7 @@ use crate::{
SockShutdownCmd,
},
prelude::*,
process::signal::{Pollee, Poller},
process::signal::{PollHandle, Pollee},
util::{MultiRead, MultiWrite},
};
@ -89,7 +89,7 @@ impl Connected {
}
}
pub(super) fn poll(&self, mask: IoEvents, mut poller: Option<&mut Poller>) -> IoEvents {
pub(super) fn poll(&self, mask: IoEvents, mut poller: Option<&mut PollHandle>) -> IoEvents {
// Note that `mask | IoEvents::ALWAYS_POLL` contains all the events we care about.
let reader_events = self.reader.poll(mask, poller.as_deref_mut());
let writer_events = self.writer.poll(mask, poller);

View File

@ -13,7 +13,7 @@ use crate::{
SockShutdownCmd,
},
prelude::*,
process::signal::{Pollee, Poller},
process::signal::{PollHandle, Pollee},
};
pub(super) struct Init {
@ -112,7 +112,7 @@ impl Init {
self.addr.as_ref()
}
pub(super) fn poll(&self, mask: IoEvents, mut poller: Option<&mut Poller>) -> IoEvents {
pub(super) fn poll(&self, mask: IoEvents, mut poller: Option<&mut PollHandle>) -> IoEvents {
// To avoid loss of events, this must be compatible with
// `Connected::poll`/`Listener::poll`.
let reader_events = self.reader_pollee.poll(mask, poller.as_deref_mut());

View File

@ -17,7 +17,7 @@ use crate::{
SockShutdownCmd, SocketAddr,
},
prelude::*,
process::signal::{Pollee, Poller},
process::signal::{PollHandle, Pollee},
};
pub(super) struct Listener {
@ -78,7 +78,7 @@ impl Listener {
}
}
pub(super) fn poll(&self, mask: IoEvents, mut poller: Option<&mut Poller>) -> IoEvents {
pub(super) fn poll(&self, mask: IoEvents, mut poller: Option<&mut PollHandle>) -> IoEvents {
let reader_events = self.backlog.poll(mask, poller.as_deref_mut());
let writer_events = self.writer_pollee.poll(mask, poller);
@ -226,7 +226,7 @@ impl Backlog {
self.wait_queue.wake_all();
}
fn poll(&self, mask: IoEvents, poller: Option<&mut Poller>) -> IoEvents {
fn poll(&self, mask: IoEvents, poller: Option<&mut PollHandle>) -> IoEvents {
self.pollee.poll(mask, poller)
}

View File

@ -21,7 +21,7 @@ use crate::{
SockShutdownCmd, Socket,
},
prelude::*,
process::signal::{Pollable, Poller},
process::signal::{PollHandle, Pollable},
util::{MultiRead, MultiWrite},
};
@ -153,7 +153,7 @@ impl UnixStreamSocket {
}
impl Pollable for UnixStreamSocket {
fn poll(&self, mask: IoEvents, poller: Option<&mut Poller>) -> IoEvents {
fn poll(&self, mask: IoEvents, poller: Option<&mut PollHandle>) -> IoEvents {
let inner = self.state.read();
match inner.as_ref() {
State::Init(init) => init.poll(mask, poller),

View File

@ -10,7 +10,7 @@ use crate::{
SendRecvFlags, SockShutdownCmd,
},
prelude::*,
process::signal::{Pollee, Poller},
process::signal::{PollHandle, Pollee},
util::{ring_buffer::RingBuffer, MultiRead, MultiWrite},
};
@ -126,7 +126,7 @@ impl Connected {
.set_peer_requested_shutdown()
}
pub fn poll(&self, mask: IoEvents, poller: Option<&mut Poller>) -> IoEvents {
pub fn poll(&self, mask: IoEvents, poller: Option<&mut PollHandle>) -> IoEvents {
self.pollee.poll(mask, poller)
}

View File

@ -7,7 +7,7 @@ use crate::{
events::IoEvents,
net::socket::vsock::{addr::VsockSocketAddr, VSOCK_GLOBAL},
prelude::*,
process::signal::{Pollee, Poller},
process::signal::{PollHandle, Pollee},
};
pub struct Connecting {
@ -45,7 +45,7 @@ impl Connecting {
self.info.disable_irq().lock().update_for_event(event)
}
pub fn poll(&self, mask: IoEvents, poller: Option<&mut Poller>) -> IoEvents {
pub fn poll(&self, mask: IoEvents, poller: Option<&mut PollHandle>) -> IoEvents {
self.pollee.poll(mask, poller)
}

View File

@ -7,7 +7,7 @@ use crate::{
VSOCK_GLOBAL,
},
prelude::*,
process::signal::{Pollee, Poller},
process::signal::{PollHandle, Pollee},
};
pub struct Init {
@ -61,7 +61,7 @@ impl Init {
*self.bound_addr.lock()
}
pub fn poll(&self, mask: IoEvents, poller: Option<&mut Poller>) -> IoEvents {
pub fn poll(&self, mask: IoEvents, poller: Option<&mut PollHandle>) -> IoEvents {
self.pollee.poll(mask, poller)
}
}

View File

@ -5,7 +5,7 @@ use crate::{
events::IoEvents,
net::socket::vsock::addr::VsockSocketAddr,
prelude::*,
process::signal::{Pollee, Poller},
process::signal::{PollHandle, Pollee},
};
pub struct Listen {
addr: VsockSocketAddr,
@ -51,7 +51,7 @@ impl Listen {
Ok(connection)
}
pub fn poll(&self, mask: IoEvents, poller: Option<&mut Poller>) -> IoEvents {
pub fn poll(&self, mask: IoEvents, poller: Option<&mut PollHandle>) -> IoEvents {
self.pollee.poll(mask, poller)
}

View File

@ -14,7 +14,7 @@ use crate::{
MessageHeader, SendRecvFlags, SockShutdownCmd, Socket, SocketAddr,
},
prelude::*,
process::signal::{Pollable, Poller},
process::signal::{PollHandle, Pollable},
util::{MultiRead, MultiWrite},
};
@ -131,7 +131,7 @@ impl VsockStreamSocket {
}
impl Pollable for VsockStreamSocket {
fn poll(&self, mask: IoEvents, poller: Option<&mut Poller>) -> IoEvents {
fn poll(&self, mask: IoEvents, poller: Option<&mut PollHandle>) -> IoEvents {
match &*self.status.read() {
Status::Init(init) => init.poll(mask, poller),
Status::Listen(listen) => listen.poll(mask, poller),
@ -231,7 +231,7 @@ impl Socket for VsockStreamSocket {
vsockspace.request(&connecting.info()).unwrap();
// wait for response from driver
// TODO: Add timeout
let mut poller = Poller::new();
let mut poller = PollHandle::new();
if !connecting
.poll(IoEvents::IN, Some(&mut poller))
.contains(IoEvents::IN)

View File

@ -20,7 +20,7 @@ use c_types::{siginfo_t, ucontext_t};
pub use events::{SigEvents, SigEventsFilter};
use ostd::{cpu::UserContext, user::UserContextApi};
pub use pause::{with_signal_blocked, Pause};
pub use poll::{Pollable, Pollee, Poller};
pub use poll::{PollHandle, Pollable, Pollee};
use sig_action::{SigAction, SigActionFlags, SigDefaultAction};
use sig_mask::SigMask;
use sig_num::SigNum;

View File

@ -44,7 +44,7 @@ impl Pollee {
///
/// This operation is _atomic_ in the sense that if there are interesting events, either the
/// events are returned or the poller is notified.
pub fn poll(&self, mask: IoEvents, poller: Option<&mut Poller>) -> IoEvents {
pub fn poll(&self, mask: IoEvents, poller: Option<&mut PollHandle>) -> IoEvents {
let mask = mask | IoEvents::ALWAYS_POLL;
// Register the provided poller.
@ -56,7 +56,7 @@ impl Pollee {
self.events() & mask
}
fn register_poller(&self, poller: &mut Poller, mask: IoEvents) {
fn register_poller(&self, poller: &mut PollHandle, mask: IoEvents) {
self.inner
.subject
.register_observer(poller.observer(), mask);
@ -127,7 +127,7 @@ impl Pollee {
}
/// A poller gets notified when its associated pollees have interesting events.
pub struct Poller {
pub struct PollHandle {
// Use event counter to wait or wake up a poller
event_counter: Arc<EventCounter>,
// All pollees that are interesting to this poller
@ -136,14 +136,14 @@ pub struct Poller {
waiter: Waiter,
}
impl Default for Poller {
impl Default for PollHandle {
fn default() -> Self {
Self::new()
}
}
impl Poller {
/// Constructs a new `Poller`.
impl PollHandle {
/// Constructs a new `PollHandle`.
pub fn new() -> Self {
let (waiter, waker) = Waiter::new_pair();
Self {
@ -167,7 +167,7 @@ impl Poller {
}
}
impl Drop for Poller {
impl Drop for PollHandle {
fn drop(&mut self) {
let observer = self.observer();
@ -234,7 +234,7 @@ pub trait Pollable {
/// poller is provided.
///
/// This method has the same semantics as [`Pollee::poll`].
fn poll(&self, mask: IoEvents, poller: Option<&mut Poller>) -> IoEvents;
fn poll(&self, mask: IoEvents, poller: Option<&mut PollHandle>) -> IoEvents;
/// Waits for events and performs event-based operations.
///
@ -270,7 +270,7 @@ pub trait Pollable {
}
// Wait until the event happens.
let mut poller = Poller::new();
let mut poller = PollHandle::new();
if self.poll(mask, Some(&mut poller)).is_empty() {
poller.wait(timeout)?;
}

View File

@ -26,7 +26,7 @@ use crate::{
},
prelude::*,
process::{
signal::{Pollable, Pollee, Poller},
signal::{PollHandle, Pollable, Pollee},
Gid, Uid,
},
time::clocks::RealTimeClock,
@ -174,7 +174,7 @@ impl EventFile {
}
impl Pollable for EventFile {
fn poll(&self, mask: IoEvents, poller: Option<&mut Poller>) -> IoEvents {
fn poll(&self, mask: IoEvents, poller: Option<&mut PollHandle>) -> IoEvents {
self.pollee.poll(mask, poller)
}
}

View File

@ -7,7 +7,7 @@ use crate::{
events::IoEvents,
fs::{file_handle::FileLike, file_table::FileDesc},
prelude::*,
process::signal::Poller,
process::signal::PollHandle,
};
pub fn sys_poll(fds: Vaddr, nfds: u64, timeout: i32, ctx: &Context) -> Result<SyscallReturn> {
@ -126,13 +126,13 @@ fn hold_files(poll_fds: &[PollFd], ctx: &Context) -> (FileResult, Vec<Option<Arc
}
enum PollerResult {
AllRegistered(Poller),
AllRegistered(PollHandle),
EventFoundAt(usize),
}
/// Registers the files with a poller, or exits early if some events are detected.
fn register_poller(poll_fds: &[PollFd], files: &[Option<Arc<dyn FileLike>>]) -> PollerResult {
let mut poller = Poller::new();
let mut poller = PollHandle::new();
for (i, (poll_fd, file)) in poll_fds.iter().zip(files.iter()).enumerate() {
let Some(file) = file else {