'\" t
.\" Title: libtraceevent
.\" Author: [see the "AUTHOR" section]
.\" Generator: DocBook XSL Stylesheets vsnapshot
.\" Date: 10/08/2022
.\" Manual: libtraceevent Manual
.\" Source: libtraceevent 1.6.3
.\" Language: English
.\"
.TH "LIBTRACEEVENT" "3" "10/08/2022" "libtraceevent 1\&.6\&.3" "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_alloc, tep_free, tep_ref, tep_unref, tep_get_ref \- Create, destroy, manage references of trace event parser context\&.
.SH "SYNOPSIS"
.sp
.nf
\fB#include \fR
struct tep_handle *\fBtep_alloc\fR(void);
void \fBtep_free\fR(struct tep_handle *\fItep\fR);
void \fBtep_ref\fR(struct tep_handle *\fItep\fR);
void \fBtep_unref\fR(struct tep_handle *\fItep\fR);
int \fBtep_get_ref\fR(struct tep_handle *\fItep\fR);
.fi
.SH "DESCRIPTION"
.sp
These are the main functions to create and destroy tep_handle \- the main structure, representing the trace event parser context\&. This context is used as the input parameter of most library APIs\&.
.sp
The \fBtep_alloc()\fR function allocates and initializes the tep context\&.
.sp
The \fBtep_free()\fR function will decrement the reference of the \fItep\fR handler\&. When there is no more references, then it will free the handler, as well as clean up all its resources that it had used\&. The argument \fItep\fR is the pointer to the trace event parser context\&.
.sp
The \fBtep_ref()\fR function adds a reference to the \fItep\fR handler\&.
.sp
The \fBtep_unref()\fR function removes a reference from the \fItep\fR handler\&. When the last reference is removed, the \fItep\fR is destroyed, and all resources that it had used are cleaned up\&.
.sp
The \fBtep_ref_get()\fR functions gets the current references of the \fItep\fR handler\&.
.SH "RETURN VALUE"
.sp
\fBtep_alloc()\fR returns a pointer to a newly created tep_handle structure\&. NULL is returned in case there is not enough free memory to allocate it\&.
.sp
\fBtep_ref_get()\fR returns the current references of \fItep\fR\&. If \fItep\fR is NULL, 0 is returned\&.
.SH "EXAMPLE"
.sp
.if n \{\
.RS 4
.\}
.nf
#include
\&.\&.\&.
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);
\&.\&.\&.
.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
\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\&.
\fBTzvetomir Stoyanov\fR <\m[blue]\fBtz\&.stoyanov@gmail\&.com\fR\m[]\&\s-2\u[2]\d\s+2>, author of this man page\&.
.fi
.if n \{\
.RE
.\}
.SH "REPORTING BUGS"
.sp
Report bugs to <\m[blue]\fBlinux\-trace\-devel@vger\&.kernel\&.org\fR\m[]\&\s-2\u[3]\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
tz.stoyanov@gmail.com
.RS 4
\%mailto:tz.stoyanov@gmail.com
.RE
.IP " 3." 4
linux-trace-devel@vger.kernel.org
.RS 4
\%mailto:linux-trace-devel@vger.kernel.org
.RE