ust-consumer: Expose user space clear buffer operation
[lttng-tools.git] / src / common / ust-consumer / ust-consumer.h
... / ...
CommitLineData
1/*
2 * Copyright (C) 2011 - Julien Desfossez <julien.desfossez@polymtl.ca>
3 * Copyright (C) 2011 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
4 *
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.
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
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
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.
17 */
18
19#ifndef _LTTNG_USTCONSUMER_H
20#define _LTTNG_USTCONSUMER_H
21
22#include <errno.h>
23
24#include <common/consumer/consumer.h>
25#include <stdbool.h>
26
27#ifdef HAVE_LIBLTTNG_UST_CTL
28
29int lttng_ustconsumer_take_snapshot(struct lttng_consumer_stream *stream);
30int lttng_ustconsumer_sample_snapshot_positions(
31 struct lttng_consumer_stream *stream);
32
33int lttng_ustconsumer_get_produced_snapshot(
34 struct lttng_consumer_stream *stream, unsigned long *pos);
35int lttng_ustconsumer_get_consumed_snapshot(
36 struct lttng_consumer_stream *stream, unsigned long *pos);
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);
43extern void lttng_ustconsumer_free_channel(struct lttng_consumer_channel *chan);
44extern int lttng_ustconsumer_add_stream(struct lttng_consumer_stream *stream);
45extern void lttng_ustconsumer_del_stream(struct lttng_consumer_stream *stream);
46
47int lttng_ustconsumer_read_subbuffer(struct lttng_consumer_stream *stream,
48 struct lttng_consumer_local_data *ctx);
49int lttng_ustconsumer_on_recv_stream(struct lttng_consumer_stream *stream);
50
51void lttng_ustconsumer_on_stream_hangup(struct lttng_consumer_stream *stream);
52
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);
56void lttng_ustctl_flush_buffer(struct lttng_consumer_stream *stream,
57 int producer_active);
58int lttng_ustconsumer_get_stream_id(struct lttng_consumer_stream *stream,
59 uint64_t *stream_id);
60int lttng_ustconsumer_data_pending(struct lttng_consumer_stream *stream);
61void lttng_ustconsumer_close_all_metadata(struct lttng_ht *ht);
62void lttng_ustconsumer_close_metadata(struct lttng_consumer_channel *metadata);
63void lttng_ustconsumer_close_stream_wakeup(struct lttng_consumer_stream *stream);
64int lttng_ustconsumer_recv_metadata(int sock, uint64_t key, uint64_t offset,
65 uint64_t len, uint64_t version,
66 struct lttng_consumer_channel *channel, int timer, int wait);
67int lttng_ustconsumer_request_metadata(struct lttng_consumer_local_data *ctx,
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);
71void lttng_ustconsumer_flush_buffer(struct lttng_consumer_stream *stream,
72 int producer);
73void lttng_ustconsumer_clear_buffer(struct lttng_consumer_stream *stream);
74int lttng_ustconsumer_get_current_timestamp(
75 struct lttng_consumer_stream *stream, uint64_t *ts);
76int lttng_ustconsumer_get_sequence_number(
77 struct lttng_consumer_stream *stream, uint64_t *seq);
78
79#else /* HAVE_LIBLTTNG_UST_CTL */
80
81static inline
82ssize_t lttng_ustconsumer_on_read_subbuffer_mmap(
83 struct lttng_consumer_local_data *ctx,
84 struct lttng_consumer_stream *stream, unsigned long len,
85 unsigned long padding)
86{
87 return -ENOSYS;
88}
89
90static inline
91ssize_t lttng_ustconsumer_on_read_subbuffer_splice(
92 struct lttng_consumer_local_data *ctx,
93 struct lttng_consumer_stream *uststream, unsigned long len,
94 unsigned long padding)
95{
96 return -ENOSYS;
97}
98
99static inline
100int lttng_ustconsumer_take_snapshot(struct lttng_consumer_stream *stream)
101{
102 return -ENOSYS;
103}
104
105static inline
106int lttng_ustconsumer_sample_snapshot_positions(
107 struct lttng_consumer_stream *stream)
108{
109 return -ENOSYS;
110}
111
112static inline
113int lttng_ustconsumer_get_produced_snapshot(
114 struct lttng_consumer_stream *stream, unsigned long *pos)
115{
116 return -ENOSYS;
117}
118
119static inline
120int lttng_ustconsumer_get_consumed_snapshot(
121 struct lttng_consumer_stream *stream, unsigned long *pos)
122{
123 return -ENOSYS;
124}
125
126static inline
127int lttng_ustconsumer_recv_cmd(struct lttng_consumer_local_data *ctx,
128 int sock, struct pollfd *consumer_sockpoll)
129{
130 return -ENOSYS;
131}
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
144static inline
145void lttng_ustconsumer_free_channel(struct lttng_consumer_channel *chan)
146{
147}
148
149static inline
150int lttng_ustconsumer_add_stream(struct lttng_consumer_stream *stream)
151{
152 return -ENOSYS;
153}
154
155static inline
156void lttng_ustconsumer_del_stream(struct lttng_consumer_stream *stream)
157{
158}
159
160static inline
161int lttng_ustconsumer_read_subbuffer(struct lttng_consumer_stream *stream,
162 struct lttng_consumer_local_data *ctx)
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
173static inline
174void lttng_ustconsumer_on_stream_hangup(struct lttng_consumer_stream *stream)
175{
176}
177
178static inline
179int lttng_ustctl_get_mmap_read_offset(struct lttng_consumer_stream *stream,
180 unsigned long *off)
181{
182 return -ENOSYS;
183}
184static inline
185int lttng_ustconsumer_data_pending(struct lttng_consumer_stream *stream)
186{
187 return -ENOSYS;
188}
189static inline
190void *lttng_ustctl_get_mmap_base(struct lttng_consumer_stream *stream)
191{
192 return NULL;
193}
194static inline
195void lttng_ustctl_flush_buffer(struct lttng_consumer_stream *stream,
196 int producer_active)
197{
198}
199static inline
200void lttng_ustconsumer_close_all_metadata(struct lttng_ht *ht)
201{
202}
203static inline
204void lttng_ustconsumer_close_metadata(struct lttng_consumer_channel *metadata)
205{
206}
207static inline
208void lttng_ustconsumer_close_stream_wakeup(struct lttng_consumer_stream *stream)
209{
210}
211static inline
212int lttng_ustconsumer_recv_metadata(int sock, uint64_t key, uint64_t offset,
213 uint64_t len, uint64_t version,
214 struct lttng_consumer_channel *channel, int timer)
215{
216 return -ENOSYS;
217}
218static inline
219int lttng_ustconsumer_request_metadata(struct lttng_consumer_local_data *ctx,
220 struct lttng_consumer_channel *channel, int timer, int wait)
221{
222 return -ENOSYS;
223}
224static inline
225int lttng_ustconsumer_sync_metadata(struct lttng_consumer_local_data *ctx,
226 struct lttng_consumer_stream *metadata)
227{
228 return -ENOSYS;
229}
230static inline
231void lttng_ustconsumer_flush_buffer(struct lttng_consumer_stream *stream,
232 int producer)
233{
234}
235static inline
236void lttng_ustconsumer_clear_buffer(struct lttng_consumer_stream *stream)
237{
238}
239static inline
240int lttng_ustconsumer_get_current_timestamp(
241 struct lttng_consumer_stream *stream, uint64_t *ts)
242{
243 return -ENOSYS;
244}
245static inline
246int lttng_ustconsumer_get_sequence_number(
247 struct lttng_consumer_stream *stream, uint64_t *seq)
248{
249 return -ENOSYS;
250}
251static inline
252int lttng_ustconsumer_get_stream_id(struct lttng_consumer_stream *stream,
253 uint64_t *stream_id)
254{
255 return -ENOSYS;
256}
257#endif /* HAVE_LIBLTTNG_UST_CTL */
258
259#endif /* _LTTNG_USTCONSUMER_H */
This page took 0.024905 seconds and 5 git commands to generate.