#include <mach/memory_entry.h> not included by <mach/mach.h> — include it explicitly
mach/memory_entry.h
macro_memory_entry_user_
#define _memory_entry_user_
macromemory_entry_MSG_COUNT
#define memory_entry_MSG_COUNT 4
functionmach_memory_entry_purgable_control
extern kern_return_t mach_memory_entry_purgable_control( mem_entry_name_port_t mem_entry, vm_purgable_t control, int *state /* inout */ )
▾
claude-fable-5, 2026-08-24 · not from Apple sources · verified against xnu osfmk/vm/vm_memory_entry.c
Queries or sets the purgeable state of the VM object backing a named memory entry, in the manner of vm_purgable_control but addressed by the entry port. control is VM_PURGABLE_GET_STATE or VM_PURGABLE_SET_STATE; *state holds VM_PURGABLE_NONVOLATILE, VM_PURGABLE_VOLATILE, or VM_PURGABLE_EMPTY, and on return the previous state. VM_PURGABLE_SET_STATE_FROM_KERNEL is rejected from user space. The entry must be an object entry (not a sub-map or copy entry) covering its object entirely from offset 0; otherwise KERN_INVALID_ARGUMENT.
functionmach_memory_entry_access_tracking
extern kern_return_t mach_memory_entry_access_tracking( mem_entry_name_port_t mem_entry, int *access_tracking, /* inout */ uint32_t *access_tracking_reads, /* out */ uint32_t *access_tracking_writes /* out */ )
▾
claude-fable-5, 2026-08-24 · not from Apple sources · verified against xnu osfmk/vm/vm_memory_entry.c
Enables or disables access tracking on the VM object backing a named memory entry and reports the accesses accumulated so far. *access_tracking carries the new setting in and the previous setting out; *access_tracking_reads and *access_tracking_writes return and reset the counts recorded since tracking was enabled. Functional only on kernels built with VM_OBJECT_ACCESS_TRACKING; otherwise returns KERN_NOT_SUPPORTED. The entry must be an object entry (not a sub-map or copy entry) or KERN_INVALID_ARGUMENT is returned.
functionmach_memory_entry_ownership
extern kern_return_t mach_memory_entry_ownership( mem_entry_name_port_t mem_entry, task_t owner, int ledger_tag, int ledger_flags )
▾
claude-fable-5, 2026-08-24 · not from Apple sources · verified against xnu osfmk/vm/vm_memory_entry.c
Assigns the memory backing a named memory entry to task owner for ledger (memory-footprint) accounting, tagged with ledger_tag (VM_LEDGER_TAG_DEFAULT, VM_LEDGER_TAG_NETWORK, ...). ledger_flags may include VM_LEDGER_FLAG_NO_FOOTPRINT to keep the memory out of the owner's phys_footprint. Transferring ownership to a task other than the caller, using a no-footprint flag, or tagging as network requires the com.apple.private.memory.ownership_transfer entitlement. Returns KERN_INVALID_ARGUMENT for undefined flags or an unsuitable entry.
functionmach_memory_entry_get_page_counts
extern kern_return_t mach_memory_entry_get_page_counts( mem_entry_name_port_t mem_entry, uint64_t *resident_cnt, /* out */ uint64_t *dirty_cnt, /* out */ uint64_t *swapped_cnt /* out */ )
Query the residency of the physical memory backing a given memory entry.
This operation is only supported on "named" memory entries created with
`MAP_MEM_NAMED_CREATE`. It is unsupported on "mappings" created with
`MAP_MEM_COPY` or `MAM_MEM_SHARED`
- Parameters
- mem_entry: The memory entry to query
- resident_cnt: If non-null, the number of resident pages written out
- dirty_cnt: If non-null, the number of resident, modified pages written out
- swapped_cnt: If non-null, the number of evicted pages written out
macrosubsystem_to_name_map_memory_entry
#define subsystem_to_name_map_memory_entry { "mach_memory_entry_purgable_control", 4900 },
{ "mach_memory_entry_access_tracking", 4901 },
{ "mach_memory_entry_ownership", 4902 },
{ "mach_memory_entry_get_page_counts", 4903 }