Cleanup: rename `get_domain_str()` -> `lttng_domain_type_str()`
[lttng-tools.git] / src / bin / lttng / commands / disable_events.c
index 269620178e4093101da62a78379d7f9d6af36bcf..0bfd0c506c850e4fedca383615c13d67365a7006 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
@@ -26,6 +16,7 @@
 #include <assert.h>
 
 #include <common/mi-lttng.h>
+#include <lttng/domain-internal.h>
 
 #include "../command.h"
 
@@ -116,7 +107,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;
 
@@ -236,7 +227,7 @@ static int disable_events(char *session_name)
                        enabled = 0;
                        success = 1;
                        MSG("All %s events of type %s are disabled in channel %s",
-                                       get_domain_str(dom.type),
+                                       lttng_domain_type_str(dom.type),
                                        print_event_type(opt_event_type),
                                        print_channel_name(channel_name));
                }
@@ -275,7 +266,7 @@ static int disable_events(char *session_name)
                                enabled = 1;
                        } else {
                                MSG("%s %s of type %s disabled in channel %s for session %s",
-                                               get_domain_str(dom.type),
+                                               lttng_domain_type_str(dom.type),
                                                event_name,
                                                print_event_type(opt_event_type),
                                                print_channel_name(channel_name),
@@ -328,6 +319,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);
@@ -377,7 +369,9 @@ int cmd_disable_events(int argc, const char **argv)
        }
 
        ret = print_missing_or_multiple_domains(
-               opt_kernel + opt_userspace + opt_jul + opt_log4j + opt_python);
+                       opt_kernel + opt_userspace + opt_jul + opt_log4j +
+                                       opt_python,
+                       true);
        if (ret) {
                ret = CMD_ERROR;
                goto end;
@@ -398,6 +392,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) {
This page took 0.02457 seconds and 4 git commands to generate.