IT lexicon › Programming › ktrace

ktrace

Programming På svenska → Updated: 2026-11-08

The BSD way to record a process's system calls to a file and read them afterwards: strace, only older and in two steps.

ktrace shipped with 4.4BSD and lives on in FreeBSD, NetBSD and OpenBSD. The kernel logs every system call, return value, signal and name lookup for the target process and writes it all in binary to ktrace.out. You then read that file with kdump, which turns it into text.

The split makes recording cheap and after-the-fact analysis easy, but it feels odd if you're used to strace scrolling output at you live. macOS carried ktrace for a while before replacing it with the DTrace-based dtruss. When a program can't find its config file, three lines of kdump output usually tell you where it looked.

← Back to the lexicon