#include "common/ust-fd.h"
#include "common/macros.h"
#include <lttng/ust-error.h>
#include "common/ust-fd.h"
#include "common/macros.h"
#include <lttng/ust-error.h>
/*
* Track whether we are within lttng-ust or application, for close
* system call override by LD_PRELOAD library. This also tracks whether
/*
* Track whether we are within lttng-ust or application, for close
* system call override by LD_PRELOAD library. This also tracks whether
void lttng_ust_lock_fd_tracker(void)
{
sigset_t sig_all_blocked, orig_mask;
void lttng_ust_lock_fd_tracker(void)
{
sigset_t sig_all_blocked, orig_mask;
- ret = pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &oldstate);
- if (ret) {
- ERR("pthread_setcancelstate: %s", strerror(ret));
+ if (lttng_ust_cancelstate_disable_push()) {
+ ERR("lttng_ust_cancelstate_disable_push");
}
sigfillset(&sig_all_blocked);
ret = pthread_sigmask(SIG_SETMASK, &sig_all_blocked, &orig_mask);
}
sigfillset(&sig_all_blocked);
ret = pthread_sigmask(SIG_SETMASK, &sig_all_blocked, &orig_mask);
void lttng_ust_unlock_fd_tracker(void)
{
sigset_t sig_all_blocked, orig_mask;
void lttng_ust_unlock_fd_tracker(void)
{
sigset_t sig_all_blocked, orig_mask;
sigfillset(&sig_all_blocked);
ret = pthread_sigmask(SIG_SETMASK, &sig_all_blocked, &orig_mask);
sigfillset(&sig_all_blocked);
ret = pthread_sigmask(SIG_SETMASK, &sig_all_blocked, &orig_mask);
pthread_mutex_unlock(&ust_safe_guard_fd_mutex);
}
ret = pthread_sigmask(SIG_SETMASK, &orig_mask, NULL);
if (ret) {
ERR("pthread_sigmask: %s", strerror(ret));
}
pthread_mutex_unlock(&ust_safe_guard_fd_mutex);
}
ret = pthread_sigmask(SIG_SETMASK, &orig_mask, NULL);
if (ret) {
ERR("pthread_sigmask: %s", strerror(ret));
}
- if (restore_cancel) {
- ret = pthread_setcancelstate(newstate, &oldstate);
- if (ret) {
- ERR("pthread_setcancelstate: %s", strerror(ret));
- }
+ if (lttng_ust_cancelstate_disable_pop()) {
+ ERR("lttng_ust_cancelstate_disable_pop");