#include <lttng/ust-arch.h>
#include <lttng/ust-events.h>
#include <lttng/ust-tracer.h>
#include <lttng/ust-arch.h>
#include <lttng/ust-events.h>
#include <lttng/ust-tracer.h>
* lttng_perf_lock - Protect lttng-ust perf counter data structures
*
* Nests within the ust_lock, and therefore within the libc dl lock.
* lttng_perf_lock - Protect lttng-ust perf counter data structures
*
* Nests within the ust_lock, and therefore within the libc dl lock.
* Nests inside RCU bp read-side lock. Protects against concurrent
* fork.
*/
static pthread_mutex_t ust_perf_mutex = PTHREAD_MUTEX_INITIALIZER;
* Nests inside RCU bp read-side lock. Protects against concurrent
* fork.
*/
static pthread_mutex_t ust_perf_mutex = PTHREAD_MUTEX_INITIALIZER;
void lttng_perf_lock(void)
{
sigset_t sig_all_blocked, orig_mask;
void lttng_perf_lock(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_perf_unlock(void)
{
sigset_t sig_all_blocked, orig_mask;
void lttng_perf_unlock(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_perf_mutex);
}
ret = pthread_sigmask(SIG_SETMASK, &orig_mask, NULL);
if (ret) {
ERR("pthread_sigmask: %s", strerror(ret));
}
pthread_mutex_unlock(&ust_perf_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");
- struct lttng_ust_lib_ring_buffer_ctx *ctx,
- struct lttng_ust_channel_buffer *chan)
+ struct lttng_ust_probe_ctx *probe_ctx __attribute__((unused)),
+ struct lttng_ust_ring_buffer_ctx *ctx,
+ struct lttng_ust_channel_buffer *chan)
lttng_ust_static_type_integer(sizeof(uint64_t) * CHAR_BIT,
lttng_ust_rb_alignof(uint64_t) * CHAR_BIT,
lttng_ust_is_signed_type(uint64_t),
lttng_ust_static_type_integer(sizeof(uint64_t) * CHAR_BIT,
lttng_ust_rb_alignof(uint64_t) * CHAR_BIT,
lttng_ust_is_signed_type(uint64_t),
/* Called with UST lock held */
int lttng_add_perf_counter_to_ctx(uint32_t type,
/* Called with UST lock held */
int lttng_add_perf_counter_to_ctx(uint32_t type,