ust-consumer: Expose user space clear buffer operation
[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 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License, version 2 only,
7 * as published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17 */
18
19 #ifndef _LTTNG_USTCONSUMER_H
20 #define _LTTNG_USTCONSUMER_H
21
22 #include <errno.h>
23
24 #include <common/consumer/consumer.h>
25 #include <stdbool.h>
26
27 #ifdef HAVE_LIBLTTNG_UST_CTL
28
29 int lttng_ustconsumer_take_snapshot(struct lttng_consumer_stream *stream);
30 int lttng_ustconsumer_sample_snapshot_positions(
31 struct lttng_consumer_stream *stream);
32
33 int lttng_ustconsumer_get_produced_snapshot(
34 struct lttng_consumer_stream *stream, unsigned long *pos);
35 int lttng_ustconsumer_get_consumed_snapshot(
36 struct lttng_consumer_stream *stream, unsigned long *pos);
37
38 int lttng_ustconsumer_recv_cmd(struct lttng_consumer_local_data *ctx,
39 int sock, struct pollfd *consumer_sockpoll);
40
41 extern int lttng_ustconsumer_allocate_channel(struct lttng_consumer_channel *chan);
42 extern void lttng_ustconsumer_del_channel(struct lttng_consumer_channel *chan);
43 extern void lttng_ustconsumer_free_channel(struct lttng_consumer_channel *chan);
44 extern int lttng_ustconsumer_add_stream(struct lttng_consumer_stream *stream);
45 extern void lttng_ustconsumer_del_stream(struct lttng_consumer_stream *stream);
46
47 int lttng_ustconsumer_read_subbuffer(struct lttng_consumer_stream *stream,
48 struct lttng_consumer_local_data *ctx);
49 int lttng_ustconsumer_on_recv_stream(struct lttng_consumer_stream *stream);
50
51 void lttng_ustconsumer_on_stream_hangup(struct lttng_consumer_stream *stream);
52
53 int lttng_ustctl_get_mmap_read_offset(struct lttng_consumer_stream *stream,
54 unsigned long *off);
55 void *lttng_ustctl_get_mmap_base(struct lttng_consumer_stream *stream);
56 void lttng_ustctl_flush_buffer(struct lttng_consumer_stream *stream,
57 int producer_active);
58 int lttng_ustconsumer_get_stream_id(struct lttng_consumer_stream *stream,
59 uint64_t *stream_id);
60 int lttng_ustconsumer_data_pending(struct lttng_consumer_stream *stream);
61 void lttng_ustconsumer_close_all_metadata(struct lttng_ht *ht);
62 void lttng_ustconsumer_close_metadata(struct lttng_consumer_channel *metadata);
63 void lttng_ustconsumer_close_stream_wakeup(struct lttng_consumer_stream *stream);
64 int lttng_ustconsumer_recv_metadata(int sock, uint64_t key, uint64_t offset,
65 uint64_t len, uint64_t version,
66 struct lttng_consumer_channel *channel, int timer, int wait);
67 int lttng_ustconsumer_request_metadata(struct lttng_consumer_local_data *ctx,
68 struct lttng_consumer_channel *channel, int timer, int wait);
69 int lttng_ustconsumer_sync_metadata(struct lttng_consumer_local_data *ctx,
70 struct lttng_consumer_stream *metadata);
71 void lttng_ustconsumer_flush_buffer(struct lttng_consumer_stream *stream,
72 int producer);
73 void lttng_ustconsumer_clear_buffer(struct lttng_consumer_stream *stream);
74 int lttng_ustconsumer_get_current_timestamp(
75 struct lttng_consumer_stream *stream, uint64_t *ts);
76 int lttng_ustconsumer_get_sequence_number(
77 struct lttng_consumer_stream *stream, uint64_t *seq);
78
79 #else /* HAVE_LIBLTTNG_UST_CTL */
80
81 static inline
82 ssize_t lttng_ustconsumer_on_read_subbuffer_mmap(
83 struct lttng_consumer_local_data *ctx,
84 struct lttng_consumer_stream *stream, unsigned long len,
85 unsigned long padding)
86 {
87 return -ENOSYS;
88 }
89
90 static inline
91 ssize_t lttng_ustconsumer_on_read_subbuffer_splice(
92 struct lttng_consumer_local_data *ctx,
93 struct lttng_consumer_stream *uststream, unsigned long len,
94 unsigned long padding)
95 {
96 return -ENOSYS;
97 }
98
99 static inline
100 int lttng_ustconsumer_take_snapshot(struct lttng_consumer_stream *stream)
101 {
102 return -ENOSYS;
103 }
104
105 static inline
106 int lttng_ustconsumer_sample_snapshot_positions(
107 struct lttng_consumer_stream *stream)
108 {
109 return -ENOSYS;
110 }
111
112 static inline
113 int lttng_ustconsumer_get_produced_snapshot(
114 struct lttng_consumer_stream *stream, unsigned long *pos)
115 {
116 return -ENOSYS;
117 }
118
119 static inline
120 int lttng_ustconsumer_get_consumed_snapshot(
121 struct lttng_consumer_stream *stream, unsigned long *pos)
122 {
123 return -ENOSYS;
124 }
125
126 static inline
127 int lttng_ustconsumer_recv_cmd(struct lttng_consumer_local_data *ctx,
128 int sock, struct pollfd *consumer_sockpoll)
129 {
130 return -ENOSYS;
131 }
132
133 static inline
134 int lttng_ustconsumer_allocate_channel(struct lttng_consumer_channel *chan)
135 {
136 return -ENOSYS;
137 }
138
139 static inline
140 void lttng_ustconsumer_del_channel(struct lttng_consumer_channel *chan)
141 {
142 }
143
144 static inline
145 void lttng_ustconsumer_free_channel(struct lttng_consumer_channel *chan)
146 {
147 }
148
149 static inline
150 int lttng_ustconsumer_add_stream(struct lttng_consumer_stream *stream)
151 {
152 return -ENOSYS;
153 }
154
155 static inline
156 void lttng_ustconsumer_del_stream(struct lttng_consumer_stream *stream)
157 {
158 }
159
160 static inline
161 int lttng_ustconsumer_read_subbuffer(struct lttng_consumer_stream *stream,
162 struct lttng_consumer_local_data *ctx)
163 {
164 return -ENOSYS;
165 }
166
167 static inline
168 int lttng_ustconsumer_on_recv_stream(struct lttng_consumer_stream *stream)
169 {
170 return -ENOSYS;
171 }
172
173 static inline
174 void lttng_ustconsumer_on_stream_hangup(struct lttng_consumer_stream *stream)
175 {
176 }
177
178 static inline
179 int lttng_ustctl_get_mmap_read_offset(struct lttng_consumer_stream *stream,
180 unsigned long *off)
181 {
182 return -ENOSYS;
183 }
184 static inline
185 int lttng_ustconsumer_data_pending(struct lttng_consumer_stream *stream)
186 {
187 return -ENOSYS;
188 }
189 static inline
190 void *lttng_ustctl_get_mmap_base(struct lttng_consumer_stream *stream)
191 {
192 return NULL;
193 }
194 static inline
195 void lttng_ustctl_flush_buffer(struct lttng_consumer_stream *stream,
196 int producer_active)
197 {
198 }
199 static inline
200 void lttng_ustconsumer_close_all_metadata(struct lttng_ht *ht)
201 {
202 }
203 static inline
204 void lttng_ustconsumer_close_metadata(struct lttng_consumer_channel *metadata)
205 {
206 }
207 static inline
208 void lttng_ustconsumer_close_stream_wakeup(struct lttng_consumer_stream *stream)
209 {
210 }
211 static inline
212 int lttng_ustconsumer_recv_metadata(int sock, uint64_t key, uint64_t offset,
213 uint64_t len, uint64_t version,
214 struct lttng_consumer_channel *channel, int timer)
215 {
216 return -ENOSYS;
217 }
218 static inline
219 int lttng_ustconsumer_request_metadata(struct lttng_consumer_local_data *ctx,
220 struct lttng_consumer_channel *channel, int timer, int wait)
221 {
222 return -ENOSYS;
223 }
224 static inline
225 int lttng_ustconsumer_sync_metadata(struct lttng_consumer_local_data *ctx,
226 struct lttng_consumer_stream *metadata)
227 {
228 return -ENOSYS;
229 }
230 static inline
231 void lttng_ustconsumer_flush_buffer(struct lttng_consumer_stream *stream,
232 int producer)
233 {
234 }
235 static inline
236 void lttng_ustconsumer_clear_buffer(struct lttng_consumer_stream *stream)
237 {
238 }
239 static inline
240 int lttng_ustconsumer_get_current_timestamp(
241 struct lttng_consumer_stream *stream, uint64_t *ts)
242 {
243 return -ENOSYS;
244 }
245 static inline
246 int lttng_ustconsumer_get_sequence_number(
247 struct lttng_consumer_stream *stream, uint64_t *seq)
248 {
249 return -ENOSYS;
250 }
251 static inline
252 int lttng_ustconsumer_get_stream_id(struct lttng_consumer_stream *stream,
253 uint64_t *stream_id)
254 {
255 return -ENOSYS;
256 }
257 #endif /* HAVE_LIBLTTNG_UST_CTL */
258
259 #endif /* _LTTNG_USTCONSUMER_H */
This page took 0.033936 seconds and 4 git commands to generate.