Skip to content

Commit cc275a6

Browse files
committed
sys::mman: adding few madvise flags.
- `MADV_PAGEOUT` which reclaim the address range, swapping it out if the page is anonymous or written back to disk if it's backed up by a file. - `MADV_COLD` which deactivate the address range but as a hint. - `MADV_WIPEONFORK` after `fork()`, the address range is wiped out to avoid sharing sensible data between processes. - `MADV_KEEPONFORK` disables `MADV_WIPEONFORK` workflow.
1 parent 5c80884 commit cc275a6

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/sys/mman.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -316,6 +316,18 @@ libc_enum! {
316316
#[cfg(apple_targets)]
317317
#[allow(missing_docs)]
318318
MADV_CAN_REUSE,
319+
/// Reclaim the address range when applicable.
320+
#[cfg(linux_android)]
321+
MADV_PAGEOUT,
322+
/// Deactivate the address range when applicable.
323+
#[cfg(linux_android)]
324+
MADV_COLD,
325+
/// After fork, the adress range is zero filled.
326+
#[cfg(linux_android)]
327+
MADV_WIPEONFORK,
328+
/// Undo `MADV_WIPEONFORK` when it applied.
329+
#[cfg(linux_android)]
330+
MADV_KEEPONFORK,
319331
}
320332
}
321333

0 commit comments

Comments
 (0)