From f56cd1d5b4b28510fcbfc08ec3ba86ffdb62cb52 Mon Sep 17 00:00:00 2001 From: Mathieu Desnoyers Date: Sat, 3 Dec 2011 17:50:23 -0500 Subject: [PATCH] Increase tracepoint provider:name len limit to 255, add compile-time warning The compiler will now complain with a warning if a tracepoint provider:name exceeds the 255 char limit (+ \0). Signed-off-by: Mathieu Desnoyers --- include/lttng/ust-abi.h | 2 +- include/lttng/ust-tracepoint-event.h | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/include/lttng/ust-abi.h b/include/lttng/ust-abi.h index 2567ceb8..8b819773 100644 --- a/include/lttng/ust-abi.h +++ b/include/lttng/ust-abi.h @@ -20,7 +20,7 @@ #include -#define LTTNG_UST_SYM_NAME_LEN 128 +#define LTTNG_UST_SYM_NAME_LEN 256 #define LTTNG_UST_COMM_VERSION_MAJOR 0 #define LTTNG_UST_COMM_VERSION_MINOR 1 diff --git a/include/lttng/ust-tracepoint-event.h b/include/lttng/ust-tracepoint-event.h index 5066b4b6..58c46d80 100644 --- a/include/lttng/ust-tracepoint-event.h +++ b/include/lttng/ust-tracepoint-event.h @@ -117,6 +117,25 @@ void _TP_COMBINE_TOKENS(__tracepoint_provider_check_, TRACEPOINT_PROVIDER)(void) #include TRACEPOINT_INCLUDE } +/* + * Stage 0.1 of tracepoint event generation. + * + * Check that each TRACEPOINT_EVENT provider:name does not exceed the + * tracepoint name length limit. + */ + +/* Reset all macros within TRACEPOINT_EVENT */ +#include + +#undef TRACEPOINT_EVENT_INSTANCE +#define TRACEPOINT_EVENT_INSTANCE(_provider, _template, _name, _args) \ +static const char \ + __tp_name_len_check##_provider##___##_name[LTTNG_UST_SYM_NAME_LEN] \ + __attribute__((unused)) = \ + #_provider ":" #_name; + +#include TRACEPOINT_INCLUDE + /* * Stage 1 of tracepoint event generation. * -- 2.34.1