UTRACE(2)
π« UTRACE(2) β bestie edition π«
okay so real talk, this one lives in the System Calls Manual and it's from the Standard C Library (libc, -lc) β iykyk, that's the manual section number in the parens, not a vibe check result π«Ά
πΈ NAME πΈ
utrace β drop a little user record into your ktrace log, no cap β¨
π LIBRARY π
Standard C Library (libc, -lc) β she's literally built in, you don't even have to link anything extra π
π¦ SYNOPSIS π¦
#include <sys/param.h>
#include <sys/time.h>
#include <sys/uio.h>
#include <sys/ktrace.h>
int
utrace(const void *addr, size_t len);
β¨ DESCRIPTION β¨
So what this does: it adds a record to the process trace, and that info is supplied by you, the user. Iconic behavior honestly π
The record it makes contains len bytes straight from memory, pointed at by addr. That's the whole vibe.
β οΈ big one bestie: this call only has an effect if the calling process is being traced. If nobody's tracing you, it's giving "talking to a wall" π nothing happens, no notes.
π RETURN VALUES π
Slayed successfully? You get the value 0 back π
Otherwise you get -1, and the global variable errno gets set to tell you what went wrong. Fr fr, always check errno π
π₯ ERRORS π₯
[EINVAL]β the specified data lengthlenwas bigger thanKTR_USER_MAXLEN. bestie that's too much data, pick a smallerlenπ[ENOMEM]β insufficient memory to honor the request. she simply did not have the RAM to serve you π[ENOSYS]β the currently running kernel was compiled withoutktrace(2)support (that's theoptions KTRACEknob). so likeβ¦ this whole syscall doesn't exist on your kernel, sorry π«
π SEE ALSO π
go read those next, they're the friend group π§π
π HISTORY π
The utrace() system call first appeared in FreeBSD 2.2. a true vintage queen, we stan an elder πΈ
and that's the whole page bestie! π this version was brought to you by the Debian crew, dated December 11, 2015 β mwah, go trace something cute ππ¦
π¦ where this page comes from
- freebsd 14.5: base 14.5
- freebsd 15.1: base 15.1
- Copyright (c) 2000 The NetBSD Foundation, Inc
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms