SYNOPSIS
#include <event-parse.h> struct tep_plugin_list *tep_load_plugins(struct tep_handle *tep); void tep_unload_plugins(struct tep_plugin_list *plugin_list, struct tep_handle *tep); void tep_load_plugins_hook(struct tep_handle *tep, const char *suffix, void (*load_plugin)(struct tep_handle *tep, const char *path, const char *name, void *data), void *data);
DESCRIPTION
The tep_load_plugins() function loads all plugins, located in the plugin directories. The tep argument is trace event parser context. The plugin directories are :
- Directories, specified in tep→plugins_dir with priority TEP_PLUGIN_FIRST - System’s plugin directory, defined at the library compile time. It depends on the library installation prefix and usually is (install_preffix)/lib/traceevent/plugins - Directory, defined by the environment variable TRACEEVENT_PLUGIN_DIR - User’s plugin directory, located at ~/.local/lib/traceevent/plugins - Directories, specified in tep→plugins_dir with priority TEP_PLUGIN_LAST
Loading of plugins can be controlled by the tep_flags, using the tep_set_flag() API:
TEP_DISABLE_SYS_PLUGINS - do not load plugins, located in the system’s plugin directory. TEP_DISABLE_PLUGINS - do not load any plugins.
The tep_set_flag() API needs to be called before tep_load_plugins(), if loading of all plugins is not the desired case.
The tep_unload_plugins() function unloads the plugins, previously loaded by tep_load_plugins(). The tep argument is trace event parser context. The plugin_list is the list of loaded plugins, returned by the tep_load_plugins() function.
The tep_load_plugins_hook function walks through all directories with plugins and calls user specified load_plugin() hook for each plugin file. Only files with given suffix are considered to be plugins. The data is a user specified context, passed to load_plugin(). Directories and the walk order are the same as in tep_load_plugins() API.
RETURN VALUE
The tep_load_plugins() function returns a list of successfully loaded plugins, or NULL in case no plugins are loaded.
EXAMPLE
#include <event-parse.h> ... struct tep_handle *tep = tep_alloc(); ... struct tep_plugin_list *plugins = tep_load_plugins(tep); if (plugins == NULL) { /* no plugins are loaded */ } ... tep_unload_plugins(plugins, tep); ... void print_plugin(struct tep_handle *tep, const char *path, const char *name, void *data) { pritnf("Found libtraceevent plugin %s/%s\n", path, name); } ... tep_load_plugins_hook(tep, ".so", print_plugin, NULL); ...
FILES
event-parse.h Header file to include in order to have access to the library APIs. -ltraceevent Linker switch to add when building a program that uses the library.
SEE ALSO
libtraceevent(3), trace-cmd(1), tep_set_flag(3)
AUTHOR
Steven Rostedt <rostedt@goodmis.org>, author of libtraceevent. Tzvetomir Stoyanov <tz.stoyanov@gmail.com>, author of this man page.
REPORTING BUGS
Report bugs to <linux-trace-devel@vger.kernel.org>
LICENSE
libtraceevent is Free Software licensed under the GNU LGPL 2.1