#include <lttng/ust.h>
#include <lttng/ust-error.h>
#include <lttng/ust-ctl.h>
+#include <urcu/tls-compat.h>
#include <ust-comm.h>
#include <usterr-signal-safe.h>
#include <helper.h>
* Counting nesting within lttng-ust. Used to ensure that calling fork()
* from liblttng-ust does not execute the pre/post fork handlers.
*/
-static int __thread lttng_ust_nest_count;
+static DEFINE_URCU_TLS(int, lttng_ust_nest_count);
/*
* Info about socket and associated listener thread.
static
void lttng_fixup_nest_count_tls(void)
{
- asm volatile ("" : : "m" (lttng_ust_nest_count));
+ asm volatile ("" : : "m" (URCU_TLS(lttng_ust_nest_count)));
}
static
* If the open failed because the file did not exist, try
* creating it ourself.
*/
- lttng_ust_nest_count++;
+ URCU_TLS(lttng_ust_nest_count)++;
pid = fork();
- lttng_ust_nest_count--;
+ URCU_TLS(lttng_ust_nest_count)--;
if (pid > 0) {
int status;
sigset_t all_sigs;
int ret;
- if (lttng_ust_nest_count)
+ if (URCU_TLS(lttng_ust_nest_count))
return;
/* Disable signals */
sigfillset(&all_sigs);
void ust_after_fork_parent(sigset_t *restore_sigset)
{
- if (lttng_ust_nest_count)
+ if (URCU_TLS(lttng_ust_nest_count))
return;
DBG("process %d", getpid());
rcu_bp_after_fork_parent();
*/
void ust_after_fork_child(sigset_t *restore_sigset)
{
- if (lttng_ust_nest_count)
+ if (URCU_TLS(lttng_ust_nest_count))
return;
DBG("process %d", getpid());
/* Release urcu mutexes */