
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
7 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.

Read kernel and driver messages on macOS 15 with log show and log stream, using predicates on process, subsystem and message text, plus time ranges and levels.

Read macOS kernel state from Terminal with sysctl and ioreg: hardware sizes, boot time, the device registry, USB devices, and how to filter the output.

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.