X-Git-Url: http://git.lttng.org./?a=blobdiff_plain;f=src%2Fbin%2Flttng-sessiond%2Ftimer.cpp;h=243b562190d12e3656e438c561f25aba4bc8215b;hb=1a12551012430c38186da14611dd4921e7319d20;hp=bb5f1d3eabf80cb78fefe6d9fbe0d448d41d4c7b;hpb=28ab034a2c3582d07d3423d2d746731f87d3969f;p=lttng-tools.git diff --git a/src/bin/lttng-sessiond/timer.cpp b/src/bin/lttng-sessiond/timer.cpp index bb5f1d3ea..243b56219 100644 --- a/src/bin/lttng-sessiond/timer.cpp +++ b/src/bin/lttng-sessiond/timer.cpp @@ -15,17 +15,17 @@ #include #include -#define LTTNG_SESSIOND_SIG_QS SIGRTMIN + 10 -#define LTTNG_SESSIOND_SIG_EXIT SIGRTMIN + 11 -#define LTTNG_SESSIOND_SIG_PENDING_ROTATION_CHECK SIGRTMIN + 12 -#define LTTNG_SESSIOND_SIG_SCHEDULED_ROTATION SIGRTMIN + 13 - -#define UINT_TO_PTR(value) \ - ({ \ - LTTNG_ASSERT(value <= UINTPTR_MAX); \ - (void *) (uintptr_t) value; \ +#define LTTNG_SESSIOND_SIG_QS (SIGRTMIN + 10) +#define LTTNG_SESSIOND_SIG_EXIT (SIGRTMIN + 11) +#define LTTNG_SESSIOND_SIG_PENDING_ROTATION_CHECK (SIGRTMIN + 12) +#define LTTNG_SESSIOND_SIG_SCHEDULED_ROTATION (SIGRTMIN + 13) + +#define UINT_TO_PTR(value) \ + ({ \ + LTTNG_ASSERT((value) <= UINTPTR_MAX); \ + (void *) (uintptr_t) (value); \ }) -#define PTR_TO_UINT(ptr) ((uintptr_t) ptr) +#define PTR_TO_UINT(ptr) ((uintptr_t) (ptr)) namespace { /* @@ -166,7 +166,7 @@ static int timer_start(timer_t *timer_id, its.it_interval.tv_nsec = its.it_value.tv_nsec; } - ret = timer_settime(*timer_id, 0, &its, NULL); + ret = timer_settime(*timer_id, 0, &its, nullptr); if (ret == -1) { PERROR("timer_settime"); goto error_destroy_timer; @@ -194,7 +194,7 @@ static int timer_stop(timer_t *timer_id, int signal) } timer_signal_thread_qs(signal); - *timer_id = 0; + *timer_id = nullptr; end: return ret; } @@ -316,14 +316,14 @@ end: * Block the RT signals for the entire process. It must be called from the * sessiond main before creating the threads */ -int timer_signal_init(void) +int timer_signal_init() { int ret; sigset_t mask; /* Block signal for entire process, so only our thread processes it. */ setmask(&mask); - ret = pthread_sigmask(SIG_BLOCK, &mask, NULL); + ret = pthread_sigmask(SIG_BLOCK, &mask, nullptr); if (ret) { errno = ret; PERROR("pthread_sigmask"); @@ -352,7 +352,7 @@ static void *thread_timer(void *data) setmask(&mask); CMM_STORE_SHARED(timer_signal.tid, pthread_self()); - while (1) { + while (true) { health_code_update(); health_poll_entry(); @@ -402,7 +402,7 @@ end: health_unregister(the_health_sessiond); rcu_thread_offline(); rcu_unregister_thread(); - return NULL; + return nullptr; } static bool shutdown_timer_thread(void *data __attribute__((unused))) @@ -415,7 +415,7 @@ bool launch_timer_thread(struct timer_thread_parameters *timer_thread_parameters struct lttng_thread *thread; thread = lttng_thread_create( - "Timer", thread_timer, shutdown_timer_thread, NULL, timer_thread_parameters); + "Timer", thread_timer, shutdown_timer_thread, nullptr, timer_thread_parameters); if (!thread) { goto error; }