More compile fixes
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Thu, 17 Nov 2011 23:39:02 +0000 (18:39 -0500)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Thu, 17 Nov 2011 23:39:02 +0000 (18:39 -0500)
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
configure.ac
include/lttng/tracepoint-types.h
include/lttng/tracepoint.h
include/lttng/ust-events.h
liblttng-ust/ltt-events.c
liblttng-ust/ltt-ring-buffer-client.h
liblttng-ust/ltt-ring-buffer-metadata-client.h
liblttng-ust/lttng-ust-abi.c
liblttng-ust/lttng-ust-comm.c
liblttng-ust/tracepoint-internal.h
liblttng-ust/tracepoint.c

index c32c835d95404fff0d047af9cd976ccbab327ff0..d3cac78f9954b23a1af7353abd9197a8909ef5d5 100644 (file)
@@ -11,10 +11,12 @@ m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
 AC_CONFIG_SRCDIR([include/lttng/tracepoint.h])
 AC_CONFIG_HEADERS([config.h include/lttng/config.h])
 AH_TEMPLATE([HAVE_EFFICIENT_UNALIGNED_ACCESS], [Use efficient unaligned access.])
+
 # Compute minor/major/patchlevel version numbers
-major_version=$(echo AC_PACKAGE_VERSION | sed 's/\([^.]\)*\.\([^.]*\)\.\([^.]*\)/\1/)')
-minor_version=$(echo AC_PACKAGE_VERSION | sed 's/\([^.]\)*\.\([^.]*\)\.\([^.]*\)/\2/)')
-patchlevel_version=$(echo AC_PACKAGE_VERSION | sed 's/\([^.]\)*\.\([^.]*\)\.\([^.]*\)/\3/)')
+AC_PROG_SED
+major_version=$(echo AC_PACKAGE_VERSION | sed 's/^\([[0-9]]\)*\.[[0-9]]*\.[[0-9]]*$/\1/')
+minor_version=$(echo AC_PACKAGE_VERSION | sed 's/^[[0-9]]*\.\([[0-9]]*\)\.[[0-9]]*$/\1/')
+patchlevel_version=$(echo AC_PACKAGE_VERSION | sed 's/^[[0-9]]*\.[[0-9]]*\.\([[0-9]]*\)$/\1/')
 AC_SUBST([MAJOR_VERSION], [$major_version])
 AC_SUBST([MINOR_VERSION], [$minor_version])
 AC_SUBST([PATCHLEVEL_VERSION], [$patchlevel_version])
index fad23bc488924ed2929730b118c0c17f2a57e67d..b6353c80a3827130e0e74c48db099e7461e88673 100644 (file)
@@ -15,8 +15,8 @@
  */
 
 struct tracepoint_probe {
-       void *callback;
-       void *priv;
+       void *func;
+       void *data;
 };
 
 struct tracepoint {
@@ -25,10 +25,4 @@ struct tracepoint {
        struct tracepoint_probe *probes;
 };
 
-struct tracepoint_lib {
-       struct cds_list_head list;
-       struct tracepoint tracepoints_start;
-       int tracepoints_count;
-};
-
 #endif /* _LTTNG_TRACEPOINT_TYPES_H */
index 86abd1a5b2514284957a27be0430262dca4e20f4..e177b87d8cfcf119c1b9ba81c67ea25d5a74088a 100644 (file)
 extern "C" {
 #endif
 
-#define tracepoint(provider, name, ...)                                          \
-       do {                                                              \
-               if (caa_unlikely(__tracepoint_##provider##_##name.state)) \
-                       __tracepoint_##provider##_##name(__VA_ARGS__);    \
+#define tracepoint(provider, name, ...)                                            \
+       do {                                                                \
+               if (caa_unlikely(__tracepoint_##provider##___##name.state)) \
+                       __tracepoint_cb_##provider##___##name(__VA_ARGS__); \
        } while (0)
 
 #define TP_ARGS(...)       __VA_ARGS__
@@ -39,7 +39,7 @@ extern "C" {
 #define _TP_COMBINE_TOKENS1(_tokena, _tokenb)       _tokena##_tokenb
 #define _TP_COMBINE_TOKENS(_tokena, _tokenb)        _TP_COMBINE_TOKENS1(_tokena, _tokenb)
 
-/* _TP_EXVAR* extract the vars names. */
+/* _TP_EXVAR* extract the var names. */
 #define _TP_EXVAR0()
 #define _TP_EXVAR2(a,b)                                                b
 #define _TP_EXVAR4(a,b,c,d)                                    b,d
@@ -92,44 +92,45 @@ extern "C" {
 /* Preprocessor trick to count arguments. Inspired from sdt.h. */
 #define _TP_NARGS(...)                 __TP_NARGS(__VA_ARGS__, 20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0)
 #define __TP_NARGS(_0,_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13,_14,_15,_16,_17,_18,_19,_20, N, ...)  N
-#define _TP_PROTO_N(N, ...)            _TP_PARAMS(TP_COMBINE_TOKENS(_TP_SPLIT, N)(__VA_ARGS__))
-#define _TP_VARS_N(N, ...)             _TP_PARAMS(TP_COMBINE_TOKENS(_TP_EVEN, N)(__VA_ARGS__))
-#define _TP_DATA_PROTO_N(N, ...)       _TP_PARAMS(TP_COMBINE_TOKENS(_TP_SPLIT_DATA, N)(__VA_ARGS__))
-#define _TP_DATA_VARS_N(N, ...)                _TP_PARAMS(TP_COMBINE_TOKENS(_TP_EVEN_DATA, N)(__VA_ARGS__))
+#define _TP_PROTO_N(N, ...)            _TP_PARAMS(_TP_COMBINE_TOKENS(_TP_EXPROTO, N)(__VA_ARGS__))
+#define _TP_VAR_N(N, ...)              _TP_PARAMS(_TP_COMBINE_TOKENS(_TP_EXVAR, N)(__VA_ARGS__))
+#define _TP_DATA_PROTO_N(N, ...)       _TP_PARAMS(_TP_COMBINE_TOKENS(_TP_EXDATA_PROTO, N)(__VA_ARGS__))
+#define _TP_DATA_VAR_N(N, ...)         _TP_PARAMS(_TP_COMBINE_TOKENS(_TP_EXDATA_VAR, N)(__VA_ARGS__))
 #define _TP_ARGS_PROTO(...)            _TP_PROTO_N(_TP_NARGS(0, ##__VA_ARGS__), ##__VA_ARGS__)
-#define _TP_ARGS_VARS(...)             _TP_VARS_N(_TP_NARGS(0, ##__VA_ARGS__), ##__VA_ARGS__)
+#define _TP_ARGS_VAR(...)              _TP_VAR_N(_TP_NARGS(0, ##__VA_ARGS__), ##__VA_ARGS__)
 #define _TP_ARGS_DATA_PROTO(...)       _TP_DATA_PROTO_N(_TP_NARGS(0, ##__VA_ARGS__), ##__VA_ARGS__)
-#define _TP_ARGS_DATA_VARS(...)                _TP_DATA_VARS_N(_TP_NARGS(0, ##__VA_ARGS__), ##__VA_ARGS__)
+#define _TP_ARGS_DATA_VAR(...)         _TP_DATA_VAR_N(_TP_NARGS(0, ##__VA_ARGS__), ##__VA_ARGS__)
 #define _TP_PARAMS(...)                        __VA_ARGS__
 
 #define _DECLARE_TRACEPOINT(provider, name, ...)                                       \
-extern struct tracepoint __tracepoint_##provider##_##name;                             \
-static inline void __tracepoint_##provider##_##name(_TP_ARGS_DATA_PROTO(__VA_ARGS__))  \
+extern struct tracepoint __tracepoint_##provider##___##name;                           \
+static inline void __tracepoint_cb_##provider##___##name(_TP_ARGS_PROTO(__VA_ARGS__))  \
 {                                                                                      \
        struct tracepoint_probe *__tp_probe;                                            \
                                                                                        \
        rcu_read_lock_bp();                                                             \
-       p = rcu_dereference(__tracepoint_##provider##_##name.probes);                   \
-       if (caa_unlikely(!p))                                                           \
+       __tp_probe = rcu_dereference(__tracepoint_##provider##___##name.probes);        \
+       if (caa_unlikely(!__tp_probe))                                                  \
                goto end;                                                               \
        do {                                                                            \
-               void *__tp_data = p->priv;                                              \
+               void *__tp_cb = __tp_probe->func;                                       \
+               void *__tp_data = __tp_probe->data;                                     \
                                                                                        \
-               (*p->callback)(_TP_ARGS_DATA_VARS(__VA_ARGS__));                        \
-               __tp_probe++;                                                           \
-       } while (*__tp_probe);                                                          \
+               URCU_FORCE_CAST(void (*)(_TP_ARGS_DATA_PROTO(__VA_ARGS__)), __tp_cb)    \
+                               (_TP_ARGS_DATA_VAR(__VA_ARGS__));                       \
+       } while ((++__tp_probe)->func);                                                 \
 end:                                                                                   \
        rcu_read_unlock_bp();                                                           \
 }                                                                                      \
-static inline void __tracepoint_register_##provider##_##name(char *name,               \
-               void *callback, void *priv)                                             \
+static inline void __tracepoint_register_##provider##___##name(char *name,             \
+               void *func, void *data)                                                 \
 {                                                                                      \
-       __tracepoint_probe_register(name, callback, data);                              \
+       __tracepoint_probe_register(name, func, data);                                  \
 }                                                                                      \
-static inline void __tracepoint_unregister_##provider##_##name(char *name,             \
-               void *callback, void *priv)                                             \
+static inline void __tracepoint_unregister_##provider##___##name(char *name,           \
+               void *func, void *data)                                                 \
 {                                                                                      \
-       __tracepoint_probe_unregister(name, callback, data);                            \
+       __tracepoint_probe_unregister(name, func, data);                                \
 }
 
 /*
@@ -148,8 +149,8 @@ static inline void __tracepoint_unregister_##provider##_##name(char *name,          \
                __attribute__((used, section("__tracepoints_ptrs"))) =          \
                        &__tracepoint_##provider##___##name;
 
-extern int __tracepoint_probe_register(const char *name, void *callback, void *priv);
-extern int __tracepoint_probe_unregister(const char *name, void *callback, void *priv);
+extern int __tracepoint_probe_register(const char *name, void *func, void *data);
+extern int __tracepoint_probe_unregister(const char *name, void *func, void *data);
 extern int tracepoint_register_lib(struct tracepoint * const *tracepoints_start,
                int tracepoints_count);
 extern int tracepoint_unregister_lib(struct tracepoint * const *tracepoints_start);
index 1c7140ff69ef528baf148af2fab14c0faeb5bbf1..63162948d67563028a130ba1c833075f6b5b9d21 100644 (file)
@@ -156,7 +156,7 @@ struct lttng_enum {
        const char *name;
        struct lttng_type container_type;
        const struct lttng_enum_entry *entries;
-       nsigned int len;
+       unsigned int len;
 };
 
 /* Event field description */
index d9da1006ad4b4c62c2be2f287863c49e4cacf3b4..c97727348cb18834fb4a38e3b763f30e7fab3eae 100644 (file)
@@ -87,7 +87,7 @@ int add_pending_probe(struct ltt_event *event, const char *name)
        struct cds_hlist_head *head;
        struct ust_pending_probe *e;
        size_t name_len = strlen(name) + 1;
-       u32 hash = jhash(name, name_len - 1, 0);
+       uint32_t hash = jhash(name, name_len - 1, 0);
 
        head = &pending_probe_table[hash & (PENDING_PROBE_HASH_SIZE - 1)];
        e = zmalloc(sizeof(struct ust_pending_probe) + name_len);
@@ -126,7 +126,7 @@ int pending_probe_fix_events(const struct lttng_event_desc *desc)
        struct ust_pending_probe *e;
        const char *name = desc->name;
        size_t name_len = strlen(name) + 1;
-       u32 hash = jhash(name, name_len - 1, 0);
+       uint32_t hash = jhash(name, name_len - 1, 0);
        int ret = 0;
 
        head = &pending_probe_table[hash & (PENDING_PROBE_HASH_SIZE - 1)];
index b2ef327364913236a041d9f223da12181d49a22d..6f714da57b97866d842dd10beafb7836cb2b0550 100644 (file)
@@ -48,7 +48,7 @@ struct packet_header {
 };
 
 
-static inline notrace u64 lib_ring_buffer_clock_read(struct channel *chan)
+static inline uint64_t lib_ring_buffer_clock_read(struct channel *chan)
 {
        return trace_clock_read64();
 }
@@ -267,7 +267,7 @@ void ltt_write_event_header_slow(const struct lttng_ust_lib_ring_buffer_config *
 
 static const struct lttng_ust_lib_ring_buffer_config client_config;
 
-static u64 client_ring_buffer_clock_read(struct channel *chan)
+static uint64_t client_ring_buffer_clock_read(struct channel *chan)
 {
        return lib_ring_buffer_clock_read(chan);
 }
@@ -294,7 +294,7 @@ static size_t client_packet_header_size(void)
        return offsetof(struct packet_header, ctx.header_end);
 }
 
-static void client_buffer_begin(struct lttng_ust_lib_ring_buffer *buf, u64 tsc,
+static void client_buffer_begin(struct lttng_ust_lib_ring_buffer *buf, uint64_t tsc,
                                unsigned int subbuf_idx,
                                struct lttng_ust_shm_handle *handle)
 {
@@ -321,7 +321,7 @@ static void client_buffer_begin(struct lttng_ust_lib_ring_buffer *buf, u64 tsc,
  * offset is assumed to never be 0 here : never deliver a completely empty
  * subbuffer. data_size is between 1 and subbuf_size.
  */
-static void client_buffer_end(struct lttng_ust_lib_ring_buffer *buf, u64 tsc,
+static void client_buffer_end(struct lttng_ust_lib_ring_buffer *buf, uint64_t tsc,
                              unsigned int subbuf_idx, unsigned long data_size,
                              struct lttng_ust_shm_handle *handle)
 {
index 0fd4d22264614fcc6633e55b5b0caf26e2d5e7f6..a9c2f641c54cc4bfc317ae5b52bb2c76d8646f59 100644 (file)
@@ -34,8 +34,7 @@ struct metadata_record_header {
 
 static const struct lttng_ust_lib_ring_buffer_config client_config;
 
-static inline
-u64 lib_ring_buffer_clock_read(struct channel *chan)
+static inline uint64_t lib_ring_buffer_clock_read(struct channel *chan)
 {
        return 0;
 }
@@ -51,7 +50,7 @@ unsigned char record_header_size(const struct lttng_ust_lib_ring_buffer_config *
 
 #include "../libringbuffer/api.h"
 
-static u64 client_ring_buffer_clock_read(struct channel *chan)
+static uint64_t client_ring_buffer_clock_read(struct channel *chan)
 {
        return 0;
 }
@@ -77,7 +76,7 @@ static size_t client_packet_header_size(void)
        return offsetof(struct metadata_packet_header, header_end);
 }
 
-static void client_buffer_begin(struct lttng_ust_lib_ring_buffer *buf, u64 tsc,
+static void client_buffer_begin(struct lttng_ust_lib_ring_buffer *buf, uint64_t tsc,
                                unsigned int subbuf_idx,
                                struct lttng_ust_shm_handle *handle)
 {
@@ -106,7 +105,7 @@ static void client_buffer_begin(struct lttng_ust_lib_ring_buffer *buf, u64 tsc,
  * offset is assumed to never be 0 here : never deliver a completely empty
  * subbuffer. data_size is between 1 and subbuf_size.
  */
-static void client_buffer_end(struct lttng_ust_lib_ring_buffer *buf, u64 tsc,
+static void client_buffer_end(struct lttng_ust_lib_ring_buffer *buf, uint64_t tsc,
                              unsigned int subbuf_idx, unsigned long data_size,
                              struct lttng_ust_shm_handle *handle)
 {
index 76f78702db080b1dcb04a5a2dad8927cf2fe60fb..6a568ba85690d77fcd351bc93c022a4c1a7f93d6 100644 (file)
@@ -30,6 +30,7 @@
 #include <lttng/ust-events.h>
 #include <lttng/usterr-signal-safe.h>
 #include "lttng/core.h"
+#include <lttng/ust-version.h>
 #include "ltt-tracer.h"
 #include "tracepoint-internal.h"
 
@@ -249,9 +250,9 @@ static
 long lttng_abi_tracer_version(int objd,
        struct lttng_ust_tracer_version *v)
 {
-       v->major = LTTNG_UST_MAJOR;
-       v->minor = LTTNG_UST_MINOR;
-       v->patchlevel = LTTNG_UST_PATCHLEVEL;
+       v->major = LTTNG_UST_MAJOR_VERSION;
+       v->minor = LTTNG_UST_MINOR_VERSION;
+       v->patchlevel = LTTNG_UST_PATCHLEVEL_VERSION;
        return 0;
 }
 
index d0239cda76f51d25129626f4a0da5659cef564d6..17c7350de06a8078c6ddc543e8c1468b44430593 100644 (file)
@@ -42,8 +42,7 @@
 #include <lttng/ust-events.h>
 #include <lttng/usterr-signal-safe.h>
 #include <lttng/ust-abi.h>
-#include <lttng/tracepoint.h>
-#include <lttng/tracepoint-internal.h>
+#include "tracepoint-internal.h"
 #include <lttng/ust.h>
 #include "ltt-tracer-core.h"
 
@@ -301,7 +300,7 @@ end:
                shm_fd = lum->u.channel.shm_fd;
                wait_fd = lum->u.channel.wait_fd;
                break;
-       case LTTNG_UST_VERSION:
+       case LTTNG_UST_TRACER_VERSION:
                lur.u.version = lum->u.version;
                break;
        case LTTNG_UST_TRACEPOINT_LIST_GET:
@@ -904,7 +903,7 @@ static void ust_after_fork_common(sigset_t *restore_sigset)
        DBG("process %d", getpid());
        ust_unlock();
        /* Restore signals */
-       ret = sigprocmask(SIG_SETMASK, &restore_sigset, NULL);
+       ret = sigprocmask(SIG_SETMASK, restore_sigset, NULL);
        if (ret == -1) {
                PERROR("sigprocmask");
        }
index c883c7bda62ef8ce1bf9e3d10de9894237ac5ead..01d8c8bfdfc3dc9dae05429153d76c745581678f 100644 (file)
  */
 
 #include <urcu/list.h>
+#include <urcu-bp.h>
 #include <lttng/tracepoint-types.h>
 
 struct tracepoint_lib {
        struct cds_list_head list;
-       struct tracepoint tracepoints_start;
+       struct tracepoint * const *tracepoints_start;
        int tracepoints_count;
 };
 
 struct tracepoint_iter {
        struct tracepoint_lib *lib;
        struct tracepoint * const *tracepoint;
+};
 
 extern int tracepoint_probe_register_noupdate(const char *name, void *callback, void *priv);
 extern int tracepoint_probe_unregister_noupdate(const char *name, void *callback, void *priv);
-extern int tracepoint_probe_update_all(void);
+extern void tracepoint_probe_update_all(void);
 
 extern void tracepoint_iter_start(struct tracepoint_iter *iter);
 extern void tracepoint_iter_next(struct tracepoint_iter *iter);
@@ -49,7 +51,7 @@ extern int tracepoint_get_iter_range(struct tracepoint * const **tracepoint,
  */
 static inline void tracepoint_synchronize_unregister(void)
 {
-       synchronize_rcu();
+       synchronize_rcu_bp();
 }
 
 extern void init_tracepoint(void);
index 217ef4c22af2de76e8fe2990d7facc187f825386..66e58d0a5a34bb8dfe2e6d931ce6ddb416930c7d 100644 (file)
@@ -22,7 +22,6 @@
 #define _LGPL_SOURCE
 #include <errno.h>
 #include <lttng/tracepoint.h>
-#include <lttng/tracepoint-internal.h>
 #include <lttng/core.h>
 #include <stdint.h>
 #include <stddef.h>
@@ -33,6 +32,7 @@
 #include <urcu/compiler.h>
 
 #include <lttng/usterr-signal-safe.h>
+#include "tracepoint-internal.h"
 #include "ltt-tracer-core.h"
 
 /* Set to 1 to enable tracepoint debug output */
@@ -199,7 +199,7 @@ static struct tracepoint_entry *get_tracepoint(const char *name)
        struct cds_hlist_head *head;
        struct cds_hlist_node *node;
        struct tracepoint_entry *e;
-       u32 hash = jhash(name, strlen(name), 0);
+       uint32_t hash = jhash(name, strlen(name), 0);
 
        head = &tracepoint_table[hash & (TRACEPOINT_TABLE_SIZE - 1)];
        cds_hlist_for_each_entry(e, node, head, hlist) {
@@ -219,7 +219,7 @@ static struct tracepoint_entry *add_tracepoint(const char *name)
        struct cds_hlist_node *node;
        struct tracepoint_entry *e;
        size_t name_len = strlen(name) + 1;
-       u32 hash = jhash(name, name_len-1, 0);
+       uint32_t hash = jhash(name, name_len-1, 0);
 
        head = &tracepoint_table[hash & (TRACEPOINT_TABLE_SIZE - 1)];
        cds_hlist_for_each_entry(e, node, head, hlist) {
This page took 0.033493 seconds and 4 git commands to generate.