Expand description
Wrapper functions for memory syscalls such as mmap, mprotect, etc.
Structs§
- Strategy for performing mmap
Enums§
- Support for huge pages
- The protection flags for Mmap
Constants§
Functions§
- Demand-zero mmap: This function mmaps the memory and guarantees to zero all mapped memory. This function WILL overwrite existing memory mapping. The user of this function needs to be aware of this, and use it cautiously.
- Demand-zero mmap (no replace): This function mmaps the memory and guarantees to zero all mapped memory. This function will not overwrite existing memory mapping, and it will result Err if there is an existing mapping.
- Get the memory maps for the process. The returned string is a multi-line string. This is only meant to be used for debugging. For example, log process memory maps after detecting a clash.
- Returns the total physical memory for the system in bytes.
- Properly handle errors from a mmap Result, including invoking the binding code in the case of an OOM error.
- mmap with no swap space reserve: This function does not reserve swap space for this mapping, which means there is no guarantee that writes to the mapping can always be successful. In case of out of physical memory, one may get a segfault for writing to the mapping. We can use this to reserve the address range, and then later overwrites the mapping with dzmmap().
- Protect the given memory (in page granularity) to forbid any access (PROT_NONE).
- Unmap the given memory (in page granularity). This wraps the unsafe libc munmap call.
- Unprotect the given memory (in page granularity) to allow access (PROT_READ/WRITE/EXEC).
- Checks if the memory has already been mapped. If not, we panic. Note that the checking has a side effect that it will map the memory if it was unmapped. So we panic if it was unmapped. Be very careful about using this function.
- Check the result from an mmap function in this module. Return true if the mmap has failed due to an existing conflicting mapping.
- Set a range of memory to the given value. Similar to memset.
- Set a range of memory to 0.