memmap2-rs
memmap2-rs copied to clipboard
Support POSIX MAP_FIXED
Would it be possible to support this flag? Currently the much older crate mmap supports it, but it hasn't been updated in 6 years (!).
Why do you need it?
Anyway, patches are welcome.
It's kind of an niche use case, I'm playing around with writing a ELF loader. I could submit a patch, but it would be just for me. Though as I work on it more I probably won't need to use MAP_FIXED
it's kind of a hack.
I think the main point of this crate is providing a portable abstraction of the memory mapping facilities available on Unix- and Windows-like operating systems. I suspect that your ELF loader does not have those portability requirements? Maybe using a Unix-specific lower level crate like nix
or libc
would be a better choice due to this?
There's already flagged things like mremap which are under #[cfg(linux)], so adding MAP_FIXED under a flag seems like not that big of a stretch.
@norcalli The are OS-specific stuff now, but not 2 years ago.
Either way, patches are welcome.