X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=src%2Fbin%2Flttng%2Fcommands%2Fenable_events.c;h=2c366c6d2e6db46636d1f8b98701a8415608e00a;hb=4ba92f185fb1d0b112cbc804a261939f5f81dc34;hp=573725d5c1ba8d79bad1e4de43db310640b04681;hpb=f5436bfcf6797b979b308a9af782750f9d079686;p=lttng-tools.git diff --git a/src/bin/lttng/commands/enable_events.c b/src/bin/lttng/commands/enable_events.c index 573725d5c..2c366c6d2 100644 --- a/src/bin/lttng/commands/enable_events.c +++ b/src/bin/lttng/commands/enable_events.c @@ -15,7 +15,6 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#define _GNU_SOURCE #define _LGPL_SOURCE #include #include @@ -677,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. @@ -809,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, @@ -1101,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; @@ -1378,7 +1401,7 @@ int cmd_enable_events(int argc, const char **argv) while ((opt = poptGetNextOpt(pc)) != -1) { switch (opt) { case OPT_HELP: - usage(stdout); + SHOW_HELP(); goto end; case OPT_TRACEPOINT: opt_event_type = LTTNG_EVENT_TRACEPOINT;