^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) libtraceevent(3)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) ================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) NAME
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) ----
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) tep_load_plugins, tep_unload_plugins, tep_load_plugins_hook - Load / unload traceevent plugins.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) SYNOPSIS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) --------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) [verse]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) --
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) *#include <event-parse.h>*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) struct tep_plugin_list pass:[*]*tep_load_plugins*(struct tep_handle pass:[*]_tep_);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) void *tep_unload_plugins*(struct tep_plugin_list pass:[*]_plugin_list_, struct tep_handle pass:[*]_tep_);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) void *tep_load_plugins_hook*(struct tep_handle pass:[*]_tep_, const char pass:[*]_suffix_,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) void (pass:[*]_load_plugin_)(struct tep_handle pass:[*]tep,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) const char pass:[*]path,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) const char pass:[*]name,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) void pass:[*]data),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) void pass:[*]_data_);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) --
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) DESCRIPTION
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) -----------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) The _tep_load_plugins()_ function loads all plugins, located in the plugin
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) directories. The _tep_ argument is trace event parser context.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) The plugin directories are :
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) [verse]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) --
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) - Directories, specified in _tep_->plugins_dir with priority TEP_PLUGIN_FIRST
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) - System's plugin directory, defined at the library compile time. It
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) depends on the library installation prefix and usually is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) _(install_preffix)/lib/traceevent/plugins_
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) - Directory, defined by the environment variable _TRACEEVENT_PLUGIN_DIR_
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) - User's plugin directory, located at _~/.local/lib/traceevent/plugins_
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) - Directories, specified in _tep_->plugins_dir with priority TEP_PLUGIN_LAST
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) --
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) Loading of plugins can be controlled by the _tep_flags_, using the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) _tep_set_flag()_ API:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) [verse]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) --
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) _TEP_DISABLE_SYS_PLUGINS_ - do not load plugins, located in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) the system's plugin directory.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) _TEP_DISABLE_PLUGINS_ - do not load any plugins.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) --
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) The _tep_set_flag()_ API needs to be called before _tep_load_plugins()_, if
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) loading of all plugins is not the desired case.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) The _tep_unload_plugins()_ function unloads the plugins, previously loaded by
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) _tep_load_plugins()_. The _tep_ argument is trace event parser context. The
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) _plugin_list_ is the list of loaded plugins, returned by
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) the _tep_load_plugins()_ function.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) The _tep_load_plugins_hook_ function walks through all directories with plugins
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) and calls user specified _load_plugin()_ hook for each plugin file. Only files
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) with given _suffix_ are considered to be plugins. The _data_ is a user specified
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) context, passed to _load_plugin()_. Directories and the walk order are the same
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) as in _tep_load_plugins()_ API.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) RETURN VALUE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) ------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) The _tep_load_plugins()_ function returns a list of successfully loaded plugins,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) or NULL in case no plugins are loaded.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) EXAMPLE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) -------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) [source,c]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) --
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) #include <event-parse.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) ...
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) struct tep_handle *tep = tep_alloc();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) ...
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) struct tep_plugin_list *plugins = tep_load_plugins(tep);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) if (plugins == NULL) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) /* no plugins are loaded */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) ...
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) tep_unload_plugins(plugins, tep);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) ...
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) void print_plugin(struct tep_handle *tep, const char *path,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) const char *name, void *data)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) pritnf("Found libtraceevent plugin %s/%s\n", path, name);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) ...
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) tep_load_plugins_hook(tep, ".so", print_plugin, NULL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) ...
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) --
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) FILES
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) -----
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) [verse]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) --
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) *event-parse.h*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96) Header file to include in order to have access to the library APIs.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97) *-ltraceevent*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98) Linker switch to add when building a program that uses the library.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99) --
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) SEE ALSO
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) --------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) _libtraceevent(3)_, _trace-cmd(1)_, _tep_set_flag(3)_
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) AUTHOR
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) ------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) [verse]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) --
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) *Steven Rostedt* <rostedt@goodmis.org>, author of *libtraceevent*.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) *Tzvetomir Stoyanov* <tz.stoyanov@gmail.com>, author of this man page.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) --
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) REPORTING BUGS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) --------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) Report bugs to <linux-trace-devel@vger.kernel.org>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) LICENSE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) -------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) libtraceevent is Free Software licensed under the GNU LGPL 2.1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) RESOURCES
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) ---------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git