miri::shims::unix::linux::epoll

Trait EvalContextExt

Source
pub trait EvalContextExt<'tcx>: MiriInterpCxExt<'tcx> {
    // Provided methods
    fn epoll_create1(
        &mut self,
        flags: &OpTy<'tcx>,
    ) -> InterpResult<'tcx, Scalar> { ... }
    fn epoll_ctl(
        &mut self,
        epfd: &OpTy<'tcx>,
        op: &OpTy<'tcx>,
        fd: &OpTy<'tcx>,
        event: &OpTy<'tcx>,
    ) -> InterpResult<'tcx, Scalar> { ... }
    fn epoll_wait(
        &mut self,
        epfd: &OpTy<'tcx>,
        events_op: &OpTy<'tcx>,
        maxevents: &OpTy<'tcx>,
        timeout: &OpTy<'tcx>,
        dest: &MPlaceTy<'tcx>,
    ) -> InterpResult<'tcx> { ... }
    fn check_and_update_readiness(
        &mut self,
        fd_ref: &FileDescriptionRef,
    ) -> InterpResult<'tcx, ()> { ... }
}

Provided Methods§

Source

fn epoll_create1(&mut self, flags: &OpTy<'tcx>) -> InterpResult<'tcx, Scalar>

This function returns a file descriptor referring to the new Epoll instance. This file descriptor is used for all subsequent calls to the epoll interface. If the flags argument is 0, then this function is the same as epoll_create().

https://linux.die.net/man/2/epoll_create1

Source

fn epoll_ctl( &mut self, epfd: &OpTy<'tcx>, op: &OpTy<'tcx>, fd: &OpTy<'tcx>, event: &OpTy<'tcx>, ) -> InterpResult<'tcx, Scalar>

This function performs control operations on the Epoll instance referred to by the file descriptor epfd. It requests that the operation op be performed for the target file descriptor, fd.

Valid values for the op argument are: EPOLL_CTL_ADD - Register the target file descriptor fd on the Epoll instance referred to by the file descriptor epfd and associate the event event with the internal file linked to fd. EPOLL_CTL_MOD - Change the event event associated with the target file descriptor fd. EPOLL_CTL_DEL - Deregister the target file descriptor fd from the Epoll instance referred to by epfd. The event is ignored and can be null.

https://linux.die.net/man/2/epoll_ctl

Source

fn epoll_wait( &mut self, epfd: &OpTy<'tcx>, events_op: &OpTy<'tcx>, maxevents: &OpTy<'tcx>, timeout: &OpTy<'tcx>, dest: &MPlaceTy<'tcx>, ) -> InterpResult<'tcx>

The epoll_wait() system call waits for events on the Epoll instance referred to by the file descriptor epfd. The buffer pointed to by events is used to return information from the ready list about file descriptors in the interest list that have some events available. Up to maxevents are returned by epoll_wait(). The maxevents argument must be greater than zero.

The timeout argument specifies the number of milliseconds that epoll_wait() will block. Time is measured against the CLOCK_MONOTONIC clock. If the timeout is zero, the function will not block, while if the timeout is -1, the function will block until at least one event has been retrieved (or an error occurred).

A call to epoll_wait() will block until either: • a file descriptor delivers an event; • the call is interrupted by a signal handler; or • the timeout expires.

Note that the timeout interval will be rounded up to the system clock granularity, and kernel scheduling delays mean that the blocking interval may overrun by a small amount. Specifying a timeout of -1 causes epoll_wait() to block indefinitely, while specifying a timeout equal to zero cause epoll_wait() to return immediately, even if no events are available.

On success, epoll_wait() returns the number of file descriptors ready for the requested I/O, or zero if no file descriptor became ready during the requested timeout milliseconds. On failure, epoll_wait() returns -1 and errno is set to indicate the error.

https://man7.org/linux/man-pages/man2/epoll_wait.2.html

Source

fn check_and_update_readiness( &mut self, fd_ref: &FileDescriptionRef, ) -> InterpResult<'tcx, ()>

For a specific file description, get its ready events and update the corresponding ready list. This function should be called whenever an event causes more bytes or an EOF to become newly readable from an FD, and whenever more bytes can be written to an FD or no more future writes are possible.

This will report an event if anyone is subscribed to it, without any further filtering, so do not call this function when an FD didn’t have anything happen to it!

Implementors§

Source§

impl<'tcx> EvalContextExt<'tcx> for MiriInterpCx<'tcx>