Clean-up: sessiond: cmd_enable_channel_internal
[lttng-tools.git] / src / common / ust-consumer / ust-consumer.h
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.h>
13 #include <common/consumer/consumer.h>
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 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);
35
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);
39
40 void lttng_ustconsumer_on_stream_hangup(struct lttng_consumer_stream *stream);
41
42 int lttng_ust_flush_buffer(struct lttng_consumer_stream *stream,
43 int producer_active);
44 int lttng_ustconsumer_get_stream_id(struct lttng_consumer_stream *stream,
45 uint64_t *stream_id);
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,
59 int producer);
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);
66
67 #else /* HAVE_LIBLTTNG_UST_CTL */
68
69 static inline
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)))
75 {
76 return -ENOSYS;
77 }
78
79 static inline
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)))
85 {
86 return -ENOSYS;
87 }
88
89 static inline
90 int lttng_ustconsumer_take_snapshot(
91 struct lttng_consumer_stream *stream __attribute__((unused)))
92 {
93 return -ENOSYS;
94 }
95
96 static inline
97 int lttng_ustconsumer_sample_snapshot_positions(
98 struct lttng_consumer_stream *stream __attribute__((unused)))
99 {
100 return -ENOSYS;
101 }
102
103 static inline
104 int lttng_ustconsumer_get_produced_snapshot(
105 struct lttng_consumer_stream *stream __attribute__((unused)),
106 unsigned long *pos __attribute__((unused)))
107 {
108 return -ENOSYS;
109 }
110
111 static inline
112 int lttng_ustconsumer_get_consumed_snapshot(
113 struct lttng_consumer_stream *stream __attribute__((unused)),
114 unsigned long *pos __attribute__((unused)))
115 {
116 return -ENOSYS;
117 }
118
119 static inline
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)))
124 {
125 return -ENOSYS;
126 }
127
128 static inline
129 int lttng_ustconsumer_allocate_channel(
130 struct lttng_consumer_channel *chan __attribute__((unused)))
131 {
132 return -ENOSYS;
133 }
134
135 static inline
136 void lttng_ustconsumer_del_channel(
137 struct lttng_consumer_channel *chan __attribute__((unused)))
138 {
139 }
140
141 static inline
142 void lttng_ustconsumer_free_channel(
143 struct lttng_consumer_channel *chan __attribute__((unused)))
144 {
145 }
146
147 static inline
148 int lttng_ustconsumer_add_stream(
149 struct lttng_consumer_stream *stream __attribute__((unused)))
150 {
151 return -ENOSYS;
152 }
153
154 static inline
155 void lttng_ustconsumer_del_stream(
156 struct lttng_consumer_stream *stream __attribute__((unused)))
157 {
158 }
159
160 static inline
161 int lttng_ustconsumer_read_subbuffer(
162 struct lttng_consumer_stream *stream __attribute__((unused)),
163 struct lttng_consumer_local_data *ctx __attribute__((unused)))
164 {
165 return -ENOSYS;
166 }
167
168 static inline
169 int lttng_ustconsumer_on_recv_stream(
170 struct lttng_consumer_stream *stream __attribute__((unused)))
171 {
172 return -ENOSYS;
173 }
174
175 static inline
176 void lttng_ustconsumer_on_stream_hangup(
177 struct lttng_consumer_stream *stream __attribute__((unused)))
178 {
179 }
180
181 static inline
182 int lttng_ustconsumer_data_pending(
183 struct lttng_consumer_stream *stream __attribute__((unused)))
184 {
185 return -ENOSYS;
186 }
187
188 static inline
189 int lttng_ust_flush_buffer(struct lttng_consumer_stream *stream __attribute__((unused)),
190 int producer_active __attribute__((unused)))
191 {
192 return -ENOSYS;
193 }
194
195 static inline
196 void lttng_ustconsumer_close_all_metadata(
197 struct lttng_ht *ht __attribute__((unused)))
198 {
199 }
200
201 static inline
202 void lttng_ustconsumer_close_metadata(
203 struct lttng_consumer_channel *metadata __attribute__((unused)))
204 {
205 }
206 static inline
207 void lttng_ustconsumer_close_stream_wakeup(
208 struct lttng_consumer_stream *stream __attribute__((unused)))
209 {
210 }
211
212 static inline
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)))
220 {
221 return -ENOSYS;
222 }
223
224 static inline
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)))
230 {
231 return -ENOSYS;
232 }
233
234 static inline
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)))
238 {
239 return SYNC_METADATA_STATUS_ERROR;
240 }
241
242 static inline
243 int lttng_ustconsumer_flush_buffer(
244 struct lttng_consumer_stream *stream __attribute__((unused)),
245 int producer __attribute__((unused)))
246 {
247 return -ENOSYS;
248 }
249
250 static inline
251 int lttng_ustconsumer_clear_buffer(
252 struct lttng_consumer_stream *stream __attribute__((unused)))
253 {
254 return -ENOSYS;
255 }
256
257 static inline
258 int lttng_ustconsumer_get_current_timestamp(
259 struct lttng_consumer_stream *stream __attribute__((unused)),
260 uint64_t *ts __attribute__((unused)))
261 {
262 return -ENOSYS;
263 }
264
265 static inline
266 int lttng_ustconsumer_get_sequence_number(
267 struct lttng_consumer_stream *stream __attribute__((unused)),
268 uint64_t *seq __attribute__((unused)))
269 {
270 return -ENOSYS;
271 }
272
273 static inline
274 int lttng_ustconsumer_get_stream_id(
275 struct lttng_consumer_stream *stream __attribute__((unused)),
276 uint64_t *stream_id __attribute__((unused)))
277 {
278 return -ENOSYS;
279 }
280
281 static inline
282 void lttng_ustconsumer_sigbus_handle(
283 void *addr __attribute__((unused)))
284 {
285 }
286 #endif /* HAVE_LIBLTTNG_UST_CTL */
287
288 #endif /* _LTTNG_USTCONSUMER_H */
This page took 0.034677 seconds and 4 git commands to generate.