2 * Copyright (C) 2011 EfficiOS Inc.
3 * Copyright (C) 2011 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
5 * SPDX-License-Identifier: GPL-2.0-only
9 #ifndef _LTTNG_USTCONSUMER_H
10 #define _LTTNG_USTCONSUMER_H
12 #include <common/compat/errno.hpp>
13 #include <common/consumer/consumer.hpp>
16 #ifdef HAVE_LIBLTTNG_UST_CTL
18 int lttng_ustconsumer_take_snapshot(struct lttng_consumer_stream *stream);
19 int lttng_ustconsumer_sample_snapshot_positions(
20 struct lttng_consumer_stream *stream);
22 int lttng_ustconsumer_get_produced_snapshot(
23 struct lttng_consumer_stream *stream, unsigned long *pos);
24 int lttng_ustconsumer_get_consumed_snapshot(
25 struct lttng_consumer_stream *stream, unsigned long *pos);
27 int lttng_ustconsumer_recv_cmd(struct lttng_consumer_local_data *ctx,
28 int sock, struct pollfd *consumer_sockpoll);
30 extern int lttng_ustconsumer_allocate_channel(struct lttng_consumer_channel *chan);
31 extern void lttng_ustconsumer_del_channel(struct lttng_consumer_channel *chan);
32 extern void lttng_ustconsumer_free_channel(struct lttng_consumer_channel *chan);
33 extern int lttng_ustconsumer_add_stream(struct lttng_consumer_stream *stream);
34 extern void lttng_ustconsumer_del_stream(struct lttng_consumer_stream *stream);
36 int lttng_ustconsumer_read_subbuffer(struct lttng_consumer_stream *stream,
37 struct lttng_consumer_local_data *ctx);
38 int lttng_ustconsumer_on_recv_stream(struct lttng_consumer_stream *stream);
40 void lttng_ustconsumer_on_stream_hangup(struct lttng_consumer_stream *stream);
42 int lttng_ust_flush_buffer(struct lttng_consumer_stream *stream,
44 int lttng_ustconsumer_get_stream_id(struct lttng_consumer_stream *stream,
46 int lttng_ustconsumer_data_pending(struct lttng_consumer_stream *stream);
47 void lttng_ustconsumer_close_all_metadata(struct lttng_ht *ht);
48 void lttng_ustconsumer_close_metadata(struct lttng_consumer_channel *metadata);
49 void lttng_ustconsumer_close_stream_wakeup(struct lttng_consumer_stream *stream);
50 int lttng_ustconsumer_recv_metadata(int sock, uint64_t key, uint64_t offset,
51 uint64_t len, uint64_t version,
52 struct lttng_consumer_channel *channel, int timer, int wait);
53 int lttng_ustconsumer_request_metadata(struct lttng_consumer_local_data *ctx,
54 struct lttng_consumer_channel *channel, int timer, int wait);
55 enum sync_metadata_status lttng_ustconsumer_sync_metadata(
56 struct lttng_consumer_local_data *ctx,
57 struct lttng_consumer_stream *metadata);
58 int lttng_ustconsumer_flush_buffer(struct lttng_consumer_stream *stream,
60 int lttng_ustconsumer_clear_buffer(struct lttng_consumer_stream *stream);
61 int lttng_ustconsumer_get_current_timestamp(
62 struct lttng_consumer_stream *stream, uint64_t *ts);
63 int lttng_ustconsumer_get_sequence_number(
64 struct lttng_consumer_stream *stream, uint64_t *seq);
65 void lttng_ustconsumer_sigbus_handle(void *addr);
67 #else /* HAVE_LIBLTTNG_UST_CTL */
70 ssize_t lttng_ustconsumer_on_read_subbuffer_mmap(
71 struct lttng_consumer_local_data *ctx __attribute__((unused)),
72 struct lttng_consumer_stream *stream __attribute__((unused)),
73 unsigned long len __attribute__((unused)),
74 unsigned long padding __attribute__((unused)))
80 ssize_t lttng_ustconsumer_on_read_subbuffer_splice(
81 struct lttng_consumer_local_data *ctx __attribute__((unused)),
82 struct lttng_consumer_stream *uststream __attribute__((unused)),
83 unsigned long len __attribute__((unused)),
84 unsigned long padding __attribute__((unused)))
90 int lttng_ustconsumer_take_snapshot(
91 struct lttng_consumer_stream *stream __attribute__((unused)))
97 int lttng_ustconsumer_sample_snapshot_positions(
98 struct lttng_consumer_stream *stream __attribute__((unused)))
104 int lttng_ustconsumer_get_produced_snapshot(
105 struct lttng_consumer_stream *stream __attribute__((unused)),
106 unsigned long *pos __attribute__((unused)))
112 int lttng_ustconsumer_get_consumed_snapshot(
113 struct lttng_consumer_stream *stream __attribute__((unused)),
114 unsigned long *pos __attribute__((unused)))
120 int lttng_ustconsumer_recv_cmd(
121 struct lttng_consumer_local_data *ctx __attribute__((unused)),
122 int sock __attribute__((unused)),
123 struct pollfd *consumer_sockpoll __attribute__((unused)))
129 int lttng_ustconsumer_allocate_channel(
130 struct lttng_consumer_channel *chan __attribute__((unused)))
136 void lttng_ustconsumer_del_channel(
137 struct lttng_consumer_channel *chan __attribute__((unused)))
142 void lttng_ustconsumer_free_channel(
143 struct lttng_consumer_channel *chan __attribute__((unused)))
148 int lttng_ustconsumer_add_stream(
149 struct lttng_consumer_stream *stream __attribute__((unused)))
155 void lttng_ustconsumer_del_stream(
156 struct lttng_consumer_stream *stream __attribute__((unused)))
161 int lttng_ustconsumer_read_subbuffer(
162 struct lttng_consumer_stream *stream __attribute__((unused)),
163 struct lttng_consumer_local_data *ctx __attribute__((unused)))
169 int lttng_ustconsumer_on_recv_stream(
170 struct lttng_consumer_stream *stream __attribute__((unused)))
176 void lttng_ustconsumer_on_stream_hangup(
177 struct lttng_consumer_stream *stream __attribute__((unused)))
182 int lttng_ustconsumer_data_pending(
183 struct lttng_consumer_stream *stream __attribute__((unused)))
189 int lttng_ust_flush_buffer(struct lttng_consumer_stream *stream __attribute__((unused)),
190 int producer_active __attribute__((unused)))
196 void lttng_ustconsumer_close_all_metadata(
197 struct lttng_ht *ht __attribute__((unused)))
202 void lttng_ustconsumer_close_metadata(
203 struct lttng_consumer_channel *metadata __attribute__((unused)))
207 void lttng_ustconsumer_close_stream_wakeup(
208 struct lttng_consumer_stream *stream __attribute__((unused)))
213 int lttng_ustconsumer_recv_metadata(int sock __attribute__((unused)),
214 uint64_t key __attribute__((unused)),
215 uint64_t offset __attribute__((unused)),
216 uint64_t len __attribute__((unused)),
217 uint64_t version __attribute__((unused)),
218 struct lttng_consumer_channel *channel __attribute__((unused)),
219 int timer __attribute__((unused)))
225 int lttng_ustconsumer_request_metadata(
226 struct lttng_consumer_local_data *ctx __attribute__((unused)),
227 struct lttng_consumer_channel *channel __attribute__((unused)),
228 int timer __attribute__((unused)),
229 int wait __attribute__((unused)))
235 enum sync_metadata_status lttng_ustconsumer_sync_metadata(
236 struct lttng_consumer_local_data *ctx __attribute__((unused)),
237 struct lttng_consumer_stream *metadata __attribute__((unused)))
239 return SYNC_METADATA_STATUS_ERROR;
243 int lttng_ustconsumer_flush_buffer(
244 struct lttng_consumer_stream *stream __attribute__((unused)),
245 int producer __attribute__((unused)))
251 int lttng_ustconsumer_clear_buffer(
252 struct lttng_consumer_stream *stream __attribute__((unused)))
258 int lttng_ustconsumer_get_current_timestamp(
259 struct lttng_consumer_stream *stream __attribute__((unused)),
260 uint64_t *ts __attribute__((unused)))
266 int lttng_ustconsumer_get_sequence_number(
267 struct lttng_consumer_stream *stream __attribute__((unused)),
268 uint64_t *seq __attribute__((unused)))
274 int lttng_ustconsumer_get_stream_id(
275 struct lttng_consumer_stream *stream __attribute__((unused)),
276 uint64_t *stream_id __attribute__((unused)))
282 void lttng_ustconsumer_sigbus_handle(
283 void *addr __attribute__((unused)))
286 #endif /* HAVE_LIBLTTNG_UST_CTL */
288 #endif /* _LTTNG_USTCONSUMER_H */