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.1.2~8 X-Git-Url: https://git.liburcu.org/?p=lttng-tools.git;a=commitdiff_plain;h=ec64e6c1a008526fa9854cebac13e5e6ed308c26 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 b6c18e142..ff9d29472 100644 --- a/src/bin/lttng/commands/enable_events.c +++ b/src/bin/lttng/commands/enable_events.c @@ -494,7 +494,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; } @@ -527,7 +527,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 e6ca9cfd9..113f69d9b 100644 --- a/src/bin/lttng/lttng.c +++ b/src/bin/lttng/lttng.c @@ -274,7 +274,7 @@ static int handle_command(int argc, char **argv) } /* Command not found */ - ret = -1; + ret = CMD_UNDEFINED; end: return ret; @@ -498,6 +498,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;