Skip to content
Mach trap#-17

svc · mach trap -17

_kernelrpc_mach_port_destroy_trap

Trap-level entry point that backs mach_port_destroy — removes all rights for a port name in one call.

Prototype

kern_return_t _kernelrpc_mach_port_destroy_trap(/* 2 args */);

Returns: kern_return_t

Version history

XNU tagmacOS#
xnu-2050.18.24macOS 10.8 Mountain Lion-17
xnu-2422.115.4macOS 10.9 Mavericks-17
xnu-2782.40.9macOS 10.10 Yosemite-17
xnu-3247.1.106macOS 10.11 El Capitan-17
xnu-3789.1.32macOS 10.12 Sierra-17
xnu-4570.1.46macOS 10.13 High Sierra-17
xnu-4903.221.2macOS 10.14 Mojave-17
xnu-6153.11.26macOS 10.15 Catalina-17
xnu-2050.22.13-17
xnu-2050.24.15-17
xnu-2050.48.11-17
xnu-2050.7.9-17
xnu-2050.9.2-17
xnu-2422.1.72-17
xnu-2422.100.13-17
xnu-2422.110.17-17
xnu-2422.90.20-17
xnu-2782.1.97-17
xnu-2782.10.72-17
xnu-2782.20.48-17
xnu-2782.30.5-17
xnu-3247.10.11-17
xnu-3248.20.55-17
xnu-3248.30.4-17
xnu-3248.40.184-17
xnu-3248.50.21-17
xnu-3248.60.10-17
xnu-3789.21.4-17
xnu-3789.31.2-17
xnu-3789.41.3-17
xnu-3789.51.2-17
xnu-3789.60.24-17
xnu-3789.70.16-17
xnu-4570.20.62-17
xnu-4570.31.3-17
xnu-4570.41.2-17
xnu-4570.51.1-17
xnu-4570.61.1-17
xnu-4570.71.2-17
xnu-4903.231.4-17
xnu-4903.241.1-17
xnu-4903.270.47-17
xnu-6153.101.6-17
xnu-6153.121.1-17
xnu-6153.141.1-17
xnu-6153.41.3-17
xnu-6153.61.1-17
xnu-6153.81.5-17

Notes

mach_port_destroy nukes every right (receive + send + send-once + dead name) associated with a given name in the caller's IPC space. Apple discourages its use because it tends to mask refcount bugs — the modern guidance is to call mach_port_mod_refs or mach_port_destruct with the proper guard token. On pinned or guarded ports the trap returns KERN_INVALID_RIGHT and may escalate to EXC_GUARD. The trap remains exported primarily for compatibility with very old (NeXTSTEP-era) code.

Detection

DTrace mach_trap probe only; no ES coverage. Frequent calls from non-legacy binaries are themselves a yellow flag.

Related APIs

_kernelrpc_mach_port_deallocate_trap_kernelrpc_mach_port_destruct_trap_kernelrpc_mach_port_mod_refs_trapmach_port_destroy