trace_array_get_by_name(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

🌸 trace_array_get_by_name β€” the kernel API manual page, bestie edition 🌸

Okay so this is trace_array_get_by_name(9) from the Kernel API Manual, and ngl it's one of those little functions that's lowkey doing a LOT behind the scenes πŸ’… stay with me.


✨ NAME ✨

trace_array_get_by_name β€” create or look up a trace array, given its name. That's it, that's the whole vibe πŸŽ€


πŸ¦‹ SYNOPSIS πŸ¦‹

struct trace_array * trace_array_get_by_name (const char *name , const
char *systems );

πŸ’– ARGUMENTS πŸ’–

  • name β€” the name of the trace array you wanna look up or create. Like the handle, the ID, the name-tag of trace arrays 🏷️
  • systems β€” a list of systems to create event directories for. Pass NULL and you get all of them, no thoughts head empty, everything, the whole buffet πŸ“

🌈 DESCRIPTION 🌈

So it returns a pointer to the trace array with the given name. And if it can't be created? You get NULL. That's it. That's the whole deal. πŸ’€


πŸ‘‘ NOTE πŸ‘‘

Okay bestie this part is important, do NOT skip it πŸ™ˆ

This function increments the reference counter associated with the trace array it returns. Which is literally what makes sure it can't be freed while it's in use. Iconic, protective, main character energy. ✨

Use trace_array_put once the trace array is no longer needed. Periodt.

If the trace_array is going to be freed, trace_array_destroy needs to be called after the trace_array_put, or you can simply let user space delete it from the tracefs instances directory.

But β€” and this is the key part β€” until the trace_array_put is called, user space can not delete it. Like, physically cannot. It's locked in. πŸ”’

πŸ”₯ SEE ALSO πŸ”₯

Kernel file ./kernel/trace/trace.c and honestly a whole friend group of functions: trace_array_put(9), tracing_is_enabled(9), tracing_on(9), tracing_snapshot(9), tracing_alloc_snapshot(9), tracer_tracing_disable(9), tracer_tracing_enable(9), tracing_off(9), tracer_tracing_is_on(9), tracing_is_on(9), register_tracer(9), tracing_start(9), tracing_stop(9), trace_buffered_event_enable(9), trace_buffered_event_disable(9), trace_dump_stack(9), ignore_event(9), trace_adjust_address(9), tracing_update_buffers(9), trace_user_fault_destroy(9), trace_user_fault_init(9), trace_user_fault_get(9), trace_user_fault_put(9), trace_user_fault_read(9), err_pos(9), tracing_log_err(9), tracing_init_dentry(9)


🧚 And that's the page!! It lives in ./kernel/trace, it's dated October 2026, and it comes to you straight from the Kernel API Manual. Go forth and trace_array_put responsibly, bestie πŸ«ΆπŸ’œ

πŸ“¦ where this page comes from