about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/tools/miri/tests/fail-dep/libc/libc_syscall_eventfd2.rs14
-rw-r--r--src/tools/miri/tests/fail-dep/libc/libc_syscall_eventfd2.stderr15
2 files changed, 29 insertions, 0 deletions
diff --git a/src/tools/miri/tests/fail-dep/libc/libc_syscall_eventfd2.rs b/src/tools/miri/tests/fail-dep/libc/libc_syscall_eventfd2.rs
new file mode 100644
index 00000000000..fc5a6b37cc0
--- /dev/null
+++ b/src/tools/miri/tests/fail-dep/libc/libc_syscall_eventfd2.rs
@@ -0,0 +1,14 @@
+//@only-target: linux
+
+// This is a test for calling eventfd2 through a syscall.
+// But we do not support this.
+fn main() {
+    let initval = 0 as libc::c_uint;
+    let flags = (libc::EFD_CLOEXEC | libc::EFD_NONBLOCK) as libc::c_int;
+
+    let result = unsafe {
+        libc::syscall(libc::SYS_eventfd2, initval, flags) //~ERROR: unsupported operation
+    };
+
+    assert_eq!(result, 3); // The first FD provided would be 3.
+}
diff --git a/src/tools/miri/tests/fail-dep/libc/libc_syscall_eventfd2.stderr b/src/tools/miri/tests/fail-dep/libc/libc_syscall_eventfd2.stderr
new file mode 100644
index 00000000000..d39cea564d6
--- /dev/null
+++ b/src/tools/miri/tests/fail-dep/libc/libc_syscall_eventfd2.stderr
@@ -0,0 +1,15 @@
+error: unsupported operation: can't execute syscall with ID 290
+  --> tests/fail-dep/libc/libc_syscall_eventfd2.rs:LL:CC
+   |
+LL |         libc::syscall(libc::SYS_eventfd2, initval, flags)
+   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't execute syscall with ID 290
+   |
+   = help: if this is a basic API commonly used on this target, please report an issue with Miri
+   = 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
+   = note: BACKTRACE:
+   = note: inside `main` at tests/fail-dep/libc/libc_syscall_eventfd2.rs:LL:CC
+
+note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace
+
+error: aborting due to 1 previous error
+