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