#if (defined(__linux__) || defined(__CYGWIN__))
#include <endian.h>
#include <byteswap.h>
-#elif defined(__FreeBSD__)
-#include <sys/endian.h>
-#define bswap_16(x) bswap16(x)
-#define bswap_32(x) bswap32(x)
-#define bswap_64(x) bswap64(x)
-#else
-#error "Please add support for your OS."
-#endif
-/*
- * BYTE_ORDER, LITTLE_ENDIAN, and BIG_ENDIAN are only defined on Linux
- * if __USE_BSD is defined. Force their definition.
- */
-#ifndef BYTE_ORDER
-#define BYTE_ORDER __BYTE_ORDER
-#endif
+#define lttng_ust_bswap_16(x) bswap_16(x)
+#define lttng_ust_bswap_32(x) bswap_32(x)
+#define lttng_ust_bswap_64(x) bswap_64(x)
-#ifndef LITTLE_ENDIAN
-#define LITTLE_ENDIAN __LITTLE_ENDIAN
-#endif
-
-#ifndef BIG_ENDIAN
-#define BIG_ENDIAN __BIG_ENDIAN
-#endif
+#define LTTNG_UST_BYTE_ORDER __BYTE_ORDER
+#define LTTNG_UST_LITTLE_ENDIAN __LITTLE_ENDIAN
+#define LTTNG_UST_BIG_ENDIAN __BIG_ENDIAN
-#ifndef FLOAT_WORD_ORDER
#ifdef __FLOAT_WORD_ORDER
-#define FLOAT_WORD_ORDER __FLOAT_WORD_ORDER
+#define LTTNG_UST_FLOAT_WORD_ORDER __FLOAT_WORD_ORDER
#else /* __FLOAT_WORD_ORDER */
-#define FLOAT_WORD_ORDER BYTE_ORDER
+#define LTTNG_UST_FLOAT_WORD_ORDER __BYTE_ORDER
#endif /* __FLOAT_WORD_ORDER */
-#endif /* FLOAT_WORD_ORDER */
+
+#elif defined(__FreeBSD__)
+
+#include <sys/endian.h>
+
+#define lttng_ust_bswap_16(x) bswap16(x)
+#define lttng_ust_bswap_32(x) bswap32(x)
+#define lttng_ust_bswap_64(x) bswap64(x)
+
+#define LTTNG_UST_BYTE_ORDER BYTE_ORDER
+#define LTTNG_UST_LITTLE_ENDIAN LITTLE_ENDIAN
+#define LTTNG_UST_BIG_ENDIAN BIG_ENDIAN
+#define FLOAT_WORD_ORDER BYTE_ORDER
+
+#else
+#error "Please add support for your OS."
+#endif
#endif /* _LTTNG_UST_ENDIAN_H */
.size = sizeof(_type) * CHAR_BIT, \
.alignment = lttng_ust_rb_alignof(_type) * CHAR_BIT, \
.signedness = lttng_ust_is_signed_type(_type), \
- .reverse_byte_order = _byte_order != BYTE_ORDER, \
+ .reverse_byte_order = _byte_order != LTTNG_UST_BYTE_ORDER, \
.base = _base, \
}))
- lttng_ust_float_mant_dig(_type), \
.mant_dig = lttng_ust_float_mant_dig(_type), \
.alignment = lttng_ust_rb_alignof(_type) * CHAR_BIT, \
- .reverse_byte_order = BYTE_ORDER != FLOAT_WORD_ORDER, \
+ .reverse_byte_order = LTTNG_UST_BYTE_ORDER != LTTNG_UST_FLOAT_WORD_ORDER, \
}))
#undef ctf_integer_nowrite
#define ctf_integer_nowrite(_type, _item, _src) \
- _ctf_integer_ext(_type, _item, _src, BYTE_ORDER, 10, 1)
+ _ctf_integer_ext(_type, _item, _src, LTTNG_UST_BYTE_ORDER, 10, 1)
#undef ctf_float_nowrite
#define ctf_float_nowrite(_type, _item, _src) \
#undef ctf_array_nowrite
#define ctf_array_nowrite(_type, _item, _src, _length) \
- _ctf_array_encoded(_type, _item, _src, BYTE_ORDER, _length, none, 1, 10)
+ _ctf_array_encoded(_type, _item, _src, LTTNG_UST_BYTE_ORDER, _length, none, 1, 10)
#undef ctf_array_nowrite_hex
#define ctf_array_nowrite_hex(_type, _item, _src, _length) \
- _ctf_array_encoded(_type, _item, _src, BYTE_ORDER, _length, none, 1, 16)
+ _ctf_array_encoded(_type, _item, _src, LTTNG_UST_BYTE_ORDER, _length, none, 1, 16)
#undef ctf_array_network_nowrite
#define ctf_array_network_nowrite(_type, _item, _src, _length) \
- _ctf_array_encoded(_type, _item, _src, BIG_ENDIAN, \
+ _ctf_array_encoded(_type, _item, _src, LTTNG_UST_BIG_ENDIAN, \
_length, none, 1, 10)
#undef ctf_array_network_nowrite_hex
#define ctf_array_network_nowrite_hex(_type, _item, _src, _length) \
- _ctf_array_encoded(_type, _item, _src, BIG_ENDIAN, \
+ _ctf_array_encoded(_type, _item, _src, LTTNG_UST_BIG_ENDIAN, \
_length, none, 1, 16)
#undef ctf_array_text_nowrite
#define ctf_array_text_nowrite(_type, _item, _src, _length) \
- _ctf_array_encoded(_type, _item, _src, BYTE_ORDER, _length, UTF8, 1, 10)
+ _ctf_array_encoded(_type, _item, _src, LTTNG_UST_BYTE_ORDER, _length, UTF8, 1, 10)
#undef ctf_sequence_nowrite
#define ctf_sequence_nowrite(_type, _item, _src, _length_type, _src_length) \
- _ctf_sequence_encoded(_type, _item, _src, BYTE_ORDER, \
+ _ctf_sequence_encoded(_type, _item, _src, LTTNG_UST_BYTE_ORDER, \
_length_type, _src_length, none, 1, 10)
#undef ctf_sequence_nowrite_hex
#define ctf_sequence_nowrite_hex(_type, _item, _src, _length_type, _src_length) \
- _ctf_sequence_encoded(_type, _item, _src, BYTE_ORDER, \
+ _ctf_sequence_encoded(_type, _item, _src, LTTNG_UST_BYTE_ORDER, \
_length_type, _src_length, none, 1, 16)
#undef ctf_sequence_network_nowrite
#define ctf_sequence_network_nowrite(_type, _item, _src, _length_type, _src_length) \
- _ctf_sequence_encoded(_type, _item, _src, BIG_ENDIAN, \
+ _ctf_sequence_encoded(_type, _item, _src, LTTNG_UST_BIG_ENDIAN, \
_length_type, _src_length, none, 1, 10)
#undef ctf_sequence_network_nowrite_hex
#define ctf_sequence_network_nowrite_hex(_type, _item, _src, _length_type, _src_length) \
- _ctf_sequence_encoded(_type, _item, _src, BIG_ENDIAN, \
+ _ctf_sequence_encoded(_type, _item, _src, LTTNG_UST_BIG_ENDIAN, \
_length_type, _src_length, none, 1, 16)
#undef ctf_sequence_text_nowrite
#define ctf_sequence_text_nowrite(_type, _item, _src, _length_type, _src_length) \
- _ctf_sequence_encoded(_type, _item, _src, BYTE_ORDER, \
+ _ctf_sequence_encoded(_type, _item, _src, LTTNG_UST_BYTE_ORDER, \
_length_type, _src_length, UTF8, 1, 10)
#undef ctf_string_nowrite
#undef ctf_integer
#define ctf_integer(_type, _item, _src) \
- _ctf_integer_ext(_type, _item, _src, BYTE_ORDER, 10, 0)
+ _ctf_integer_ext(_type, _item, _src, LTTNG_UST_BYTE_ORDER, 10, 0)
#undef ctf_integer_hex
#define ctf_integer_hex(_type, _item, _src) \
- _ctf_integer_ext(_type, _item, _src, BYTE_ORDER, 16, 0)
+ _ctf_integer_ext(_type, _item, _src, LTTNG_UST_BYTE_ORDER, 16, 0)
#undef ctf_integer_network
#define ctf_integer_network(_type, _item, _src) \
- _ctf_integer_ext(_type, _item, _src, BIG_ENDIAN, 10, 0)
+ _ctf_integer_ext(_type, _item, _src, LTTNG_UST_BIG_ENDIAN, 10, 0)
#undef ctf_integer_network_hex
#define ctf_integer_network_hex(_type, _item, _src) \
- _ctf_integer_ext(_type, _item, _src, BIG_ENDIAN, 16, 0)
+ _ctf_integer_ext(_type, _item, _src, LTTNG_UST_BIG_ENDIAN, 16, 0)
#undef ctf_float
#define ctf_float(_type, _item, _src) \
#undef ctf_array
#define ctf_array(_type, _item, _src, _length) \
- _ctf_array_encoded(_type, _item, _src, BYTE_ORDER, \
+ _ctf_array_encoded(_type, _item, _src, LTTNG_UST_BYTE_ORDER, \
_length, none, 0, 10)
#undef ctf_array_hex
#define ctf_array_hex(_type, _item, _src, _length) \
- _ctf_array_encoded(_type, _item, _src, BYTE_ORDER, \
+ _ctf_array_encoded(_type, _item, _src, LTTNG_UST_BYTE_ORDER, \
_length, none, 0, 16)
#undef ctf_array_network
#define ctf_array_network(_type, _item, _src, _length) \
- _ctf_array_encoded(_type, _item, _src, BIG_ENDIAN, \
+ _ctf_array_encoded(_type, _item, _src, LTTNG_UST_BIG_ENDIAN, \
_length, none, 0, 10)
#undef ctf_array_network_hex
#define ctf_array_network_hex(_type, _item, _src, _length) \
- _ctf_array_encoded(_type, _item, _src, BIG_ENDIAN, \
+ _ctf_array_encoded(_type, _item, _src, LTTNG_UST_BIG_ENDIAN, \
_length, none, 0, 16)
#undef ctf_array_text
#define ctf_array_text(_type, _item, _src, _length) \
- _ctf_array_encoded(_type, _item, _src, BYTE_ORDER, \
+ _ctf_array_encoded(_type, _item, _src, LTTNG_UST_BYTE_ORDER, \
_length, UTF8, 0, 10)
#undef ctf_sequence
#define ctf_sequence(_type, _item, _src, _length_type, _src_length) \
- _ctf_sequence_encoded(_type, _item, _src, BYTE_ORDER, \
+ _ctf_sequence_encoded(_type, _item, _src, LTTNG_UST_BYTE_ORDER, \
_length_type, _src_length, none, 0, 10)
#undef ctf_sequence_hex
#define ctf_sequence_hex(_type, _item, _src, _length_type, _src_length) \
- _ctf_sequence_encoded(_type, _item, _src, BYTE_ORDER, \
+ _ctf_sequence_encoded(_type, _item, _src, LTTNG_UST_BYTE_ORDER, \
_length_type, _src_length, none, 0, 16)
#undef ctf_sequence_network
#define ctf_sequence_network(_type, _item, _src, _length_type, _src_length) \
- _ctf_sequence_encoded(_type, _item, _src, BIG_ENDIAN, \
+ _ctf_sequence_encoded(_type, _item, _src, LTTNG_UST_BIG_ENDIAN, \
_length_type, _src_length, none, 0, 10)
#undef ctf_sequence_network_hex
#define ctf_sequence_network_hex(_type, _item, _src, _length_type, _src_length) \
- _ctf_sequence_encoded(_type, _item, _src, BIG_ENDIAN, \
+ _ctf_sequence_encoded(_type, _item, _src, LTTNG_UST_BIG_ENDIAN, \
_length_type, _src_length, none, 0, 16)
#undef ctf_sequence_text
#define ctf_sequence_text(_type, _item, _src, _length_type, _src_length) \
- _ctf_sequence_encoded(_type, _item, _src, BYTE_ORDER, \
+ _ctf_sequence_encoded(_type, _item, _src, LTTNG_UST_BYTE_ORDER, \
_length_type, _src_length, UTF8, 0, 10)
#undef ctf_string
LTTNG_UST_COMPOUND_LITERAL(const struct lttng_ust_event_field, { \
.struct_size = sizeof(struct lttng_ust_event_field), \
.name = "_" #_item "_length", \
- .type = lttng_ust_type_integer_define(_length_type, BYTE_ORDER, 10), \
+ .type = lttng_ust_type_integer_define(_length_type, LTTNG_UST_BYTE_ORDER, 10), \
.nowrite = _nowrite, \
.nofilter = 1, \
}), \
}, \
.struct_size = sizeof(struct lttng_ust_type_enum), \
.desc = &__enum_##_provider##_##_name, \
- .container_type = lttng_ust_type_integer_define(_type, BYTE_ORDER, 10), \
+ .container_type = lttng_ust_type_integer_define(_type, LTTNG_UST_BYTE_ORDER, 10), \
}), \
.nowrite = _nowrite, \
.nofilter = 0, \
#undef _ctf_enum
#define _ctf_enum(_provider, _name, _type, _item, _src, _nowrite) \
- _ctf_integer_ext(_type, _item, _src, BYTE_ORDER, 10, _nowrite)
+ _ctf_integer_ext(_type, _item, _src, LTTNG_UST_BYTE_ORDER, 10, _nowrite)
#undef LTTNG_UST_TP_ARGS
#define LTTNG_UST_TP_ARGS(...) __VA_ARGS__
case 2: \
{ \
union { _type t; int16_t v; } __tmp = { (_type) (_src) }; \
- if (_byte_order != BYTE_ORDER) \
- __tmp.v = bswap_16(__tmp.v); \
+ if (_byte_order != LTTNG_UST_BYTE_ORDER) \
+ __tmp.v = lttng_ust_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); \
+ if (_byte_order != LTTNG_UST_BYTE_ORDER) \
+ __tmp.v = lttng_ust_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); \
+ if (_byte_order != LTTNG_UST_BYTE_ORDER) \
+ __tmp.v = lttng_ust_bswap_64(__tmp.v); \
__ctf_tmp_int64 = (int64_t) __tmp.v; \
break; \
} \
case 2: \
{ \
union { _type t; uint16_t v; } __tmp = { (_type) (_src) }; \
- if (_byte_order != BYTE_ORDER) \
- __tmp.v = bswap_16(__tmp.v); \
+ if (_byte_order != LTTNG_UST_BYTE_ORDER) \
+ __tmp.v = lttng_ust_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); \
+ if (_byte_order != LTTNG_UST_BYTE_ORDER) \
+ __tmp.v = lttng_ust_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); \
+ if (_byte_order != LTTNG_UST_BYTE_ORDER) \
+ __tmp.v = lttng_ust_bswap_64(__tmp.v); \
__ctf_tmp_uint64 = (uint64_t) __tmp.v; \
break; \
} \
#undef _ctf_enum
#define _ctf_enum(_provider, _name, _type, _item, _src, _nowrite) \
- _ctf_integer_ext(_type, _item, _src, BYTE_ORDER, 10, _nowrite)
+ _ctf_integer_ext(_type, _item, _src, LTTNG_UST_BYTE_ORDER, 10, _nowrite)
#undef LTTNG_UST_TP_ARGS
#define LTTNG_UST_TP_ARGS(...) __VA_ARGS__
#undef _ctf_enum
#define _ctf_enum(_provider, _name, _type, _item, _src, _nowrite) \
- _ctf_integer_ext(_type, _item, _src, BYTE_ORDER, 10, _nowrite)
+ _ctf_integer_ext(_type, _item, _src, LTTNG_UST_BYTE_ORDER, 10, _nowrite)
#undef LTTNG_UST_TP_ARGS
#define LTTNG_UST_TP_ARGS(...) __VA_ARGS__
#undef _ctf_enum
#define _ctf_enum(_provider, _name, _type, _item, _src, _nowrite) \
- _ctf_integer_ext(_type, _item, _src, BYTE_ORDER, 10, _nowrite)
+ _ctf_integer_ext(_type, _item, _src, LTTNG_UST_BYTE_ORDER, 10, _nowrite)
/* Beware: this get len actually consumes the len value */
#undef lttng_ust__get_dynamic_len
#include <stdint.h> /* C99 5.2.4.2 Numerical limits */
#include <limits.h> /* C99 5.2.4.2 Numerical limits */
#include <stdbool.h> /* C99 7.16 bool type */
-#include <lttng/ust-endian.h> /* Non-standard BIG_ENDIAN, LITTLE_ENDIAN, BYTE_ORDER */
+#include <lttng/ust-endian.h> /* Non-standard LTTNG_UST_BIG_ENDIAN, LTTNG_UST_LITTLE_ENDIAN, LTTNG_UST_BYTE_ORDER */
/*
* This header strictly follows the C99 standard, except for use of the
* bt_bitfield_write_be - write integer to a bitfield in big endian
*/
-#if (BYTE_ORDER == LITTLE_ENDIAN)
+#if (LTTNG_UST_BYTE_ORDER == LTTNG_UST_LITTLE_ENDIAN)
#define bt_bitfield_write(ptr, type, start, length, v) \
_bt_bitfield_write_le(ptr, type, start, length, v)
#define bt_bitfield_write_be(ptr, type, start, length, v) \
_bt_bitfield_write_be(ptr, unsigned char, start, length, v)
-#elif (BYTE_ORDER == BIG_ENDIAN)
+#elif (LTTNG_UST_BYTE_ORDER == LTTNG_UST_BIG_ENDIAN)
#define bt_bitfield_write(ptr, type, start, length, v) \
_bt_bitfield_write_be(ptr, type, start, length, v)
#define bt_bitfield_write_be(ptr, type, start, length, v) \
_bt_bitfield_write_be(ptr, type, start, length, v)
-#else /* (BYTE_ORDER == PDP_ENDIAN) */
+#else /* (LTTNG_UST_BYTE_ORDER == PDP_ENDIAN) */
#error "Byte order not supported"
* bt_bitfield_read_be - read integer from a bitfield in big endian
*/
-#if (BYTE_ORDER == LITTLE_ENDIAN)
+#if (LTTNG_UST_BYTE_ORDER == LTTNG_UST_LITTLE_ENDIAN)
#define bt_bitfield_read(ptr, type, start, length, vptr) \
_bt_bitfield_read_le(ptr, type, start, length, vptr)
#define bt_bitfield_read_be(ptr, type, start, length, vptr) \
_bt_bitfield_read_be(ptr, unsigned char, start, length, vptr)
-#elif (BYTE_ORDER == BIG_ENDIAN)
+#elif (LTTNG_UST_BYTE_ORDER == LTTNG_UST_BIG_ENDIAN)
#define bt_bitfield_read(ptr, type, start, length, vptr) \
_bt_bitfield_read_be(ptr, type, start, length, vptr)
#define bt_bitfield_read_be(ptr, type, start, length, vptr) \
_bt_bitfield_read_be(ptr, type, start, length, vptr)
-#else /* (BYTE_ORDER == PDP_ENDIAN) */
+#else /* (LTTNG_UST_BYTE_ORDER == PDP_ENDIAN) */
#error "Byte order not supported"
}
if (!is_elf_native_endian(elf)) {
- nhdr.n_namesz = bswap_32(nhdr.n_namesz);
- nhdr.n_descsz = bswap_32(nhdr.n_descsz);
- nhdr.n_type = bswap_32(nhdr.n_type);
+ nhdr.n_namesz = lttng_ust_bswap_32(nhdr.n_namesz);
+ nhdr.n_descsz = lttng_ust_bswap_32(nhdr.n_descsz);
+ nhdr.n_type = lttng_ust_bswap_32(nhdr.n_type);
}
offset += sizeof(nhdr) + nhdr.n_namesz;
goto error;
}
if (!is_elf_native_endian(elf)) {
- _crc = bswap_32(_crc);
+ _crc = lttng_ust_bswap_32(_crc);
}
end:
* Determine native endianness in order to convert when reading an ELF
* file if there is a mismatch.
*/
-#if BYTE_ORDER == LITTLE_ENDIAN
+#if LTTNG_UST_BYTE_ORDER == LTTNG_UST_LITTLE_ENDIAN
#define NATIVE_ELF_ENDIANNESS ELFDATA2LSB
#else
#define NATIVE_ELF_ENDIANNESS ELFDATA2MSB
do { \
switch (sizeof(x)) { \
case 8: \
- x = bswap_64(x); \
+ x = lttng_ust_bswap_64(x); \
break; \
case 4: \
- x = bswap_32(x); \
+ x = lttng_ust_bswap_32(x); \
break; \
case 2: \
- x = bswap_16(x); \
+ x = lttng_ust_bswap_16(x); \
break; \
case 1: \
break; \
.size = (_size), \
.alignment = (_alignment), \
.signedness = (_signedness), \
- .reverse_byte_order = (_byte_order) != BYTE_ORDER, \
+ .reverse_byte_order = (_byte_order) != LTTNG_UST_BYTE_ORDER, \
.base = (_base), \
}))
.encoding = lttng_ust_string_encoding_UTF8, \
.elem_type = lttng_ust_static_type_integer(sizeof(char) * CHAR_BIT, \
lttng_ust_rb_alignof(char) * CHAR_BIT, lttng_ust_is_signed_type(char), \
- BYTE_ORDER, 10), \
+ LTTNG_UST_BYTE_ORDER, 10), \
}))
#define lttng_ust_static_event_field(_name, _type, _nowrite, _nofilter) \
c ^= b; c -= rot(b, 24); \
}
-#if (BYTE_ORDER == LITTLE_ENDIAN)
-#define HASH_LITTLE_ENDIAN 1
+#if (LTTNG_UST_BYTE_ORDER == LTTNG_UST_LITTLE_ENDIAN)
+#define HASH_LTTNG_UST_LITTLE_ENDIAN 1
#else
-#define HASH_LITTLE_ENDIAN 0
+#define HASH_LTTNG_UST_LITTLE_ENDIAN 0
#endif
/*
a = b = c = 0xdeadbeef + ((uint32_t)length) + initval;
u.ptr = key;
- if (HASH_LITTLE_ENDIAN && ((u.i & 0x3) == 0)) {
+ if (HASH_LTTNG_UST_LITTLE_ENDIAN && ((u.i & 0x3) == 0)) {
const uint32_t *k = (const uint32_t *) key; /* read 32-bit chunks */
/*------ all but last block: aligned reads and affect 32 bits of (a,b,c) */
}
}
- } else if (HASH_LITTLE_ENDIAN && ((u.i & 0x1) == 0)) {
+ } else if (HASH_LTTNG_UST_LITTLE_ENDIAN && ((u.i & 0x1) == 0)) {
const uint16_t *k = (const uint16_t *) key; /* read 16-bit chunks */
const uint8_t *k8;
return len;
if (reg_msg.magic == LTTNG_UST_ABI_COMM_MAGIC) {
- *byte_order = BYTE_ORDER == BIG_ENDIAN ?
- BIG_ENDIAN : LITTLE_ENDIAN;
- } else if (reg_msg.magic == bswap_32(LTTNG_UST_ABI_COMM_MAGIC)) {
- *byte_order = BYTE_ORDER == BIG_ENDIAN ?
- LITTLE_ENDIAN : BIG_ENDIAN;
+ *byte_order = LTTNG_UST_BYTE_ORDER == LTTNG_UST_BIG_ENDIAN ?
+ LTTNG_UST_BIG_ENDIAN : LTTNG_UST_LITTLE_ENDIAN;
+ } else if (reg_msg.magic == lttng_ust_bswap_32(LTTNG_UST_ABI_COMM_MAGIC)) {
+ *byte_order = LTTNG_UST_BYTE_ORDER == LTTNG_UST_BIG_ENDIAN ?
+ LTTNG_UST_LITTLE_ENDIAN : LTTNG_UST_BIG_ENDIAN;
} else {
return -LTTNG_UST_ERR_INVAL_MAGIC;
}
int16_t tmp;
tmp = *(int16_t *) ptr;
if (byte_order_reversed)
- tmp = bswap_16(tmp);
+ tmp = lttng_ust_bswap_16(tmp);
value = tmp;
break;
int32_t tmp;
tmp = *(int32_t *) ptr;
if (byte_order_reversed)
- tmp = bswap_32(tmp);
+ tmp = lttng_ust_bswap_32(tmp);
value = tmp;
break;
int64_t tmp;
tmp = *(int64_t *) ptr;
if (byte_order_reversed)
- tmp = bswap_64(tmp);
+ tmp = lttng_ust_bswap_64(tmp);
value = tmp;
break;
uint16_t tmp;
tmp = *(uint16_t *) ptr;
if (byte_order_reversed)
- tmp = bswap_16(tmp);
+ tmp = lttng_ust_bswap_16(tmp);
value = tmp;
break;
uint32_t tmp;
tmp = *(uint32_t *) ptr;
if (byte_order_reversed)
- tmp = bswap_32(tmp);
+ tmp = lttng_ust_bswap_32(tmp);
value = tmp;
break;
uint64_t tmp;
tmp = *(uint64_t *) ptr;
if (byte_order_reversed)
- tmp = bswap_64(tmp);
+ tmp = lttng_ust_bswap_64(tmp);
value = tmp;
break;
dbg_printf("op load field s16\n");
tmp = *(int16_t *) stack_top->u.ptr.ptr;
if (stack_top->u.ptr.rev_bo)
- tmp = bswap_16(tmp);
+ tmp = lttng_ust_bswap_16(tmp);
stack_top->u.v = tmp;
stack_top->type = REG_S64;
break;
dbg_printf("op load field s32\n");
tmp = *(int32_t *) stack_top->u.ptr.ptr;
if (stack_top->u.ptr.rev_bo)
- tmp = bswap_32(tmp);
+ tmp = lttng_ust_bswap_32(tmp);
stack_top->u.v = tmp;
stack_top->type = REG_S64;
break;
dbg_printf("op load field s64\n");
tmp = *(int64_t *) stack_top->u.ptr.ptr;
if (stack_top->u.ptr.rev_bo)
- tmp = bswap_64(tmp);
+ tmp = lttng_ust_bswap_64(tmp);
stack_top->u.v = tmp;
stack_top->type = REG_S64;
break;
dbg_printf("op load field signed enumeration\n");
tmp = *(int64_t *) stack_top->u.ptr.ptr;
if (stack_top->u.ptr.rev_bo)
- tmp = bswap_64(tmp);
+ tmp = lttng_ust_bswap_64(tmp);
stack_top->u.v = tmp;
stack_top->type = REG_S64;
break;
dbg_printf("op load field u16\n");
tmp = *(uint16_t *) stack_top->u.ptr.ptr;
if (stack_top->u.ptr.rev_bo)
- tmp = bswap_16(tmp);
+ tmp = lttng_ust_bswap_16(tmp);
stack_top->u.v = tmp;
stack_top->type = REG_U64;
break;
dbg_printf("op load field u32\n");
tmp = *(uint32_t *) stack_top->u.ptr.ptr;
if (stack_top->u.ptr.rev_bo)
- tmp = bswap_32(tmp);
+ tmp = lttng_ust_bswap_32(tmp);
stack_top->u.v = tmp;
stack_top->type = REG_U64;
break;
dbg_printf("op load field u64\n");
tmp = *(uint64_t *) stack_top->u.ptr.ptr;
if (stack_top->u.ptr.rev_bo)
- tmp = bswap_64(tmp);
+ tmp = lttng_ust_bswap_64(tmp);
stack_top->u.v = tmp;
stack_top->type = REG_U64;
break;
dbg_printf("op load field unsigned enumeration\n");
tmp = *(uint64_t *) stack_top->u.ptr.ptr;
if (stack_top->u.ptr.rev_bo)
- tmp = bswap_64(tmp);
+ tmp = lttng_ust_bswap_64(tmp);
stack_top->u.v = tmp;
stack_top->type = REG_U64;
break;
lttng_ust_static_type_integer(sizeof(ino_t) * CHAR_BIT,
lttng_ust_rb_alignof(ino_t) * CHAR_BIT,
lttng_ust_is_signed_type(ino_t),
- BYTE_ORDER, 10),
+ LTTNG_UST_BYTE_ORDER, 10),
false, false),
cgroup_ns_get_size,
cgroup_ns_record,
lttng_ust_static_type_integer(sizeof(int) * CHAR_BIT,
lttng_ust_rb_alignof(int) * CHAR_BIT,
lttng_ust_is_signed_type(int),
- BYTE_ORDER, 10),
+ LTTNG_UST_BYTE_ORDER, 10),
false, false),
cpu_id_get_size,
cpu_id_record,
lttng_ust_static_type_integer(sizeof(void *) * CHAR_BIT,
lttng_ust_rb_alignof(void *) * CHAR_BIT,
lttng_ust_is_signed_type(void *),
- BYTE_ORDER, 10),
+ LTTNG_UST_BYTE_ORDER, 10),
false, false),
ip_get_size,
ip_record,
lttng_ust_static_type_integer(sizeof(ino_t) * CHAR_BIT,
lttng_ust_rb_alignof(ino_t) * CHAR_BIT,
lttng_ust_is_signed_type(ino_t),
- BYTE_ORDER, 10),
+ LTTNG_UST_BYTE_ORDER, 10),
false, false),
ipc_ns_get_size,
ipc_ns_record,
lttng_ust_static_type_integer(sizeof(ino_t) * CHAR_BIT,
lttng_ust_rb_alignof(ino_t) * CHAR_BIT,
lttng_ust_is_signed_type(ino_t),
- BYTE_ORDER, 10),
+ LTTNG_UST_BYTE_ORDER, 10),
false, false),
mnt_ns_get_size,
mnt_ns_record,
lttng_ust_static_type_integer(sizeof(ino_t) * CHAR_BIT,
lttng_ust_rb_alignof(ino_t) * CHAR_BIT,
lttng_ust_is_signed_type(ino_t),
- BYTE_ORDER, 10),
+ LTTNG_UST_BYTE_ORDER, 10),
false, false),
net_ns_get_size,
net_ns_record,
lttng_ust_static_type_integer(sizeof(uint64_t) * CHAR_BIT,
lttng_ust_rb_alignof(uint64_t) * CHAR_BIT,
lttng_ust_is_signed_type(uint64_t),
- BYTE_ORDER, 10);
+ LTTNG_UST_BYTE_ORDER, 10);
/* Called with UST lock held */
int lttng_add_perf_counter_to_ctx(uint32_t type,
lttng_ust_static_type_integer(sizeof(ino_t) * CHAR_BIT,
lttng_ust_rb_alignof(ino_t) * CHAR_BIT,
lttng_ust_is_signed_type(ino_t),
- BYTE_ORDER, 10),
+ LTTNG_UST_BYTE_ORDER, 10),
false, false),
pid_ns_get_size,
pid_ns_record,
lttng_ust_static_type_integer(sizeof(unsigned long) * CHAR_BIT,
lttng_ust_rb_alignof(unsigned long) * CHAR_BIT,
lttng_ust_is_signed_type(unsigned long),
- BYTE_ORDER, 10),
+ LTTNG_UST_BYTE_ORDER, 10),
false, false),
pthread_id_get_size,
pthread_id_record,
lttng_ust_static_type_integer(sizeof(ino_t) * CHAR_BIT,
lttng_ust_rb_alignof(ino_t) * CHAR_BIT,
lttng_ust_is_signed_type(ino_t),
- BYTE_ORDER, 10),
+ LTTNG_UST_BYTE_ORDER, 10),
false, false),
time_ns_get_size,
time_ns_record,
lttng_ust_static_type_integer(sizeof(ino_t) * CHAR_BIT,
lttng_ust_rb_alignof(ino_t) * CHAR_BIT,
lttng_ust_is_signed_type(ino_t),
- BYTE_ORDER, 10),
+ LTTNG_UST_BYTE_ORDER, 10),
false, false),
user_ns_get_size,
user_ns_record,
lttng_ust_static_type_integer(sizeof(ino_t) * CHAR_BIT,
lttng_ust_rb_alignof(ino_t) * CHAR_BIT,
lttng_ust_is_signed_type(ino_t),
- BYTE_ORDER, 10),
+ LTTNG_UST_BYTE_ORDER, 10),
false, false),
uts_ns_get_size,
uts_ns_record,
lttng_ust_static_type_integer(sizeof(gid_t) * CHAR_BIT,
lttng_ust_rb_alignof(gid_t) * CHAR_BIT,
lttng_ust_is_signed_type(gid_t),
- BYTE_ORDER, 10),
+ LTTNG_UST_BYTE_ORDER, 10),
false, false),
vegid_get_size,
vegid_record,
lttng_ust_static_type_integer(sizeof(uid_t) * CHAR_BIT,
lttng_ust_rb_alignof(uid_t) * CHAR_BIT,
lttng_ust_is_signed_type(uid_t),
- BYTE_ORDER, 10),
+ LTTNG_UST_BYTE_ORDER, 10),
false, false),
veuid_get_size,
veuid_record,
lttng_ust_static_type_integer(sizeof(gid_t) * CHAR_BIT,
lttng_ust_rb_alignof(gid_t) * CHAR_BIT,
lttng_ust_is_signed_type(gid_t),
- BYTE_ORDER, 10),
+ LTTNG_UST_BYTE_ORDER, 10),
false, false),
vgid_get_size,
vgid_record,
lttng_ust_static_type_integer(sizeof(pid_t) * CHAR_BIT,
lttng_ust_rb_alignof(pid_t) * CHAR_BIT,
lttng_ust_is_signed_type(pid_t),
- BYTE_ORDER, 10),
+ LTTNG_UST_BYTE_ORDER, 10),
false, false),
vpid_get_size,
vpid_record,
lttng_ust_static_type_integer(sizeof(gid_t) * CHAR_BIT,
lttng_ust_rb_alignof(gid_t) * CHAR_BIT,
lttng_ust_is_signed_type(gid_t),
- BYTE_ORDER, 10),
+ LTTNG_UST_BYTE_ORDER, 10),
false, false),
vsgid_get_size,
vsgid_record,
lttng_ust_static_type_integer(sizeof(uid_t) * CHAR_BIT,
lttng_ust_rb_alignof(uid_t) * CHAR_BIT,
lttng_ust_is_signed_type(uid_t),
- BYTE_ORDER, 10),
+ LTTNG_UST_BYTE_ORDER, 10),
false, false),
vsuid_get_size,
vsuid_record,
lttng_ust_static_type_integer(sizeof(pid_t) * CHAR_BIT,
lttng_ust_rb_alignof(pid_t) * CHAR_BIT,
lttng_ust_is_signed_type(pid_t),
- BYTE_ORDER, 10),
+ LTTNG_UST_BYTE_ORDER, 10),
false, false),
vtid_get_size,
vtid_record,
lttng_ust_static_type_integer(sizeof(uid_t) * CHAR_BIT,
lttng_ust_rb_alignof(uid_t) * CHAR_BIT,
lttng_ust_is_signed_type(uid_t),
- BYTE_ORDER, 10),
+ LTTNG_UST_BYTE_ORDER, 10),
false, false),
vuid_get_size,
vuid_record,
[LTTNG_UST_DYNAMIC_TYPE_S8] = LTTNG_UST_COMPOUND_LITERAL(const struct lttng_ust_event_field, {
.struct_size = sizeof(struct lttng_ust_event_field),
.name = "int8",
- .type = lttng_ust_type_integer_define(int8_t, BYTE_ORDER, 10),
+ .type = lttng_ust_type_integer_define(int8_t, LTTNG_UST_BYTE_ORDER, 10),
.nowrite = 0,
}),
[LTTNG_UST_DYNAMIC_TYPE_S16] = LTTNG_UST_COMPOUND_LITERAL(const struct lttng_ust_event_field, {
.struct_size = sizeof(struct lttng_ust_event_field),
.name = "int16",
- .type = lttng_ust_type_integer_define(int16_t, BYTE_ORDER, 10),
+ .type = lttng_ust_type_integer_define(int16_t, LTTNG_UST_BYTE_ORDER, 10),
.nowrite = 0,
}),
[LTTNG_UST_DYNAMIC_TYPE_S32] = LTTNG_UST_COMPOUND_LITERAL(const struct lttng_ust_event_field, {
.struct_size = sizeof(struct lttng_ust_event_field),
.name = "int32",
- .type = lttng_ust_type_integer_define(int32_t, BYTE_ORDER, 10),
+ .type = lttng_ust_type_integer_define(int32_t, LTTNG_UST_BYTE_ORDER, 10),
.nowrite = 0,
}),
[LTTNG_UST_DYNAMIC_TYPE_S64] = LTTNG_UST_COMPOUND_LITERAL(const struct lttng_ust_event_field, {
.struct_size = sizeof(struct lttng_ust_event_field),
.name = "int64",
- .type = lttng_ust_type_integer_define(int64_t, BYTE_ORDER, 10),
+ .type = lttng_ust_type_integer_define(int64_t, LTTNG_UST_BYTE_ORDER, 10),
.nowrite = 0,
}),
[LTTNG_UST_DYNAMIC_TYPE_U8] = LTTNG_UST_COMPOUND_LITERAL(const struct lttng_ust_event_field, {
.struct_size = sizeof(struct lttng_ust_event_field),
.name = "uint8",
- .type = lttng_ust_type_integer_define(uint8_t, BYTE_ORDER, 10),
+ .type = lttng_ust_type_integer_define(uint8_t, LTTNG_UST_BYTE_ORDER, 10),
.nowrite = 0,
}),
[LTTNG_UST_DYNAMIC_TYPE_U16] = LTTNG_UST_COMPOUND_LITERAL(const struct lttng_ust_event_field, {
.struct_size = sizeof(struct lttng_ust_event_field),
.name = "uint16",
- .type = lttng_ust_type_integer_define(uint16_t, BYTE_ORDER, 10),
+ .type = lttng_ust_type_integer_define(uint16_t, LTTNG_UST_BYTE_ORDER, 10),
.nowrite = 0,
}),
[LTTNG_UST_DYNAMIC_TYPE_U32] = LTTNG_UST_COMPOUND_LITERAL(const struct lttng_ust_event_field, {
.struct_size = sizeof(struct lttng_ust_event_field),
.name = "uint32",
- .type = lttng_ust_type_integer_define(uint32_t, BYTE_ORDER, 10),
+ .type = lttng_ust_type_integer_define(uint32_t, LTTNG_UST_BYTE_ORDER, 10),
.nowrite = 0,
}),
[LTTNG_UST_DYNAMIC_TYPE_U64] = LTTNG_UST_COMPOUND_LITERAL(const struct lttng_ust_event_field, {
.struct_size = sizeof(struct lttng_ust_event_field),
.name = "uint64",
- .type = lttng_ust_type_integer_define(uint64_t, BYTE_ORDER, 10),
+ .type = lttng_ust_type_integer_define(uint64_t, LTTNG_UST_BYTE_ORDER, 10),
.nowrite = 0,
}),
[LTTNG_UST_DYNAMIC_TYPE_FLOAT] = LTTNG_UST_COMPOUND_LITERAL(const struct lttng_ust_event_field, {
},
.struct_size = sizeof(struct lttng_ust_type_enum),
.desc = &dt_enum_desc,
- .container_type = lttng_ust_type_integer_define(char, BYTE_ORDER, 10),
+ .container_type = lttng_ust_type_integer_define(char, LTTNG_UST_BYTE_ORDER, 10),
}),
.nowrite = 0,
};