#include <inttypes.h>
#include <signal.h>
-#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 {
/*
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;
}
timer_signal_thread_qs(signal);
- *timer_id = 0;
+ *timer_id = nullptr;
end:
return ret;
}
/*
* Call with session and session_list locks held.
*/
-int timer_session_rotation_pending_check_stop(struct ltt_session *session)
+int timer_session_rotation_pending_check_stop(ltt_session& session)
{
int ret;
- LTTNG_ASSERT(session);
- LTTNG_ASSERT(session->rotation_pending_check_timer_enabled);
+ LTTNG_ASSERT(session.rotation_pending_check_timer_enabled);
- DBG("Disabling session rotation pending check timer on session %" PRIu64, session->id);
- ret = timer_stop(&session->rotation_pending_check_timer,
+ DBG("Disabling session rotation pending check timer on session %" PRIu64, session.id);
+ ret = timer_stop(&session.rotation_pending_check_timer,
LTTNG_SESSIOND_SIG_PENDING_ROTATION_CHECK);
if (ret == -1) {
ERR("Failed to stop rotate_pending_check timer");
} else {
- session->rotation_pending_check_timer_enabled = false;
+ session.rotation_pending_check_timer_enabled = false;
/*
* The timer's reference to the session can be released safely.
*/
- session_put(session);
+ session_put(&session);
}
+
return ret;
}
* 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");
setmask(&mask);
CMM_STORE_SHARED(timer_signal.tid, pthread_self());
- while (1) {
+ while (true) {
health_code_update();
health_poll_entry();
struct ltt_session *session =
(struct ltt_session *) info.si_value.sival_ptr;
- rotation_thread_enqueue_job(ctx->rotation_thread_job_queue,
- ROTATION_THREAD_JOB_TYPE_CHECK_PENDING_ROTATION,
- session);
+ rotation_thread_enqueue_job(
+ ctx->rotation_thread_job_queue,
+ lttng::sessiond::rotation_thread_job_type::CHECK_PENDING_ROTATION,
+ session);
} else if (signr == LTTNG_SESSIOND_SIG_SCHEDULED_ROTATION) {
- rotation_thread_enqueue_job(ctx->rotation_thread_job_queue,
- ROTATION_THREAD_JOB_TYPE_SCHEDULED_ROTATION,
- (struct ltt_session *) info.si_value.sival_ptr);
+ rotation_thread_enqueue_job(
+ ctx->rotation_thread_job_queue,
+ lttng::sessiond::rotation_thread_job_type::SCHEDULED_ROTATION,
+ (struct ltt_session *) info.si_value.sival_ptr);
/*
* The scheduled periodic rotation timer is not in
* "one-shot" mode. The reference to the session is not
health_unregister(the_health_sessiond);
rcu_thread_offline();
rcu_unregister_thread();
- return NULL;
+ return nullptr;
}
static bool shutdown_timer_thread(void *data __attribute__((unused)))
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;
}