| 1 | /* SPDX-License-Identifier: (GPL-2.0-only or LGPL-2.1-only) |
| 2 | * |
| 3 | * lttng/abi.h |
| 4 | * |
| 5 | * LTTng ABI header |
| 6 | * |
| 7 | * Copyright (C) 2010-2012 Mathieu Desnoyers <mathieu.desnoyers@efficios.com> |
| 8 | */ |
| 9 | |
| 10 | #ifndef _LTTNG_ABI_H |
| 11 | #define _LTTNG_ABI_H |
| 12 | |
| 13 | #include <linux/fs.h> |
| 14 | #include <linux/types.h> |
| 15 | |
| 16 | /* |
| 17 | * Major/minor version of ABI exposed to lttng tools. Major number |
| 18 | * should be increased when an incompatible ABI change is done. |
| 19 | */ |
| 20 | #define LTTNG_KERNEL_ABI_MAJOR_VERSION 2 |
| 21 | #define LTTNG_KERNEL_ABI_MINOR_VERSION 6 |
| 22 | |
| 23 | #define LTTNG_KERNEL_ABI_SYM_NAME_LEN 256 |
| 24 | #define LTTNG_KERNEL_ABI_SESSION_NAME_LEN 256 |
| 25 | |
| 26 | /* |
| 27 | * The expected iso8601 time formats are either: |
| 28 | * |
| 29 | * - YYYYmmddTHHMMSS+HHMM (20 characters + \0) |
| 30 | * - YYYY-mm-ddTHH:MM:SS+HH:MM (25 characters + \0) |
| 31 | */ |
| 32 | #define LTTNG_KERNEL_ABI_SESSION_CREATION_TIME_ISO8601_LEN 26 |
| 33 | |
| 34 | enum lttng_kernel_abi_instrumentation { |
| 35 | LTTNG_KERNEL_ABI_TRACEPOINT = 0, |
| 36 | LTTNG_KERNEL_ABI_KPROBE = 1, |
| 37 | LTTNG_KERNEL_ABI_FUNCTION = 2, |
| 38 | LTTNG_KERNEL_ABI_KRETPROBE = 3, |
| 39 | LTTNG_KERNEL_ABI_NOOP = 4, /* not hooked */ |
| 40 | LTTNG_KERNEL_ABI_SYSCALL = 5, |
| 41 | LTTNG_KERNEL_ABI_UPROBE = 6, |
| 42 | }; |
| 43 | |
| 44 | /* |
| 45 | * LTTng consumer mode |
| 46 | */ |
| 47 | enum lttng_kernel_abi_output { |
| 48 | LTTNG_KERNEL_ABI_SPLICE = 0, |
| 49 | LTTNG_KERNEL_ABI_MMAP = 1, |
| 50 | }; |
| 51 | |
| 52 | /* |
| 53 | * LTTng DebugFS ABI structures. |
| 54 | */ |
| 55 | #define LTTNG_KERNEL_ABI_CHANNEL_PADDING LTTNG_KERNEL_ABI_SYM_NAME_LEN + 32 |
| 56 | struct lttng_kernel_abi_channel { |
| 57 | uint64_t subbuf_size; /* in bytes */ |
| 58 | uint64_t num_subbuf; |
| 59 | unsigned int switch_timer_interval; /* usecs */ |
| 60 | unsigned int read_timer_interval; /* usecs */ |
| 61 | uint32_t output; /* enum lttng_kernel_abi_output (splice, mmap) */ |
| 62 | int overwrite; /* 1: overwrite, 0: discard */ |
| 63 | char padding[LTTNG_KERNEL_ABI_CHANNEL_PADDING]; |
| 64 | } __attribute__((packed)); |
| 65 | |
| 66 | enum lttng_kernel_abi_kretprobe_entryexit { |
| 67 | LTTNG_KERNEL_ABI_KRETPROBE_ENTRYEXIT = 0, |
| 68 | LTTNG_KERNEL_ABI_KRETPROBE_ENTRY = 1, |
| 69 | LTTNG_KERNEL_ABI_KRETPROBE_EXIT = 2, |
| 70 | }; |
| 71 | |
| 72 | struct lttng_kernel_abi_kretprobe { |
| 73 | uint64_t addr; |
| 74 | |
| 75 | uint64_t offset; |
| 76 | char symbol_name[LTTNG_KERNEL_ABI_SYM_NAME_LEN]; |
| 77 | uint8_t entryexit; /* enum lttng_kernel_abi_kretprobe_entryexit */ |
| 78 | } __attribute__((packed)); |
| 79 | |
| 80 | /* |
| 81 | * Either addr is used, or symbol_name and offset. |
| 82 | */ |
| 83 | struct lttng_kernel_abi_kprobe { |
| 84 | uint64_t addr; |
| 85 | |
| 86 | uint64_t offset; |
| 87 | char symbol_name[LTTNG_KERNEL_ABI_SYM_NAME_LEN]; |
| 88 | } __attribute__((packed)); |
| 89 | |
| 90 | struct lttng_kernel_abi_function_tracer { |
| 91 | char symbol_name[LTTNG_KERNEL_ABI_SYM_NAME_LEN]; |
| 92 | } __attribute__((packed)); |
| 93 | |
| 94 | struct lttng_kernel_abi_uprobe { |
| 95 | int fd; |
| 96 | } __attribute__((packed)); |
| 97 | |
| 98 | struct lttng_kernel_abi_event_callsite_uprobe { |
| 99 | uint64_t offset; |
| 100 | } __attribute__((packed)); |
| 101 | |
| 102 | struct lttng_kernel_abi_event_callsite { |
| 103 | union { |
| 104 | struct lttng_kernel_abi_event_callsite_uprobe uprobe; |
| 105 | } u; |
| 106 | } __attribute__((packed)); |
| 107 | |
| 108 | enum lttng_kernel_abi_syscall_entryexit { |
| 109 | LTTNG_KERNEL_ABI_SYSCALL_ENTRYEXIT = 0, |
| 110 | LTTNG_KERNEL_ABI_SYSCALL_ENTRY = 1, |
| 111 | LTTNG_KERNEL_ABI_SYSCALL_EXIT = 2, |
| 112 | }; |
| 113 | |
| 114 | enum lttng_kernel_abi_syscall_abi { |
| 115 | LTTNG_KERNEL_ABI_SYSCALL_ABI_ALL = 0, |
| 116 | LTTNG_KERNEL_ABI_SYSCALL_ABI_NATIVE = 1, |
| 117 | LTTNG_KERNEL_ABI_SYSCALL_ABI_COMPAT = 2, |
| 118 | }; |
| 119 | |
| 120 | enum lttng_kernel_abi_syscall_match { |
| 121 | LTTNG_KERNEL_ABI_SYSCALL_MATCH_NAME = 0, |
| 122 | LTTNG_KERNEL_ABI_SYSCALL_MATCH_NR = 1, /* Not implemented. */ |
| 123 | }; |
| 124 | |
| 125 | struct lttng_kernel_abi_syscall { |
| 126 | uint8_t entryexit; /* enum lttng_kernel_abi_syscall_entryexit */ |
| 127 | uint8_t abi; /* enum lttng_kernel_abi_syscall_abi */ |
| 128 | uint8_t match; /* enum lttng_kernel_abi_syscall_match */ |
| 129 | uint8_t padding; |
| 130 | uint32_t nr; /* For LTTNG_SYSCALL_MATCH_NR */ |
| 131 | } __attribute__((packed)); |
| 132 | |
| 133 | /* |
| 134 | * An immediate match requires that the requested event matches existing |
| 135 | * instrumentation when the ioctl is issued, whereas a lazy match does not |
| 136 | * have this constraint. |
| 137 | * |
| 138 | * Instrumentation default |
| 139 | * --------------------------------------------------------------------------- |
| 140 | * LTTNG_KERNEL_ABI_TRACEPOINT: lazy |
| 141 | * LTTNG_KERNEL_ABI_SYSCALL: lazy |
| 142 | * LTTNG_KERNEL_ABI_KPROBE: immediate |
| 143 | * LTTNG_KERNEL_ABI_KRETPROBE: immediate |
| 144 | * LTTNG_KERNEL_ABI_UPROBE: immediate |
| 145 | */ |
| 146 | enum lttng_kernel_abi_match_check { |
| 147 | LTTNG_KERNEL_ABI_MATCH_DEFAULT = 0, |
| 148 | LTTNG_KERNEL_ABI_MATCH_IMMEDIATE = 1, |
| 149 | LTTNG_KERNEL_ABI_MATCH_LAZY = 2, |
| 150 | }; |
| 151 | |
| 152 | /* |
| 153 | * Extended event parameters. |
| 154 | */ |
| 155 | struct lttng_kernel_abi_event_ext { |
| 156 | uint32_t len; /* length of this structure */ |
| 157 | |
| 158 | uint8_t match_check; /* enum lttng_kernel_abi_match_check */ |
| 159 | } __attribute__((packed)); |
| 160 | |
| 161 | /* |
| 162 | * For syscall tracing, name = "*" means "enable all". |
| 163 | */ |
| 164 | #define LTTNG_KERNEL_ABI_EVENT_PADDING2 LTTNG_KERNEL_ABI_SYM_NAME_LEN + 32 |
| 165 | struct lttng_kernel_abi_event { |
| 166 | char name[LTTNG_KERNEL_ABI_SYM_NAME_LEN]; /* event name */ |
| 167 | uint32_t instrumentation; /* enum lttng_kernel_abi_instrumentation */ |
| 168 | uint64_t token; /* User-provided token */ |
| 169 | uint64_t event_ext; /* struct lttng_kernel_abi_event_ext */ |
| 170 | |
| 171 | /* Per instrumentation type configuration */ |
| 172 | union { |
| 173 | struct lttng_kernel_abi_kretprobe kretprobe; |
| 174 | struct lttng_kernel_abi_kprobe kprobe; |
| 175 | struct lttng_kernel_abi_function_tracer ftrace; |
| 176 | struct lttng_kernel_abi_uprobe uprobe; |
| 177 | struct lttng_kernel_abi_syscall syscall; |
| 178 | char padding[LTTNG_KERNEL_ABI_EVENT_PADDING2]; |
| 179 | } u; |
| 180 | } __attribute__((packed)); |
| 181 | |
| 182 | #define LTTNG_KERNEL_ABI_EVENT_NOTIFIER_PADDING 32 |
| 183 | struct lttng_kernel_abi_event_notifier { |
| 184 | struct lttng_kernel_abi_event event; |
| 185 | uint64_t error_counter_index; |
| 186 | |
| 187 | char padding[LTTNG_KERNEL_ABI_EVENT_NOTIFIER_PADDING]; |
| 188 | } __attribute__((packed)); |
| 189 | |
| 190 | #define LTTNG_KERNEL_ABI_EVENT_NOTIFIER_NOTIFICATION_PADDING 32 |
| 191 | struct lttng_kernel_abi_event_notifier_notification { |
| 192 | uint64_t token; |
| 193 | uint16_t capture_buf_size; |
| 194 | char padding[LTTNG_KERNEL_ABI_EVENT_NOTIFIER_NOTIFICATION_PADDING]; |
| 195 | } __attribute__((packed)); |
| 196 | |
| 197 | enum lttng_kernel_abi_key_token_type { |
| 198 | LTTNG_KERNEL_ABI_KEY_TOKEN_STRING = 0, /* arg: string_ptr. */ |
| 199 | LTTNG_KERNEL_ABI_KEY_TOKEN_EVENT_NAME = 1, /* no arg. */ |
| 200 | LTTNG_KERNEL_ABI_KEY_TOKEN_PROVIDER_NAME = 2, /* no arg. */ |
| 201 | }; |
| 202 | |
| 203 | enum lttng_kernel_abi_counter_arithmetic { |
| 204 | LTTNG_KERNEL_ABI_COUNTER_ARITHMETIC_MODULAR = 0, |
| 205 | }; |
| 206 | |
| 207 | enum lttng_kernel_abi_counter_bitness { |
| 208 | LTTNG_KERNEL_ABI_COUNTER_BITNESS_32 = 0, |
| 209 | LTTNG_KERNEL_ABI_COUNTER_BITNESS_64 = 1, |
| 210 | }; |
| 211 | |
| 212 | struct lttng_kernel_abi_key_token { |
| 213 | uint32_t len; /* length of child structure. */ |
| 214 | uint32_t type; /* enum lttng_kernel_abi_key_token_type */ |
| 215 | /* |
| 216 | * The size of this structure is fixed because it is embedded into |
| 217 | * children structures. |
| 218 | */ |
| 219 | } __attribute__((packed)); |
| 220 | |
| 221 | /* Length of this structure excludes the following string. */ |
| 222 | struct lttng_kernel_abi_key_token_string { |
| 223 | struct lttng_kernel_abi_key_token parent; |
| 224 | uint32_t string_len; /* string length (includes \0) */ |
| 225 | |
| 226 | /* Null-terminated string of length @string_len follows this structure. */ |
| 227 | } __attribute__((packed)); |
| 228 | |
| 229 | /* |
| 230 | * token types event_name and provider_name don't have specific fields, |
| 231 | * so they do not need to derive their own specific child structure. |
| 232 | */ |
| 233 | |
| 234 | struct lttng_kernel_abi_counter_map_descriptor { |
| 235 | uint32_t len; /* length of this structure. */ |
| 236 | |
| 237 | uint64_t descriptor_index; /* Descriptor index (input: [ 0 .. nr_descriptors - 1 ]) */ |
| 238 | |
| 239 | uint32_t dimension; /* Dimension indexed (output) */ |
| 240 | uint64_t user_token; /* User-provided 64-bit token (output) */ |
| 241 | uint64_t key_string; /* |
| 242 | * Pointer (input) to key string associated with this index |
| 243 | * (output). If key_string_len is smaller than the required |
| 244 | * space, the ioctl fails with -ENOSPC, storing the required |
| 245 | * string space into @key_string_len. |
| 246 | */ |
| 247 | uint32_t key_string_len; /* Key string length (input/output, includes \0) */ |
| 248 | uint64_t array_indexes; /* |
| 249 | * Pointer (input) to array of indexes within each dimension |
| 250 | * (output). There are @dimension values populated. Each |
| 251 | * element is of type uint64_t. If arrays_indexes_len is |
| 252 | * smaller than @dimension, the ioctl fails with -ENOSPC, |
| 253 | * storing the required array index length into |
| 254 | * @array_index_len. |
| 255 | */ |
| 256 | uint32_t array_indexes_len; /* Array indexes length (input/output). */ |
| 257 | } __attribute__((packed)); |
| 258 | |
| 259 | /* |
| 260 | * Dimension indexing: All events should use the same key type to index |
| 261 | * a given map dimension. |
| 262 | */ |
| 263 | enum lttng_kernel_abi_key_type { |
| 264 | LTTNG_KERNEL_ABI_KEY_TYPE_TOKENS = 0, /* Dimension key is a set of tokens. */ |
| 265 | LTTNG_KERNEL_ABI_KEY_TYPE_INTEGER = 1, /* Dimension key is an integer value. */ |
| 266 | }; |
| 267 | |
| 268 | struct lttng_kernel_abi_counter_key_dimension { |
| 269 | uint32_t len; /* length of child structure */ |
| 270 | uint32_t key_type; /* enum lttng_kernel_abi_key_type */ |
| 271 | /* |
| 272 | * The size of this structure is fixed because it is embedded |
| 273 | * into children structures. |
| 274 | */ |
| 275 | } __attribute__((packed)); |
| 276 | |
| 277 | struct lttng_kernel_abi_counter_key_dimension_tokens { |
| 278 | struct lttng_kernel_abi_counter_key_dimension parent; |
| 279 | uint32_t nr_key_tokens; |
| 280 | |
| 281 | /* Followed by an array of nr_key_tokens struct lttng_kernel_abi_key_token elements. */ |
| 282 | } __attribute__((packed)); |
| 283 | |
| 284 | /* |
| 285 | * The "integer" key type is not implemented yet, but when it will be |
| 286 | * introduced in the future, its specific key dimension will allow |
| 287 | * defining the function to apply over input argument, bytecode to run |
| 288 | * and so on. |
| 289 | */ |
| 290 | |
| 291 | enum lttng_kernel_abi_counter_action { |
| 292 | LTTNG_KERNEL_ABI_COUNTER_ACTION_INCREMENT = 0, |
| 293 | |
| 294 | /* |
| 295 | * Can be extended with additional actions, such as decrement, |
| 296 | * set value, run bytecode, and so on. |
| 297 | */ |
| 298 | }; |
| 299 | |
| 300 | struct lttng_kernel_abi_counter_event { |
| 301 | uint32_t len; /* length of this structure */ |
| 302 | uint32_t action; /* enum lttng_kernel_abi_counter_action */ |
| 303 | |
| 304 | struct lttng_kernel_abi_event event; |
| 305 | uint32_t number_key_dimensions; /* array of dimensions is an array of var. len. elements. */ |
| 306 | |
| 307 | /* |
| 308 | * Followed by additional data specific to the action, and by a |
| 309 | * variable-length array of key dimensions. |
| 310 | */ |
| 311 | } __attribute__((packed)); |
| 312 | |
| 313 | enum lttng_kernel_abi_counter_dimension_flags { |
| 314 | LTTNG_KERNEL_ABI_COUNTER_DIMENSION_FLAG_UNDERFLOW = (1 << 0), |
| 315 | LTTNG_KERNEL_ABI_COUNTER_DIMENSION_FLAG_OVERFLOW = (1 << 1), |
| 316 | }; |
| 317 | |
| 318 | struct lttng_kernel_abi_counter_dimension { |
| 319 | uint32_t key_type; /* enum lttng_kernel_abi_key_type */ |
| 320 | uint32_t flags; /* enum lttng_kernel_abi_counter_dimension_flags */ |
| 321 | uint64_t size; /* dimension size */ |
| 322 | uint64_t underflow_index; |
| 323 | uint64_t overflow_index; |
| 324 | } __attribute__((packed)); |
| 325 | |
| 326 | struct lttng_kernel_abi_counter_dimension_array { |
| 327 | uint32_t number_dimensions; |
| 328 | uint32_t elem_len; /* array stride (size of struct lttng_kernel_abi_counter_dimension) */ |
| 329 | uint64_t ptr; /* pointer to array of struct lttng_kernel_abi_counter_dimension */ |
| 330 | } __attribute__((packed)); |
| 331 | |
| 332 | enum lttng_kernel_abi_counter_conf_flags { |
| 333 | LTTNG_KERNEL_ABI_COUNTER_CONF_FLAG_COALESCE_HITS = (1 << 0), |
| 334 | }; |
| 335 | |
| 336 | struct lttng_kernel_abi_counter_conf { |
| 337 | uint32_t len; /* length of this structure */ |
| 338 | uint32_t flags; /* enum lttng_kernel_abi_counter_conf_flags */ |
| 339 | uint32_t arithmetic; /* enum lttng_kernel_abi_counter_arithmetic */ |
| 340 | uint32_t bitness; /* enum lttng_kernel_abi_counter_bitness */ |
| 341 | int64_t global_sum_step; |
| 342 | struct lttng_kernel_abi_counter_dimension_array dimension_array; |
| 343 | } __attribute__((packed)); |
| 344 | |
| 345 | struct lttng_kernel_abi_counter_index { |
| 346 | uint32_t number_dimensions; |
| 347 | uint64_t ptr; /* pointer to dimension indexes (array of uint64_t) */ |
| 348 | } __attribute__((packed)); |
| 349 | |
| 350 | enum lttng_kernel_abi_counter_value_flags { |
| 351 | LTTNG_KERNEL_ABI_COUNTER_VALUE_FLAG_UNDERFLOW = (1 << 0), |
| 352 | LTTNG_KERNEL_ABI_COUNTER_VALUE_FLAG_OVERFLOW = (1 << 1), |
| 353 | }; |
| 354 | |
| 355 | struct lttng_kernel_abi_counter_value { |
| 356 | int64_t value; |
| 357 | uint32_t flags; /* enum lttng_kernel_abi_counter_value_flags */ |
| 358 | } __attribute__((packed)); |
| 359 | |
| 360 | struct lttng_kernel_abi_counter_read { |
| 361 | uint32_t len; /* length of this structure */ |
| 362 | struct lttng_kernel_abi_counter_index index; |
| 363 | int32_t cpu; /* -1 for global counter, >= 0 for specific cpu. */ |
| 364 | struct lttng_kernel_abi_counter_value value; /* output */ |
| 365 | } __attribute__((packed)); |
| 366 | |
| 367 | struct lttng_kernel_abi_counter_aggregate { |
| 368 | uint32_t len; /* length of this structure */ |
| 369 | struct lttng_kernel_abi_counter_index index; |
| 370 | struct lttng_kernel_abi_counter_value value; /* output */ |
| 371 | } __attribute__((packed)); |
| 372 | |
| 373 | struct lttng_kernel_abi_counter_clear { |
| 374 | uint32_t len; /* length of this structure */ |
| 375 | struct lttng_kernel_abi_counter_index index; |
| 376 | } __attribute__((packed)); |
| 377 | |
| 378 | struct lttng_kernel_abi_tracer_version { |
| 379 | uint32_t major; |
| 380 | uint32_t minor; |
| 381 | uint32_t patchlevel; |
| 382 | } __attribute__((packed)); |
| 383 | |
| 384 | struct lttng_kernel_abi_tracer_abi_version { |
| 385 | uint32_t major; |
| 386 | uint32_t minor; |
| 387 | } __attribute__((packed)); |
| 388 | |
| 389 | struct lttng_kernel_abi_session_name { |
| 390 | char name[LTTNG_KERNEL_ABI_SESSION_NAME_LEN]; |
| 391 | } __attribute__((packed)); |
| 392 | |
| 393 | struct lttng_kernel_abi_session_creation_time { |
| 394 | char iso8601[LTTNG_KERNEL_ABI_SESSION_CREATION_TIME_ISO8601_LEN]; |
| 395 | } __attribute__((packed)); |
| 396 | |
| 397 | enum lttng_kernel_abi_calibrate_type { |
| 398 | LTTNG_KERNEL_ABI_CALIBRATE_KRETPROBE, |
| 399 | }; |
| 400 | |
| 401 | struct lttng_kernel_abi_calibrate { |
| 402 | uint32_t type; /* enum lttng_kernel_abi_calibrate_type (input) */ |
| 403 | } __attribute__((packed)); |
| 404 | |
| 405 | struct lttng_kernel_abi_syscall_mask { |
| 406 | uint32_t len; /* in bits */ |
| 407 | char mask[]; |
| 408 | } __attribute__((packed)); |
| 409 | |
| 410 | enum lttng_kernel_abi_context_type { |
| 411 | LTTNG_KERNEL_ABI_CONTEXT_PID = 0, |
| 412 | LTTNG_KERNEL_ABI_CONTEXT_PERF_COUNTER = 1, |
| 413 | LTTNG_KERNEL_ABI_CONTEXT_PROCNAME = 2, |
| 414 | LTTNG_KERNEL_ABI_CONTEXT_PRIO = 3, |
| 415 | LTTNG_KERNEL_ABI_CONTEXT_NICE = 4, |
| 416 | LTTNG_KERNEL_ABI_CONTEXT_VPID = 5, |
| 417 | LTTNG_KERNEL_ABI_CONTEXT_TID = 6, |
| 418 | LTTNG_KERNEL_ABI_CONTEXT_VTID = 7, |
| 419 | LTTNG_KERNEL_ABI_CONTEXT_PPID = 8, |
| 420 | LTTNG_KERNEL_ABI_CONTEXT_VPPID = 9, |
| 421 | LTTNG_KERNEL_ABI_CONTEXT_HOSTNAME = 10, |
| 422 | LTTNG_KERNEL_ABI_CONTEXT_CPU_ID = 11, |
| 423 | LTTNG_KERNEL_ABI_CONTEXT_INTERRUPTIBLE = 12, |
| 424 | LTTNG_KERNEL_ABI_CONTEXT_PREEMPTIBLE = 13, |
| 425 | LTTNG_KERNEL_ABI_CONTEXT_NEED_RESCHEDULE = 14, |
| 426 | LTTNG_KERNEL_ABI_CONTEXT_MIGRATABLE = 15, |
| 427 | LTTNG_KERNEL_ABI_CONTEXT_CALLSTACK_KERNEL = 16, |
| 428 | LTTNG_KERNEL_ABI_CONTEXT_CALLSTACK_USER = 17, |
| 429 | LTTNG_KERNEL_ABI_CONTEXT_CGROUP_NS = 18, |
| 430 | LTTNG_KERNEL_ABI_CONTEXT_IPC_NS = 19, |
| 431 | LTTNG_KERNEL_ABI_CONTEXT_MNT_NS = 20, |
| 432 | LTTNG_KERNEL_ABI_CONTEXT_NET_NS = 21, |
| 433 | LTTNG_KERNEL_ABI_CONTEXT_PID_NS = 22, |
| 434 | LTTNG_KERNEL_ABI_CONTEXT_USER_NS = 23, |
| 435 | LTTNG_KERNEL_ABI_CONTEXT_UTS_NS = 24, |
| 436 | LTTNG_KERNEL_ABI_CONTEXT_UID = 25, |
| 437 | LTTNG_KERNEL_ABI_CONTEXT_EUID = 26, |
| 438 | LTTNG_KERNEL_ABI_CONTEXT_SUID = 27, |
| 439 | LTTNG_KERNEL_ABI_CONTEXT_GID = 28, |
| 440 | LTTNG_KERNEL_ABI_CONTEXT_EGID = 29, |
| 441 | LTTNG_KERNEL_ABI_CONTEXT_SGID = 30, |
| 442 | LTTNG_KERNEL_ABI_CONTEXT_VUID = 31, |
| 443 | LTTNG_KERNEL_ABI_CONTEXT_VEUID = 32, |
| 444 | LTTNG_KERNEL_ABI_CONTEXT_VSUID = 33, |
| 445 | LTTNG_KERNEL_ABI_CONTEXT_VGID = 34, |
| 446 | LTTNG_KERNEL_ABI_CONTEXT_VEGID = 35, |
| 447 | LTTNG_KERNEL_ABI_CONTEXT_VSGID = 36, |
| 448 | LTTNG_KERNEL_ABI_CONTEXT_TIME_NS = 37, |
| 449 | }; |
| 450 | |
| 451 | struct lttng_kernel_abi_perf_counter_ctx { |
| 452 | uint32_t type; |
| 453 | uint64_t config; |
| 454 | char name[LTTNG_KERNEL_ABI_SYM_NAME_LEN]; |
| 455 | } __attribute__((packed)); |
| 456 | |
| 457 | #define LTTNG_KERNEL_ABI_CONTEXT_PADDING1 16 |
| 458 | #define LTTNG_KERNEL_ABI_CONTEXT_PADDING2 LTTNG_KERNEL_ABI_SYM_NAME_LEN + 32 |
| 459 | struct lttng_kernel_abi_context { |
| 460 | uint32_t ctx; /*enum lttng_kernel_abi_context_type */ |
| 461 | char padding[LTTNG_KERNEL_ABI_CONTEXT_PADDING1]; |
| 462 | |
| 463 | union { |
| 464 | struct lttng_kernel_abi_perf_counter_ctx perf_counter; |
| 465 | char padding[LTTNG_KERNEL_ABI_CONTEXT_PADDING2]; |
| 466 | } u; |
| 467 | } __attribute__((packed)); |
| 468 | |
| 469 | #define LTTNG_KERNEL_ABI_FILTER_BYTECODE_MAX_LEN 65536 |
| 470 | struct lttng_kernel_abi_filter_bytecode { |
| 471 | uint32_t len; |
| 472 | uint32_t reloc_offset; |
| 473 | uint64_t seqnum; |
| 474 | char data[]; |
| 475 | } __attribute__((packed)); |
| 476 | |
| 477 | #define LTTNG_KERNEL_ABI_CAPTURE_BYTECODE_MAX_LEN 65536 |
| 478 | struct lttng_kernel_abi_capture_bytecode { |
| 479 | uint32_t len; |
| 480 | uint32_t reloc_offset; |
| 481 | uint64_t seqnum; |
| 482 | char data[]; |
| 483 | } __attribute__((packed)); |
| 484 | |
| 485 | enum lttng_kernel_abi_tracker_type { |
| 486 | LTTNG_KERNEL_ABI_TRACKER_UNKNOWN = -1, |
| 487 | |
| 488 | LTTNG_KERNEL_ABI_TRACKER_PID = 0, |
| 489 | LTTNG_KERNEL_ABI_TRACKER_VPID = 1, |
| 490 | LTTNG_KERNEL_ABI_TRACKER_UID = 2, |
| 491 | LTTNG_KERNEL_ABI_TRACKER_VUID = 3, |
| 492 | LTTNG_KERNEL_ABI_TRACKER_GID = 4, |
| 493 | LTTNG_KERNEL_ABI_TRACKER_VGID = 5, |
| 494 | }; |
| 495 | |
| 496 | struct lttng_kernel_abi_tracker_args { |
| 497 | uint32_t type; /* enum lttng_kernel_abi_tracker_type */ |
| 498 | int32_t id; |
| 499 | }; |
| 500 | |
| 501 | /* LTTng file descriptor ioctl */ |
| 502 | /* lttng/abi-old.h reserve 0x40, 0x41, 0x42, 0x43, and 0x44. */ |
| 503 | #define LTTNG_KERNEL_ABI_SESSION _IO(0xF6, 0x45) |
| 504 | #define LTTNG_KERNEL_ABI_TRACER_VERSION \ |
| 505 | _IOR(0xF6, 0x46, struct lttng_kernel_abi_tracer_version) |
| 506 | #define LTTNG_KERNEL_ABI_TRACEPOINT_LIST _IO(0xF6, 0x47) |
| 507 | #define LTTNG_KERNEL_ABI_WAIT_QUIESCENT _IO(0xF6, 0x48) |
| 508 | #define LTTNG_KERNEL_ABI_CALIBRATE \ |
| 509 | _IOWR(0xF6, 0x49, struct lttng_kernel_abi_calibrate) |
| 510 | #define LTTNG_KERNEL_ABI_SYSCALL_LIST _IO(0xF6, 0x4A) |
| 511 | #define LTTNG_KERNEL_ABI_TRACER_ABI_VERSION \ |
| 512 | _IOR(0xF6, 0x4B, struct lttng_kernel_abi_tracer_abi_version) |
| 513 | #define LTTNG_KERNEL_ABI_EVENT_NOTIFIER_GROUP_CREATE _IO(0xF6, 0x4C) |
| 514 | |
| 515 | /* Session FD ioctl */ |
| 516 | /* lttng/abi-old.h reserve 0x50, 0x51, 0x52, and 0x53. */ |
| 517 | #define LTTNG_KERNEL_ABI_METADATA \ |
| 518 | _IOW(0xF6, 0x54, struct lttng_kernel_abi_channel) |
| 519 | #define LTTNG_KERNEL_ABI_CHANNEL \ |
| 520 | _IOW(0xF6, 0x55, struct lttng_kernel_abi_channel) |
| 521 | #define LTTNG_KERNEL_ABI_SESSION_START _IO(0xF6, 0x56) |
| 522 | #define LTTNG_KERNEL_ABI_SESSION_STOP _IO(0xF6, 0x57) |
| 523 | #define LTTNG_KERNEL_ABI_SESSION_TRACK_PID \ |
| 524 | _IOW(0xF6, 0x58, int32_t) |
| 525 | #define LTTNG_KERNEL_ABI_SESSION_UNTRACK_PID \ |
| 526 | _IOW(0xF6, 0x59, int32_t) |
| 527 | |
| 528 | /* |
| 529 | * ioctl 0x58 and 0x59 are duplicated here. It works, since _IOR vs _IO |
| 530 | * are generating two different ioctl numbers, but this was not done on |
| 531 | * purpose. We should generally try to avoid those duplications. |
| 532 | */ |
| 533 | #define LTTNG_KERNEL_ABI_SESSION_LIST_TRACKER_PIDS _IO(0xF6, 0x58) |
| 534 | #define LTTNG_KERNEL_ABI_SESSION_METADATA_REGEN _IO(0xF6, 0x59) |
| 535 | |
| 536 | /* lttng/abi-old.h reserve 0x5A and 0x5B. */ |
| 537 | #define LTTNG_KERNEL_ABI_SESSION_STATEDUMP _IO(0xF6, 0x5C) |
| 538 | #define LTTNG_KERNEL_ABI_SESSION_SET_NAME \ |
| 539 | _IOW(0xF6, 0x5D, struct lttng_kernel_abi_session_name) |
| 540 | #define LTTNG_KERNEL_ABI_SESSION_SET_CREATION_TIME \ |
| 541 | _IOW(0xF6, 0x5E, struct lttng_kernel_abi_session_creation_time) |
| 542 | |
| 543 | /* Channel FD ioctl */ |
| 544 | /* lttng/abi-old.h reserve 0x60 and 0x61. */ |
| 545 | #define LTTNG_KERNEL_ABI_STREAM _IO(0xF6, 0x62) |
| 546 | #define LTTNG_KERNEL_ABI_EVENT \ |
| 547 | _IOW(0xF6, 0x63, struct lttng_kernel_abi_event) |
| 548 | /* LTTNG_KERNEL_ABI_SYSCALL_MASK applies to both channel and counter fds. */ |
| 549 | #define LTTNG_KERNEL_ABI_SYSCALL_MASK \ |
| 550 | _IOWR(0xF6, 0x64, struct lttng_kernel_abi_syscall_mask) |
| 551 | |
| 552 | /* Event and Channel FD ioctl */ |
| 553 | /* lttng/abi-old.h reserve 0x70. */ |
| 554 | #define LTTNG_KERNEL_ABI_CONTEXT \ |
| 555 | _IOW(0xF6, 0x71, struct lttng_kernel_abi_context) |
| 556 | |
| 557 | /* Event, Event notifier, Channel, Counter and Session ioctl */ |
| 558 | /* lttng/abi-old.h reserve 0x80 and 0x81. */ |
| 559 | #define LTTNG_KERNEL_ABI_ENABLE _IO(0xF6, 0x82) |
| 560 | #define LTTNG_KERNEL_ABI_DISABLE _IO(0xF6, 0x83) |
| 561 | |
| 562 | /* Event notifier group and session ioctl */ |
| 563 | |
| 564 | /* (0xF6, 0x84) is reserved for old ABI. */ |
| 565 | |
| 566 | #define LTTNG_KERNEL_ABI_COUNTER \ |
| 567 | _IOW(0xF6, 0x85, struct lttng_kernel_abi_counter_conf) |
| 568 | |
| 569 | /* Event and Event notifier FD ioctl */ |
| 570 | #define LTTNG_KERNEL_ABI_FILTER _IO(0xF6, 0x90) |
| 571 | #define LTTNG_KERNEL_ABI_ADD_CALLSITE _IO(0xF6, 0x91) |
| 572 | |
| 573 | /* Session FD ioctl (continued) */ |
| 574 | #define LTTNG_KERNEL_ABI_SESSION_LIST_TRACKER_IDS \ |
| 575 | _IOW(0xF6, 0xA0, struct lttng_kernel_abi_tracker_args) |
| 576 | #define LTTNG_KERNEL_ABI_SESSION_TRACK_ID \ |
| 577 | _IOW(0xF6, 0xA1, struct lttng_kernel_abi_tracker_args) |
| 578 | #define LTTNG_KERNEL_ABI_SESSION_UNTRACK_ID \ |
| 579 | _IOW(0xF6, 0xA2, struct lttng_kernel_abi_tracker_args) |
| 580 | |
| 581 | /* Event notifier group file descriptor ioctl */ |
| 582 | #define LTTNG_KERNEL_ABI_EVENT_NOTIFIER_CREATE \ |
| 583 | _IOW(0xF6, 0xB0, struct lttng_kernel_abi_event_notifier) |
| 584 | #define LTTNG_KERNEL_ABI_EVENT_NOTIFIER_GROUP_NOTIFICATION_FD \ |
| 585 | _IO(0xF6, 0xB1) |
| 586 | |
| 587 | /* Event notifier file descriptor ioctl */ |
| 588 | #define LTTNG_KERNEL_ABI_CAPTURE _IO(0xF6, 0xB8) |
| 589 | |
| 590 | /* (0xF6, {0xC0, 0xC1, 0xC2}) are reserved for old ABI. */ |
| 591 | |
| 592 | /* Counter file descriptor ioctl */ |
| 593 | #define LTTNG_KERNEL_ABI_COUNTER_MAP_NR_DESCRIPTORS \ |
| 594 | _IOR(0xF6, 0xC3, uint64_t) |
| 595 | #define LTTNG_KERNEL_ABI_COUNTER_MAP_DESCRIPTOR \ |
| 596 | _IOWR(0xF6, 0xC4, struct lttng_kernel_abi_counter_map_descriptor) |
| 597 | #define LTTNG_KERNEL_ABI_COUNTER_EVENT \ |
| 598 | _IOW(0xF6, 0xC5, struct lttng_kernel_abi_counter_event) |
| 599 | #define LTTNG_KERNEL_ABI_COUNTER_READ \ |
| 600 | _IOWR(0xF6, 0xC6, struct lttng_kernel_abi_counter_read) |
| 601 | #define LTTNG_KERNEL_ABI_COUNTER_AGGREGATE \ |
| 602 | _IOWR(0xF6, 0xC7, struct lttng_kernel_abi_counter_aggregate) |
| 603 | #define LTTNG_KERNEL_ABI_COUNTER_CLEAR \ |
| 604 | _IOW(0xF6, 0xC8, struct lttng_kernel_abi_counter_clear) |
| 605 | |
| 606 | /* |
| 607 | * LTTng-specific ioctls for the lib ringbuffer. |
| 608 | * |
| 609 | * Operations applying to the current sub-buffer need to occur between |
| 610 | * a get/put or get_next/put_next ioctl pair. |
| 611 | */ |
| 612 | |
| 613 | /* returns the timestamp begin of the current sub-buffer */ |
| 614 | #define LTTNG_KERNEL_ABI_RING_BUFFER_GET_TIMESTAMP_BEGIN _IOR(0xF6, 0x20, uint64_t) |
| 615 | /* returns the timestamp end of the current sub-buffer */ |
| 616 | #define LTTNG_KERNEL_ABI_RING_BUFFER_GET_TIMESTAMP_END _IOR(0xF6, 0x21, uint64_t) |
| 617 | /* returns the number of events discarded of the current sub-buffer */ |
| 618 | #define LTTNG_KERNEL_ABI_RING_BUFFER_GET_EVENTS_DISCARDED _IOR(0xF6, 0x22, uint64_t) |
| 619 | /* returns the packet payload size of the current sub-buffer */ |
| 620 | #define LTTNG_KERNEL_ABI_RING_BUFFER_GET_CONTENT_SIZE _IOR(0xF6, 0x23, uint64_t) |
| 621 | /* returns the packet size of the current sub-buffer*/ |
| 622 | #define LTTNG_KERNEL_ABI_RING_BUFFER_GET_PACKET_SIZE _IOR(0xF6, 0x24, uint64_t) |
| 623 | /* returns the stream id (invariant for the stream) */ |
| 624 | #define LTTNG_KERNEL_ABI_RING_BUFFER_GET_STREAM_ID _IOR(0xF6, 0x25, uint64_t) |
| 625 | /* returns the current timestamp as perceived from the tracer */ |
| 626 | #define LTTNG_KERNEL_ABI_RING_BUFFER_GET_CURRENT_TIMESTAMP _IOR(0xF6, 0x26, uint64_t) |
| 627 | /* returns the packet sequence number of the current sub-buffer */ |
| 628 | #define LTTNG_KERNEL_ABI_RING_BUFFER_GET_SEQ_NUM _IOR(0xF6, 0x27, uint64_t) |
| 629 | /* returns the stream instance id (invariant for the stream) */ |
| 630 | #define LTTNG_KERNEL_ABI_RING_BUFFER_INSTANCE_ID _IOR(0xF6, 0x28, uint64_t) |
| 631 | |
| 632 | /* |
| 633 | * Those ioctl numbers use the wrong direction, but are kept for ABI backward |
| 634 | * compatibility. |
| 635 | */ |
| 636 | #define LTTNG_KERNEL_ABI_OLD_SESSION_SET_NAME \ |
| 637 | _IOR(0xF6, 0x5D, struct lttng_kernel_abi_session_name) |
| 638 | #define LTTNG_KERNEL_ABI_OLD_SESSION_SET_CREATION_TIME \ |
| 639 | _IOR(0xF6, 0x5E, struct lttng_kernel_abi_session_creation_time) |
| 640 | #define LTTNG_KERNEL_ABI_OLD_SESSION_TRACK_PID \ |
| 641 | _IOR(0xF6, 0x58, int32_t) |
| 642 | #define LTTNG_KERNEL_ABI_OLD_SESSION_UNTRACK_PID \ |
| 643 | _IOR(0xF6, 0x59, int32_t) |
| 644 | #define LTTNG_KERNEL_ABI_OLD_SESSION_LIST_TRACKER_IDS \ |
| 645 | _IOR(0xF6, 0xA0, struct lttng_kernel_abi_tracker_args) |
| 646 | #define LTTNG_KERNEL_ABI_OLD_SESSION_TRACK_ID \ |
| 647 | _IOR(0xF6, 0xA1, struct lttng_kernel_abi_tracker_args) |
| 648 | #define LTTNG_KERNEL_ABI_OLD_SESSION_UNTRACK_ID \ |
| 649 | _IOR(0xF6, 0xA2, struct lttng_kernel_abi_tracker_args) |
| 650 | |
| 651 | #ifdef CONFIG_COMPAT |
| 652 | /* returns the timestamp begin of the current sub-buffer */ |
| 653 | #define LTTNG_KERNEL_ABI_RING_BUFFER_COMPAT_GET_TIMESTAMP_BEGIN \ |
| 654 | LTTNG_KERNEL_ABI_RING_BUFFER_GET_TIMESTAMP_BEGIN |
| 655 | /* returns the timestamp end of the current sub-buffer */ |
| 656 | #define LTTNG_KERNEL_ABI_RING_BUFFER_COMPAT_GET_TIMESTAMP_END \ |
| 657 | LTTNG_KERNEL_ABI_RING_BUFFER_GET_TIMESTAMP_END |
| 658 | /* returns the number of events discarded of the current sub-buffer */ |
| 659 | #define LTTNG_KERNEL_ABI_RING_BUFFER_COMPAT_GET_EVENTS_DISCARDED \ |
| 660 | LTTNG_KERNEL_ABI_RING_BUFFER_GET_EVENTS_DISCARDED |
| 661 | /* returns the packet payload size of the current sub-buffer */ |
| 662 | #define LTTNG_KERNEL_ABI_RING_BUFFER_COMPAT_GET_CONTENT_SIZE \ |
| 663 | LTTNG_KERNEL_ABI_RING_BUFFER_GET_CONTENT_SIZE |
| 664 | /* returns the packet size of the current sub-buffer */ |
| 665 | #define LTTNG_KERNEL_ABI_RING_BUFFER_COMPAT_GET_PACKET_SIZE \ |
| 666 | LTTNG_KERNEL_ABI_RING_BUFFER_GET_PACKET_SIZE |
| 667 | /* returns the stream id (invariant for the stream) */ |
| 668 | #define LTTNG_KERNEL_ABI_RING_BUFFER_COMPAT_GET_STREAM_ID \ |
| 669 | LTTNG_KERNEL_ABI_RING_BUFFER_GET_STREAM_ID |
| 670 | /* returns the current timestamp as perceived from the tracer */ |
| 671 | #define LTTNG_KERNEL_ABI_RING_BUFFER_COMPAT_GET_CURRENT_TIMESTAMP \ |
| 672 | LTTNG_KERNEL_ABI_RING_BUFFER_GET_CURRENT_TIMESTAMP |
| 673 | /* returns the packet sequence number of the current sub-buffer */ |
| 674 | #define LTTNG_KERNEL_ABI_RING_BUFFER_COMPAT_GET_SEQ_NUM \ |
| 675 | LTTNG_KERNEL_ABI_RING_BUFFER_GET_SEQ_NUM |
| 676 | /* returns the stream instance id (invariant for the stream) */ |
| 677 | #define LTTNG_KERNEL_ABI_RING_BUFFER_COMPAT_INSTANCE_ID \ |
| 678 | LTTNG_KERNEL_ABI_RING_BUFFER_INSTANCE_ID |
| 679 | #endif /* CONFIG_COMPAT */ |
| 680 | |
| 681 | #endif /* _LTTNG_ABI_H */ |