Fix: improve error message when UST support is disabled
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Thu, 22 Aug 2013 21:48:59 +0000 (17:48 -0400)
committerDavid Goulet <dgoulet@efficios.com>
Fri, 23 Aug 2013 16:02:23 +0000 (12:02 -0400)
Fixes #583

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
include/lttng/lttng-error.h
src/bin/lttng-sessiond/main.c
src/bin/lttng-sessiond/ust-app.h
src/common/error.c

index be96d9f61f7b8d53cd42bb5a54bd5f7cd5f9dab1..478713a30583a55457500a1501c8c98affca66d9 100644 (file)
@@ -114,7 +114,7 @@ enum lttng_error_code {
        LTTNG_ERR_TRACE_ALREADY_STOPPED  = 81,  /* Tracing already stopped */
        LTTNG_ERR_KERN_EVENT_ENOSYS      = 82,  /* Kernel event type not supported */
        /* 83 */
-       /* 84 */
+       LTTNG_ERR_NO_UST                 = 84,  /* LTTng-UST tracer is not supported. Please rebuild lttng-tools with lttng-ust support enabled. */
        /* 85 */
        /* 86 */
        /* 87 */
index 06a09fbb93fe6f511d9678b4c20d68051763fb00..9d2ad08b07e5ec4069a5cde4ceeec2fa2a148ebf 100644 (file)
@@ -2688,6 +2688,10 @@ static int process_client_msg(struct command_ctx *cmd_ctx, int sock,
                break;
        case LTTNG_DOMAIN_UST:
        {
+               if (!ust_app_supported()) {
+                       ret = LTTNG_ERR_NO_UST;
+                       goto error;
+               }
                /* Consumer is in an ERROR state. Report back to client */
                if (uatomic_read(&ust_consumerd_state) == CONSUMER_ERROR) {
                        ret = LTTNG_ERR_NO_USTCONSUMERD;
index 92ac9c4e1e4af29af2f387cb82d50338fdb9bfcd..c9c47284c70a0a7a7558da949d839ceb2cbab7a6 100644 (file)
@@ -315,6 +315,12 @@ ssize_t ust_app_push_metadata(struct ust_registry_session *registry,
                struct consumer_socket *socket, int send_zero_data);
 void ust_app_destroy(struct ust_app *app);
 
+static inline
+int ust_app_supported(void)
+{
+       return 1;
+}
+
 #else /* HAVE_LIBLTTNG_UST_CTL */
 
 static inline
@@ -512,6 +518,12 @@ void ust_app_destroy(struct ust_app *app)
        return;
 }
 
+static inline
+int ust_app_supported(void)
+{
+       return 0;
+}
+
 #endif /* HAVE_LIBLTTNG_UST_CTL */
 
 #endif /* _LTT_UST_APP_H */
index 61d34c24a44b68ecf5e444f3e2d6c799f2e7535b..9192f201086258db329418219d383ac6d027da7c 100644 (file)
@@ -83,6 +83,7 @@ static const char *error_string_array[] = {
        [ ERROR_INDEX(LTTNG_ERR_UST_CONTEXT_EXIST)] = "UST context already exist",
        [ 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_KERN_EVENT_ENOSYS) ] = "Kernel event type not supported",
This page took 0.030428 seconds and 4 git commands to generate.