
Mach Traps vs BSD System Calls on macOS
Learn how macOS routes one trap instruction to either a Mach trap or a BSD system call, how the number sign and class decide, and why you should call libSystem.
Tag
5 posts

Learn how macOS routes one trap instruction to either a Mach trap or a BSD system call, how the number sign and class decide, and why you should call libSystem.

How Mach ports, port rights and mach_msg work on macOS 15, with a complete client and server in C using the bootstrap server, plus where XPC sits on top.

Choose between DriverKit, system extensions and legacy kexts on macOS 15: what each runs in, what it can reach, how it installs, and a decision table.

How XNU combines Mach, a BSD layer and IOKit in one kernel: what each part owns, how a process maps to a task, and how a read call crosses all three.

A map of the XNU kernel behind macOS: Mach tasks and ports, the BSD layer, IOKit, system call entry, virtual memory, security layers, extensions and boot.