Fix: fd tracker: do not allow signal handlers to close lttng-ust FDs
[lttng-ust.git] / liblttng-ust / lttng-ust-comm.c
index 26c2e2907bcfdd9701dda4c7575432fdd1e33523..1a279517a3cb8945767d312895068e43301003d6 100644 (file)
@@ -81,6 +81,8 @@ static int initialized;
  *
  * ust_lock nests within the dynamic loader lock (within glibc) because
  * it is taken within the library constructor.
+ *
+ * The ust fd tracker lock nests within the ust_mutex.
  */
 static pthread_mutex_t ust_mutex = PTHREAD_MUTEX_INITIALIZER;
 
@@ -1437,6 +1439,7 @@ void *ust_listener_thread(void *arg)
        long timeout;
 
        lttng_ust_fixup_tls();
+       lttng_ust_fd_tracker_register_thread();
        /*
         * If available, add '-ust' to the end of this thread's
         * process name
@@ -2024,6 +2027,7 @@ void ust_before_fork(sigset_t *save_sigset)
 
        ust_lock_nocheck();
        rcu_bp_before_fork();
+       lttng_ust_lock_fd_tracker();
 }
 
 static void ust_after_fork_common(sigset_t *restore_sigset)
@@ -2031,6 +2035,7 @@ static void ust_after_fork_common(sigset_t *restore_sigset)
        int ret;
 
        DBG("process %d", getpid());
+       lttng_ust_unlock_fd_tracker();
        ust_unlock();
 
        pthread_mutex_unlock(&ust_fork_mutex);
This page took 0.027397 seconds and 4 git commands to generate.