Skip to content

Commit 1e61275

Browse files
committed
Conditional compile dzmmap since the implementation detail is platform dependent
1 parent 5befca9 commit 1e61275

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/util/memory.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,13 @@ pub fn zero(start: Address, len: usize) {
88
}
99
}
1010

11+
/// Demand-zero mmap:
12+
/// This function guarantees to zero all mapped memory.
13+
///
14+
/// On linux, this is achieved by using the `MAP_ANON` mmap flag.
15+
///
16+
/// ***TODO: Unimplemented for other OSes***
17+
#[cfg(target_os = "linux")]
1118
pub fn dzmmap(start: Address, size: usize) -> Result<Address> {
1219
let prot = libc::PROT_READ | libc::PROT_WRITE | libc::PROT_EXEC;
1320
let flags = libc::MAP_ANON | libc::MAP_PRIVATE | libc::MAP_FIXED;

0 commit comments

Comments
 (0)