-
Notifications
You must be signed in to change notification settings - Fork 164
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support discontinuous memory maps #30
Comments
Here's how a unix dynamic linker might do this:
E.g., the program headers need to be mmap'd into different locations, but the code + data reference each other assuming it's essentially continguous memory, I think this is similar to your requirements. Some sugar to do this in this lib would be nice though :) |
This is not going to happen on Windows. To quote MSDN:
|
The only thing I think we can really do here is expose MAP_FIXED, which is already being tracked in #21 , so I'm going to go ahead and close this. |
I'm working with a file format that scatters its data around on disk. It's composed of multiple logical data streams which are intended to be memory mapped. The segments are all page-aligned, and records within a stream constantly refer to other records based on their positions within the stream entirely oblivious to the physical layout.
Ultimately I want a single continuous read-only
&[u8]
given a list of offsets and sizes:In the case of POSIX
mmap()
, I think this would be done by usingmmap(NULL, <total size>, MAP_ANON, PROT_NONE, 0, 0)
to ask for a chunk of address space without actually committing resources to it, followed by repeatedmmap(<address>, <size>, MAP_FIXED, PROT_READ, <fd>, <offset>)
to map each file piece to the appropriate location within that space.On Windows, I think this is
VirtualAllocEx(MEM_RESERVE)
to get the address space, thenMapViewOfFileEx()
to map each piece.The text was updated successfully, but these errors were encountered: