2 * Copyright (C) 2013 - David Goulet <dgoulet@efficios.com>
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License, version 2 only, as
6 * published by the Free Software Foundation.
8 * This program is distributed in the hope that it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13 * You should have received a copy of the GNU General Public License along with
14 * this program; if not, write to the Free Software Foundation, Inc., 51
15 * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 #ifndef LTTNG_CONSUMER_STREAM_H
19 #define LTTNG_CONSUMER_STREAM_H
24 * Close stream's file descriptors and, if needed, close stream also on the
27 * The stream lock MUST be acquired.
28 * The consumer data lock MUST be acquired.
30 void consumer_stream_close(struct lttng_consumer_stream
*stream
);
33 * Close stream on the relayd side. This call can destroy a relayd if the
36 * A RCU read side lock MUST be acquired if the relayd object was looked up in
37 * a hash table before calling this.
39 void consumer_stream_relayd_close(struct lttng_consumer_stream
*stream
,
40 struct consumer_relayd_sock_pair
*relayd
);
43 * Delete the stream from all possible hash tables.
45 * The consumer data lock MUST be acquired.
47 void consumer_stream_delete(struct lttng_consumer_stream
*stream
,
51 * Free the given stream within a RCU call.
53 void consumer_stream_free(struct lttng_consumer_stream
*stream
);
56 * Destroy a stream completely. This will delete, close and free the stream.
57 * Once return, the stream is NO longer usable. Its channel may get destroyed
58 * if conditions are met.
60 * This MUST be called WITHOUT the consumer data and stream lock acquired.
62 void consumer_stream_destroy(struct lttng_consumer_stream
*stream
,
66 * Destroy the stream's buffers on the tracer side. This is also called in a
69 void consumer_stream_destroy_buffers(struct lttng_consumer_stream
*stream
);
72 * Write index of a specific stream either on the relayd or local disk.
74 int consumer_stream_write_index(struct lttng_consumer_stream
*stream
,
75 struct ctf_packet_index
*index
);
77 int consumer_stream_sync_metadata(struct lttng_consumer_local_data
*ctx
,
81 * Create the output files of a local stream.
83 * This must be called with the channel's and the stream's lock held.
85 int consumer_stream_create_output_files(struct lttng_consumer_stream
*stream
,
89 * Rotate the output files of a local stream. This will change the
90 * active output files of both the binary and index in accordance
91 * with the stream's configuration (stream file count).
93 * This must be called with the channel's and the stream's lock held.
95 int consumer_stream_rotate_output_files(struct lttng_consumer_stream
*stream
);
98 * Indicates whether or not a stream is logically deleted. A deleted stream
99 * should no longer be used; its existence is only garanteed by the RCU lock
100 * held by the caller.
102 * This function must be called with the RCU read side lock held.
104 bool consumer_stream_is_deleted(struct lttng_consumer_stream
*stream
);
106 #endif /* LTTNG_CONSUMER_STREAM_H */