Commit | Line | Data |
---|---|---|
3bd1e081 | 1 | /* |
21cf9b6b | 2 | * Copyright (C) 2011 EfficiOS Inc. |
ab5be9fa | 3 | * Copyright (C) 2011 Mathieu Desnoyers <mathieu.desnoyers@efficios.com> |
3bd1e081 | 4 | * |
ab5be9fa | 5 | * SPDX-License-Identifier: GPL-2.0-only |
3bd1e081 | 6 | * |
3bd1e081 MD |
7 | */ |
8 | ||
9 | #ifndef _LTTNG_USTCONSUMER_H | |
10 | #define _LTTNG_USTCONSUMER_H | |
11 | ||
edf4b93e | 12 | #include <common/compat/errno.h> |
c8fea79c | 13 | #include <common/consumer/consumer.h> |
02d02e31 | 14 | #include <stdbool.h> |
10a8a223 | 15 | |
74d0b642 | 16 | #ifdef HAVE_LIBLTTNG_UST_CTL |
3bd1e081 | 17 | |
ffe60014 | 18 | int lttng_ustconsumer_take_snapshot(struct lttng_consumer_stream *stream); |
e9404c27 JG |
19 | int lttng_ustconsumer_sample_snapshot_positions( |
20 | struct lttng_consumer_stream *stream); | |
3bd1e081 | 21 | |
3bd1e081 | 22 | int lttng_ustconsumer_get_produced_snapshot( |
ffe60014 | 23 | struct lttng_consumer_stream *stream, unsigned long *pos); |
10a50311 JD |
24 | int lttng_ustconsumer_get_consumed_snapshot( |
25 | struct lttng_consumer_stream *stream, unsigned long *pos); | |
3bd1e081 MD |
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); | |
b83e03c4 | 32 | extern void lttng_ustconsumer_free_channel(struct lttng_consumer_channel *chan); |
e316aad5 | 33 | extern int lttng_ustconsumer_add_stream(struct lttng_consumer_stream *stream); |
3bd1e081 MD |
34 | extern void lttng_ustconsumer_del_stream(struct lttng_consumer_stream *stream); |
35 | ||
d41f73b7 | 36 | int lttng_ustconsumer_read_subbuffer(struct lttng_consumer_stream *stream, |
d2956687 | 37 | struct lttng_consumer_local_data *ctx); |
d41f73b7 MD |
38 | int lttng_ustconsumer_on_recv_stream(struct lttng_consumer_stream *stream); |
39 | ||
d056b477 MD |
40 | void lttng_ustconsumer_on_stream_hangup(struct lttng_consumer_stream *stream); |
41 | ||
881fc67f MD |
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); | |
6d805429 | 46 | int lttng_ustconsumer_data_pending(struct lttng_consumer_stream *stream); |
6d574024 DG |
47 | void lttng_ustconsumer_close_all_metadata(struct lttng_ht *ht); |
48 | void lttng_ustconsumer_close_metadata(struct lttng_consumer_channel *metadata); | |
d8ef542d | 49 | void lttng_ustconsumer_close_stream_wakeup(struct lttng_consumer_stream *stream); |
331744e3 | 50 | int lttng_ustconsumer_recv_metadata(int sock, uint64_t key, uint64_t offset, |
93ec662e JD |
51 | uint64_t len, uint64_t version, |
52 | struct lttng_consumer_channel *channel, int timer, int wait); | |
331744e3 | 53 | int lttng_ustconsumer_request_metadata(struct lttng_consumer_local_data *ctx, |
94d49140 | 54 | struct lttng_consumer_channel *channel, int timer, int wait); |
577eea73 JG |
55 | enum sync_metadata_status lttng_ustconsumer_sync_metadata( |
56 | struct lttng_consumer_local_data *ctx, | |
94d49140 | 57 | struct lttng_consumer_stream *metadata); |
881fc67f | 58 | int lttng_ustconsumer_flush_buffer(struct lttng_consumer_stream *stream, |
84a182ce | 59 | int producer); |
881fc67f | 60 | int lttng_ustconsumer_clear_buffer(struct lttng_consumer_stream *stream); |
84a182ce DG |
61 | int lttng_ustconsumer_get_current_timestamp( |
62 | struct lttng_consumer_stream *stream, uint64_t *ts); | |
fb83fe64 JD |
63 | int lttng_ustconsumer_get_sequence_number( |
64 | struct lttng_consumer_stream *stream, uint64_t *seq); | |
881fc67f | 65 | void lttng_ustconsumer_sigbus_handle(void *addr); |
f02e1e8a | 66 | |
74d0b642 | 67 | #else /* HAVE_LIBLTTNG_UST_CTL */ |
3bd1e081 MD |
68 | |
69 | static inline | |
4078b776 | 70 | ssize_t lttng_ustconsumer_on_read_subbuffer_mmap( |
f46376a1 MJ |
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))) | |
3bd1e081 MD |
75 | { |
76 | return -ENOSYS; | |
77 | } | |
78 | ||
79 | static inline | |
4078b776 | 80 | ssize_t lttng_ustconsumer_on_read_subbuffer_splice( |
f46376a1 MJ |
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))) | |
3bd1e081 MD |
85 | { |
86 | return -ENOSYS; | |
87 | } | |
88 | ||
89 | static inline | |
f46376a1 MJ |
90 | int lttng_ustconsumer_take_snapshot( |
91 | struct lttng_consumer_stream *stream __attribute__((unused))) | |
3bd1e081 MD |
92 | { |
93 | return -ENOSYS; | |
94 | } | |
95 | ||
e9404c27 JG |
96 | static inline |
97 | int lttng_ustconsumer_sample_snapshot_positions( | |
f46376a1 | 98 | struct lttng_consumer_stream *stream __attribute__((unused))) |
e9404c27 JG |
99 | { |
100 | return -ENOSYS; | |
101 | } | |
102 | ||
3bd1e081 MD |
103 | static inline |
104 | int lttng_ustconsumer_get_produced_snapshot( | |
f46376a1 MJ |
105 | struct lttng_consumer_stream *stream __attribute__((unused)), |
106 | unsigned long *pos __attribute__((unused))) | |
3bd1e081 MD |
107 | { |
108 | return -ENOSYS; | |
109 | } | |
110 | ||
e9404c27 JG |
111 | static inline |
112 | int lttng_ustconsumer_get_consumed_snapshot( | |
f46376a1 MJ |
113 | struct lttng_consumer_stream *stream __attribute__((unused)), |
114 | unsigned long *pos __attribute__((unused))) | |
e9404c27 JG |
115 | { |
116 | return -ENOSYS; | |
117 | } | |
118 | ||
3bd1e081 | 119 | static inline |
f46376a1 MJ |
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))) | |
fbc72522 DG |
124 | { |
125 | return -ENOSYS; | |
126 | } | |
3bd1e081 MD |
127 | |
128 | static inline | |
f46376a1 MJ |
129 | int lttng_ustconsumer_allocate_channel( |
130 | struct lttng_consumer_channel *chan __attribute__((unused))) | |
3bd1e081 MD |
131 | { |
132 | return -ENOSYS; | |
133 | } | |
134 | ||
135 | static inline | |
f46376a1 MJ |
136 | void lttng_ustconsumer_del_channel( |
137 | struct lttng_consumer_channel *chan __attribute__((unused))) | |
3bd1e081 MD |
138 | { |
139 | } | |
140 | ||
b83e03c4 | 141 | static inline |
f46376a1 MJ |
142 | void lttng_ustconsumer_free_channel( |
143 | struct lttng_consumer_channel *chan __attribute__((unused))) | |
b83e03c4 MD |
144 | { |
145 | } | |
146 | ||
3bd1e081 | 147 | static inline |
f46376a1 MJ |
148 | int lttng_ustconsumer_add_stream( |
149 | struct lttng_consumer_stream *stream __attribute__((unused))) | |
3bd1e081 MD |
150 | { |
151 | return -ENOSYS; | |
152 | } | |
153 | ||
154 | static inline | |
f46376a1 MJ |
155 | void lttng_ustconsumer_del_stream( |
156 | struct lttng_consumer_stream *stream __attribute__((unused))) | |
3bd1e081 MD |
157 | { |
158 | } | |
159 | ||
d41f73b7 | 160 | static inline |
f46376a1 MJ |
161 | int lttng_ustconsumer_read_subbuffer( |
162 | struct lttng_consumer_stream *stream __attribute__((unused)), | |
163 | struct lttng_consumer_local_data *ctx __attribute__((unused))) | |
d41f73b7 MD |
164 | { |
165 | return -ENOSYS; | |
166 | } | |
167 | ||
168 | static inline | |
f46376a1 MJ |
169 | int lttng_ustconsumer_on_recv_stream( |
170 | struct lttng_consumer_stream *stream __attribute__((unused))) | |
d41f73b7 MD |
171 | { |
172 | return -ENOSYS; | |
173 | } | |
174 | ||
d056b477 | 175 | static inline |
f46376a1 MJ |
176 | void lttng_ustconsumer_on_stream_hangup( |
177 | struct lttng_consumer_stream *stream __attribute__((unused))) | |
d056b477 MD |
178 | { |
179 | } | |
180 | ||
ca22feea | 181 | static inline |
f46376a1 MJ |
182 | int lttng_ustconsumer_data_pending( |
183 | struct lttng_consumer_stream *stream __attribute__((unused))) | |
ca22feea DG |
184 | { |
185 | return -ENOSYS; | |
186 | } | |
f46376a1 | 187 | |
ffe60014 | 188 | static inline |
f46376a1 MJ |
189 | int lttng_ust_flush_buffer(struct lttng_consumer_stream *stream __attribute__((unused)), |
190 | int producer_active __attribute__((unused))) | |
fc6d7a51 | 191 | { |
881fc67f | 192 | return -ENOSYS; |
fc6d7a51 | 193 | } |
f46376a1 | 194 | |
fc6d7a51 | 195 | static inline |
f46376a1 MJ |
196 | void lttng_ustconsumer_close_all_metadata( |
197 | struct lttng_ht *ht __attribute__((unused))) | |
6d574024 DG |
198 | { |
199 | } | |
f46376a1 | 200 | |
6d574024 | 201 | static inline |
f46376a1 MJ |
202 | void lttng_ustconsumer_close_metadata( |
203 | struct lttng_consumer_channel *metadata __attribute__((unused))) | |
d88aee68 DG |
204 | { |
205 | } | |
d8ef542d | 206 | static inline |
f46376a1 MJ |
207 | void lttng_ustconsumer_close_stream_wakeup( |
208 | struct lttng_consumer_stream *stream __attribute__((unused))) | |
d8ef542d MD |
209 | { |
210 | } | |
f46376a1 | 211 | |
ee69440b | 212 | static inline |
f46376a1 MJ |
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))) | |
ee69440b DG |
220 | { |
221 | return -ENOSYS; | |
222 | } | |
f46376a1 | 223 | |
ee69440b | 224 | static inline |
f46376a1 MJ |
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))) | |
ee69440b DG |
230 | { |
231 | return -ENOSYS; | |
232 | } | |
f46376a1 | 233 | |
94d49140 | 234 | static inline |
f46376a1 MJ |
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))) | |
94d49140 | 238 | { |
577eea73 | 239 | return SYNC_METADATA_STATUS_ERROR; |
94d49140 | 240 | } |
f46376a1 | 241 | |
84a182ce | 242 | static inline |
f46376a1 MJ |
243 | int lttng_ustconsumer_flush_buffer( |
244 | struct lttng_consumer_stream *stream __attribute__((unused)), | |
245 | int producer __attribute__((unused))) | |
84a182ce | 246 | { |
881fc67f | 247 | return -ENOSYS; |
84a182ce | 248 | } |
f46376a1 | 249 | |
84a182ce | 250 | static inline |
f46376a1 MJ |
251 | int lttng_ustconsumer_clear_buffer( |
252 | struct lttng_consumer_stream *stream __attribute__((unused))) | |
214f70e0 | 253 | { |
881fc67f | 254 | return -ENOSYS; |
214f70e0 | 255 | } |
f46376a1 | 256 | |
214f70e0 | 257 | static inline |
84a182ce | 258 | int lttng_ustconsumer_get_current_timestamp( |
f46376a1 MJ |
259 | struct lttng_consumer_stream *stream __attribute__((unused)), |
260 | uint64_t *ts __attribute__((unused))) | |
84a182ce DG |
261 | { |
262 | return -ENOSYS; | |
263 | } | |
f46376a1 | 264 | |
a31c9f22 | 265 | static inline |
fb83fe64 | 266 | int lttng_ustconsumer_get_sequence_number( |
f46376a1 MJ |
267 | struct lttng_consumer_stream *stream __attribute__((unused)), |
268 | uint64_t *seq __attribute__((unused))) | |
fb83fe64 JD |
269 | { |
270 | return -ENOSYS; | |
271 | } | |
f46376a1 | 272 | |
70190e1c | 273 | static inline |
f46376a1 MJ |
274 | int lttng_ustconsumer_get_stream_id( |
275 | struct lttng_consumer_stream *stream __attribute__((unused)), | |
276 | uint64_t *stream_id __attribute__((unused))) | |
70190e1c DG |
277 | { |
278 | return -ENOSYS; | |
279 | } | |
f46376a1 | 280 | |
881fc67f | 281 | static inline |
f46376a1 MJ |
282 | void lttng_ustconsumer_sigbus_handle( |
283 | void *addr __attribute__((unused))) | |
881fc67f MD |
284 | { |
285 | } | |
74d0b642 | 286 | #endif /* HAVE_LIBLTTNG_UST_CTL */ |
3bd1e081 MD |
287 | |
288 | #endif /* _LTTNG_USTCONSUMER_H */ |