'\" t .\" Title: libtraceevent .\" Author: [see the "AUTHOR" section] .\" Generator: DocBook XSL Stylesheets vsnapshot .\" Date: 01/14/2024 .\" Manual: libtraceevent Manual .\" Source: libtraceevent 1.8.2 .\" Language: English .\" .TH "LIBTRACEEVENT" "3" "01/14/2024" "libtraceevent 1\&.8\&.2" "libtraceevent 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" tep_load_plugins, tep_unload_plugins, tep_load_plugins_hook, tep_add_plugin_path, tep_plugin_add_option \- Load / unload traceevent plugins\&. .SH "SYNOPSIS" .sp .nf \fB#include \fR struct tep_plugin_list *\fBtep_load_plugins\fR(struct tep_handle *\fItep\fR); void \fBtep_unload_plugins\fR(struct tep_plugin_list *\fIplugin_list\fR, struct tep_handle *\fItep\fR); void \fBtep_load_plugins_hook\fR(struct tep_handle *\fItep\fR, const char *\fIsuffix\fR, void (*\fIload_plugin\fR)(struct tep_handle *tep, const char *path, const char *name, void *data), void *\fIdata\fR); int \fBtep_add_plugin_path\fR(struct tep_handle *tep, char *path, enum tep_plugin_load_priority prio); int \fBtep_plugin_add_option\fR(const char *\fIname\fR, const char *\fIval\fR); .fi .SH "DESCRIPTION" .sp The \fBtep_load_plugins()\fR function loads all plugins, located in the plugin directories\&. The \fItep\fR argument is trace event parser context\&. The plugin directories are : .sp .if n \{\ .RS 4 .\} .nf \- Directories, specified in \fItep\fR\(->plugins_dir with priority TEP_PLUGIN_FIRST \- System\(cqs plugin directory, defined at the library compile time\&. It depends on the library installation prefix and usually is \fI(install_preffix)/lib/traceevent/plugins\fR \- Directory, defined by the environment variable \fITRACEEVENT_PLUGIN_DIR\fR \- User\(cqs plugin directory, located at \fI~/\&.local/lib/traceevent/plugins\fR \- Directories, specified in \fItep\fR\(->plugins_dir with priority TEP_PLUGIN_LAST .fi .if n \{\ .RE .\} .sp Loading of plugins can be controlled by the \fItep_flags\fR, using the \fBtep_set_flag()\fR API: .sp .if n \{\ .RS 4 .\} .nf \fITEP_DISABLE_SYS_PLUGINS\fR \- do not load plugins, located in the system\(cqs plugin directory\&. \fITEP_DISABLE_PLUGINS\fR \- do not load any plugins\&. .fi .if n \{\ .RE .\} .sp The \fBtep_set_flag()\fR API needs to be called before \fBtep_load_plugins()\fR, if loading of all plugins is not the desired case\&. .sp The \fBtep_unload_plugins()\fR function unloads the plugins, previously loaded by \fBtep_load_plugins()\fR\&. The \fItep\fR argument is trace event parser context\&. The \fIplugin_list\fR is the list of loaded plugins, returned by the \fBtep_load_plugins()\fR function\&. .sp The \fBtep_load_plugins_hook()\fR function walks through all directories with plugins and calls user specified \fBload_plugin()\fR hook for each plugin file\&. Only files with given \fIsuffix\fR are considered to be plugins\&. The \fIdata\fR is a user specified context, passed to \fBload_plugin()\fR\&. Directories and the walk order are the same as in \fBtep_load_plugins()\fR API\&. .sp The \fBtep_add_plugin_path()\fR functions adds additional directories with plugins in the \fItep\fR\(->plugins_dir list\&. It must be called before \fBtep_load_plugins()\fR in order for the plugins from the new directories to be loaded\&. The \fItep\fR argument is the trace event parser context\&. The \fIpath\fR is the full path to the new plugin directory\&. The \fIprio\fR argument specifies the loading priority order for the new directory of plugins\&. The loading priority is important in case of different versions of the same plugin located in multiple plugin directories\&.The last loaded plugin wins\&. The priority can be: .sp .if n \{\ .RS 4 .\} .nf \fITEP_PLUGIN_FIRST\fR \- Load plugins from this directory first \fITEP_PLUGIN_LAST\fR \- Load plugins from this directory last .fi .if n \{\ .RE .\} .sp Where the plugins in TEP_PLUGIN_LAST" will take precedence over the plugins in the other directories\&. .sp The \fBtep_plugin_add_option()\fR sets options defined by a plugin\&. The \fIname\fR is the name of the option to set to \fIval\fR\&. Plugins can add options to change its behavior and \fBtep_plugin_add_option()\fR is used by the application to make those modifications\&. .SH "RETURN VALUE" .sp The \fBtep_load_plugins()\fR function returns a list of successfully loaded plugins, or NULL in case no plugins are loaded\&. The \fBtep_add_plugin_path()\fR function returns \-1 in case of an error, 0 otherwise\&. .SH "EXAMPLE" .sp .if n \{\ .RS 4 .\} .nf #include \&.\&.\&. struct tep_handle *tep = tep_alloc(); \&.\&.\&. tep_add_plugin_path(tep, "~/dev_plugins", TEP_PLUGIN_LAST); \&.\&.\&. 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\en", path, name); } \&.\&.\&. tep_load_plugins_hook(tep, "\&.so", print_plugin, NULL); \&.\&.\&. .fi .if n \{\ .RE .\} .SH "FILES" .sp .if n \{\ .RS 4 .\} .nf \fBevent\-parse\&.h\fR Header file to include in order to have access to the library APIs\&. \fB\-ltraceevent\fR Linker switch to add when building a program that uses the library\&. .fi .if n \{\ .RE .\} .SH "SEE ALSO" .sp \fBlibtraceevent\fR(3), \fBtrace\-cmd\fR(1), \fBtep_set_flag\fR(3) .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>, author of \fBlibtraceevent\fR\&. \fBTzvetomir Stoyanov\fR <\m[blue]\fBtz\&.stoyanov@gmail\&.com\fR\m[]\&\s-2\u[2]\d\s+2>, author of this man page\&. .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 libtraceevent is Free Software licensed under the GNU LGPL 2\&.1 .SH "RESOURCES" .sp \m[blue]\fBhttps://git\&.kernel\&.org/pub/scm/libs/libtrace/libtraceevent\&.git/\fR\m[] .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