LIBTRACEEVENT(3)
β¨ LIBTRACEEVENT(3) β¨
okay bestie, welcome to the libtraceevent manual π this one's about a single lil function that reads the header page and sets up your trace event parser context. it's giving foundational. it's giving "you need this before anything else works." let's get into it π«Ά
πΈ NAME πΈ
tep_parse_header_page β parses the data stored in the header page. that's it, that's the whole job. no cap π
π SYNOPSIS π
#include <event-parse.h>
int tep_parse_header_page(struct tep_handle *tep, char *buf, unsigned long size, int long_size);
π DESCRIPTION π
so here's the tea β β tep_parse_header_page() parses the header page data sitting in buf, and it initializes tep (your trace event parser context, the main character of this whole library) with it. the buffer buf comes with size, and it's supposed to be copied from tracefs/events/header_page. literally that's where it lives. go get it from there, don't improvise π
β οΈ heads up: some old kernels do not have header page info. like, it's just not there. in this case, you can calltep_parse_header_page()withsizeequal to0. and then thetepcontext gets initialized with default values instead. it's fine, she copes π
and in that use case, you can use long_size to set the size of a long integer to be used. so you're not left hanging β you still get to tell it how big your longs are. iconic behavior honestly β¨
π₯ RETURN VALUE π₯
0β success, we ate π-1β an error happened, not slay π
β EXAMPLE β
here's how it looks in the wild, bestie. copy it, run it, live your truth:
#include <event-parse.h>
...
struct tep_handle *tep = tep_alloc();
...
char *buf;
int size;
buf = read_file("/sys/kernel/tracing/events/header_page", &size);
if (tep_parse_header_page(tep, buf, size, sizeof(unsigned long)) != 0) {
/* Failed to parse the header page */
}
...
see that sizeof(unsigned long)? that's your long_size in action. and that comment in the if is the sad path β if it's not 0, the parse failed. tragic but informative π
π¦ FILES π¦
event-parse.hβ the header file you need to include so you can actually access the library APIs. no include, no vibes. periodt.-ltraceeventβ the linker switch to add when building a program that uses the library. don't forget it or the linker will simply not know her π
πΈ SEE ALSO πΈ
go read those next, iykyk π
π AUTHOR π
- Steven Rostedt
<rostedt@goodmis.org[1]>β author of libtraceevent. the originator. the blueprint. π - Tzvetomir Stoyanov
<tz.stoyanov@gmail.com[2]>β author of this man page. thank you for your service π«Ά
π REPORTING BUGS π
found a bug? don't gatekeep it, report it to <linux-trace-devel@vger.kernel.org[3]> β¨
π LICENSE π
libtraceevent is Free Software licensed under the GNU LGPL 2.1. free as in freedom, bestie π
π RESOURCES π
https://git.kernel.org/pub/scm/libs/libtrace/libtraceevent.git/
the source. the mothership. go look π§
π NOTES π
rostedt@goodmis.orgβmailto:rostedt@goodmis.orgtz.stoyanov@gmail.comβmailto:tz.stoyanov@gmail.comlinux-trace-devel@vger.kernel.orgβmailto:linux-trace-devel@vger.kernel.org
and that's the whole page, bestie π this was libtraceevent 1.9.0, dated 06/15/2026 β go parse that header page and slay β¨π¦ no cap fr fr π
π¦ where this page comes from
- ubuntu stonking: libtraceevent-doc 1:1.9.0-2 Β· LGPL-2.1-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms