about summary refs log tree commit diff
path: root/src/tools/miri/tests/fail-dep/shims/munmap_partial.rs
blob: 938850ee2862b5e64b94ce01beff4c5ca2e718df (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
//! Our mmap/munmap support is a thin wrapper over Interpcx::allocate_ptr. Since the underlying
//! layer has much more UB than munmap does, we need to be sure we throw an unsupported error here.
//@ignore-target-windows: No libc on Windows

fn main() {
    unsafe {
        let ptr = libc::mmap(
            std::ptr::null_mut(),
            page_size::get() * 2,
            libc::PROT_READ | libc::PROT_WRITE,
            libc::MAP_PRIVATE | libc::MAP_ANONYMOUS,
            -1,
            0,
        );
        libc::munmap(ptr, 1);
        //~^ ERROR: unsupported operation
    }
}