#include <mach/mach_host.h>
mach/mach_host.h
Module mach_host
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.
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 )
▾
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.
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
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 */ )
▾
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
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.
macrosubsystem_to_name_map_mach_host
#define subsystem_to_name_map_mach_host { "host_info", 200 },
{ "host_kernel_version", 201 },
{ "host_page_size", 202 },
{ "mach_memory_object_memory_entry", 203 },
{ "host_processor_info", 204 },
{ "host_get_io_main", 205 },
{ "host_get_clock_service", 206 },
{ "kmod_get_info", 207 },
{ "host_virtual_physical_table_info", 209 },
{ "processor_set_default", 213 },
{ "processor_set_create", 214 },
{ "mach_memory_object_memory_entry_64", 215 },
{ "host_statistics", 216 },
{ "host_request_notification", 217 },
{ "host_lockgroup_info", 218 },
{ "host_statistics64", 219 },
{ "mach_zone_info", 220 },
{ "mach_zone_force_gc", 221 },
{ "host_create_mach_voucher", 222 },
{ "host_register_mach_voucher_attr_manager", 223 },
{ "host_register_well_known_mach_voucher_attr_manager", 224 },
{ "host_set_atm_diagnostic_flag", 225 },
{ "mach_memory_info", 227 },
{ "host_set_multiuser_config_flags", 228 },
{ "mach_zone_info_for_zone", 231 },
{ "mach_zone_info_for_largest_zone", 232 },
{ "mach_zone_get_zlog_zones", 233 },
{ "mach_zone_get_btlog_records", 234 },
{ "mach_memory_info_redacted", 235 }