Build TRACEPOINT_EVENT integer type
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Wed, 10 Aug 2011 15:13:06 +0000 (11:13 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Wed, 10 Aug 2011 15:13:06 +0000 (11:13 -0400)
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
19 files changed:
include/Makefile.am
include/share.h [deleted file]
include/ust/lttng-events.h
include/ust/lttng-tracepoint-event.h
include/ust/share.h [new file with mode: 0644]
include/ust/usterr-signal-safe.h [new file with mode: 0644]
include/usterr_signal_safe.h [deleted file]
libringbuffer/frontend_types.h
libringbuffer/shm.h
libust/buffers.c
libust/ltt-context.c
libust/ltt-events.c
libust/ltt-ring-buffer-client.h
libust/ltt-tracer-core.h
libust/ltt-tracer.h
libust/lttng-ust-abi.c
libust/tracepoint.c
libust/ust-core.c
tests/hello/tp.h

index 9385364217c32ab2224ee45663259fdfefe27d98..856be021838b1122c09cd26e0bfbacd7de8cb7b3 100644 (file)
@@ -7,16 +7,19 @@ nobase_include_HEADERS = \
        ust/lttng-events.h \
        ust/version.h \
        ust/lttng-ust-abi.h \
-       ust/ringbuffer-abi.h
+       ust/ringbuffer-abi.h \
+       ust/lttng-tracer.h \
+       ust/usterr-signal-safe.h \
+       ust/core.h \
+       ust/share.h
+
+# note: usterr-signal-safe.h, core.h and share.h need namespace cleanup.
 
 noinst_HEADERS = \
-       share.h \
        usterr.h \
        ust_snprintf.h \
-       usterr_signal_safe.h \
        ust/compat.h \
        ust/config.h \
-       ust/core.h \
        ust/marker-internal.h \
        ust/tracepoint-internal.h \
        ust/clock.h \
diff --git a/include/share.h b/include/share.h
deleted file mode 100644 (file)
index 7bdeb5d..0000000
+++ /dev/null
@@ -1,81 +0,0 @@
-/* Copyright (C) 2009  Pierre-Marc Fournier
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA
- */
-
-#ifndef UST_SHARE_H
-#define UST_SHARE_H
-
-/* write() */
-#include <unistd.h>
-
-/* send() */
-#include <sys/types.h>
-#include <sys/socket.h>
-
-#include <errno.h>
-
-/* This write is patient because it restarts if it was incomplete.
- */
-
-static __inline__ ssize_t patient_write(int fd, const void *buf, size_t count)
-{
-       const char *bufc = (const char *) buf;
-       int result;
-
-       for(;;) {
-               result = write(fd, bufc, count);
-               if(result == -1 && errno == EINTR) {
-                       continue;
-               }
-               if(result <= 0) {
-                       return result;
-               }
-               count -= result;
-               bufc += result;
-
-               if(count == 0) {
-                       break;
-               }
-       }
-
-       return bufc-(const char *)buf;
-}
-
-static __inline__ ssize_t patient_send(int fd, const void *buf, size_t count, int flags)
-{
-       const char *bufc = (const char *) buf;
-       int result;
-
-       for(;;) {
-               result = send(fd, bufc, count, flags);
-               if(result == -1 && errno == EINTR) {
-                       continue;
-               }
-               if(result <= 0) {
-                       return result;
-               }
-               count -= result;
-               bufc += result;
-
-               if(count == 0) {
-                       break;
-               }
-       }
-
-       return bufc-(const char *)buf;
-}
-
-#endif /* UST_SHARE_H */
index 5ca156b7c74a81a025673aa6608fd2896c67f838..b15182c80f08357c08426f97acb223a788314e9c 100644 (file)
 #include <uuid/uuid.h>
 #include <stdint.h>
 #include <ust/lttng-ust-abi.h>
+#include <ust/lttng-tracer.h>
 #include <endian.h>
 #include <float.h>
 
-#undef is_signed_type
-#define is_signed_type(type)           (((type)(-1)) < 0)
-
 struct ltt_channel;
 struct ltt_session;
 struct lib_ring_buffer_ctx;
@@ -57,8 +55,8 @@ struct lttng_enum_entry {
            .u.basic.integer =                                  \
                {                                               \
                  .size = sizeof(_type) * CHAR_BIT,             \
-                 .alignment = ltt_alignof(_type) * CHAR_BIT,   \
-                 .signedness = is_signed_type(_type),          \
+                 .alignment = lttng_alignof(_type) * CHAR_BIT, \
+                 .signedness = lttng_is_signed_type(_type),    \
                  .reverse_byte_order = _byte_order != __BYTE_ORDER,    \
                  .base = _base,                                \
                  .encoding = lttng_encode_##_encoding,         \
@@ -88,8 +86,8 @@ struct lttng_integer_type {
                  .exp_dig = sizeof(_type) * CHAR_BIT           \
                                - _float_mant_dig(_type),       \
                  .mant_dig = _float_mant_dig(_type),           \
-                 .alignment = ltt_alignof(_type) * CHAR_BIT,   \
-                 .signedness = is_signed_type(_type),          \
+                 .alignment = lttng_alignof(_type) * CHAR_BIT, \
+                 .signedness = lttng_is_signed_type(_type),    \
                  .reverse_byte_order = __BYTE_ORDER != __FLOAT_WORD_ORDER, \
                },                                              \
        }                                                       \
index c006ffd365346e9e50133bf1bcc93178afd17b73..70d7c653263c0edc43ef1a69ea101a4cb3600855 100644 (file)
@@ -20,6 +20,7 @@
 #include <stdio.h>
 #include <urcu/compiler.h>
 #include <ust/lttng-events.h>
+#include <ust/usterr-signal-safe.h>
 #include <ust/ringbuffer-config.h>
 
 /*
 /* Helpers */
 #define _TP_ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
 
+#define _tp_max_t(type, x, y)                          \
+       ({                                              \
+               type __max1 = (x);                      \
+               type __max2 = (y);                      \
+               __max1 > __max2 ? __max1: __max2;       \
+       })
+
+
 /*
  * Stage 1 of the trace events.
  *
 
 #undef TRACEPOINT_EVENT_CLASS
 #define TRACEPOINT_EVENT_CLASS(_name, _proto, _args, _fields)               \
-       TRACEPOINT_EVENT_CLASS_NOARGS(_name, _fields)
+       TRACEPOINT_EVENT_CLASS_NOARGS(_name, TP_PARAMS(_fields))
 
 #include TRACEPOINT_INCLUDE(TRACEPOINT_INCLUDE_FILE)
 
@@ -261,25 +270,25 @@ static struct lttng_probe_desc TP_ID(__probe_desc___, TRACEPOINT_SYSTEM) = {
 
 #undef ctf_integer_ext
 #define ctf_integer_ext(_type, _item, _src, _byte_order, _base)                       \
-       __event_len += lib_ring_buffer_align(__event_len, ltt_alignof(_type)); \
+       __event_len += lib_ring_buffer_align(__event_len, lttng_alignof(_type)); \
        __event_len += sizeof(_type);
 
 #undef ctf_float
 #define ctf_float(_type, _item, _src)                                         \
-       __event_len += lib_ring_buffer_align(__event_len, ltt_alignof(_type)); \
+       __event_len += lib_ring_buffer_align(__event_len, lttng_alignof(_type)); \
        __event_len += sizeof(_type);
 
 #undef ctf_array_encoded
 #define ctf_array_encoded(_type, _item, _src, _length)                        \
-       __event_len += lib_ring_buffer_align(__event_len, ltt_alignof(_type)); \
+       __event_len += lib_ring_buffer_align(__event_len, lttng_alignof(_type)); \
        __event_len += sizeof(_type) * (_length);
 
 #undef ctf_sequence_encoded
 #define ctf_sequence_encoded(_type, _item, _src, _length_type, \
                        _src_length, _encoding)                 \
-       __event_len += lib_ring_buffer_align(__event_len, ltt_alignof(_length_type));   \
+       __event_len += lib_ring_buffer_align(__event_len, lttng_alignof(_length_type));   \
        __event_len += sizeof(_length_type);                                   \
-       __event_len += lib_ring_buffer_align(__event_len, ltt_alignof(_type)); \
+       __event_len += lib_ring_buffer_align(__event_len, lttng_alignof(_type)); \
        __dynamic_len[__dynamic_len_idx] = (_length);                          \
        __event_len += sizeof(_type) * __dynamic_len[__dynamic_len_idx];       \
        __dynamic_len_idx++;
@@ -335,21 +344,21 @@ static inline size_t __event_get_size__##_name(size_t *__dynamic_len)           \
 
 #undef ctf_integer_ext
 #define ctf_integer_ext(_type, _item, _src, _byte_order, _base)                       \
-       __event_align = max_t(size_t, __event_align, ltt_alignof(_type));
+       __event_align = _tp_max_t(size_t, __event_align, lttng_alignof(_type));
 
 #undef ctf_float
 #define ctf_float(_type, _item, _src)                                         \
-       __event_align = max_t(size_t, __event_align, ltt_alignof(_type));
+       __event_align = _tp_max_t(size_t, __event_align, lttng_alignof(_type));
 
 #undef ctf_array_encoded
 #define ctf_array_encoded(_type, _item, _src, _length)                        \
-       __event_align = max_t(size_t, __event_align, ltt_alignof(_type));
+       __event_align = _tp_max_t(size_t, __event_align, lttng_alignof(_type));
 
 #undef ctf_sequence_encoded
 #define ctf_sequence_encoded(_type, _item, _src, _length_type, \
                        _src_length, _encoding)                 \
-       __event_align = max_t(size_t, __event_align, ltt_alignof(_length_type));          \
-       __event_align = max_t(size_t, __event_align, ltt_alignof(_type));
+       __event_align = _tp_max_t(size_t, __event_align, lttng_alignof(_length_type));    \
+       __event_align = _tp_max_t(size_t, __event_align, lttng_alignof(_type));
 
 #undef ctf_string
 #define ctf_string(_item, _src)
@@ -399,7 +408,7 @@ static inline size_t __event_get_align__##_name(void)                             \
 #define ctf_integer_ext(_type, _item, _src, _byte_order, _base)                \
        {                                                               \
                _type __tmp = (_src);                                   \
-               lib_ring_buffer_align_ctx(&ctx, ltt_alignof(__tmp));    \
+               lib_ring_buffer_align_ctx(&ctx, lttng_alignof(__tmp));  \
                __chan->ops->event_write(&ctx, &__tmp, sizeof(__tmp));  \
        }
 
@@ -407,13 +416,13 @@ static inline size_t __event_get_align__##_name(void)                           \
 #define ctf_float(_type, _item, _src)                                  \
        {                                                               \
                _type __tmp = (_src);                                   \
-               lib_ring_buffer_align_ctx(&ctx, ltt_alignof(__tmp));    \
+               lib_ring_buffer_align_ctx(&ctx, lttng_alignof(__tmp));  \
                __chan->ops->event_write(&ctx, &__tmp, sizeof(__tmp));  \
        }
 
 #undef ctf_array_encoded
 #define ctf_array_encoded(_type, _item, _src, _length)                 \
-       lib_ring_buffer_align_ctx(&ctx, ltt_alignof(_type));            \
+       lib_ring_buffer_align_ctx(&ctx, lttng_alignof(_type));          \
        __chan->ops->event_write(&ctx, _src, _length);
 
 #undef ctf_sequence_encoded
@@ -421,10 +430,10 @@ static inline size_t __event_get_align__##_name(void)                           \
                        _src_length, _encoding)                 \
        {                                                               \
                _length_type __tmpl = __dynamic_len[__dynamic_len_idx]; \
-               lib_ring_buffer_align_ctx(&ctx, ltt_alignof(_length_type));    \
+               lib_ring_buffer_align_ctx(&ctx, lttng_alignof(_length_type));    \
                __chan->ops->event_write(&ctx, &__tmpl, sizeof(_length_type)); \
        }                                                               \
-       lib_ring_buffer_align_ctx(&ctx, ltt_alignof(_type));            \
+       lib_ring_buffer_align_ctx(&ctx, lttng_alignof(_type));          \
        __chan->ops->event_write(&ctx, _src,                            \
                sizeof(_type) * __get_sequence_len(dest));
 
diff --git a/include/ust/share.h b/include/ust/share.h
new file mode 100644 (file)
index 0000000..7bdeb5d
--- /dev/null
@@ -0,0 +1,81 @@
+/* Copyright (C) 2009  Pierre-Marc Fournier
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA
+ */
+
+#ifndef UST_SHARE_H
+#define UST_SHARE_H
+
+/* write() */
+#include <unistd.h>
+
+/* send() */
+#include <sys/types.h>
+#include <sys/socket.h>
+
+#include <errno.h>
+
+/* This write is patient because it restarts if it was incomplete.
+ */
+
+static __inline__ ssize_t patient_write(int fd, const void *buf, size_t count)
+{
+       const char *bufc = (const char *) buf;
+       int result;
+
+       for(;;) {
+               result = write(fd, bufc, count);
+               if(result == -1 && errno == EINTR) {
+                       continue;
+               }
+               if(result <= 0) {
+                       return result;
+               }
+               count -= result;
+               bufc += result;
+
+               if(count == 0) {
+                       break;
+               }
+       }
+
+       return bufc-(const char *)buf;
+}
+
+static __inline__ ssize_t patient_send(int fd, const void *buf, size_t count, int flags)
+{
+       const char *bufc = (const char *) buf;
+       int result;
+
+       for(;;) {
+               result = send(fd, bufc, count, flags);
+               if(result == -1 && errno == EINTR) {
+                       continue;
+               }
+               if(result <= 0) {
+                       return result;
+               }
+               count -= result;
+               bufc += result;
+
+               if(count == 0) {
+                       break;
+               }
+       }
+
+       return bufc-(const char *)buf;
+}
+
+#endif /* UST_SHARE_H */
diff --git a/include/ust/usterr-signal-safe.h b/include/ust/usterr-signal-safe.h
new file mode 100644 (file)
index 0000000..483e7f5
--- /dev/null
@@ -0,0 +1,158 @@
+#ifndef _USTERR_SIGNAL_SAFE_H
+#define _USTERR_SIGNAL_SAFE_H
+
+/*
+ * Copyright (C) 2009  Pierre-Marc Fournier
+ * Copyright (C) 2011  Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; version 2.1 of
+ * the License.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA
+ */
+
+#include <string.h>
+#include <sys/types.h>
+#include <sys/syscall.h>
+#include <errno.h>
+#include <stdarg.h>
+#include <stdio.h>
+
+#include <ust/core.h>
+
+#include <ust/share.h>
+
+enum ust_loglevel {
+       UST_LOGLEVEL_UNKNOWN = 0,
+       UST_LOGLEVEL_NORMAL,
+       UST_LOGLEVEL_DEBUG,
+};
+
+extern volatile enum ust_loglevel ust_loglevel;
+void init_usterr(void);
+
+static inline int ust_debug(void)
+{
+       return ust_loglevel == UST_LOGLEVEL_DEBUG;
+}
+
+#ifndef UST_COMPONENT
+//#error UST_COMPONENT is undefined
+#define UST_COMPONENT libust
+#endif
+
+/* To stringify the expansion of a define */
+#define UST_XSTR(d) UST_STR(d)
+#define UST_STR(s) #s
+
+/* We sometimes print in the tracing path, and tracing can occur in
+ * signal handlers, so we must use a print method which is signal safe.
+ */
+
+extern int ust_safe_snprintf(char *str, size_t n, const char *fmt, ...)
+       __attribute__ ((format (printf, 3, 4)));
+
+static inline void __attribute__ ((format (printf, 1, 2)))
+       __check_ust_safe_fmt(const char *fmt, ...)
+{
+}
+
+#define sigsafe_print_err(fmt, args...)                                        \
+{                                                                      \
+       /* Can't use dynamic allocation. Limit ourselves to 250 chars. */ \
+       char ____buf[250];                                              \
+       int ____saved_errno;                                            \
+                                                                       \
+       /* Save the errno. */                                           \
+       ____saved_errno = errno;                                        \
+                                                                       \
+       ust_safe_snprintf(____buf, sizeof(____buf), fmt, ## args);      \
+                                                                       \
+       /* Add end of string in case of buffer overflow. */             \
+       ____buf[sizeof(____buf) - 1] = 0;                               \
+                                                                       \
+       patient_write(STDERR_FILENO, ____buf, strlen(____buf));         \
+       /*                                                              \
+        * Can't print errors because we are in the error printing code \
+        * path.                                                        \
+        */                                                             \
+                                                                       \
+       /* Restore errno, in order to be async-signal safe. */          \
+       errno = ____saved_errno;                                        \
+}
+
+#define UST_STR_COMPONENT UST_XSTR(UST_COMPONENT)
+
+#define ERRMSG(fmt, args...)                   \
+       do {                                    \
+               sigsafe_print_err(UST_STR_COMPONENT "[%ld/%ld]: " fmt " (in %s() at " __FILE__ ":" UST_XSTR(__LINE__) ")\n",    \
+               (long) getpid(),                \
+               (long) syscall(SYS_gettid),     \
+               ## args, __func__);             \
+               fflush(stderr);                 \
+       } while(0)
+
+#ifdef UST_DEBUG
+# define DBG(fmt, args...)                     ERRMSG(fmt, ## args)
+# define DBG_raw(fmt, args...)                                 \
+       do {                                                    \
+               sigsafe_print_err(fmt, ## args);                \
+               fflush(stderr);                                 \
+       } while(0)
+#else
+# define DBG(fmt, args...)                                     \
+       do {                                                    \
+               if (ust_debug())                                \
+                       ERRMSG(fmt, ## args);                   \
+       } while (0)
+# define DBG_raw(fmt, args...)                                 \
+       do {                                                    \
+               if (ust_debug()) {                              \
+                       sigsafe_print_err(fmt, ## args);        \
+                       fflush(stderr);                         \
+               }                                               \
+       } while(0)
+#endif
+#define WARN(fmt, args...) ERRMSG("Warning: " fmt, ## args)
+#define ERR(fmt, args...) ERRMSG("Error: " fmt, ## args)
+#define BUG(fmt, args...) ERRMSG("BUG: " fmt, ## args)
+
+#if (_POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600) && !defined(_GNU_SOURCE)
+#define PERROR(call, args...)\
+       do { \
+               char buf[200] = "Error in strerror_r()"; \
+               strerror_r(errno, buf, sizeof(buf)); \
+               ERRMSG("Error: " call ": %s", ## args, buf); \
+       } while(0);
+#else
+#define PERROR(call, args...)\
+       do { \
+               char *buf; \
+               char tmp[200]; \
+               buf = strerror_r(errno, tmp, sizeof(tmp)); \
+               ERRMSG("Error: " call ": %s", ## args, buf); \
+       } while(0);
+#endif
+
+#define BUG_ON(condition)                                      \
+       do {                                                    \
+               if (unlikely(condition))                        \
+                       ERR("condition not respected (BUG) on line %s:%d", __FILE__, __LINE__); \
+       } while(0)
+#define WARN_ON(condition)                                     \
+       do {                                                    \
+               if (unlikely(condition))                        \
+                       WARN("condition not respected on line %s:%d", __FILE__, __LINE__); \
+       } while(0)
+#define WARN_ON_ONCE(condition) WARN_ON(condition)
+
+#endif /* _USTERR_SIGNAL_SAFE_H */
diff --git a/include/usterr_signal_safe.h b/include/usterr_signal_safe.h
deleted file mode 100644 (file)
index 77f9d5f..0000000
+++ /dev/null
@@ -1,159 +0,0 @@
-#ifndef _USTERR_SIGNAL_SAFE_H
-#define _USTERR_SIGNAL_SAFE_H
-
-/*
- * Copyright (C) 2009  Pierre-Marc Fournier
- * Copyright (C) 2011  Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; version 2.1 of
- * the License.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA
- */
-
-#include <string.h>
-#include <sys/types.h>
-#include <sys/syscall.h>
-#include <errno.h>
-#include <stdarg.h>
-#include <stdio.h>
-
-#include <ust/core.h>
-
-#include "share.h"
-
-enum ust_loglevel {
-       UST_LOGLEVEL_UNKNOWN = 0,
-       UST_LOGLEVEL_NORMAL,
-       UST_LOGLEVEL_DEBUG,
-};
-
-extern volatile enum ust_loglevel ust_loglevel;
-void init_usterr(void);
-
-static inline int ust_debug(void)
-{
-       return ust_loglevel == UST_LOGLEVEL_DEBUG;
-}
-
-#ifndef UST_COMPONENT
-//#error UST_COMPONENT is undefined
-#define UST_COMPONENT libust
-#endif
-
-/* To stringify the expansion of a define */
-#define XSTR(d) STR(d)
-#define STR(s) #s
-
-/* We sometimes print in the tracing path, and tracing can occur in
- * signal handlers, so we must use a print method which is signal safe.
- */
-
-extern int ust_safe_snprintf(char *str, size_t n, const char *fmt, ...)
-       __attribute__ ((format (printf, 3, 4)));
-
-static inline void __attribute__ ((format (printf, 1, 2)))
-       __check_ust_safe_fmt(const char *fmt, ...)
-{
-}
-
-#define sigsafe_print_err(fmt, args...)                                        \
-{                                                                      \
-       /* Can't use dynamic allocation. Limit ourselves to 250 chars. */ \
-       char ____buf[250];                                              \
-       int ____saved_errno;                                            \
-                                                                       \
-       /* Save the errno. */                                           \
-       ____saved_errno = errno;                                        \
-                                                                       \
-       ust_safe_snprintf(____buf, sizeof(____buf), fmt, ## args);      \
-                                                                       \
-       /* Add end of string in case of buffer overflow. */             \
-       ____buf[sizeof(____buf) - 1] = 0;                               \
-                                                                       \
-       patient_write(STDERR_FILENO, ____buf, strlen(____buf));         \
-       /*                                                              \
-        * Can't print errors because we are in the error printing code \
-        * path.                                                        \
-        */                                                             \
-                                                                       \
-       /* Restore errno, in order to be async-signal safe. */          \
-       errno = ____saved_errno;                                        \
-}
-
-#define UST_STR_COMPONENT XSTR(UST_COMPONENT)
-
-#define ERRMSG(fmt, args...)                   \
-       do {                                    \
-               sigsafe_print_err(UST_STR_COMPONENT "[%ld/%ld]: " fmt " (in %s() at " __FILE__ ":" XSTR(__LINE__) ")\n",        \
-               (long) getpid(),                \
-               (long) syscall(SYS_gettid),     \
-               ## args, __func__);             \
-               fflush(stderr);                 \
-       } while(0)
-
-#ifdef UST_DEBUG
-# define DBG(fmt, args...)                     ERRMSG(fmt, ## args)
-# define DBG_raw(fmt, args...)                                 \
-       do {                                                    \
-               sigsafe_print_err(fmt, ## args);                \
-               fflush(stderr);                                 \
-       } while(0)
-#else
-# define DBG(fmt, args...)                                     \
-       do {                                                    \
-               if (ust_debug())                                \
-                       ERRMSG(fmt, ## args);                   \
-       } while (0)
-# define DBG_raw(fmt, args...)                                 \
-       do {                                                    \
-               if (ust_debug()) {                              \
-                       sigsafe_print_err(fmt, ## args);        \
-                       fflush(stderr);                         \
-               }                                               \
-       } while(0)
-#endif
-#define WARN(fmt, args...) ERRMSG("Warning: " fmt, ## args)
-#define ERR(fmt, args...) ERRMSG("Error: " fmt, ## args)
-#define BUG(fmt, args...) ERRMSG("BUG: " fmt, ## args)
-
-#if (_POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600) && !defined(_GNU_SOURCE)
-#define PERROR(call, args...)\
-       do { \
-               char buf[200] = "Error in strerror_r()"; \
-               strerror_r(errno, buf, sizeof(buf)); \
-               ERRMSG("Error: " call ": %s", ## args, buf); \
-       } while(0);
-#else
-#define PERROR(call, args...)\
-       do { \
-               char *buf; \
-               char tmp[200]; \
-               buf = strerror_r(errno, tmp, sizeof(tmp)); \
-               ERRMSG("Error: " call ": %s", ## args, buf); \
-       } while(0);
-#endif
-
-#define BUG_ON(condition)                                      \
-       do {                                                    \
-               if (unlikely(condition))                        \
-                       ERR("condition not respected (BUG) on line %s:%d", __FILE__, __LINE__); \
-       } while(0)
-#define WARN_ON(condition)                                     \
-       do {                                                    \
-               if (unlikely(condition))                        \
-                       WARN("condition not respected on line %s:%d", __FILE__, __LINE__); \
-       } while(0)
-#define WARN_ON_ONCE(condition) WARN_ON(condition)
-
-
-#endif /* _USTERR_SIGNAL_SAFE_H */
index 59611f2fc4f5d9feb359d53af9144fbfb1688c66..28179dfc58b8ebc31c75b65115127d9fa73e79a3 100644 (file)
@@ -23,7 +23,7 @@
 
 #include "ust/core.h"
 
-#include "usterr_signal_safe.h"
+#include <ust/usterr-signal-safe.h>
 #include <ust/ringbuffer-config.h>
 #include "backend_types.h"
 #include "shm.h"
index 4e9ced198755809cdf63f8140180eeecfb4ff5bd..71624e3999a3974ec4b11ea4c2c5045bc29dbaf1 100644 (file)
@@ -10,8 +10,8 @@
  */
 
 #include <stdint.h>
+#include <ust/usterr-signal-safe.h>
 #include "ust/core.h"
-#include "usterr_signal_safe.h"
 
 #define SHM_MAGIC      0x54335433
 #define SHM_MAJOR      0
index c4eddb068cdb72d0ba4855b1eafcbd350c91913b..5e67d544d13104877808ad21a62ae44669562e86 100644 (file)
@@ -40,7 +40,7 @@
 #include "channels.h"
 #include "tracer.h"
 #include "tracercore.h"
-#include "usterr_signal_safe.h"
+#include <ust/usterr-signal-safe.h>
 
 struct ltt_reserve_switch_offsets {
        long begin, end, old;
index fc0eb7ef2ed25f8fd3372a522cc63da190b595a0..83aa297592929d9d900cb52940fd25974e62ae03 100644 (file)
@@ -11,7 +11,7 @@
 #include <ust/lttng-events.h>
 #include <ust/core.h>
 #include <string.h>
-#include <usterr_signal_safe.h>
+#include <ust/usterr-signal-safe.h>
 
 /*
  * Note: as we append context information, the pointer location may change.
index e4ffc69a32474b9fdd45331e893770ee399ba5b7..ece959b3e88c8237f0bf542fb50cf7f57871b5e6 100644 (file)
@@ -21,7 +21,7 @@
 #include <sys/shm.h>
 #include <sys/ipc.h>
 #include <ust/lttng-events.h>
-#include "usterr_signal_safe.h"
+#include <ust/usterr-signal-safe.h>
 #include "ust/core.h"
 #include "ltt-tracer.h"
 #include "ust/wait.h"
@@ -753,8 +753,8 @@ int _ltt_event_header_declare(struct ltt_session *session)
        "               } extended;\n"
        "       } v;\n"
        "} align(%u);\n\n",
-       ltt_alignof(uint32_t) * CHAR_BIT,
-       ltt_alignof(uint16_t) * CHAR_BIT
+       lttng_alignof(uint32_t) * CHAR_BIT,
+       lttng_alignof(uint16_t) * CHAR_BIT
        );
 }
 
@@ -805,10 +805,10 @@ int _ltt_session_metadata_statedump(struct ltt_session *session)
                "               uint32_t stream_id;\n"
                "       };\n"
                "};\n\n",
-               ltt_alignof(uint8_t) * CHAR_BIT,
-               ltt_alignof(uint16_t) * CHAR_BIT,
-               ltt_alignof(uint32_t) * CHAR_BIT,
-               ltt_alignof(uint64_t) * CHAR_BIT,
+               lttng_alignof(uint8_t) * CHAR_BIT,
+               lttng_alignof(uint16_t) * CHAR_BIT,
+               lttng_alignof(uint32_t) * CHAR_BIT,
+               lttng_alignof(uint64_t) * CHAR_BIT,
                CTF_VERSION_MAJOR,
                CTF_VERSION_MINOR,
                uuid_s,
index 2a187c71454474d0b43ee224b4330e86b9923010..dce34aa24597d35548069aa03e582cd2bbabf34b 100644 (file)
@@ -105,7 +105,7 @@ unsigned char record_header_size(const struct lib_ring_buffer_config *config,
 
        switch (ltt_chan->header_type) {
        case 1: /* compact */
-               padding = lib_ring_buffer_align(offset, ltt_alignof(uint32_t));
+               padding = lib_ring_buffer_align(offset, lttng_alignof(uint32_t));
                offset += padding;
                if (!(ctx->rflags & (RING_BUFFER_RFLAG_FULL_TSC | LTT_RFLAG_EXTENDED))) {
                        offset += sizeof(uint32_t);     /* id and timestamp */
@@ -113,24 +113,24 @@ unsigned char record_header_size(const struct lib_ring_buffer_config *config,
                        /* Minimum space taken by 5-bit id */
                        offset += sizeof(uint8_t);
                        /* Align extended struct on largest member */
-                       offset += lib_ring_buffer_align(offset, ltt_alignof(uint64_t));
+                       offset += lib_ring_buffer_align(offset, lttng_alignof(uint64_t));
                        offset += sizeof(uint32_t);     /* id */
-                       offset += lib_ring_buffer_align(offset, ltt_alignof(uint64_t));
+                       offset += lib_ring_buffer_align(offset, lttng_alignof(uint64_t));
                        offset += sizeof(uint64_t);     /* timestamp */
                }
                break;
        case 2: /* large */
-               padding = lib_ring_buffer_align(offset, ltt_alignof(uint16_t));
+               padding = lib_ring_buffer_align(offset, lttng_alignof(uint16_t));
                offset += padding;
                offset += sizeof(uint16_t);
                if (!(ctx->rflags & (RING_BUFFER_RFLAG_FULL_TSC | LTT_RFLAG_EXTENDED))) {
-                       offset += lib_ring_buffer_align(offset, ltt_alignof(uint32_t));
+                       offset += lib_ring_buffer_align(offset, lttng_alignof(uint32_t));
                        offset += sizeof(uint32_t);     /* timestamp */
                } else {
                        /* Align extended struct on largest member */
-                       offset += lib_ring_buffer_align(offset, ltt_alignof(uint64_t));
+                       offset += lib_ring_buffer_align(offset, lttng_alignof(uint64_t));
                        offset += sizeof(uint32_t);     /* id */
-                       offset += lib_ring_buffer_align(offset, ltt_alignof(uint64_t));
+                       offset += lib_ring_buffer_align(offset, lttng_alignof(uint64_t));
                        offset += sizeof(uint64_t);     /* timestamp */
                }
                break;
@@ -188,7 +188,7 @@ void ltt_write_event_header(const struct lib_ring_buffer_config *config,
                uint16_t id = event_id;
 
                lib_ring_buffer_write(config, ctx, &id, sizeof(id));
-               lib_ring_buffer_align_ctx(ctx, ltt_alignof(uint32_t));
+               lib_ring_buffer_align_ctx(ctx, lttng_alignof(uint32_t));
                lib_ring_buffer_write(config, ctx, &timestamp, sizeof(timestamp));
                break;
        }
@@ -228,9 +228,9 @@ void ltt_write_event_header_slow(const struct lib_ring_buffer_config *config,
                        bt_bitfield_write(&id, uint8_t, 0, 5, 31);
                        lib_ring_buffer_write(config, ctx, &id, sizeof(id));
                        /* Align extended struct on largest member */
-                       lib_ring_buffer_align_ctx(ctx, ltt_alignof(uint64_t));
+                       lib_ring_buffer_align_ctx(ctx, lttng_alignof(uint64_t));
                        lib_ring_buffer_write(config, ctx, &event_id, sizeof(event_id));
-                       lib_ring_buffer_align_ctx(ctx, ltt_alignof(uint64_t));
+                       lib_ring_buffer_align_ctx(ctx, lttng_alignof(uint64_t));
                        lib_ring_buffer_write(config, ctx, &timestamp, sizeof(timestamp));
                }
                break;
@@ -241,7 +241,7 @@ void ltt_write_event_header_slow(const struct lib_ring_buffer_config *config,
                        uint16_t id = event_id;
 
                        lib_ring_buffer_write(config, ctx, &id, sizeof(id));
-                       lib_ring_buffer_align_ctx(ctx, ltt_alignof(uint32_t));
+                       lib_ring_buffer_align_ctx(ctx, lttng_alignof(uint32_t));
                        lib_ring_buffer_write(config, ctx, &timestamp, sizeof(timestamp));
                } else {
                        uint16_t id = 65535;
@@ -249,9 +249,9 @@ void ltt_write_event_header_slow(const struct lib_ring_buffer_config *config,
 
                        lib_ring_buffer_write(config, ctx, &id, sizeof(id));
                        /* Align extended struct on largest member */
-                       lib_ring_buffer_align_ctx(ctx, ltt_alignof(uint64_t));
+                       lib_ring_buffer_align_ctx(ctx, lttng_alignof(uint64_t));
                        lib_ring_buffer_write(config, ctx, &event_id, sizeof(event_id));
-                       lib_ring_buffer_align_ctx(ctx, ltt_alignof(uint64_t));
+                       lib_ring_buffer_align_ctx(ctx, lttng_alignof(uint64_t));
                        lib_ring_buffer_write(config, ctx, &timestamp, sizeof(timestamp));
                }
                break;
index abab1734a13207234a0c0eaf1fc4f7129437a61c..c793682770f7f3df1ffdc4a747c35ee20bb29d63 100644 (file)
 
 #include <ust/kcompat/kcompat.h>
 #include <ust/core.h>
+#include <ust/lttng-tracer.h>
 #include <urcu/list.h>
-
-#ifndef CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS
-/* Align data on its natural alignment */
-#define RING_BUFFER_ALIGN
-#endif
-
-#include "usterr_signal_safe.h"
+#include <ust/usterr-signal-safe.h>
 #include "ust/bug.h"
+
 #include <ust/ringbuffer-config.h>
 
 struct ltt_session;
index a79c5f76ed2c78c498f2034cb4e69bde4df6fd3c..f77683937e28b088fcc941d14a33660fc50cda94 100644 (file)
 #include <ust/lttng-events.h>
 #include "ltt-tracer-core.h"
 
-#define LTTNG_UST_VERSION 0
-#define LTTNG_UST_PATCHLEVEL 9
-#define LTTNG_UST_SUBLEVEL 1
-
-#ifndef CHAR_BIT
-#define CHAR_BIT 8
-#endif
-
 /* Number of bytes to log with a read/write event */
 #define LTT_LOG_RW_SIZE                        32L
 #define LTT_MAX_SMALL_SIZE             0xFFFFU
 
-#ifdef RING_BUFFER_ALIGN
-#define ltt_alignof(type)      __alignof__(type)
-#else
-#define ltt_alignof(type)      1
-#endif
-
 /* Tracer properties */
 #define CTF_MAGIC_NUMBER               0xC1FC1FC1
 #define TSDL_MAGIC_NUMBER              0x75D11D57
index ad582c055bb1f31e036612f8a45a9af60eaeffdc..3674dcc37dbab278a809d2b633e15596b2dea545 100644 (file)
@@ -28,7 +28,7 @@
 #include <urcu/compiler.h>
 #include <urcu/list.h>
 #include <ust/lttng-events.h>
-#include "usterr_signal_safe.h"
+#include <ust/usterr-signal-safe.h>
 #include "ust/core.h"
 #include "ltt-tracer.h"
 
index 67619a85d8e36933af87d57035fb3671452fe406..6eb40ea29d46879a303c1dfe1d0107501cf06db1 100644 (file)
@@ -28,7 +28,7 @@
 #include <urcu-bp.h>
 #include <urcu/hlist.h>
 
-#include "usterr_signal_safe.h"
+#include <ust/usterr-signal-safe.h>
 
 extern struct tracepoint * const __start___tracepoints_ptrs[]
        __attribute__((visibility("hidden")));
index 7791ffb0a9fef66f542e9397ea8895154bae8076..cb87b745efbb4aaad93c083d65897bd1da074c2a 100644 (file)
@@ -18,7 +18,7 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
-#include <usterr_signal_safe.h>
+#include <ust/usterr-signal-safe.h>
 #include <stdlib.h>
 
 volatile enum ust_loglevel ust_loglevel;
index 606f0f1392eaf9bd0cb4ab92fe80495b7be778e3..7fa16e904c835ac5145d4e8d4aed459e7786bb6a 100644 (file)
 #include <ust/tracepoint.h>
 
 TRACEPOINT_EVENT(ust_tests_hello_tptest,
-                TP_PROTO(int anint),
-                TP_ARGS(anint),
-                TP_FIELDS())
+                       TP_PROTO(int anint),
+                       TP_ARGS(anint),
+                       TP_FIELDS(
+                               ctf_integer(int, intfield, anint)
+                       ))
 
 TRACEPOINT_EVENT_NOARGS(ust_tests_hello_tptest_sighandler,
                        TP_FIELDS())
This page took 0.041228 seconds and 4 git commands to generate.