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

Christian Babeux christian.babeux at efficios.com
Thu Aug 23 18:21:14 EDT 2012


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)
+				{
+				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)
+				{
+				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




More information about the lttng-dev mailing list