ust-consumer: Expose user space clear buffer operation
[lttng-tools.git] / src / common / ust-consumer / ust-consumer.h
CommitLineData
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 29int lttng_ustconsumer_take_snapshot(struct lttng_consumer_stream *stream);
e9404c27
JG
30int lttng_ustconsumer_sample_snapshot_positions(
31 struct lttng_consumer_stream *stream);
3bd1e081 32
3bd1e081 33int lttng_ustconsumer_get_produced_snapshot(
ffe60014 34 struct lttng_consumer_stream *stream, unsigned long *pos);
10a50311
JD
35int lttng_ustconsumer_get_consumed_snapshot(
36 struct lttng_consumer_stream *stream, unsigned long *pos);
3bd1e081
MD
37
38int lttng_ustconsumer_recv_cmd(struct lttng_consumer_local_data *ctx,
39 int sock, struct pollfd *consumer_sockpoll);
40
41extern int lttng_ustconsumer_allocate_channel(struct lttng_consumer_channel *chan);
42extern void lttng_ustconsumer_del_channel(struct lttng_consumer_channel *chan);
b83e03c4 43extern void lttng_ustconsumer_free_channel(struct lttng_consumer_channel *chan);
e316aad5 44extern int lttng_ustconsumer_add_stream(struct lttng_consumer_stream *stream);
3bd1e081
MD
45extern void lttng_ustconsumer_del_stream(struct lttng_consumer_stream *stream);
46
d41f73b7 47int lttng_ustconsumer_read_subbuffer(struct lttng_consumer_stream *stream,
d2956687 48 struct lttng_consumer_local_data *ctx);
d41f73b7
MD
49int lttng_ustconsumer_on_recv_stream(struct lttng_consumer_stream *stream);
50
d056b477
MD
51void lttng_ustconsumer_on_stream_hangup(struct lttng_consumer_stream *stream);
52
ffe60014
DG
53int lttng_ustctl_get_mmap_read_offset(struct lttng_consumer_stream *stream,
54 unsigned long *off);
55void *lttng_ustctl_get_mmap_base(struct lttng_consumer_stream *stream);
fc6d7a51
JD
56void lttng_ustctl_flush_buffer(struct lttng_consumer_stream *stream,
57 int producer_active);
70190e1c
DG
58int lttng_ustconsumer_get_stream_id(struct lttng_consumer_stream *stream,
59 uint64_t *stream_id);
6d805429 60int lttng_ustconsumer_data_pending(struct lttng_consumer_stream *stream);
6d574024
DG
61void lttng_ustconsumer_close_all_metadata(struct lttng_ht *ht);
62void lttng_ustconsumer_close_metadata(struct lttng_consumer_channel *metadata);
d8ef542d 63void lttng_ustconsumer_close_stream_wakeup(struct lttng_consumer_stream *stream);
331744e3 64int 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 67int lttng_ustconsumer_request_metadata(struct lttng_consumer_local_data *ctx,
94d49140
JD
68 struct lttng_consumer_channel *channel, int timer, int wait);
69int lttng_ustconsumer_sync_metadata(struct lttng_consumer_local_data *ctx,
70 struct lttng_consumer_stream *metadata);
84a182ce
DG
71void lttng_ustconsumer_flush_buffer(struct lttng_consumer_stream *stream,
72 int producer);
214f70e0 73void lttng_ustconsumer_clear_buffer(struct lttng_consumer_stream *stream);
84a182ce
DG
74int lttng_ustconsumer_get_current_timestamp(
75 struct lttng_consumer_stream *stream, uint64_t *ts);
fb83fe64
JD
76int 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
81static inline
4078b776 82ssize_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
90static inline
4078b776 91ssize_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
99static inline
ffe60014 100int lttng_ustconsumer_take_snapshot(struct lttng_consumer_stream *stream)
3bd1e081
MD
101{
102 return -ENOSYS;
103}
104
e9404c27
JG
105static inline
106int lttng_ustconsumer_sample_snapshot_positions(
107 struct lttng_consumer_stream *stream)
108{
109 return -ENOSYS;
110}
111
3bd1e081
MD
112static inline
113int 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
119static inline
120int lttng_ustconsumer_get_consumed_snapshot(
121 struct lttng_consumer_stream *stream, unsigned long *pos)
122{
123 return -ENOSYS;
124}
125
3bd1e081
MD
126static inline
127int 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
133static inline
134int lttng_ustconsumer_allocate_channel(struct lttng_consumer_channel *chan)
135{
136 return -ENOSYS;
137}
138
139static inline
140void lttng_ustconsumer_del_channel(struct lttng_consumer_channel *chan)
141{
142}
143
b83e03c4
MD
144static inline
145void lttng_ustconsumer_free_channel(struct lttng_consumer_channel *chan)
146{
147}
148
3bd1e081 149static inline
e316aad5 150int lttng_ustconsumer_add_stream(struct lttng_consumer_stream *stream)
3bd1e081
MD
151{
152 return -ENOSYS;
153}
154
155static inline
156void lttng_ustconsumer_del_stream(struct lttng_consumer_stream *stream)
157{
158}
159
d41f73b7
MD
160static inline
161int 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
167static inline
168int lttng_ustconsumer_on_recv_stream(struct lttng_consumer_stream *stream)
169{
170 return -ENOSYS;
171}
172
d056b477
MD
173static inline
174void lttng_ustconsumer_on_stream_hangup(struct lttng_consumer_stream *stream)
175{
176}
177
f02e1e8a 178static inline
ffe60014
DG
179int lttng_ustctl_get_mmap_read_offset(struct lttng_consumer_stream *stream,
180 unsigned long *off)
f02e1e8a
DG
181{
182 return -ENOSYS;
183}
ca22feea 184static inline
6d805429 185int lttng_ustconsumer_data_pending(struct lttng_consumer_stream *stream)
ca22feea
DG
186{
187 return -ENOSYS;
188}
ffe60014
DG
189static inline
190void *lttng_ustctl_get_mmap_base(struct lttng_consumer_stream *stream)
191{
192 return NULL;
193}
d88aee68 194static inline
fc6d7a51
JD
195void lttng_ustctl_flush_buffer(struct lttng_consumer_stream *stream,
196 int producer_active)
197{
198}
199static inline
6d574024
DG
200void lttng_ustconsumer_close_all_metadata(struct lttng_ht *ht)
201{
202}
203static inline
204void lttng_ustconsumer_close_metadata(struct lttng_consumer_channel *metadata)
d88aee68
DG
205{
206}
d8ef542d
MD
207static inline
208void lttng_ustconsumer_close_stream_wakeup(struct lttng_consumer_stream *stream)
209{
210}
ee69440b
DG
211static inline
212int 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}
218static inline
ee69440b 219int 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
224static inline
225int lttng_ustconsumer_sync_metadata(struct lttng_consumer_local_data *ctx,
226 struct lttng_consumer_stream *metadata)
227{
228 return -ENOSYS;
229}
84a182ce
DG
230static inline
231void lttng_ustconsumer_flush_buffer(struct lttng_consumer_stream *stream,
232 int producer)
233{
234}
235static inline
214f70e0
JR
236void lttng_ustconsumer_clear_buffer(struct lttng_consumer_stream *stream)
237{
238}
239static inline
84a182ce
DG
240int lttng_ustconsumer_get_current_timestamp(
241 struct lttng_consumer_stream *stream, uint64_t *ts)
242{
243 return -ENOSYS;
244}
a31c9f22 245static inline
fb83fe64
JD
246int lttng_ustconsumer_get_sequence_number(
247 struct lttng_consumer_stream *stream, uint64_t *seq)
248{
249 return -ENOSYS;
250}
70190e1c
DG
251static inline
252int 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 */
This page took 0.065582 seconds and 4 git commands to generate.