SoW-2019-0002: Dynamic Snapshot
[lttng-tools.git] / src / bin / lttng / commands / disable_events.c
index e301b71b38642a0b841df04ed658fdb4bd025f0c..501c3cf3aa7bc31caecf8792a68a5966c4086594 100644 (file)
@@ -1,18 +1,8 @@
 /*
- * Copyright (C) 2011 David Goulet <david.goulet@polymtl.ca>
+ * Copyright (C) 2011 David Goulet <david.goulet@polymtl.ca>
  *
- * 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
@@ -40,6 +30,12 @@ static int opt_log4j;
 static int opt_python;
 static int opt_event_type;
 
+#ifdef LTTNG_EMBED_HELP
+static const char help_msg[] =
+#include <lttng-disable-event.1.h>
+;
+#endif
+
 enum {
        OPT_HELP = 1,
        OPT_TYPE_SYSCALL,
@@ -110,7 +106,7 @@ const char *print_event_type(const enum lttng_event_type ev_type)
  * enabled is 0 or 1
  * success is 0 or 1
  */
-static int mi_print_event(char *event_name, int enabled, int success)
+static int mi_print_event(const char *event_name, int enabled, int success)
 {
        int ret;
 
@@ -322,6 +318,7 @@ int cmd_disable_events(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;
        int event_type = -1;
 
        pc = poptGetContext(NULL, argc, argv, long_options, 0);
@@ -392,6 +389,13 @@ int cmd_disable_events(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) {
@@ -467,7 +471,7 @@ end:
                ret = ret ? ret : LTTNG_ERR_MI_IO_FAIL;
        }
 
-       /* Overwrite ret if an error occured in disable_events */
+       /* Overwrite ret if an error occurred in disable_events */
        ret = command_ret ? command_ret : ret;
 
        poptFreeContext(pc);
This page took 0.026397 seconds and 5 git commands to generate.