region
A Rust library for dealing with memory regions.
It is implemented using platform specific APIs (e.g VirtualQuery,
VirtualLock, mprotect, mlock).
Platforms
This library has (so far) support for:
- Windows
- Linux & Android
- macOS & iOS
- FreeBSD
Installation
Add this to your Cargo.toml:
[]
= "2.1.1"
and this to your crate root:
extern crate region;
Example
- Cross-platform equivalents:
let ret5 = ;
// Page size
let pz = size;
let pc = ceil;
let pf = floor;
// VirtualQuery | '/proc/self/maps'
let q = query?;
let qr = query_range?;
// VirtualProtect | mprotect
protect?;
// ... you can also temporarily change a region's protection
let handle = protect_with_handle?;
// VirtualLock | mlock
let guard = lock?;