Clean-up: run format-cpp on the tree
[lttng-tools.git] / src / bin / lttng-sessiond / ust-abi-internal.hpp
... / ...
CommitLineData
1/*
2 * Copyright 2010-2012 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 *
4 * SPDX-License-Identifier: MIT
5 *
6 * Copied from LTTng-UST lttng/ust-abi.h
7 *
8 * LTTng-UST ABI header
9 *
10 */
11
12#ifndef LTTNG_UST_ABI_INTERNAL_H
13#define LTTNG_UST_ABI_INTERNAL_H
14
15#include <common/macros.hpp>
16
17#include <stdint.h>
18
19#ifndef LTTNG_PACKED
20#error "LTTNG_PACKED should be defined"
21#endif
22
23#ifndef __ust_stringify
24#define __ust_stringify1(x) #x
25#define __ust_stringify(x) __ust_stringify1(x)
26#endif /* __ust_stringify */
27
28#define LTTNG_UST_ABI_SYM_NAME_LEN 256
29#define LTTNG_UST_ABI_PROCNAME_LEN 16
30
31/* UST comm magic number, used to validate protocol and endianness. */
32#define LTTNG_UST_ABI_COMM_MAGIC 0xC57C57C5
33
34/* Version for ABI between liblttng-ust, sessiond, consumerd */
35#define LTTNG_UST_ABI_MAJOR_VERSION 9
36#define LTTNG_UST_ABI_MAJOR_VERSION_OLDEST_COMPATIBLE 8
37#define LTTNG_UST_ABI_MINOR_VERSION 0
38
39enum lttng_ust_abi_instrumentation {
40 LTTNG_UST_ABI_TRACEPOINT = 0,
41 LTTNG_UST_ABI_PROBE = 1,
42 LTTNG_UST_ABI_FUNCTION = 2,
43};
44
45enum lttng_ust_abi_loglevel_type {
46 LTTNG_UST_ABI_LOGLEVEL_ALL = 0,
47 LTTNG_UST_ABI_LOGLEVEL_RANGE = 1,
48 LTTNG_UST_ABI_LOGLEVEL_SINGLE = 2,
49};
50
51enum lttng_ust_abi_output {
52 LTTNG_UST_ABI_MMAP = 0,
53};
54
55enum lttng_ust_abi_chan_type {
56 LTTNG_UST_ABI_CHAN_PER_CPU = 0,
57 LTTNG_UST_ABI_CHAN_METADATA = 1,
58};
59
60struct lttng_ust_abi_tracer_version {
61 uint32_t major;
62 uint32_t minor;
63 uint32_t patchlevel;
64} LTTNG_PACKED;
65
66#define LTTNG_UST_ABI_CHANNEL_PADDING (LTTNG_UST_ABI_SYM_NAME_LEN + 32)
67/*
68 * Given that the consumerd is limited to 64k file descriptors, we
69 * cannot expect much more than 1MB channel structure size. This size is
70 * depends on the number of streams within a channel, which depends on
71 * the number of possible CPUs on the system.
72 */
73#define LTTNG_UST_ABI_CHANNEL_DATA_MAX_LEN 1048576U
74struct lttng_ust_abi_channel {
75 uint64_t len;
76 int32_t type; /* enum lttng_ust_abi_chan_type */
77 char padding[LTTNG_UST_ABI_CHANNEL_PADDING];
78 char data[]; /* variable sized data */
79} LTTNG_PACKED;
80
81#define LTTNG_UST_ABI_STREAM_PADDING1 (LTTNG_UST_ABI_SYM_NAME_LEN + 32)
82struct lttng_ust_abi_stream {
83 uint64_t len; /* shm len */
84 uint32_t stream_nr; /* stream number */
85 char padding[LTTNG_UST_ABI_STREAM_PADDING1];
86 /*
87 * shm_fd and wakeup_fd are send over unix socket as file
88 * descriptors after this structure.
89 */
90} LTTNG_PACKED;
91
92#define LTTNG_UST_ABI_COUNTER_DIMENSION_MAX 4
93
94enum lttng_ust_abi_counter_arithmetic {
95 LTTNG_UST_ABI_COUNTER_ARITHMETIC_MODULAR = 0,
96 LTTNG_UST_ABI_COUNTER_ARITHMETIC_SATURATION = 1,
97};
98
99enum lttng_ust_abi_counter_bitness {
100 LTTNG_UST_ABI_COUNTER_BITNESS_32 = 0,
101 LTTNG_UST_ABI_COUNTER_BITNESS_64 = 1,
102};
103
104struct lttng_ust_abi_counter_dimension {
105 uint64_t size;
106 uint64_t underflow_index;
107 uint64_t overflow_index;
108 uint8_t has_underflow;
109 uint8_t has_overflow;
110} LTTNG_PACKED;
111
112#define LTTNG_UST_ABI_COUNTER_CONF_PADDING1 67
113struct lttng_ust_abi_counter_conf {
114 uint32_t arithmetic; /* enum lttng_ust_abi_counter_arithmetic */
115 uint32_t bitness; /* enum lttng_ust_abi_counter_bitness */
116 uint32_t number_dimensions;
117 int64_t global_sum_step;
118 struct lttng_ust_abi_counter_dimension dimensions[LTTNG_UST_ABI_COUNTER_DIMENSION_MAX];
119 uint8_t coalesce_hits;
120 char padding[LTTNG_UST_ABI_COUNTER_CONF_PADDING1];
121} LTTNG_PACKED;
122
123struct lttng_ust_abi_counter_value {
124 uint32_t number_dimensions;
125 uint64_t dimension_indexes[LTTNG_UST_ABI_COUNTER_DIMENSION_MAX];
126 int64_t value;
127} LTTNG_PACKED;
128
129#define LTTNG_UST_ABI_EVENT_PADDING1 8
130#define LTTNG_UST_ABI_EVENT_PADDING2 (LTTNG_UST_ABI_SYM_NAME_LEN + 32)
131struct lttng_ust_abi_event {
132 int32_t instrumentation; /* enum lttng_ust_abi_instrumentation */
133 char name[LTTNG_UST_ABI_SYM_NAME_LEN]; /* event name */
134
135 int32_t loglevel_type; /* enum lttng_ust_abi_loglevel_type */
136 int32_t loglevel; /* value, -1: all */
137 uint64_t token; /* User-provided token */
138 char padding[LTTNG_UST_ABI_EVENT_PADDING1];
139
140 /* Per instrumentation type configuration */
141 union {
142 char padding[LTTNG_UST_ABI_EVENT_PADDING2];
143 } u;
144} LTTNG_PACKED;
145
146#define LTTNG_UST_ABI_EVENT_NOTIFIER_PADDING 32
147struct lttng_ust_abi_event_notifier {
148 struct lttng_ust_abi_event event;
149 uint64_t error_counter_index;
150 char padding[LTTNG_UST_ABI_EVENT_NOTIFIER_PADDING];
151} LTTNG_PACKED;
152
153#define LTTNG_UST_ABI_EVENT_NOTIFIER_NOTIFICATION_PADDING 32
154struct lttng_ust_abi_event_notifier_notification {
155 uint64_t token;
156 uint16_t capture_buf_size;
157 char padding[LTTNG_UST_ABI_EVENT_NOTIFIER_NOTIFICATION_PADDING];
158} LTTNG_PACKED;
159
160#define LTTNG_UST_ABI_COUNTER_PADDING1 (LTTNG_UST_ABI_SYM_NAME_LEN + 32)
161#define LTTNG_UST_ABI_COUNTER_DATA_MAX_LEN 4096U
162struct lttng_ust_abi_counter {
163 uint64_t len;
164 char padding[LTTNG_UST_ABI_COUNTER_PADDING1];
165 char data[]; /* variable sized data */
166} LTTNG_PACKED;
167
168#define LTTNG_UST_ABI_COUNTER_GLOBAL_PADDING1 (LTTNG_UST_ABI_SYM_NAME_LEN + 32)
169struct lttng_ust_abi_counter_global {
170 uint64_t len; /* shm len */
171 char padding[LTTNG_UST_ABI_COUNTER_GLOBAL_PADDING1];
172} LTTNG_PACKED;
173
174#define LTTNG_UST_ABI_COUNTER_CPU_PADDING1 (LTTNG_UST_ABI_SYM_NAME_LEN + 32)
175struct lttng_ust_abi_counter_cpu {
176 uint64_t len; /* shm len */
177 uint32_t cpu_nr;
178 char padding[LTTNG_UST_ABI_COUNTER_CPU_PADDING1];
179} LTTNG_PACKED;
180
181enum lttng_ust_abi_field_type {
182 LTTNG_UST_ABI_FIELD_OTHER = 0,
183 LTTNG_UST_ABI_FIELD_INTEGER = 1,
184 LTTNG_UST_ABI_FIELD_ENUM = 2,
185 LTTNG_UST_ABI_FIELD_FLOAT = 3,
186 LTTNG_UST_ABI_FIELD_STRING = 4,
187};
188
189#define LTTNG_UST_ABI_FIELD_ITER_PADDING (LTTNG_UST_ABI_SYM_NAME_LEN + 28)
190struct lttng_ust_abi_field_iter {
191 char event_name[LTTNG_UST_ABI_SYM_NAME_LEN];
192 char field_name[LTTNG_UST_ABI_SYM_NAME_LEN];
193 int32_t type; /* enum lttng_ust_abi_field_type */
194 int loglevel; /* event loglevel */
195 int nowrite;
196 char padding[LTTNG_UST_ABI_FIELD_ITER_PADDING];
197} LTTNG_PACKED;
198
199enum lttng_ust_abi_context_type {
200 LTTNG_UST_ABI_CONTEXT_VTID = 0,
201 LTTNG_UST_ABI_CONTEXT_VPID = 1,
202 LTTNG_UST_ABI_CONTEXT_PTHREAD_ID = 2,
203 LTTNG_UST_ABI_CONTEXT_PROCNAME = 3,
204 LTTNG_UST_ABI_CONTEXT_IP = 4,
205 LTTNG_UST_ABI_CONTEXT_PERF_THREAD_COUNTER = 5,
206 LTTNG_UST_ABI_CONTEXT_CPU_ID = 6,
207 LTTNG_UST_ABI_CONTEXT_APP_CONTEXT = 7,
208 LTTNG_UST_ABI_CONTEXT_CGROUP_NS = 8,
209 LTTNG_UST_ABI_CONTEXT_IPC_NS = 9,
210 LTTNG_UST_ABI_CONTEXT_MNT_NS = 10,
211 LTTNG_UST_ABI_CONTEXT_NET_NS = 11,
212 LTTNG_UST_ABI_CONTEXT_PID_NS = 12,
213 LTTNG_UST_ABI_CONTEXT_USER_NS = 13,
214 LTTNG_UST_ABI_CONTEXT_UTS_NS = 14,
215 LTTNG_UST_ABI_CONTEXT_VUID = 15,
216 LTTNG_UST_ABI_CONTEXT_VEUID = 16,
217 LTTNG_UST_ABI_CONTEXT_VSUID = 17,
218 LTTNG_UST_ABI_CONTEXT_VGID = 18,
219 LTTNG_UST_ABI_CONTEXT_VEGID = 19,
220 LTTNG_UST_ABI_CONTEXT_VSGID = 20,
221 LTTNG_UST_ABI_CONTEXT_TIME_NS = 21,
222};
223
224struct lttng_ust_abi_perf_counter_ctx {
225 uint32_t type;
226 uint64_t config;
227 char name[LTTNG_UST_ABI_SYM_NAME_LEN];
228} LTTNG_PACKED;
229
230#define LTTNG_UST_ABI_CONTEXT_PADDING1 16
231#define LTTNG_UST_ABI_CONTEXT_PADDING2 (LTTNG_UST_ABI_SYM_NAME_LEN + 32)
232struct lttng_ust_abi_context {
233 int32_t ctx; /* enum lttng_ust_abi_context_type */
234 char padding[LTTNG_UST_ABI_CONTEXT_PADDING1];
235
236 union {
237 struct lttng_ust_abi_perf_counter_ctx perf_counter;
238 struct {
239 /* Includes trailing '\0'. */
240 uint32_t provider_name_len;
241 uint32_t ctx_name_len;
242 } app_ctx;
243 char padding[LTTNG_UST_ABI_CONTEXT_PADDING2];
244 } u;
245} LTTNG_PACKED;
246
247/*
248 * Tracer channel attributes.
249 */
250#define LTTNG_UST_ABI_CHANNEL_ATTR_PADDING (LTTNG_UST_ABI_SYM_NAME_LEN + 32)
251struct lttng_ust_abi_channel_attr {
252 uint64_t subbuf_size; /* bytes */
253 uint64_t num_subbuf; /* power of 2 */
254 int overwrite; /* 1: overwrite, 0: discard */
255 unsigned int switch_timer_interval; /* usec */
256 unsigned int read_timer_interval; /* usec */
257 int32_t output; /* enum lttng_ust_abi_output */
258 union {
259 struct {
260 int64_t blocking_timeout; /* Blocking timeout (usec) */
261 } s;
262 char padding[LTTNG_UST_ABI_CHANNEL_ATTR_PADDING];
263 } u;
264} LTTNG_PACKED;
265
266#define LTTNG_UST_ABI_TRACEPOINT_ITER_PADDING 16
267struct lttng_ust_abi_tracepoint_iter {
268 char name[LTTNG_UST_ABI_SYM_NAME_LEN]; /* provider:name */
269 int loglevel;
270 char padding[LTTNG_UST_ABI_TRACEPOINT_ITER_PADDING];
271} LTTNG_PACKED;
272
273enum lttng_ust_abi_object_type {
274 LTTNG_UST_ABI_OBJECT_TYPE_UNKNOWN = -1,
275 LTTNG_UST_ABI_OBJECT_TYPE_CHANNEL = 0,
276 LTTNG_UST_ABI_OBJECT_TYPE_STREAM = 1,
277 LTTNG_UST_ABI_OBJECT_TYPE_EVENT = 2,
278 LTTNG_UST_ABI_OBJECT_TYPE_CONTEXT = 3,
279 LTTNG_UST_ABI_OBJECT_TYPE_EVENT_NOTIFIER_GROUP = 4,
280 LTTNG_UST_ABI_OBJECT_TYPE_EVENT_NOTIFIER = 5,
281 LTTNG_UST_ABI_OBJECT_TYPE_COUNTER = 6,
282 LTTNG_UST_ABI_OBJECT_TYPE_COUNTER_GLOBAL = 7,
283 LTTNG_UST_ABI_OBJECT_TYPE_COUNTER_CPU = 8,
284};
285
286#define LTTNG_UST_ABI_OBJECT_DATA_PADDING1 32
287#define LTTNG_UST_ABI_OBJECT_DATA_PADDING2 (LTTNG_UST_ABI_SYM_NAME_LEN + 32)
288
289struct lttng_ust_abi_object_data {
290 int32_t type; /* enum lttng_ust_abi_object_type */
291 int handle;
292 uint64_t size;
293 char padding1[LTTNG_UST_ABI_OBJECT_DATA_PADDING1];
294 union {
295 struct {
296 void *data;
297 int32_t type; /* enum lttng_ust_abi_chan_type */
298 int wakeup_fd;
299 } channel;
300 struct {
301 int shm_fd;
302 int wakeup_fd;
303 uint32_t stream_nr;
304 } stream;
305 struct {
306 void *data;
307 } counter;
308 struct {
309 int shm_fd;
310 } counter_global;
311 struct {
312 int shm_fd;
313 uint32_t cpu_nr;
314 } counter_cpu;
315 char padding2[LTTNG_UST_ABI_OBJECT_DATA_PADDING2];
316 } u;
317} LTTNG_PACKED;
318
319enum lttng_ust_abi_calibrate_type {
320 LTTNG_UST_ABI_CALIBRATE_TRACEPOINT,
321};
322
323#define LTTNG_UST_ABI_CALIBRATE_PADDING1 16
324#define LTTNG_UST_ABI_CALIBRATE_PADDING2 (LTTNG_UST_ABI_SYM_NAME_LEN + 32)
325struct lttng_ust_abi_calibrate {
326 enum lttng_ust_abi_calibrate_type type; /* type (input) */
327 char padding[LTTNG_UST_ABI_CALIBRATE_PADDING1];
328
329 union {
330 char padding[LTTNG_UST_ABI_CALIBRATE_PADDING2];
331 } u;
332} LTTNG_PACKED;
333
334#define LTTNG_UST_ABI_FILTER_BYTECODE_MAX_LEN 65536
335#define LTTNG_UST_ABI_FILTER_PADDING 32
336struct lttng_ust_abi_filter_bytecode {
337 uint32_t len;
338 uint32_t reloc_offset;
339 uint64_t seqnum;
340 char padding[LTTNG_UST_ABI_FILTER_PADDING];
341 char data[0];
342} LTTNG_PACKED;
343
344#define LTTNG_UST_ABI_CAPTURE_BYTECODE_MAX_LEN 65536
345#define LTTNG_UST_ABI_CAPTURE_PADDING 32
346struct lttng_ust_abi_capture_bytecode {
347 uint32_t len;
348 uint32_t reloc_offset;
349 uint64_t seqnum;
350 char padding[LTTNG_UST_ABI_CAPTURE_PADDING];
351 char data[0];
352} LTTNG_PACKED;
353
354#define LTTNG_UST_ABI_EXCLUSION_PADDING 32
355struct lttng_ust_abi_event_exclusion {
356 uint32_t count;
357 char padding[LTTNG_UST_ABI_EXCLUSION_PADDING];
358 char names[LTTNG_UST_ABI_SYM_NAME_LEN][0];
359} LTTNG_PACKED;
360
361#define LTTNG_UST_ABI_CMD(minor) (minor)
362#define LTTNG_UST_ABI_CMDR(minor, type) (minor)
363#define LTTNG_UST_ABI_CMDW(minor, type) (minor)
364
365/* Handled by object descriptor */
366#define LTTNG_UST_ABI_RELEASE LTTNG_UST_ABI_CMD(0x1)
367
368/* Handled by object cmd */
369
370/* LTTng-UST commands */
371#define LTTNG_UST_ABI_SESSION LTTNG_UST_ABI_CMD(0x40)
372#define LTTNG_UST_ABI_TRACER_VERSION LTTNG_UST_ABI_CMDR(0x41, struct lttng_ust_abi_tracer_version)
373#define LTTNG_UST_ABI_TRACEPOINT_LIST LTTNG_UST_ABI_CMD(0x42)
374#define LTTNG_UST_ABI_WAIT_QUIESCENT LTTNG_UST_ABI_CMD(0x43)
375#define LTTNG_UST_ABI_REGISTER_DONE LTTNG_UST_ABI_CMD(0x44)
376#define LTTNG_UST_ABI_TRACEPOINT_FIELD_LIST LTTNG_UST_ABI_CMD(0x45)
377#define LTTNG_UST_ABI_EVENT_NOTIFIER_GROUP_CREATE LTTNG_UST_ABI_CMD(0x46)
378
379/* Session commands */
380#define LTTNG_UST_ABI_CHANNEL LTTNG_UST_ABI_CMDW(0x51, struct lttng_ust_abi_channel)
381#define LTTNG_UST_ABI_SESSION_START LTTNG_UST_ABI_CMD(0x52)
382#define LTTNG_UST_ABI_SESSION_STOP LTTNG_UST_ABI_CMD(0x53)
383#define LTTNG_UST_ABI_SESSION_STATEDUMP LTTNG_UST_ABI_CMD(0x54)
384
385/* Channel commands */
386#define LTTNG_UST_ABI_STREAM LTTNG_UST_ABI_CMD(0x60)
387#define LTTNG_UST_ABI_EVENT LTTNG_UST_ABI_CMDW(0x61, struct lttng_ust_abi_event)
388
389/* Event and channel commands */
390#define LTTNG_UST_ABI_CONTEXT LTTNG_UST_ABI_CMDW(0x70, struct lttng_ust_abi_context)
391#define LTTNG_UST_ABI_FLUSH_BUFFER LTTNG_UST_ABI_CMD(0x71)
392
393/* Event, event notifier, channel and session commands */
394#define LTTNG_UST_ABI_ENABLE LTTNG_UST_ABI_CMD(0x80)
395#define LTTNG_UST_ABI_DISABLE LTTNG_UST_ABI_CMD(0x81)
396
397/* Tracepoint list commands */
398#define LTTNG_UST_ABI_TRACEPOINT_LIST_GET LTTNG_UST_ABI_CMD(0x90)
399#define LTTNG_UST_ABI_TRACEPOINT_FIELD_LIST_GET LTTNG_UST_ABI_CMD(0x91)
400
401/* Event and event notifier commands */
402#define LTTNG_UST_ABI_FILTER LTTNG_UST_ABI_CMD(0xA0)
403#define LTTNG_UST_ABI_EXCLUSION LTTNG_UST_ABI_CMD(0xA1)
404
405/* Event notifier group commands */
406#define LTTNG_UST_ABI_EVENT_NOTIFIER_CREATE \
407 LTTNG_UST_ABI_CMDW(0xB0, struct lttng_ust_abi_event_notifier)
408
409/* Event notifier commands */
410#define LTTNG_UST_ABI_CAPTURE LTTNG_UST_ABI_CMD(0xB6)
411
412/* Session and event notifier group commands */
413#define LTTNG_UST_ABI_COUNTER LTTNG_UST_ABI_CMDW(0xC0, struct lttng_ust_abi_counter)
414
415/* Counter commands */
416#define LTTNG_UST_ABI_COUNTER_GLOBAL LTTNG_UST_ABI_CMDW(0xD0, struct lttng_ust_abi_counter_global)
417#define LTTNG_UST_ABI_COUNTER_CPU LTTNG_UST_ABI_CMDW(0xD1, struct lttng_ust_abi_counter_cpu)
418
419#define LTTNG_UST_ABI_ROOT_HANDLE 0
420
421#endif /* LTTNG_UST_ABI_INTERNAL_H */
This page took 0.022763 seconds and 4 git commands to generate.