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