Fix: tests: extra arguments are not passed to the remove trigger command
[lttng-tools.git] / src / common / lttng-kernel.h
CommitLineData
93128a92 1/*
ab5be9fa
MJ
2 * Copyright (C) 2011 Julien Desfossez <julien.desfossez@polymtl.ca>
3 * Copyright (C) 2011 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
4 * Copyright (C) 2011 David Goulet <david.goulet@polymtl.ca>
93128a92 5 *
ab5be9fa 6 * SPDX-License-Identifier: GPL-2.0-only
93128a92 7 *
93128a92
DG
8 */
9
10#ifndef _LTTNG_KERNEL_H
11#define _LTTNG_KERNEL_H
12
e848fc76 13#include <stdint.h>
113373e4 14#include <common/macros.h>
0ef03255
FD
15#include <lttng/constant.h>
16#include <lttng/event.h>
e848fc76 17
2d6bae7e
FD
18#define LTTNG_KERNEL_ABI_SYM_NAME_LEN 256
19#define LTTNG_KERNEL_ABI_MAX_UPROBE_NUM 32
20#define LTTNG_KERNEL_ABI_SESSION_NAME_LEN 256
21#define LTTNG_KERNEL_ABI_SESSION_CREATION_TIME_ISO8601_LEN 26
9cb98350 22
7d29a247
DG
23/*
24 * LTTng DebugFS ABI structures.
25 *
26 * This is the kernel ABI copied from lttng-modules tree.
27 */
28
2d6bae7e
FD
29enum lttng_kernel_abi_instrumentation {
30 LTTNG_KERNEL_ABI_ALL = -1, /* Used within lttng-tools */
31 LTTNG_KERNEL_ABI_TRACEPOINT = 0,
32 LTTNG_KERNEL_ABI_KPROBE = 1,
33 LTTNG_KERNEL_ABI_FUNCTION = 2,
34 LTTNG_KERNEL_ABI_KRETPROBE = 3,
35 LTTNG_KERNEL_ABI_NOOP = 4, /* not hooked */
36 LTTNG_KERNEL_ABI_SYSCALL = 5,
37 LTTNG_KERNEL_ABI_UPROBE = 6,
e6ddca71
DG
38};
39
2d6bae7e
FD
40enum lttng_kernel_abi_context_type {
41 LTTNG_KERNEL_ABI_CONTEXT_PID = 0,
42 LTTNG_KERNEL_ABI_CONTEXT_PERF_CPU_COUNTER = 1,
43 LTTNG_KERNEL_ABI_CONTEXT_PROCNAME = 2,
44 LTTNG_KERNEL_ABI_CONTEXT_PRIO = 3,
45 LTTNG_KERNEL_ABI_CONTEXT_NICE = 4,
46 LTTNG_KERNEL_ABI_CONTEXT_VPID = 5,
47 LTTNG_KERNEL_ABI_CONTEXT_TID = 6,
48 LTTNG_KERNEL_ABI_CONTEXT_VTID = 7,
49 LTTNG_KERNEL_ABI_CONTEXT_PPID = 8,
50 LTTNG_KERNEL_ABI_CONTEXT_VPPID = 9,
51 LTTNG_KERNEL_ABI_CONTEXT_HOSTNAME = 10,
52 LTTNG_KERNEL_ABI_CONTEXT_CPU_ID = 11,
53 LTTNG_KERNEL_ABI_CONTEXT_INTERRUPTIBLE = 12,
54 LTTNG_KERNEL_ABI_CONTEXT_PREEMPTIBLE = 13,
55 LTTNG_KERNEL_ABI_CONTEXT_NEED_RESCHEDULE = 14,
56 LTTNG_KERNEL_ABI_CONTEXT_MIGRATABLE = 15,
57 LTTNG_KERNEL_ABI_CONTEXT_CALLSTACK_KERNEL = 16,
58 LTTNG_KERNEL_ABI_CONTEXT_CALLSTACK_USER = 17,
59 LTTNG_KERNEL_ABI_CONTEXT_CGROUP_NS = 18,
60 LTTNG_KERNEL_ABI_CONTEXT_IPC_NS = 19,
61 LTTNG_KERNEL_ABI_CONTEXT_MNT_NS = 20,
62 LTTNG_KERNEL_ABI_CONTEXT_NET_NS = 21,
63 LTTNG_KERNEL_ABI_CONTEXT_PID_NS = 22,
64 LTTNG_KERNEL_ABI_CONTEXT_USER_NS = 23,
65 LTTNG_KERNEL_ABI_CONTEXT_UTS_NS = 24,
66 LTTNG_KERNEL_ABI_CONTEXT_UID = 25,
67 LTTNG_KERNEL_ABI_CONTEXT_EUID = 26,
68 LTTNG_KERNEL_ABI_CONTEXT_SUID = 27,
69 LTTNG_KERNEL_ABI_CONTEXT_GID = 28,
70 LTTNG_KERNEL_ABI_CONTEXT_EGID = 29,
71 LTTNG_KERNEL_ABI_CONTEXT_SGID = 30,
72 LTTNG_KERNEL_ABI_CONTEXT_VUID = 31,
73 LTTNG_KERNEL_ABI_CONTEXT_VEUID = 32,
74 LTTNG_KERNEL_ABI_CONTEXT_VSUID = 33,
75 LTTNG_KERNEL_ABI_CONTEXT_VGID = 34,
76 LTTNG_KERNEL_ABI_CONTEXT_VEGID = 35,
77 LTTNG_KERNEL_ABI_CONTEXT_VSGID = 36,
78 LTTNG_KERNEL_ABI_CONTEXT_TIME_NS = 37,
7d29a247
DG
79};
80
81/* Perf counter attributes */
2d6bae7e 82struct lttng_kernel_abi_perf_counter_ctx {
7d29a247
DG
83 uint32_t type;
84 uint64_t config;
2d6bae7e 85 char name[LTTNG_KERNEL_ABI_SYM_NAME_LEN];
113373e4 86} LTTNG_PACKED;
7d29a247
DG
87
88/* Event/Channel context */
2d6bae7e
FD
89#define LTTNG_KERNEL_ABI_CONTEXT_PADDING1 16
90#define LTTNG_KERNEL_ABI_CONTEXT_PADDING2 LTTNG_KERNEL_ABI_SYM_NAME_LEN + 32
91struct lttng_kernel_abi_context {
92 enum lttng_kernel_abi_context_type ctx;
93 char padding[LTTNG_KERNEL_ABI_CONTEXT_PADDING1];
dbbb3ec5 94
7d29a247 95 union {
2d6bae7e
FD
96 struct lttng_kernel_abi_perf_counter_ctx perf_counter;
97 char padding[LTTNG_KERNEL_ABI_CONTEXT_PADDING2];
7d29a247 98 } u;
113373e4 99} LTTNG_PACKED;
9cb98350 100
2d6bae7e 101struct lttng_kernel_abi_kretprobe {
8f0d098b
MD
102 uint64_t addr;
103
104 uint64_t offset;
2d6bae7e 105 char symbol_name[LTTNG_KERNEL_ABI_SYM_NAME_LEN];
113373e4 106} LTTNG_PACKED;
8f0d098b 107
93128a92 108/*
7d29a247 109 * Either addr is used, or symbol_name and offset.
93128a92 110 */
2d6bae7e 111struct lttng_kernel_abi_kprobe {
7d29a247
DG
112 uint64_t addr;
113
114 uint64_t offset;
2d6bae7e 115 char symbol_name[LTTNG_KERNEL_ABI_SYM_NAME_LEN];
113373e4 116} LTTNG_PACKED;
9cb98350 117
2d6bae7e 118struct lttng_kernel_abi_uprobe {
1ab8c2ad
FD
119 int fd;
120} LTTNG_PACKED;
121
2d6bae7e 122struct lttng_kernel_abi_event_callsite_uprobe {
1ab8c2ad
FD
123 uint64_t offset;
124} LTTNG_PACKED;
125
2d6bae7e 126struct lttng_kernel_abi_event_callsite {
1ab8c2ad 127 union {
2d6bae7e 128 struct lttng_kernel_abi_event_callsite_uprobe uprobe;
1ab8c2ad
FD
129 } u;
130} LTTNG_PACKED;
131
2d6bae7e
FD
132enum lttng_kernel_abi_syscall_entryexit {
133 LTTNG_KERNEL_ABI_SYSCALL_ENTRYEXIT = 0,
134 LTTNG_KERNEL_ABI_SYSCALL_ENTRY = 1,
135 LTTNG_KERNEL_ABI_SYSCALL_EXIT = 2,
c863e5a6
FD
136};
137
2d6bae7e
FD
138enum lttng_kernel_abi_syscall_abi {
139 LTTNG_KERNEL_ABI_SYSCALL_ABI_ALL = 0,
140 LTTNG_KERNEL_ABI_SYSCALL_ABI_NATIVE = 1,
141 LTTNG_KERNEL_ABI_SYSCALL_ABI_COMPAT = 2,
c863e5a6
FD
142};
143
2d6bae7e
FD
144enum lttng_kernel_abi_syscall_match {
145 LTTNG_KERNEL_ABI_SYSCALL_MATCH_NAME = 0,
146 LTTNG_KERNEL_ABI_SYSCALL_MATCH_NR = 1,
c863e5a6
FD
147};
148
2d6bae7e
FD
149struct lttng_kernel_abi_syscall {
150 uint8_t entryexit; /* enum lttng_kernel_abi_syscall_entryexit */
151 uint8_t abi; /* enum lttng_kernel_abi_syscall_abi */
152 uint8_t match; /* enum lttng_kernel_abi_syscall_match */
c863e5a6
FD
153 uint8_t padding;
154 uint32_t nr; /* For LTTNG_SYSCALL_MATCH_NR */
155} LTTNG_PACKED;
156
f05b5f07 157/* Function tracer */
2d6bae7e
FD
158struct lttng_kernel_abi_function {
159 char symbol_name[LTTNG_KERNEL_ABI_SYM_NAME_LEN];
113373e4 160} LTTNG_PACKED;
93128a92 161
2d6bae7e
FD
162#define LTTNG_KERNEL_ABI_EVENT_PADDING1 8
163#define LTTNG_KERNEL_ABI_EVENT_PADDING2 LTTNG_KERNEL_ABI_SYM_NAME_LEN + 32
164struct lttng_kernel_abi_event {
165 char name[LTTNG_KERNEL_ABI_SYM_NAME_LEN];
166 enum lttng_kernel_abi_instrumentation instrumentation;
8e49ca12 167 uint64_t token;
2d6bae7e 168 char padding[LTTNG_KERNEL_ABI_EVENT_PADDING1];
dbbb3ec5 169
9cb98350
JD
170 /* Per instrumentation type configuration */
171 union {
2d6bae7e
FD
172 struct lttng_kernel_abi_kretprobe kretprobe;
173 struct lttng_kernel_abi_kprobe kprobe;
174 struct lttng_kernel_abi_function ftrace;
175 struct lttng_kernel_abi_uprobe uprobe;
176 struct lttng_kernel_abi_syscall syscall;
177 char padding[LTTNG_KERNEL_ABI_EVENT_PADDING2];
9cb98350 178 } u;
113373e4 179} LTTNG_PACKED;
93128a92 180
2d6bae7e
FD
181#define LTTNG_KERNEL_ABI_EVENT_NOTIFIER_PADDING 32
182struct lttng_kernel_abi_event_notifier {
183 struct lttng_kernel_abi_event event;
90aa04a1
FD
184 uint64_t error_counter_idx;
185
2d6bae7e 186 char padding[LTTNG_KERNEL_ABI_EVENT_NOTIFIER_PADDING];
cfb1c9bc
JR
187} LTTNG_PACKED;
188
2d6bae7e 189#define LTTNG_KERNEL_ABI_COUNTER_DIMENSION_MAX 4
90aa04a1 190
2d6bae7e
FD
191enum lttng_kernel_abi_counter_arithmetic {
192 LTTNG_KERNEL_ABI_COUNTER_ARITHMETIC_MODULAR = 0,
90aa04a1
FD
193};
194
2d6bae7e
FD
195enum lttng_kernel_abi_counter_bitness {
196 LTTNG_KERNEL_ABI_COUNTER_BITNESS_32 = 0,
197 LTTNG_KERNEL_ABI_COUNTER_BITNESS_64 = 1,
90aa04a1
FD
198};
199
2d6bae7e 200struct lttng_kernel_abi_counter_dimension {
90aa04a1
FD
201 uint64_t size;
202 uint64_t underflow_index;
203 uint64_t overflow_index;
204 uint8_t has_underflow;
205 uint8_t has_overflow;
206} LTTNG_PACKED;
207
2d6bae7e
FD
208#define LTTNG_KERNEL_ABI_COUNTER_CONF_PADDING1 67
209struct lttng_kernel_abi_counter_conf {
210 uint32_t arithmetic; /* enum lttng_kernel_abi_counter_arithmetic */
211 uint32_t bitness; /* enum lttng_kernel_abi_counter_bitness */
90aa04a1
FD
212 uint32_t number_dimensions;
213 int64_t global_sum_step;
2d6bae7e 214 struct lttng_kernel_abi_counter_dimension dimensions[LTTNG_KERNEL_ABI_COUNTER_DIMENSION_MAX];
90aa04a1 215 uint8_t coalesce_hits;
2d6bae7e 216 char padding[LTTNG_KERNEL_ABI_COUNTER_CONF_PADDING1];
90aa04a1
FD
217} LTTNG_PACKED;
218
2d6bae7e 219struct lttng_kernel_abi_counter_index {
90aa04a1 220 uint32_t number_dimensions;
2d6bae7e 221 uint64_t dimension_indexes[LTTNG_KERNEL_ABI_COUNTER_DIMENSION_MAX];
90aa04a1
FD
222} LTTNG_PACKED;
223
2d6bae7e 224struct lttng_kernel_abi_counter_value {
90aa04a1
FD
225 int64_t value;
226 uint8_t underflow;
227 uint8_t overflow;
228} LTTNG_PACKED;
229
2d6bae7e
FD
230#define LTTNG_KERNEL_ABI_COUNTER_READ_PADDING 32
231struct lttng_kernel_abi_counter_read {
232 struct lttng_kernel_abi_counter_index index;
90aa04a1 233 int32_t cpu; /* -1 for global counter, >= 0 for specific cpu. */
2d6bae7e
FD
234 struct lttng_kernel_abi_counter_value value; /* output */
235 char padding[LTTNG_KERNEL_ABI_COUNTER_READ_PADDING];
90aa04a1
FD
236} LTTNG_PACKED;
237
2d6bae7e
FD
238#define LTTNG_KERNEL_ABI_COUNTER_AGGREGATE_PADDING 32
239struct lttng_kernel_abi_counter_aggregate {
240 struct lttng_kernel_abi_counter_index index;
241 struct lttng_kernel_abi_counter_value value; /* output */
242 char padding[LTTNG_KERNEL_ABI_COUNTER_AGGREGATE_PADDING];
90aa04a1
FD
243} LTTNG_PACKED;
244
2d6bae7e
FD
245#define LTTNG_KERNEL_ABI_COUNTER_CLEAR_PADDING 32
246struct lttng_kernel_abi_counter_clear {
247 struct lttng_kernel_abi_counter_index index;
248 char padding[LTTNG_KERNEL_ABI_COUNTER_CLEAR_PADDING];
90aa04a1
FD
249} LTTNG_PACKED;
250
2d6bae7e
FD
251#define LTTNG_KERNEL_ABI_EVENT_NOTIFIER_NOTIFICATION_PADDING 32
252struct lttng_kernel_abi_event_notifier_notification {
cfb1c9bc 253 uint64_t token;
bbd6675c 254 uint16_t capture_buf_size;
2d6bae7e 255 char padding[LTTNG_KERNEL_ABI_EVENT_NOTIFIER_NOTIFICATION_PADDING];
cfb1c9bc
JR
256} LTTNG_PACKED;
257
2d6bae7e
FD
258#define LTTNG_KERNEL_ABI_CAPTURE_BYTECODE_MAX_LEN 65536
259struct lttng_kernel_abi_capture_bytecode {
bbd6675c
JR
260 uint32_t len;
261 uint32_t reloc_offset;
262 uint64_t seqnum;
263 char data[0];
264} LTTNG_PACKED;
265
2d6bae7e 266struct lttng_kernel_abi_tracer_version {
a62a6556
MD
267 uint32_t major;
268 uint32_t minor;
9cb98350 269 uint32_t patchlevel;
113373e4 270} LTTNG_PACKED;
93128a92 271
2d6bae7e 272struct lttng_kernel_abi_tracer_abi_version {
c052142c
MD
273 uint32_t major;
274 uint32_t minor;
275} LTTNG_PACKED;
276
2d6bae7e 277struct lttng_kernel_abi_syscall_mask {
46820c8b 278 uint32_t len; /* in bits */
e80c3634
MD
279 char mask[];
280} LTTNG_PACKED;
281
4dbc372b
JD
282/*
283 * kernel channel
284 */
2d6bae7e
FD
285#define LTTNG_KERNEL_ABI_CHANNEL_PADDING1 LTTNG_SYMBOL_NAME_LEN + 32
286struct lttng_kernel_abi_channel {
4dbc372b
JD
287 uint64_t subbuf_size; /* bytes */
288 uint64_t num_subbuf; /* power of 2 */
289 unsigned int switch_timer_interval; /* usec */
290 unsigned int read_timer_interval; /* usec */
291 enum lttng_event_output output; /* splice, mmap */
292
293 int overwrite; /* 1: overwrite, 0: discard */
2d6bae7e 294 char padding[LTTNG_KERNEL_ABI_CHANNEL_PADDING1];
113373e4 295} LTTNG_PACKED;
d0254c7c 296
00a62084 297#define KERNEL_FILTER_BYTECODE_MAX_LEN 65536
2d6bae7e 298struct lttng_kernel_abi_filter_bytecode {
00a62084
MD
299 uint32_t len;
300 uint32_t reloc_offset;
301 uint64_t seqnum;
302 char data[0];
303} LTTNG_PACKED;
304
8ff4109e
JR
305/*
306 * kernel session name
307 */
2d6bae7e
FD
308struct lttng_kernel_abi_session_name {
309 char name[LTTNG_KERNEL_ABI_SESSION_NAME_LEN];
8ff4109e
JR
310} LTTNG_PACKED;
311
e04b2181
JR
312/*
313 * kernel session creation datetime
314 */
2d6bae7e
FD
315struct lttng_kernel_abi_session_creation_time {
316 char iso8601[LTTNG_KERNEL_ABI_SESSION_CREATION_TIME_ISO8601_LEN];
e04b2181
JR
317} LTTNG_PACKED;
318
2d6bae7e
FD
319enum lttng_kernel_abi_tracker_type {
320 LTTNG_KERNEL_ABI_TRACKER_UNKNOWN = -1,
d01c0e56 321
2d6bae7e
FD
322 LTTNG_KERNEL_ABI_TRACKER_PID = 0,
323 LTTNG_KERNEL_ABI_TRACKER_VPID = 1,
324 LTTNG_KERNEL_ABI_TRACKER_UID = 2,
325 LTTNG_KERNEL_ABI_TRACKER_VUID = 3,
326 LTTNG_KERNEL_ABI_TRACKER_GID = 4,
327 LTTNG_KERNEL_ABI_TRACKER_VGID = 5,
d01c0e56
MD
328};
329
2d6bae7e
FD
330struct lttng_kernel_abi_tracker_args {
331 enum lttng_kernel_abi_tracker_type type;
d01c0e56
MD
332 int32_t id;
333};
334
93128a92 335#endif /* _LTTNG_KERNEL_H */
This page took 0.075605 seconds and 4 git commands to generate.