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