[lttng-dev] [PATCH lttng-tools] Filter: Notify the user when a filter is already enabled on event(s)

Mathieu Desnoyers mathieu.desnoyers at efficios.com
Thu Aug 23 18:45:41 EDT 2012


* Christian Babeux (christian.babeux at efficios.com) wrote:
> 
> Signed-off-by: Christian Babeux <christian.babeux at efficios.com>
> ---
>  src/bin/lttng/commands/enable_events.c | 24 ++++++++++++++++++++++--
>  1 file changed, 22 insertions(+), 2 deletions(-)
> 
> diff --git a/src/bin/lttng/commands/enable_events.c b/src/bin/lttng/commands/enable_events.c
> index a2c8a68..7a65ee6 100644
> --- a/src/bin/lttng/commands/enable_events.c
> +++ b/src/bin/lttng/commands/enable_events.c
> @@ -384,7 +384,17 @@ static int enable_events(char *session_name)
>  			ret = lttng_set_event_filter(handle, ev.name, channel_name,
>  						opt_filter);
>  			if (ret < 0) {
> -				ERR("Error setting filter");
> +				switch (-ret)

bracket on same line as switch statement please.

> +				{
> +				case LTTCOMM_FILTER_EXIST:
> +					ERR("Filter on events is already enabled (channel %s, session %s)",
> +						channel_name, session_name);
> +					break;
> +				default:
> +					ERR("Error setting filter");
> +					break;
> +				}
> +
>  				ret = -1;
>  				goto error;
>  			}
> @@ -554,7 +564,17 @@ static int enable_events(char *session_name)
>  			ret = lttng_set_event_filter(handle, ev.name,
>  				channel_name, opt_filter);
>  			if (ret < 0) {
> -				ERR("Error setting filter");
> +				switch (-ret)

same here.

Can you describe the change in the changelog ? What was the behavior
before, with some example cases (sequences of commands), and what this
is changing.

Thanks,

Mathieu

> +				{
> +				case LTTCOMM_FILTER_EXIST:
> +					ERR("Filter on event %s is already enabled (channel %s, session %s)",
> +						event_name, channel_name, session_name);
> +					break;
> +				default:
> +					ERR("Error setting filter");
> +					break;
> +				}
> +
>  				ret = -1;
>  				goto error;
>  			}
> -- 
> 1.7.11.4
> 

-- 
Mathieu Desnoyers
Operating System Efficiency R&D Consultant
EfficiOS Inc.
http://www.efficios.com



More information about the lttng-dev mailing list