X-Git-Url: http://git.lttng.org./?a=blobdiff_plain;f=src%2Fbin%2Flttng%2Fcommands%2Fadd_context.c;h=2e1c1c5b7e281bd64340f69d90b7f0172a786b0b;hb=1b849782e0f974cfb85d93a55b823b81d3737a2a;hp=6dc29d0670b3bb5883e7e39b39d2514107eb3b61;hpb=98cf2db15fd1a0d073b9a5f1066e385fcccbee09;p=lttng-tools.git diff --git a/src/bin/lttng/commands/add_context.c b/src/bin/lttng/commands/add_context.c index 6dc29d067..2e1c1c5b7 100644 --- a/src/bin/lttng/commands/add_context.c +++ b/src/bin/lttng/commands/add_context.c @@ -25,6 +25,7 @@ #include #include #include +#include #include @@ -40,12 +41,6 @@ static int opt_kernel; static int opt_userspace; static char *opt_type; -#if 0 -/* Not implemented yet */ -static char *opt_cmd_name; -static pid_t opt_pid; -#endif - enum { OPT_HELP = 1, OPT_TYPE, @@ -568,9 +563,7 @@ static int add_context(char *session_name) } else if (opt_userspace) { dom.type = LTTNG_DOMAIN_UST; } else { - print_missing_domain(); - ret = CMD_ERROR; - goto error; + assert(0); } handle = lttng_create_handle(session_name, &dom); @@ -718,7 +711,7 @@ int cmd_add_context(int argc, const char **argv) type = zmalloc(sizeof(struct ctx_type)); if (type == NULL) { - perror("malloc ctx_type"); + PERROR("malloc ctx_type"); ret = CMD_FATAL; goto end; } @@ -735,9 +728,6 @@ int cmd_add_context(int argc, const char **argv) break; case OPT_USERSPACE: opt_userspace = 1; -#if 0 - opt_cmd_name = poptGetOptArg(pc); -#endif break; case OPT_LIST_OPTIONS: list_cmd_options(stdout, long_options); @@ -749,6 +739,13 @@ int cmd_add_context(int argc, const char **argv) } } + ret = print_missing_or_multiple_domains(opt_kernel + opt_userspace); + + if (ret) { + ret = CMD_ERROR; + goto end; + } + if (!opt_type) { ERR("Missing mandatory -t TYPE"); usage(stderr);