#include <sys/mman.h>
sys/mman.h
macroPROT_NONE
Protections are chosen from these bits, or-ed together
#define PROT_NONE 0x00
[MC2] no permissions
macroMAP_SHARED
Flags contain sharing type and options.
Sharing types; choose one.
#define MAP_SHARED 0x0001
[MF|SHM] share changes
macroMAP_ANONYMOUS
#define MAP_ANONYMOUS MAP_ANON
macroMAP_RESILIENT_CODESIGN
The MAP_RESILIENT_* flags can be used when the caller wants to map some
possibly unreliable memory and be able to access it safely, possibly
getting the wrong contents rather than raising any exception.
For safety reasons, such mappings have to be read-only (PROT_READ access
only).
MAP_RESILIENT_CODESIGN:
accessing this mapping will not generate code-signing violations,
even if the contents are tainted.
MAP_RESILIENT_MEDIA:
accessing this mapping will not generate an exception if the contents
are not available (unreachable removable or remote media, access beyond
end-of-file, ...). Missing contents will be replaced with zeroes.
#define MAP_RESILIENT_CODESIGN 0x2000
no code-signing failures
macroMAP_TRANSLATED_ALLOW_EXECUTE
Flags used to support translated processes.
#define MAP_TRANSLATED_ALLOW_EXECUTE 0x20000
allow execute in translated processes
macroMS_ASYNC
msync() flags
When making a new MS_*, update tests vm_parameter_validation_[user|kern]
and their expected results; they deliberately call VM functions with invalid
msync values and you may be turning one of those invalid msyncs valid.
#define MS_ASYNC 0x0001
[MF|SIO] return immediately
macroPOSIX_MADV_NORMAL
Advice to madvise
When making a new MADV_*, update tests vm_parameter_validation_[user|kern]
and their expected results; they deliberately call VM functions with invalid
madvise values and you may be turning one of those invalid madvises valid.
#define POSIX_MADV_NORMAL 0
[MC1] no further special treatment
macroMADV_NORMAL
#define MADV_NORMAL POSIX_MADV_NORMAL
macroMADV_RANDOM
#define MADV_RANDOM POSIX_MADV_RANDOM
macroMADV_SEQUENTIAL
#define MADV_SEQUENTIAL POSIX_MADV_SEQUENTIAL
macroMADV_WILLNEED
#define MADV_WILLNEED POSIX_MADV_WILLNEED
macroMADV_DONTNEED
#define MADV_DONTNEED POSIX_MADV_DONTNEED
macroMADV_ZERO_WIRED_PAGES
#define MADV_ZERO_WIRED_PAGES 6
zero the wired pages that have not been unwired before the entry is deleted
macroMADV_CAN_REUSE
#define MADV_CAN_REUSE 9
functionmunlockall
int munlockall(void)
functionmlock
int mlock(const void *, size_t)
[MR]
man page · June 2, 1993
mlock(2) — lock (unlock) physical pages in memorymacro_MMAP
#define _MMAP
functionmmap
__DARWIN_ALIAS(mmap) void * mmap(void *, size_t, int, int, int, off_t)
[MC3]
man page · February 14, 2020
mmap(2) — allocate memory, or map files or devices into memoryfunctionmprotect
__DARWIN_ALIAS(mprotect) int mprotect(void *, size_t, int)
[MPR]
man page · October 16, 2008
mprotect(2) — control the protection of pagesfunctionmsync
__DARWIN_ALIAS_C(msync) int msync(void *, size_t, int)
[MF|SIO]
man page · June 21, 1994
msync(2) — synchronize a mapped regionfunctionmunlock
int munlock(const void *, size_t)
[MR]
man page · June 2, 1993
munlock(2) — lock (unlock) physical pages in memoryfunctionmunmap
__DARWIN_ALIAS(munmap) int munmap(void *, size_t)
[MC3]
man page · October 16, 2008
munmap(2) — remove a mappingfunctionshm_open
int shm_open(const char *, int, ...)
[SHM]
man page · August 29, 2008
shm_open(2) — open a shared memory objectfunctionshm_unlink
int shm_unlink(const char *)
man page · August 31, 2006
shm_unlink(2) — remove shared memory objectfunctionposix_madvise
int posix_madvise(void *, size_t, int)
[ADV]
man page · June 9, 1993
posix_madvise(2) — give advice about use of memoryfunctionmadvise
int madvise(void *, size_t, int)
man page · June 9, 1993
madvise(2) — give advice about use of memoryfunctionmincore
int mincore(const void *, size_t, char *)
man page · June 9, 1993
mincore(2) — determine residency of memory pages⚠ the man page prototype differs from the current header — man:
int mincore(char*, size_t, char*) · header: int mincore(void*, size_t, char*)functionminherit
int minherit(void *, size_t, int)
man page · June 9, 1993
minherit(2) — control the inheritance of pages⚠ the man page prototype differs from the current header — man:
int minherit(char*, size_t, int) · header: int minherit(void*, size_t, int)