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