#include <kern/ipc_mig.h>
kern/ipc_mig.h
Send a message from the kernel
functionmach_msg_send_from_kernel_proper
extern mach_msg_return_t mach_msg_send_from_kernel_proper( mach_msg_header_t *msg, mach_msg_size_t send_size )
▾
claude-fable-5, 2026-08-24 · not from Apple sources · verified against xnu osfmk/kern/ipc_mig.c
Sends a message from kernel space, used by the client side of KernelUser MIG interfaces to implement SimpleRoutines; this is the supported variant for kernel extensions (the _proper suffix distinguishes it from the historical unaligned-ABI symbol). The message is copied in from kernel memory and sent with MACH_SEND_KERNEL_DEFAULT semantics and no timeout. Returns MACH_MSG_SUCCESS when the message is sent, MACH_SEND_INVALID_DEST for a bad destination port, or MACH_SEND_NO_BUFFER if a message buffer cannot be obtained; on failure the message contents are destroyed.
macromach_msg_send_from_kernel
#define mach_msg_send_from_kernel mach_msg_send_from_kernel_proper
functionkernel_mach_msg_send_with_builder
extern mach_msg_return_t kernel_mach_msg_send_with_builder( mach_msg_size_t descriptor_count, /* Warning: NOT total send size */ mach_msg_size_t payload_size, /* Warning: NOT total send size */ /* Nullable */ /* Nullable */ void (^builder)(mach_msg_header_t *header, mach_msg_descriptor_t *__counted_by(descriptor_count)descs, void *__sized_by(payload_size)payload) )
▾
claude-fable-5, 2026-08-24 · not from Apple sources · verified against xnu osfmk/kern/ipc_mig.c
Sends a kernel message constructed in place: allocates a kmsg sized for descriptor_count descriptors plus payload_size bytes of payload (payload_size excludes the header and descriptors, and is not the total send size), then invokes the builder block with pointers to the header, the descriptor array (NULL when descriptor_count is 0), and the payload area. A nonzero descriptor count implies a complex message and the builder must set MACH_MSGH_BITS_COMPLEX; the builder must also set msgh_size to the total size. Sent with MACH_SEND_KERNEL_DEFAULT semantics and no timeout. Returns MACH_SEND_NO_BUFFER if the message cannot be allocated, otherwise the send result.
functionmach_msg_rpc_from_kernel_proper
extern mach_msg_return_t mach_msg_rpc_from_kernel_proper( mach_msg_header_t *msg, mach_msg_size_t send_size, mach_msg_size_t rcv_size )
▾
claude-fable-5, 2026-08-24 · not from Apple sources · verified against xnu osfmk/kern/ipc_mig.c
Sends a message from the kernel and receives a reply into the same buffer, using the calling thread's reply port; used by the client side of KernelUser MIG interfaces to implement Routines. This is the supported variant for kernel extensions. msgh_local_port must be MACH_PORT_NULL; the wait for the reply is uninterruptible. Returns MACH_MSG_SUCCESS when the reply is received, MACH_RCV_PORT_DIED if the reply port was deallocated, or a send error; rcv_size bounds the reply.
functionmach_msg_destroy_from_kernel_proper
extern void mach_msg_destroy_from_kernel_proper(mach_msg_header_t *msg)
▾
claude-fable-5, 2026-08-24 · not from Apple sources · verified against xnu osfmk/kern/ipc_mig.c
Destroys an unwanted or unexpected reply message held by a kernel-side MIG user stub, releasing the port rights and descriptor resources the message carries, in the manner of ipc_kmsg_destroy but operating on bare message contents. This is the supported variant for kernel extensions.
macromach_msg_rpc_from_kernel
#define mach_msg_rpc_from_kernel mach_msg_rpc_from_kernel_proper
macromach_msg_destroy_from_kernel
#define mach_msg_destroy_from_kernel mach_msg_destroy_from_kernel_proper