+#ifndef container_of
+#define container_of(ptr, type, member) \
+ ({ \
+ const typeof(((type *)NULL)->member) * __ptr = (ptr); \
+ (type *)((char *)__ptr - offsetof(type, member)); \
+ })
+#endif
+
+
+/*
+ * The min and max macros are not needed in C++ (std::min and std::max are
+ * preferred) and they conflict with some C++ header file. Don't define them
+ * when compiling C++ source.
+ */
+#ifndef __cplusplus
+
+# ifndef max
+# define max(a, b) ((a) > (b) ? (a) : (b))
+# endif
+
+# ifndef min
+# define min(a, b) ((a) < (b) ? (a) : (b))
+# endif
+
+# ifndef max_t
+# define max_t(type, a, b) max((type) a, (type) b)
+# endif
+
+# ifndef min_t
+# define min_t(type, a, b) min((type) a, (type) b)
+# endif
+
+#endif
+
+#ifndef LTTNG_PACKED
+#define LTTNG_PACKED __attribute__((__packed__))
+#endif
+
+#ifndef LTTNG_NO_SANITIZE_ADDRESS
+#if defined(__clang__) || defined (__GNUC__)
+#define LTTNG_NO_SANITIZE_ADDRESS __attribute__((no_sanitize_address))
+#else
+#define LTTNG_NO_SANITIZE_ADDRESS