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