Fix start/stop lttng message error
authorDavid Goulet <dgoulet@efficios.com>
Mon, 5 Mar 2012 14:56:40 +0000 (09:56 -0500)
committerDavid Goulet <dgoulet@efficios.com>
Mon, 5 Mar 2012 14:56:40 +0000 (09:56 -0500)
Add the already started/stopped error message and print a more
meaningful error on the command line.

(closes #47)

Signed-off-by: David Goulet <dgoulet@efficios.com>
src/bin/lttng-sessiond/main.c
src/common/sessiond-comm/sessiond-comm.c
src/common/sessiond-comm/sessiond-comm.h

index 12322837e7f681038e0ed6fe54d2ac72e035668d..b275874e7bc98dc3062b27c7529479326ef1b9bc 100644 (file)
@@ -2850,7 +2850,8 @@ static int cmd_start_trace(struct ltt_session *session)
        usess = session->ust_session;
 
        if (session->enabled) {
-               ret = LTTCOMM_UST_START_FAIL;
+               /* Already started. */
+               ret = LTTCOMM_TRACE_ALREADY_STARTED;
                goto error;
        }
 
@@ -2942,7 +2943,7 @@ static int cmd_stop_trace(struct ltt_session *session)
        usess = session->ust_session;
 
        if (!session->enabled) {
-               ret = LTTCOMM_UST_STOP_FAIL;
+               ret = LTTCOMM_TRACE_ALREADY_STOPPED;
                goto error;
        }
 
index 96615f4389adad78ac3804a9cd9c1b1dba7a763a..53d8d7ca539b836758d14a71d57bbb80b5ed0e36 100644 (file)
@@ -101,6 +101,10 @@ static const char *lttcomm_readable_code[] = {
        [ LTTCOMM_ERR_INDEX(LTTCOMM_UST_EVENT_NOT_FOUND)] = "UST event not found",
        [ LTTCOMM_ERR_INDEX(LTTCOMM_UST_CONTEXT_EXIST)] = "UST context already exist",
        [ LTTCOMM_ERR_INDEX(LTTCOMM_UST_CONTEXT_INVAL)] = "UST invalid context",
+       [ LTTCOMM_ERR_INDEX(LTTCOMM_NEED_ROOT_SESSIOND) ] = "A root lttng-sessiond needs to be running, and client user part of the \"tracing\" group, to interact with kernel tracing",
+       [ LTTCOMM_ERR_INDEX(LTTCOMM_TRACE_ALREADY_STARTED) ] = "Tracing already started",
+       [ LTTCOMM_ERR_INDEX(LTTCOMM_TRACE_ALREADY_STOPPED) ] = "Tracing already stopped",
+
        [ LTTCOMM_ERR_INDEX(CONSUMERD_COMMAND_SOCK_READY) ] = "consumerd command socket ready",
        [ LTTCOMM_ERR_INDEX(CONSUMERD_SUCCESS_RECV_FD) ] = "consumerd success on receiving fds",
        [ LTTCOMM_ERR_INDEX(CONSUMERD_ERROR_RECV_FD) ] = "consumerd error on receiving fds",
@@ -116,7 +120,6 @@ static const char *lttcomm_readable_code[] = {
        [ LTTCOMM_ERR_INDEX(CONSUMERD_SPLICE_ENOMEM) ] = "consumerd splice ENOMEM",
        [ LTTCOMM_ERR_INDEX(CONSUMERD_SPLICE_ESPIPE) ] = "consumerd splice ESPIPE",
        [ LTTCOMM_ERR_INDEX(LTTCOMM_NO_EVENT) ] = "Event not found",
-       [ LTTCOMM_ERR_INDEX(LTTCOMM_NEED_ROOT_SESSIOND) ] = "A root lttng-sessiond needs to be running, and client user part of the \"tracing\" group, to interact with kernel tracing",
 };
 
 /*
index 17cb51915555393a96f924c2fd47a2afa6afeb5a..73abfe84aa41c5315120f35cb60a3b7317a10e94 100644 (file)
@@ -136,6 +136,9 @@ enum lttcomm_return_code {
        LTTCOMM_UST_EVENT_NOT_FOUND,    /* UST event not found */
        LTTCOMM_UST_CONTEXT_EXIST,      /* UST context exist */
        LTTCOMM_UST_CONTEXT_INVAL,      /* UST context invalid */
+       LTTCOMM_NEED_ROOT_SESSIOND,             /* root sessiond is needed */
+       LTTCOMM_TRACE_ALREADY_STARTED,  /* Tracing already started */
+       LTTCOMM_TRACE_ALREADY_STOPPED,  /* Tracing already stopped */
 
        CONSUMERD_COMMAND_SOCK_READY,           /* when consumerd command socket ready */
        CONSUMERD_SUCCESS_RECV_FD,              /* success on receiving fds */
@@ -151,7 +154,7 @@ enum lttcomm_return_code {
        CONSUMERD_SPLICE_EINVAL,                /* EINVAL from splice(2) */
        CONSUMERD_SPLICE_ENOMEM,                /* ENOMEM from splice(2) */
        CONSUMERD_SPLICE_ESPIPE,                /* ESPIPE from splice(2) */
-       LTTCOMM_NEED_ROOT_SESSIOND,             /* root sessiond is needed */
+
        /* MUST be last element */
        LTTCOMM_NR,                                             /* Last element */
 };
This page took 0.030072 seconds and 4 git commands to generate.