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

mach/host_priv.h

23 functions · 3 macros

macro_host_priv_user_

#define _host_priv_user_ 

macrohost_priv_MSG_COUNT

#define host_priv_MSG_COUNT 26

functionhost_get_boot_info

extern kern_return_t host_get_boot_info(
	host_priv_t host_priv,
	kernel_boot_info_t boot_info /* out */
)
Get boot configuration information from kernel.
MIG routine from mach/host_priv.defs
CMU/MIT Mach reference · manual page · © Carnegie Mellon
Return operator boot information.
The host_get_boot_info function returns the boot-time information string supplied by the operator when priv_host was initialized. The constant KERNEL_BOOT_INFO_MAX (in \*L \*O) should be used to dimension storage for the returned string.

functionhost_reboot

extern kern_return_t host_reboot(host_priv_t host_priv, int options)
Reboot this host. Only available to privileged users.
MIG routine from mach/host_priv.defs
CMU/MIT Mach reference · manual page · © Carnegie Mellon
Reboot this host.
The host_reboot function reboots the specified host.
Notes. If successful, this call will not return.

functionhost_priv_statistics

extern kern_return_t host_priv_statistics(
	host_priv_t host_priv,
	host_flavor_t flavor,
	host_info_t host_info_out, /* out */
	mach_msg_type_number_t *host_info_outCnt
)
Return privileged statistics from this host.
MIG routine from mach/host_priv.defs

functionhost_default_memory_manager

extern kern_return_t host_default_memory_manager(
	host_priv_t host_priv,
	memory_object_default_t *default_manager, /* inout */
	memory_object_cluster_size_t cluster_size
)
Sets the default memory manager, the port to which newly-created temporary memory objects are delivered. [See (memory_object_default)memory_object_create.] Also sets the default cluster size used for pagein/pageout to this port. The old memory manager port is returned.
MIG routine from mach/host_priv.defs
CMU/MIT Mach reference · manual page · © Carnegie Mellon
Establish the official connection between the kernel and its default pager task.
The host_default_memory_manager function establishes the default memory manager for a host. The named manager will be the target for future memory_object_create calls.

functionvm_wire

extern kern_return_t vm_wire(
	host_priv_t host_priv,
	vm_map_t task,
	vm_address_t address,
	vm_size_t size,
	vm_prot_t desired_access
)
Specify that the range of the virtual address space of the target task must not cause page faults for the indicated accesses. [ To unwire the pages, specify VM_PROT_NONE. ]
MIG routine from mach/host_priv.defs
CMU/MIT Mach reference · manual page · © Carnegie Mellon
Modify the target region's paging characteristics.
The vm_wire function sets the pageability privileges for a region within the specified task's address space. wired_access specifies the types of accesses to the memory region which must not suffer from (internal) faults of any kind after this call returns. A non-null wired_access value indicates that the page is to be "wired" into memory; a null value indicates "un-wiring". The kernel maintains for the region a count of the number of times the region is wired. A page is wired into physical memory if any task accessing it has a non-zero wired count for the page. The region starts at the beginning of the virtual page containing address; it ends at the end of the virtual page containing address + size - 1. Because of this rounding to virtual page boundaries, the amount of memory affected may be greater than size. Use host_page_size to find the current virtual page size.
Notes. This interface is machine word length specific because of the virtual address parameter.
KERN_INVALID_ADDRESSThe address is illegal or specifies a non-allocated region.

functionthread_wire

extern kern_return_t thread_wire(
	host_priv_t host_priv,
	thread_act_t thread,
	boolean_t wired
)
Specify that the target thread must always be able to run and to allocate memory.
MIG routine from mach/host_priv.defs
CMU/MIT Mach reference · manual page · © Carnegie Mellon
Mark the thread as privileged with respect to kernel resources.
The thread_wire function marks the thread as "wired". A "wired" thread is always eligible to be scheduled and can consume physical memory even when free memory is scarce. This property should be assigned to threads in the default page-out path. Threads not in the default page-out path should not have this property to prevent the kernel's free list of pages from being exhausted.
KERN_INVALID_ARGUMENTthread is not a thread port..P host_priv is not the control port for the host on which thread executes.
GNU Mach reference · 7.1.4 Thread Settings · © FSF, GFDL
kern_return_t thread_wire(host_priv_t host_priv, thread_t thread, boolean_t wired)
The function thread_wire controls the VM privilege level of the thread thread. A VM-privileged thread never waits inside the kernel for memory allocation from the kernel's free list of pages or for allocation of a kernel stack. Threads that are part of the default pageout path should be VM-privileged, to prevent system deadlocks. Threads that are not part of the default pageout path should not be VM-privileged, to prevent the kernel's free list of pages from being exhausted. The functions returns KERN_SUCCESS if the call succeeded, KERN_INVALID_ARGUMENT if host_priv or thread was invalid. The thread_wire call is actually an RPC to host_priv, normally a send right for a privileged host port, but potentially any send right. In addition to the normal diagnostic return codes from the call's server (normally the kernel), the call may return mach_msg return codes.

functionvm_allocate_cpm

extern kern_return_t vm_allocate_cpm(
	host_priv_t host_priv,
	vm_map_t task,
	vm_address_t *address, /* inout */
	vm_size_t size,
	int flags
)
Obsolete
MIG routine from mach/host_priv.defs

functionhost_processors

extern kern_return_t host_processors(
	host_priv_t host_priv,
	processor_array_t *out_processor_list, /* out */
	mach_msg_type_number_t *out_processor_listCnt
)
Get list of processors on this host.
MIG routine from mach/host_priv.defs
CMU/MIT Mach reference · manual page · © Carnegie Mellon
Return a list of send rights representing all processor ports.
The host_processors function returns an array of send right ports for each processor existing on host_priv.

functionhost_get_clock_control

extern kern_return_t host_get_clock_control(
	host_priv_t host_priv,
	clock_id_t clock_id,
	clock_ctrl_t *clock_ctrl /* out */
)
Obsolete interfaces, removed from kernel
MIG routine from mach/host_priv.defs
CMU/MIT Mach reference · manual page · © Carnegie Mellon
Return a send right to a kernel clock's control port.
The host_get_clock_control function returns a send right to the control port for a kernel clock object. This right is used to set the clock's resolution and time.

functionkmod_create

extern kern_return_t kmod_create(
	host_priv_t host_priv,
	vm_address_t info,
	kmod_t *module /* out */
)
MIG routine from mach/host_priv.defs
claude-fable-5, 2026-08-24 · not from Apple sources · verified against xnu osfmk/mach/host_priv.defs, osfmk/mach/kmod.h
Obsolete; removed from the kernel. Part of the original kernel-module (kmod) loading interface: given the privileged host port and a kmod_info structure at the given address, it registered a new kernel module and returned its id. Kernel extension management moved to the OSKext/kext_request interfaces long ago; the MIG slot is skipped in the kernel, so the call fails with MIG_BAD_ID.

functionkmod_destroy

extern kern_return_t kmod_destroy(host_priv_t host_priv, kmod_t module)
MIG routine from mach/host_priv.defs
claude-fable-5, 2026-08-24 · not from Apple sources · verified against xnu osfmk/mach/host_priv.defs, osfmk/mach/kmod.h
Obsolete; removed from the kernel. Formerly unloaded the kernel module named by id, given the privileged host port. Superseded by the OSKext/kext_request interfaces; the MIG slot is skipped in the kernel, so the call fails with MIG_BAD_ID.

functionkmod_control

extern kern_return_t kmod_control(
	host_priv_t host_priv,
	kmod_t module,
	kmod_control_flavor_t flavor,
	kmod_args_t *data, /* inout */
	mach_msg_type_number_t *dataCnt
)
MIG routine from mach/host_priv.defs
claude-fable-5, 2026-08-24 · not from Apple sources · verified against xnu osfmk/mach/host_priv.defs, osfmk/mach/kmod.h
Obsolete; removed from the kernel. Formerly performed a control operation, selected by flavor, on a loaded kernel module (starting or stopping it, or exchanging data with it through the inout kmod_args_t buffer). Superseded by the OSKext/kext_request interfaces; the MIG slot is skipped in the kernel, so the call fails with MIG_BAD_ID.

functionhost_get_special_port

extern kern_return_t host_get_special_port(
	host_priv_t host_priv,
	int node,
	int which,
	mach_port_t *port /* out */
)
Get a given special port for a given node. Special ports are defined in host_special_ports.h; examples include the master device port. There are a limited number of slots available for system servers.
MIG routine from mach/host_priv.defs

functionhost_set_special_port

extern kern_return_t host_set_special_port(
	host_priv_t host_priv,
	int which,
	mach_port_t port
)
Set a given special port for the local node. See host_get_special_port.
MIG routine from mach/host_priv.defs

functionhost_set_exception_ports

extern kern_return_t host_set_exception_ports(
	host_priv_t host_priv,
	exception_mask_t exception_mask,
	mach_port_t new_port,
	exception_behavior_t behavior,
	thread_state_flavor_t new_flavor
)
Set an exception handler for a host on one or more exception types. These handlers are invoked for all threads on the host if there are no task or thread-specific exception handlers or those handlers returned an error.
MIG routine from mach/host_priv.defs

functionhost_get_exception_ports

extern kern_return_t host_get_exception_ports(
	host_priv_t host_priv,
	exception_mask_t exception_mask,
	exception_mask_array_t masks, /* out */
	mach_msg_type_number_t *masksCnt,
	exception_handler_array_t old_handlers, /* out */
	exception_behavior_array_t old_behaviors, /* out */
	exception_flavor_array_t old_flavors /* out */
)
Lookup some of the old exception handlers for a host
MIG routine from mach/host_priv.defs

functionhost_swap_exception_ports

extern kern_return_t host_swap_exception_ports(
	host_priv_t host_priv,
	exception_mask_t exception_mask,
	mach_port_t new_port,
	exception_behavior_t behavior,
	thread_state_flavor_t new_flavor,
	exception_mask_array_t masks, /* out */
	mach_msg_type_number_t *masksCnt,
	exception_handler_array_t old_handlerss, /* out */
	exception_behavior_array_t old_behaviors, /* out */
	exception_flavor_array_t old_flavors /* out */
)
Set an exception handler for a host on one or more exception types. At the same time, return the previously defined exception handlers for those types.
MIG routine from mach/host_priv.defs

functionmach_vm_wire

extern kern_return_t mach_vm_wire(
	host_priv_t host_priv,
	vm_map_t task,
	mach_vm_address_t address,
	mach_vm_size_t size,
	vm_prot_t desired_access
)
old host_load_symbol_table Specify that the range of the virtual address space of the target task must not cause page faults for the indicated accesses. [ To unwire the pages, specify VM_PROT_NONE. ]
MIG routine from mach/host_priv.defs

functionhost_processor_sets

extern kern_return_t host_processor_sets(
	host_priv_t host_priv,
	processor_set_name_array_t *processor_sets, /* out */
	mach_msg_type_number_t *processor_setsCnt
)
JMM - Keep all processor_set related items at the end for easy removal. List all processor sets on host.
MIG routine from mach/host_priv.defs
CMU/MIT Mach reference · manual page · © Carnegie Mellon
Return a list of send rights representing all processor set name ports.
The host_processor_sets function returns send rights for the name ports for each processor set currently existing on host.
Notes. If control ports to the processor sets are needed, use host_processor_set_priv.

functionhost_processor_set_priv

extern kern_return_t host_processor_set_priv(
	host_priv_t host_priv,
	processor_set_name_t set_name,
	processor_set_t *set /* out */
)
Get control port for a processor set.
MIG routine from mach/host_priv.defs
CMU/MIT Mach reference · manual page · © Carnegie Mellon
Translate a processor set name port into a processor set control port.
The host_processor_set_priv function returns send rights for the control port for a specified processor set currently existing on host_priv.

functionhost_set_UNDServer

extern kern_return_t host_set_UNDServer(
	host_priv_t host,
	UNDServerRef server
)
old get_dp_control_port Set the UserNotification daemon access port for this host. If this value is already set, the kernel will discard its reference to the previously registered port.
MIG routine from mach/host_priv.defs

functionhost_get_UNDServer

extern kern_return_t host_get_UNDServer(
	host_priv_t host,
	UNDServerRef *server /* out */
)
Get the UserNotification daemon access port for this host. This can then be used to communicate with that daemon, which in turn communicates with the User through whatever means available (pop-up-menus for GUI systems, text for non-GUI, etc..). Access to this port is restricted to privileged clients because it is a special purpose port intended for kernel clients. User level clients should go directly to the CFUserNotifcation services.
MIG routine from mach/host_priv.defs

functionkext_request

extern kern_return_t kext_request(
	host_priv_t host_priv,
	uint32_t user_log_flags,
	vm_offset_t request_data,
	mach_msg_type_number_t request_dataCnt,
	vm_offset_t *response_data, /* out */
	mach_msg_type_number_t *response_dataCnt,
	vm_offset_t *log_data, /* out */
	mach_msg_type_number_t *log_dataCnt,
	kern_return_t *op_result /* out */
)
Perform an operation with a kernel extension, on the kext loading system, or request information about loaded kexts or the state of the kext loading system. Active operations (load, unload, disable/enable) require host_priv/root access. Info retrieval does not. WARNING: THIS ROUTINE IS PRIVATE TO THE KEXT-MANAGEMENT STACK AND IS SUBJECT TO CHANGE AT ANY TIME.
MIG routine from mach/host_priv.defs

macrosubsystem_to_name_map_host_priv

#define subsystem_to_name_map_host_priv { "host_get_boot_info", 400 },
    { "host_reboot", 401 },
    { "host_priv_statistics", 402 },
    { "host_default_memory_manager", 403 },
    { "vm_wire", 404 },
    { "thread_wire", 405 },
    { "vm_allocate_cpm", 406 },
    { "host_processors", 407 },
    { "host_get_clock_control", 408 },
    { "kmod_create", 409 },
    { "kmod_destroy", 410 },
    { "kmod_control", 411 },
    { "host_get_special_port", 412 },
    { "host_set_special_port", 413 },
    { "host_set_exception_ports", 414 },
    { "host_get_exception_ports", 415 },
    { "host_swap_exception_ports", 416 },
    { "mach_vm_wire", 418 },
    { "host_processor_sets", 419 },
    { "host_processor_set_priv", 420 },
    { "host_set_UNDServer", 423 },
    { "host_get_UNDServer", 424 },
    { "kext_request", 425 }