Skip to content

Commit

Permalink
sys::mman: adding few madvise flags.
Browse files Browse the repository at this point in the history
- `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.
  • Loading branch information
devnexen committed Dec 11, 2024
1 parent 5c80884 commit cc275a6
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/sys/mman.rs
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,18 @@ libc_enum! {
#[cfg(apple_targets)]
#[allow(missing_docs)]
MADV_CAN_REUSE,
/// Reclaim the address range when applicable.
#[cfg(linux_android)]
MADV_PAGEOUT,
/// Deactivate the address range when applicable.
#[cfg(linux_android)]
MADV_COLD,
/// After fork, the adress range is zero filled.
#[cfg(linux_android)]
MADV_WIPEONFORK,
/// Undo `MADV_WIPEONFORK` when it applied.
#[cfg(linux_android)]
MADV_KEEPONFORK,
}
}

Expand Down

0 comments on commit cc275a6

Please sign in to comment.