Prepare for '-Wimplicit-fallthrough'
[lttng-tools.git] / src / bin / lttng-sessiond / cmd.cpp
index 2682629bbbbe91d2a89b6e40178fa0c6ec74bac3..ff7c0394719de93b893250d7ecd1762dd29ba336 100644 (file)
@@ -917,7 +917,6 @@ relayd_comm_error:
  * Returns LTTNG_OK, or an LTTng error code on failure.
  */
 static enum lttng_error_code send_consumer_relayd_sockets(
-               enum lttng_domain_type domain,
                unsigned int session_id, struct consumer_output *consumer,
                struct consumer_socket *sock, const char *session_name,
                const char *hostname, const char *base_path, int session_live_timer,
@@ -998,7 +997,7 @@ int cmd_setup_relayd(struct ltt_session *session)
                cds_lfht_for_each_entry(usess->consumer->socks->ht, &iter.iter,
                                socket, node.node) {
                        pthread_mutex_lock(socket->lock);
-                       ret = send_consumer_relayd_sockets(LTTNG_DOMAIN_UST, session->id,
+                       ret = send_consumer_relayd_sockets(session->id,
                                        usess->consumer, socket,
                                        session->name, session->hostname,
                                        session->base_path,
@@ -1026,7 +1025,7 @@ int cmd_setup_relayd(struct ltt_session *session)
                cds_lfht_for_each_entry(ksess->consumer->socks->ht, &iter.iter,
                                socket, node.node) {
                        pthread_mutex_lock(socket->lock);
-                       ret = send_consumer_relayd_sockets(LTTNG_DOMAIN_KERNEL, session->id,
+                       ret = send_consumer_relayd_sockets(session->id,
                                        ksess->consumer, socket,
                                        session->name, session->hostname,
                                        session->base_path,
@@ -1922,8 +1921,8 @@ int cmd_add_context(struct command_ctx *cmd_ctx,
                        ret = LTTNG_ERR_UST_CHAN_NOT_FOUND;
                        goto error;
                }
-               /* break is _not_ missing here. */
        }
+       /* fall through */
        case LTTNG_DOMAIN_UST:
        {
                struct ltt_ust_session *usess = session->ust_session;
@@ -2818,7 +2817,7 @@ int cmd_start_trace(struct ltt_session *session)
         */
        session->rotated_after_last_stop = false;
 
-       if (session->rotate_timer_period) {
+       if (session->rotate_timer_period && !session->rotation_schedule_timer_enabled) {
                int int_ret = timer_session_rotation_schedule_timer_start(
                                session, session->rotate_timer_period);
 
@@ -3288,6 +3287,7 @@ void cmd_destroy_session_reply(const struct ltt_session *session,
                .cmd_header_size =
                        sizeof(struct lttcomm_session_destroy_command_header),
                .data_size = 0,
+               .fd_count = 0,
        };
        size_t payload_size_before_location;
 
@@ -3765,8 +3765,8 @@ enum lttng_error_code cmd_list_channels(enum lttng_domain_type domain,
 
                        channel = trace_ust_channel_to_lttng_channel(uchan);
                        if (!channel) {
-                               ret = LTTNG_ERR_NOMEM;
-                               break;
+                               ret_code = LTTNG_ERR_NOMEM;
+                               goto end;
                        }
 
                        extended = (struct lttng_channel_extended *)
@@ -3777,7 +3777,7 @@ enum lttng_error_code cmd_list_channels(enum lttng_domain_type domain,
                        if (ret < 0) {
                                lttng_channel_destroy(channel);
                                ret_code = LTTNG_ERR_UNK;
-                               break;
+                               goto end;
                        }
 
                        extended->discarded_events = discarded_events;
@@ -3785,15 +3785,15 @@ enum lttng_error_code cmd_list_channels(enum lttng_domain_type domain,
 
                        ret = lttng_channel_serialize(
                                        channel, &payload->buffer);
-                       lttng_channel_destroy(channel);
                        if (ret) {
                                ERR("Failed to serialize lttng_channel: channel name = '%s'",
                                                channel->name);
+                               lttng_channel_destroy(channel);
                                ret_code = LTTNG_ERR_UNK;
-                               ret = -1;
-                               break;
+                               goto end;
                        }
 
+                       lttng_channel_destroy(channel);
                        i++;
                }
                rcu_read_unlock();
@@ -5038,7 +5038,7 @@ static enum lttng_error_code set_relayd_for_snapshot(
        cds_lfht_for_each_entry(output->socks->ht, &iter.iter,
                        socket, node.node) {
                pthread_mutex_lock(socket->lock);
-               status = send_consumer_relayd_sockets(LTTNG_DOMAIN_NONE, session->id,
+               status = send_consumer_relayd_sockets(session->id,
                                output, socket,
                                session->name, session->hostname,
                                base_path,
@@ -5067,7 +5067,7 @@ static enum lttng_error_code record_kernel_snapshot(
                struct ltt_kernel_session *ksess,
                const struct consumer_output *output,
                const struct ltt_session *session,
-               int wait, uint64_t nb_packets_per_stream)
+               uint64_t nb_packets_per_stream)
 {
        enum lttng_error_code status;
 
@@ -5076,7 +5076,7 @@ static enum lttng_error_code record_kernel_snapshot(
        LTTNG_ASSERT(session);
 
        status = kernel_snapshot_record(
-                       ksess, output, wait, nb_packets_per_stream);
+                       ksess, output, nb_packets_per_stream);
        return status;
 }
 
@@ -5088,7 +5088,7 @@ static enum lttng_error_code record_kernel_snapshot(
 static enum lttng_error_code record_ust_snapshot(struct ltt_ust_session *usess,
                const struct consumer_output *output,
                const struct ltt_session *session,
-               int wait, uint64_t nb_packets_per_stream)
+               uint64_t nb_packets_per_stream)
 {
        enum lttng_error_code status;
 
@@ -5097,7 +5097,7 @@ static enum lttng_error_code record_ust_snapshot(struct ltt_ust_session *usess,
        LTTNG_ASSERT(session);
 
        status = ust_app_snapshot_record(
-                       usess, output, wait, nb_packets_per_stream);
+                       usess, output, nb_packets_per_stream);
        return status;
 }
 
@@ -5191,7 +5191,7 @@ int64_t get_session_nb_packets_per_stream(const struct ltt_session *session,
 
 static
 enum lttng_error_code snapshot_record(struct ltt_session *session,
-               const struct snapshot_output *snapshot_output, int wait)
+               const struct snapshot_output *snapshot_output)
 {
        int64_t nb_packets_per_stream;
        char snapshot_chunk_name[LTTNG_NAME_MAX];
@@ -5311,7 +5311,7 @@ enum lttng_error_code snapshot_record(struct ltt_session *session,
        if (session->kernel_session) {
                ret_code = record_kernel_snapshot(session->kernel_session,
                                snapshot_kernel_consumer_output, session,
-                               wait, nb_packets_per_stream);
+                               nb_packets_per_stream);
                if (ret_code != LTTNG_OK) {
                        goto error_close_trace_chunk;
                }
@@ -5320,7 +5320,7 @@ enum lttng_error_code snapshot_record(struct ltt_session *session,
        if (session->ust_session) {
                ret_code = record_ust_snapshot(session->ust_session,
                                snapshot_ust_consumer_output, session,
-                               wait, nb_packets_per_stream);
+                               nb_packets_per_stream);
                if (ret_code != LTTNG_OK) {
                        goto error_close_trace_chunk;
                }
@@ -5368,7 +5368,8 @@ error:
  * Return LTTNG_OK on success or else a LTTNG_ERR code.
  */
 int cmd_snapshot_record(struct ltt_session *session,
-               const struct lttng_snapshot_output *output, int wait)
+               const struct lttng_snapshot_output *output,
+               int wait __attribute__((unused)))
 {
        enum lttng_error_code cmd_ret = LTTNG_OK;
        int ret;
@@ -5430,7 +5431,7 @@ int cmd_snapshot_record(struct ltt_session *session,
 
                /* Use the global datetime */
                memcpy(tmp_output->datetime, datetime, sizeof(datetime));
-               cmd_ret = snapshot_record(session, tmp_output, wait);
+               cmd_ret = snapshot_record(session, tmp_output);
                if (cmd_ret != LTTNG_OK) {
                        goto error;
                }
@@ -5470,7 +5471,7 @@ int cmd_snapshot_record(struct ltt_session *session,
                                }
                        }
 
-                       cmd_ret = snapshot_record(session, &output_copy, wait);
+                       cmd_ret = snapshot_record(session, &output_copy);
                        if (cmd_ret != LTTNG_OK) {
                                rcu_read_unlock();
                                goto error;
This page took 0.026742 seconds and 4 git commands to generate.