X-Git-Url: https://git.liburcu.org/?a=blobdiff_plain;f=src%2Fcommon%2Fconsumer%2Fconsumer-stream.cpp;h=33f97c77e66a2e074718ad8ce81b8073c3abe7e8;hb=0114db0ec2407029052eb61a0189c9b1cd64d520;hp=f9807cb0173f4bf6f4a7c0e9f838afb4631c16ec;hpb=6653fca60fdb6bf4ea4781bfee8304832d6a7e83;p=lttng-tools.git diff --git a/src/common/consumer/consumer-stream.cpp b/src/common/consumer/consumer-stream.cpp index f9807cb01..33f97c77e 100644 --- a/src/common/consumer/consumer-stream.cpp +++ b/src/common/consumer/consumer-stream.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2011 Julien Desfossez + * Copyright (C) 2011 EfficiOS Inc. * Copyright (C) 2011 Mathieu Desnoyers * Copyright (C) 2013 David Goulet * @@ -12,22 +12,22 @@ #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "consumer-stream.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#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, <tng_ht_node_u64::head); struct lttng_consumer_stream *stream = - caa_container_of(node, struct lttng_consumer_stream, node); + lttng::utils::container_of(node, <tng_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(); if (stream == NULL) { PERROR("malloc struct lttng_consumer_stream"); ret = -ENOMEM; @@ -669,6 +669,7 @@ struct lttng_consumer_stream *consumer_stream_create( goto error; } + stream->send_node = CDS_LIST_HEAD_INIT(stream->send_node); stream->chan = channel; stream->key = stream_key; stream->trace_chunk = trace_chunk; @@ -1060,6 +1061,8 @@ void consumer_stream_destroy(struct lttng_consumer_stream *stream, { LTTNG_ASSERT(stream); + cds_list_del_init(&stream->send_node); + /* Stream is in monitor mode. */ if (stream->monitor) { struct lttng_consumer_channel *free_chan = NULL; @@ -1092,6 +1095,7 @@ void consumer_stream_destroy(struct lttng_consumer_stream *stream, * If the stream is not visible globally, this needs to be done * outside of the consumer data lock section. */ + destroy_close_stream(stream); free_chan = unref_channel(stream); } @@ -1270,7 +1274,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) {