trace-cmd: For libtraceevent 1.3 have pr_info equal tep_info
PATCH 1/1 trace-cmd: For libtraceevent 1.3 have pr_info equal tep_info
From: "Steven Rostedt (VMware)" <[email protected]>
In version libtracevent 1.3, pr_stat() turned to tep_info(), because "pr_stat" was too generic. Although a compiled version of trace-cmd may still work because of the use of weak functions, building this version of trace-cmd may cause several warnings because warning is not declared.
Since pr_stat is called out as deprecated, simply doing a:
-Dpr_stat=tep_info
is not sufficient, as the header that deprecates pr_stat will also be affected, and you still get the warning, that is confusing.
"tep_info" is deprecated, use tep_info instead.
Instead, change all callers of pr_stat() to pr_info() and have the Makefile do -Dpr_info=pr_stat when libtraceevent is less than 1.3, and -Dpr_info=tep_info when it is equal or greater to 1.3.
--- Makefile | 5 ++++- lib/trace-cmd/trace-input.c | 2 +- lib/trace-cmd/trace-plugin.c | 2 +- lib/traceevent/event-parse.c | 8 ++++---- lib/traceevent/event-plugin.c | 2 +- lib/traceevent/include/event-utils.h | 2 +- lib/traceevent/parse-utils.c | 2 +- python/ctracecmd.i | 6 +++--- tracecmd/trace-cmd.c | 2 +- tracecmd/trace-record.c | 2 +- 10 files changed, 18 insertions(+), 15 deletions(-)
Makefile +4 -1
@@ -240,10 +240,13 @@ TEST_LIBTRACEEVENT = $(shell sh -c "$(PKG_CONFIG) --cflags $(LIBTRACEEVENT) > /d TEST_LIBTRACEFS = $(shell sh -c "$(PKG_CONFIG) --cflags $(LIBTRACEFS) > /dev/null 2>&1 && echo y") endif +# My get overwritten if libtraceveent is 1.3 or greater. +TEP_WARNING = -Dpr_info=pr_stat + ifeq ("$(TEST_LIBTRACEEVENT)", "y") TRACEEVENT_V13 = $(shell sh -c "$(PKG_CONFIG) --atleast-version 1.3 $(LIBTRACEEVENT) > /dev/null 2>&1 && echo y") ifeq ("$(TRACEEVENT_V13)", "y") - TEP_WARNING=-Dwarning=tep_warning + TEP_WARNING = -Dwarning=tep_warning -Dpr_info=tep_info endif LIBTRACEEVENT_CFLAGS = $(shell sh -c "$(PKG_CONFIG) --cflags $(LIBTRACEEVENT)") $(TEP_WARNING) LIBTRACEEVENT_LDLAGS = $(shell sh -c "$(PKG_CONFIG) --libs $(LIBTRACEEVENT)")
lib/trace-cmd/trace-input.c +1 -1
@@ -3170,7 +3170,7 @@ struct tracecmd_input *tracecmd_alloc_fd(int fd, int flags) version =read_string (handle);if (!version) goto failed_read; -pr_stat ("version = %s\n" , version); +pr_info ("version = %s\n" , version);free (version);if (do_read_check (handle, buf,1 ))
lib/trace-cmd/trace-plugin.c +1 -1
@@ -140,7 +140,7 @@ load_plugin(struct trace_plugin_context *trace, const char *path, list->name = plugin; *plugin_list = list; -pr_stat ("registering plugin: %s" , plugin); +pr_info ("registering plugin: %s" , plugin);func (trace);return ;
lib/traceevent/event-parse.c +4 -4
@@ -6764,7 +6764,7 @@ static int find_event_handle(struct tep_handle *tep, struct tep_event *event)if (!(*next))return 0 ; -pr_stat ("overriding event (%d) %s:%s with new print handler" , +pr_info ("overriding event (%d) %s:%s with new print handler" , event->id, event->system, event->name); event->handler = handle->func;
@@ -7241,7 +7241,7 @@ int tep_register_print_function(struct tep_handle *tep,* plugins updating the function. This overrides the * system defaults. */ -pr_stat ("override of function helper '%s'" , name); +pr_info ("override of function helper '%s'" , name);remove_func_handler (tep, name); }
@@ -7379,7 +7379,7 @@ int tep_register_event_handler(struct tep_handle *tep, int id,if (event ==NULL ) goto not_found; -pr_stat ("overriding event (%d) %s:%s with new print handler" , +pr_info ("overriding event (%d) %s:%s with new print handler" , event->id, event->system, event->name); event->handler = func;
@@ -7465,7 +7465,7 @@ int tep_unregister_event_handler(struct tep_handle *tep, int id, goto not_found;if (event->handler == func && event->context == context) { -pr_stat ("removing override handler for event (%d) %s:%s. Going back to default handler." , +pr_info ("removing override handler for event (%d) %s:%s. Going back to default handler." , event->id, event->system, event->name); event->handler =NULL ;
lib/traceevent/event-plugin.c +1 -1
@@ -498,7 +498,7 @@ load_plugin(struct tep_handle *tep, const char *path, list->name = plugin; *plugin_list = list; -pr_stat ("registering plugin: %s" , plugin); +pr_info ("registering plugin: %s" , plugin);func (tep);return ;
lib/traceevent/include/event-utils.h +1 -1
@@ -10,7 +10,7 @@/* Can be overridden */ void warning (const char *fmt, ...); -void pr_stat (const char *fmt, ...); +void pr_info (const char *fmt, ...);void vpr_stat (const char *fmt,va_list ap);/* Always available */
lib/traceevent/parse-utils.c +1 -1
@@ -57,6 +57,6 @@ void __weak vpr_stat(const char *fmt, va_list ap) { } -void __weak pr_stat (const char *fmt, ...) +void __weak pr_info (const char *fmt, ...) { }
python/ctracecmd.i +3 -3
@@ -44,14 +44,14 @@ static void py_supress_trace_output(void) skip_output = 1; } -void pr_stat(const char *fmt, ...) +void pr_info(const char *fmt, ...) { va_list ap; if (skip_output) return; va_start(ap, fmt); - __vpr_stat(fmt, ap); + __vpr_info(fmt, ap); va_end(ap); }
@@ -249,7 +249,7 @@ static int python_callback(struct trace_seq *s, %ignore trace_seq_vprintf; -%ignore vpr_stat; +%ignore vpr_info; /* SWIG can't grok these, define them to nothing */ #define __trace
tracecmd/trace-cmd.c +1 -1
@@ -35,7 +35,7 @@ void warning(const char *fmt, ...)fprintf (stderr,"\n" ); } -void pr_stat (const char *fmt, ...) +void pr_info (const char *fmt, ...) {va_list ap;
tracecmd/trace-record.c +1 -1
@@ -2940,7 +2940,7 @@ static int expand_event_files(struct buffer_instance *instance, path = globbuf.gl_pathv[i]; event =create_event (instance, path, old_event); -pr_stat ("%s\n" , path); +pr_info ("%s\n" , path); len =strlen (path);
Signature · 1 line
2.31.1