@@ -3,7 +3,7 @@ libtraceevent(3)
3
3
4
4
NAME
5
5
----
6
- tep_load_plugins, tep_unload_plugins - Load / unload traceevent plugins.
6
+ tep_load_plugins, tep_unload_plugins, tep_load_plugins_hook - Load / unload traceevent plugins.
7
7
8
8
SYNOPSIS
9
9
--------
@@ -13,6 +13,12 @@ SYNOPSIS
13
13
14
14
struct tep_plugin_list pass:[*]*tep_load_plugins*(struct tep_handle pass:[*]_tep_);
15
15
void *tep_unload_plugins*(struct tep_plugin_list pass:[*]_plugin_list_, struct tep_handle pass:[*]_tep_);
16
+ void *tep_load_plugins_hook*(struct tep_handle pass:[*]_tep_, const char pass:[*]_suffix_,
17
+ void (pass:[*]_load_plugin_)(struct tep_handle pass:[*]tep,
18
+ const char pass:[*]path,
19
+ const char pass:[*]name,
20
+ void pass:[*]data),
21
+ void pass:[*]_data_);
16
22
--
17
23
18
24
DESCRIPTION
@@ -22,11 +28,13 @@ directories. The _tep_ argument is trace event parser context.
22
28
The plugin directories are :
23
29
[verse]
24
30
--
31
+ - Directories, specified in _tep_->plugins_dir with priority TEP_PLUGIN_FIRST
25
32
- System's plugin directory, defined at the library compile time. It
26
33
depends on the library installation prefix and usually is
27
34
_(install_preffix)/lib/traceevent/plugins_
28
35
- Directory, defined by the environment variable _TRACEEVENT_PLUGIN_DIR_
29
36
- User's plugin directory, located at _~/.local/lib/traceevent/plugins_
37
+ - Directories, specified in _tep_->plugins_dir with priority TEP_PLUGIN_LAST
30
38
--
31
39
Loading of plugins can be controlled by the _tep_flags_, using the
32
40
_tep_set_flag()_ API:
@@ -44,6 +52,12 @@ _tep_load_plugins()_. The _tep_ argument is trace event parser context. The
44
52
_plugin_list_ is the list of loaded plugins, returned by
45
53
the _tep_load_plugins()_ function.
46
54
55
+ The _tep_load_plugins_hook_ function walks through all directories with plugins
56
+ and calls user specified _load_plugin()_ hook for each plugin file. Only files
57
+ with given _suffix_ are considered to be plugins. The _data_ is a user specified
58
+ context, passed to _load_plugin()_. Directories and the walk order are the same
59
+ as in _tep_load_plugins()_ API.
60
+
47
61
RETURN VALUE
48
62
------------
49
63
The _tep_load_plugins()_ function returns a list of successfully loaded plugins,
@@ -63,6 +77,15 @@ if (plugins == NULL) {
63
77
}
64
78
...
65
79
tep_unload_plugins(plugins, tep);
80
+ ...
81
+ void print_plugin(struct tep_handle *tep, const char *path,
82
+ const char *name, void *data)
83
+ {
84
+ pritnf("Found libtraceevent plugin %s/%s\n", path, name);
85
+ }
86
+ ...
87
+ tep_load_plugins_hook(tep, ".so", print_plugin, NULL);
88
+ ...
66
89
--
67
90
68
91
FILES
0 commit comments