X-Git-Url: http://git.efficios.com/?p=lttng-tools.git;a=blobdiff_plain;f=src%2Fbin%2Flttng%2Fcommands%2Fload.c;h=002ec4958945ae2bc7caf9eb3c86537243290a84;hp=7578fdce0b687d3fc74854501aac593006a1073b;hb=ab5be9fa2eb5ba9600a82cd18fd3cfcbac69169a;hpb=96694f0b10af5b226fd28a3da5dc1c703eee9986 diff --git a/src/bin/lttng/commands/load.c b/src/bin/lttng/commands/load.c index 7578fdce0..002ec4958 100644 --- a/src/bin/lttng/commands/load.c +++ b/src/bin/lttng/commands/load.c @@ -1,18 +1,8 @@ /* - * Copyright (C) 2014 - Jérémie Galarneau + * Copyright (C) 2014 Jérémie Galarneau * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License, version 2 only, - * as published by the Free Software Foundation. + * SPDX-License-Identifier: GPL-2.0-only * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #define _LGPL_SOURCE @@ -37,6 +27,12 @@ static int opt_load_all; static const char *session_name; +#ifdef LTTNG_EMBED_HELP +static const char help_msg[] = +#include +; +#endif + enum { OPT_HELP = 1, OPT_ALL, @@ -116,9 +112,33 @@ static int mi_load_print(const char *session_name) } } - /* Close load element */ - ret = mi_lttng_writer_close_element(writer); + /* Print override elements */ + ret = mi_lttng_writer_open_element(writer, mi_lttng_element_load_overrides); + if (ret) { + goto end; + } + /* Session name override element */ + if (opt_override_session_name) { + ret = mi_lttng_writer_write_element_string(writer, + config_element_name, opt_override_session_name); + if (ret) { + goto end; + } + } + + /* Session url override element */ + if (opt_override_url) { + ret = mi_lttng_writer_write_element_string(writer, + mi_lttng_element_load_override_url, + opt_override_url); + if (ret) { + goto end; + } + } + + /* Close override and load element */ + ret = mi_lttng_close_multi_element(writer, 2); end: return ret; } @@ -133,6 +153,7 @@ int cmd_load(int argc, const char **argv) poptContext pc; struct lttng_load_session_attr *session_attr = NULL; char *input_path = NULL; + const char *leftover = NULL; pc = poptGetContext(NULL, argc, argv, load_opts, 0); poptReadDefaultConfig(pc, 0); @@ -176,6 +197,13 @@ int cmd_load(int argc, const char **argv) } } + leftover = poptGetArg(pc); + if (leftover) { + ERR("Unknown argument: %s", leftover); + ret = CMD_ERROR; + goto end; + } + /* Mi check */ if (lttng_opt_mi) { writer = mi_lttng_writer_create(fileno(stdout), lttng_opt_mi); @@ -294,6 +322,11 @@ int cmd_load(int argc, const char **argv) MSG("Session has been loaded successfully"); } + if (opt_override_session_name) { + MSG("Session name overridden with %s", + opt_override_session_name); + } + if (opt_override_url) { MSG("Session output url overridden with %s", opt_override_url); }