'\" t
.\" Title: libtracefs
.\" Author: [see the "AUTHOR" section]
.\" Generator: DocBook XSL Stylesheets vsnapshot
.\" Date: 05/25/2021
.\" Manual: libtracefs Manual
.\" Source: libtracefs 1.2.0
.\" Language: English
.\"
.TH "LIBTRACEFS" "3" "05/25/2021" "libtracefs 1\&.2\&.0" "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_options_get_supported, tracefs_option_is_supported, tracefs_options_get_enabled, tracefs_option_is_enabled, tracefs_option_mask_is_set \- Get and check ftrace options\&.
.SH "SYNOPSIS"
.sp
.nf
\fB#include \fR
const struct tracefs_options_mask *\fBtracefs_options_get_supported\fR(struct tracefs_instance *\fIinstance\fR);
bool \fBtracefs_option_is_supported\fR(struct tracefs_instance *\fIinstance\fR, enum tracefs_option_id \fIid\fR);
const struct tracefs_options_mask *\fBtracefs_options_get_enabled\fR(struct tracefs_instance *\fIinstance\fR);
bool \fBtracefs_option_is_enabled\fR(struct tracefs_instance *\fIinstance\fR, enum tracefs_option_id \fIid\fR);
bool \fBtracefs_option_mask_is_set\fR(const struct tracefs_options_mask *options, enum tracefs_option_id id);
.fi
.SH "DESCRIPTION"
.sp
This set of APIs can be used to get and check current ftrace options\&. Supported ftrace options may depend on the kernel version and the kernel configuration\&.
.sp
The \fItracefs_options_get_supported()\fR function gets all ftrace options supported by the system in the given \fIinstance\fR\&. If \fIinstance\fR is NULL, supported options of the top trace instance are returned\&. The set of supported options is the same in all created trace instances, but may be different than the top trace instance\&.
.sp
The \fItracefs_option_is_supported()\fR function checks if the option with given \fIid\fR is supported by the system in the given \fIinstance\fR\&. If \fIinstance\fR is NULL, the top trace instance is used\&. If an option is supported at the top trace instance, it it may not be supported in a created trace instance\&.
.sp
The \fItracefs_options_get_enabled()\fR function gets all ftrace options, currently enabled in the given \fIinstance\fR\&. If \fIinstance\fR is NULL, enabled options of the top trace instance are returned\&.
.sp
The \fItracefs_option_is_enabled()\fR function checks if the option with given \fIid\fR is enabled in the given \fIinstance\fR\&. If \fIinstance\fR is NULL, the top trace instance is used\&.
.sp
The \fItracefs_option_mask_is_set()\fR function checks if the bit, corresponding to the option with \fIid\fR is set in the \fIoptions\fR bitmask returned from \fItracefs_option_get_enabled()\fR and \fItracefs_option_is_supported()\fR\&.
.SH "RETURN VALUE"
.sp
The \fItracefs_options_get_supported()\fR and \fItracefs_options_get_enabled()\fR functions, on success, return a pointer to the bitmask within the instance, or a global bitmask for the top level, or NULL in case of an error\&. As the returned bitmask is part of the instance structure (or a global variable) and must not be freed or modified\&.
.sp
The \fItracefs_option_is_supported()\fR and \fItracefs_option_is_enabled()\fR functions return true if the option in supported / enabled, or false otherwise\&.
.sp
The \fItracefs_option_mask_is_set()\fR returns true if the corresponding option is set in the mask or false otherwise\&.
.SH "EXAMPLE"
.sp
.if n \{\
.RS 4
.\}
.nf
#include
\&.\&.\&.
const struct tracefs_options_mask *options;
\&.\&.\&.
options = tracefs_options_get_supported(NULL);
if (!options) {
/* Failed to get supported options */
} else {
\&.\&.\&.
}
\&.\&.\&.
options = tracefs_options_get_enabled(NULL);
if (!options) {
/* Failed to get options, enabled in the top instance */
} else {
\&.\&.\&.
}
if (tracefs_options_mask_is_set(options, TRACEFS_OPTION_LATENCY_FORMAT)) {
\&.\&.\&.
}
\&.\&.\&.
if (tracefs_option_is_supported(NULL, TRACEFS_OPTION_LATENCY_FORMAT)) {
/* Latency format option is supprted */
}
\&.\&.\&.
if (tracefs_option_is_enabled(NULL, TRACEFS_OPTION_STACKTRACE)) {
/* Stacktrace option is enabled in the top instance */
}
.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