Fix: Warn the user when enabling an event in a new domain
authorChristian Babeux <christian.babeux@efficios.com>
Fri, 7 Nov 2014 23:18:43 +0000 (18:18 -0500)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Mon, 10 Nov 2014 16:59:50 +0000 (11:59 -0500)
This patch warn the user when trying to enable an event in a new domain
that was not configured prior to the tracing start.

Fixes #826

Signed-off-by: Christian Babeux <christian.babeux@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
src/bin/lttng/commands/enable_events.c
src/common/error.c

index ee93127049913aa60d76195b1bda3d03b90a82d8..cba349e636abafc520fdddf72c72832e91cc2b84 100644 (file)
@@ -630,6 +630,16 @@ static int enable_events(char *session_name)
                                        WARN("Kernel events already enabled (channel %s, session %s)",
                                                        print_channel_name(channel_name), session_name);
                                        break;
+                               case LTTNG_ERR_TRACE_ALREADY_STARTED:
+                               {
+                                       const char *msg = "The command tried to enable an event in a new domain for a session that has already been started once.";
+                                       ERR("Events: %s (channel %s, session %s)",
+                                                       msg,
+                                                       print_channel_name(channel_name),
+                                                       session_name);
+                                       error = 1;
+                                       break;
+                               }
                                default:
                                        ERR("Events: %s (channel %s, session %s)",
                                                        lttng_strerror(ret),
@@ -703,6 +713,16 @@ static int enable_events(char *session_name)
                                                        " (channel %s, session %s)",
                                                print_channel_name(channel_name), session_name);
                                        break;
+                               case LTTNG_ERR_TRACE_ALREADY_STARTED:
+                               {
+                                       const char *msg = "The command tried to enable an event in a new domain for a session that has already been started once.";
+                                       ERR("All events: %s (channel %s, session %s, filter \'%s\')",
+                                                       msg,
+                                                       print_channel_name(channel_name),
+                                                       session_name, opt_filter);
+                                       error = 1;
+                                       break;
+                               }
                                default:
                                        ERR("All events: %s (channel %s, session %s, filter \'%s\')",
                                                        lttng_strerror(ret),
@@ -879,6 +899,17 @@ static int enable_events(char *session_name)
                                                        exclusion_string,
                                                        print_channel_name(channel_name), session_name);
                                        break;
+                               case LTTNG_ERR_TRACE_ALREADY_STARTED:
+                               {
+                                       const char *msg = "The command tried to enable an event in a new domain for a session that has already been started once.";
+                                       ERR("Event %s%s: %s (channel %s, session %s)", event_name,
+                                                       exclusion_string,
+                                                       msg,
+                                                       print_channel_name(channel_name),
+                                                       session_name);
+                                       error = 1;
+                                       break;
+                               }
                                default:
                                        ERR("Event %s%s: %s (channel %s, session %s)", event_name,
                                                        exclusion_string,
@@ -915,6 +946,17 @@ static int enable_events(char *session_name)
                                                exclusion_string,
                                                print_channel_name(channel_name), session_name);
                                        break;
+                               case LTTNG_ERR_TRACE_ALREADY_STARTED:
+                               {
+                                       const char *msg = "The command tried to enable an event in a new domain for a session that has already been started once.";
+                                       ERR("Event %s%s: %s (channel %s, session %s, filter \'%s\')", ev.name,
+                                                       exclusion_string,
+                                                       msg,
+                                                       print_channel_name(channel_name),
+                                                       session_name, opt_filter);
+                                       error = 1;
+                                       break;
+                               }
                                default:
                                        ERR("Event %s%s: %s (channel %s, session %s, filter \'%s\')", ev.name,
                                                        exclusion_string,
index e4c974a6c498da6ad705b0f9ca9b77e6eec4af8c..fc17eba0b97b680aae8287fe8695a4d486433358 100644 (file)
@@ -122,8 +122,8 @@ static const char *error_string_array[] = {
        [ ERROR_INDEX(LTTNG_ERR_UST_CONTEXT_INVAL)] = "UST invalid context",
        [ ERROR_INDEX(LTTNG_ERR_NEED_ROOT_SESSIOND) ] = "Tracing the kernel requires a root lttng-sessiond daemon, as well as \"tracing\" group membership or root user ID for the lttng client.",
        [ ERROR_INDEX(LTTNG_ERR_NO_UST) ] = "LTTng-UST tracer is not supported. Please rebuild lttng-tools with lttng-ust support enabled.",
-       [ ERROR_INDEX(LTTNG_ERR_TRACE_ALREADY_STARTED) ] = "Tracing already started",
-       [ ERROR_INDEX(LTTNG_ERR_TRACE_ALREADY_STOPPED) ] = "Tracing already stopped",
+       [ ERROR_INDEX(LTTNG_ERR_TRACE_ALREADY_STARTED) ] = "Tracing has already been started once",
+       [ ERROR_INDEX(LTTNG_ERR_TRACE_ALREADY_STOPPED) ] = "Tracing has already been stopped",
        [ ERROR_INDEX(LTTNG_ERR_KERN_EVENT_ENOSYS) ] = "Kernel event type not supported",
        [ ERROR_INDEX(LTTNG_ERR_NEED_CHANNEL_NAME) ] = "Non-default channel exists within session: channel name needs to be specified with '-c name'",
        [ ERROR_INDEX(LTTNG_ERR_INVALID) ] = "Invalid parameter",
This page took 0.027863 seconds and 4 git commands to generate.