#include <mach/mach_host.h> also included by <mach/mach.h>

mach/mach_host.h

28 functions · 3 macros

macro_mach_host_user_

#define _mach_host_user_ 

macromach_host_MSG_COUNT

#define mach_host_MSG_COUNT 36

functionhost_info

extern __TVOS_PROHIBITED __WATCHOS_PROHIBITED 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_kernel_version

extern kern_return_t host_kernel_version(
	host_t host,
	kernel_version_t kernel_version /* out */
)
Get string describing current kernel version.
MIG routine from mach/mach_host.defs
CMU/MIT Mach reference · manual page · © Carnegie Mellon
Return kernel version information for a host.
The host_kernel_version function returns the version string compiled into the kernel executing on host at the time it was built. This describes the version of the kernel. The constant KERNEL_VERSION_MAX (in \*L \*O) should be used to dimension storage for the returned string if the kernel_version_t declaration is not used.

function_host_page_size

extern kern_return_t _host_page_size(
	host_t host,
	vm_size_t *out_page_size /* out */
)
Get host page size (compatibility for running old libraries on new kernels - host_page_size() is now a library routine based on constants)
MIG routine from mach/mach_host.defs

functionmach_memory_object_memory_entry

extern kern_return_t mach_memory_object_memory_entry(
	host_t host,
	boolean_t internal,
	vm_size_t size,
	vm_prot_t permission,
	memory_object_t pager,
	mach_port_t *entry_handle /* out */
)
Allow pagers to create named entries that point to un-mapped abstract memory object. The named entries are generally mappable and can be subsetted through the mach_make_memory_entry call
MIG routine from mach/mach_host.defs

functionhost_processor_info

extern kern_return_t host_processor_info(
	host_t host,
	processor_flavor_t flavor,
	natural_t *out_processor_count, /* out */
	processor_info_array_t *out_processor_info, /* out */
	mach_msg_type_number_t *out_processor_infoCnt
)
Get processor info for all the processors on this host. The returned data is an OOL array of processor info.
MIG routine from mach/mach_host.defs

functionhost_get_io_main

extern kern_return_t host_get_io_main(
	host_t host,
	io_main_t *io_main /* out */
)
Return host IO main access port
MIG routine from mach/mach_host.defs

functionhost_get_clock_service

extern kern_return_t host_get_clock_service(
	host_t host,
	clock_id_t clock_id,
	clock_serv_t *clock_serv /* out */
)
Get service port for a processor set. Available to all.
MIG routine from mach/mach_host.defs
CMU/MIT Mach reference · manual page · © Carnegie Mellon
Return a send right to a kernel clock's service port.
The host_get_clock_service function returns a send right to the name port for a kernel clock object. This right is used to get the time and resolutions of the clock and to set clock alarms.

functionkmod_get_info

extern kern_return_t kmod_get_info(
	host_t host,
	kmod_args_t *modules, /* out */
	mach_msg_type_number_t *modulesCnt
)
kernel module interface (obsolete as of SnowLeopard) see mach/kmod.h kmod_ MIG calls now return KERN_NOT_SUPPORTED on PPC/i386/x86_64.
MIG routine from mach/mach_host.defs

functionhost_virtual_physical_table_info

extern kern_return_t host_virtual_physical_table_info(
	host_t host,
	hash_info_bucket_array_t *info, /* out */
	mach_msg_type_number_t *infoCnt
)
was host_zone_info Returns information about the global VP table. Only supported in MACH_VM_DEBUG kernels, otherwise returns KERN_FAILURE.
MIG routine from mach/mach_host.defs

functionprocessor_set_default

extern kern_return_t processor_set_default(
	host_t host,
	processor_set_name_t *default_set /* out */
)
was disable_bluebox Get default processor set for host.
MIG routine from mach/mach_host.defs
CMU/MIT Mach reference · manual page · © Carnegie Mellon
Return the default processor set.
The processor_set_default function returns the name port for the default processor set for the specified host. The default processor set is used by all threads, tasks and processors that are not explicitly assigned to other sets.

functionprocessor_set_create

extern kern_return_t processor_set_create(
	host_t host,
	processor_set_t *new_set, /* out */
	processor_set_name_t *new_name /* out */
)
OBSOLETE interfaces, removed from kernel
MIG routine from mach/mach_host.defs
CMU/MIT Mach reference · manual page · © Carnegie Mellon
Create a new processor set object.
The processor_set_create function creates a new processor set and returns the two ports associated with it. The port returned in new_set is the control port representing the set. It is used to perform operations such as assigning processors, tasks or threads. The port returned in new_name is the name port which identifies the set, and is used to obtain information about the set.

functionmach_memory_object_memory_entry_64

extern kern_return_t mach_memory_object_memory_entry_64(
	host_t host,
	boolean_t internal,
	memory_object_size_t size,
	vm_prot_t permission,
	memory_object_t pager,
	mach_port_t *entry_handle /* out */
)
MIG routine from mach/mach_host.defs
claude-fable-5, 2026-08-24 · not from Apple sources · verified against xnu osfmk/vm/vm_memory_entry.c
Creates a named memory entry backed by the given memory object (pager), returning a send right in entry_handle that can be mapped with vm_map or mach_vm_map. If pager is MEMORY_OBJECT_NULL and internal is TRUE, a fresh anonymous VM object of the given size backs the entry. permission gives the entry's protection. Returns KERN_INVALID_HOST if host is HOST_NULL, KERN_INVALID_ARGUMENT if no VM object can be derived from pager. Since user space has no way to create a memory_object_t, the pager-backed form is only usable from kernel/IOKit code; see mach_make_memory_entry_64 for the user-level way to make named entries.

functionhost_statistics

extern kern_return_t host_statistics(
	host_t host_priv,
	host_flavor_t flavor,
	host_info_t host_info_out, /* out */
	mach_msg_type_number_t *host_info_outCnt
)
Return statistics from this host.
MIG routine from mach/mach_host.defs
CMU/MIT Mach reference · manual page · © Carnegie Mellon
Return statistics for a host.
The host_statistics function returns scheduling and virtual memory statistics concerning the host as specified by flavor.

functionhost_request_notification

extern __TVOS_PROHIBITED __WATCHOS_PROHIBITED 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.

functionhost_lockgroup_info

extern kern_return_t host_lockgroup_info(
	host_t host,
	lockgroup_info_array_t *lockgroup_info, /* out */
	mach_msg_type_number_t *lockgroup_infoCnt
)
MIG routine from mach/mach_host.defs
claude-fable-5, 2026-08-24 · not from Apple sources · verified against xnu osfmk/kern/lock_group.c
Returns an array of lockgroup_info_t structures, one per lock group registered in the kernel. Each entry carries the group's name and its counts of spin locks, mutexes, and reader-writer locks; on CONFIG_DTRACE kernels the mutex/spin contention statistics (held, miss, wait counts) are filled in as well. The array is returned out of line and should be deallocated by the caller with vm_deallocate. Returns KERN_INVALID_HOST if host is HOST_NULL. Consumed by lock-profiling tools such as lockstat.

functionhost_statistics64

extern kern_return_t host_statistics64(
	host_t host_priv,
	host_flavor_t flavor,
	host_info64_t host_info64_out, /* out */
	mach_msg_type_number_t *host_info64_outCnt
)
Return 64-bit statistics from this host.
MIG routine from mach/mach_host.defs

functionmach_zone_info

extern kern_return_t mach_zone_info(
	mach_port_t host,
	mach_zone_name_array_t *names, /* out */
	mach_msg_type_number_t *namesCnt,
	mach_zone_info_array_t *info, /* out */
	mach_msg_type_number_t *infoCnt
)
Returns information about the memory allocation zones. Data returned is compatible with various caller and kernel address space sizes.
MIG routine from mach/mach_host.defs

functionhost_create_mach_voucher

extern __TVOS_PROHIBITED __WATCHOS_PROHIBITED 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 __TVOS_PROHIBITED __WATCHOS_PROHIBITED 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 __TVOS_PROHIBITED __WATCHOS_PROHIBITED 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 __TVOS_PROHIBITED __WATCHOS_PROHIBITED 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

functionhost_get_atm_diagnostic_flag

extern __TVOS_PROHIBITED __WATCHOS_PROHIBITED kern_return_t host_get_atm_diagnostic_flag(
	host_t host,
	uint32_t *diagnostic_flag
)
claude-fable-5, 2026-08-24 · not from Apple sources · verified against xnu libsyscall/mach/host.c
Returns the ATM (Activity Trace Manager) diagnostic configuration word. Implemented entirely in Libsystem_kernel: the value is read from the commpage (COMM_PAGE_READ of ATM_DIAGNOSTIC_CONFIG), so no message is sent and the call always returns KERN_SUCCESS. The value is set by the privileged host_set_atm_diagnostic_flag call.

functionmach_memory_info

extern kern_return_t mach_memory_info(
	mach_port_t host,
	mach_zone_name_array_t *names, /* out */
	mach_msg_type_number_t *namesCnt,
	mach_zone_info_array_t *info, /* out */
	mach_msg_type_number_t *infoCnt,
	mach_memory_info_array_t *memory_info, /* out */
	mach_msg_type_number_t *memory_infoCnt
)
MIG routine from mach/mach_host.defs
claude-fable-5, 2026-08-24 · not from Apple sources · verified against xnu osfmk/kern/zalloc.c
Returns kernel zone allocator statistics: parallel out-of-line arrays of zone names and mach_zone_info_t (as mach_zone_info), plus a mach_memory_info_array_t describing wired-memory allocation sites (kernel tags and kexts). If host is the privileged host port and the caller is root, full information is returned; otherwise the info is redacted (sizes zeroed, kalloc-type zones coalesced). On some platforms an unredacted call also requires the com.apple.private.memoryinfo entitlement and is rate-limited. The caller should vm_deallocate the returned arrays. Consumed by zprint(1) and memorymaintenanced.

functionhost_set_multiuser_config_flags

extern kern_return_t host_set_multiuser_config_flags(
	host_priv_t host_priv,
	uint32_t multiuser_flags
)
Update the global multiuser flags, readable from the commpage
MIG routine from mach/mach_host.defs

functionhost_get_multiuser_config_flags

extern kern_return_t host_get_multiuser_config_flags(
	host_t host,
	uint32_t *multiuser_flags
)
claude-fable-5, 2026-08-24 · not from Apple sources · verified against xnu libsyscall/mach/host.c
Returns the multiuser configuration flags word (e.g. kIsMultiUserDevice), read directly from the commpage (COMM_PAGE_READ of MULTIUSER_CONFIG) without a kernel call. Only meaningful on embedded (iOS-family) devices; elsewhere returns KERN_NOT_SUPPORTED.

functionhost_check_multiuser_mode

extern kern_return_t host_check_multiuser_mode(host_t host, uint32_t *multiuser_mode)
claude-fable-5, 2026-08-24 · not from Apple sources · verified against xnu libsyscall/mach/host.c
Sets *multiuser_mode to 1 if the device is configured as a multiuser (shared) device, 0 otherwise, by testing kIsMultiUserDevice in the commpage multiuser configuration flags (see host_get_multiuser_config_flags). Returns KERN_NOT_SUPPORTED where no multiuser configuration exists (macOS, simulator).

functionmach_zone_info_for_zone

extern kern_return_t mach_zone_info_for_zone(
	host_priv_t host,
	mach_zone_name_t name,
	mach_zone_info_t *info /* out */
)
Returns information about a specific zone. The zone name is passed in via the argument name, info returns the zone info.
MIG routine from mach/mach_host.defs

functionmach_memory_info_redacted

extern kern_return_t mach_memory_info_redacted(
	mach_port_t host,
	mach_zone_name_array_t *names, /* out */
	mach_msg_type_number_t *namesCnt,
	mach_zone_info_array_t *info, /* out */
	mach_msg_type_number_t *infoCnt,
	mach_memory_info_array_t *memory_info, /* out */
	mach_msg_type_number_t *memory_infoCnt
)
Always returns the redacted version of the mach_memory_info output
MIG routine from mach/mach_host.defs