diff mbox series

[8/8] tools/lib/traceevent: remove call to exit() from tep_filter_add_filter_str()

Message ID 20190326154328.28718-9-tstoyanov@vmware.com (mailing list archive)
State Accepted
Headers show
Series Cleanup traceevent API and make it more consistent | expand

Commit Message

Tzvetomir Stoyanov March 26, 2019, 3:43 p.m. UTC
This patch removes call to exit() from tep_filter_add_filter_str(). A library
function should not force the application to exit. In the current implementation
tep_filter_add_filter_str() calls exit() when a special "test_filters" mode is
set, used only for debugging purposes. When this mode is set and a filter is
added - its string is printed to the console and exit() is called. This patch
changes the logic - when in "test_filters" mode, the filter string is still
printed, but the exit() is not called. It is up to the application to track when
"test_filters" mode is set and to call exit, if needed.

Signed-off-by: Tzvetomir Stoyanov <tstoyanov@vmware.com>
---
 tools/lib/traceevent/parse-filter.c | 3 ---
 1 file changed, 3 deletions(-)

Comments

Steven Rostedt March 26, 2019, 8:02 p.m. UTC | #1
On Tue, 26 Mar 2019 17:43:28 +0200
Tzvetomir Stoyanov <tstoyanov@vmware.com> wrote:

> This patch removes call to exit() from tep_filter_add_filter_str(). A library
> function should not force the application to exit. In the current implementation
> tep_filter_add_filter_str() calls exit() when a special "test_filters" mode is
> set, used only for debugging purposes. When this mode is set and a filter is
> added - its string is printed to the console and exit() is called. This patch
> changes the logic - when in "test_filters" mode, the filter string is still
> printed, but the exit() is not called. It is up to the application to track when
> "test_filters" mode is set and to call exit, if needed.

I applied this one too (after changing tep back to pevent so that it
will apply without the other patches).

I'll start testing these and then send them to Arnaldo when complete.

Thanks!

-- Steve

> 
> Signed-off-by: Tzvetomir Stoyanov <tstoyanov@vmware.com>
> ---
>  tools/lib/traceevent/parse-filter.c | 3 ---
>  1 file changed, 3 deletions(-)
> 
> diff --git a/tools/lib/traceevent/parse-filter.c b/tools/lib/traceevent/parse-filter.c
> index 298694356277..552592d153fb 100644
> --- a/tools/lib/traceevent/parse-filter.c
> +++ b/tools/lib/traceevent/parse-filter.c
> @@ -1346,9 +1346,6 @@ enum tep_errno tep_filter_add_filter_str(struct tep_event_filter *filter,
>  
>  	free_events(events);
>  
> -	if (rtn >= 0 && tep->test_filters)
> -		exit(0);
> -
>  	return rtn;
>  }
>
diff mbox series

Patch

diff --git a/tools/lib/traceevent/parse-filter.c b/tools/lib/traceevent/parse-filter.c
index 298694356277..552592d153fb 100644
--- a/tools/lib/traceevent/parse-filter.c
+++ b/tools/lib/traceevent/parse-filter.c
@@ -1346,9 +1346,6 @@  enum tep_errno tep_filter_add_filter_str(struct tep_event_filter *filter,
 
 	free_events(events);
 
-	if (rtn >= 0 && tep->test_filters)
-		exit(0);
-
 	return rtn;
 }