From: David Goulet Date: Mon, 25 Mar 2013 19:07:30 +0000 (-0400) Subject: Add unsupported error code to lttng cmd line X-Git-Tag: v2.2.0-rc1~29 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=4ce78777c3ffcdd42e635ed45aa5dd3a7c7bd22d;p=lttng-tools.git Add unsupported error code to lttng cmd line Fixes #438 Signed-off-by: David Goulet --- diff --git a/src/bin/lttng/command.h b/src/bin/lttng/command.h index 68ce903de..21585383f 100644 --- a/src/bin/lttng/command.h +++ b/src/bin/lttng/command.h @@ -31,6 +31,7 @@ enum cmd_error_code { CMD_UNDEFINED, CMD_FATAL, CMD_WARNING, + CMD_UNSUPPORTED, }; struct cmd_struct { diff --git a/src/bin/lttng/commands/enable_events.c b/src/bin/lttng/commands/enable_events.c index 231dac3fb..93ef0c5a4 100644 --- a/src/bin/lttng/commands/enable_events.c +++ b/src/bin/lttng/commands/enable_events.c @@ -497,7 +497,7 @@ static int enable_events(char *session_name) if (opt_loglevel) { MSG("Kernel loglevels are not supported."); - ret = CMD_UNDEFINED; + ret = CMD_UNSUPPORTED; goto error; } @@ -530,7 +530,7 @@ static int enable_events(char *session_name) case LTTNG_EVENT_SYSCALL: default: ERR("Event type not available for user-space tracing"); - ret = CMD_UNDEFINED; + ret = CMD_UNSUPPORTED; goto error; } diff --git a/src/bin/lttng/lttng.c b/src/bin/lttng/lttng.c index d3aaa8424..90c031faf 100644 --- a/src/bin/lttng/lttng.c +++ b/src/bin/lttng/lttng.c @@ -272,7 +272,7 @@ static int handle_command(int argc, char **argv) } /* Command not found */ - ret = -1; + ret = CMD_UNDEFINED; end: return ret; @@ -499,6 +499,9 @@ static int parse_args(int argc, char **argv) case CMD_FATAL: ERR("Fatal error"); break; + case CMD_UNSUPPORTED: + ERR("Unsupported command"); + break; case -1: usage(stderr); ret = 1;