From: Mathieu Desnoyers Date: Thu, 17 Nov 2011 23:39:02 +0000 (-0500) Subject: More compile fixes X-Git-Tag: v1.9.1~83 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=23c8854a5fa1120df5cfdfbf08f00e00976f95fa;p=lttng-ust.git More compile fixes Signed-off-by: Mathieu Desnoyers --- diff --git a/configure.ac b/configure.ac index c32c835d..d3cac78f 100644 --- a/configure.ac +++ b/configure.ac @@ -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]) diff --git a/include/lttng/tracepoint-types.h b/include/lttng/tracepoint-types.h index fad23bc4..b6353c80 100644 --- a/include/lttng/tracepoint-types.h +++ b/include/lttng/tracepoint-types.h @@ -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 */ diff --git a/include/lttng/tracepoint.h b/include/lttng/tracepoint.h index 86abd1a5..e177b87d 100644 --- a/include/lttng/tracepoint.h +++ b/include/lttng/tracepoint.h @@ -22,10 +22,10 @@ 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); diff --git a/include/lttng/ust-events.h b/include/lttng/ust-events.h index 1c7140ff..63162948 100644 --- a/include/lttng/ust-events.h +++ b/include/lttng/ust-events.h @@ -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 */ diff --git a/liblttng-ust/ltt-events.c b/liblttng-ust/ltt-events.c index d9da1006..c9772734 100644 --- a/liblttng-ust/ltt-events.c +++ b/liblttng-ust/ltt-events.c @@ -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)]; diff --git a/liblttng-ust/ltt-ring-buffer-client.h b/liblttng-ust/ltt-ring-buffer-client.h index b2ef3273..6f714da5 100644 --- a/liblttng-ust/ltt-ring-buffer-client.h +++ b/liblttng-ust/ltt-ring-buffer-client.h @@ -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) { diff --git a/liblttng-ust/ltt-ring-buffer-metadata-client.h b/liblttng-ust/ltt-ring-buffer-metadata-client.h index 0fd4d222..a9c2f641 100644 --- a/liblttng-ust/ltt-ring-buffer-metadata-client.h +++ b/liblttng-ust/ltt-ring-buffer-metadata-client.h @@ -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) { diff --git a/liblttng-ust/lttng-ust-abi.c b/liblttng-ust/lttng-ust-abi.c index 76f78702..6a568ba8 100644 --- a/liblttng-ust/lttng-ust-abi.c +++ b/liblttng-ust/lttng-ust-abi.c @@ -30,6 +30,7 @@ #include #include #include "lttng/core.h" +#include #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; } diff --git a/liblttng-ust/lttng-ust-comm.c b/liblttng-ust/lttng-ust-comm.c index d0239cda..17c7350d 100644 --- a/liblttng-ust/lttng-ust-comm.c +++ b/liblttng-ust/lttng-ust-comm.c @@ -42,8 +42,7 @@ #include #include #include -#include -#include +#include "tracepoint-internal.h" #include #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"); } diff --git a/liblttng-ust/tracepoint-internal.h b/liblttng-ust/tracepoint-internal.h index c883c7bd..01d8c8bf 100644 --- a/liblttng-ust/tracepoint-internal.h +++ b/liblttng-ust/tracepoint-internal.h @@ -20,21 +20,23 @@ */ #include +#include #include 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); diff --git a/liblttng-ust/tracepoint.c b/liblttng-ust/tracepoint.c index 217ef4c2..66e58d0a 100644 --- a/liblttng-ust/tracepoint.c +++ b/liblttng-ust/tracepoint.c @@ -22,7 +22,6 @@ #define _LGPL_SOURCE #include #include -#include #include #include #include @@ -33,6 +32,7 @@ #include #include +#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) {