diff options
author | Steven Rostedt <srostedt@redhat.com> | 2010-02-03 15:43:24 -0500 |
---|---|---|
committer | Steven Rostedt <rostedt@goodmis.org> | 2010-02-03 15:43:24 -0500 |
commit | a4bf97738653d2561da9c539e6a2be7accc21cb3 (patch) | |
tree | 2749a414593e63ec5438f8d8771b899c28def8f2 /trace-util.c | |
parent | aa89e253617492653a090dbf48d36df6def84f9a (diff) |
trace-cmd: Record the file name of plugins in plugin list
Keep the file name of plugins in the plugin list in case we need
to debug a plugin.
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Diffstat (limited to 'trace-util.c')
-rw-r--r-- | trace-util.c | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/trace-util.c b/trace-util.c index d6c1948..41c4f9b 100644 --- a/trace-util.c +++ b/trace-util.c | |||
@@ -26,6 +26,7 @@ | |||
26 | 26 | ||
27 | struct plugin_list { | 27 | struct plugin_list { |
28 | struct plugin_list *next; | 28 | struct plugin_list *next; |
29 | char *name; | ||
29 | void *handle; | 30 | void *handle; |
30 | }; | 31 | }; |
31 | 32 | ||
@@ -175,25 +176,28 @@ load_plugin(struct pevent *pevent, struct plugin_list *plugin_list, | |||
175 | if (!handle) { | 176 | if (!handle) { |
176 | warning("cound not load plugin '%s'\n%s\n", | 177 | warning("cound not load plugin '%s'\n%s\n", |
177 | plugin, dlerror()); | 178 | plugin, dlerror()); |
178 | goto out; | 179 | goto out_free; |
179 | } | 180 | } |
180 | 181 | ||
181 | list = malloc_or_die(sizeof(*list)); | ||
182 | list->next = plugin_list; | ||
183 | list->handle = handle; | ||
184 | plugin_list = list; | ||
185 | |||
186 | func = dlsym(handle, PEVENT_PLUGIN_LOADER_NAME); | 182 | func = dlsym(handle, PEVENT_PLUGIN_LOADER_NAME); |
187 | if (!func) { | 183 | if (!func) { |
188 | warning("cound not find func '%s' in plugin '%s'\n%s\n", | 184 | warning("cound not find func '%s' in plugin '%s'\n%s\n", |
189 | PEVENT_PLUGIN_LOADER_NAME, plugin, dlerror()); | 185 | PEVENT_PLUGIN_LOADER_NAME, plugin, dlerror()); |
190 | goto out; | 186 | goto out_free; |
191 | } | 187 | } |
192 | 188 | ||
189 | list = malloc_or_die(sizeof(*list)); | ||
190 | list->next = plugin_list; | ||
191 | list->handle = handle; | ||
192 | list->name = plugin; | ||
193 | plugin_list = list; | ||
194 | |||
193 | printf("registering plugin: %s\n", plugin); | 195 | printf("registering plugin: %s\n", plugin); |
194 | ret = func(pevent); | 196 | ret = func(pevent); |
195 | 197 | ||
196 | out: | 198 | return plugin_list; |
199 | |||
200 | out_free: | ||
197 | free(plugin); | 201 | free(plugin); |
198 | 202 | ||
199 | return plugin_list; | 203 | return plugin_list; |
@@ -315,6 +319,7 @@ void tracecmd_unload_plugins(struct plugin_list *plugin_list) | |||
315 | if (func) | 319 | if (func) |
316 | func(); | 320 | func(); |
317 | dlclose(list->handle); | 321 | dlclose(list->handle); |
322 | free(list->name); | ||
318 | free(list); | 323 | free(list); |
319 | } | 324 | } |
320 | } | 325 | } |