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 | ||
c9e313bc SM |
12 | #include <common/compat/errno.hpp> |
13 | #include <common/consumer/consumer.hpp> | |
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 | ||
3bd1e081 | 30 | extern void lttng_ustconsumer_del_channel(struct lttng_consumer_channel *chan); |
b83e03c4 | 31 | extern void lttng_ustconsumer_free_channel(struct lttng_consumer_channel *chan); |
e316aad5 | 32 | extern int lttng_ustconsumer_add_stream(struct lttng_consumer_stream *stream); |
3bd1e081 MD |
33 | extern void lttng_ustconsumer_del_stream(struct lttng_consumer_stream *stream); |
34 | ||
d41f73b7 | 35 | int lttng_ustconsumer_read_subbuffer(struct lttng_consumer_stream *stream, |
d2956687 | 36 | struct lttng_consumer_local_data *ctx); |
d41f73b7 MD |
37 | int lttng_ustconsumer_on_recv_stream(struct lttng_consumer_stream *stream); |
38 | ||
d056b477 MD |
39 | void lttng_ustconsumer_on_stream_hangup(struct lttng_consumer_stream *stream); |
40 | ||
881fc67f MD |
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); | |
6d805429 | 45 | int lttng_ustconsumer_data_pending(struct lttng_consumer_stream *stream); |
6d574024 DG |
46 | void lttng_ustconsumer_close_all_metadata(struct lttng_ht *ht); |
47 | void lttng_ustconsumer_close_metadata(struct lttng_consumer_channel *metadata); | |
d8ef542d | 48 | void lttng_ustconsumer_close_stream_wakeup(struct lttng_consumer_stream *stream); |
331744e3 | 49 | int lttng_ustconsumer_recv_metadata(int sock, uint64_t key, uint64_t offset, |
93ec662e JD |
50 | uint64_t len, uint64_t version, |
51 | struct lttng_consumer_channel *channel, int timer, int wait); | |
331744e3 | 52 | int lttng_ustconsumer_request_metadata(struct lttng_consumer_local_data *ctx, |
94d49140 | 53 | struct lttng_consumer_channel *channel, int timer, int wait); |
577eea73 JG |
54 | enum sync_metadata_status lttng_ustconsumer_sync_metadata( |
55 | struct lttng_consumer_local_data *ctx, | |
94d49140 | 56 | struct lttng_consumer_stream *metadata); |
881fc67f | 57 | int lttng_ustconsumer_flush_buffer(struct lttng_consumer_stream *stream, |
84a182ce | 58 | int producer); |
881fc67f | 59 | int lttng_ustconsumer_clear_buffer(struct lttng_consumer_stream *stream); |
84a182ce DG |
60 | int lttng_ustconsumer_get_current_timestamp( |
61 | struct lttng_consumer_stream *stream, uint64_t *ts); | |
fb83fe64 JD |
62 | int lttng_ustconsumer_get_sequence_number( |
63 | struct lttng_consumer_stream *stream, uint64_t *seq); | |
881fc67f | 64 | void lttng_ustconsumer_sigbus_handle(void *addr); |
f02e1e8a | 65 | |
74d0b642 | 66 | #else /* HAVE_LIBLTTNG_UST_CTL */ |
3bd1e081 MD |
67 | |
68 | static inline | |
4078b776 | 69 | ssize_t lttng_ustconsumer_on_read_subbuffer_mmap( |
f46376a1 MJ |
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))) | |
3bd1e081 MD |
74 | { |
75 | return -ENOSYS; | |
76 | } | |
77 | ||
78 | static inline | |
4078b776 | 79 | ssize_t lttng_ustconsumer_on_read_subbuffer_splice( |
f46376a1 MJ |
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))) | |
3bd1e081 MD |
84 | { |
85 | return -ENOSYS; | |
86 | } | |
87 | ||
88 | static inline | |
f46376a1 MJ |
89 | int lttng_ustconsumer_take_snapshot( |
90 | struct lttng_consumer_stream *stream __attribute__((unused))) | |
3bd1e081 MD |
91 | { |
92 | return -ENOSYS; | |
93 | } | |
94 | ||
e9404c27 JG |
95 | static inline |
96 | int lttng_ustconsumer_sample_snapshot_positions( | |
f46376a1 | 97 | struct lttng_consumer_stream *stream __attribute__((unused))) |
e9404c27 JG |
98 | { |
99 | return -ENOSYS; | |
100 | } | |
101 | ||
3bd1e081 MD |
102 | static inline |
103 | int lttng_ustconsumer_get_produced_snapshot( | |
f46376a1 MJ |
104 | struct lttng_consumer_stream *stream __attribute__((unused)), |
105 | unsigned long *pos __attribute__((unused))) | |
3bd1e081 MD |
106 | { |
107 | return -ENOSYS; | |
108 | } | |
109 | ||
e9404c27 JG |
110 | static inline |
111 | int lttng_ustconsumer_get_consumed_snapshot( | |
f46376a1 MJ |
112 | struct lttng_consumer_stream *stream __attribute__((unused)), |
113 | unsigned long *pos __attribute__((unused))) | |
e9404c27 JG |
114 | { |
115 | return -ENOSYS; | |
116 | } | |
117 | ||
3bd1e081 | 118 | static inline |
f46376a1 MJ |
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))) | |
fbc72522 DG |
123 | { |
124 | return -ENOSYS; | |
125 | } | |
3bd1e081 | 126 | |
3bd1e081 | 127 | static inline |
f46376a1 MJ |
128 | void lttng_ustconsumer_del_channel( |
129 | struct lttng_consumer_channel *chan __attribute__((unused))) | |
3bd1e081 MD |
130 | { |
131 | } | |
132 | ||
b83e03c4 | 133 | static inline |
f46376a1 MJ |
134 | void lttng_ustconsumer_free_channel( |
135 | struct lttng_consumer_channel *chan __attribute__((unused))) | |
b83e03c4 MD |
136 | { |
137 | } | |
138 | ||
3bd1e081 | 139 | static inline |
f46376a1 MJ |
140 | int lttng_ustconsumer_add_stream( |
141 | struct lttng_consumer_stream *stream __attribute__((unused))) | |
3bd1e081 MD |
142 | { |
143 | return -ENOSYS; | |
144 | } | |
145 | ||
146 | static inline | |
f46376a1 MJ |
147 | void lttng_ustconsumer_del_stream( |
148 | struct lttng_consumer_stream *stream __attribute__((unused))) | |
3bd1e081 MD |
149 | { |
150 | } | |
151 | ||
d41f73b7 | 152 | static inline |
f46376a1 MJ |
153 | int lttng_ustconsumer_read_subbuffer( |
154 | struct lttng_consumer_stream *stream __attribute__((unused)), | |
155 | struct lttng_consumer_local_data *ctx __attribute__((unused))) | |
d41f73b7 MD |
156 | { |
157 | return -ENOSYS; | |
158 | } | |
159 | ||
160 | static inline | |
f46376a1 MJ |
161 | int lttng_ustconsumer_on_recv_stream( |
162 | struct lttng_consumer_stream *stream __attribute__((unused))) | |
d41f73b7 MD |
163 | { |
164 | return -ENOSYS; | |
165 | } | |
166 | ||
d056b477 | 167 | static inline |
f46376a1 MJ |
168 | void lttng_ustconsumer_on_stream_hangup( |
169 | struct lttng_consumer_stream *stream __attribute__((unused))) | |
d056b477 MD |
170 | { |
171 | } | |
172 | ||
ca22feea | 173 | static inline |
f46376a1 MJ |
174 | int lttng_ustconsumer_data_pending( |
175 | struct lttng_consumer_stream *stream __attribute__((unused))) | |
ca22feea DG |
176 | { |
177 | return -ENOSYS; | |
178 | } | |
f46376a1 | 179 | |
ffe60014 | 180 | static inline |
f46376a1 MJ |
181 | int lttng_ust_flush_buffer(struct lttng_consumer_stream *stream __attribute__((unused)), |
182 | int producer_active __attribute__((unused))) | |
fc6d7a51 | 183 | { |
881fc67f | 184 | return -ENOSYS; |
fc6d7a51 | 185 | } |
f46376a1 | 186 | |
fc6d7a51 | 187 | static inline |
f46376a1 MJ |
188 | void lttng_ustconsumer_close_all_metadata( |
189 | struct lttng_ht *ht __attribute__((unused))) | |
6d574024 DG |
190 | { |
191 | } | |
f46376a1 | 192 | |
6d574024 | 193 | static inline |
f46376a1 MJ |
194 | void lttng_ustconsumer_close_metadata( |
195 | struct lttng_consumer_channel *metadata __attribute__((unused))) | |
d88aee68 DG |
196 | { |
197 | } | |
d8ef542d | 198 | static inline |
f46376a1 MJ |
199 | void lttng_ustconsumer_close_stream_wakeup( |
200 | struct lttng_consumer_stream *stream __attribute__((unused))) | |
d8ef542d MD |
201 | { |
202 | } | |
f46376a1 | 203 | |
ee69440b | 204 | static inline |
f46376a1 MJ |
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))) | |
ee69440b DG |
212 | { |
213 | return -ENOSYS; | |
214 | } | |
f46376a1 | 215 | |
ee69440b | 216 | static inline |
f46376a1 MJ |
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))) | |
ee69440b DG |
222 | { |
223 | return -ENOSYS; | |
224 | } | |
f46376a1 | 225 | |
94d49140 | 226 | static inline |
f46376a1 MJ |
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))) | |
94d49140 | 230 | { |
577eea73 | 231 | return SYNC_METADATA_STATUS_ERROR; |
94d49140 | 232 | } |
f46376a1 | 233 | |
84a182ce | 234 | static inline |
f46376a1 MJ |
235 | int lttng_ustconsumer_flush_buffer( |
236 | struct lttng_consumer_stream *stream __attribute__((unused)), | |
237 | int producer __attribute__((unused))) | |
84a182ce | 238 | { |
881fc67f | 239 | return -ENOSYS; |
84a182ce | 240 | } |
f46376a1 | 241 | |
84a182ce | 242 | static inline |
f46376a1 MJ |
243 | int lttng_ustconsumer_clear_buffer( |
244 | struct lttng_consumer_stream *stream __attribute__((unused))) | |
214f70e0 | 245 | { |
881fc67f | 246 | return -ENOSYS; |
214f70e0 | 247 | } |
f46376a1 | 248 | |
214f70e0 | 249 | static inline |
84a182ce | 250 | int lttng_ustconsumer_get_current_timestamp( |
f46376a1 MJ |
251 | struct lttng_consumer_stream *stream __attribute__((unused)), |
252 | uint64_t *ts __attribute__((unused))) | |
84a182ce DG |
253 | { |
254 | return -ENOSYS; | |
255 | } | |
f46376a1 | 256 | |
a31c9f22 | 257 | static inline |
fb83fe64 | 258 | int lttng_ustconsumer_get_sequence_number( |
f46376a1 MJ |
259 | struct lttng_consumer_stream *stream __attribute__((unused)), |
260 | uint64_t *seq __attribute__((unused))) | |
fb83fe64 JD |
261 | { |
262 | return -ENOSYS; | |
263 | } | |
f46376a1 | 264 | |
70190e1c | 265 | static inline |
f46376a1 MJ |
266 | int lttng_ustconsumer_get_stream_id( |
267 | struct lttng_consumer_stream *stream __attribute__((unused)), | |
268 | uint64_t *stream_id __attribute__((unused))) | |
70190e1c DG |
269 | { |
270 | return -ENOSYS; | |
271 | } | |
f46376a1 | 272 | |
881fc67f | 273 | static inline |
f46376a1 MJ |
274 | void lttng_ustconsumer_sigbus_handle( |
275 | void *addr __attribute__((unused))) | |
881fc67f MD |
276 | { |
277 | } | |
74d0b642 | 278 | #endif /* HAVE_LIBLTTNG_UST_CTL */ |
3bd1e081 MD |
279 | |
280 | #endif /* _LTTNG_USTCONSUMER_H */ |