LIBTRACEEVENT(3)

πŸ’– LIBTRACEEVENT(3) β€” the libtraceevent manual, bestie edition πŸ’–

okay so you're here for tep_read_number and honestly? good taste. this is the libtraceevent manual page and i'm gonna walk you through it like we're texting at 2am. grab a snack πŸ“


✨ NAME ✨

tep_read_number β€” reads a number from raw data. that's it, that's the whole gig. no cap.


🌸 SYNOPSIS 🌸

first things first, you gotta pull in the header:

#include <event-parse.h>

unsigned long long tep_read_number(struct tep_handle *tep, const void *ptr, int size);

look at that signature. look at it. unsigned long long?? she's giving big number energy πŸ’…


πŸ¦‹ DESCRIPTION πŸ¦‹

okay so tep_read_number() reads an integer straight out of raw data, and the way it does this is so smart β€” it takes into account both the endianness of the raw data and the endianness of the current host. mixing endianness is a whole situation and this function just handles it for you. iconique.

let's break down the cast of characters:

  • tep β€” the trace event parser context. she's the main character, everything runs through her.
  • ptr β€” a pointer to the raw data, like, the actual spot where the integer is chillin'.
  • size β€” the size of the integer. yes bestie, you have to tell it. it's not psychic.

πŸ”₯ RETURN VALUE πŸ”₯

tep_read_number() hands you back the integer in the byte order of the current host. so whatever chaos the raw data was in, you get it in your host's native vibe. 🫢

but listen β€” if something goes wrong? it returns 0. zero. the void. the empty plate. so don't be out here assuming 0 always means "the number was zero", okay?? fr fr, check your errors.


🌈 EXAMPLE 🌈

here's how the girlies actually use it:

#include <event-parse.h>
...
struct tep_handle *tep = tep_alloc();
...
void process_record(struct tep_record *record)
{
    int offset = 24;
    int data = tep_read_number(tep, record->data + offset, 4);

    /* Read the 4 bytes at the offset 24 of data as an integer */
}
...

see what's happening? we're grabbing 4 bytes starting at offset 24 inside record->data and reading them as an integer. chef's kiss. 😭✨


πŸŽ€ FILES πŸŽ€

  • event-parse.h β€” the header file you include so you can actually access the library APIs. no include, no access, no exceptions.
  • -ltraceevent β€” the linker switch you add when building a program that uses the library. yes you need it. yes it goes in your build. don't forget it and then panic. πŸ™ˆ

⭐ SEE ALSO ⭐

go forth and read more, bestie:


πŸ‘‘ AUTHOR πŸ‘‘

  • Steven Rostedt <rostedt@goodmis.org> β€” author of libtraceevent. the originator. the blueprint.
  • Tzvetomir Stoyanov <tz.stoyanov@gmail.com> β€” author of this man page. thank her for the lore.

πŸ’€ REPORTING BUGS πŸ’€

found a bug? don't suffer in silence, tell someone:

Report bugs to <linux-trace-devel@vger.kernel.org>


πŸ’œ LICENSE πŸ’œ

libtraceevent is Free Software licensed under the GNU LGPL 2.1. free as in freedom, protected as in license. periodt.


🧚 RESOURCES 🧚

go, click, explore, become ungovernable.


πŸ’… NOTES πŸ’…

  1. rostedt@goodmis.org β†’ mailto:rostedt@goodmis.org
  2. tz.stoyanov@gmail.com β†’ mailto:tz.stoyanov@gmail.com
  3. linux-trace-devel@vger.kernel.org β†’ mailto:linux-trace-devel@vger.kernel.org

that's the whole page, you ate it up, i'm so proud of you. πŸ₯Ήβœ¨

this was libtraceevent version 1.9.0, dated 06/15/2026, and yeah β€” it's LIBTRACEEVENT(3), like we've been saying this whole time. mwah. πŸ’‹πŸŽ€

πŸ“¦ where this page comes from