tracing_map_read_var_once(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… tracing_map_read_var_once(9) πŸ’…

okay so bestie, welcome to the tracing_map_read_var_once page β€” it lives in the Kernel API Manual (section 9, the kernel-functions girlies) and it's basically the "read it and yeet it" function for a tracing_map_elt's variable field. iconic behaviour, honestly.


✨ SYNOPSIS ✨

u64 tracing_map_read_var_once (struct tracing_map_elt *elt , unsigned int i );

like, you give it an elt and an i, and it hands you back a u64. that's the whole vibe check. 🫢


🌸 ARGUMENTS 🌸

  • elt β€” the tracing_map_elt. yes, THE elt. the main character. πŸ‘‘
  • i β€” the index of the given variable associated with the tracing_map_elt. it's giving "which one, bestie?" energy. πŸ”

πŸ’– DESCRIPTION πŸ’–

okay so here's the tea. this function retrieves the value of the variable i associated with the specified tracing_map_elt instance β€” and then it resets that variable to the 'not set' state. read AND reset, in one lil call. ate and left no crumbs. πŸ’…

the index i is the index returned by the call to tracing_map_add_var when the tracing map was set up. so pls don't just make up a number, okay? use the one you got back. πŸ™ˆ

and the reset? that's lowkey the whole point: it essentially makes the variable a read-once variable β€” but only if it's only accessed using this function. so if you're calling this and also poking the variable some other way, that read-once fantasy is not happening, no cap. 😭


⭐ RETURN ⭐

the variable value associated with field i for elt. that's it, that's the return. a u64 and a dream. πŸ¦‹


πŸŽ€ SEE ALSO πŸŽ€

kernel file ./kernel/trace/tracing_map.c β€” and literally the whole tracing_map friend group, they're all here:


⚠️ friendly reminder bestie: tracing_map_read_var_once = read + reset. if you were banking on that value still being there afterwards, it is NOT. plan accordingly. πŸ’€

and that's the page! sourced from ./kernel/trace, dated October 2026 β€” mwah, go read some tracing maps, ily, bye! πŸŒˆπŸ’œπŸŽ€

πŸ“¦ where this page comes from