NAME |SYNOPSIS |DESCRIPTION |RETURN VALUE |EXAMPLE |FILES |SEE ALSO |AUTHOR |REPORTING BUGS |LICENSE |RESOURCES |COPYING |NOTES |COLOPHON | |
LIBTRACEFS(3) libtracefs ManualLIBTRACEFS(3)tracefs_options_get_supported, tracefs_option_is_supported, tracefs_options_get_enabled, tracefs_option_is_enabled, tracefs_option_mask_is_set, tracefs_option_id - Get and check ftrace options.
#include <tracefs.h> const struct tracefs_options_mask *tracefs_options_get_supported(struct tracefs_instance *instance); booltracefs_option_is_supported(struct tracefs_instance *instance, enum tracefs_option_idid); const struct tracefs_options_mask *tracefs_options_get_enabled(struct tracefs_instance *instance); booltracefs_option_is_enabled(struct tracefs_instance *instance, enum tracefs_option_idid); booltracefs_option_mask_is_set(const struct tracefs_options_maskoptions, enum tracefs_option_id id);enum tracefs_option_id *tracefs_option_id(const char *name);
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. Thetracefs_options_get_supported()function gets all ftrace options supported by the system in the giveninstance. Ifinstance 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. The *tracefs_option_is_supported()/ function checks if the option with givenid is supported by the system in the giveninstance. Ifinstance 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. Thetracefs_options_get_enabled()function gets all ftrace options, currently enabled in the giveninstance. Ifinstance is NULL, enabled options of the top trace instance are returned. Thetracefs_option_is_enabled()function checks if the option with givenid is enabled in the giveninstance. Ifinstance is NULL, the top trace instance is used. Thetracefs_option_mask_is_set()function checks if the bit, corresponding to the option withid is set in theoptions bitmask returned fromtracefs_option_get_enabled()andtracefs_option_is_supported(). Thetracefs_option_id()converts an optionname into its corresponding id, if it is found. This allows to find the optionid to use in the other functions if only thename is known.
Thetracefs_options_get_supported()andtracefs_options_get_enabled()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. Thetracefs_option_is_supported()andtracefs_option_is_enabled() functions return true if the option in supported / enabled, or false otherwise. Thetracefs_option_mask_is_set()returns true if the corresponding option is set in the mask or false otherwise. Thetracefs_option_id()returns the corresponding id defined bytracefs_options(3) from the givenname. If thename can not be found, then TRACEFS_OPTION_INVALID is returned.
#include <tracefs.h> ... 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 */ }tracefs.h Header file to include in order to have access to the library APIs.-ltracefs Linker switch to add when building a program that uses the library.
libtracefs(3),libtraceevent(3),trace-cmd(1)
Steven Rostedt<rostedt@goodmis.org[1]>Tzvetomir Stoyanov<tz.stoyanov@gmail.com[2]>
Report bugs to <linux-trace-devel@vger.kernel.org[3]>
libtracefs is Free Software licensed under the GNU LGPL 2.1
https://git.kernel.org/pub/scm/libs/libtrace/libtracefs.git/
Copyright (C) 2020 VMware, Inc. Free use of this software is granted under the terms of the GNU Public License (GPL).
1. rostedt@goodmis.org mailto:rostedt@goodmis.org 2. tz.stoyanov@gmail.com mailto:tz.stoyanov@gmail.com 3. linux-trace-devel@vger.kernel.org mailto:linux-trace-devel@vger.kernel.org
This page is part of thelibtracefs (Linux kernel trace file system library) project. Information about the project can be found at ⟨https://www.trace-cmd.org/⟩. If you have a bug report for this manual page, see ⟨https://www.trace-cmd.org/⟩. This page was obtained from the project's upstream Git repository ⟨https://git.kernel.org/pub/scm/libs/libtrace/libtracefs.git⟩ on 2025-08-11. (At that time, the date of the most recent commit that was found in the repository was 2025-06-02.) If you discover any rendering problems in this HTML version of the page, or you believe there is a better or more up-to-date source for the page, or you have corrections or improvements to the information in this COLOPHON (which isnot part of the original manual page), send a mail to man-pages@man7.orglibtracefs 1.7.0 12/22/2023LIBTRACEFS(3)HTML rendering created 2025-09-06 byMichael Kerrisk, author ofThe Linux Programming Interface. For details of in-depthLinux/UNIX system programming training courses that I teach, lookhere. Hosting byjambit GmbH. | ![]() |