X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=src%2Fbin%2Flttng%2Fcommands%2Fdisable_channels.c;h=cf9f20bb6d3fd2a539651c6c08d6a09699ca68c5;hb=81663f073dbfb4b61c06a0ceb8ca33c4fc41b1c5;hp=678af746d5091181aed4febe926130525afa7c5b;hpb=38b4ef1b199ddb15db78774a39e9c524ca7e2d24;p=lttng-tools.git diff --git a/src/bin/lttng/commands/disable_channels.c b/src/bin/lttng/commands/disable_channels.c index 678af746d..cf9f20bb6 100644 --- a/src/bin/lttng/commands/disable_channels.c +++ b/src/bin/lttng/commands/disable_channels.c @@ -1,18 +1,8 @@ /* - * Copyright (C) 2011 - David Goulet + * Copyright (C) 2011 David Goulet * - * 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 @@ -23,9 +13,9 @@ #include #include #include -#include #include +#include #include "../command.h" @@ -34,6 +24,12 @@ static int opt_kernel; static char *opt_session_name; static int opt_userspace; +#ifdef LTTNG_EMBED_HELP +static const char help_msg[] = +#include +; +#endif + enum { OPT_HELP = 1, OPT_USERSPACE, @@ -58,8 +54,8 @@ static int mi_partial_channel_print(char *channel_name, unsigned int enabled, { int ret; - assert(writer); - assert(channel_name); + LTTNG_ASSERT(writer); + LTTNG_ASSERT(channel_name); /* Open channel element */ ret = mi_lttng_writer_open_element(writer, config_element_channel); @@ -116,7 +112,7 @@ static int disable_channels(char *session_name) dom.type = LTTNG_DOMAIN_UST; } else { /* Checked by the caller. */ - assert(0); + abort(); } handle = lttng_create_handle(session_name, &dom); @@ -159,7 +155,8 @@ static int disable_channels(char *session_name) } else { MSG("%s channel %s disabled for session %s", - get_domain_str(dom.type), channel_name, session_name); + lttng_domain_type_str(dom.type), + channel_name, session_name); enabled = 0; success = 1; } @@ -210,6 +207,7 @@ int cmd_disable_channels(int argc, const char **argv) int opt, ret = CMD_SUCCESS, command_ret = CMD_SUCCESS, success = 1; static poptContext pc; char *session_name = NULL; + const char *leftover = NULL; pc = poptGetContext(NULL, argc, argv, long_options, 0); poptReadDefaultConfig(pc, 0); @@ -231,7 +229,8 @@ int cmd_disable_channels(int argc, const char **argv) } } - ret = print_missing_or_multiple_domains(opt_kernel + opt_userspace); + ret = print_missing_or_multiple_domains( + opt_kernel + opt_userspace, false); if (ret) { ret = CMD_ERROR; goto end; @@ -244,6 +243,13 @@ int cmd_disable_channels(int argc, const char **argv) goto end; } + leftover = poptGetArg(pc); + if (leftover) { + ERR("Unknown argument: %s", leftover); + ret = CMD_ERROR; + goto end; + } + if (!opt_session_name) { session_name = get_session_name(); if (session_name == NULL) {