-
Notifications
You must be signed in to change notification settings - Fork 103
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
Allow mapping MAP_PRIVATE memory to file #92
Comments
Current solution is this: fn restore(file: &File, state: &GuestMemoryState) -> std::result::Result<Self, Error> {
let mmap_regions = state
.regions
.iter()
.map(|region| {
let file_clone = file.try_clone().expect("Cannot clone memory file.");
MmapRegion::build(
Some(FileOffset::new(file_clone, region.offset)),
region.size,
libc::PROT_READ | libc::PROT_WRITE,
libc::MAP_NORESERVE | libc::MAP_PRIVATE,
)
.map(|r| {
GuestRegionMmap::new(r, GuestAddress(region.base_address))
.expect("Cannot create guest mmap region.")
})
.expect("Cannot create mmap region.")
})
.collect();
Ok(Self::from_regions(mmap_regions).map_err(Error::CreateMemory)?)
} |
Is there any plans to support this natively? I was surprised to find that |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The only provided interfaces right now force MAP_SHARED on all file mappings.
The text was updated successfully, but these errors were encountered: