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 15:59:03 +0000 (11:59 -0400)
Fixes #583

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@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 51ef9ca1ed52773b9e766acafafdf7e061ad422c..5e0dd07b272027b9b50539d6a17c6d73f2f362cc 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 */
        LTTNG_ERR_NEED_CHANNEL_NAME      = 83,  /* Non-default channel exists within session: channel name needs to be specified with '-c name' */
-       /* 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 69bc3a183a9addb3c45b50915a331d743ec13be4..4ebd1e7d6c50d89da95aae89ff7e4d7b1ea77c59 100644 (file)
@@ -2710,6 +2710,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 a08cfd28928bdfbdfcaf3a01d2de65cc314608fb..fd5e93fe9e4cb80224fd9668eade6cb845fa8d87 100644 (file)
@@ -320,6 +320,12 @@ int ust_app_snapshot_record(struct ltt_ust_session *usess,
                struct snapshot_output *output, int wait, unsigned int nb_streams);
 unsigned int ust_app_get_nb_stream(struct ltt_ust_session *usess);
 
+static inline
+int ust_app_supported(void)
+{
+       return 1;
+}
+
 #else /* HAVE_LIBLTTNG_UST_CTL */
 
 static inline
@@ -528,6 +534,12 @@ unsigned int ust_app_get_nb_stream(struct ltt_ust_session *usess)
        return 0;
 }
 
+static inline
+int ust_app_supported(void)
+{
+       return 0;
+}
+
 #endif /* HAVE_LIBLTTNG_UST_CTL */
 
 #endif /* _LTT_UST_APP_H */
index 7faba5a0b720e7bcba6a6c77442b9f33bd4ecf75..911baea3ed4b42f0671dc1e53d9c32dd78287b22 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.030369 seconds and 4 git commands to generate.