#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
return retval;
}
+static
+void lttng_ust_fixup_malloc_nesting_tls(void)
+{
+ asm volatile ("" : : "m" (URCU_TLS(malloc_nesting)));
+}
+
__attribute__((constructor))
void lttng_ust_malloc_wrapper_init(void)
{
if (cur_alloc.calloc) {
return;
}
+ lttng_ust_fixup_malloc_nesting_tls();
/*
* Ensure the allocator is in place before the process becomes
* multithreaded.