Function region::query[][src]

pub fn query(address: *const u8) -> Result<Region>

Queries the OS with an address, returning the region it resides within.

The implementation uses VirtualQuery on Windows, mach_vm_region on macOS, kinfo_getvmmap on FreeBSD, and parses proc/[pid]/maps on Linux.

Examples

use region::{Protection};

let data = [0; 100];
let region = region::query(data.as_ptr()).unwrap();

assert_eq!(region.protection, Protection::READ_WRITE);