Add wasi-emulated-mman cargo feature #3093
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #3091 by adding a
wasi-emulated-mman
cargo feature that adds bindings forwasi-libc
's emulated mman.I am not sure if I implemented this completely correctly; feedback would be highly appreciated!
Some general comments/questions:
mmap64
here, as I was unsure how to handle C's#define mmap64 mmap
. I only started learning Rust a couple months ago so I am not sure what would be analogous here._GNU_SOURCE
and_BSD_SOURCE
conditional includes in the C header, so I included the relevant bindings in the hopes that I could get feedback on that from someone here.The unix/linux-likeI failed to realize theMAP_FAILED
is implemented aspub const MAP_FAILED: *mut ::c_void = !0 as *mut ::c_void;
, which confused me. Themman.h
inwasi-libc
is#define MAP_FAILED ((void *) -1)
. What is the correct rust binding for this constant?!0
is just the bitwise operator; all set here.libc-test/semver/wasi.txt
?CC="clang ... --sysroot=..." cargo build --target="..."
)? Or through some different mechanism?