synth_event_add_val(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… synth_event_add_val(9) β€” like, the Kernel API Manual, but make it make sense

okay so bestie, welcome to the glow-up of synth_event_add_val(9) from the Kernel API Manual. this page is about adding a named field's value to an open synth trace, and honestly? she's iconic for it. let's get into it πŸŽ€


✨ NAME ✨

synth_event_add_val β€” add a named field's value to an open synth trace πŸ¦‹


🌸 SYNOPSIS 🌸

int synth_event_add_val (const char *field_name , u64 val , struct
synth_event_trace_state *trace_state );

like, that's the whole signature, no notes πŸ’…


🫢 ARGUMENTS 🫢

  • field_name β€” the name of the synthetic event field value you wanna set. it's your little label, your name tag at the party 🏷️
  • val β€” the value you're setting that named field to. the actual content, the main character of the operation ✨
  • trace_state β€” a pointer to the object that's tracking the piecewise trace state. think of her as the group chat admin keeping receipts πŸ“‹

πŸ”₯ DESCRIPTION πŸ”₯

so what she does is: set the value of the named field in an event that's been opened by synth_event_trace_start. that's the setup, that's the prerequisite, don't skip it πŸ™ˆ

the val param should be the value cast to u64. and if the value points to a string? then the val param should be a char * cast to u64. yep, that's the move, that's the vibe 🧚

what she does under the hood: this function looks up the field name, and if found, sets the field to the specified value. lowkey slay. but ngl, this lookup makes this function more expensive than synth_event_add_next_val, so use that β€” or the none-piecewise synth_event_trace β€” instead if efficiency is more important. know your tradeoffs, bestie πŸ’€

note however that synth_event_add_next_val and synth_event_add_val can't be intermixed for a given event trace β€” one or the other but not both can be used at the same time. pick a lane, periodt 🚫
note also that synth_event_trace_end must be called after all values have been added for each event trace, regardless of whether adding all field values succeeded or not. yes even if it went sideways. especially if it went sideways. clean up after yourself 😭

⭐ RETURN ⭐

0 on success, err otherwise. that's it, that's the whole report card πŸ“


🌈 SEE ALSO 🌈


and that's the whole page, babes πŸ’– this lil sign-off comes to you straight from ./kernel/trace, dated October 2026, and yes it's still synth_event_add_val(9) β€” she's booked, she's busy, she's in the kernel fr fr πŸ¦‹βœ¨πŸŽ€

πŸ“¦ where this page comes from