#include <mach/mach_host.h>

mach/mach_host.h Kernel.framework

Module mach_host
includes: Kernel/string.h, Kernel/mach/ndr.h, Kernel/mach/boolean.h, Kernel/mach/kern_return.h, Kernel/mach/notify.h, mach/mach_types.h, mach/message.h, Kernel/mach/mig_errors.h, mach/port.h, Availability.h, Kernel/mach/std_types.h, Kernel/mach/mig.h, Kernel/mach/mig.h, mach/mach_types.h, mach/mach_types.h, Kernel/mach_debug/mach_debug_types.h, sys/cdefs.h
11 functions · 1 macro

functionhost_info

extern kern_return_t host_info(
	host_t host,
	host_flavor_t flavor,
	host_info_t host_info_out, /* out */
	mach_msg_type_number_t *host_info_outCnt
)
Basic types References to host objects are returned by: mach_host_self() - trap Return information about this host.
MIG routine from mach/mach_host.defs
CMU/MIT Mach reference · manual page · © Carnegie Mellon
Return information about a host.
The host_info function returns selected information about a host, as specified by flavor.
Notes. This interface is machine word length specific because of the memory size returned by HOST_BASIC_INFO.

functionhost_page_size

extern kern_return_t host_page_size(host_t host, vm_size_t *out_page_size)
CMU/MIT Mach reference · manual page · © Carnegie Mellon
Provide the system's virtual page size.
The host_page_size function returns the page size for the given host.

functionhost_request_notification

extern kern_return_t host_request_notification(
	host_t host,
	host_flavor_t notify_type,
	mach_port_t notify_port
)
MIG routine from mach/mach_host.defs
claude-fable-5, 2026-08-24 · not from Apple sources · verified against xnu osfmk/kern/host_notify.c
Registers notify_port to receive a one-shot kernel notification message. notify_type is one of: HOST_NOTIFY_CALENDAR_CHANGE a host_calendar_changed message when the wall-clock (calendar) time changes discontinuously HOST_NOTIFY_CALENDAR_SET a host_calendar_set message when the calendar time is explicitly set The message is sent to the supplied send-once right and the registration is consumed; a caller wanting further notifications must re-register. The port is made immovable as a side effect. Returns KERN_INVALID_ARGUMENT for a null host or unknown notify_type, KERN_INVALID_CAPABILITY for an invalid or dead port.

functionmach_zone_force_gc

extern kern_return_t mach_zone_force_gc(host_t host)
claude-fable-5, 2026-08-24 · not from Apple sources · verified against xnu osfmk/kern/zalloc.c
Forces an immediate garbage collection of the kernel zone allocator, draining collectable free elements (zone_gc with ZONE_GC_DRAIN) and invoking the buffer cache collect callout first. Effective only on DEBUG and DEVELOPMENT kernels; on RELEASE kernels it is a no-op that still returns KERN_SUCCESS. Returns KERN_INVALID_HOST if host is HOST_NULL.

functionhost_create_mach_voucher

extern kern_return_t host_create_mach_voucher(
	host_t host,
	mach_voucher_attr_raw_recipe_array_t recipes,
	mach_msg_type_number_t recipesCnt,
	ipc_voucher_t *voucher /* out */
)
Create a new voucher by running a series of commands against <key, previous-voucher> pairs of resource attributes.
MIG routine from mach/mach_host.defs

functionhost_register_mach_voucher_attr_manager

extern kern_return_t host_register_mach_voucher_attr_manager(
	host_t host,
	mach_voucher_attr_manager_t attr_manager,
	mach_voucher_attr_value_handle_t default_value,
	mach_voucher_attr_key_t *new_key, /* out */
	ipc_voucher_attr_control_t *new_attr_control /* out */
)
OBSOLETE
MIG routine from mach/mach_host.defs

functionhost_register_well_known_mach_voucher_attr_manager

extern kern_return_t host_register_well_known_mach_voucher_attr_manager(
	host_t host,
	mach_voucher_attr_manager_t attr_manager,
	mach_voucher_attr_value_handle_t default_value,
	mach_voucher_attr_key_t key,
	ipc_voucher_attr_control_t *new_attr_control /* out */
)
MIG routine from mach/mach_host.defs
claude-fable-5, 2026-08-24 · not from Apple sources · verified against xnu osfmk/mach/mach_host.defs
Obsolete; removed from the kernel (the MIG slot is skipped and marked OBSOLETE in mach_host.defs). Formerly registered a user-space Mach voucher attribute manager to back the well-known attribute key given in key, returning a control port for the new attribute. User-space voucher attribute managers are no longer supported; the call fails with MIG_BAD_ID. See host_create_mach_voucher for the surviving voucher interface.

functionhost_set_atm_diagnostic_flag

extern kern_return_t host_set_atm_diagnostic_flag(
	host_t host,
	uint32_t diagnostic_flag
)
Update the global ATM diagnostic flag, readable from the commpage
MIG routine from mach/mach_host.defs

functionmach_zone_info_for_largest_zone

extern kern_return_t mach_zone_info_for_largest_zone(
	host_priv_t host,
	mach_zone_name_t *name,
	mach_zone_info_t *info
)
claude-fable-5, 2026-08-24 · not from Apple sources · verified against xnu osfmk/kern/zalloc.c
Returns the name (mach_zone_name_t) and statistics (mach_zone_info_t) of the zone currently occupying the most memory. Requires the host-privileged port; returns KERN_INVALID_HOST if host is HOST_NULL (or, on kernels built with CONFIG_DEBUGGER_FOR_ZONE_INFO, when no debugger is attached), KERN_INVALID_ARGUMENT if either out parameter is null, and KERN_FAILURE if the information cannot be gathered.

functionmach_zone_get_zlog_zones

extern kern_return_t mach_zone_get_zlog_zones(
	host_priv_t host,
	mach_zone_name_array_t *names,
	mach_msg_type_number_t *namesCnt
)
claude-fable-5, 2026-08-24 · not from Apple sources · verified against xnu osfmk/kern/zalloc.c
Returns the names of all zones that have zone logging enabled, as a vm-allocated mach_zone_name_array_t the caller must deallocate. Available only on kernels built with ZALLOC_ENABLE_LOGGING; otherwise returns KERN_FAILURE. Returns KERN_INVALID_HOST if host is HOST_NULL and KERN_INVALID_ARGUMENT if an out parameter is null.

functionmach_zone_get_btlog_records

extern kern_return_t mach_zone_get_btlog_records(
	host_priv_t host,
	mach_zone_name_t name,
	zone_btrecord_array_t *recs,
	mach_msg_type_number_t *recsCnt
)
claude-fable-5, 2026-08-24 · not from Apple sources · verified against xnu osfmk/kern/zalloc.c
Returns the backtrace log (btlog) records collected for the zone named name, as a vm-allocated zone_btrecord_array_t with recsCnt entries. Available only on kernels built with ZALLOC_ENABLE_LOGGING and for zones whose logging was enabled (zlog boot-arg); otherwise returns KERN_FAILURE. Returns KERN_INVALID_HOST if host is HOST_NULL and KERN_INVALID_ARGUMENT if an out parameter is null or the zone is not found.