Skip to content

Commit dedac2d

Browse files
committed
Auto merge of rust-lang#2838 - DebugSteven:disable-epoll_wait, r=oli-obk
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.
2 parents 93a0575 + 9311b4a commit dedac2d

File tree

3 files changed

+18
-2
lines changed

3 files changed

+18
-2
lines changed

src/tools/miri/src/shims/unix/linux/fd.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,15 +152,14 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
152152
let _maxevents = this.read_scalar(maxevents)?.to_i32()?;
153153
let _timeout = this.read_scalar(timeout)?.to_i32()?;
154154

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

162161
// FIXME return number of events ready when scheme for marking events ready exists
163-
Ok(Scalar::from_i32(numevents))
162+
throw_unsup_format!("returning ready events from epoll_wait is not yet implemented");
164163
} else {
165164
Ok(Scalar::from_i32(this.handle_not_found()?))
166165
}

src/tools/miri/tests/pass-dep/tokio/sleep.rs renamed to src/tools/miri/tests/fail/tokio/sleep.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
//@compile-flags: -Zmiri-permissive-provenance -Zmiri-backtrace=full
22
//@only-target-x86_64-unknown-linux: support for tokio only on linux and x86
3+
//@error-pattern: returning ready events from epoll_wait is not yet implemented
4+
//@normalize-stderr-test: " += note:.*\n" -> ""
35

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

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
error: unsupported operation: returning ready events from epoll_wait is not yet implemented
2+
--> CARGO_REGISTRY/.../epoll.rs:LL:CC
3+
|
4+
LL | / syscall!(epoll_wait(
5+
LL | | self.ep,
6+
LL | | events.as_mut_ptr(),
7+
LL | | events.capacity() as i32,
8+
LL | | timeout,
9+
LL | | ))
10+
| |__________^ returning ready events from epoll_wait is not yet implemented
11+
|
12+
= help: this is likely not a bug in the program; it indicates that the program performed an operation that the interpreter does not support
13+
14+
error: aborting due to previous error
15+

0 commit comments

Comments
 (0)