'\" t .\" Title: libtracefs .\" Author: [see the "AUTHOR" section] .\" Generator: DocBook XSL Stylesheets vsnapshot .\" Date: 01/15/2021 .\" Manual: libtracefs Manual .\" Source: libtracefs 1.0.2 .\" Language: English .\" .TH "LIBTRACEFS" "3" "01/15/2021" "libtracefs 1\&.0\&.2" "libtracefs 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" tracefs_instance_create, tracefs_instance_destroy, tracefs_instance_free, tracefs_instance_is_new \- Manage trace instances\&. .SH "SYNOPSIS" .sp .nf \fB#include \fR struct tracefs_instance *\fBtracefs_instance_create\fR(const char *\fIname\fR); int \fBtracefs_instance_destroy\fR(struct tracefs_instance *\fIinstance\fR); void \fBtracefs_instance_free\fR(struct tracefs_instance *\fIinstance\fR); bool \fBtracefs_instance_is_new\fR(struct tracefs_instance *\fIinstance\fR); .fi .SH "DESCRIPTION" .sp This set of functions can be used to manage trace instances\&. A trace instance is a sub buffer used by the Linux tracing system\&. Given a unique name, the events enabled in an instance do not affect the main tracing system, nor other instances, as events enabled in the main tracing system or other instances do not affect the given instance\&. .sp The \fItracefs_instance_create()\fR function allocates and initializes a new tracefs_instance structure and returns it\&. If the instance does not yet exist in the system, it will be created\&. .sp The \fItracefs_instance_destroy()\fR frees the \fIinstance\fR structure, and will also remove the trace instance from the system\&. .sp The \fItracefs_instance_free()\fR function frees the tracefs_instance structure, without removing the trace instance from the system\&. .sp The \fItracefs_instance_is_new()\fR function checks if the given \fIinstance\fR is newly created by \fItracefs_instance_create()\fR, or it has been in the system before that\&. .SH "RETURN VALUE" .sp The \fItracefs_instance_create()\fR function returns a pointer to a newly allocated tracefs_instance structure\&. It must be freed with \fItracefs_instance_destroy()\fR or \fItracefs_instance_free()\fR\&. .sp The \fItracefs_instance_destroy()\fR function returns \-1 in case of an error, or 0 otherwise\&. .sp The \fItracefs_instance_is_new()\fR function returns true if the \fItracefs_instance_create()\fR that allocated \fIinstance\fR also created the trace instance in the system, or false if the trace instance already existed in the system when \fIinstance\fR was allocated by \fItracefs_instance_create()\fR\&. .SH "EXAMPLE" .sp .if n \{\ .RS 4 .\} .nf #include struct tracefs_instance *inst = tracefs_instance_create("foo"); if (!inst) { /* Error creating a new trace instance */ \&.\&.\&. } \&.\&.\&. if (tracefs_instance_is_new(inst)) tracefs_instance_destroy(inst); else tracefs_instance_free(inst); .fi .if n \{\ .RE .\} .SH "FILES" .sp .if n \{\ .RS 4 .\} .nf \fBtracefs\&.h\fR Header file to include in order to have access to the library APIs\&. \fB\-ltracefs\fR Linker switch to add when building a program that uses the library\&. .fi .if n \{\ .RE .\} .SH "SEE ALSO" .sp \fIlibtracefs(3)\fR, \fIlibtraceevent(3)\fR, \fItrace\-cmd(1)\fR .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> \fBTzvetomir Stoyanov\fR <\m[blue]\fBtz\&.stoyanov@gmail\&.com\fR\m[]\&\s-2\u[2]\d\s+2> .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 libtracefs is Free Software licensed under the GNU LGPL 2\&.1 .SH "RESOURCES" .sp \m[blue]\fBhttps://git\&.kernel\&.org/pub/scm/libs/libtrace/libtracefs\&.git/\fR\m[] .SH "COPYING" .sp Copyright (C) 2020 VMware, Inc\&. Free use of this software is granted under the terms of the GNU Public License (GPL)\&. .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