LIBTRACEFS(3)
πΈ LIBTRACEFS πΈ
okay so this is the libtracefs manual page, and today we're learning about ftrace options β getting them, checking them, the whole vibe check. bestie, this is the good stuff. π
β¨ NAME β¨
tracefs_options_get_supported, tracefs_option_is_supported, tracefs_options_get_enabled, tracefs_option_is_enabled, tracefs_option_mask_is_set, tracefs_option_id β literally all the "get and check ftrace options" girlies. π
π¦ SYNOPSIS π¦
#include <tracefs.h>
const struct tracefs_options_mask *tracefs_options_get_supported(struct tracefs_instance *instance);
bool tracefs_option_is_supported(struct tracefs_instance *instance, enum tracefs_option_id id);
const struct tracefs_options_mask *tracefs_options_get_enabled(struct tracefs_instance *instance);
bool tracefs_option_is_enabled(struct tracefs_instance *instance, enum tracefs_option_id id);
bool tracefs_option_mask_is_set(const struct tracefs_options_mask options, enum tracefs_option_id id);
enum tracefs_option_id *tracefs_option_id(const char *name);
no cap, that's the whole cast of characters. β
π DESCRIPTION π
so this little squad of APIs is how you get and check current ftrace options. iconic behaviour. the tea here is that which ftrace options are supported depends on your kernel version and your kernel config β so it's not the same everywhere, iykyk. π«Ά
the getters and checkers, one by one π
tracefs_options_get_supported()β gets all the ftrace options supported by the system in the given instance. ifinstanceisNULL, you get the supported options of the top trace instance instead. heads up: the set of supported options is the same across all created trace instances, but it may be different than the top trace instance. so don't assume, bestie. πtracefs_option_is_supported()β checks if the option with the givenidis supported by the system in the given instance. ifinstanceisNULL, the top trace instance is used. big caveat: if an option is supported at the top trace instance, it may not be supported in a created trace instance. it's giving "different strokes for different instances". πtracefs_options_get_enabled()β gets all the ftrace options currently enabled in the given instance. ifinstanceisNULL, you get the enabled options of the top trace instance. slay. β¨tracefs_option_is_enabled()β checks if the option with the givenidis enabled in the given instance. ifinstanceisNULL, the top trace instance is used. simple, clean, main character energy. πtracefs_option_mask_is_set()β checks if the bit corresponding to the option withidis set in the options bitmask returned fromtracefs_option_get_enabled()andtracefs_option_is_supported(). mask moment. πtracefs_option_id()β converts an option name into its corresponding id, if it's found. this is literally the glow-up translator: if you only know the name, this lets you find the option id to use in all the other functions. obsessed. π§
π₯ RETURN VALUE π₯
tracefs_options_get_supported()andtracefs_options_get_enabled()β on success, return a pointer to the bitmask within the instance, or a global bitmask for the top level, orNULLin case of an error. β οΈ and listen: the returned bitmask is part of the instance structure (or a global variable) and must NOT be freed or modified. do not touch. do not free. not your bitmask, not your business. πtracefs_option_is_supported()andtracefs_option_is_enabled()β returntrueif the option is supported / enabled, orfalseotherwise.tracefs_option_mask_is_set()β returnstrueif the corresponding option is set in the mask, orfalseotherwise.tracefs_option_id()β returns the corresponding id defined bytracefs_options(3)from the given name. if the name can not be found,TRACEFS_OPTION_INVALIDis returned. sad girl hours. π
π EXAMPLE π
#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 */
}
fr fr just copy this pattern and you're golden. π
π FILES π
tracefs.hβ the header file to include in order to have access to the library APIs. yes you actually have to include it bestie. π-ltracefsβ the linker switch to add when building a program that uses the library. don't forget it or you'll be crying at link errors. π
β SEE ALSO β
libtracefs(3), libtraceevent(3), trace-cmd(1)
the whole friend group. go read them too. π«Ά
π AUTHOR π
- Steven Rostedt
<rostedt@goodmis.org[1]> - Tzvetomir Stoyanov
<tz.stoyanov@gmail.com[2]>
legends, honestly.
π REPORTING BUGS π
spotted something sus? Report bugs to <linux-trace-devel@vger.kernel.org[3]> β they want to hear it, ngl.
πΈ LICENSE πΈ
libtracefs is Free Software licensed under the GNU LGPL 2.1. periodt.
π¦ RESOURCES π¦
https://git.kernel.org/pub/scm/libs/libtrace/libtracefs.git/
go lurk the repo, it's giving open source excellence. β¨
π COPYING π
Copyright (C) 2020 VMware, Inc. Free use of this software is granted under the terms of the GNU Public License (GPL).
π NOTES π
rostedt@goodmis.orgmailto:rostedt@goodmis.orgtz.stoyanov@gmail.commailto:tz.stoyanov@gmail.comlinux-trace-devel@vger.kernel.orgmailto:linux-trace-devel@vger.kernel.org
aaaand that's the page! π this was libtracefs 1.8.4, dated 10/21/2026 β screenshot it, bookmark it, tell your friends. bye bestie, go check some options! π¦π β¨
π¦ where this page comes from
- arch rolling: libtracefs 1.8.4-1 Β· GPL-2.0-only AND LGPL-2.1-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms