Commit | Line | Data |
---|---|---|
3bd1e081 | 1 | /* |
ab5be9fa MJ |
2 | * Copyright (C) 2011 Julien Desfossez <julien.desfossez@polymtl.ca> |
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 | |
97535efa SM |
16 | #ifdef __cplusplus |
17 | extern "C" { | |
18 | #endif | |
19 | ||
74d0b642 | 20 | #ifdef HAVE_LIBLTTNG_UST_CTL |
3bd1e081 | 21 | |
ffe60014 | 22 | int lttng_ustconsumer_take_snapshot(struct lttng_consumer_stream *stream); |
e9404c27 JG |
23 | int lttng_ustconsumer_sample_snapshot_positions( |
24 | struct lttng_consumer_stream *stream); | |
3bd1e081 | 25 | |
3bd1e081 | 26 | int lttng_ustconsumer_get_produced_snapshot( |
ffe60014 | 27 | struct lttng_consumer_stream *stream, unsigned long *pos); |
10a50311 JD |
28 | int lttng_ustconsumer_get_consumed_snapshot( |
29 | struct lttng_consumer_stream *stream, unsigned long *pos); | |
3bd1e081 MD |
30 | |
31 | int lttng_ustconsumer_recv_cmd(struct lttng_consumer_local_data *ctx, | |
32 | int sock, struct pollfd *consumer_sockpoll); | |
33 | ||
34 | extern int lttng_ustconsumer_allocate_channel(struct lttng_consumer_channel *chan); | |
35 | extern void lttng_ustconsumer_del_channel(struct lttng_consumer_channel *chan); | |
b83e03c4 | 36 | extern void lttng_ustconsumer_free_channel(struct lttng_consumer_channel *chan); |
e316aad5 | 37 | extern int lttng_ustconsumer_add_stream(struct lttng_consumer_stream *stream); |
3bd1e081 MD |
38 | extern void lttng_ustconsumer_del_stream(struct lttng_consumer_stream *stream); |
39 | ||
d41f73b7 | 40 | int lttng_ustconsumer_read_subbuffer(struct lttng_consumer_stream *stream, |
d2956687 | 41 | struct lttng_consumer_local_data *ctx); |
d41f73b7 MD |
42 | int lttng_ustconsumer_on_recv_stream(struct lttng_consumer_stream *stream); |
43 | ||
d056b477 MD |
44 | void lttng_ustconsumer_on_stream_hangup(struct lttng_consumer_stream *stream); |
45 | ||
881fc67f MD |
46 | int lttng_ust_flush_buffer(struct lttng_consumer_stream *stream, |
47 | int producer_active); | |
48 | int lttng_ustconsumer_get_stream_id(struct lttng_consumer_stream *stream, | |
49 | uint64_t *stream_id); | |
6d805429 | 50 | int lttng_ustconsumer_data_pending(struct lttng_consumer_stream *stream); |
6d574024 DG |
51 | void lttng_ustconsumer_close_all_metadata(struct lttng_ht *ht); |
52 | void lttng_ustconsumer_close_metadata(struct lttng_consumer_channel *metadata); | |
d8ef542d | 53 | void lttng_ustconsumer_close_stream_wakeup(struct lttng_consumer_stream *stream); |
331744e3 | 54 | int lttng_ustconsumer_recv_metadata(int sock, uint64_t key, uint64_t offset, |
93ec662e JD |
55 | uint64_t len, uint64_t version, |
56 | struct lttng_consumer_channel *channel, int timer, int wait); | |
331744e3 | 57 | int lttng_ustconsumer_request_metadata(struct lttng_consumer_local_data *ctx, |
94d49140 | 58 | struct lttng_consumer_channel *channel, int timer, int wait); |
577eea73 JG |
59 | enum sync_metadata_status lttng_ustconsumer_sync_metadata( |
60 | struct lttng_consumer_local_data *ctx, | |
94d49140 | 61 | struct lttng_consumer_stream *metadata); |
881fc67f | 62 | int lttng_ustconsumer_flush_buffer(struct lttng_consumer_stream *stream, |
84a182ce | 63 | int producer); |
881fc67f | 64 | int lttng_ustconsumer_clear_buffer(struct lttng_consumer_stream *stream); |
84a182ce DG |
65 | int lttng_ustconsumer_get_current_timestamp( |
66 | struct lttng_consumer_stream *stream, uint64_t *ts); | |
fb83fe64 JD |
67 | int lttng_ustconsumer_get_sequence_number( |
68 | struct lttng_consumer_stream *stream, uint64_t *seq); | |
881fc67f | 69 | void lttng_ustconsumer_sigbus_handle(void *addr); |
f02e1e8a | 70 | |
74d0b642 | 71 | #else /* HAVE_LIBLTTNG_UST_CTL */ |
3bd1e081 MD |
72 | |
73 | static inline | |
4078b776 | 74 | ssize_t lttng_ustconsumer_on_read_subbuffer_mmap( |
3bd1e081 | 75 | struct lttng_consumer_local_data *ctx, |
1d4dfdef DG |
76 | struct lttng_consumer_stream *stream, unsigned long len, |
77 | unsigned long padding) | |
3bd1e081 MD |
78 | { |
79 | return -ENOSYS; | |
80 | } | |
81 | ||
82 | static inline | |
4078b776 | 83 | ssize_t lttng_ustconsumer_on_read_subbuffer_splice( |
3bd1e081 | 84 | struct lttng_consumer_local_data *ctx, |
1d4dfdef DG |
85 | struct lttng_consumer_stream *uststream, unsigned long len, |
86 | unsigned long padding) | |
3bd1e081 MD |
87 | { |
88 | return -ENOSYS; | |
89 | } | |
90 | ||
91 | static inline | |
ffe60014 | 92 | int lttng_ustconsumer_take_snapshot(struct lttng_consumer_stream *stream) |
3bd1e081 MD |
93 | { |
94 | return -ENOSYS; | |
95 | } | |
96 | ||
e9404c27 JG |
97 | static inline |
98 | int lttng_ustconsumer_sample_snapshot_positions( | |
99 | struct lttng_consumer_stream *stream) | |
100 | { | |
101 | return -ENOSYS; | |
102 | } | |
103 | ||
3bd1e081 MD |
104 | static inline |
105 | int lttng_ustconsumer_get_produced_snapshot( | |
ffe60014 | 106 | struct lttng_consumer_stream *stream, unsigned long *pos) |
3bd1e081 MD |
107 | { |
108 | return -ENOSYS; | |
109 | } | |
110 | ||
e9404c27 JG |
111 | static inline |
112 | int lttng_ustconsumer_get_consumed_snapshot( | |
113 | struct lttng_consumer_stream *stream, unsigned long *pos) | |
114 | { | |
115 | return -ENOSYS; | |
116 | } | |
117 | ||
3bd1e081 MD |
118 | static inline |
119 | int lttng_ustconsumer_recv_cmd(struct lttng_consumer_local_data *ctx, | |
fbc72522 DG |
120 | int sock, struct pollfd *consumer_sockpoll) |
121 | { | |
122 | return -ENOSYS; | |
123 | } | |
3bd1e081 MD |
124 | |
125 | static inline | |
126 | int lttng_ustconsumer_allocate_channel(struct lttng_consumer_channel *chan) | |
127 | { | |
128 | return -ENOSYS; | |
129 | } | |
130 | ||
131 | static inline | |
132 | void lttng_ustconsumer_del_channel(struct lttng_consumer_channel *chan) | |
133 | { | |
134 | } | |
135 | ||
b83e03c4 MD |
136 | static inline |
137 | void lttng_ustconsumer_free_channel(struct lttng_consumer_channel *chan) | |
138 | { | |
139 | } | |
140 | ||
3bd1e081 | 141 | static inline |
e316aad5 | 142 | int lttng_ustconsumer_add_stream(struct lttng_consumer_stream *stream) |
3bd1e081 MD |
143 | { |
144 | return -ENOSYS; | |
145 | } | |
146 | ||
147 | static inline | |
148 | void lttng_ustconsumer_del_stream(struct lttng_consumer_stream *stream) | |
149 | { | |
150 | } | |
151 | ||
d41f73b7 MD |
152 | static inline |
153 | int lttng_ustconsumer_read_subbuffer(struct lttng_consumer_stream *stream, | |
d2956687 | 154 | struct lttng_consumer_local_data *ctx) |
d41f73b7 MD |
155 | { |
156 | return -ENOSYS; | |
157 | } | |
158 | ||
159 | static inline | |
160 | int lttng_ustconsumer_on_recv_stream(struct lttng_consumer_stream *stream) | |
161 | { | |
162 | return -ENOSYS; | |
163 | } | |
164 | ||
d056b477 MD |
165 | static inline |
166 | void lttng_ustconsumer_on_stream_hangup(struct lttng_consumer_stream *stream) | |
167 | { | |
168 | } | |
169 | ||
ca22feea | 170 | static inline |
6d805429 | 171 | int lttng_ustconsumer_data_pending(struct lttng_consumer_stream *stream) |
ca22feea DG |
172 | { |
173 | return -ENOSYS; | |
174 | } | |
ffe60014 | 175 | static inline |
881fc67f | 176 | int lttng_ust_flush_buffer(struct lttng_consumer_stream *stream, |
fc6d7a51 JD |
177 | int producer_active) |
178 | { | |
881fc67f | 179 | return -ENOSYS; |
fc6d7a51 JD |
180 | } |
181 | static inline | |
6d574024 DG |
182 | void lttng_ustconsumer_close_all_metadata(struct lttng_ht *ht) |
183 | { | |
184 | } | |
185 | static inline | |
186 | void lttng_ustconsumer_close_metadata(struct lttng_consumer_channel *metadata) | |
d88aee68 DG |
187 | { |
188 | } | |
d8ef542d MD |
189 | static inline |
190 | void lttng_ustconsumer_close_stream_wakeup(struct lttng_consumer_stream *stream) | |
191 | { | |
192 | } | |
ee69440b DG |
193 | static inline |
194 | int lttng_ustconsumer_recv_metadata(int sock, uint64_t key, uint64_t offset, | |
93ec662e JD |
195 | uint64_t len, uint64_t version, |
196 | struct lttng_consumer_channel *channel, int timer) | |
ee69440b DG |
197 | { |
198 | return -ENOSYS; | |
199 | } | |
200 | static inline | |
ee69440b | 201 | int lttng_ustconsumer_request_metadata(struct lttng_consumer_local_data *ctx, |
84a182ce | 202 | struct lttng_consumer_channel *channel, int timer, int wait) |
ee69440b DG |
203 | { |
204 | return -ENOSYS; | |
205 | } | |
94d49140 | 206 | static inline |
577eea73 | 207 | enum sync_metadata_status lttng_ustconsumer_sync_metadata(struct lttng_consumer_local_data *ctx, |
94d49140 JD |
208 | struct lttng_consumer_stream *metadata) |
209 | { | |
577eea73 | 210 | return SYNC_METADATA_STATUS_ERROR; |
94d49140 | 211 | } |
84a182ce | 212 | static inline |
881fc67f | 213 | int lttng_ustconsumer_flush_buffer(struct lttng_consumer_stream *stream, |
84a182ce DG |
214 | int producer) |
215 | { | |
881fc67f | 216 | return -ENOSYS; |
84a182ce DG |
217 | } |
218 | static inline | |
881fc67f | 219 | int lttng_ustconsumer_clear_buffer(struct lttng_consumer_stream *stream) |
214f70e0 | 220 | { |
881fc67f | 221 | return -ENOSYS; |
214f70e0 JR |
222 | } |
223 | static inline | |
84a182ce DG |
224 | int lttng_ustconsumer_get_current_timestamp( |
225 | struct lttng_consumer_stream *stream, uint64_t *ts) | |
226 | { | |
227 | return -ENOSYS; | |
228 | } | |
a31c9f22 | 229 | static inline |
fb83fe64 JD |
230 | int lttng_ustconsumer_get_sequence_number( |
231 | struct lttng_consumer_stream *stream, uint64_t *seq) | |
232 | { | |
233 | return -ENOSYS; | |
234 | } | |
70190e1c DG |
235 | static inline |
236 | int lttng_ustconsumer_get_stream_id(struct lttng_consumer_stream *stream, | |
237 | uint64_t *stream_id) | |
238 | { | |
239 | return -ENOSYS; | |
240 | } | |
881fc67f MD |
241 | static inline |
242 | void lttng_ustconsumer_sigbus_handle(void *addr) | |
243 | { | |
244 | } | |
74d0b642 | 245 | #endif /* HAVE_LIBLTTNG_UST_CTL */ |
3bd1e081 | 246 | |
97535efa SM |
247 | #ifdef __cplusplus |
248 | } | |
249 | #endif | |
250 | ||
3bd1e081 | 251 | #endif /* _LTTNG_USTCONSUMER_H */ |