Skip to main content

Module sys

Module sys 

Source
Available on Unix and crate feature pool and non-miri only.
Expand description

The platform seam: mapping, unmapping, paging advice, and the page size.

The mmap variant is production; the Miri variant backs regions with the Rust heap and treats every advice as a contents-preserving no-op — the weakest behavior the advice contracts allow — so the pool’s tests run under the interpreter with full provenance and data-race checking:

MIRIFLAGS=-Zmiri-disable-isolation cargo +nightly miri test -p mz-ore --features pool pool::

(The isolation flag is for the test harness’s wall-clock log timestamps, not for anything the pool does.)

Enums§

Advice 🔒
Paging advice, in the vocabulary the pool needs.

Functions§

advise 🔒
Applies advice to the largest page-aligned subrange of [ptr, ptr + len), rounding the start up and the end down so the advice never spills onto pages the range only partially covers.
map 🔒
Maps len bytes of anonymous memory with the base aligned to align. len must be a whole number of pages and align a page-multiple power of two. Alignments beyond one page over-map and trim; huge-page alignments additionally advise MADV_HUGEPAGE (best-effort; the kernel falls back to base pages under fragmentation).
nonresident 🔒
Whether every page of the page-aligned subrange of [ptr, ptr + len) has been unmapped from this process, per the present bits in /proc/self/pagemap. A failed observation reports false: the ledger keeps counting pages it cannot prove gone.
page_size 🔒
unmap 🔒
Releases a mapping returned by map.