Commit | Line | Data |
---|---|---|
3bd1e081 MD |
1 | /* |
2 | * Copyright (C) 2011 - Julien Desfossez <julien.desfossez@polymtl.ca> | |
3 | * Copyright (C) 2011 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com> | |
4 | * | |
d14d33bf AM |
5 | * This program is free software; you can redistribute it and/or modify |
6 | * it under the terms of the GNU General Public License, version 2 only, | |
7 | * as published by the Free Software Foundation. | |
3bd1e081 MD |
8 | * |
9 | * This program is distributed in the hope that it will be useful, | |
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
d14d33bf | 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3bd1e081 MD |
12 | * GNU General Public License for more details. |
13 | * | |
d14d33bf AM |
14 | * You should have received a copy of the GNU General Public License along |
15 | * with this program; if not, write to the Free Software Foundation, Inc., | |
16 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | |
3bd1e081 MD |
17 | */ |
18 | ||
19 | #ifndef _LTTNG_USTCONSUMER_H | |
20 | #define _LTTNG_USTCONSUMER_H | |
21 | ||
3bd1e081 MD |
22 | #include <errno.h> |
23 | ||
c8fea79c | 24 | #include <common/consumer/consumer.h> |
02d02e31 | 25 | #include <stdbool.h> |
10a8a223 | 26 | |
74d0b642 | 27 | #ifdef HAVE_LIBLTTNG_UST_CTL |
3bd1e081 | 28 | |
ffe60014 | 29 | int lttng_ustconsumer_take_snapshot(struct lttng_consumer_stream *stream); |
e9404c27 JG |
30 | int lttng_ustconsumer_sample_snapshot_positions( |
31 | struct lttng_consumer_stream *stream); | |
3bd1e081 | 32 | |
3bd1e081 | 33 | int lttng_ustconsumer_get_produced_snapshot( |
ffe60014 | 34 | struct lttng_consumer_stream *stream, unsigned long *pos); |
10a50311 JD |
35 | int lttng_ustconsumer_get_consumed_snapshot( |
36 | struct lttng_consumer_stream *stream, unsigned long *pos); | |
3bd1e081 MD |
37 | |
38 | int lttng_ustconsumer_recv_cmd(struct lttng_consumer_local_data *ctx, | |
39 | int sock, struct pollfd *consumer_sockpoll); | |
40 | ||
41 | extern int lttng_ustconsumer_allocate_channel(struct lttng_consumer_channel *chan); | |
42 | extern void lttng_ustconsumer_del_channel(struct lttng_consumer_channel *chan); | |
b83e03c4 | 43 | extern void lttng_ustconsumer_free_channel(struct lttng_consumer_channel *chan); |
e316aad5 | 44 | extern int lttng_ustconsumer_add_stream(struct lttng_consumer_stream *stream); |
3bd1e081 MD |
45 | extern void lttng_ustconsumer_del_stream(struct lttng_consumer_stream *stream); |
46 | ||
d41f73b7 | 47 | int lttng_ustconsumer_read_subbuffer(struct lttng_consumer_stream *stream, |
d2956687 | 48 | struct lttng_consumer_local_data *ctx); |
d41f73b7 MD |
49 | int lttng_ustconsumer_on_recv_stream(struct lttng_consumer_stream *stream); |
50 | ||
d056b477 MD |
51 | void lttng_ustconsumer_on_stream_hangup(struct lttng_consumer_stream *stream); |
52 | ||
ffe60014 DG |
53 | int lttng_ustctl_get_mmap_read_offset(struct lttng_consumer_stream *stream, |
54 | unsigned long *off); | |
55 | void *lttng_ustctl_get_mmap_base(struct lttng_consumer_stream *stream); | |
fc6d7a51 JD |
56 | void lttng_ustctl_flush_buffer(struct lttng_consumer_stream *stream, |
57 | int producer_active); | |
70190e1c DG |
58 | int lttng_ustconsumer_get_stream_id(struct lttng_consumer_stream *stream, |
59 | uint64_t *stream_id); | |
6d805429 | 60 | int lttng_ustconsumer_data_pending(struct lttng_consumer_stream *stream); |
6d574024 DG |
61 | void lttng_ustconsumer_close_all_metadata(struct lttng_ht *ht); |
62 | void lttng_ustconsumer_close_metadata(struct lttng_consumer_channel *metadata); | |
d8ef542d | 63 | void lttng_ustconsumer_close_stream_wakeup(struct lttng_consumer_stream *stream); |
331744e3 | 64 | int lttng_ustconsumer_recv_metadata(int sock, uint64_t key, uint64_t offset, |
93ec662e JD |
65 | uint64_t len, uint64_t version, |
66 | struct lttng_consumer_channel *channel, int timer, int wait); | |
331744e3 | 67 | int lttng_ustconsumer_request_metadata(struct lttng_consumer_local_data *ctx, |
94d49140 JD |
68 | struct lttng_consumer_channel *channel, int timer, int wait); |
69 | int lttng_ustconsumer_sync_metadata(struct lttng_consumer_local_data *ctx, | |
70 | struct lttng_consumer_stream *metadata); | |
84a182ce DG |
71 | void lttng_ustconsumer_flush_buffer(struct lttng_consumer_stream *stream, |
72 | int producer); | |
214f70e0 | 73 | void lttng_ustconsumer_clear_buffer(struct lttng_consumer_stream *stream); |
84a182ce DG |
74 | int lttng_ustconsumer_get_current_timestamp( |
75 | struct lttng_consumer_stream *stream, uint64_t *ts); | |
fb83fe64 JD |
76 | int lttng_ustconsumer_get_sequence_number( |
77 | struct lttng_consumer_stream *stream, uint64_t *seq); | |
f02e1e8a | 78 | |
74d0b642 | 79 | #else /* HAVE_LIBLTTNG_UST_CTL */ |
3bd1e081 MD |
80 | |
81 | static inline | |
4078b776 | 82 | ssize_t lttng_ustconsumer_on_read_subbuffer_mmap( |
3bd1e081 | 83 | struct lttng_consumer_local_data *ctx, |
1d4dfdef DG |
84 | struct lttng_consumer_stream *stream, unsigned long len, |
85 | unsigned long padding) | |
3bd1e081 MD |
86 | { |
87 | return -ENOSYS; | |
88 | } | |
89 | ||
90 | static inline | |
4078b776 | 91 | ssize_t lttng_ustconsumer_on_read_subbuffer_splice( |
3bd1e081 | 92 | struct lttng_consumer_local_data *ctx, |
1d4dfdef DG |
93 | struct lttng_consumer_stream *uststream, unsigned long len, |
94 | unsigned long padding) | |
3bd1e081 MD |
95 | { |
96 | return -ENOSYS; | |
97 | } | |
98 | ||
99 | static inline | |
ffe60014 | 100 | int lttng_ustconsumer_take_snapshot(struct lttng_consumer_stream *stream) |
3bd1e081 MD |
101 | { |
102 | return -ENOSYS; | |
103 | } | |
104 | ||
e9404c27 JG |
105 | static inline |
106 | int lttng_ustconsumer_sample_snapshot_positions( | |
107 | struct lttng_consumer_stream *stream) | |
108 | { | |
109 | return -ENOSYS; | |
110 | } | |
111 | ||
3bd1e081 MD |
112 | static inline |
113 | int lttng_ustconsumer_get_produced_snapshot( | |
ffe60014 | 114 | struct lttng_consumer_stream *stream, unsigned long *pos) |
3bd1e081 MD |
115 | { |
116 | return -ENOSYS; | |
117 | } | |
118 | ||
e9404c27 JG |
119 | static inline |
120 | int lttng_ustconsumer_get_consumed_snapshot( | |
121 | struct lttng_consumer_stream *stream, unsigned long *pos) | |
122 | { | |
123 | return -ENOSYS; | |
124 | } | |
125 | ||
3bd1e081 MD |
126 | static inline |
127 | int lttng_ustconsumer_recv_cmd(struct lttng_consumer_local_data *ctx, | |
fbc72522 DG |
128 | int sock, struct pollfd *consumer_sockpoll) |
129 | { | |
130 | return -ENOSYS; | |
131 | } | |
3bd1e081 MD |
132 | |
133 | static inline | |
134 | int lttng_ustconsumer_allocate_channel(struct lttng_consumer_channel *chan) | |
135 | { | |
136 | return -ENOSYS; | |
137 | } | |
138 | ||
139 | static inline | |
140 | void lttng_ustconsumer_del_channel(struct lttng_consumer_channel *chan) | |
141 | { | |
142 | } | |
143 | ||
b83e03c4 MD |
144 | static inline |
145 | void lttng_ustconsumer_free_channel(struct lttng_consumer_channel *chan) | |
146 | { | |
147 | } | |
148 | ||
3bd1e081 | 149 | static inline |
e316aad5 | 150 | int lttng_ustconsumer_add_stream(struct lttng_consumer_stream *stream) |
3bd1e081 MD |
151 | { |
152 | return -ENOSYS; | |
153 | } | |
154 | ||
155 | static inline | |
156 | void lttng_ustconsumer_del_stream(struct lttng_consumer_stream *stream) | |
157 | { | |
158 | } | |
159 | ||
d41f73b7 MD |
160 | static inline |
161 | int lttng_ustconsumer_read_subbuffer(struct lttng_consumer_stream *stream, | |
d2956687 | 162 | struct lttng_consumer_local_data *ctx) |
d41f73b7 MD |
163 | { |
164 | return -ENOSYS; | |
165 | } | |
166 | ||
167 | static inline | |
168 | int lttng_ustconsumer_on_recv_stream(struct lttng_consumer_stream *stream) | |
169 | { | |
170 | return -ENOSYS; | |
171 | } | |
172 | ||
d056b477 MD |
173 | static inline |
174 | void lttng_ustconsumer_on_stream_hangup(struct lttng_consumer_stream *stream) | |
175 | { | |
176 | } | |
177 | ||
f02e1e8a | 178 | static inline |
ffe60014 DG |
179 | int lttng_ustctl_get_mmap_read_offset(struct lttng_consumer_stream *stream, |
180 | unsigned long *off) | |
f02e1e8a DG |
181 | { |
182 | return -ENOSYS; | |
183 | } | |
ca22feea | 184 | static inline |
6d805429 | 185 | int lttng_ustconsumer_data_pending(struct lttng_consumer_stream *stream) |
ca22feea DG |
186 | { |
187 | return -ENOSYS; | |
188 | } | |
ffe60014 DG |
189 | static inline |
190 | void *lttng_ustctl_get_mmap_base(struct lttng_consumer_stream *stream) | |
191 | { | |
192 | return NULL; | |
193 | } | |
d88aee68 | 194 | static inline |
fc6d7a51 JD |
195 | void lttng_ustctl_flush_buffer(struct lttng_consumer_stream *stream, |
196 | int producer_active) | |
197 | { | |
198 | } | |
199 | static inline | |
6d574024 DG |
200 | void lttng_ustconsumer_close_all_metadata(struct lttng_ht *ht) |
201 | { | |
202 | } | |
203 | static inline | |
204 | void lttng_ustconsumer_close_metadata(struct lttng_consumer_channel *metadata) | |
d88aee68 DG |
205 | { |
206 | } | |
d8ef542d MD |
207 | static inline |
208 | void lttng_ustconsumer_close_stream_wakeup(struct lttng_consumer_stream *stream) | |
209 | { | |
210 | } | |
ee69440b DG |
211 | static inline |
212 | int lttng_ustconsumer_recv_metadata(int sock, uint64_t key, uint64_t offset, | |
93ec662e JD |
213 | uint64_t len, uint64_t version, |
214 | struct lttng_consumer_channel *channel, int timer) | |
ee69440b DG |
215 | { |
216 | return -ENOSYS; | |
217 | } | |
218 | static inline | |
ee69440b | 219 | int lttng_ustconsumer_request_metadata(struct lttng_consumer_local_data *ctx, |
84a182ce | 220 | struct lttng_consumer_channel *channel, int timer, int wait) |
ee69440b DG |
221 | { |
222 | return -ENOSYS; | |
223 | } | |
94d49140 JD |
224 | static inline |
225 | int lttng_ustconsumer_sync_metadata(struct lttng_consumer_local_data *ctx, | |
226 | struct lttng_consumer_stream *metadata) | |
227 | { | |
228 | return -ENOSYS; | |
229 | } | |
84a182ce DG |
230 | static inline |
231 | void lttng_ustconsumer_flush_buffer(struct lttng_consumer_stream *stream, | |
232 | int producer) | |
233 | { | |
234 | } | |
235 | static inline | |
214f70e0 JR |
236 | void lttng_ustconsumer_clear_buffer(struct lttng_consumer_stream *stream) |
237 | { | |
238 | } | |
239 | static inline | |
84a182ce DG |
240 | int lttng_ustconsumer_get_current_timestamp( |
241 | struct lttng_consumer_stream *stream, uint64_t *ts) | |
242 | { | |
243 | return -ENOSYS; | |
244 | } | |
a31c9f22 | 245 | static inline |
fb83fe64 JD |
246 | int lttng_ustconsumer_get_sequence_number( |
247 | struct lttng_consumer_stream *stream, uint64_t *seq) | |
248 | { | |
249 | return -ENOSYS; | |
250 | } | |
70190e1c DG |
251 | static inline |
252 | int lttng_ustconsumer_get_stream_id(struct lttng_consumer_stream *stream, | |
253 | uint64_t *stream_id) | |
254 | { | |
255 | return -ENOSYS; | |
256 | } | |
74d0b642 | 257 | #endif /* HAVE_LIBLTTNG_UST_CTL */ |
3bd1e081 MD |
258 | |
259 | #endif /* _LTTNG_USTCONSUMER_H */ |