err_pos(9)
π¦ err_pos(9) β like, the Kernel API Manual page, bestie π¦
okay so we're in the <pink>Kernel API Manual</pink> today and the star of the show is err_pos(9) β yes, that's the manual section, she's a kernel function, it's giving very "I live in ./kernel/trace/trace.c" energy π
β¨ NAME β¨
err_pos β find the position of a string within a command for error careting π―
no fr, that's literally it. you give her a command and a string, she tells you where in that command the string is so your error message can point at it with a little caret. iconic behaviour honestly.
πΈ SYNOPSIS πΈ
unsigned int err_pos (char *cmd , const char *str );
that's the whole vibe. two args, one unsigned int coming back at you π«Ά
π ARGUMENTS π
cmdβ the tracing command that caused the error π like, the actual command string that did the oopsie.strβ the string you wanna position the caret at, withincmd. that's the thing you're hunting for π
π DESCRIPTION π
okay so here's the tea, bestie: err_pos finds the position of the first occurrence of str within cmd. first one, not all of them β she's not doing a whole search party, just the first match π
and the return value? you can pass it straight to tracing_log_err for caret placement within cmd. so like, your error message can go:
here's the command
^
right there
which is honestly so helpful and lowkey main character energy β¨
the details, fr fr:
- returns the index within
cmdof the first occurrence ofstrπ― - returns
0ifstrwas not found π
β οΈ okay important little heads up:0is the "not found" answer, so don't go assuming index0means "it's at the very start" without thinking about it, iykyk. that's just what the page says, no cap.
π SEE ALSO π
the whole friend group π β and yes, we're listing every single one, because they all matter:
Kernel file ./kernel/trace/trace.c : 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), tracing_log_err(9), trace_array_get_by_name(9), tracing_init_dentry(9)
like, go read them, they're all slaying in their own way π§
and that's the page!! π sign-off time: this one lives in <cyan>./kernel/trace</cyan>, dated October 2026, and yes she's err_pos(9) all the way down β mwah πβ¨ π¦
π¦ 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