Skip to contentSkip to conversation

Fix: improve error message when UST support is disabled

PATCH Mathieu Desnoyers 1 participant 1 message Aug 24, 2013 1 message not in the archive

lore
Share & tools
lore
#1 lore raw
In reply to a message not in the archive
Quoted 1 line · * Mathieu Desnoyers ([email protected]) wrote:

Fixes #583

Hi David,

I see this patch is merged, but did not received any reply to the email. Please reply with a "Merged" message to help tracking status of patches (as you usually do).

Thanks!

Mathieu

Quoted 83 lines

---

include/lttng/lttng-error.h +1 -1
index 51ef9ca..5e0dd07 100644
@@ -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 */
src/bin/lttng-sessiond/main.c +4 -0
index 69bc3a1..4ebd1e7 100644
@@ -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;
src/bin/lttng-sessiond/ust-app.h +12 -0
index a08cfd2..fd5e93f 100644
@@ -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 */
src/common/error.c +1 -0
index 7faba5a..911baea 100644
@@ -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",
Signature · 9 lines
-- 
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com

_______________________________________________
lttng-dev mailing list
[email protected]
http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
Signature · 3 lines
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com