LIBTRACEEVENT(3)
π LIBTRACEEVENT π
okay bestie, this is a libtraceevent manual page, and we're getting into the whole create/destroy/reference-counting situation for the trace event parser context. no cap, it's giving foundational.
β¨ NAME β¨
tep_alloc, tep_free, tep_ref, tep_unref, tep_get_ref, tep_kbuffer β um, literally create, destroy, and manage the references of a trace event parser context. that's the whole vibe. π¦
πΈ SYNOPSIS πΈ
#include <event-parse.h>
struct tep_handle *tep_alloc(void);
void tep_free(struct tep_handle *tep);
void tep_ref(struct tep_handle *tep);
void tep_unref(struct tep_handle *tep);
int tep_get_ref(struct tep_handle *tep);
struct kbuffer *tep_kbuffer(struct tep_handle *tep);
π DESCRIPTION π
so these are the main character functions, fr. they create and destroy tep_handle β which is the big structural girl, the one representing the trace event parser context. that context gets passed in as the input parameter of most of the library's APIs, so like... everything kind of revolves around her. π
tep_alloc()β allocates and initializes the tep context. new tep, who dis. β¨tep_free()β decrements the reference of the tep handler. and when there are no more references left? it frees the handler, and cleans up all its resources that it had used. thetepargument is the pointer to the trace event parser context. rip boo, you served well. πtep_ref()β adds a reference to the tep handler. one more bestie holding on. π«Άtep_unref()β removes a reference from the tep handler. and when the last reference is removed, the tep is destroyed, and all the resources it had used get cleaned up. periodt. πtep_ref_get()β gets the current references of the tep handler. (yes it's spelled that way up here, don't come for me, the synopsis saystep_get_refβ iykyk π)tep_kbuffer()β allocates a kbuffer descriptor that can be used to parse raw data that is represented by the tep handle descriptor. and listen, it must be freed withkbuf_free(3). no leaking, that's not the vibe.
π RETURN VALUE π
tep_alloc()returns a pointer to a newly createdtep_handlestructure. it returnsNULLin case there is not enough free memory to allocate it. (lowkey tragic but okay β¨)tep_ref_get()returns the current references oftep. iftepisNULL,0is returned.tep_kbuffer()returns a kbuffer descriptor that can parse the raw data that represents the tep handle. must be freed withkbuf_free(3). π
π§ EXAMPLE π§
okay here's the whole glow-up in action:
#include <event-parse.h>
...
struct tep_handle *tep = tep_alloc();
...
int ref = tep_get_ref(tep);
tep_ref(tep);
if ( (ref+1) != tep_get_ref(tep)) {
/* Something wrong happened, the counter is not incremented by 1 */
}
tep_unref(tep);
...
tep_free(tep);
...
π FILES π
event-parse.hβ header file to include in order to have access to the library APIs. gotta have her. π-ltraceeventβ linker switch to add when building a program that uses the library.
π₯ SEE ALSO π₯
libtraceevent(3), trace-cmd(1)
β AUTHOR β
- Steven Rostedt
<rostedt@goodmis.org[1]>, author of libtraceevent. π - Tzvetomir Stoyanov
<tz.stoyanov@gmail.com[2]>, author of this man page. π
π REPORTING BUGS π
Report bugs to <linux-trace-devel@vger.kernel.org[3]>
πΈ LICENSE πΈ
libtraceevent is Free Software licensed under the GNU LGPL 2.1. slay, legally speaking. π
π¦ RESOURCES π¦
https://git.kernel.org/pub/scm/libs/libtrace/libtraceevent.git/
π NOTES π
rostedt@goodmis.orgmailto:rostedt@goodmis.orgtz.stoyanov@gmail.commailto:tz.stoyanov@gmail.comlinux-trace-devel@vger.kernel.orgmailto:linux-trace-devel@vger.kernel.org
bestie, remember: everytep_ref()needs itstep_unref(), and everytep_alloc()needs itstep_free(). balance. harmony. main character energy. β¨
and that's the whole page, no cap π β brought to you by libtraceevent 1.9.0, dated 06/15/2026, and yeah we're still calling it LIBTRACEEVENT(3) over here. mwah. π«ΆπΈ
π¦ 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