Warn when exclusion names are truncated
authorPhilippe Proulx <eeppeliteloop@gmail.com>
Wed, 26 Aug 2015 22:13:23 +0000 (18:13 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Wed, 4 Nov 2015 20:57:37 +0000 (15:57 -0500)
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
src/bin/lttng/commands/enable_events.c

index 44cc70dcb1c63a26fbeccb380721eb2ef7622f64..6a536976636e6d4f5729ccc9333f6ec066da4b48 100644 (file)
@@ -676,6 +676,24 @@ end:
        *exclusion_list_ptr = exclusion_list;
        return ret;
 }
+
+static void warn_on_truncated_exclusion_names(char **exclusion_list,
+       int exclusion_count, int *warn)
+{
+       size_t i = 0;
+
+       for (i = 0; i < exclusion_count; ++i) {
+               const char *name = exclusion_list[i];
+               size_t len = strlen(name);
+
+               if (len >= LTTNG_SYMBOL_NAME_LEN) {
+                       WARN("Event exclusion \"%s\" will be truncated",
+                               name);
+                       *warn = 1;
+               }
+       }
+}
+
 /*
  * Enabling event using the lttng API.
  * Note: in case of error only the last error code will be return.
@@ -808,6 +826,9 @@ static int enable_events(char *session_name)
                                goto error;
                        }
                        ev.exclusion = 1;
+
+                       warn_on_truncated_exclusion_names(exclusion_list,
+                               exclusion_count, &warn);
                }
                if (!opt_filter) {
                        ret = lttng_enable_event_with_exclusions(handle,
@@ -1100,6 +1121,9 @@ static int enable_events(char *session_name)
                                if (ret == CMD_ERROR) {
                                        goto error;
                                }
+
+                               warn_on_truncated_exclusion_names(
+                                       exclusion_list, exclusion_count, &warn);
                        }
 
                        ev.loglevel_type = opt_loglevel_type;
This page took 0.02666 seconds and 4 git commands to generate.