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

Write a minimal Linux 6.12 network driver with alloc_etherdev, net_device_ops, ndo_start_xmit and netif_rx, then read its counters with ip and ethtool.

Write a Linux 6.12 GPIO controller driver with struct gpio_chip: direction, get and set callbacks, locking, registration and the generic MMIO helper.

How an IOMMU translates and restricts device DMA on Linux 6.12, how IOMMU groups and domains work, and how to check the setup from sysfs and boot flags.

Implement struct pci_error_handlers in a Linux 6.12 driver: error_detected, slot_reset and resume, how the AER core drives them and what each must restore.

Choose between dma_alloc_coherent and dma_map_single in a Linux 6.12 PCI driver by lifetime, access pattern and cost, with the mask, sync and unmap rules.

Request MSI, MSI-X or legacy interrupts in a Linux 6.12 PCI driver with pci_alloc_irq_vectors, bind handlers per vector and release them in the right order.

Make a Linux 6.12 USB driver survive unplug during reads and writes with kref, an io_mutex, a disconnect flag, usb_poison_urb and anchored URB cancellation.

Turn a Linux 6.12 board with a USB device controller into a USB serial and Ethernet gadget using configfs and libcomposite, with the exact directory steps.

Queue several bulk URBs from a Linux 6.12 driver, limit how many are in flight, and handle completions in atomic context without leaking memory.

Learn what register_filesystem does, which file_system_type fields matter, how mount finds your type by name, and how to unregister it safely on module unload.