1996a5b51572a137f13c8806db9ead70f949a4cb
[lttng-tools.git] / src / common / ust-consumer / ust-consumer.hpp
1 /*
2 * Copyright (C) 2011 EfficiOS Inc.
3 * Copyright (C) 2011 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
4 *
5 * SPDX-License-Identifier: GPL-2.0-only
6 *
7 */
8
9 #ifndef _LTTNG_USTCONSUMER_H
10 #define _LTTNG_USTCONSUMER_H
11
12 #include <common/compat/errno.hpp>
13 #include <common/consumer/consumer.hpp>
14 #include <stdbool.h>
15
16 #ifdef HAVE_LIBLTTNG_UST_CTL
17
18 int lttng_ustconsumer_take_snapshot(struct lttng_consumer_stream *stream);
19 int lttng_ustconsumer_sample_snapshot_positions(
20 struct lttng_consumer_stream *stream);
21
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);
26
27 int lttng_ustconsumer_recv_cmd(struct lttng_consumer_local_data *ctx,
28 int sock, struct pollfd *consumer_sockpoll);
29
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);
34
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);
38
39 void lttng_ustconsumer_on_stream_hangup(struct lttng_consumer_stream *stream);
40
41 int lttng_ust_flush_buffer(struct lttng_consumer_stream *stream,
42 int producer_active);
43 int lttng_ustconsumer_get_stream_id(struct lttng_consumer_stream *stream,
44 uint64_t *stream_id);
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,
58 int producer);
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);
65
66 #else /* HAVE_LIBLTTNG_UST_CTL */
67
68 static inline
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)))
74 {
75 return -ENOSYS;
76 }
77
78 static inline
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)))
84 {
85 return -ENOSYS;
86 }
87
88 static inline
89 int lttng_ustconsumer_take_snapshot(
90 struct lttng_consumer_stream *stream __attribute__((unused)))
91 {
92 return -ENOSYS;
93 }
94
95 static inline
96 int lttng_ustconsumer_sample_snapshot_positions(
97 struct lttng_consumer_stream *stream __attribute__((unused)))
98 {
99 return -ENOSYS;
100 }
101
102 static inline
103 int lttng_ustconsumer_get_produced_snapshot(
104 struct lttng_consumer_stream *stream __attribute__((unused)),
105 unsigned long *pos __attribute__((unused)))
106 {
107 return -ENOSYS;
108 }
109
110 static inline
111 int lttng_ustconsumer_get_consumed_snapshot(
112 struct lttng_consumer_stream *stream __attribute__((unused)),
113 unsigned long *pos __attribute__((unused)))
114 {
115 return -ENOSYS;
116 }
117
118 static inline
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)))
123 {
124 return -ENOSYS;
125 }
126
127 static inline
128 void lttng_ustconsumer_del_channel(
129 struct lttng_consumer_channel *chan __attribute__((unused)))
130 {
131 }
132
133 static inline
134 void lttng_ustconsumer_free_channel(
135 struct lttng_consumer_channel *chan __attribute__((unused)))
136 {
137 }
138
139 static inline
140 int lttng_ustconsumer_add_stream(
141 struct lttng_consumer_stream *stream __attribute__((unused)))
142 {
143 return -ENOSYS;
144 }
145
146 static inline
147 void lttng_ustconsumer_del_stream(
148 struct lttng_consumer_stream *stream __attribute__((unused)))
149 {
150 }
151
152 static inline
153 int lttng_ustconsumer_read_subbuffer(
154 struct lttng_consumer_stream *stream __attribute__((unused)),
155 struct lttng_consumer_local_data *ctx __attribute__((unused)))
156 {
157 return -ENOSYS;
158 }
159
160 static inline
161 int lttng_ustconsumer_on_recv_stream(
162 struct lttng_consumer_stream *stream __attribute__((unused)))
163 {
164 return -ENOSYS;
165 }
166
167 static inline
168 void lttng_ustconsumer_on_stream_hangup(
169 struct lttng_consumer_stream *stream __attribute__((unused)))
170 {
171 }
172
173 static inline
174 int lttng_ustconsumer_data_pending(
175 struct lttng_consumer_stream *stream __attribute__((unused)))
176 {
177 return -ENOSYS;
178 }
179
180 static inline
181 int lttng_ust_flush_buffer(struct lttng_consumer_stream *stream __attribute__((unused)),
182 int producer_active __attribute__((unused)))
183 {
184 return -ENOSYS;
185 }
186
187 static inline
188 void lttng_ustconsumer_close_all_metadata(
189 struct lttng_ht *ht __attribute__((unused)))
190 {
191 }
192
193 static inline
194 void lttng_ustconsumer_close_metadata(
195 struct lttng_consumer_channel *metadata __attribute__((unused)))
196 {
197 }
198 static inline
199 void lttng_ustconsumer_close_stream_wakeup(
200 struct lttng_consumer_stream *stream __attribute__((unused)))
201 {
202 }
203
204 static inline
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)))
212 {
213 return -ENOSYS;
214 }
215
216 static inline
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)))
222 {
223 return -ENOSYS;
224 }
225
226 static inline
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)))
230 {
231 return SYNC_METADATA_STATUS_ERROR;
232 }
233
234 static inline
235 int lttng_ustconsumer_flush_buffer(
236 struct lttng_consumer_stream *stream __attribute__((unused)),
237 int producer __attribute__((unused)))
238 {
239 return -ENOSYS;
240 }
241
242 static inline
243 int lttng_ustconsumer_clear_buffer(
244 struct lttng_consumer_stream *stream __attribute__((unused)))
245 {
246 return -ENOSYS;
247 }
248
249 static inline
250 int lttng_ustconsumer_get_current_timestamp(
251 struct lttng_consumer_stream *stream __attribute__((unused)),
252 uint64_t *ts __attribute__((unused)))
253 {
254 return -ENOSYS;
255 }
256
257 static inline
258 int lttng_ustconsumer_get_sequence_number(
259 struct lttng_consumer_stream *stream __attribute__((unused)),
260 uint64_t *seq __attribute__((unused)))
261 {
262 return -ENOSYS;
263 }
264
265 static inline
266 int lttng_ustconsumer_get_stream_id(
267 struct lttng_consumer_stream *stream __attribute__((unused)),
268 uint64_t *stream_id __attribute__((unused)))
269 {
270 return -ENOSYS;
271 }
272
273 static inline
274 void lttng_ustconsumer_sigbus_handle(
275 void *addr __attribute__((unused)))
276 {
277 }
278 #endif /* HAVE_LIBLTTNG_UST_CTL */
279
280 #endif /* _LTTNG_USTCONSUMER_H */
This page took 0.035781 seconds and 4 git commands to generate.