common: compile libconsumer, libust-consumer, libkernel-consumer as C++
[lttng-tools.git] / src / common / ust-consumer / ust-consumer.h
CommitLineData
3bd1e081 1/*
ab5be9fa
MJ
2 * Copyright (C) 2011 Julien Desfossez <julien.desfossez@polymtl.ca>
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
97535efa
SM
16#ifdef __cplusplus
17extern "C" {
18#endif
19
74d0b642 20#ifdef HAVE_LIBLTTNG_UST_CTL
3bd1e081 21
ffe60014 22int lttng_ustconsumer_take_snapshot(struct lttng_consumer_stream *stream);
e9404c27
JG
23int lttng_ustconsumer_sample_snapshot_positions(
24 struct lttng_consumer_stream *stream);
3bd1e081 25
3bd1e081 26int lttng_ustconsumer_get_produced_snapshot(
ffe60014 27 struct lttng_consumer_stream *stream, unsigned long *pos);
10a50311
JD
28int lttng_ustconsumer_get_consumed_snapshot(
29 struct lttng_consumer_stream *stream, unsigned long *pos);
3bd1e081
MD
30
31int lttng_ustconsumer_recv_cmd(struct lttng_consumer_local_data *ctx,
32 int sock, struct pollfd *consumer_sockpoll);
33
34extern int lttng_ustconsumer_allocate_channel(struct lttng_consumer_channel *chan);
35extern void lttng_ustconsumer_del_channel(struct lttng_consumer_channel *chan);
b83e03c4 36extern void lttng_ustconsumer_free_channel(struct lttng_consumer_channel *chan);
e316aad5 37extern int lttng_ustconsumer_add_stream(struct lttng_consumer_stream *stream);
3bd1e081
MD
38extern void lttng_ustconsumer_del_stream(struct lttng_consumer_stream *stream);
39
d41f73b7 40int lttng_ustconsumer_read_subbuffer(struct lttng_consumer_stream *stream,
d2956687 41 struct lttng_consumer_local_data *ctx);
d41f73b7
MD
42int lttng_ustconsumer_on_recv_stream(struct lttng_consumer_stream *stream);
43
d056b477
MD
44void lttng_ustconsumer_on_stream_hangup(struct lttng_consumer_stream *stream);
45
881fc67f
MD
46int lttng_ust_flush_buffer(struct lttng_consumer_stream *stream,
47 int producer_active);
48int lttng_ustconsumer_get_stream_id(struct lttng_consumer_stream *stream,
49 uint64_t *stream_id);
6d805429 50int lttng_ustconsumer_data_pending(struct lttng_consumer_stream *stream);
6d574024
DG
51void lttng_ustconsumer_close_all_metadata(struct lttng_ht *ht);
52void lttng_ustconsumer_close_metadata(struct lttng_consumer_channel *metadata);
d8ef542d 53void lttng_ustconsumer_close_stream_wakeup(struct lttng_consumer_stream *stream);
331744e3 54int lttng_ustconsumer_recv_metadata(int sock, uint64_t key, uint64_t offset,
93ec662e
JD
55 uint64_t len, uint64_t version,
56 struct lttng_consumer_channel *channel, int timer, int wait);
331744e3 57int lttng_ustconsumer_request_metadata(struct lttng_consumer_local_data *ctx,
94d49140 58 struct lttng_consumer_channel *channel, int timer, int wait);
577eea73
JG
59enum sync_metadata_status lttng_ustconsumer_sync_metadata(
60 struct lttng_consumer_local_data *ctx,
94d49140 61 struct lttng_consumer_stream *metadata);
881fc67f 62int lttng_ustconsumer_flush_buffer(struct lttng_consumer_stream *stream,
84a182ce 63 int producer);
881fc67f 64int lttng_ustconsumer_clear_buffer(struct lttng_consumer_stream *stream);
84a182ce
DG
65int lttng_ustconsumer_get_current_timestamp(
66 struct lttng_consumer_stream *stream, uint64_t *ts);
fb83fe64
JD
67int lttng_ustconsumer_get_sequence_number(
68 struct lttng_consumer_stream *stream, uint64_t *seq);
881fc67f 69void lttng_ustconsumer_sigbus_handle(void *addr);
f02e1e8a 70
74d0b642 71#else /* HAVE_LIBLTTNG_UST_CTL */
3bd1e081
MD
72
73static inline
4078b776 74ssize_t lttng_ustconsumer_on_read_subbuffer_mmap(
3bd1e081 75 struct lttng_consumer_local_data *ctx,
1d4dfdef
DG
76 struct lttng_consumer_stream *stream, unsigned long len,
77 unsigned long padding)
3bd1e081
MD
78{
79 return -ENOSYS;
80}
81
82static inline
4078b776 83ssize_t lttng_ustconsumer_on_read_subbuffer_splice(
3bd1e081 84 struct lttng_consumer_local_data *ctx,
1d4dfdef
DG
85 struct lttng_consumer_stream *uststream, unsigned long len,
86 unsigned long padding)
3bd1e081
MD
87{
88 return -ENOSYS;
89}
90
91static inline
ffe60014 92int lttng_ustconsumer_take_snapshot(struct lttng_consumer_stream *stream)
3bd1e081
MD
93{
94 return -ENOSYS;
95}
96
e9404c27
JG
97static inline
98int lttng_ustconsumer_sample_snapshot_positions(
99 struct lttng_consumer_stream *stream)
100{
101 return -ENOSYS;
102}
103
3bd1e081
MD
104static inline
105int lttng_ustconsumer_get_produced_snapshot(
ffe60014 106 struct lttng_consumer_stream *stream, unsigned long *pos)
3bd1e081
MD
107{
108 return -ENOSYS;
109}
110
e9404c27
JG
111static inline
112int lttng_ustconsumer_get_consumed_snapshot(
113 struct lttng_consumer_stream *stream, unsigned long *pos)
114{
115 return -ENOSYS;
116}
117
3bd1e081
MD
118static inline
119int lttng_ustconsumer_recv_cmd(struct lttng_consumer_local_data *ctx,
fbc72522
DG
120 int sock, struct pollfd *consumer_sockpoll)
121{
122 return -ENOSYS;
123}
3bd1e081
MD
124
125static inline
126int lttng_ustconsumer_allocate_channel(struct lttng_consumer_channel *chan)
127{
128 return -ENOSYS;
129}
130
131static inline
132void lttng_ustconsumer_del_channel(struct lttng_consumer_channel *chan)
133{
134}
135
b83e03c4
MD
136static inline
137void lttng_ustconsumer_free_channel(struct lttng_consumer_channel *chan)
138{
139}
140
3bd1e081 141static inline
e316aad5 142int lttng_ustconsumer_add_stream(struct lttng_consumer_stream *stream)
3bd1e081
MD
143{
144 return -ENOSYS;
145}
146
147static inline
148void lttng_ustconsumer_del_stream(struct lttng_consumer_stream *stream)
149{
150}
151
d41f73b7
MD
152static inline
153int lttng_ustconsumer_read_subbuffer(struct lttng_consumer_stream *stream,
d2956687 154 struct lttng_consumer_local_data *ctx)
d41f73b7
MD
155{
156 return -ENOSYS;
157}
158
159static inline
160int lttng_ustconsumer_on_recv_stream(struct lttng_consumer_stream *stream)
161{
162 return -ENOSYS;
163}
164
d056b477
MD
165static inline
166void lttng_ustconsumer_on_stream_hangup(struct lttng_consumer_stream *stream)
167{
168}
169
ca22feea 170static inline
6d805429 171int lttng_ustconsumer_data_pending(struct lttng_consumer_stream *stream)
ca22feea
DG
172{
173 return -ENOSYS;
174}
ffe60014 175static inline
881fc67f 176int lttng_ust_flush_buffer(struct lttng_consumer_stream *stream,
fc6d7a51
JD
177 int producer_active)
178{
881fc67f 179 return -ENOSYS;
fc6d7a51
JD
180}
181static inline
6d574024
DG
182void lttng_ustconsumer_close_all_metadata(struct lttng_ht *ht)
183{
184}
185static inline
186void lttng_ustconsumer_close_metadata(struct lttng_consumer_channel *metadata)
d88aee68
DG
187{
188}
d8ef542d
MD
189static inline
190void lttng_ustconsumer_close_stream_wakeup(struct lttng_consumer_stream *stream)
191{
192}
ee69440b
DG
193static inline
194int lttng_ustconsumer_recv_metadata(int sock, uint64_t key, uint64_t offset,
93ec662e
JD
195 uint64_t len, uint64_t version,
196 struct lttng_consumer_channel *channel, int timer)
ee69440b
DG
197{
198 return -ENOSYS;
199}
200static inline
ee69440b 201int lttng_ustconsumer_request_metadata(struct lttng_consumer_local_data *ctx,
84a182ce 202 struct lttng_consumer_channel *channel, int timer, int wait)
ee69440b
DG
203{
204 return -ENOSYS;
205}
94d49140 206static inline
577eea73 207enum sync_metadata_status lttng_ustconsumer_sync_metadata(struct lttng_consumer_local_data *ctx,
94d49140
JD
208 struct lttng_consumer_stream *metadata)
209{
577eea73 210 return SYNC_METADATA_STATUS_ERROR;
94d49140 211}
84a182ce 212static inline
881fc67f 213int lttng_ustconsumer_flush_buffer(struct lttng_consumer_stream *stream,
84a182ce
DG
214 int producer)
215{
881fc67f 216 return -ENOSYS;
84a182ce
DG
217}
218static inline
881fc67f 219int lttng_ustconsumer_clear_buffer(struct lttng_consumer_stream *stream)
214f70e0 220{
881fc67f 221 return -ENOSYS;
214f70e0
JR
222}
223static inline
84a182ce
DG
224int lttng_ustconsumer_get_current_timestamp(
225 struct lttng_consumer_stream *stream, uint64_t *ts)
226{
227 return -ENOSYS;
228}
a31c9f22 229static inline
fb83fe64
JD
230int lttng_ustconsumer_get_sequence_number(
231 struct lttng_consumer_stream *stream, uint64_t *seq)
232{
233 return -ENOSYS;
234}
70190e1c
DG
235static inline
236int lttng_ustconsumer_get_stream_id(struct lttng_consumer_stream *stream,
237 uint64_t *stream_id)
238{
239 return -ENOSYS;
240}
881fc67f
MD
241static inline
242void lttng_ustconsumer_sigbus_handle(void *addr)
243{
244}
74d0b642 245#endif /* HAVE_LIBLTTNG_UST_CTL */
3bd1e081 246
97535efa
SM
247#ifdef __cplusplus
248}
249#endif
250
3bd1e081 251#endif /* _LTTNG_USTCONSUMER_H */
This page took 0.074751 seconds and 4 git commands to generate.