Fix: sessiond: size-based rotation threshold exceeded in per-pid tracing (2/2)
[lttng-tools.git] / src / common / consumer / consumer-stream.cpp
index c24ea6bca60762dcab04d8ddc147c7608276c60e..bb0ec0a2436db1a9fb042b29b1e53b622c2eb60e 100644 (file)
 #include <sys/mman.h>
 #include <unistd.h>
 
-#include <common/common.h>
-#include <common/consumer/consumer-timer.h>
-#include <common/consumer/consumer-timer.h>
-#include <common/consumer/consumer.h>
-#include <common/consumer/consumer.h>
-#include <common/consumer/metadata-bucket.h>
-#include <common/consumer/metadata-bucket.h>
-#include <common/index/index.h>
-#include <common/kernel-consumer/kernel-consumer.h>
-#include <common/kernel-ctl/kernel-ctl.h>
-#include <common/macros.h>
-#include <common/relayd/relayd.h>
-#include <common/ust-consumer/ust-consumer.h>
-#include <common/utils.h>
-
-#include "consumer-stream.h"
+#include <common/common.hpp>
+#include <common/consumer/consumer-timer.hpp>
+#include <common/consumer/consumer-timer.hpp>
+#include <common/consumer/consumer.hpp>
+#include <common/consumer/consumer.hpp>
+#include <common/consumer/metadata-bucket.hpp>
+#include <common/consumer/metadata-bucket.hpp>
+#include <common/index/index.hpp>
+#include <common/kernel-consumer/kernel-consumer.hpp>
+#include <common/kernel-ctl/kernel-ctl.hpp>
+#include <common/macros.hpp>
+#include <common/relayd/relayd.hpp>
+#include <common/ust-consumer/ust-consumer.hpp>
+#include <common/utils.hpp>
+
+#include "consumer-stream.hpp"
 
 /*
  * RCU call to free stream. MUST only be used with call_rcu().
@@ -35,9 +35,9 @@
 static void free_stream_rcu(struct rcu_head *head)
 {
        struct lttng_ht_node_u64 *node =
-               caa_container_of(head, struct lttng_ht_node_u64, head);
+               lttng::utils::container_of(head, &lttng_ht_node_u64::head);
        struct lttng_consumer_stream *stream =
-               caa_container_of(node, struct lttng_consumer_stream, node);
+               lttng::utils::container_of(node, &lttng_consumer_stream::node);
 
        pthread_mutex_destroy(&stream->lock);
        free(stream);
@@ -160,7 +160,7 @@ void ctf_packet_index_populate(struct ctf_packet_index *index,
 }
 
 static ssize_t consumer_stream_consume_mmap(
-               struct lttng_consumer_local_data *ctx,
+               struct lttng_consumer_local_data *ctx __attribute__((unused)),
                struct lttng_consumer_stream *stream,
                const struct stream_subbuffer *subbuffer)
 {
@@ -231,7 +231,7 @@ static ssize_t consumer_stream_consume_splice(
 static int consumer_stream_send_index(
                struct lttng_consumer_stream *stream,
                const struct stream_subbuffer *subbuffer,
-               struct lttng_consumer_local_data *ctx)
+               struct lttng_consumer_local_data *ctx __attribute__((unused)))
 {
        off_t packet_offset = 0;
        struct ctf_packet_index index = {};
@@ -591,8 +591,8 @@ end:
  */
 static
 int post_consume_open_new_packet(struct lttng_consumer_stream *stream,
-               const struct stream_subbuffer *subbuffer,
-               struct lttng_consumer_local_data *ctx)
+               const struct stream_subbuffer *subbuffer __attribute__((unused)),
+               struct lttng_consumer_local_data *ctx __attribute__((unused)))
 {
        int ret = 0;
 
@@ -654,7 +654,7 @@ struct lttng_consumer_stream *consumer_stream_create(
        int ret;
        struct lttng_consumer_stream *stream;
 
-       stream = (lttng_consumer_stream *) zmalloc(sizeof(*stream));
+       stream = zmalloc<lttng_consumer_stream>();
        if (stream == NULL) {
                PERROR("malloc struct lttng_consumer_stream");
                ret = -ENOMEM;
@@ -1075,10 +1075,12 @@ void consumer_stream_destroy(struct lttng_consumer_stream *stream,
                if (stream->globally_visible) {
                        pthread_mutex_lock(&the_consumer_data.lock);
                        pthread_mutex_lock(&stream->chan->lock);
+
                        pthread_mutex_lock(&stream->lock);
                        /* Remove every reference of the stream in the consumer. */
                        consumer_stream_delete(stream, ht);
 
+
                        destroy_close_stream(stream);
 
                        /* Update channel's refcount of the stream. */
@@ -1274,7 +1276,7 @@ end:
 }
 
 static ssize_t metadata_bucket_consume(
-               struct lttng_consumer_local_data *unused,
+               struct lttng_consumer_local_data *unused __attribute__((unused)),
                struct lttng_consumer_stream *stream,
                const struct stream_subbuffer *subbuffer)
 {
This page took 0.024728 seconds and 4 git commands to generate.