@@ -65,7 +65,7 @@ static void add_child(struct func_stack *stack, const char *child, int pos)
ptr = realloc(stack->stack, sizeof(char *) *
(stack->size + STK_BLK));
if (!ptr) {
- warning("could not allocate plugin memory\n");
+ tep_warning("could not allocate plugin memory\n");
return;
}
@@ -91,7 +91,7 @@ static int add_and_get_index(const char *parent, const char *child, int cpu)
ptr = realloc(fstack, sizeof(*fstack) * (cpu + 1));
if (!ptr) {
- warning("could not allocate plugin memory\n");
+ tep_warning("could not allocate plugin memory\n");
return 0;
}
@@ -39,19 +39,19 @@ static int show_warning = 1;
#define do_warning(fmt, ...) \
do { \
if (show_warning) \
- warning(fmt, ##__VA_ARGS__); \
+ tep_warning(fmt, ##__VA_ARGS__);\
} while (0)
-#define do_warning_event(event, fmt, ...) \
- do { \
- if (!show_warning) \
- continue; \
- \
- if (event) \
- warning("[%s:%s] " fmt, event->system, \
- event->name, ##__VA_ARGS__); \
- else \
- warning(fmt, ##__VA_ARGS__); \
+#define do_warning_event(event, fmt, ...) \
+ do { \
+ if (!show_warning) \
+ continue; \
+ \
+ if (event) \
+ tep_warning("[%s:%s] " fmt, event->system, \
+ event->name, ##__VA_ARGS__); \
+ else \
+ tep_warning(fmt, ##__VA_ARGS__); \
} while (0)
/**
@@ -454,14 +454,14 @@ load_plugin(struct tep_handle *tep, const char *path,
ret = asprintf(&plugin, "%s/%s", path, file);
if (ret < 0) {
- warning("could not allocate plugin memory\n");
+ tep_warning("could not allocate plugin memory\n");
return;
}
handle = dlopen(plugin, RTLD_NOW | RTLD_GLOBAL);
if (!handle) {
- warning("could not load plugin '%s'\n%s\n",
- plugin, dlerror());
+ tep_warning("could not load plugin '%s'\n%s\n",
+ plugin, dlerror());
goto out_free;
}
@@ -481,14 +481,14 @@ load_plugin(struct tep_handle *tep, const char *path,
func = dlsym(handle, TEP_PLUGIN_LOADER_NAME);
if (!func) {
- warning("could not find func '%s' in plugin '%s'\n%s\n",
- TEP_PLUGIN_LOADER_NAME, plugin, dlerror());
+ tep_warning("could not find func '%s' in plugin '%s'\n%s\n",
+ TEP_PLUGIN_LOADER_NAME, plugin, dlerror());
goto out_free;
}
list = malloc(sizeof(*list));
if (!list) {
- warning("could not allocate plugin memory\n");
+ tep_warning("could not allocate plugin memory\n");
goto out_free;
}
@@ -616,7 +616,7 @@ void tep_load_plugins_hook(struct tep_handle *tep, const char *suffix,
ret = asprintf(&path, "%s/%s", home, LOCAL_PLUGIN_DIR);
if (ret < 0) {
- warning("could not allocate plugin memory\n");
+ tep_warning("could not allocate plugin memory\n");
return;
}
@@ -9,7 +9,7 @@
#include <ctype.h>
/* Can be overridden */
-void warning(const char *fmt, ...);
+void tep_warning(const char *fmt, ...);
void pr_stat(const char *fmt, ...);
void vpr_stat(const char *fmt, va_list ap);
@@ -32,7 +32,7 @@ void __warning(const char *fmt, ...)
va_end(ap);
}
-void __weak warning(const char *fmt, ...)
+void __weak tep_warning(const char *fmt, ...)
{
va_list ap;
The traceevent library uses a function with generic name warning() to print various warning messages. This function is implemented as a weak and can be overridden by the application. However, as the name is generic, there could be collisions with other libraries or application, using the functin with the same name. Renamed warning() to tep_warning(). Signed-off-by: Tzvetomir Stoyanov (VMware) <tz.stoyanov@gmail.com> --- plugins/plugin_function.c | 4 ++-- src/event-parse.c | 22 +++++++++++----------- src/event-plugin.c | 14 +++++++------- src/event-utils.h | 2 +- src/parse-utils.c | 2 +- 5 files changed, 22 insertions(+), 22 deletions(-)