Commit | Line | Data |
---|---|---|
2bdd86d4 MD |
1 | /* |
2 | * Copyright (C) 2011 - Julien Desfossez <julien.desfossez@polymtl.ca> | |
3 | * Mathieu Desnoyers <mathieu.desnoyers@efficios.com> | |
4 | * | |
5 | * This program is free software; you can redistribute it and/or | |
6 | * modify it under the terms of the GNU General Public License | |
7 | * as published by the Free Software Foundation; only version 2 | |
8 | * of the License. | |
9 | * | |
10 | * This program is distributed in the hope that it will be useful, | |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | * GNU General Public License for more details. | |
14 | * | |
15 | * You should have received a copy of the GNU General Public License | |
16 | * along with this program; if not, write to the Free Software | |
17 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |
18 | */ | |
19 | ||
20 | #ifndef _LTTNG_UST_CTL_H | |
21 | #define _LTTNG_UST_CTL_H | |
22 | ||
23 | /* | |
24 | * ust-ctl stub API when UST is not present. | |
25 | */ | |
26 | ||
27 | #include "lttng-ust-abi.h" | |
28 | #include <errno.h> | |
29 | ||
30 | /* | |
31 | * Tracer channel attributes. | |
32 | */ | |
33 | struct lttng_ust_channel_attr { | |
34 | int overwrite; /* 1: overwrite, 0: discard */ | |
35 | uint64_t subbuf_size; /* bytes */ | |
36 | uint64_t num_subbuf; /* power of 2 */ | |
37 | unsigned int switch_timer_interval; /* usec */ | |
38 | unsigned int read_timer_interval; /* usec */ | |
39 | enum lttng_ust_output output; /* splice, mmap */ | |
40 | }; | |
41 | ||
42 | struct object_data { | |
43 | int handle; | |
44 | int shm_fd; | |
45 | int wait_fd; | |
46 | uint64_t memory_map_size; | |
47 | }; | |
48 | ||
49 | static inline | |
50 | int ustctl_register_done(int sock) | |
51 | { | |
52 | return -ENOSYS; | |
53 | } | |
54 | static inline | |
55 | int ustctl_create_session(int sock) | |
56 | { | |
57 | return -ENOSYS; | |
58 | } | |
59 | static inline | |
60 | int ustctl_open_metadata(int sock, int session_handle, | |
61 | struct lttng_ust_channel_attr *chops, | |
62 | struct object_data **metadata_data) | |
63 | { | |
64 | return -ENOSYS; | |
65 | } | |
66 | static inline | |
67 | int ustctl_create_channel(int sock, int session_handle, | |
68 | struct lttng_ust_channel_attr *chops, | |
69 | struct object_data **channel_data) | |
70 | { | |
71 | return -ENOSYS; | |
72 | } | |
73 | static inline | |
74 | int ustctl_create_stream(int sock, struct object_data *channel_data, | |
75 | struct object_data **stream_data) | |
76 | { | |
77 | return -ENOSYS; | |
78 | } | |
79 | static inline | |
80 | int ustctl_create_event(int sock, struct lttng_ust_event *ev, | |
81 | struct object_data *channel_data, | |
82 | struct object_data **event_data) | |
83 | { | |
84 | return -ENOSYS; | |
85 | } | |
86 | static inline | |
87 | int ustctl_add_context(int sock, struct lttng_ust_context *ctx, | |
88 | struct object_data *obj_data, | |
89 | struct object_data **context_data) | |
90 | { | |
91 | return -ENOSYS; | |
92 | } | |
93 | ||
94 | static inline | |
95 | int ustctl_enable(int sock, struct object_data *object) | |
96 | { | |
97 | return -ENOSYS; | |
98 | } | |
99 | static inline | |
100 | int ustctl_disable(int sock, struct object_data *object) | |
101 | { | |
102 | return -ENOSYS; | |
103 | } | |
104 | static inline | |
105 | int ustctl_start_session(int sock, int handle) | |
106 | { | |
107 | return -ENOSYS; | |
108 | } | |
109 | static inline | |
110 | int ustctl_stop_session(int sock, int handle) | |
111 | { | |
112 | return -ENOSYS; | |
113 | } | |
114 | ||
115 | static inline | |
116 | int ustctl_tracepoint_list(int sock) /* not implemented yet */ | |
117 | { | |
118 | return -ENOSYS; | |
119 | } | |
120 | static inline | |
121 | int ustctl_tracer_version(int sock, struct lttng_ust_tracer_version *v) | |
122 | { | |
123 | return -ENOSYS; | |
124 | } | |
125 | static inline | |
126 | int ustctl_wait_quiescent(int sock) | |
127 | { | |
128 | return -ENOSYS; | |
129 | } | |
130 | ||
131 | /* Flush each buffers in this channel */ | |
132 | static inline | |
133 | int ustctl_flush_buffer(int sock, struct object_data *channel_data) | |
134 | { | |
135 | return -ENOSYS; | |
136 | } | |
137 | ||
138 | /* not implemented yet */ | |
139 | struct lttng_ust_calibrate; | |
140 | static inline | |
141 | int ustctl_calibrate(int sock, struct lttng_ust_calibrate *calibrate) | |
142 | { | |
143 | return -ENOSYS; | |
144 | } | |
145 | ||
146 | /* | |
147 | * Map channel shm_handle and add streams. Typically performed by the | |
148 | * consumer to map the objects into its memory space. | |
149 | */ | |
150 | static inline | |
151 | struct shm_handle *ustctl_map_channel(struct object_data *chan_data) | |
152 | { | |
153 | return NULL; | |
154 | } | |
155 | static inline | |
156 | int ustctl_add_stream(struct shm_handle *shm_handle, | |
157 | struct object_data *stream_data) | |
158 | { | |
159 | return -ENOSYS; | |
160 | } | |
161 | /* | |
162 | * Note: the object_data from which the shm_handle is derived can only | |
163 | * be released after unmapping the handle. | |
164 | */ | |
165 | static inline | |
166 | void ustctl_unmap_channel(struct shm_handle *shm_handle) | |
167 | { | |
168 | } | |
169 | ||
170 | /* Buffer operations */ | |
171 | ||
172 | struct shm_handle; | |
173 | struct lib_ring_buffer; | |
174 | ||
175 | /* Open/close stream buffers for read */ | |
176 | static inline | |
177 | struct lib_ring_buffer *ustctl_open_stream_read(struct shm_handle *handle, | |
178 | int cpu) | |
179 | { | |
180 | return NULL; | |
181 | } | |
182 | static inline | |
183 | void ustctl_close_stream_read(struct shm_handle *handle, | |
184 | struct lib_ring_buffer *buf) | |
185 | { | |
186 | } | |
187 | ||
188 | /* For mmap mode, readable without "get" operation */ | |
189 | static inline | |
190 | int ustctl_get_mmap_len(struct shm_handle *handle, | |
191 | struct lib_ring_buffer *buf, | |
192 | unsigned long *len) | |
193 | { | |
194 | return -ENOSYS; | |
195 | } | |
196 | static inline | |
197 | int ustctl_get_max_subbuf_size(struct shm_handle *handle, | |
198 | struct lib_ring_buffer *buf, | |
199 | unsigned long *len) | |
200 | { | |
201 | return -ENOSYS; | |
202 | } | |
203 | ||
204 | /* | |
205 | * For mmap mode, operate on the current packet (between get/put or | |
206 | * get_next/put_next). | |
207 | */ | |
208 | static inline | |
209 | void *ustctl_get_mmap_base(struct shm_handle *handle, | |
210 | struct lib_ring_buffer *buf) | |
211 | { | |
212 | return NULL; | |
213 | } | |
214 | static inline | |
215 | int ustctl_get_mmap_read_offset(struct shm_handle *handle, | |
216 | struct lib_ring_buffer *buf, unsigned long *off) | |
217 | { | |
218 | return -ENOSYS; | |
219 | } | |
220 | static inline | |
221 | int ustctl_get_subbuf_size(struct shm_handle *handle, | |
222 | struct lib_ring_buffer *buf, unsigned long *len) | |
223 | { | |
224 | return -ENOSYS; | |
225 | } | |
226 | static inline | |
227 | int ustctl_get_padded_subbuf_size(struct shm_handle *handle, | |
228 | struct lib_ring_buffer *buf, unsigned long *len) | |
229 | { | |
230 | return -ENOSYS; | |
231 | } | |
232 | static inline | |
233 | int ustctl_get_next_subbuf(struct shm_handle *handle, | |
234 | struct lib_ring_buffer *buf) | |
235 | { | |
236 | return -ENOSYS; | |
237 | } | |
238 | static inline | |
239 | int ustctl_put_next_subbuf(struct shm_handle *handle, | |
240 | struct lib_ring_buffer *buf) | |
241 | { | |
242 | return -ENOSYS; | |
243 | } | |
244 | ||
245 | /* snapshot */ | |
246 | ||
247 | static inline | |
248 | int ustctl_snapshot(struct shm_handle *handle, | |
249 | struct lib_ring_buffer *buf) | |
250 | { | |
251 | return -ENOSYS; | |
252 | } | |
253 | static inline | |
254 | int ustctl_snapshot_get_consumed(struct shm_handle *handle, | |
255 | struct lib_ring_buffer *buf, unsigned long *pos) | |
256 | { | |
257 | return -ENOSYS; | |
258 | } | |
259 | static inline | |
260 | int ustctl_snapshot_get_produced(struct shm_handle *handle, | |
261 | struct lib_ring_buffer *buf, unsigned long *pos) | |
262 | { | |
263 | return -ENOSYS; | |
264 | } | |
265 | static inline | |
266 | int ustctl_get_subbuf(struct shm_handle *handle, | |
267 | struct lib_ring_buffer *buf, unsigned long *pos) | |
268 | { | |
269 | return -ENOSYS; | |
270 | } | |
271 | static inline | |
272 | int ustctl_put_subbuf(struct shm_handle *handle, | |
273 | struct lib_ring_buffer *buf) | |
274 | { | |
275 | return -ENOSYS; | |
276 | } | |
277 | ||
278 | /* Release object created by members of this API */ | |
279 | static inline | |
280 | void release_object(int sock, struct object_data *data) | |
281 | { | |
282 | } | |
283 | ||
284 | #endif /* _LTTNG_UST_CTL_H */ |