ust-fd: Add close_range declaration
[lttng-ust.git] / include / lttng / ust-tracepoint-event.h
index 1edb50c13d295cac4d0f973223dc1c3453ee285e..5d845ae1e4bb0246cef8cda5495b89e04aa89c17 100644 (file)
@@ -1,8 +1,6 @@
-/*
- * SPDX-License-Identifier: MIT
- *
- * Copyright (C) 2011-2012 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- */
+// SPDX-FileCopyrightText: 2011-2012 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+//
+// SPDX-License-Identifier: MIT
 
 #include <stdint.h>
 #include <stdio.h>
@@ -257,9 +255,48 @@ void lttng_ust__event_template_proto___##_provider##___##_name(LTTNG_UST__TP_ARG
        };
 #include LTTNG_UST_TRACEPOINT_INCLUDE
 
+
+/*
+ * Stage 0.9.0
+ * Verifying sequence length types are of an unsigned type.
+ */
+
+/* Reset all macros within LTTNG_UST_TRACEPOINT_EVENT */
+#include <lttng/ust-tracepoint-event-reset.h>
+#include <lttng/ust-tracepoint-event-write.h>
+#include <lttng/ust-tracepoint-event-nowrite.h>
+
+/*
+ * Note that it is not possible to encode the length type as a C identifier,
+ * since it can be multiple tokens.
+ */
+#undef lttng_ust__field_sequence_encoded
+#define lttng_ust__field_sequence_encoded(_type, _item, _src, _byte_order,     \
+                       _length_type, _src_length, _encoding, _nowrite, \
+                       _elem_type_base)                        \
+       lttng_ust_static_assert(!lttng_ust_is_signed_type(_length_type), \
+                               "Length type " #_length_type " is not a unsigned integer type", \
+                               Length_type_is_not_a_unsigned_integer_type);
+
+#undef LTTNG_UST_TP_FIELDS
+#define LTTNG_UST_TP_FIELDS(...) __VA_ARGS__   /* Only one used in this phase */
+
+#undef LTTNG_UST__TRACEPOINT_EVENT_CLASS
+#define LTTNG_UST__TRACEPOINT_EVENT_CLASS(_provider, _name, _args, _fields)    \
+               _fields
+
+#include LTTNG_UST_TRACEPOINT_INCLUDE
+
+#if defined(__cplusplus)
+
 /*
  * Stage 0.9.1
- * Verifying array and sequence elements are of an integer type.
+ * Verifying array and sequence elements are of an integer or pointer
+ * type.
+ *
+ * This compile-time check is only enabled in C++, because the C
+ * implementation of lttng_ust_is_pointer_type does not support opaque
+ * pointer types.
  */
 
 /* Reset all macros within LTTNG_UST_TRACEPOINT_EVENT */
@@ -288,6 +325,8 @@ void lttng_ust__event_template_proto___##_provider##___##_name(LTTNG_UST__TP_ARG
 
 #include LTTNG_UST_TRACEPOINT_INCLUDE
 
+#endif
+
 /*
  * Stage 0.9.2 of tracepoint event generation.
  *
@@ -844,7 +883,7 @@ size_t lttng_ust__event_get_align__##_provider##___##_name(LTTNG_UST__TP_ARGS_PR
        if (lttng_ust_string_encoding_##_encoding == lttng_ust_string_encoding_none) \
                __chan->ops->event_write(&__ctx, _src, sizeof(_type) * (_length), lttng_ust_rb_alignof(_type)); \
        else                                                            \
-               __chan->ops->event_pstrcpy_pad(&__ctx, (const char *) (_src), _length); \
+               __chan->ops->event_pstrcpy_pad(&__ctx, (const char *) (_src), _length);
 
 #undef lttng_ust__field_sequence_encoded
 #define lttng_ust__field_sequence_encoded(_type, _item, _src, _byte_order, _length_type, \
@@ -1136,7 +1175,7 @@ static const struct lttng_ust_event_desc lttng_ust__event_desc___##_provider##_#
 #define LTTNG_UST__TRACEPOINT_EVENT_INSTANCE(_template_provider, _template_name, _provider, _name, _args) \
        &lttng_ust__event_desc___##_provider##_##_name,
 
-static const struct lttng_ust_event_desc * const LTTNG_UST__TP_COMBINE_TOKENS(lttng_ust__event_desc___, LTTNG_UST_TRACEPOINT_PROVIDER)[] = {
+static const struct lttng_ust_event_desc * const LTTNG_UST__TP_COMBINE_TOKENS(lttng_ust__provider_event_desc___, LTTNG_UST_TRACEPOINT_PROVIDER)[] = {
 #include LTTNG_UST_TRACEPOINT_INCLUDE
        NULL,   /* Dummy, C99 forbids 0-len array. */
 };
@@ -1151,8 +1190,8 @@ static const struct lttng_ust_event_desc * const LTTNG_UST__TP_COMBINE_TOKENS(lt
 const struct lttng_ust_probe_desc LTTNG_UST__TP_COMBINE_TOKENS(lttng_ust__probe_desc___, LTTNG_UST_TRACEPOINT_PROVIDER) = {
        .struct_size = sizeof(struct lttng_ust_probe_desc),
        .provider_name = lttng_ust__tp_stringify(LTTNG_UST_TRACEPOINT_PROVIDER),
-       .event_desc = LTTNG_UST__TP_COMBINE_TOKENS(lttng_ust__event_desc___, LTTNG_UST_TRACEPOINT_PROVIDER),
-       .nr_events = LTTNG_UST__TP_ARRAY_SIZE(LTTNG_UST__TP_COMBINE_TOKENS(lttng_ust__event_desc___, LTTNG_UST_TRACEPOINT_PROVIDER)) - 1,
+       .event_desc = LTTNG_UST__TP_COMBINE_TOKENS(lttng_ust__provider_event_desc___, LTTNG_UST_TRACEPOINT_PROVIDER),
+       .nr_events = LTTNG_UST__TP_ARRAY_SIZE(LTTNG_UST__TP_COMBINE_TOKENS(lttng_ust__provider_event_desc___, LTTNG_UST_TRACEPOINT_PROVIDER)) - 1,
        .major = LTTNG_UST_PROVIDER_MAJOR,
        .minor = LTTNG_UST_PROVIDER_MINOR,
 };
This page took 0.023668 seconds and 4 git commands to generate.