Skip to content

Commit f04d1f6

Browse files
committed
syscall/eventfd2: add failing test
The shim syscall logic doesn't support ID 290, SYS_eventfd2.
1 parent 5cdee07 commit f04d1f6

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
//@only-target: linux
2+
3+
// This is a test for calling eventfd2 through a syscall.
4+
// But we do not support this.
5+
fn main() {
6+
let initval = 0 as libc::c_uint;
7+
let flags = (libc::EFD_CLOEXEC | libc::EFD_NONBLOCK) as libc::c_int;
8+
9+
let result = unsafe {
10+
libc::syscall(libc::SYS_eventfd2, initval, flags) //~ERROR: unsupported operation
11+
};
12+
13+
assert_eq!(result, 3); // The first FD provided would be 3.
14+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
error: unsupported operation: can't execute syscall with ID 290
2+
--> tests/fail-dep/libc/libc_syscall_eventfd2.rs:LL:CC
3+
|
4+
LL | libc::syscall(libc::SYS_eventfd2, initval, flags)
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't execute syscall with ID 290
6+
|
7+
= help: if this is a basic API commonly used on this target, please report an issue with Miri
8+
= help: however, note that Miri does not aim to support every FFI function out there; for instance, we will not support APIs for things such as GUIs, scripting languages, or databases
9+
= note: BACKTRACE:
10+
= note: inside `main` at tests/fail-dep/libc/libc_syscall_eventfd2.rs:LL:CC
11+
12+
note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace
13+
14+
error: aborting due to 1 previous error
15+

0 commit comments

Comments
 (0)