Fix: endianness of integers received by filter
[lttng-ust.git] / include / lttng / ust-tracepoint-event.h
index 92edc455f3ddde03bd3817b82bf7d7d3ae177667..e914d97ed002f98dab33761a5607d1ed793b5602 100644 (file)
@@ -28,6 +28,7 @@
 #include <lttng/ringbuffer-config.h>
 #include <lttng/ust-compiler.h>
 #include <lttng/tracepoint.h>
+#include <byteswap.h>
 #include <string.h>
 
 #define __LTTNG_UST_NULL_STRING        "(null)"
@@ -411,18 +412,24 @@ size_t __event_get_size__##_provider##___##_name(size_t *__dynamic_len, _TP_ARGS
                case 2:                                                        \
                {                                                              \
                        union { _type t; int16_t v; } __tmp = { (_type) (_src) }; \
+                       if (_byte_order != BYTE_ORDER)                         \
+                               __tmp.v = bswap_16(__tmp.v);                   \
                        __ctf_tmp_int64 = (int64_t) __tmp.v;                   \
                        break;                                                 \
                }                                                              \
                case 4:                                                        \
                {                                                              \
                        union { _type t; int32_t v; } __tmp = { (_type) (_src) }; \
+                       if (_byte_order != BYTE_ORDER)                         \
+                               __tmp.v = bswap_32(__tmp.v);                   \
                        __ctf_tmp_int64 = (int64_t) __tmp.v;                   \
                        break;                                                 \
                }                                                              \
                case 8:                                                        \
                {                                                              \
                        union { _type t; int64_t v; } __tmp = { (_type) (_src) }; \
+                       if (_byte_order != BYTE_ORDER)                         \
+                               __tmp.v = bswap_64(__tmp.v);                   \
                        __ctf_tmp_int64 = (int64_t) __tmp.v;                   \
                        break;                                                 \
                }                                                              \
@@ -442,18 +449,24 @@ size_t __event_get_size__##_provider##___##_name(size_t *__dynamic_len, _TP_ARGS
                case 2:                                                        \
                {                                                              \
                        union { _type t; uint16_t v; } __tmp = { (_type) (_src) }; \
+                       if (_byte_order != BYTE_ORDER)                         \
+                               __tmp.v = bswap_16(__tmp.v);                   \
                        __ctf_tmp_uint64 = (uint64_t) __tmp.v;                 \
                        break;                                                 \
                }                                                              \
                case 4:                                                        \
                {                                                              \
                        union { _type t; uint32_t v; } __tmp = { (_type) (_src) }; \
+                       if (_byte_order != BYTE_ORDER)                         \
+                               __tmp.v = bswap_32(__tmp.v);                   \
                        __ctf_tmp_uint64 = (uint64_t) __tmp.v;                 \
                        break;                                                 \
                }                                                              \
                case 8:                                                        \
                {                                                              \
                        union { _type t; uint64_t v; } __tmp = { (_type) (_src) }; \
+                       if (_byte_order != BYTE_ORDER)                         \
+                               __tmp.v = bswap_64(__tmp.v);                   \
                        __ctf_tmp_uint64 = (uint64_t) __tmp.v;                 \
                        break;                                                 \
                }                                                              \
This page took 0.024101 seconds and 4 git commands to generate.