'\" t
.\" Title: libtraceevent
.\" Author: [see the "AUTHOR" section]
.\" Generator: DocBook XSL Stylesheets vsnapshot
.\" Date: 03/09/2026
.\" Manual: libtraceevent Manual
.\" Source: libtraceevent
.\" Language: English
.\"
.TH "LIBTRACEEVENT" "3" "03/09/2026" "libtraceevent" "libtraceevent Manual"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.\" http://bugs.debian.org/507673
.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
.ad l
.\" -----------------------------------------------------------------
.\" * MAIN CONTENT STARTS HERE *
.\" -----------------------------------------------------------------
.SH "NAME"
tep_btf_list_args \- Show the arguments of a function from BTF
.SH "SYNOPSIS"
.sp
.nf
\fB#include \fR
int \fBtep_btf_list_args\fR(struct tep_handle *\fItep\fR, struct trace_seq *\fIs\fR, const char *\fIfunc\fR);
.fi
.SH "DESCRIPTION"
.sp
If the Linux kernel has BTF configured, then a binary file will exist in the path of \fB/sys/kernel/btf/vmlinux\fR\&. If this file is read into memory and passed to \fBtep_load_btf()\fR function, then it can be used to read the arguments of a given function, if that function data is found within the BTF file\&.
.sp
The \fBtep_btf_print_args()\fR takes a \fItep\fR handle, a trace_seq \fIs\fR pointer (that was initialized by \fBtrace_seq_init(3)\fR), and a \fIfunc\fR string that is the name of the function to find the BTF information to use to print the function\(cqs prototype\&. If BTF is not loaded or the \fIfunc\fR name is not found it will return a negative\&.
.SH "RETURN VALUE"
.sp
\fBtep_btf_list_args()\fR returns the number of arguments read on success and \-1 on failure (for example, if the function is not found)\&.
.SH "EXAMPLE"
.sp
.if n \{\
.RS 4
.\}
.nf
#include
#include
#include
#include
#include
#include
#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(")\en");
exit(0);
}
.fi
.if n \{\
.RE
.\}
.SH "FILES"
.sp
.if n \{\
.RS 4
.\}
.nf
\fBevent\-parse\&.h\fR
Header file to include in order to have access to the library APIs\&.
\fB\-ltraceevent\fR
Linker switch to add when building a program that uses the library\&.
.fi
.if n \{\
.RE
.\}
.SH "SEE ALSO"
.sp
\fBtep_btf_load\fR(3), \fBtep_btf_print_args\fR(3), \fBlibtraceevent\fR(3), \fBtrace\-cmd\fR(1)
.SH "AUTHOR"
.sp
.if n \{\
.RS 4
.\}
.nf
\fBSteven Rostedt\fR <\m[blue]\fBrostedt@goodmis\&.org\fR\m[]\&\s-2\u[1]\d\s+2>, author of \fBlibtraceevent\fR\&.
.fi
.if n \{\
.RE
.\}
.SH "REPORTING BUGS"
.sp
Report bugs to <\m[blue]\fBlinux\-trace\-devel@vger\&.kernel\&.org\fR\m[]\&\s-2\u[2]\d\s+2>
.SH "LICENSE"
.sp
libtraceevent is Free Software licensed under the GNU LGPL 2\&.1
.SH "RESOURCES"
.sp
\m[blue]\fBhttps://git\&.kernel\&.org/pub/scm/libs/libtrace/libtraceevent\&.git/\fR\m[]
.SH "NOTES"
.IP " 1." 4
rostedt@goodmis.org
.RS 4
\%mailto:rostedt@goodmis.org
.RE
.IP " 2." 4
linux-trace-devel@vger.kernel.org
.RS 4
\%mailto:linux-trace-devel@vger.kernel.org
.RE