Skip to content

Commit

Permalink
Auto merge of rust-lang#2838 - DebugSteven:disable-epoll_wait, r=oli-obk
Browse files Browse the repository at this point in the history
throw unsupported for `epoll_wait`

This PR throws unsupported to indicate miri doesn't yet return ready events. Previously it always returned 0, indicating no ready events, even if events for the epoll file descriptor may have been ready.
  • Loading branch information
bors committed Apr 11, 2023
2 parents 93a0575 + 9311b4a commit dedac2d
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
3 changes: 1 addition & 2 deletions src/tools/miri/src/shims/unix/linux/fd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -152,15 +152,14 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
let _maxevents = this.read_scalar(maxevents)?.to_i32()?;
let _timeout = this.read_scalar(timeout)?.to_i32()?;

let numevents = 0;
if let Some(epfd) = this.machine.file_handler.handles.get_mut(&epfd) {
let _epfd = epfd
.as_any_mut()
.downcast_mut::<Epoll>()
.ok_or_else(|| err_unsup_format!("non-epoll FD passed to `epoll_wait`"))?;

// FIXME return number of events ready when scheme for marking events ready exists
Ok(Scalar::from_i32(numevents))
throw_unsup_format!("returning ready events from epoll_wait is not yet implemented");
} else {
Ok(Scalar::from_i32(this.handle_not_found()?))
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
//@compile-flags: -Zmiri-permissive-provenance -Zmiri-backtrace=full
//@only-target-x86_64-unknown-linux: support for tokio only on linux and x86
//@error-pattern: returning ready events from epoll_wait is not yet implemented
//@normalize-stderr-test: " += note:.*\n" -> ""

use tokio::time::{sleep, Duration, Instant};

Expand Down
15 changes: 15 additions & 0 deletions src/tools/miri/tests/fail/tokio/sleep.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
error: unsupported operation: returning ready events from epoll_wait is not yet implemented
--> CARGO_REGISTRY/.../epoll.rs:LL:CC
|
LL | / syscall!(epoll_wait(
LL | | self.ep,
LL | | events.as_mut_ptr(),
LL | | events.capacity() as i32,
LL | | timeout,
LL | | ))
| |__________^ returning ready events from epoll_wait is not yet implemented
|
= help: this is likely not a bug in the program; it indicates that the program performed an operation that the interpreter does not support

error: aborting due to previous error

0 comments on commit dedac2d

Please sign in to comment.