LIBTRACEEVENT(3)
π LIBTRACEEVENT(3) β the libtraceevent manual, bestie edition π
okay so welcome to the libtraceevent manual page, section 3 (that's library functions, iykyk). grab a strawberry π and let's get into it.
β¨ NAME β¨
tep_btf_list_args β show the arguments of a function, pulled straight out of BTF π¦
β¨ SYNOPSIS β¨
#include <event-parse.h>
int tep_btf_list_args(struct tep_handle *tep, struct trace_seq *s, const char *func);
β¨ DESCRIPTION β¨
so. if your Linux kernel has BTF configured, there's a binary file just vibing at /sys/kernel/btf/vmlinux. if that file gets read into memory and handed over to the tep_load_btf() function, then it can be used to read the arguments of any given function β if that function's data is actually found inside the BTF file. no data, no dice, periodt.
tep_btf_print_args() takes a tep handle, a trace_seq s pointer (which has to be initialized by trace_seq_init(3) first β do not skip this, bestie), and a func string. that string is the name of the function whose BTF info you want to use to print the function's prototype. and if BTF isn't loaded, or the func name just isn't found? it returns a negative. π
β¨ RETURN VALUE β¨
tep_btf_list_args() returns the number of arguments read when it succeeds, and -1 when it fails (for example, if the function isn't found). that's it. that's the whole vibe check.
β¨ EXAMPLE β¨
here's the whole thing in action, no cap:
#include <stdlib.h>
#include <stdio.h>
#include <fcntl.h>
#include <event-parse.h>
#include <sys/stat.h>
#include <unistd.h>
#define BTF_FILE "/sys/kernel/btf/vmlinux"
int main(int argc, char **argv)
{
struct tep_handle *tep;
struct trace_seq s;
struct stat st;
char *buf;
int fd, r, z;
if (argc < 2)
exit(-1);
if (stat(BTF_FILE, &st) < 0) {
perror(BTF_FILE);
exit(-1);
}
buf = malloc(st.st_size);
if (!buf)
exit(-1);
fd = open(BTF_FILE, O_RDONLY);
if (fd < 0) {
perror(BTF_FILE);
exit(-1);
}
for (z = 0; z < st.st_size; ) {
r = read(fd, buf + z, st.st_size - z);
if (r <= 0)
break;
z += r;
}
close(fd);
tep = tep_alloc();
if (!tep)
exit(-1);
tep_load_btf(tep, buf, z);
free(buf);
trace_seq_init(&s);
tep_btf_list_args(tep, &s, argv[1]);
printf("%s(", argv[1]);
trace_seq_do_printf(&s);
printf(")\n");
exit(0);
}
β¨ FILES β¨
event-parse.hβ the header file you include so you can actually get at the library APIs, bestie.-ltraceeventβ the linker switch you add when building a program that uses the library. add it or it's giving undefined reference energy π
β¨ SEE ALSO β¨
tep_btf_load(3), tep_btf_print_args(3), libtraceevent(3), trace-cmd(1)
β¨ AUTHOR β¨
Steven Rostedt <rostedt@goodmis.org[1]>, author of libtraceevent. π
β¨ REPORTING BUGS β¨
found a bug? report it to <linux-trace-devel@vger.kernel.org[2]> π«Ά
β¨ LICENSE β¨
libtraceevent is Free Software licensed under the GNU LGPL 2.1 β¨
β¨ RESOURCES β¨
https://git.kernel.org/pub/scm/libs/libtrace/libtraceevent.git/
β¨ NOTES β¨
rostedt@goodmis.orgmailto:rostedt@goodmis.orglinux-trace-devel@vger.kernel.orgmailto:linux-trace-devel@vger.kernel.org
aaaand that's the page, bestie π this was libtraceevent 1.9.0, dated 06/15/2026, filed under LIBTRACEEVENT(3) β slay, go read your BTF, 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