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])
*/
struct tracepoint_probe {
- void *callback;
- void *priv;
+ void *func;
+ void *data;
};
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 */
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__
#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
/* 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); \
}
/*
__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);
const char *name;
struct lttng_type container_type;
const struct lttng_enum_entry *entries;
- nsigned int len;
+ unsigned int len;
};
/* Event field description */
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);
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)];
};
-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();
}
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);
}
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)
{
* 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)
{
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;
}
#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;
}
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)
{
* 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)
{
#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"
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;
}
#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"
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:
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");
}
*/
#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);
*/
static inline void tracepoint_synchronize_unregister(void)
{
- synchronize_rcu();
+ synchronize_rcu_bp();
}
extern void init_tracepoint(void);
#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>
#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 */
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) {
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) {