trace_array_printk(9)
β¨ trace_array_printk β Kernel API Manual β¨
okay so bestie, we're in the trace_array_printk(9) manual page today π
and honestly? it's a good one. it's all about printing messages into your own tracing instance instead of being messy and yelling into the top-level buffer. main character energy only, no cap π
πΈ NAME πΈ
trace_array_printk β print a message to a specific instance
like, a specific one. not all of them. we're being polite about it π«Ά
π¦ SYNOPSIS π¦
int trace_array_printk (struct trace_array *tr , unsigned long ip ,
const char *fmt , ... );
look at that signature. iconic. it returns an int, it takes a struct trace_array *tr, an unsigned long ip, a const char *fmt, and then the classic ... because it's a printf-style situation and it will eat however many variable arguments you feed it π
π ARGUMENTS π
trβ the instance trace_array descriptor. this is your instance's little ID card, okay? gotta know which buffer we're talking to πͺͺipβ the instruction pointer that this is called from. yes literally, the instruction pointer. you pass it in, it gets recorded, that's the vibe βfmtβ the format to print (printf format, bestie, so all your usual format specifiers live here) β¨...β variable arguments. as many as yourfmtasks for. no more, no less, we're not doing that π
π₯ DESCRIPTION π₯
so here's the tea β if a subsystem sets up its own instance, they have the right to printk strings into their own tracing instance buffer using this function. that's it. that's the whole deal. your instance, your buffer, your rules π
but β and this is the important part, so listen up β this function will not write into the top level buffer. nope. not doing it. if you want the top level buffer, use trace_printk for that. and why, you ask? because writing into the top level buffer should only have events that can be individually disabled. it's a whole thing about keeping the top level clean and disable-able, iykyk π§
also, trace_printk is only used for debugging a kernel, and should not be ever incorporated in normal use. like, ever ever. it's a debugging tool, not a lifestyle π«Ά
trace_array_printk, on the other hand, can be used, as it will not add noise to the top level tracing buffer. so you get your messages, and the top level buffer stays unbothered and pristine. slay π
β οΈ real talk though: note thattrace_array_init_printkmust be called ontrbefore this can be used. before. not after, not "ehh it'll probably work", before. do the init first or this whole thing is a no π
π SEE ALSO π
- Kernel file
./kernel/trace/trace_printk.cβ__trace_puts(9),__trace_bputs(9),trace_vbprintk(9),trace_array_init_printk(9)π¦
and that's the page, bestie!! π source/version is ./kernel/trace and the date on this beauty is October 2026 β go forth and print into your own instance only, periodt ππ₯
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms