AC_CHECK_HEADERS([urcu-bp.h], [], [AC_MSG_ERROR([Cannot find [URCU] headers (urcu-bp.h). Use [CPPFLAGS]=-Idir to specify their location.
This error can also occur when the liburcu package's configure script has not been run.])])
+# URCU library version needed or newer
+m4_define([WRONG_LIBURCU_MSG], [Userspace RCU (liburcu) >= 0.11.0 is needed])
+
+#Macro added in urcu 0.6.6
+AC_CHECK_DECL([caa_likely], [],
+ [AC_MSG_ERROR([WRONG_LIBURCU_MSG])], [[#include <urcu.h>]])
+#Macro added in urcu 0.11.0
+AC_CHECK_DECL([DEFINE_URCU_TLS_IE], [],
+ [AC_MSG_ERROR([WRONG_LIBURCU_MSG])], [[#include <urcu/tls-compat.h>]]
+)
+
# urcu-cds - check that URCU Concurrent Data Structure lib is available to compilation
# Part of Userspace RCU library 0.7.2 or better.
AC_CHECK_LIB([urcu-cds], [_cds_lfht_new], [], [AC_MSG_ERROR([Cannot find
liburcu-cds lib, part of Userspace RCU 0.7 or better. Use [LDFLAGS]=-Ldir to specify its location.])])
-AC_MSG_CHECKING([caa_likely()])
-AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
- #include <urcu/compiler.h>
- void fct(void)
- {
- if (caa_likely(1)) {
- }
- }
-]])], [
- AC_MSG_RESULT([yes])
-], [
- AC_MSG_RESULT([no])
- AC_MSG_ERROR([Please upgrade your version of liburcu to 0.6.6 or better])
-])
-
# urcu - check that URCU lib is available to compilation
AC_CHECK_LIB([urcu-bp], [synchronize_rcu_bp], [], [AC_MSG_ERROR([Cannot find liburcu-bp lib. Use [LDFLAGS]=-Ldir to specify its location.])])
* Track whether we are within lttng-ust or application, for close
* system call override by LD_PRELOAD library.
*/
-static DEFINE_URCU_TLS(int, thread_fd_tracking);
+static DEFINE_URCU_TLS_IE(int, thread_fd_tracking);
/* fd_set used to book keep fd being used by lttng-ust. */
static fd_set *lttng_fd_set;
#include <lttng/ust-events.h>
#include <lttng/ringbuffer-config.h>
#include <lttng/ust-context-provider.h>
+#include <urcu/tls-compat.h>
#include "helper.h"
#include "lttng_ust_context.h"
} __attribute__((packed));
/* TLS passing context info from JNI to callbacks. */
-__thread struct lttng_ust_jni_tls lttng_ust_context_info_tls;
+DECLARE_URCU_TLS_IE(struct lttng_ust_jni_tls, lttng_ust_context_info_tls);
static const char *get_ctx_string_at_offset(int32_t offset)
{
#ifndef LIBLTTNG_UST_JAVA_AGENT_JNI_COMMON_LTTNG_UST_CONTEXT_H_
#define LIBLTTNG_UST_JAVA_AGENT_JNI_COMMON_LTTNG_UST_CONTEXT_H_
+#include <urcu/tls-compat.h>
+
struct lttng_ust_jni_ctx_entry;
struct lttng_ust_jni_tls {
int32_t ctx_strings_len;
};
-extern __thread struct lttng_ust_jni_tls lttng_ust_context_info_tls;
+extern DECLARE_URCU_TLS(struct lttng_ust_jni_tls, lttng_ust_context_info_tls);
#endif /* LIBLTTNG_UST_JAVA_AGENT_JNI_COMMON_LTTNG_UST_CONTEXT_H_ */
#define calloc static_calloc
#define pthread_mutex_lock ust_malloc_spin_lock
#define pthread_mutex_unlock ust_malloc_spin_unlock
-static DEFINE_URCU_TLS(int, malloc_nesting);
+static DEFINE_URCU_TLS_IE(int, malloc_nesting);
#undef ust_malloc_spin_unlock
#undef ust_malloc_spin_lock
#undef calloc
* libc.
*/
#include <lttng/ust-dlfcn.h>
+#include <urcu/tls-compat.h>
#include <helper.h>
#include <pthread.h>
#define TP_IP_PARAM ip
#include "ust_pthread.h"
-static __thread int thread_in_trace;
+static DEFINE_URCU_TLS_IE(int, thread_in_trace);
int pthread_mutex_lock(pthread_mutex_t *mutex)
{
* thread.
*/
typedef char procname_array[17];
-static DEFINE_URCU_TLS(procname_array, cached_procname);
+static DEFINE_URCU_TLS_IE(procname_array, cached_procname);
static inline
char *wrapper_getprocname(void)
* We cache the result to ensure we don't trigger a system call for
* each event.
*/
-static DEFINE_URCU_TLS(pid_t, cached_vtid);
+static DEFINE_URCU_TLS_IE(pid_t, cached_vtid);
/*
* Upon fork or clone, the TID assigned to our thread is not the same as
static pthread_mutex_t ust_mutex = PTHREAD_MUTEX_INITIALIZER;
/* Allow nesting the ust_mutex within the same thread. */
-static DEFINE_URCU_TLS(int, ust_mutex_nest);
+static DEFINE_URCU_TLS_IE(int, ust_mutex_nest);
/*
* ust_exit_mutex protects thread_active variable wrt thread exit. It
switch_old_end:1;
};
-DEFINE_URCU_TLS(unsigned int, lib_ring_buffer_nesting);
+DEFINE_URCU_TLS_IE(unsigned int, lib_ring_buffer_nesting);
/*
* wakeup_fd_mutex protects wakeup fd use by timer from concurrent
#include <fcntl.h>
#include <signal.h>
#include <string.h>
+#include <urcu/tls-compat.h>
/*
* Work-around inet.h missing struct mmsghdr forward declaration, with
* triggers a warning when system files warnings are enabled.
#include <lttng/ringbuffer-config.h>
#include <lttng/ust-context-provider.h>
-static __thread unsigned int test_count;
+static DEFINE_URCU_TLS_IE(unsigned int, test_count);
void test_inc_count(void)
{