2 * Copyright (C) 2013 David Goulet <dgoulet@efficios.com>
4 * SPDX-License-Identifier: GPL-2.0-only
8 #ifndef LTTNG_CONSUMER_STREAM_H
9 #define LTTNG_CONSUMER_STREAM_H
14 * Close stream's file descriptors and, if needed, close stream also on the
17 * The stream lock MUST be acquired.
18 * The consumer data lock MUST be acquired.
20 void consumer_stream_close(struct lttng_consumer_stream
*stream
);
23 * Close stream on the relayd side. This call can destroy a relayd if the
26 * A RCU read side lock MUST be acquired if the relayd object was looked up in
27 * a hash table before calling this.
29 void consumer_stream_relayd_close(struct lttng_consumer_stream
*stream
,
30 struct consumer_relayd_sock_pair
*relayd
);
33 * Delete the stream from all possible hash tables.
35 * The consumer data lock MUST be acquired.
37 void consumer_stream_delete(struct lttng_consumer_stream
*stream
,
41 * Free the given stream within a RCU call.
43 void consumer_stream_free(struct lttng_consumer_stream
*stream
);
46 * Destroy a stream completely. This will delete, close and free the stream.
47 * Once return, the stream is NO longer usable. Its channel may get destroyed
48 * if conditions are met.
50 * This MUST be called WITHOUT the consumer data and stream lock acquired.
52 void consumer_stream_destroy(struct lttng_consumer_stream
*stream
,
56 * Destroy the stream's buffers on the tracer side. This is also called in a
59 void consumer_stream_destroy_buffers(struct lttng_consumer_stream
*stream
);
62 * Write index of a specific stream either on the relayd or local disk.
64 int consumer_stream_write_index(struct lttng_consumer_stream
*stream
,
65 struct ctf_packet_index
*index
);
67 int consumer_stream_sync_metadata(struct lttng_consumer_local_data
*ctx
,
71 * Create the output files of a local stream.
73 * This must be called with the channel's and the stream's lock held.
75 int consumer_stream_create_output_files(struct lttng_consumer_stream
*stream
,
79 * Rotate the output files of a local stream. This will change the
80 * active output files of both the binary and index in accordance
81 * with the stream's configuration (stream file count).
83 * This must be called with the channel's and the stream's lock held.
85 int consumer_stream_rotate_output_files(struct lttng_consumer_stream
*stream
);
88 * Indicates whether or not a stream is logically deleted. A deleted stream
89 * should no longer be used; its existence is only garanteed by the RCU lock
92 * This function must be called with the RCU read side lock held.
94 bool consumer_stream_is_deleted(struct lttng_consumer_stream
*stream
);
96 #endif /* LTTNG_CONSUMER_STREAM_H */