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