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

mach/mach_error.h

File: mach_error.h Author: Douglas Orr, Carnegie Mellon University Date: Mar. 1988 Definitions of routines in mach_error.c
3 functions · 1 macro

macro_MACH_ERROR_

#define _MACH_ERROR_ 1

functionmach_error_string

char *mach_error_string(
	/* Returns a string appropriate to the error argument given */
	mach_error_t error_value
)
claude-fable-5, 2026-08-24 · not from Apple sources · verified against xnu libsyscall/mach/mach_error_string.c, libsyscall/mach/error_codes.c
Returns a pointer to a static human-readable string describing the given error, such as "(os/kern) invalid argument". Decodes the mach_error_t system/subsystem/code encoding (see mach/error.h), first mapping old-style flat error numbers (IPC, MIG, netname, and similar historical ranges) into the modern encoding, and consulting per-system string tables covering the kernel, user-space, server, IPC, VM, libkern, and IOKit error systems. Unrecognized values yield strings such as "unknown error code" or "(?/?) unknown error system". The returned storage must not be modified or freed.

functionmach_error

void mach_error(
	/* Prints an appropriate message on the standard error stream */
	const char *str,
	mach_error_t error_value
)
claude-fable-5, 2026-08-24 · not from Apple sources · verified against xnu libsyscall/mach/mach_error.c
Prints a diagnostic on the standard error stream: the caller-supplied string followed by the human-readable description of error_value as returned by mach_error_string. When full diagnostics are enabled (the global mach_error_full_diag) or the code is not recognized, the output also includes the error type from mach_error_type and the numeric value in hexadecimal.

functionmach_error_type

char *mach_error_type(
	/* * Returns a string with the error system,
	subsystem and code */ mach_error_t error_value
)
claude-fable-5, 2026-08-24 · not from Apple sources · verified against xnu libsyscall/mach/mach_error_string.c, libsyscall/mach/error_codes.c
Returns a pointer to a static string naming the error system and subsystem of the given error, such as "(os/kern)", after mapping old-style flat error numbers into the modern system/subsystem/code encoding. Returns "(?/?)" if the system or subsystem is not recognized. The returned storage must not be modified or freed.