X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=src%2Fbin%2Flttng-sessiond%2Frotation-thread.cpp;h=ac75f58abab75bf24e0a25b817070c0bfc2aa5ca;hb=281a10509e36529edb8733a28367122531a63e21;hp=ecc4c3ea730513a16845dc42dd1aacecc798fb27;hpb=eb2827a4f0ccc637bf1d42edebf2607dbea80428;p=lttng-tools.git diff --git a/src/bin/lttng-sessiond/rotation-thread.cpp b/src/bin/lttng-sessiond/rotation-thread.cpp index ecc4c3ea7..ac75f58ab 100644 --- a/src/bin/lttng-sessiond/rotation-thread.cpp +++ b/src/bin/lttng-sessiond/rotation-thread.cpp @@ -8,35 +8,35 @@ #define _LGPL_SOURCE #include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include #include #include #include #include -#include -#include -#include -#include -#include - -#include "rotation-thread.h" -#include "lttng-sessiond.h" -#include "health-sessiond.h" -#include "rotate.h" -#include "cmd.h" -#include "session.h" -#include "timer.h" -#include "notification-thread-commands.h" -#include "utils.h" -#include "thread.h" +#include +#include +#include +#include +#include + +#include "rotation-thread.hpp" +#include "lttng-sessiond.hpp" +#include "health-sessiond.hpp" +#include "rotate.hpp" +#include "cmd.hpp" +#include "session.hpp" +#include "timer.hpp" +#include "notification-thread-commands.hpp" +#include "utils.hpp" +#include "thread.hpp" #include #include @@ -47,13 +47,6 @@ struct rotation_thread { struct lttng_poll_event events; }; -struct rotation_thread_job { - enum rotation_thread_job_type type; - struct ltt_session *session; - /* List member in struct rotation_thread_timer_queue. */ - struct cds_list_head head; -}; - /* * The timer thread enqueues jobs and wakes up the rotation thread. * When the rotation thread wakes up, it empties the queue. @@ -72,6 +65,15 @@ struct rotation_thread_handle { struct lttng_pipe *quit_pipe; }; +namespace { +struct rotation_thread_job { + enum rotation_thread_job_type type; + struct ltt_session *session; + /* List member in struct rotation_thread_timer_queue. */ + struct cds_list_head head; +}; +} /* namespace */ + static const char *get_job_type_str(enum rotation_thread_job_type job_type) { @@ -89,7 +91,7 @@ struct rotation_thread_timer_queue *rotation_thread_timer_queue_create(void) { struct rotation_thread_timer_queue *queue = NULL; - queue = (rotation_thread_timer_queue *) zmalloc(sizeof(*queue)); + queue = zmalloc(); if (!queue) { PERROR("Failed to allocate timer rotate queue"); goto end; @@ -134,7 +136,7 @@ struct rotation_thread_handle *rotation_thread_handle_create( { struct rotation_thread_handle *handle; - handle = (rotation_thread_handle *) zmalloc(sizeof(*handle)); + handle = zmalloc(); if (!handle) { goto end; } @@ -193,7 +195,7 @@ void rotation_thread_enqueue_job(struct rotation_thread_timer_queue *queue, goto end; } - job = (rotation_thread_job *) zmalloc(sizeof(struct rotation_thread_job)); + job = zmalloc(); if (!job) { PERROR("Failed to allocate rotation thread job of type \"%s\" for session \"%s\"", job_type_str, session->name); @@ -215,7 +217,10 @@ void rotation_thread_enqueue_job(struct rotation_thread_timer_queue *queue, * the job will be processed when the rotation_thread catches * up. */ + DIAGNOSTIC_PUSH + DIAGNOSTIC_IGNORE_LOGICAL_OP if (errno == EAGAIN || errno == EWOULDBLOCK) { + DIAGNOSTIC_POP /* * Not an error, but would be surprising and indicate * that the rotation thread can't keep up with the @@ -561,7 +566,7 @@ int run_job(struct rotation_thread_job *job, struct ltt_session *session, static int handle_job_queue(struct rotation_thread_handle *handle, - struct rotation_thread *state, + struct rotation_thread *state __attribute__((unused)), struct rotation_thread_timer_queue *queue) { int ret = 0; @@ -585,7 +590,7 @@ int handle_job_queue(struct rotation_thread_handle *handle, session = job->session; if (!session) { DBG("Session \"%s\" not found", - session->name); + session->name != NULL ? session->name : ""); /* * This is a non-fatal error, and we cannot report it to * the user (timer), so just print the error and @@ -707,9 +712,9 @@ end: } static -int handle_notification_channel(int fd, +int handle_notification_channel(int fd __attribute__((unused)), struct rotation_thread_handle *handle, - struct rotation_thread *state) + struct rotation_thread *state __attribute__((unused))) { int ret; bool notification_pending;