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 void lttng_ustconsumer_del_channel(struct lttng_consumer_channel *chan);
31 extern void lttng_ustconsumer_free_channel(struct lttng_consumer_channel *chan);
32 extern int lttng_ustconsumer_add_stream(struct lttng_consumer_stream *stream);
33 extern void lttng_ustconsumer_del_stream(struct lttng_consumer_stream *stream);
35 int lttng_ustconsumer_read_subbuffer(struct lttng_consumer_stream *stream,
36 struct lttng_consumer_local_data *ctx);
37 int lttng_ustconsumer_on_recv_stream(struct lttng_consumer_stream *stream);
39 void lttng_ustconsumer_on_stream_hangup(struct lttng_consumer_stream *stream);
41 int lttng_ust_flush_buffer(struct lttng_consumer_stream *stream,
43 int lttng_ustconsumer_get_stream_id(struct lttng_consumer_stream *stream,
45 int lttng_ustconsumer_data_pending(struct lttng_consumer_stream *stream);
46 void lttng_ustconsumer_close_all_metadata(struct lttng_ht *ht);
47 void lttng_ustconsumer_close_metadata(struct lttng_consumer_channel *metadata);
48 void lttng_ustconsumer_close_stream_wakeup(struct lttng_consumer_stream *stream);
49 int lttng_ustconsumer_recv_metadata(int sock, uint64_t key, uint64_t offset,
50 uint64_t len, uint64_t version,
51 struct lttng_consumer_channel *channel, int timer, int wait);
52 int lttng_ustconsumer_request_metadata(struct lttng_consumer_local_data *ctx,
53 struct lttng_consumer_channel *channel, int timer, int wait);
54 enum sync_metadata_status lttng_ustconsumer_sync_metadata(
55 struct lttng_consumer_local_data *ctx,
56 struct lttng_consumer_stream *metadata);
57 int lttng_ustconsumer_flush_buffer(struct lttng_consumer_stream *stream,
59 int lttng_ustconsumer_clear_buffer(struct lttng_consumer_stream *stream);
60 int lttng_ustconsumer_get_current_timestamp(
61 struct lttng_consumer_stream *stream, uint64_t *ts);
62 int lttng_ustconsumer_get_sequence_number(
63 struct lttng_consumer_stream *stream, uint64_t *seq);
64 void lttng_ustconsumer_sigbus_handle(void *addr);
66 #else /* HAVE_LIBLTTNG_UST_CTL */
69 ssize_t lttng_ustconsumer_on_read_subbuffer_mmap(
70 struct lttng_consumer_local_data *ctx __attribute__((unused)),
71 struct lttng_consumer_stream *stream __attribute__((unused)),
72 unsigned long len __attribute__((unused)),
73 unsigned long padding __attribute__((unused)))
79 ssize_t lttng_ustconsumer_on_read_subbuffer_splice(
80 struct lttng_consumer_local_data *ctx __attribute__((unused)),
81 struct lttng_consumer_stream *uststream __attribute__((unused)),
82 unsigned long len __attribute__((unused)),
83 unsigned long padding __attribute__((unused)))
89 int lttng_ustconsumer_take_snapshot(
90 struct lttng_consumer_stream *stream __attribute__((unused)))
96 int lttng_ustconsumer_sample_snapshot_positions(
97 struct lttng_consumer_stream *stream __attribute__((unused)))
103 int lttng_ustconsumer_get_produced_snapshot(
104 struct lttng_consumer_stream *stream __attribute__((unused)),
105 unsigned long *pos __attribute__((unused)))
111 int lttng_ustconsumer_get_consumed_snapshot(
112 struct lttng_consumer_stream *stream __attribute__((unused)),
113 unsigned long *pos __attribute__((unused)))
119 int lttng_ustconsumer_recv_cmd(
120 struct lttng_consumer_local_data *ctx __attribute__((unused)),
121 int sock __attribute__((unused)),
122 struct pollfd *consumer_sockpoll __attribute__((unused)))
128 void lttng_ustconsumer_del_channel(
129 struct lttng_consumer_channel *chan __attribute__((unused)))
134 void lttng_ustconsumer_free_channel(
135 struct lttng_consumer_channel *chan __attribute__((unused)))
140 int lttng_ustconsumer_add_stream(
141 struct lttng_consumer_stream *stream __attribute__((unused)))
147 void lttng_ustconsumer_del_stream(
148 struct lttng_consumer_stream *stream __attribute__((unused)))
153 int lttng_ustconsumer_read_subbuffer(
154 struct lttng_consumer_stream *stream __attribute__((unused)),
155 struct lttng_consumer_local_data *ctx __attribute__((unused)))
161 int lttng_ustconsumer_on_recv_stream(
162 struct lttng_consumer_stream *stream __attribute__((unused)))
168 void lttng_ustconsumer_on_stream_hangup(
169 struct lttng_consumer_stream *stream __attribute__((unused)))
174 int lttng_ustconsumer_data_pending(
175 struct lttng_consumer_stream *stream __attribute__((unused)))
181 int lttng_ust_flush_buffer(struct lttng_consumer_stream *stream __attribute__((unused)),
182 int producer_active __attribute__((unused)))
188 void lttng_ustconsumer_close_all_metadata(
189 struct lttng_ht *ht __attribute__((unused)))
194 void lttng_ustconsumer_close_metadata(
195 struct lttng_consumer_channel *metadata __attribute__((unused)))
199 void lttng_ustconsumer_close_stream_wakeup(
200 struct lttng_consumer_stream *stream __attribute__((unused)))
205 int lttng_ustconsumer_recv_metadata(int sock __attribute__((unused)),
206 uint64_t key __attribute__((unused)),
207 uint64_t offset __attribute__((unused)),
208 uint64_t len __attribute__((unused)),
209 uint64_t version __attribute__((unused)),
210 struct lttng_consumer_channel *channel __attribute__((unused)),
211 int timer __attribute__((unused)))
217 int lttng_ustconsumer_request_metadata(
218 struct lttng_consumer_local_data *ctx __attribute__((unused)),
219 struct lttng_consumer_channel *channel __attribute__((unused)),
220 int timer __attribute__((unused)),
221 int wait __attribute__((unused)))
227 enum sync_metadata_status lttng_ustconsumer_sync_metadata(
228 struct lttng_consumer_local_data *ctx __attribute__((unused)),
229 struct lttng_consumer_stream *metadata __attribute__((unused)))
231 return SYNC_METADATA_STATUS_ERROR;
235 int lttng_ustconsumer_flush_buffer(
236 struct lttng_consumer_stream *stream __attribute__((unused)),
237 int producer __attribute__((unused)))
243 int lttng_ustconsumer_clear_buffer(
244 struct lttng_consumer_stream *stream __attribute__((unused)))
250 int lttng_ustconsumer_get_current_timestamp(
251 struct lttng_consumer_stream *stream __attribute__((unused)),
252 uint64_t *ts __attribute__((unused)))
258 int lttng_ustconsumer_get_sequence_number(
259 struct lttng_consumer_stream *stream __attribute__((unused)),
260 uint64_t *seq __attribute__((unused)))
266 int lttng_ustconsumer_get_stream_id(
267 struct lttng_consumer_stream *stream __attribute__((unused)),
268 uint64_t *stream_id __attribute__((unused)))
274 void lttng_ustconsumer_sigbus_handle(
275 void *addr __attribute__((unused)))
278 #endif /* HAVE_LIBLTTNG_UST_CTL */
280 #endif /* _LTTNG_USTCONSUMER_H */