pub struct TimerFd { /* private fields */ }
Implementations§
source§impl TimerFd
impl TimerFd
sourcepub fn new(status: FileStatus) -> Arc<AtomicRefCell<Self>>
pub fn new(status: FileStatus) -> Arc<AtomicRefCell<Self>>
Creates a new TimerFd
object that internally sets up a Timer
that can be waited on
with poll, select, and epoll, enabling support for timerfd_create(2).
We wrap the new TimerFd
in an Arc<AtomicRefCell>
because we need to use a weak
reference to internally support setting up callback functions that reference the TimerFd
on timer expiration.
sourcepub fn get_timer_remaining(&self) -> Option<SimulationTime>
pub fn get_timer_remaining(&self) -> Option<SimulationTime>
Returns the relative duration until the next expiration event occurs if the timer is armed,
and None
if the timer is disarmed.
sourcepub fn get_timer_interval(&self) -> Option<SimulationTime>
pub fn get_timer_interval(&self) -> Option<SimulationTime>
Returns the relative duration over which the timer has been configured to periodically
expire, or None
if the timer is configured to expire only once.
sourcepub fn arm_timer(
&mut self,
host: &Host,
expire_time: EmulatedTime,
interval: Option<SimulationTime>,
cb_queue: &mut CallbackQueue,
)
pub fn arm_timer( &mut self, host: &Host, expire_time: EmulatedTime, interval: Option<SimulationTime>, cb_queue: &mut CallbackQueue, )
Arm the timer by setting its expiration time and interval, enabling support for
timerfd_settime(2). The readable state of the TimerFd
is updated as appropriate.
sourcepub fn disarm_timer(&mut self, cb_queue: &mut CallbackQueue)
pub fn disarm_timer(&mut self, cb_queue: &mut CallbackQueue)
Disarm the timer so that it no longer fires expiration events, enabling support for
timerfd_settime(2). The readable state of the TimerFd
is updated as appropriate.
pub fn status(&self) -> FileStatus
pub fn set_status(&mut self, status: FileStatus)
pub fn mode(&self) -> FileMode
pub fn has_open_file(&self) -> bool
pub fn supports_sa_restart(&self) -> bool
pub fn set_has_open_file(&mut self, val: bool)
pub fn readv( &mut self, iovs: &[IoVec], offset: Option<kernel_off_t>, _flags: c_int, mem: &mut MemoryManager, cb_queue: &mut CallbackQueue, ) -> Result<isize, SyscallError>
pub fn writev( &mut self, _iovs: &[IoVec], _offset: Option<kernel_off_t>, _flags: c_int, _mem: &mut MemoryManager, _cb_queue: &mut CallbackQueue, ) -> Result<isize, SyscallError>
pub fn close( &mut self, cb_queue: &mut CallbackQueue, ) -> Result<(), SyscallError>
pub fn ioctl( &mut self, request: IoctlRequest, _arg_ptr: ForeignPtr<()>, _memory_manager: &mut MemoryManager, ) -> SyscallResult
pub fn stat(&self) -> Result<stat, SyscallError>
pub fn add_listener( &mut self, monitoring_state: FileState, monitoring_signals: FileSignals, filter: StateListenerFilter, notify_fn: impl Fn(FileState, FileState, FileSignals, &mut CallbackQueue) + Send + Sync + 'static, ) -> StateListenHandle
pub fn add_legacy_listener(&mut self, ptr: HostTreePointer<StatusListener>)
pub fn remove_legacy_listener(&mut self, ptr: *mut StatusListener)
pub fn state(&self) -> FileState
Auto Trait Implementations§
impl Freeze for TimerFd
impl !RefUnwindSafe for TimerFd
impl Send for TimerFd
impl Sync for TimerFd
impl Unpin for TimerFd
impl !UnwindSafe for TimerFd
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more