- Remove extra "lttng-" from filename (now implied by the path).
- Adapt includes accordingly.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
for details.
include/lttng/prio_heap.h
-lib/prio_heap/lttng_prio_heap.c
include/lttng/bitfield.h
-filter-bytecode.h
+include/lttng/filter-bytecode.h
+include/filter.h
+lib/prio_heap/lttng_prio_heap.c
lttng-filter-interpreter.c
lttng-filter-specialize.c
lttng-filter-validator.c
lttng-filter.c
-lttng-filter.h
#ifndef _LTTNG_BLACKLIST_KPROBES_H
#define _LTTNG_BLACKLIST_KPROBES_H
-#include <lttng-kernel-version.h>
+#include <lttng/kernel-version.h>
#if LTTNG_KERNEL_RANGE(4,20,0, 4,20,13) \
|| LTTNG_KERNEL_RANGE(4,19,9, 4,19,26) \
#ifndef _LTTNG_BLACKLIST_TIMEKEEPING_H
#define _LTTNG_BLACKLIST_TIMEKEEPING_H
-#include <lttng-kernel-version.h>
+#include <lttng/kernel-version.h>
#if ((LTTNG_KERNEL_RANGE(3,10,0, 3,10,14) && !LTTNG_RHEL_KERNEL_RANGE(3,10,0,123,0,0, 3,10,14,0,0,0)) \
|| LTTNG_KERNEL_RANGE(3,11,0, 3,11,3))
+++ /dev/null
-/* SPDX-License-Identifier: MIT
- *
- * filter-bytecode.h
- *
- * LTTng filter bytecode
- *
- * Copyright 2012-2016 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- */
-
-#ifndef _FILTER_BYTECODE_H
-#define _FILTER_BYTECODE_H
-
-/*
- * offsets are absolute from start of bytecode.
- */
-
-struct field_ref {
- /* Initially, symbol offset. After link, field offset. */
- uint16_t offset;
-} __attribute__((packed));
-
-struct get_symbol {
- /* Symbol offset. */
- uint16_t offset;
-} __attribute__((packed));
-
-struct get_index_u16 {
- uint16_t index;
-} __attribute__((packed));
-
-struct get_index_u64 {
- uint64_t index;
-} __attribute__((packed));
-
-struct literal_numeric {
- int64_t v;
-} __attribute__((packed));
-
-struct literal_double {
- double v;
-} __attribute__((packed));
-
-struct literal_string {
- char string[0];
-} __attribute__((packed));
-
-enum filter_op {
- FILTER_OP_UNKNOWN = 0,
-
- FILTER_OP_RETURN = 1,
-
- /* binary */
- FILTER_OP_MUL = 2,
- FILTER_OP_DIV = 3,
- FILTER_OP_MOD = 4,
- FILTER_OP_PLUS = 5,
- FILTER_OP_MINUS = 6,
- FILTER_OP_BIT_RSHIFT = 7,
- FILTER_OP_BIT_LSHIFT = 8,
- FILTER_OP_BIT_AND = 9,
- FILTER_OP_BIT_OR = 10,
- FILTER_OP_BIT_XOR = 11,
-
- /* binary comparators */
- FILTER_OP_EQ = 12,
- FILTER_OP_NE = 13,
- FILTER_OP_GT = 14,
- FILTER_OP_LT = 15,
- FILTER_OP_GE = 16,
- FILTER_OP_LE = 17,
-
- /* string binary comparator: apply to */
- FILTER_OP_EQ_STRING = 18,
- FILTER_OP_NE_STRING = 19,
- FILTER_OP_GT_STRING = 20,
- FILTER_OP_LT_STRING = 21,
- FILTER_OP_GE_STRING = 22,
- FILTER_OP_LE_STRING = 23,
-
- /* s64 binary comparator */
- FILTER_OP_EQ_S64 = 24,
- FILTER_OP_NE_S64 = 25,
- FILTER_OP_GT_S64 = 26,
- FILTER_OP_LT_S64 = 27,
- FILTER_OP_GE_S64 = 28,
- FILTER_OP_LE_S64 = 29,
-
- /* double binary comparator */
- FILTER_OP_EQ_DOUBLE = 30,
- FILTER_OP_NE_DOUBLE = 31,
- FILTER_OP_GT_DOUBLE = 32,
- FILTER_OP_LT_DOUBLE = 33,
- FILTER_OP_GE_DOUBLE = 34,
- FILTER_OP_LE_DOUBLE = 35,
-
- /* Mixed S64-double binary comparators */
- FILTER_OP_EQ_DOUBLE_S64 = 36,
- FILTER_OP_NE_DOUBLE_S64 = 37,
- FILTER_OP_GT_DOUBLE_S64 = 38,
- FILTER_OP_LT_DOUBLE_S64 = 39,
- FILTER_OP_GE_DOUBLE_S64 = 40,
- FILTER_OP_LE_DOUBLE_S64 = 41,
-
- FILTER_OP_EQ_S64_DOUBLE = 42,
- FILTER_OP_NE_S64_DOUBLE = 43,
- FILTER_OP_GT_S64_DOUBLE = 44,
- FILTER_OP_LT_S64_DOUBLE = 45,
- FILTER_OP_GE_S64_DOUBLE = 46,
- FILTER_OP_LE_S64_DOUBLE = 47,
-
- /* unary */
- FILTER_OP_UNARY_PLUS = 48,
- FILTER_OP_UNARY_MINUS = 49,
- FILTER_OP_UNARY_NOT = 50,
- FILTER_OP_UNARY_PLUS_S64 = 51,
- FILTER_OP_UNARY_MINUS_S64 = 52,
- FILTER_OP_UNARY_NOT_S64 = 53,
- FILTER_OP_UNARY_PLUS_DOUBLE = 54,
- FILTER_OP_UNARY_MINUS_DOUBLE = 55,
- FILTER_OP_UNARY_NOT_DOUBLE = 56,
-
- /* logical */
- FILTER_OP_AND = 57,
- FILTER_OP_OR = 58,
-
- /* load field ref */
- FILTER_OP_LOAD_FIELD_REF = 59,
- FILTER_OP_LOAD_FIELD_REF_STRING = 60,
- FILTER_OP_LOAD_FIELD_REF_SEQUENCE = 61,
- FILTER_OP_LOAD_FIELD_REF_S64 = 62,
- FILTER_OP_LOAD_FIELD_REF_DOUBLE = 63,
-
- /* load immediate from operand */
- FILTER_OP_LOAD_STRING = 64,
- FILTER_OP_LOAD_S64 = 65,
- FILTER_OP_LOAD_DOUBLE = 66,
-
- /* cast */
- FILTER_OP_CAST_TO_S64 = 67,
- FILTER_OP_CAST_DOUBLE_TO_S64 = 68,
- FILTER_OP_CAST_NOP = 69,
-
- /* get context ref */
- FILTER_OP_GET_CONTEXT_REF = 70,
- FILTER_OP_GET_CONTEXT_REF_STRING = 71,
- FILTER_OP_GET_CONTEXT_REF_S64 = 72,
- FILTER_OP_GET_CONTEXT_REF_DOUBLE = 73,
-
- /* load userspace field ref */
- FILTER_OP_LOAD_FIELD_REF_USER_STRING = 74,
- FILTER_OP_LOAD_FIELD_REF_USER_SEQUENCE = 75,
-
- /*
- * load immediate star globbing pattern (literal string)
- * from immediate
- */
- FILTER_OP_LOAD_STAR_GLOB_STRING = 76,
-
- /* globbing pattern binary operator: apply to */
- FILTER_OP_EQ_STAR_GLOB_STRING = 77,
- FILTER_OP_NE_STAR_GLOB_STRING = 78,
-
- /*
- * Instructions for recursive traversal through composed types.
- */
- FILTER_OP_GET_CONTEXT_ROOT = 79,
- FILTER_OP_GET_APP_CONTEXT_ROOT = 80,
- FILTER_OP_GET_PAYLOAD_ROOT = 81,
-
- FILTER_OP_GET_SYMBOL = 82,
- FILTER_OP_GET_SYMBOL_FIELD = 83,
- FILTER_OP_GET_INDEX_U16 = 84,
- FILTER_OP_GET_INDEX_U64 = 85,
-
- FILTER_OP_LOAD_FIELD = 86,
- FILTER_OP_LOAD_FIELD_S8 = 87,
- FILTER_OP_LOAD_FIELD_S16 = 88,
- FILTER_OP_LOAD_FIELD_S32 = 89,
- FILTER_OP_LOAD_FIELD_S64 = 90,
- FILTER_OP_LOAD_FIELD_U8 = 91,
- FILTER_OP_LOAD_FIELD_U16 = 92,
- FILTER_OP_LOAD_FIELD_U32 = 93,
- FILTER_OP_LOAD_FIELD_U64 = 94,
- FILTER_OP_LOAD_FIELD_STRING = 95,
- FILTER_OP_LOAD_FIELD_SEQUENCE = 96,
- FILTER_OP_LOAD_FIELD_DOUBLE = 97,
-
- FILTER_OP_UNARY_BIT_NOT = 98,
-
- FILTER_OP_RETURN_S64 = 99,
-
- NR_FILTER_OPS,
-};
-
-typedef uint8_t filter_opcode_t;
-
-struct load_op {
- filter_opcode_t op;
- char data[0];
- /* data to load. Size known by enum filter_opcode and null-term char. */
-} __attribute__((packed));
-
-struct binary_op {
- filter_opcode_t op;
-} __attribute__((packed));
-
-struct unary_op {
- filter_opcode_t op;
-} __attribute__((packed));
-
-/* skip_offset is absolute from start of bytecode */
-struct logical_op {
- filter_opcode_t op;
- uint16_t skip_offset; /* bytecode insn, if skip second test */
-} __attribute__((packed));
-
-struct cast_op {
- filter_opcode_t op;
-} __attribute__((packed));
-
-struct return_op {
- filter_opcode_t op;
-} __attribute__((packed));
-
-#endif /* _FILTER_BYTECODE_H */
--- /dev/null
+/* SPDX-License-Identifier: (GPL-2.0-only or LGPL-2.1-only)
+ *
+ * lttng/abi-old.h
+ *
+ * LTTng old ABI header (without support for compat 32/64 bits)
+ *
+ * Copyright (C) 2010-2012 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+ */
+
+#ifndef _LTTNG_ABI_OLD_H
+#define _LTTNG_ABI_OLD_H
+
+#include <linux/fs.h>
+#include <lttng/abi.h>
+
+/*
+ * LTTng DebugFS ABI structures.
+ */
+#define LTTNG_KERNEL_OLD_CHANNEL_PADDING LTTNG_KERNEL_SYM_NAME_LEN + 32
+struct lttng_kernel_old_channel {
+ int overwrite; /* 1: overwrite, 0: discard */
+ uint64_t subbuf_size; /* in bytes */
+ uint64_t num_subbuf;
+ unsigned int switch_timer_interval; /* usecs */
+ unsigned int read_timer_interval; /* usecs */
+ enum lttng_kernel_output output; /* splice, mmap */
+ char padding[LTTNG_KERNEL_OLD_CHANNEL_PADDING];
+};
+
+struct lttng_kernel_old_kretprobe {
+ uint64_t addr;
+
+ uint64_t offset;
+ char symbol_name[LTTNG_KERNEL_SYM_NAME_LEN];
+};
+
+/*
+ * Either addr is used, or symbol_name and offset.
+ */
+struct lttng_kernel_old_kprobe {
+ uint64_t addr;
+
+ uint64_t offset;
+ char symbol_name[LTTNG_KERNEL_SYM_NAME_LEN];
+};
+
+struct lttng_kernel_old_function_tracer {
+ char symbol_name[LTTNG_KERNEL_SYM_NAME_LEN];
+};
+
+/*
+ * For syscall tracing, name = '\0' means "enable all".
+ */
+#define LTTNG_KERNEL_OLD_EVENT_PADDING1 16
+#define LTTNG_KERNEL_OLD_EVENT_PADDING2 LTTNG_KERNEL_SYM_NAME_LEN + 32
+struct lttng_kernel_old_event {
+ char name[LTTNG_KERNEL_SYM_NAME_LEN]; /* event name */
+ enum lttng_kernel_instrumentation instrumentation;
+ char padding[LTTNG_KERNEL_OLD_EVENT_PADDING1];
+
+ /* Per instrumentation type configuration */
+ union {
+ struct lttng_kernel_old_kretprobe kretprobe;
+ struct lttng_kernel_old_kprobe kprobe;
+ struct lttng_kernel_old_function_tracer ftrace;
+ char padding[LTTNG_KERNEL_OLD_EVENT_PADDING2];
+ } u;
+};
+
+struct lttng_kernel_old_tracer_version {
+ uint32_t major;
+ uint32_t minor;
+ uint32_t patchlevel;
+};
+
+struct lttng_kernel_old_calibrate {
+ enum lttng_kernel_calibrate_type type; /* type (input) */
+};
+
+struct lttng_kernel_old_perf_counter_ctx {
+ uint32_t type;
+ uint64_t config;
+ char name[LTTNG_KERNEL_SYM_NAME_LEN];
+};
+
+#define LTTNG_KERNEL_OLD_CONTEXT_PADDING1 16
+#define LTTNG_KERNEL_OLD_CONTEXT_PADDING2 LTTNG_KERNEL_SYM_NAME_LEN + 32
+struct lttng_kernel_old_context {
+ enum lttng_kernel_context_type ctx;
+ char padding[LTTNG_KERNEL_OLD_CONTEXT_PADDING1];
+
+ union {
+ struct lttng_kernel_old_perf_counter_ctx perf_counter;
+ char padding[LTTNG_KERNEL_OLD_CONTEXT_PADDING2];
+ } u;
+};
+
+/* LTTng file descriptor ioctl */
+#define LTTNG_KERNEL_OLD_SESSION _IO(0xF6, 0x40)
+#define LTTNG_KERNEL_OLD_TRACER_VERSION \
+ _IOR(0xF6, 0x41, struct lttng_kernel_old_tracer_version)
+#define LTTNG_KERNEL_OLD_TRACEPOINT_LIST _IO(0xF6, 0x42)
+#define LTTNG_KERNEL_OLD_WAIT_QUIESCENT _IO(0xF6, 0x43)
+#define LTTNG_KERNEL_OLD_CALIBRATE \
+ _IOWR(0xF6, 0x44, struct lttng_kernel_old_calibrate)
+
+/* Session FD ioctl */
+#define LTTNG_KERNEL_OLD_METADATA \
+ _IOW(0xF6, 0x50, struct lttng_kernel_old_channel)
+#define LTTNG_KERNEL_OLD_CHANNEL \
+ _IOW(0xF6, 0x51, struct lttng_kernel_old_channel)
+#define LTTNG_KERNEL_OLD_SESSION_START _IO(0xF6, 0x52)
+#define LTTNG_KERNEL_OLD_SESSION_STOP _IO(0xF6, 0x53)
+
+/* Channel FD ioctl */
+#define LTTNG_KERNEL_OLD_STREAM _IO(0xF6, 0x60)
+#define LTTNG_KERNEL_OLD_EVENT \
+ _IOW(0xF6, 0x61, struct lttng_kernel_old_event)
+
+/* Event and Channel FD ioctl */
+#define LTTNG_KERNEL_OLD_CONTEXT \
+ _IOW(0xF6, 0x70, struct lttng_kernel_old_context)
+
+/* Event, Channel and Session ioctl */
+#define LTTNG_KERNEL_OLD_ENABLE _IO(0xF6, 0x80)
+#define LTTNG_KERNEL_OLD_DISABLE _IO(0xF6, 0x81)
+
+#endif /* _LTTNG_ABI_OLD_H */
--- /dev/null
+/* SPDX-License-Identifier: (GPL-2.0-only or LGPL-2.1-only)
+ *
+ * lttng/abi.h
+ *
+ * LTTng ABI header
+ *
+ * Copyright (C) 2010-2012 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+ */
+
+#ifndef _LTTNG_ABI_H
+#define _LTTNG_ABI_H
+
+#include <linux/fs.h>
+
+/*
+ * Major/minor version of ABI exposed to lttng tools. Major number
+ * should be increased when an incompatible ABI change is done.
+ */
+#define LTTNG_MODULES_ABI_MAJOR_VERSION 2
+#define LTTNG_MODULES_ABI_MINOR_VERSION 5
+
+#define LTTNG_KERNEL_SYM_NAME_LEN 256
+#define LTTNG_KERNEL_SESSION_NAME_LEN 256
+#define LTTNG_KERNEL_SESSION_CREATION_TIME_ISO8601_LEN 26
+
+enum lttng_kernel_instrumentation {
+ LTTNG_KERNEL_TRACEPOINT = 0,
+ LTTNG_KERNEL_KPROBE = 1,
+ LTTNG_KERNEL_FUNCTION = 2,
+ LTTNG_KERNEL_KRETPROBE = 3,
+ LTTNG_KERNEL_NOOP = 4, /* not hooked */
+ LTTNG_KERNEL_SYSCALL = 5,
+ LTTNG_KERNEL_UPROBE = 6,
+};
+
+/*
+ * LTTng consumer mode
+ */
+enum lttng_kernel_output {
+ LTTNG_KERNEL_SPLICE = 0,
+ LTTNG_KERNEL_MMAP = 1,
+};
+
+/*
+ * LTTng DebugFS ABI structures.
+ */
+#define LTTNG_KERNEL_CHANNEL_PADDING LTTNG_KERNEL_SYM_NAME_LEN + 32
+struct lttng_kernel_channel {
+ uint64_t subbuf_size; /* in bytes */
+ uint64_t num_subbuf;
+ unsigned int switch_timer_interval; /* usecs */
+ unsigned int read_timer_interval; /* usecs */
+ enum lttng_kernel_output output; /* splice, mmap */
+ int overwrite; /* 1: overwrite, 0: discard */
+ char padding[LTTNG_KERNEL_CHANNEL_PADDING];
+} __attribute__((packed));
+
+struct lttng_kernel_kretprobe {
+ uint64_t addr;
+
+ uint64_t offset;
+ char symbol_name[LTTNG_KERNEL_SYM_NAME_LEN];
+} __attribute__((packed));
+
+/*
+ * Either addr is used, or symbol_name and offset.
+ */
+struct lttng_kernel_kprobe {
+ uint64_t addr;
+
+ uint64_t offset;
+ char symbol_name[LTTNG_KERNEL_SYM_NAME_LEN];
+} __attribute__((packed));
+
+struct lttng_kernel_function_tracer {
+ char symbol_name[LTTNG_KERNEL_SYM_NAME_LEN];
+} __attribute__((packed));
+
+struct lttng_kernel_uprobe {
+ int fd;
+} __attribute__((packed));
+
+struct lttng_kernel_event_callsite_uprobe {
+ uint64_t offset;
+} __attribute__((packed));
+
+struct lttng_kernel_event_callsite {
+ union {
+ struct lttng_kernel_event_callsite_uprobe uprobe;
+ } u;
+} __attribute__((packed));
+
+/*
+ * For syscall tracing, name = "*" means "enable all".
+ */
+#define LTTNG_KERNEL_EVENT_PADDING1 16
+#define LTTNG_KERNEL_EVENT_PADDING2 LTTNG_KERNEL_SYM_NAME_LEN + 32
+struct lttng_kernel_event {
+ char name[LTTNG_KERNEL_SYM_NAME_LEN]; /* event name */
+ enum lttng_kernel_instrumentation instrumentation;
+ char padding[LTTNG_KERNEL_EVENT_PADDING1];
+
+ /* Per instrumentation type configuration */
+ union {
+ struct lttng_kernel_kretprobe kretprobe;
+ struct lttng_kernel_kprobe kprobe;
+ struct lttng_kernel_function_tracer ftrace;
+ struct lttng_kernel_uprobe uprobe;
+ char padding[LTTNG_KERNEL_EVENT_PADDING2];
+ } u;
+} __attribute__((packed));
+
+struct lttng_kernel_tracer_version {
+ uint32_t major;
+ uint32_t minor;
+ uint32_t patchlevel;
+} __attribute__((packed));
+
+struct lttng_kernel_tracer_abi_version {
+ uint32_t major;
+ uint32_t minor;
+} __attribute__((packed));
+
+struct lttng_kernel_session_name {
+ char name[LTTNG_KERNEL_SESSION_NAME_LEN];
+} __attribute__((packed));
+
+struct lttng_kernel_session_creation_time {
+ char iso8601[LTTNG_KERNEL_SESSION_CREATION_TIME_ISO8601_LEN];
+} __attribute__((packed));
+
+enum lttng_kernel_calibrate_type {
+ LTTNG_KERNEL_CALIBRATE_KRETPROBE,
+};
+
+struct lttng_kernel_calibrate {
+ enum lttng_kernel_calibrate_type type; /* type (input) */
+} __attribute__((packed));
+
+struct lttng_kernel_syscall_mask {
+ uint32_t len; /* in bits */
+ char mask[];
+} __attribute__((packed));
+
+enum lttng_kernel_context_type {
+ LTTNG_KERNEL_CONTEXT_PID = 0,
+ LTTNG_KERNEL_CONTEXT_PERF_COUNTER = 1,
+ LTTNG_KERNEL_CONTEXT_PROCNAME = 2,
+ LTTNG_KERNEL_CONTEXT_PRIO = 3,
+ LTTNG_KERNEL_CONTEXT_NICE = 4,
+ LTTNG_KERNEL_CONTEXT_VPID = 5,
+ LTTNG_KERNEL_CONTEXT_TID = 6,
+ LTTNG_KERNEL_CONTEXT_VTID = 7,
+ LTTNG_KERNEL_CONTEXT_PPID = 8,
+ LTTNG_KERNEL_CONTEXT_VPPID = 9,
+ LTTNG_KERNEL_CONTEXT_HOSTNAME = 10,
+ LTTNG_KERNEL_CONTEXT_CPU_ID = 11,
+ LTTNG_KERNEL_CONTEXT_INTERRUPTIBLE = 12,
+ LTTNG_KERNEL_CONTEXT_PREEMPTIBLE = 13,
+ LTTNG_KERNEL_CONTEXT_NEED_RESCHEDULE = 14,
+ LTTNG_KERNEL_CONTEXT_MIGRATABLE = 15,
+ LTTNG_KERNEL_CONTEXT_CALLSTACK_KERNEL = 16,
+ LTTNG_KERNEL_CONTEXT_CALLSTACK_USER = 17,
+ LTTNG_KERNEL_CONTEXT_CGROUP_NS = 18,
+ LTTNG_KERNEL_CONTEXT_IPC_NS = 19,
+ LTTNG_KERNEL_CONTEXT_MNT_NS = 20,
+ LTTNG_KERNEL_CONTEXT_NET_NS = 21,
+ LTTNG_KERNEL_CONTEXT_PID_NS = 22,
+ LTTNG_KERNEL_CONTEXT_USER_NS = 23,
+ LTTNG_KERNEL_CONTEXT_UTS_NS = 24,
+ LTTNG_KERNEL_CONTEXT_UID = 25,
+ LTTNG_KERNEL_CONTEXT_EUID = 26,
+ LTTNG_KERNEL_CONTEXT_SUID = 27,
+ LTTNG_KERNEL_CONTEXT_GID = 28,
+ LTTNG_KERNEL_CONTEXT_EGID = 29,
+ LTTNG_KERNEL_CONTEXT_SGID = 30,
+ LTTNG_KERNEL_CONTEXT_VUID = 31,
+ LTTNG_KERNEL_CONTEXT_VEUID = 32,
+ LTTNG_KERNEL_CONTEXT_VSUID = 33,
+ LTTNG_KERNEL_CONTEXT_VGID = 34,
+ LTTNG_KERNEL_CONTEXT_VEGID = 35,
+ LTTNG_KERNEL_CONTEXT_VSGID = 36,
+};
+
+struct lttng_kernel_perf_counter_ctx {
+ uint32_t type;
+ uint64_t config;
+ char name[LTTNG_KERNEL_SYM_NAME_LEN];
+} __attribute__((packed));
+
+#define LTTNG_KERNEL_CONTEXT_PADDING1 16
+#define LTTNG_KERNEL_CONTEXT_PADDING2 LTTNG_KERNEL_SYM_NAME_LEN + 32
+struct lttng_kernel_context {
+ enum lttng_kernel_context_type ctx;
+ char padding[LTTNG_KERNEL_CONTEXT_PADDING1];
+
+ union {
+ struct lttng_kernel_perf_counter_ctx perf_counter;
+ char padding[LTTNG_KERNEL_CONTEXT_PADDING2];
+ } u;
+} __attribute__((packed));
+
+#define LTTNG_KERNEL_FILTER_BYTECODE_MAX_LEN 65536
+struct lttng_kernel_filter_bytecode {
+ uint32_t len;
+ uint32_t reloc_offset;
+ uint64_t seqnum;
+ char data[0];
+} __attribute__((packed));
+
+enum lttng_kernel_tracker_type {
+ LTTNG_KERNEL_TRACKER_UNKNOWN = -1,
+
+ LTTNG_KERNEL_TRACKER_PID = 0,
+ LTTNG_KERNEL_TRACKER_VPID = 1,
+ LTTNG_KERNEL_TRACKER_UID = 2,
+ LTTNG_KERNEL_TRACKER_VUID = 3,
+ LTTNG_KERNEL_TRACKER_GID = 4,
+ LTTNG_KERNEL_TRACKER_VGID = 5,
+};
+
+struct lttng_kernel_tracker_args {
+ enum lttng_kernel_tracker_type type;
+ int32_t id;
+};
+
+/* LTTng file descriptor ioctl */
+/* lttng/abi-old.h reserve 0x40, 0x41, 0x42, 0x43, and 0x44. */
+#define LTTNG_KERNEL_SESSION _IO(0xF6, 0x45)
+#define LTTNG_KERNEL_TRACER_VERSION \
+ _IOR(0xF6, 0x46, struct lttng_kernel_tracer_version)
+#define LTTNG_KERNEL_TRACEPOINT_LIST _IO(0xF6, 0x47)
+#define LTTNG_KERNEL_WAIT_QUIESCENT _IO(0xF6, 0x48)
+#define LTTNG_KERNEL_CALIBRATE \
+ _IOWR(0xF6, 0x49, struct lttng_kernel_calibrate)
+#define LTTNG_KERNEL_SYSCALL_LIST _IO(0xF6, 0x4A)
+#define LTTNG_KERNEL_TRACER_ABI_VERSION \
+ _IOR(0xF6, 0x4B, struct lttng_kernel_tracer_abi_version)
+
+/* Session FD ioctl */
+/* lttng/abi-old.h reserve 0x50, 0x51, 0x52, and 0x53. */
+#define LTTNG_KERNEL_METADATA \
+ _IOW(0xF6, 0x54, struct lttng_kernel_channel)
+#define LTTNG_KERNEL_CHANNEL \
+ _IOW(0xF6, 0x55, struct lttng_kernel_channel)
+#define LTTNG_KERNEL_SESSION_START _IO(0xF6, 0x56)
+#define LTTNG_KERNEL_SESSION_STOP _IO(0xF6, 0x57)
+#define LTTNG_KERNEL_SESSION_TRACK_PID \
+ _IOR(0xF6, 0x58, int32_t)
+#define LTTNG_KERNEL_SESSION_UNTRACK_PID \
+ _IOR(0xF6, 0x59, int32_t)
+
+/*
+ * ioctl 0x58 and 0x59 are duplicated here. It works, since _IOR vs _IO
+ * are generating two different ioctl numbers, but this was not done on
+ * purpose. We should generally try to avoid those duplications.
+ */
+#define LTTNG_KERNEL_SESSION_LIST_TRACKER_PIDS _IO(0xF6, 0x58)
+#define LTTNG_KERNEL_SESSION_METADATA_REGEN _IO(0xF6, 0x59)
+
+/* lttng/abi-old.h reserve 0x5A and 0x5B. */
+#define LTTNG_KERNEL_SESSION_STATEDUMP _IO(0xF6, 0x5C)
+#define LTTNG_KERNEL_SESSION_SET_NAME \
+ _IOR(0xF6, 0x5D, struct lttng_kernel_session_name)
+#define LTTNG_KERNEL_SESSION_SET_CREATION_TIME \
+ _IOR(0xF6, 0x5E, struct lttng_kernel_session_creation_time)
+
+/* Channel FD ioctl */
+/* lttng/abi-old.h reserve 0x60 and 0x61. */
+#define LTTNG_KERNEL_STREAM _IO(0xF6, 0x62)
+#define LTTNG_KERNEL_EVENT \
+ _IOW(0xF6, 0x63, struct lttng_kernel_event)
+#define LTTNG_KERNEL_SYSCALL_MASK \
+ _IOWR(0xF6, 0x64, struct lttng_kernel_syscall_mask)
+
+/* Event and Channel FD ioctl */
+/* lttng/abi-old.h reserve 0x70. */
+#define LTTNG_KERNEL_CONTEXT \
+ _IOW(0xF6, 0x71, struct lttng_kernel_context)
+
+/* Event, Channel and Session ioctl */
+/* lttng/abi-old.h reserve 0x80 and 0x81. */
+#define LTTNG_KERNEL_ENABLE _IO(0xF6, 0x82)
+#define LTTNG_KERNEL_DISABLE _IO(0xF6, 0x83)
+
+/* Event FD ioctl */
+#define LTTNG_KERNEL_FILTER _IO(0xF6, 0x90)
+#define LTTNG_KERNEL_ADD_CALLSITE _IO(0xF6, 0x91)
+
+/* Session FD ioctl (continued) */
+#define LTTNG_KERNEL_SESSION_LIST_TRACKER_IDS \
+ _IOR(0xF6, 0xA0, struct lttng_kernel_tracker_args)
+#define LTTNG_KERNEL_SESSION_TRACK_ID \
+ _IOR(0xF6, 0xA1, struct lttng_kernel_tracker_args)
+#define LTTNG_KERNEL_SESSION_UNTRACK_ID \
+ _IOR(0xF6, 0xA2, struct lttng_kernel_tracker_args)
+
+/*
+ * LTTng-specific ioctls for the lib ringbuffer.
+ *
+ * Operations applying to the current sub-buffer need to occur between
+ * a get/put or get_next/put_next ioctl pair.
+ */
+
+/* returns the timestamp begin of the current sub-buffer */
+#define LTTNG_RING_BUFFER_GET_TIMESTAMP_BEGIN _IOR(0xF6, 0x20, uint64_t)
+/* returns the timestamp end of the current sub-buffer */
+#define LTTNG_RING_BUFFER_GET_TIMESTAMP_END _IOR(0xF6, 0x21, uint64_t)
+/* returns the number of events discarded of the current sub-buffer */
+#define LTTNG_RING_BUFFER_GET_EVENTS_DISCARDED _IOR(0xF6, 0x22, uint64_t)
+/* returns the packet payload size of the current sub-buffer */
+#define LTTNG_RING_BUFFER_GET_CONTENT_SIZE _IOR(0xF6, 0x23, uint64_t)
+/* returns the packet size of the current sub-buffer*/
+#define LTTNG_RING_BUFFER_GET_PACKET_SIZE _IOR(0xF6, 0x24, uint64_t)
+/* returns the stream id (invariant for the stream) */
+#define LTTNG_RING_BUFFER_GET_STREAM_ID _IOR(0xF6, 0x25, uint64_t)
+/* returns the current timestamp as perceived from the tracer */
+#define LTTNG_RING_BUFFER_GET_CURRENT_TIMESTAMP _IOR(0xF6, 0x26, uint64_t)
+/* returns the packet sequence number of the current sub-buffer */
+#define LTTNG_RING_BUFFER_GET_SEQ_NUM _IOR(0xF6, 0x27, uint64_t)
+/* returns the stream instance id (invariant for the stream) */
+#define LTTNG_RING_BUFFER_INSTANCE_ID _IOR(0xF6, 0x28, uint64_t)
+
+#ifdef CONFIG_COMPAT
+/* returns the timestamp begin of the current sub-buffer */
+#define LTTNG_RING_BUFFER_COMPAT_GET_TIMESTAMP_BEGIN \
+ LTTNG_RING_BUFFER_GET_TIMESTAMP_BEGIN
+/* returns the timestamp end of the current sub-buffer */
+#define LTTNG_RING_BUFFER_COMPAT_GET_TIMESTAMP_END \
+ LTTNG_RING_BUFFER_GET_TIMESTAMP_END
+/* returns the number of events discarded of the current sub-buffer */
+#define LTTNG_RING_BUFFER_COMPAT_GET_EVENTS_DISCARDED \
+ LTTNG_RING_BUFFER_GET_EVENTS_DISCARDED
+/* returns the packet payload size of the current sub-buffer */
+#define LTTNG_RING_BUFFER_COMPAT_GET_CONTENT_SIZE \
+ LTTNG_RING_BUFFER_GET_CONTENT_SIZE
+/* returns the packet size of the current sub-buffer */
+#define LTTNG_RING_BUFFER_COMPAT_GET_PACKET_SIZE \
+ LTTNG_RING_BUFFER_GET_PACKET_SIZE
+/* returns the stream id (invariant for the stream) */
+#define LTTNG_RING_BUFFER_COMPAT_GET_STREAM_ID \
+ LTTNG_RING_BUFFER_GET_STREAM_ID
+/* returns the current timestamp as perceived from the tracer */
+#define LTTNG_RING_BUFFER_COMPAT_GET_CURRENT_TIMESTAMP \
+ LTTNG_RING_BUFFER_GET_CURRENT_TIMESTAMP
+/* returns the packet sequence number of the current sub-buffer */
+#define LTTNG_RING_BUFFER_COMPAT_GET_SEQ_NUM \
+ LTTNG_RING_BUFFER_GET_SEQ_NUM
+/* returns the stream instance id (invariant for the stream) */
+#define LTTNG_RING_BUFFER_COMPAT_INSTANCE_ID \
+ LTTNG_RING_BUFFER_INSTANCE_ID
+#endif /* CONFIG_COMPAT */
+
+#endif /* _LTTNG_ABI_H */
#define _BABELTRACE_BITFIELD_H
#include <linux/types.h>
-#include <lttng-endian.h>
+#include <lttng/endian.h>
#ifndef CHAR_BIT
#define CHAR_BIT 8
--- /dev/null
+/* SPDX-License-Identifier: (GPL-2.0-only or LGPL-2.1-only)
+ *
+ * lttng/clock.h
+ *
+ * Copyright (C) 2014 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+ */
+
+#ifndef _LTTNG_CLOCK_H
+#define _LTTNG_CLOCK_H
+
+#include <linux/module.h>
+
+#define LTTNG_MODULES_UUID_STR_LEN 37
+
+struct lttng_trace_clock {
+ u64 (*read64)(void);
+ u64 (*freq)(void);
+ int (*uuid)(char *uuid);
+ const char *(*name)(void);
+ const char *(*description)(void);
+};
+
+int lttng_clock_register_plugin(struct lttng_trace_clock *ltc,
+ struct module *mod);
+void lttng_clock_unregister_plugin(struct lttng_trace_clock *ltc,
+ struct module *mod);
+
+#endif /* _LTTNG_TRACE_CLOCK_H */
--- /dev/null
+/* SPDX-License-Identifier: (GPL-2.0-only or LGPL-2.1-only)
+ *
+ * lttng/cpuhotplug.h
+ *
+ * Copyright (C) 2016 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+ */
+
+#ifndef LTTNG_CPUHOTPLUG_H
+#define LTTNG_CPUHOTPLUG_H
+
+struct lttng_cpuhp_node;
+
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,10,0))
+
+#include <linux/cpuhotplug.h>
+
+enum lttng_cpuhp_component {
+ LTTNG_RING_BUFFER_FRONTEND,
+ LTTNG_RING_BUFFER_BACKEND,
+ LTTNG_RING_BUFFER_ITER,
+ LTTNG_CONTEXT_PERF_COUNTERS,
+};
+
+struct lttng_cpuhp_node {
+ enum lttng_cpuhp_component component;
+ struct hlist_node node;
+};
+
+extern enum cpuhp_state lttng_hp_prepare;
+extern enum cpuhp_state lttng_hp_online;
+
+int lttng_cpuhp_rb_backend_prepare(unsigned int cpu,
+ struct lttng_cpuhp_node *node);
+int lttng_cpuhp_rb_frontend_dead(unsigned int cpu,
+ struct lttng_cpuhp_node *node);
+int lttng_cpuhp_rb_frontend_online(unsigned int cpu,
+ struct lttng_cpuhp_node *node);
+int lttng_cpuhp_rb_frontend_offline(unsigned int cpu,
+ struct lttng_cpuhp_node *node);
+int lttng_cpuhp_rb_iter_online(unsigned int cpu,
+ struct lttng_cpuhp_node *node);
+
+/* Ring buffer is a separate library. */
+void lttng_rb_set_hp_prepare(enum cpuhp_state val);
+void lttng_rb_set_hp_online(enum cpuhp_state val);
+
+extern enum cpuhp_state lttng_rb_hp_prepare;
+extern enum cpuhp_state lttng_rb_hp_online;
+
+#endif
+
+#endif /* LTTNG_CPUHOTPLUG_H */
--- /dev/null
+/* SPDX-License-Identifier: (GPL-2.0-only or LGPL-2.1-only) */
+#ifndef _LTTNG_ENDIAN_H
+#define _LTTNG_ENDIAN_H
+
+/*
+ * lttng/endian.h
+ *
+ * Copyright (C) 2010-2012 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+ */
+
+#ifdef __KERNEL__
+# include <asm/byteorder.h>
+# ifdef __BIG_ENDIAN
+# define __BYTE_ORDER __BIG_ENDIAN
+# elif defined(__LITTLE_ENDIAN)
+# define __BYTE_ORDER __LITTLE_ENDIAN
+# else
+# error "unknown endianness"
+# endif
+#ifndef __BIG_ENDIAN
+# define __BIG_ENDIAN 4321
+#endif
+#ifndef __LITTLE_ENDIAN
+# define __LITTLE_ENDIAN 1234
+#endif
+#else
+# include <endian.h>
+#endif
+
+#endif /* _LTTNG_ENDIAN_H */
--- /dev/null
+/* SPDX-License-Identifier: (GPL-2.0-only or LGPL-2.1-only)
+ *
+ * lttng/events.h
+ *
+ * Holds LTTng per-session event registry.
+ *
+ * Copyright (C) 2010-2012 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+ */
+
+#ifndef _LTTNG_EVENTS_H
+#define _LTTNG_EVENTS_H
+
+#include <linux/version.h>
+#include <linux/list.h>
+#include <linux/kprobes.h>
+#include <linux/kref.h>
+#include <linux/uuid.h>
+#include <wrapper/uprobes.h>
+#include <lttng/cpuhotplug.h>
+#include <lttng/tracer.h>
+#include <lttng/abi.h>
+#include <lttng/abi-old.h>
+#include <lttng/endian.h>
+
+#define lttng_is_signed_type(type) (((type)(-1)) < 0)
+
+struct lttng_channel;
+struct lttng_session;
+struct lttng_metadata_cache;
+struct lib_ring_buffer_ctx;
+struct perf_event;
+struct perf_event_attr;
+struct lib_ring_buffer_config;
+
+/* Type description */
+
+enum abstract_types {
+ atype_integer,
+ atype_string,
+ atype_enum_nestable,
+ atype_array_nestable,
+ atype_sequence_nestable,
+ atype_struct_nestable,
+ atype_variant_nestable,
+ NR_ABSTRACT_TYPES,
+};
+
+enum lttng_string_encodings {
+ lttng_encode_none = 0,
+ lttng_encode_UTF8 = 1,
+ lttng_encode_ASCII = 2,
+ NR_STRING_ENCODINGS,
+};
+
+enum channel_type {
+ PER_CPU_CHANNEL,
+ METADATA_CHANNEL,
+};
+
+struct lttng_enum_value {
+ unsigned long long value;
+ unsigned int signedness:1;
+};
+
+struct lttng_enum_entry {
+ struct lttng_enum_value start, end; /* start and end are inclusive */
+ const char *string;
+ struct {
+ unsigned int is_auto:1;
+ } options;
+};
+
+#define __type_integer(_type, _size, _alignment, _signedness, \
+ _byte_order, _base, _encoding) \
+ { \
+ .atype = atype_integer, \
+ .u.integer = \
+ { \
+ .size = (_size) ? : sizeof(_type) * CHAR_BIT, \
+ .alignment = (_alignment) ? : lttng_alignof(_type) * CHAR_BIT, \
+ .signedness = (_signedness) >= 0 ? (_signedness) : lttng_is_signed_type(_type), \
+ .reverse_byte_order = _byte_order != __BYTE_ORDER, \
+ .base = _base, \
+ .encoding = lttng_encode_##_encoding, \
+ }, \
+ } \
+
+struct lttng_integer_type {
+ unsigned int size; /* in bits */
+ unsigned short alignment; /* in bits */
+ unsigned int signedness:1,
+ reverse_byte_order:1;
+ unsigned int base; /* 2, 8, 10, 16, for pretty print */
+ enum lttng_string_encodings encoding;
+};
+
+struct lttng_type {
+ enum abstract_types atype;
+ union {
+ struct lttng_integer_type integer;
+ struct {
+ enum lttng_string_encodings encoding;
+ } string;
+ struct {
+ const struct lttng_enum_desc *desc; /* Enumeration mapping */
+ const struct lttng_type *container_type;
+ } enum_nestable;
+ struct {
+ const struct lttng_type *elem_type;
+ unsigned int length; /* Num. elems. */
+ unsigned int alignment;
+ } array_nestable;
+ struct {
+ const char *length_name; /* Length field name. */
+ const struct lttng_type *elem_type;
+ unsigned int alignment; /* Alignment before elements. */
+ } sequence_nestable;
+ struct {
+ unsigned int nr_fields;
+ const struct lttng_event_field *fields; /* Array of fields. */
+ unsigned int alignment;
+ } struct_nestable;
+ struct {
+ const char *tag_name;
+ const struct lttng_event_field *choices; /* Array of fields. */
+ unsigned int nr_choices;
+ unsigned int alignment;
+ } variant_nestable;
+ } u;
+};
+
+struct lttng_enum_desc {
+ const char *name;
+ const struct lttng_enum_entry *entries;
+ unsigned int nr_entries;
+};
+
+/* Event field description */
+
+struct lttng_event_field {
+ const char *name;
+ struct lttng_type type;
+ unsigned int nowrite:1, /* do not write into trace */
+ user:1, /* fetch from user-space */
+ nofilter:1; /* do not consider for filter */
+};
+
+union lttng_ctx_value {
+ int64_t s64;
+ const char *str;
+ double d;
+};
+
+/*
+ * We need to keep this perf counter field separately from struct
+ * lttng_ctx_field because cpu hotplug needs fixed-location addresses.
+ */
+struct lttng_perf_counter_field {
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,10,0))
+ struct lttng_cpuhp_node cpuhp_prepare;
+ struct lttng_cpuhp_node cpuhp_online;
+#else
+ struct notifier_block nb;
+ int hp_enable;
+#endif
+ struct perf_event_attr *attr;
+ struct perf_event **e; /* per-cpu array */
+};
+
+struct lttng_probe_ctx {
+ struct lttng_event *event;
+ uint8_t interruptible;
+};
+
+struct lttng_ctx_field {
+ struct lttng_event_field event_field;
+ size_t (*get_size)(size_t offset);
+ size_t (*get_size_arg)(size_t offset, struct lttng_ctx_field *field,
+ struct lib_ring_buffer_ctx *ctx,
+ struct lttng_channel *chan);
+ void (*record)(struct lttng_ctx_field *field,
+ struct lib_ring_buffer_ctx *ctx,
+ struct lttng_channel *chan);
+ void (*get_value)(struct lttng_ctx_field *field,
+ struct lttng_probe_ctx *lttng_probe_ctx,
+ union lttng_ctx_value *value);
+ union {
+ struct lttng_perf_counter_field *perf_counter;
+ } u;
+ void (*destroy)(struct lttng_ctx_field *field);
+ /*
+ * Private data to keep state between get_size and record.
+ * User must perform its own synchronization to protect against
+ * concurrent and reentrant contexts.
+ */
+ void *priv;
+};
+
+struct lttng_ctx {
+ struct lttng_ctx_field *fields;
+ unsigned int nr_fields;
+ unsigned int allocated_fields;
+ size_t largest_align; /* in bytes */
+};
+
+struct lttng_event_desc {
+ const char *name; /* lttng-modules name */
+ const char *kname; /* Linux kernel name (tracepoints) */
+ void *probe_callback;
+ const struct lttng_event_ctx *ctx; /* context */
+ const struct lttng_event_field *fields; /* event payload */
+ unsigned int nr_fields;
+ struct module *owner;
+};
+
+struct lttng_probe_desc {
+ const char *provider;
+ const struct lttng_event_desc **event_desc;
+ unsigned int nr_events;
+ struct list_head head; /* chain registered probes */
+ struct list_head lazy_init_head;
+ int lazy; /* lazy registration */
+};
+
+struct lttng_krp; /* Kretprobe handling */
+
+enum lttng_event_type {
+ LTTNG_TYPE_EVENT = 0,
+ LTTNG_TYPE_ENABLER = 1,
+};
+
+struct lttng_filter_bytecode_node {
+ struct list_head node;
+ struct lttng_enabler *enabler;
+ /*
+ * struct lttng_kernel_filter_bytecode has var. sized array, must be
+ * last field.
+ */
+ struct lttng_kernel_filter_bytecode bc;
+};
+
+/*
+ * Filter return value masks.
+ */
+enum lttng_filter_ret {
+ LTTNG_FILTER_DISCARD = 0,
+ LTTNG_FILTER_RECORD_FLAG = (1ULL << 0),
+ /* Other bits are kept for future use. */
+};
+
+struct lttng_bytecode_runtime {
+ /* Associated bytecode */
+ struct lttng_filter_bytecode_node *bc;
+ uint64_t (*filter)(void *filter_data, struct lttng_probe_ctx *lttng_probe_ctx,
+ const char *filter_stack_data);
+ int link_failed;
+ struct list_head node; /* list of bytecode runtime in event */
+ struct lttng_event *event;
+};
+
+/*
+ * Objects in a linked-list of enablers, owned by an event.
+ */
+struct lttng_enabler_ref {
+ struct list_head node; /* enabler ref list */
+ struct lttng_enabler *ref; /* backward ref */
+};
+
+struct lttng_uprobe_handler {
+ struct lttng_event *event;
+ loff_t offset;
+ struct uprobe_consumer up_consumer;
+ struct list_head node;
+};
+
+/*
+ * lttng_event structure is referred to by the tracing fast path. It must be
+ * kept small.
+ */
+struct lttng_event {
+ enum lttng_event_type evtype; /* First field. */
+ unsigned int id;
+ struct lttng_channel *chan;
+ int enabled;
+ const struct lttng_event_desc *desc;
+ void *filter;
+ struct lttng_ctx *ctx;
+ enum lttng_kernel_instrumentation instrumentation;
+ union {
+ struct {
+ struct kprobe kp;
+ char *symbol_name;
+ } kprobe;
+ struct {
+ struct lttng_krp *lttng_krp;
+ char *symbol_name;
+ } kretprobe;
+ struct {
+ struct inode *inode;
+ struct list_head head;
+ } uprobe;
+ } u;
+ struct list_head list; /* Event list in session */
+ unsigned int metadata_dumped:1;
+
+ /* Backward references: list of lttng_enabler_ref (ref to enablers) */
+ struct list_head enablers_ref_head;
+ struct hlist_node hlist; /* session ht of events */
+ int registered; /* has reg'd tracepoint probe */
+ /* list of struct lttng_bytecode_runtime, sorted by seqnum */
+ struct list_head bytecode_runtime_head;
+ int has_enablers_without_bytecode;
+};
+
+enum lttng_enabler_type {
+ LTTNG_ENABLER_STAR_GLOB,
+ LTTNG_ENABLER_NAME,
+};
+
+/*
+ * Enabler field, within whatever object is enabling an event. Target of
+ * backward reference.
+ */
+struct lttng_enabler {
+ enum lttng_event_type evtype; /* First field. */
+
+ enum lttng_enabler_type type;
+
+ struct list_head node; /* per-session list of enablers */
+ /* head list of struct lttng_ust_filter_bytecode_node */
+ struct list_head filter_bytecode_head;
+
+ struct lttng_kernel_event event_param;
+ struct lttng_channel *chan;
+ struct lttng_ctx *ctx;
+ unsigned int enabled:1;
+};
+
+struct lttng_channel_ops {
+ struct channel *(*channel_create)(const char *name,
+ struct lttng_channel *lttng_chan,
+ void *buf_addr,
+ size_t subbuf_size, size_t num_subbuf,
+ unsigned int switch_timer_interval,
+ unsigned int read_timer_interval);
+ void (*channel_destroy)(struct channel *chan);
+ struct lib_ring_buffer *(*buffer_read_open)(struct channel *chan);
+ int (*buffer_has_read_closed_stream)(struct channel *chan);
+ void (*buffer_read_close)(struct lib_ring_buffer *buf);
+ int (*event_reserve)(struct lib_ring_buffer_ctx *ctx,
+ uint32_t event_id);
+ void (*event_commit)(struct lib_ring_buffer_ctx *ctx);
+ void (*event_write)(struct lib_ring_buffer_ctx *ctx, const void *src,
+ size_t len);
+ void (*event_write_from_user)(struct lib_ring_buffer_ctx *ctx,
+ const void *src, size_t len);
+ void (*event_memset)(struct lib_ring_buffer_ctx *ctx,
+ int c, size_t len);
+ void (*event_strcpy)(struct lib_ring_buffer_ctx *ctx, const char *src,
+ size_t len);
+ void (*event_strcpy_from_user)(struct lib_ring_buffer_ctx *ctx,
+ const char __user *src, size_t len);
+ /*
+ * packet_avail_size returns the available size in the current
+ * packet. Note that the size returned is only a hint, since it
+ * may change due to concurrent writes.
+ */
+ size_t (*packet_avail_size)(struct channel *chan);
+ wait_queue_head_t *(*get_writer_buf_wait_queue)(struct channel *chan, int cpu);
+ wait_queue_head_t *(*get_hp_wait_queue)(struct channel *chan);
+ int (*is_finalized)(struct channel *chan);
+ int (*is_disabled)(struct channel *chan);
+ int (*timestamp_begin) (const struct lib_ring_buffer_config *config,
+ struct lib_ring_buffer *bufb,
+ uint64_t *timestamp_begin);
+ int (*timestamp_end) (const struct lib_ring_buffer_config *config,
+ struct lib_ring_buffer *bufb,
+ uint64_t *timestamp_end);
+ int (*events_discarded) (const struct lib_ring_buffer_config *config,
+ struct lib_ring_buffer *bufb,
+ uint64_t *events_discarded);
+ int (*content_size) (const struct lib_ring_buffer_config *config,
+ struct lib_ring_buffer *bufb,
+ uint64_t *content_size);
+ int (*packet_size) (const struct lib_ring_buffer_config *config,
+ struct lib_ring_buffer *bufb,
+ uint64_t *packet_size);
+ int (*stream_id) (const struct lib_ring_buffer_config *config,
+ struct lib_ring_buffer *bufb,
+ uint64_t *stream_id);
+ int (*current_timestamp) (const struct lib_ring_buffer_config *config,
+ struct lib_ring_buffer *bufb,
+ uint64_t *ts);
+ int (*sequence_number) (const struct lib_ring_buffer_config *config,
+ struct lib_ring_buffer *bufb,
+ uint64_t *seq);
+ int (*instance_id) (const struct lib_ring_buffer_config *config,
+ struct lib_ring_buffer *bufb,
+ uint64_t *id);
+};
+
+struct lttng_transport {
+ char *name;
+ struct module *owner;
+ struct list_head node;
+ struct lttng_channel_ops ops;
+};
+
+struct lttng_syscall_filter;
+
+#define LTTNG_EVENT_HT_BITS 12
+#define LTTNG_EVENT_HT_SIZE (1U << LTTNG_EVENT_HT_BITS)
+
+struct lttng_event_ht {
+ struct hlist_head table[LTTNG_EVENT_HT_SIZE];
+};
+
+struct lttng_channel {
+ unsigned int id;
+ struct channel *chan; /* Channel buffers */
+ int enabled;
+ struct lttng_ctx *ctx;
+ /* Event ID management */
+ struct lttng_session *session;
+ struct file *file; /* File associated to channel */
+ unsigned int free_event_id; /* Next event ID to allocate */
+ struct list_head list; /* Channel list */
+ struct lttng_channel_ops *ops;
+ struct lttng_transport *transport;
+ struct lttng_event **sc_table; /* for syscall tracing */
+ struct lttng_event **compat_sc_table;
+ struct lttng_event **sc_exit_table; /* for syscall exit tracing */
+ struct lttng_event **compat_sc_exit_table;
+ struct lttng_event *sc_unknown; /* for unknown syscalls */
+ struct lttng_event *sc_compat_unknown;
+ struct lttng_event *sc_exit_unknown;
+ struct lttng_event *compat_sc_exit_unknown;
+ struct lttng_syscall_filter *sc_filter;
+ int header_type; /* 0: unset, 1: compact, 2: large */
+ enum channel_type channel_type;
+ unsigned int metadata_dumped:1,
+ sys_enter_registered:1,
+ sys_exit_registered:1,
+ syscall_all:1,
+ tstate:1; /* Transient enable state */
+};
+
+struct lttng_metadata_stream {
+ void *priv; /* Ring buffer private data */
+ struct lttng_metadata_cache *metadata_cache;
+ unsigned int metadata_in; /* Bytes read from the cache */
+ unsigned int metadata_out; /* Bytes consumed from stream */
+ int finalized; /* Has channel been finalized */
+ wait_queue_head_t read_wait; /* Reader buffer-level wait queue */
+ struct list_head list; /* Stream list */
+ struct lttng_transport *transport;
+ uint64_t version; /* Current version of the metadata cache */
+};
+
+#define LTTNG_DYNAMIC_LEN_STACK_SIZE 128
+
+struct lttng_dynamic_len_stack {
+ size_t stack[LTTNG_DYNAMIC_LEN_STACK_SIZE];
+ size_t offset;
+};
+
+DECLARE_PER_CPU(struct lttng_dynamic_len_stack, lttng_dynamic_len_stack);
+
+/*
+ * struct lttng_id_tracker declared in header due to deferencing of *v
+ * in RCU_INITIALIZER(v).
+ */
+#define LTTNG_ID_HASH_BITS 6
+#define LTTNG_ID_TABLE_SIZE (1 << LTTNG_ID_HASH_BITS)
+
+enum tracker_type {
+ TRACKER_PID,
+ TRACKER_VPID,
+ TRACKER_UID,
+ TRACKER_VUID,
+ TRACKER_GID,
+ TRACKER_VGID,
+
+ TRACKER_UNKNOWN,
+};
+
+struct lttng_id_tracker_rcu {
+ struct hlist_head id_hash[LTTNG_ID_TABLE_SIZE];
+};
+
+struct lttng_id_tracker {
+ struct lttng_session *session;
+ enum tracker_type tracker_type;
+ struct lttng_id_tracker_rcu *p; /* RCU dereferenced. */
+};
+
+struct lttng_id_hash_node {
+ struct hlist_node hlist;
+ int id;
+};
+
+struct lttng_session {
+ int active; /* Is trace session active ? */
+ int been_active; /* Has trace session been active ? */
+ struct file *file; /* File associated to session */
+ struct list_head chan; /* Channel list head */
+ struct list_head events; /* Event list head */
+ struct list_head list; /* Session list */
+ unsigned int free_chan_id; /* Next chan ID to allocate */
+ uuid_le uuid; /* Trace session unique ID */
+ struct lttng_metadata_cache *metadata_cache;
+ struct lttng_id_tracker pid_tracker;
+ struct lttng_id_tracker vpid_tracker;
+ struct lttng_id_tracker uid_tracker;
+ struct lttng_id_tracker vuid_tracker;
+ struct lttng_id_tracker gid_tracker;
+ struct lttng_id_tracker vgid_tracker;
+ unsigned int metadata_dumped:1,
+ tstate:1; /* Transient enable state */
+ /* List of enablers */
+ struct list_head enablers_head;
+ /* Hash table of events */
+ struct lttng_event_ht events_ht;
+ char name[LTTNG_KERNEL_SESSION_NAME_LEN];
+ char creation_time[LTTNG_KERNEL_SESSION_CREATION_TIME_ISO8601_LEN];
+};
+
+struct lttng_metadata_cache {
+ char *data; /* Metadata cache */
+ unsigned int cache_alloc; /* Metadata allocated size (bytes) */
+ unsigned int metadata_written; /* Number of bytes written in metadata cache */
+ struct kref refcount; /* Metadata cache usage */
+ struct list_head metadata_stream; /* Metadata stream list */
+ uuid_le uuid; /* Trace session unique ID (copy) */
+ struct mutex lock; /* Produce/consume lock */
+ uint64_t version; /* Current version of the metadata */
+};
+
+void lttng_lock_sessions(void);
+void lttng_unlock_sessions(void);
+
+struct list_head *lttng_get_probe_list_head(void);
+
+struct lttng_enabler *lttng_enabler_create(enum lttng_enabler_type type,
+ struct lttng_kernel_event *event_param,
+ struct lttng_channel *chan);
+
+int lttng_enabler_enable(struct lttng_enabler *enabler);
+int lttng_enabler_disable(struct lttng_enabler *enabler);
+int lttng_fix_pending_events(void);
+int lttng_session_active(void);
+
+struct lttng_session *lttng_session_create(void);
+int lttng_session_enable(struct lttng_session *session);
+int lttng_session_disable(struct lttng_session *session);
+void lttng_session_destroy(struct lttng_session *session);
+int lttng_session_metadata_regenerate(struct lttng_session *session);
+int lttng_session_statedump(struct lttng_session *session);
+void metadata_cache_destroy(struct kref *kref);
+
+struct lttng_channel *lttng_channel_create(struct lttng_session *session,
+ const char *transport_name,
+ void *buf_addr,
+ size_t subbuf_size, size_t num_subbuf,
+ unsigned int switch_timer_interval,
+ unsigned int read_timer_interval,
+ enum channel_type channel_type);
+struct lttng_channel *lttng_global_channel_create(struct lttng_session *session,
+ int overwrite, void *buf_addr,
+ size_t subbuf_size, size_t num_subbuf,
+ unsigned int switch_timer_interval,
+ unsigned int read_timer_interval);
+
+void lttng_metadata_channel_destroy(struct lttng_channel *chan);
+struct lttng_event *lttng_event_create(struct lttng_channel *chan,
+ struct lttng_kernel_event *event_param,
+ void *filter,
+ const struct lttng_event_desc *event_desc,
+ enum lttng_kernel_instrumentation itype);
+struct lttng_event *_lttng_event_create(struct lttng_channel *chan,
+ struct lttng_kernel_event *event_param,
+ void *filter,
+ const struct lttng_event_desc *event_desc,
+ enum lttng_kernel_instrumentation itype);
+struct lttng_event *lttng_event_compat_old_create(struct lttng_channel *chan,
+ struct lttng_kernel_old_event *old_event_param,
+ void *filter,
+ const struct lttng_event_desc *internal_desc);
+
+int lttng_channel_enable(struct lttng_channel *channel);
+int lttng_channel_disable(struct lttng_channel *channel);
+int lttng_event_enable(struct lttng_event *event);
+int lttng_event_disable(struct lttng_event *event);
+
+void lttng_transport_register(struct lttng_transport *transport);
+void lttng_transport_unregister(struct lttng_transport *transport);
+
+void synchronize_trace(void);
+int lttng_abi_init(void);
+int lttng_abi_compat_old_init(void);
+void lttng_abi_exit(void);
+void lttng_abi_compat_old_exit(void);
+
+int lttng_probe_register(struct lttng_probe_desc *desc);
+void lttng_probe_unregister(struct lttng_probe_desc *desc);
+const struct lttng_event_desc *lttng_event_get(const char *name);
+void lttng_event_put(const struct lttng_event_desc *desc);
+int lttng_probes_init(void);
+void lttng_probes_exit(void);
+
+int lttng_metadata_output_channel(struct lttng_metadata_stream *stream,
+ struct channel *chan);
+
+int lttng_id_tracker_get_node_id(const struct lttng_id_hash_node *node);
+int lttng_id_tracker_empty_set(struct lttng_id_tracker *lf);
+void lttng_id_tracker_destroy(struct lttng_id_tracker *lf, bool rcu);
+bool lttng_id_tracker_lookup(struct lttng_id_tracker_rcu *p, int id);
+int lttng_id_tracker_add(struct lttng_id_tracker *lf, int id);
+int lttng_id_tracker_del(struct lttng_id_tracker *lf, int id);
+
+int lttng_session_track_id(struct lttng_session *session,
+ enum tracker_type tracker_type, int id);
+int lttng_session_untrack_id(struct lttng_session *session,
+ enum tracker_type tracker_type, int id);
+
+int lttng_session_list_tracker_ids(struct lttng_session *session,
+ enum tracker_type tracker_type);
+
+void lttng_clock_ref(void);
+void lttng_clock_unref(void);
+
+#if defined(CONFIG_HAVE_SYSCALL_TRACEPOINTS)
+int lttng_syscalls_register(struct lttng_channel *chan, void *filter);
+int lttng_syscalls_unregister(struct lttng_channel *chan);
+int lttng_syscall_filter_enable(struct lttng_channel *chan,
+ const char *name);
+int lttng_syscall_filter_disable(struct lttng_channel *chan,
+ const char *name);
+long lttng_channel_syscall_mask(struct lttng_channel *channel,
+ struct lttng_kernel_syscall_mask __user *usyscall_mask);
+#else
+static inline int lttng_syscalls_register(struct lttng_channel *chan, void *filter)
+{
+ return -ENOSYS;
+}
+
+static inline int lttng_syscalls_unregister(struct lttng_channel *chan)
+{
+ return 0;
+}
+
+static inline int lttng_syscall_filter_enable(struct lttng_channel *chan,
+ const char *name)
+{
+ return -ENOSYS;
+}
+
+static inline int lttng_syscall_filter_disable(struct lttng_channel *chan,
+ const char *name)
+{
+ return -ENOSYS;
+}
+
+static inline long lttng_channel_syscall_mask(struct lttng_channel *channel,
+ struct lttng_kernel_syscall_mask __user *usyscall_mask)
+{
+ return -ENOSYS;
+}
+#endif
+
+void lttng_filter_sync_state(struct lttng_bytecode_runtime *runtime);
+int lttng_enabler_attach_bytecode(struct lttng_enabler *enabler,
+ struct lttng_kernel_filter_bytecode __user *bytecode);
+void lttng_enabler_event_link_bytecode(struct lttng_event *event,
+ struct lttng_enabler *enabler);
+
+int lttng_probes_init(void);
+
+extern struct lttng_ctx *lttng_static_ctx;
+
+int lttng_context_init(void);
+void lttng_context_exit(void);
+struct lttng_ctx_field *lttng_append_context(struct lttng_ctx **ctx);
+void lttng_context_update(struct lttng_ctx *ctx);
+int lttng_find_context(struct lttng_ctx *ctx, const char *name);
+int lttng_get_context_index(struct lttng_ctx *ctx, const char *name);
+void lttng_remove_context_field(struct lttng_ctx **ctx,
+ struct lttng_ctx_field *field);
+void lttng_destroy_context(struct lttng_ctx *ctx);
+int lttng_add_pid_to_ctx(struct lttng_ctx **ctx);
+int lttng_add_cpu_id_to_ctx(struct lttng_ctx **ctx);
+int lttng_add_procname_to_ctx(struct lttng_ctx **ctx);
+int lttng_add_prio_to_ctx(struct lttng_ctx **ctx);
+int lttng_add_nice_to_ctx(struct lttng_ctx **ctx);
+int lttng_add_vpid_to_ctx(struct lttng_ctx **ctx);
+int lttng_add_tid_to_ctx(struct lttng_ctx **ctx);
+int lttng_add_vtid_to_ctx(struct lttng_ctx **ctx);
+int lttng_add_ppid_to_ctx(struct lttng_ctx **ctx);
+int lttng_add_vppid_to_ctx(struct lttng_ctx **ctx);
+int lttng_add_hostname_to_ctx(struct lttng_ctx **ctx);
+int lttng_add_interruptible_to_ctx(struct lttng_ctx **ctx);
+int lttng_add_need_reschedule_to_ctx(struct lttng_ctx **ctx);
+#if defined(CONFIG_PREEMPT_RT_FULL) || defined(CONFIG_PREEMPT)
+int lttng_add_preemptible_to_ctx(struct lttng_ctx **ctx);
+#else
+static inline
+int lttng_add_preemptible_to_ctx(struct lttng_ctx **ctx)
+{
+ return -ENOSYS;
+}
+#endif
+#ifdef CONFIG_PREEMPT_RT_FULL
+int lttng_add_migratable_to_ctx(struct lttng_ctx **ctx);
+#else
+static inline
+int lttng_add_migratable_to_ctx(struct lttng_ctx **ctx)
+{
+ return -ENOSYS;
+}
+#endif
+
+int lttng_add_callstack_to_ctx(struct lttng_ctx **ctx, int type);
+
+#if defined(CONFIG_CGROUPS) && \
+ ((LINUX_VERSION_CODE >= KERNEL_VERSION(4,6,0)) || \
+ LTTNG_UBUNTU_KERNEL_RANGE(4,4,0,0, 4,5,0,0))
+int lttng_add_cgroup_ns_to_ctx(struct lttng_ctx **ctx);
+#else
+static inline
+int lttng_add_cgroup_ns_to_ctx(struct lttng_ctx **ctx)
+{
+ return -ENOSYS;
+}
+#endif
+
+#if defined(CONFIG_IPC_NS) && \
+ (LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0))
+int lttng_add_ipc_ns_to_ctx(struct lttng_ctx **ctx);
+#else
+static inline
+int lttng_add_ipc_ns_to_ctx(struct lttng_ctx **ctx)
+{
+ return -ENOSYS;
+}
+#endif
+
+#if !defined(LTTNG_MNT_NS_MISSING_HEADER) && \
+ (LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0))
+int lttng_add_mnt_ns_to_ctx(struct lttng_ctx **ctx);
+#else
+static inline
+int lttng_add_mnt_ns_to_ctx(struct lttng_ctx **ctx)
+{
+ return -ENOSYS;
+}
+#endif
+
+#if defined(CONFIG_NET_NS) && \
+ (LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0))
+int lttng_add_net_ns_to_ctx(struct lttng_ctx **ctx);
+#else
+static inline
+int lttng_add_net_ns_to_ctx(struct lttng_ctx **ctx)
+{
+ return -ENOSYS;
+}
+#endif
+
+#if defined(CONFIG_PID_NS) && \
+ (LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0))
+int lttng_add_pid_ns_to_ctx(struct lttng_ctx **ctx);
+#else
+static inline
+int lttng_add_pid_ns_to_ctx(struct lttng_ctx **ctx)
+{
+ return -ENOSYS;
+}
+#endif
+
+#if defined(CONFIG_USER_NS) && \
+ (LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0))
+int lttng_add_user_ns_to_ctx(struct lttng_ctx **ctx);
+#else
+static inline
+int lttng_add_user_ns_to_ctx(struct lttng_ctx **ctx)
+{
+ return -ENOSYS;
+}
+#endif
+
+#if defined(CONFIG_UTS_NS) && \
+ (LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0))
+int lttng_add_uts_ns_to_ctx(struct lttng_ctx **ctx);
+#else
+static inline
+int lttng_add_uts_ns_to_ctx(struct lttng_ctx **ctx)
+{
+ return -ENOSYS;
+}
+#endif
+
+int lttng_add_uid_to_ctx(struct lttng_ctx **ctx);
+int lttng_add_euid_to_ctx(struct lttng_ctx **ctx);
+int lttng_add_suid_to_ctx(struct lttng_ctx **ctx);
+int lttng_add_gid_to_ctx(struct lttng_ctx **ctx);
+int lttng_add_egid_to_ctx(struct lttng_ctx **ctx);
+int lttng_add_sgid_to_ctx(struct lttng_ctx **ctx);
+int lttng_add_vuid_to_ctx(struct lttng_ctx **ctx);
+int lttng_add_veuid_to_ctx(struct lttng_ctx **ctx);
+int lttng_add_vsuid_to_ctx(struct lttng_ctx **ctx);
+int lttng_add_vgid_to_ctx(struct lttng_ctx **ctx);
+int lttng_add_vegid_to_ctx(struct lttng_ctx **ctx);
+int lttng_add_vsgid_to_ctx(struct lttng_ctx **ctx);
+
+#if defined(CONFIG_PERF_EVENTS)
+int lttng_add_perf_counter_to_ctx(uint32_t type,
+ uint64_t config,
+ const char *name,
+ struct lttng_ctx **ctx);
+int lttng_cpuhp_perf_counter_online(unsigned int cpu,
+ struct lttng_cpuhp_node *node);
+int lttng_cpuhp_perf_counter_dead(unsigned int cpu,
+ struct lttng_cpuhp_node *node);
+#else
+static inline
+int lttng_add_perf_counter_to_ctx(uint32_t type,
+ uint64_t config,
+ const char *name,
+ struct lttng_ctx **ctx)
+{
+ return -ENOSYS;
+}
+static inline
+int lttng_cpuhp_perf_counter_online(unsigned int cpu,
+ struct lttng_cpuhp_node *node)
+{
+ return 0;
+}
+static inline
+int lttng_cpuhp_perf_counter_dead(unsigned int cpu,
+ struct lttng_cpuhp_node *node)
+{
+ return 0;
+}
+#endif
+
+int lttng_logger_init(void);
+void lttng_logger_exit(void);
+
+extern int lttng_statedump_start(struct lttng_session *session);
+
+#ifdef CONFIG_KPROBES
+int lttng_kprobes_register(const char *name,
+ const char *symbol_name,
+ uint64_t offset,
+ uint64_t addr,
+ struct lttng_event *event);
+void lttng_kprobes_unregister(struct lttng_event *event);
+void lttng_kprobes_destroy_private(struct lttng_event *event);
+#else
+static inline
+int lttng_kprobes_register(const char *name,
+ const char *symbol_name,
+ uint64_t offset,
+ uint64_t addr,
+ struct lttng_event *event)
+{
+ return -ENOSYS;
+}
+
+static inline
+void lttng_kprobes_unregister(struct lttng_event *event)
+{
+}
+
+static inline
+void lttng_kprobes_destroy_private(struct lttng_event *event)
+{
+}
+#endif
+
+int lttng_event_add_callsite(struct lttng_event *event,
+ struct lttng_kernel_event_callsite *callsite);
+
+#ifdef CONFIG_UPROBES
+int lttng_uprobes_register(const char *name,
+ int fd, struct lttng_event *event);
+int lttng_uprobes_add_callsite(struct lttng_event *event,
+ struct lttng_kernel_event_callsite *callsite);
+void lttng_uprobes_unregister(struct lttng_event *event);
+void lttng_uprobes_destroy_private(struct lttng_event *event);
+#else
+static inline
+int lttng_uprobes_register(const char *name,
+ int fd, struct lttng_event *event)
+{
+ return -ENOSYS;
+}
+
+static inline
+int lttng_uprobes_add_callsite(struct lttng_event *event,
+ struct lttng_kernel_event_callsite *callsite)
+{
+ return -ENOSYS;
+}
+
+static inline
+void lttng_uprobes_unregister(struct lttng_event *event)
+{
+}
+
+static inline
+void lttng_uprobes_destroy_private(struct lttng_event *event)
+{
+}
+#endif
+
+#ifdef CONFIG_KRETPROBES
+int lttng_kretprobes_register(const char *name,
+ const char *symbol_name,
+ uint64_t offset,
+ uint64_t addr,
+ struct lttng_event *event_entry,
+ struct lttng_event *event_exit);
+void lttng_kretprobes_unregister(struct lttng_event *event);
+void lttng_kretprobes_destroy_private(struct lttng_event *event);
+int lttng_kretprobes_event_enable_state(struct lttng_event *event,
+ int enable);
+#else
+static inline
+int lttng_kretprobes_register(const char *name,
+ const char *symbol_name,
+ uint64_t offset,
+ uint64_t addr,
+ struct lttng_event *event_entry,
+ struct lttng_event *event_exit)
+{
+ return -ENOSYS;
+}
+
+static inline
+void lttng_kretprobes_unregister(struct lttng_event *event)
+{
+}
+
+static inline
+void lttng_kretprobes_destroy_private(struct lttng_event *event)
+{
+}
+
+static inline
+int lttng_kretprobes_event_enable_state(struct lttng_event *event,
+ int enable)
+{
+ return -ENOSYS;
+}
+#endif
+
+int lttng_calibrate(struct lttng_kernel_calibrate *calibrate);
+
+extern const struct file_operations lttng_tracepoint_list_fops;
+extern const struct file_operations lttng_syscall_list_fops;
+
+#define TRACEPOINT_HAS_DATA_ARG
+
+static inline bool lttng_is_bytewise_integer(const struct lttng_type *type)
+{
+ if (type->atype != atype_integer)
+ return false;
+ switch (type->u.integer.size) {
+ case 8: /* Fall-through. */
+ case 16: /* Fall-through. */
+ case 32: /* Fall-through. */
+ case 64:
+ break;
+ default:
+ return false;
+ }
+ return true;
+}
+
+#endif /* _LTTNG_EVENTS_H */
--- /dev/null
+/* SPDX-License-Identifier: MIT
+ *
+ * lttng/filter-bytecode.h
+ *
+ * LTTng filter bytecode
+ *
+ * Copyright 2012-2016 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+ */
+
+#ifndef _FILTER_BYTECODE_H
+#define _FILTER_BYTECODE_H
+
+/*
+ * offsets are absolute from start of bytecode.
+ */
+
+struct field_ref {
+ /* Initially, symbol offset. After link, field offset. */
+ uint16_t offset;
+} __attribute__((packed));
+
+struct get_symbol {
+ /* Symbol offset. */
+ uint16_t offset;
+} __attribute__((packed));
+
+struct get_index_u16 {
+ uint16_t index;
+} __attribute__((packed));
+
+struct get_index_u64 {
+ uint64_t index;
+} __attribute__((packed));
+
+struct literal_numeric {
+ int64_t v;
+} __attribute__((packed));
+
+struct literal_double {
+ double v;
+} __attribute__((packed));
+
+struct literal_string {
+ char string[0];
+} __attribute__((packed));
+
+enum filter_op {
+ FILTER_OP_UNKNOWN = 0,
+
+ FILTER_OP_RETURN = 1,
+
+ /* binary */
+ FILTER_OP_MUL = 2,
+ FILTER_OP_DIV = 3,
+ FILTER_OP_MOD = 4,
+ FILTER_OP_PLUS = 5,
+ FILTER_OP_MINUS = 6,
+ FILTER_OP_BIT_RSHIFT = 7,
+ FILTER_OP_BIT_LSHIFT = 8,
+ FILTER_OP_BIT_AND = 9,
+ FILTER_OP_BIT_OR = 10,
+ FILTER_OP_BIT_XOR = 11,
+
+ /* binary comparators */
+ FILTER_OP_EQ = 12,
+ FILTER_OP_NE = 13,
+ FILTER_OP_GT = 14,
+ FILTER_OP_LT = 15,
+ FILTER_OP_GE = 16,
+ FILTER_OP_LE = 17,
+
+ /* string binary comparator: apply to */
+ FILTER_OP_EQ_STRING = 18,
+ FILTER_OP_NE_STRING = 19,
+ FILTER_OP_GT_STRING = 20,
+ FILTER_OP_LT_STRING = 21,
+ FILTER_OP_GE_STRING = 22,
+ FILTER_OP_LE_STRING = 23,
+
+ /* s64 binary comparator */
+ FILTER_OP_EQ_S64 = 24,
+ FILTER_OP_NE_S64 = 25,
+ FILTER_OP_GT_S64 = 26,
+ FILTER_OP_LT_S64 = 27,
+ FILTER_OP_GE_S64 = 28,
+ FILTER_OP_LE_S64 = 29,
+
+ /* double binary comparator */
+ FILTER_OP_EQ_DOUBLE = 30,
+ FILTER_OP_NE_DOUBLE = 31,
+ FILTER_OP_GT_DOUBLE = 32,
+ FILTER_OP_LT_DOUBLE = 33,
+ FILTER_OP_GE_DOUBLE = 34,
+ FILTER_OP_LE_DOUBLE = 35,
+
+ /* Mixed S64-double binary comparators */
+ FILTER_OP_EQ_DOUBLE_S64 = 36,
+ FILTER_OP_NE_DOUBLE_S64 = 37,
+ FILTER_OP_GT_DOUBLE_S64 = 38,
+ FILTER_OP_LT_DOUBLE_S64 = 39,
+ FILTER_OP_GE_DOUBLE_S64 = 40,
+ FILTER_OP_LE_DOUBLE_S64 = 41,
+
+ FILTER_OP_EQ_S64_DOUBLE = 42,
+ FILTER_OP_NE_S64_DOUBLE = 43,
+ FILTER_OP_GT_S64_DOUBLE = 44,
+ FILTER_OP_LT_S64_DOUBLE = 45,
+ FILTER_OP_GE_S64_DOUBLE = 46,
+ FILTER_OP_LE_S64_DOUBLE = 47,
+
+ /* unary */
+ FILTER_OP_UNARY_PLUS = 48,
+ FILTER_OP_UNARY_MINUS = 49,
+ FILTER_OP_UNARY_NOT = 50,
+ FILTER_OP_UNARY_PLUS_S64 = 51,
+ FILTER_OP_UNARY_MINUS_S64 = 52,
+ FILTER_OP_UNARY_NOT_S64 = 53,
+ FILTER_OP_UNARY_PLUS_DOUBLE = 54,
+ FILTER_OP_UNARY_MINUS_DOUBLE = 55,
+ FILTER_OP_UNARY_NOT_DOUBLE = 56,
+
+ /* logical */
+ FILTER_OP_AND = 57,
+ FILTER_OP_OR = 58,
+
+ /* load field ref */
+ FILTER_OP_LOAD_FIELD_REF = 59,
+ FILTER_OP_LOAD_FIELD_REF_STRING = 60,
+ FILTER_OP_LOAD_FIELD_REF_SEQUENCE = 61,
+ FILTER_OP_LOAD_FIELD_REF_S64 = 62,
+ FILTER_OP_LOAD_FIELD_REF_DOUBLE = 63,
+
+ /* load immediate from operand */
+ FILTER_OP_LOAD_STRING = 64,
+ FILTER_OP_LOAD_S64 = 65,
+ FILTER_OP_LOAD_DOUBLE = 66,
+
+ /* cast */
+ FILTER_OP_CAST_TO_S64 = 67,
+ FILTER_OP_CAST_DOUBLE_TO_S64 = 68,
+ FILTER_OP_CAST_NOP = 69,
+
+ /* get context ref */
+ FILTER_OP_GET_CONTEXT_REF = 70,
+ FILTER_OP_GET_CONTEXT_REF_STRING = 71,
+ FILTER_OP_GET_CONTEXT_REF_S64 = 72,
+ FILTER_OP_GET_CONTEXT_REF_DOUBLE = 73,
+
+ /* load userspace field ref */
+ FILTER_OP_LOAD_FIELD_REF_USER_STRING = 74,
+ FILTER_OP_LOAD_FIELD_REF_USER_SEQUENCE = 75,
+
+ /*
+ * load immediate star globbing pattern (literal string)
+ * from immediate
+ */
+ FILTER_OP_LOAD_STAR_GLOB_STRING = 76,
+
+ /* globbing pattern binary operator: apply to */
+ FILTER_OP_EQ_STAR_GLOB_STRING = 77,
+ FILTER_OP_NE_STAR_GLOB_STRING = 78,
+
+ /*
+ * Instructions for recursive traversal through composed types.
+ */
+ FILTER_OP_GET_CONTEXT_ROOT = 79,
+ FILTER_OP_GET_APP_CONTEXT_ROOT = 80,
+ FILTER_OP_GET_PAYLOAD_ROOT = 81,
+
+ FILTER_OP_GET_SYMBOL = 82,
+ FILTER_OP_GET_SYMBOL_FIELD = 83,
+ FILTER_OP_GET_INDEX_U16 = 84,
+ FILTER_OP_GET_INDEX_U64 = 85,
+
+ FILTER_OP_LOAD_FIELD = 86,
+ FILTER_OP_LOAD_FIELD_S8 = 87,
+ FILTER_OP_LOAD_FIELD_S16 = 88,
+ FILTER_OP_LOAD_FIELD_S32 = 89,
+ FILTER_OP_LOAD_FIELD_S64 = 90,
+ FILTER_OP_LOAD_FIELD_U8 = 91,
+ FILTER_OP_LOAD_FIELD_U16 = 92,
+ FILTER_OP_LOAD_FIELD_U32 = 93,
+ FILTER_OP_LOAD_FIELD_U64 = 94,
+ FILTER_OP_LOAD_FIELD_STRING = 95,
+ FILTER_OP_LOAD_FIELD_SEQUENCE = 96,
+ FILTER_OP_LOAD_FIELD_DOUBLE = 97,
+
+ FILTER_OP_UNARY_BIT_NOT = 98,
+
+ FILTER_OP_RETURN_S64 = 99,
+
+ NR_FILTER_OPS,
+};
+
+typedef uint8_t filter_opcode_t;
+
+struct load_op {
+ filter_opcode_t op;
+ char data[0];
+ /* data to load. Size known by enum filter_opcode and null-term char. */
+} __attribute__((packed));
+
+struct binary_op {
+ filter_opcode_t op;
+} __attribute__((packed));
+
+struct unary_op {
+ filter_opcode_t op;
+} __attribute__((packed));
+
+/* skip_offset is absolute from start of bytecode */
+struct logical_op {
+ filter_opcode_t op;
+ uint16_t skip_offset; /* bytecode insn, if skip second test */
+} __attribute__((packed));
+
+struct cast_op {
+ filter_opcode_t op;
+} __attribute__((packed));
+
+struct return_op {
+ filter_opcode_t op;
+} __attribute__((packed));
+
+#endif /* _FILTER_BYTECODE_H */
--- /dev/null
+/* SPDX-License-Identifier: MIT
+ *
+ * lttng/filter.h
+ *
+ * LTTng modules filter header.
+ *
+ * Copyright (C) 2010-2016 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+ */
+
+#ifndef _LTTNG_FILTER_H
+#define _LTTNG_FILTER_H
+
+#include <linux/kernel.h>
+
+#include <lttng/events.h>
+#include <lttng/filter-bytecode.h>
+
+/* Filter stack length, in number of entries */
+#define FILTER_STACK_LEN 10 /* includes 2 dummy */
+#define FILTER_STACK_EMPTY 1
+
+#define FILTER_MAX_DATA_LEN 65536
+
+#ifdef DEBUG
+#define dbg_printk(fmt, args...) \
+ printk(KERN_DEBUG "[debug bytecode in %s:%s@%u] " fmt, \
+ __FILE__, __func__, __LINE__, ## args)
+#else
+#define dbg_printk(fmt, args...) \
+do { \
+ /* do nothing but check printf format */ \
+ if (0) \
+ printk(KERN_DEBUG "[debug bytecode in %s:%s@%u] " fmt, \
+ __FILE__, __func__, __LINE__, ## args); \
+} while (0)
+#endif
+
+/* Linked bytecode. Child of struct lttng_bytecode_runtime. */
+struct bytecode_runtime {
+ struct lttng_bytecode_runtime p;
+ size_t data_len;
+ size_t data_alloc_len;
+ char *data;
+ uint16_t len;
+ char code[0];
+};
+
+enum entry_type {
+ REG_S64,
+ REG_DOUBLE,
+ REG_STRING,
+ REG_STAR_GLOB_STRING,
+ REG_TYPE_UNKNOWN,
+ REG_PTR,
+};
+
+enum load_type {
+ LOAD_ROOT_CONTEXT,
+ LOAD_ROOT_APP_CONTEXT,
+ LOAD_ROOT_PAYLOAD,
+ LOAD_OBJECT,
+};
+
+enum object_type {
+ OBJECT_TYPE_S8,
+ OBJECT_TYPE_S16,
+ OBJECT_TYPE_S32,
+ OBJECT_TYPE_S64,
+ OBJECT_TYPE_U8,
+ OBJECT_TYPE_U16,
+ OBJECT_TYPE_U32,
+ OBJECT_TYPE_U64,
+
+ OBJECT_TYPE_DOUBLE,
+ OBJECT_TYPE_STRING,
+ OBJECT_TYPE_STRING_SEQUENCE,
+
+ OBJECT_TYPE_SEQUENCE,
+ OBJECT_TYPE_ARRAY,
+ OBJECT_TYPE_STRUCT,
+ OBJECT_TYPE_VARIANT,
+
+ OBJECT_TYPE_DYNAMIC,
+};
+
+struct filter_get_index_data {
+ uint64_t offset; /* in bytes */
+ size_t ctx_index;
+ size_t array_len;
+ struct {
+ size_t len;
+ enum object_type type;
+ bool rev_bo; /* reverse byte order */
+ } elem;
+};
+
+/* Validation stack */
+struct vstack_load {
+ enum load_type type;
+ enum object_type object_type;
+ const struct lttng_event_field *field;
+ bool rev_bo; /* reverse byte order */
+};
+
+struct vstack_entry {
+ enum entry_type type;
+ struct vstack_load load;
+};
+
+struct vstack {
+ int top; /* top of stack */
+ struct vstack_entry e[FILTER_STACK_LEN];
+};
+
+static inline
+void vstack_init(struct vstack *stack)
+{
+ stack->top = -1;
+}
+
+static inline
+struct vstack_entry *vstack_ax(struct vstack *stack)
+{
+ if (unlikely(stack->top < 0))
+ return NULL;
+ return &stack->e[stack->top];
+}
+
+static inline
+struct vstack_entry *vstack_bx(struct vstack *stack)
+{
+ if (unlikely(stack->top < 1))
+ return NULL;
+ return &stack->e[stack->top - 1];
+}
+
+static inline
+int vstack_push(struct vstack *stack)
+{
+ if (stack->top >= FILTER_STACK_LEN - 1) {
+ printk(KERN_WARNING "Stack full\n");
+ return -EINVAL;
+ }
+ ++stack->top;
+ return 0;
+}
+
+static inline
+int vstack_pop(struct vstack *stack)
+{
+ if (unlikely(stack->top < 0)) {
+ printk(KERN_WARNING "Stack empty\n");
+ return -EINVAL;
+ }
+ stack->top--;
+ return 0;
+}
+
+/* Execution stack */
+enum estack_string_literal_type {
+ ESTACK_STRING_LITERAL_TYPE_NONE,
+ ESTACK_STRING_LITERAL_TYPE_PLAIN,
+ ESTACK_STRING_LITERAL_TYPE_STAR_GLOB,
+};
+
+struct load_ptr {
+ enum load_type type;
+ enum object_type object_type;
+ const void *ptr;
+ bool rev_bo;
+ /* Temporary place-holders for contexts. */
+ union {
+ int64_t s64;
+ uint64_t u64;
+ double d;
+ } u;
+ /*
+ * "field" is only needed when nested under a variant, in which
+ * case we cannot specialize the nested operations.
+ */
+ const struct lttng_event_field *field;
+};
+
+struct estack_entry {
+ union {
+ int64_t v;
+
+ struct {
+ const char *str;
+ const char __user *user_str;
+ size_t seq_len;
+ enum estack_string_literal_type literal_type;
+ int user; /* is string from userspace ? */
+ } s;
+ struct load_ptr ptr;
+ } u;
+};
+
+struct estack {
+ int top; /* top of stack */
+ struct estack_entry e[FILTER_STACK_LEN];
+};
+
+#define estack_ax_v ax
+#define estack_bx_v bx
+
+#define estack_ax(stack, top) \
+ ({ \
+ BUG_ON((top) <= FILTER_STACK_EMPTY); \
+ &(stack)->e[top]; \
+ })
+
+#define estack_bx(stack, top) \
+ ({ \
+ BUG_ON((top) <= FILTER_STACK_EMPTY + 1); \
+ &(stack)->e[(top) - 1]; \
+ })
+
+#define estack_push(stack, top, ax, bx) \
+ do { \
+ BUG_ON((top) >= FILTER_STACK_LEN - 1); \
+ (stack)->e[(top) - 1].u.v = (bx); \
+ (bx) = (ax); \
+ ++(top); \
+ } while (0)
+
+#define estack_pop(stack, top, ax, bx) \
+ do { \
+ BUG_ON((top) <= FILTER_STACK_EMPTY); \
+ (ax) = (bx); \
+ (bx) = (stack)->e[(top) - 2].u.v; \
+ (top)--; \
+ } while (0)
+
+const char *lttng_filter_print_op(enum filter_op op);
+
+int lttng_filter_validate_bytecode(struct bytecode_runtime *bytecode);
+int lttng_filter_specialize_bytecode(struct lttng_event *event,
+ struct bytecode_runtime *bytecode);
+
+uint64_t lttng_filter_false(void *filter_data,
+ struct lttng_probe_ctx *lttng_probe_ctx,
+ const char *filter_stack_data);
+uint64_t lttng_filter_interpret_bytecode(void *filter_data,
+ struct lttng_probe_ctx *lttng_probe_ctx,
+ const char *filter_stack_data);
+
+#endif /* _LTTNG_FILTER_H */
--- /dev/null
+/* SPDX-License-Identifier: (GPL-2.0-only or LGPL-2.1-only)
+ *
+ * lttng/kernel-version.h
+ *
+ * Contains helpers to check more complex kernel version conditions.
+ *
+ * Copyright (C) 2012 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+ */
+
+#ifndef _LTTNG_KERNEL_VERSION_H
+#define _LTTNG_KERNEL_VERSION_H
+
+#include <linux/version.h>
+#include <generated/utsrelease.h>
+
+/*
+ * This macro checks if the kernel version is between the two specified
+ * versions (lower limit inclusive, upper limit exclusive).
+ */
+#define LTTNG_KERNEL_RANGE(a_low, b_low, c_low, a_high, b_high, c_high) \
+ (LINUX_VERSION_CODE >= KERNEL_VERSION(a_low, b_low, c_low) && \
+ LINUX_VERSION_CODE < KERNEL_VERSION(a_high, b_high, c_high))
+
+/* Ubuntu */
+
+#define LTTNG_UBUNTU_KERNEL_VERSION(a, b, c, d) \
+ (((a) << 24) + ((b) << 16) + ((c) << 8) + (d))
+
+#ifdef UTS_UBUNTU_RELEASE_ABI
+#define LTTNG_UBUNTU_VERSION_CODE \
+ ((LINUX_VERSION_CODE << 8) + UTS_UBUNTU_RELEASE_ABI)
+#else
+#define LTTNG_UBUNTU_VERSION_CODE 0
+#endif
+
+#define LTTNG_UBUNTU_KERNEL_RANGE(a_low, b_low, c_low, d_low, \
+ a_high, b_high, c_high, d_high) \
+ (LTTNG_UBUNTU_VERSION_CODE >= \
+ LTTNG_UBUNTU_KERNEL_VERSION(a_low, b_low, c_low, d_low) && \
+ LTTNG_UBUNTU_VERSION_CODE < \
+ LTTNG_UBUNTU_KERNEL_VERSION(a_high, b_high, c_high, d_high))
+
+/* Debian */
+
+#define LTTNG_DEBIAN_KERNEL_VERSION(a, b, c, d, e, f) \
+ (((((a) << 16) + ((b) << 8) + (c)) * 1000000ULL) + ((d) * 10000) + ((e) * 100) + (f))
+
+#ifdef DEBIAN_API_VERSION
+#define LTTNG_DEBIAN_VERSION_CODE \
+ ((LINUX_VERSION_CODE * 1000000ULL) + DEBIAN_API_VERSION)
+#else
+#define LTTNG_DEBIAN_VERSION_CODE 0
+#endif
+
+#define LTTNG_DEBIAN_KERNEL_RANGE(a_low, b_low, c_low, d_low, e_low, f_low, \
+ a_high, b_high, c_high, d_high, e_high, f_high) \
+ (LTTNG_DEBIAN_VERSION_CODE >= \
+ LTTNG_DEBIAN_KERNEL_VERSION(a_low, b_low, c_low, d_low, e_low, f_low) && \
+ LTTNG_DEBIAN_VERSION_CODE < \
+ LTTNG_DEBIAN_KERNEL_VERSION(a_high, b_high, c_high, d_high, e_high, f_high))
+
+#define LTTNG_RHEL_KERNEL_VERSION(a, b, c, d, e, f) \
+ (((((a) << 16) + ((b) << 8) + (c)) * 10000000ULL) + ((d) * 10000) + ((e) * 100) + (f))
+
+/* RHEL */
+
+#ifdef RHEL_API_VERSION
+#define LTTNG_RHEL_VERSION_CODE \
+ ((LINUX_VERSION_CODE * 10000000ULL) + RHEL_API_VERSION)
+#else
+#define LTTNG_RHEL_VERSION_CODE 0
+#endif
+
+#define LTTNG_RHEL_KERNEL_RANGE(a_low, b_low, c_low, d_low, e_low, f_low, \
+ a_high, b_high, c_high, d_high, e_high, f_high) \
+ (LTTNG_RHEL_VERSION_CODE >= \
+ LTTNG_RHEL_KERNEL_VERSION(a_low, b_low, c_low, d_low, e_low, f_low) && \
+ LTTNG_RHEL_VERSION_CODE < \
+ LTTNG_RHEL_KERNEL_VERSION(a_high, b_high, c_high, d_high, e_high, f_high))
+
+/* SUSE Linux enterprise */
+
+#define LTTNG_SLE_KERNEL_VERSION(a, b, c, d, e, f) \
+ (((((a) << 16) + ((b) << 8) + (c)) * 10000000ULL) + ((d) * 10000) + ((e) * 100) + (f))
+
+#ifdef SLE_API_VERSION
+#define LTTNG_SLE_VERSION_CODE \
+ ((LINUX_VERSION_CODE * 10000000ULL) + SLE_API_VERSION)
+#else
+#define LTTNG_SLE_VERSION_CODE 0
+#endif
+
+#define LTTNG_SLE_KERNEL_RANGE(a_low, b_low, c_low, d_low, e_low, f_low, \
+ a_high, b_high, c_high, d_high, e_high, f_high) \
+ (LTTNG_SLE_VERSION_CODE >= \
+ LTTNG_SLE_KERNEL_VERSION(a_low, b_low, c_low, d_low, e_low, f_low) && \
+ LTTNG_SLE_VERSION_CODE < \
+ LTTNG_SLE_KERNEL_VERSION(a_high, b_high, c_high, d_high, e_high, f_high))
+
+/* Fedora */
+
+#define LTTNG_FEDORA_KERNEL_VERSION(a, b, c, d) \
+ (((((a) << 16) + ((b) << 8) + (c)) * 10000ULL) + (d))
+
+#ifdef FEDORA_REVISION_VERSION
+#define LTTNG_FEDORA_VERSION_CODE \
+ ((LINUX_VERSION_CODE * 10000ULL) + FEDORA_REVISION_VERSION)
+#else
+#define LTTNG_FEDORA_VERSION_CODE 0
+#endif
+
+#define LTTNG_FEDORA_KERNEL_RANGE(a_low, b_low, c_low, d_low, \
+ a_high, b_high, c_high, d_high) \
+ (LTTNG_FEDORA_VERSION_CODE >= \
+ LTTNG_FEDORA_KERNEL_VERSION(a_low, b_low, c_low, d_low) && \
+ LTTNG_FEDORA_VERSION_CODE < \
+ LTTNG_FEDORA_KERNEL_VERSION(a_high, b_high, c_high, d_high))
+
+/* RT patch */
+
+#define LTTNG_RT_KERNEL_VERSION(a, b, c, d) \
+ (((a) << 24) + ((b) << 16) + ((c) << 8) + (d))
+
+#ifdef RT_PATCH_VERSION
+#define LTTNG_RT_VERSION_CODE \
+ ((LINUX_VERSION_CODE << 8) + RT_PATCH_VERSION)
+#else
+#define LTTNG_RT_VERSION_CODE 0
+#endif
+
+#define LTTNG_RT_KERNEL_RANGE(a_low, b_low, c_low, d_low, \
+ a_high, b_high, c_high, d_high) \
+ (LTTNG_RT_VERSION_CODE >= \
+ LTTNG_RT_KERNEL_VERSION(a_low, b_low, c_low, d_low) && \
+ LTTNG_RT_VERSION_CODE < \
+ LTTNG_RT_KERNEL_VERSION(a_high, b_high, c_high, d_high))
+
+#endif /* _LTTNG_KERNEL_VERSION_H */
--- /dev/null
+/* SPDX-License-Identifier: (GPL-2.0-only or LGPL-2.1-only) */
+#ifndef _LTTNG_STRING_UTILS_H
+#define _LTTNG_STRING_UTILS_H
+
+/*
+ * Copyright (C) 2017 Philippe Proulx <pproulx@efficios.com>
+ */
+
+#include <stdbool.h>
+
+typedef char (*strutils_get_char_at_cb)(size_t, void *);
+
+bool strutils_is_star_glob_pattern(const char *pattern);
+bool strutils_is_star_at_the_end_only_glob_pattern(const char *pattern);
+bool strutils_star_glob_match(const char *pattern, size_t pattern_len,
+ const char *candidate, size_t candidate_len);
+bool strutils_star_glob_match_char_cb(
+ strutils_get_char_at_cb pattern_get_char_at_cb,
+ void *pattern_get_char_at_cb_data,
+ strutils_get_char_at_cb candidate_get_char_at_cb,
+ void *candidate_get_char_at_cb_data);
+
+#endif /* _LTTNG_STRING_UTILS_H */
--- /dev/null
+/* SPDX-License-Identifier: (GPL-2.0-only or LGPL-2.1-only)
+ *
+ * lttng/tp-mempool.h
+ *
+ * Copyright (C) 2018 Julien Desfossez <jdesfossez@efficios.com>
+ */
+
+#ifndef LTTNG_TP_MEMPOOL_H
+#define LTTNG_TP_MEMPOOL_H
+
+#include <linux/percpu.h>
+
+#define LTTNG_TP_MEMPOOL_NR_BUF_PER_CPU 4
+#define LTTNG_TP_MEMPOOL_BUF_SIZE 4096
+
+/*
+ * Initialize the pool, only performed once. The pool is a set of
+ * LTTNG_TP_MEMPOOL_NR_BUF_PER_CPU buffers of size LTTNG_TP_MEMPOOL_BUF_SIZE
+ * per-cpu.
+ *
+ * Returns 0 on success, a negative value on error.
+ */
+int lttng_tp_mempool_init(void);
+
+/*
+ * Destroy the pool and free all the memory allocated.
+ */
+void lttng_tp_mempool_destroy(void);
+
+/*
+ * Ask for a buffer on the current cpu.
+ *
+ * The pool is per-cpu, but there is no exclusive access guarantee on the
+ * per-cpu free-list, the caller needs to ensure it cannot get preempted or
+ * interrupted while performing the allocation.
+ *
+ * The maximum size that can be allocated is LTTNG_TP_MEMPOOL_BUF_SIZE, and the
+ * maximum number of buffers allocated simultaneously on the same CPU is
+ * LTTNG_TP_MEMPOOL_NR_BUF_PER_CPU.
+ *
+ * Return a pointer to a buffer on success, NULL on error.
+ */
+void *lttng_tp_mempool_alloc(size_t size);
+
+/*
+ * Release the memory reserved. Same concurrency limitations as the allocation.
+ */
+void lttng_tp_mempool_free(void *ptr);
+
+#endif /* LTTNG_TP_MEMPOOL_H */
#include <asm/byteorder.h>
#include <linux/swab.h>
-#include <lttng/types.h>
-#include <lttng/probe-user.h>
#include <wrapper/vmalloc.h> /* for wrapper_vmalloc_sync_mappings() */
#include <ringbuffer/frontend_types.h>
#include <ringbuffer/backend.h>
#include <wrapper/rcu.h>
#include <wrapper/user_namespace.h>
-#include <lttng-events.h>
-#include <lttng-tracer-core.h>
-#include <lttng-tp-mempool.h>
+#include <lttng/types.h>
+#include <lttng/probe-user.h>
+#include <lttng/events.h>
+#include <lttng/tracer-core.h>
+#include <lttng/tp-mempool.h>
#define __LTTNG_NULL_STRING "(null)"
--- /dev/null
+/* SPDX-License-Identifier: (GPL-2.0-only or LGPL-2.1-only)
+ *
+ * lttng/tracepoint.h
+ *
+ * LTTng adaptation layer for Linux kernel 3.15+ tracepoints.
+ *
+ * Copyright (C) 2014 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+ */
+
+#ifndef _LTTNG_TRACEPOINT_H
+#define _LTTNG_TRACEPOINT_H
+
+int lttng_tracepoint_probe_register(const char *name, void *probe, void *data);
+int lttng_tracepoint_probe_unregister(const char *name, void *probe, void *data);
+int lttng_tracepoint_init(void);
+void lttng_tracepoint_exit(void);
+
+#endif /* _LTTNG_TRACEPOINT_H */
--- /dev/null
+/* SPDX-License-Identifier: (GPL-2.0-only or LGPL-2.1-only)
+ *
+ * lttng/tracer-core.h
+ *
+ * This contains the core definitions for the Linux Trace Toolkit Next
+ * Generation tracer.
+ *
+ * Copyright (C) 2005-2012 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+ */
+
+#ifndef LTTNG_TRACER_CORE_H
+#define LTTNG_TRACER_CORE_H
+
+#include <linux/list.h>
+#include <linux/percpu.h>
+
+#ifndef CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS
+/* Align data on its natural alignment */
+#define RING_BUFFER_ALIGN
+#endif
+
+#include <ringbuffer/config.h>
+
+struct lttng_session;
+struct lttng_channel;
+struct lttng_event;
+
+#endif /* LTTNG_TRACER_CORE_H */
--- /dev/null
+/* SPDX-License-Identifier: (GPL-2.0-only or LGPL-2.1-only) */
+#ifndef _LTTNG_TRACER_H
+#define _LTTNG_TRACER_H
+
+/*
+ * lttng/tracer.h
+ *
+ * This contains the definitions for the Linux Trace Toolkit Next
+ * Generation tracer.
+ *
+ * Copyright (C) 2005-2012 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+ */
+
+#include <stdarg.h>
+#include <linux/types.h>
+#include <linux/limits.h>
+#include <linux/list.h>
+#include <linux/cache.h>
+#include <linux/timex.h>
+#include <linux/wait.h>
+#include <asm/atomic.h>
+#include <asm/local.h>
+
+#include <wrapper/trace-clock.h>
+#include <wrapper/compiler.h>
+#include <wrapper/vmalloc.h>
+#include <lttng/tracer-core.h>
+#include <lttng/events.h>
+
+#define LTTNG_MODULES_MAJOR_VERSION 2
+#define LTTNG_MODULES_MINOR_VERSION 12
+#define LTTNG_MODULES_PATCHLEVEL_VERSION 0
+#define LTTNG_MODULES_EXTRAVERSION "-rc1"
+
+#define LTTNG_VERSION_NAME "(Ta) Meilleure"
+#define LTTNG_VERSION_DESCRIPTION "Ta Meilleure is a Northeast IPA beer brewed by Lagabière. Translating to \"Your best one\", this beer gives out strong aromas of passion fruit, lemon, and peaches. Tastewise, expect a lot of fruit, a creamy texture, and a smooth lingering hop bitterness."
+
+#ifndef CHAR_BIT
+#define CHAR_BIT 8
+#endif
+
+/* Number of bytes to log with a read/write event */
+#define LTTNG_LOG_RW_SIZE 32L
+#define LTTNG_MAX_SMALL_SIZE 0xFFFFU
+
+#ifdef RING_BUFFER_ALIGN
+#define lttng_alignof(type) __alignof__(type)
+#else
+#define lttng_alignof(type) 1
+#endif
+
+/* Tracer properties */
+#define CTF_MAGIC_NUMBER 0xC1FC1FC1
+#define TSDL_MAGIC_NUMBER 0x75D11D57
+
+/* CTF specification version followed */
+#define CTF_SPEC_MAJOR 1
+#define CTF_SPEC_MINOR 8
+
+/*
+ * Number of milliseconds to retry before failing metadata writes on buffer full
+ * condition. (10 seconds)
+ */
+#define LTTNG_METADATA_TIMEOUT_MSEC 10000
+
+#define LTTNG_RFLAG_EXTENDED RING_BUFFER_RFLAG_END
+#define LTTNG_RFLAG_END (LTTNG_RFLAG_EXTENDED << 1)
+
+#endif /* _LTTNG_TRACER_H */
#define _LTTNG_PROBES_LTTNG_TYPES_H
#include <linux/seq_file.h>
-#include <lttng-events.h>
-#include <lttng-tracer.h>
-#include <lttng-endian.h>
+#include <lttng/events.h>
+#include <lttng/tracer.h>
+#include <lttng/endian.h>
#endif /* _LTTNG_PROBES_LTTNG_TYPES_H */
#include <linux/cpumask.h>
#include <linux/types.h>
-#include <lttng-kernel-version.h>
-#include <lttng-cpuhotplug.h>
+#include <lttng/kernel-version.h>
+#include <lttng/cpuhotplug.h>
struct lib_ring_buffer_backend_page {
void *virt; /* page virtual address (cached) */
#include <linux/types.h>
#include <linux/percpu.h>
#include <lttng/align.h>
-#include <lttng-tracer-core.h>
+#include <lttng/tracer-core.h>
struct lib_ring_buffer;
struct channel;
#define RING_BUFFER_RFLAG_END (1U << 1)
#ifndef LTTNG_TRACER_CORE_H
-#error "lttng-tracer-core.h is needed for RING_BUFFER_ALIGN define"
+#error "lttng/tracer-core.h is needed for RING_BUFFER_ALIGN define"
#endif
/*
#include <ringbuffer/config.h>
#include <ringbuffer/backend_types.h>
#include <lttng/prio_heap.h> /* For per-CPU read-side iterator */
-#include <lttng-cpuhotplug.h>
+#include <lttng/cpuhotplug.h>
/*
* A switch is done during tracing or as a final flush after tracing (so it
#include <linux/udp.h>
#include <linux/icmp.h>
#include <linux/version.h>
-#include <lttng-endian.h>
+#include <lttng/endian.h>
#include <net/sock.h>
#ifndef ONCE_LTTNG_NET_H
#include <ringbuffer/frontend.h>
#include <ringbuffer/vfs.h>
#include <wrapper/poll.h>
-#include <lttng-tracer.h>
+#include <lttng/tracer.h>
static int put_ulong(unsigned long val, unsigned long arg)
{
+++ /dev/null
-/* SPDX-License-Identifier: (GPL-2.0-only or LGPL-2.1-only)
- *
- * lttng-abi-old.h
- *
- * LTTng old ABI header (without support for compat 32/64 bits)
- *
- * Copyright (C) 2010-2012 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- */
-
-#ifndef _LTTNG_ABI_OLD_H
-#define _LTTNG_ABI_OLD_H
-
-#include <linux/fs.h>
-#include <lttng-abi.h>
-
-/*
- * LTTng DebugFS ABI structures.
- */
-#define LTTNG_KERNEL_OLD_CHANNEL_PADDING LTTNG_KERNEL_SYM_NAME_LEN + 32
-struct lttng_kernel_old_channel {
- int overwrite; /* 1: overwrite, 0: discard */
- uint64_t subbuf_size; /* in bytes */
- uint64_t num_subbuf;
- unsigned int switch_timer_interval; /* usecs */
- unsigned int read_timer_interval; /* usecs */
- enum lttng_kernel_output output; /* splice, mmap */
- char padding[LTTNG_KERNEL_OLD_CHANNEL_PADDING];
-};
-
-struct lttng_kernel_old_kretprobe {
- uint64_t addr;
-
- uint64_t offset;
- char symbol_name[LTTNG_KERNEL_SYM_NAME_LEN];
-};
-
-/*
- * Either addr is used, or symbol_name and offset.
- */
-struct lttng_kernel_old_kprobe {
- uint64_t addr;
-
- uint64_t offset;
- char symbol_name[LTTNG_KERNEL_SYM_NAME_LEN];
-};
-
-struct lttng_kernel_old_function_tracer {
- char symbol_name[LTTNG_KERNEL_SYM_NAME_LEN];
-};
-
-/*
- * For syscall tracing, name = '\0' means "enable all".
- */
-#define LTTNG_KERNEL_OLD_EVENT_PADDING1 16
-#define LTTNG_KERNEL_OLD_EVENT_PADDING2 LTTNG_KERNEL_SYM_NAME_LEN + 32
-struct lttng_kernel_old_event {
- char name[LTTNG_KERNEL_SYM_NAME_LEN]; /* event name */
- enum lttng_kernel_instrumentation instrumentation;
- char padding[LTTNG_KERNEL_OLD_EVENT_PADDING1];
-
- /* Per instrumentation type configuration */
- union {
- struct lttng_kernel_old_kretprobe kretprobe;
- struct lttng_kernel_old_kprobe kprobe;
- struct lttng_kernel_old_function_tracer ftrace;
- char padding[LTTNG_KERNEL_OLD_EVENT_PADDING2];
- } u;
-};
-
-struct lttng_kernel_old_tracer_version {
- uint32_t major;
- uint32_t minor;
- uint32_t patchlevel;
-};
-
-struct lttng_kernel_old_calibrate {
- enum lttng_kernel_calibrate_type type; /* type (input) */
-};
-
-struct lttng_kernel_old_perf_counter_ctx {
- uint32_t type;
- uint64_t config;
- char name[LTTNG_KERNEL_SYM_NAME_LEN];
-};
-
-#define LTTNG_KERNEL_OLD_CONTEXT_PADDING1 16
-#define LTTNG_KERNEL_OLD_CONTEXT_PADDING2 LTTNG_KERNEL_SYM_NAME_LEN + 32
-struct lttng_kernel_old_context {
- enum lttng_kernel_context_type ctx;
- char padding[LTTNG_KERNEL_OLD_CONTEXT_PADDING1];
-
- union {
- struct lttng_kernel_old_perf_counter_ctx perf_counter;
- char padding[LTTNG_KERNEL_OLD_CONTEXT_PADDING2];
- } u;
-};
-
-/* LTTng file descriptor ioctl */
-#define LTTNG_KERNEL_OLD_SESSION _IO(0xF6, 0x40)
-#define LTTNG_KERNEL_OLD_TRACER_VERSION \
- _IOR(0xF6, 0x41, struct lttng_kernel_old_tracer_version)
-#define LTTNG_KERNEL_OLD_TRACEPOINT_LIST _IO(0xF6, 0x42)
-#define LTTNG_KERNEL_OLD_WAIT_QUIESCENT _IO(0xF6, 0x43)
-#define LTTNG_KERNEL_OLD_CALIBRATE \
- _IOWR(0xF6, 0x44, struct lttng_kernel_old_calibrate)
-
-/* Session FD ioctl */
-#define LTTNG_KERNEL_OLD_METADATA \
- _IOW(0xF6, 0x50, struct lttng_kernel_old_channel)
-#define LTTNG_KERNEL_OLD_CHANNEL \
- _IOW(0xF6, 0x51, struct lttng_kernel_old_channel)
-#define LTTNG_KERNEL_OLD_SESSION_START _IO(0xF6, 0x52)
-#define LTTNG_KERNEL_OLD_SESSION_STOP _IO(0xF6, 0x53)
-
-/* Channel FD ioctl */
-#define LTTNG_KERNEL_OLD_STREAM _IO(0xF6, 0x60)
-#define LTTNG_KERNEL_OLD_EVENT \
- _IOW(0xF6, 0x61, struct lttng_kernel_old_event)
-
-/* Event and Channel FD ioctl */
-#define LTTNG_KERNEL_OLD_CONTEXT \
- _IOW(0xF6, 0x70, struct lttng_kernel_old_context)
-
-/* Event, Channel and Session ioctl */
-#define LTTNG_KERNEL_OLD_ENABLE _IO(0xF6, 0x80)
-#define LTTNG_KERNEL_OLD_DISABLE _IO(0xF6, 0x81)
-
-#endif /* _LTTNG_ABI_OLD_H */
#include <wrapper/poll.h>
#include <wrapper/file.h>
#include <wrapper/kref.h>
-#include <lttng-string-utils.h>
-#include <lttng-abi.h>
-#include <lttng-abi-old.h>
-#include <lttng-events.h>
-#include <lttng-tracer.h>
-#include <lttng-tp-mempool.h>
+#include <lttng/string-utils.h>
+#include <lttng/abi.h>
+#include <lttng/abi-old.h>
+#include <lttng/events.h>
+#include <lttng/tracer.h>
+#include <lttng/tp-mempool.h>
#include <ringbuffer/frontend_types.h>
/*
+++ /dev/null
-/* SPDX-License-Identifier: (GPL-2.0-only or LGPL-2.1-only)
- *
- * lttng-abi.h
- *
- * LTTng ABI header
- *
- * Copyright (C) 2010-2012 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- */
-
-#ifndef _LTTNG_ABI_H
-#define _LTTNG_ABI_H
-
-#include <linux/fs.h>
-
-/*
- * Major/minor version of ABI exposed to lttng tools. Major number
- * should be increased when an incompatible ABI change is done.
- */
-#define LTTNG_MODULES_ABI_MAJOR_VERSION 2
-#define LTTNG_MODULES_ABI_MINOR_VERSION 5
-
-#define LTTNG_KERNEL_SYM_NAME_LEN 256
-#define LTTNG_KERNEL_SESSION_NAME_LEN 256
-#define LTTNG_KERNEL_SESSION_CREATION_TIME_ISO8601_LEN 26
-
-enum lttng_kernel_instrumentation {
- LTTNG_KERNEL_TRACEPOINT = 0,
- LTTNG_KERNEL_KPROBE = 1,
- LTTNG_KERNEL_FUNCTION = 2,
- LTTNG_KERNEL_KRETPROBE = 3,
- LTTNG_KERNEL_NOOP = 4, /* not hooked */
- LTTNG_KERNEL_SYSCALL = 5,
- LTTNG_KERNEL_UPROBE = 6,
-};
-
-/*
- * LTTng consumer mode
- */
-enum lttng_kernel_output {
- LTTNG_KERNEL_SPLICE = 0,
- LTTNG_KERNEL_MMAP = 1,
-};
-
-/*
- * LTTng DebugFS ABI structures.
- */
-#define LTTNG_KERNEL_CHANNEL_PADDING LTTNG_KERNEL_SYM_NAME_LEN + 32
-struct lttng_kernel_channel {
- uint64_t subbuf_size; /* in bytes */
- uint64_t num_subbuf;
- unsigned int switch_timer_interval; /* usecs */
- unsigned int read_timer_interval; /* usecs */
- enum lttng_kernel_output output; /* splice, mmap */
- int overwrite; /* 1: overwrite, 0: discard */
- char padding[LTTNG_KERNEL_CHANNEL_PADDING];
-} __attribute__((packed));
-
-struct lttng_kernel_kretprobe {
- uint64_t addr;
-
- uint64_t offset;
- char symbol_name[LTTNG_KERNEL_SYM_NAME_LEN];
-} __attribute__((packed));
-
-/*
- * Either addr is used, or symbol_name and offset.
- */
-struct lttng_kernel_kprobe {
- uint64_t addr;
-
- uint64_t offset;
- char symbol_name[LTTNG_KERNEL_SYM_NAME_LEN];
-} __attribute__((packed));
-
-struct lttng_kernel_function_tracer {
- char symbol_name[LTTNG_KERNEL_SYM_NAME_LEN];
-} __attribute__((packed));
-
-struct lttng_kernel_uprobe {
- int fd;
-} __attribute__((packed));
-
-struct lttng_kernel_event_callsite_uprobe {
- uint64_t offset;
-} __attribute__((packed));
-
-struct lttng_kernel_event_callsite {
- union {
- struct lttng_kernel_event_callsite_uprobe uprobe;
- } u;
-} __attribute__((packed));
-
-/*
- * For syscall tracing, name = "*" means "enable all".
- */
-#define LTTNG_KERNEL_EVENT_PADDING1 16
-#define LTTNG_KERNEL_EVENT_PADDING2 LTTNG_KERNEL_SYM_NAME_LEN + 32
-struct lttng_kernel_event {
- char name[LTTNG_KERNEL_SYM_NAME_LEN]; /* event name */
- enum lttng_kernel_instrumentation instrumentation;
- char padding[LTTNG_KERNEL_EVENT_PADDING1];
-
- /* Per instrumentation type configuration */
- union {
- struct lttng_kernel_kretprobe kretprobe;
- struct lttng_kernel_kprobe kprobe;
- struct lttng_kernel_function_tracer ftrace;
- struct lttng_kernel_uprobe uprobe;
- char padding[LTTNG_KERNEL_EVENT_PADDING2];
- } u;
-} __attribute__((packed));
-
-struct lttng_kernel_tracer_version {
- uint32_t major;
- uint32_t minor;
- uint32_t patchlevel;
-} __attribute__((packed));
-
-struct lttng_kernel_tracer_abi_version {
- uint32_t major;
- uint32_t minor;
-} __attribute__((packed));
-
-struct lttng_kernel_session_name {
- char name[LTTNG_KERNEL_SESSION_NAME_LEN];
-} __attribute__((packed));
-
-struct lttng_kernel_session_creation_time {
- char iso8601[LTTNG_KERNEL_SESSION_CREATION_TIME_ISO8601_LEN];
-} __attribute__((packed));
-
-enum lttng_kernel_calibrate_type {
- LTTNG_KERNEL_CALIBRATE_KRETPROBE,
-};
-
-struct lttng_kernel_calibrate {
- enum lttng_kernel_calibrate_type type; /* type (input) */
-} __attribute__((packed));
-
-struct lttng_kernel_syscall_mask {
- uint32_t len; /* in bits */
- char mask[];
-} __attribute__((packed));
-
-enum lttng_kernel_context_type {
- LTTNG_KERNEL_CONTEXT_PID = 0,
- LTTNG_KERNEL_CONTEXT_PERF_COUNTER = 1,
- LTTNG_KERNEL_CONTEXT_PROCNAME = 2,
- LTTNG_KERNEL_CONTEXT_PRIO = 3,
- LTTNG_KERNEL_CONTEXT_NICE = 4,
- LTTNG_KERNEL_CONTEXT_VPID = 5,
- LTTNG_KERNEL_CONTEXT_TID = 6,
- LTTNG_KERNEL_CONTEXT_VTID = 7,
- LTTNG_KERNEL_CONTEXT_PPID = 8,
- LTTNG_KERNEL_CONTEXT_VPPID = 9,
- LTTNG_KERNEL_CONTEXT_HOSTNAME = 10,
- LTTNG_KERNEL_CONTEXT_CPU_ID = 11,
- LTTNG_KERNEL_CONTEXT_INTERRUPTIBLE = 12,
- LTTNG_KERNEL_CONTEXT_PREEMPTIBLE = 13,
- LTTNG_KERNEL_CONTEXT_NEED_RESCHEDULE = 14,
- LTTNG_KERNEL_CONTEXT_MIGRATABLE = 15,
- LTTNG_KERNEL_CONTEXT_CALLSTACK_KERNEL = 16,
- LTTNG_KERNEL_CONTEXT_CALLSTACK_USER = 17,
- LTTNG_KERNEL_CONTEXT_CGROUP_NS = 18,
- LTTNG_KERNEL_CONTEXT_IPC_NS = 19,
- LTTNG_KERNEL_CONTEXT_MNT_NS = 20,
- LTTNG_KERNEL_CONTEXT_NET_NS = 21,
- LTTNG_KERNEL_CONTEXT_PID_NS = 22,
- LTTNG_KERNEL_CONTEXT_USER_NS = 23,
- LTTNG_KERNEL_CONTEXT_UTS_NS = 24,
- LTTNG_KERNEL_CONTEXT_UID = 25,
- LTTNG_KERNEL_CONTEXT_EUID = 26,
- LTTNG_KERNEL_CONTEXT_SUID = 27,
- LTTNG_KERNEL_CONTEXT_GID = 28,
- LTTNG_KERNEL_CONTEXT_EGID = 29,
- LTTNG_KERNEL_CONTEXT_SGID = 30,
- LTTNG_KERNEL_CONTEXT_VUID = 31,
- LTTNG_KERNEL_CONTEXT_VEUID = 32,
- LTTNG_KERNEL_CONTEXT_VSUID = 33,
- LTTNG_KERNEL_CONTEXT_VGID = 34,
- LTTNG_KERNEL_CONTEXT_VEGID = 35,
- LTTNG_KERNEL_CONTEXT_VSGID = 36,
-};
-
-struct lttng_kernel_perf_counter_ctx {
- uint32_t type;
- uint64_t config;
- char name[LTTNG_KERNEL_SYM_NAME_LEN];
-} __attribute__((packed));
-
-#define LTTNG_KERNEL_CONTEXT_PADDING1 16
-#define LTTNG_KERNEL_CONTEXT_PADDING2 LTTNG_KERNEL_SYM_NAME_LEN + 32
-struct lttng_kernel_context {
- enum lttng_kernel_context_type ctx;
- char padding[LTTNG_KERNEL_CONTEXT_PADDING1];
-
- union {
- struct lttng_kernel_perf_counter_ctx perf_counter;
- char padding[LTTNG_KERNEL_CONTEXT_PADDING2];
- } u;
-} __attribute__((packed));
-
-#define LTTNG_KERNEL_FILTER_BYTECODE_MAX_LEN 65536
-struct lttng_kernel_filter_bytecode {
- uint32_t len;
- uint32_t reloc_offset;
- uint64_t seqnum;
- char data[0];
-} __attribute__((packed));
-
-enum lttng_kernel_tracker_type {
- LTTNG_KERNEL_TRACKER_UNKNOWN = -1,
-
- LTTNG_KERNEL_TRACKER_PID = 0,
- LTTNG_KERNEL_TRACKER_VPID = 1,
- LTTNG_KERNEL_TRACKER_UID = 2,
- LTTNG_KERNEL_TRACKER_VUID = 3,
- LTTNG_KERNEL_TRACKER_GID = 4,
- LTTNG_KERNEL_TRACKER_VGID = 5,
-};
-
-struct lttng_kernel_tracker_args {
- enum lttng_kernel_tracker_type type;
- int32_t id;
-};
-
-/* LTTng file descriptor ioctl */
-/* lttng-abi-old.h reserve 0x40, 0x41, 0x42, 0x43, and 0x44. */
-#define LTTNG_KERNEL_SESSION _IO(0xF6, 0x45)
-#define LTTNG_KERNEL_TRACER_VERSION \
- _IOR(0xF6, 0x46, struct lttng_kernel_tracer_version)
-#define LTTNG_KERNEL_TRACEPOINT_LIST _IO(0xF6, 0x47)
-#define LTTNG_KERNEL_WAIT_QUIESCENT _IO(0xF6, 0x48)
-#define LTTNG_KERNEL_CALIBRATE \
- _IOWR(0xF6, 0x49, struct lttng_kernel_calibrate)
-#define LTTNG_KERNEL_SYSCALL_LIST _IO(0xF6, 0x4A)
-#define LTTNG_KERNEL_TRACER_ABI_VERSION \
- _IOR(0xF6, 0x4B, struct lttng_kernel_tracer_abi_version)
-
-/* Session FD ioctl */
-/* lttng-abi-old.h reserve 0x50, 0x51, 0x52, and 0x53. */
-#define LTTNG_KERNEL_METADATA \
- _IOW(0xF6, 0x54, struct lttng_kernel_channel)
-#define LTTNG_KERNEL_CHANNEL \
- _IOW(0xF6, 0x55, struct lttng_kernel_channel)
-#define LTTNG_KERNEL_SESSION_START _IO(0xF6, 0x56)
-#define LTTNG_KERNEL_SESSION_STOP _IO(0xF6, 0x57)
-#define LTTNG_KERNEL_SESSION_TRACK_PID \
- _IOR(0xF6, 0x58, int32_t)
-#define LTTNG_KERNEL_SESSION_UNTRACK_PID \
- _IOR(0xF6, 0x59, int32_t)
-
-/*
- * ioctl 0x58 and 0x59 are duplicated here. It works, since _IOR vs _IO
- * are generating two different ioctl numbers, but this was not done on
- * purpose. We should generally try to avoid those duplications.
- */
-#define LTTNG_KERNEL_SESSION_LIST_TRACKER_PIDS _IO(0xF6, 0x58)
-#define LTTNG_KERNEL_SESSION_METADATA_REGEN _IO(0xF6, 0x59)
-
-/* lttng-abi-old.h reserve 0x5A and 0x5B. */
-#define LTTNG_KERNEL_SESSION_STATEDUMP _IO(0xF6, 0x5C)
-#define LTTNG_KERNEL_SESSION_SET_NAME \
- _IOR(0xF6, 0x5D, struct lttng_kernel_session_name)
-#define LTTNG_KERNEL_SESSION_SET_CREATION_TIME \
- _IOR(0xF6, 0x5E, struct lttng_kernel_session_creation_time)
-
-/* Channel FD ioctl */
-/* lttng-abi-old.h reserve 0x60 and 0x61. */
-#define LTTNG_KERNEL_STREAM _IO(0xF6, 0x62)
-#define LTTNG_KERNEL_EVENT \
- _IOW(0xF6, 0x63, struct lttng_kernel_event)
-#define LTTNG_KERNEL_SYSCALL_MASK \
- _IOWR(0xF6, 0x64, struct lttng_kernel_syscall_mask)
-
-/* Event and Channel FD ioctl */
-/* lttng-abi-old.h reserve 0x70. */
-#define LTTNG_KERNEL_CONTEXT \
- _IOW(0xF6, 0x71, struct lttng_kernel_context)
-
-/* Event, Channel and Session ioctl */
-/* lttng-abi-old.h reserve 0x80 and 0x81. */
-#define LTTNG_KERNEL_ENABLE _IO(0xF6, 0x82)
-#define LTTNG_KERNEL_DISABLE _IO(0xF6, 0x83)
-
-/* Event FD ioctl */
-#define LTTNG_KERNEL_FILTER _IO(0xF6, 0x90)
-#define LTTNG_KERNEL_ADD_CALLSITE _IO(0xF6, 0x91)
-
-/* Session FD ioctl (continued) */
-#define LTTNG_KERNEL_SESSION_LIST_TRACKER_IDS \
- _IOR(0xF6, 0xA0, struct lttng_kernel_tracker_args)
-#define LTTNG_KERNEL_SESSION_TRACK_ID \
- _IOR(0xF6, 0xA1, struct lttng_kernel_tracker_args)
-#define LTTNG_KERNEL_SESSION_UNTRACK_ID \
- _IOR(0xF6, 0xA2, struct lttng_kernel_tracker_args)
-
-/*
- * LTTng-specific ioctls for the lib ringbuffer.
- *
- * Operations applying to the current sub-buffer need to occur between
- * a get/put or get_next/put_next ioctl pair.
- */
-
-/* returns the timestamp begin of the current sub-buffer */
-#define LTTNG_RING_BUFFER_GET_TIMESTAMP_BEGIN _IOR(0xF6, 0x20, uint64_t)
-/* returns the timestamp end of the current sub-buffer */
-#define LTTNG_RING_BUFFER_GET_TIMESTAMP_END _IOR(0xF6, 0x21, uint64_t)
-/* returns the number of events discarded of the current sub-buffer */
-#define LTTNG_RING_BUFFER_GET_EVENTS_DISCARDED _IOR(0xF6, 0x22, uint64_t)
-/* returns the packet payload size of the current sub-buffer */
-#define LTTNG_RING_BUFFER_GET_CONTENT_SIZE _IOR(0xF6, 0x23, uint64_t)
-/* returns the packet size of the current sub-buffer*/
-#define LTTNG_RING_BUFFER_GET_PACKET_SIZE _IOR(0xF6, 0x24, uint64_t)
-/* returns the stream id (invariant for the stream) */
-#define LTTNG_RING_BUFFER_GET_STREAM_ID _IOR(0xF6, 0x25, uint64_t)
-/* returns the current timestamp as perceived from the tracer */
-#define LTTNG_RING_BUFFER_GET_CURRENT_TIMESTAMP _IOR(0xF6, 0x26, uint64_t)
-/* returns the packet sequence number of the current sub-buffer */
-#define LTTNG_RING_BUFFER_GET_SEQ_NUM _IOR(0xF6, 0x27, uint64_t)
-/* returns the stream instance id (invariant for the stream) */
-#define LTTNG_RING_BUFFER_INSTANCE_ID _IOR(0xF6, 0x28, uint64_t)
-
-#ifdef CONFIG_COMPAT
-/* returns the timestamp begin of the current sub-buffer */
-#define LTTNG_RING_BUFFER_COMPAT_GET_TIMESTAMP_BEGIN \
- LTTNG_RING_BUFFER_GET_TIMESTAMP_BEGIN
-/* returns the timestamp end of the current sub-buffer */
-#define LTTNG_RING_BUFFER_COMPAT_GET_TIMESTAMP_END \
- LTTNG_RING_BUFFER_GET_TIMESTAMP_END
-/* returns the number of events discarded of the current sub-buffer */
-#define LTTNG_RING_BUFFER_COMPAT_GET_EVENTS_DISCARDED \
- LTTNG_RING_BUFFER_GET_EVENTS_DISCARDED
-/* returns the packet payload size of the current sub-buffer */
-#define LTTNG_RING_BUFFER_COMPAT_GET_CONTENT_SIZE \
- LTTNG_RING_BUFFER_GET_CONTENT_SIZE
-/* returns the packet size of the current sub-buffer */
-#define LTTNG_RING_BUFFER_COMPAT_GET_PACKET_SIZE \
- LTTNG_RING_BUFFER_GET_PACKET_SIZE
-/* returns the stream id (invariant for the stream) */
-#define LTTNG_RING_BUFFER_COMPAT_GET_STREAM_ID \
- LTTNG_RING_BUFFER_GET_STREAM_ID
-/* returns the current timestamp as perceived from the tracer */
-#define LTTNG_RING_BUFFER_COMPAT_GET_CURRENT_TIMESTAMP \
- LTTNG_RING_BUFFER_GET_CURRENT_TIMESTAMP
-/* returns the packet sequence number of the current sub-buffer */
-#define LTTNG_RING_BUFFER_COMPAT_GET_SEQ_NUM \
- LTTNG_RING_BUFFER_GET_SEQ_NUM
-/* returns the stream instance id (invariant for the stream) */
-#define LTTNG_RING_BUFFER_COMPAT_INSTANCE_ID \
- LTTNG_RING_BUFFER_INSTANCE_ID
-#endif /* CONFIG_COMPAT */
-
-#endif /* _LTTNG_ABI_H */
* Copyright (C) 2010-2012 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
*/
-#include <lttng-abi.h>
-#include <lttng-events.h>
+#include <lttng/abi.h>
+#include <lttng/events.h>
noinline
void lttng_calibrate_kretprobe(void)
#include <linux/mutex.h>
#include <wrapper/trace-clock.h>
-#include <lttng-events.h>
-#include <lttng-tracer.h>
+#include <lttng/events.h>
+#include <lttng/tracer.h>
struct lttng_trace_clock *lttng_trace_clock;
EXPORT_SYMBOL_GPL(lttng_trace_clock);
+++ /dev/null
-/* SPDX-License-Identifier: (GPL-2.0-only or LGPL-2.1-only)
- *
- * lttng-clock.h
- *
- * Copyright (C) 2014 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- */
-
-#ifndef _LTTNG_CLOCK_H
-#define _LTTNG_CLOCK_H
-
-#include <linux/module.h>
-
-#define LTTNG_MODULES_UUID_STR_LEN 37
-
-struct lttng_trace_clock {
- u64 (*read64)(void);
- u64 (*freq)(void);
- int (*uuid)(char *uuid);
- const char *(*name)(void);
- const char *(*description)(void);
-};
-
-int lttng_clock_register_plugin(struct lttng_trace_clock *ltc,
- struct module *mod);
-void lttng_clock_unregister_plugin(struct lttng_trace_clock *ltc,
- struct module *mod);
-
-#endif /* _LTTNG_TRACE_CLOCK_H */
#include <linux/utsname.h>
#include <linux/stacktrace.h>
#include <linux/spinlock.h>
-#include "lttng-events.h"
#include <ringbuffer/backend.h>
#include <ringbuffer/frontend.h>
+#include <lttng/events.h>
+#include <lttng/tracer.h>
+#include <lttng/endian.h>
#include "wrapper/vmalloc.h"
-#include "lttng-tracer.h"
-#include "lttng-endian.h"
#ifdef CONFIG_ARCH_STACKWALK
#include "lttng-context-callstack-stackwalk-impl.h"
#include <linux/slab.h>
#include <linux/sched.h>
#include <linux/cgroup.h>
-#include <lttng-events.h>
+#include <lttng/events.h>
#include <ringbuffer/frontend_types.h>
#include <wrapper/vmalloc.h>
#include <wrapper/namespace.h>
-#include <lttng-tracer.h>
+#include <lttng/tracer.h>
#if defined(CONFIG_CGROUPS) && \
((LINUX_VERSION_CODE >= KERNEL_VERSION(4,6,0)) || \
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/sched.h>
-#include <lttng-events.h>
+#include <lttng/events.h>
#include <ringbuffer/frontend_types.h>
#include <wrapper/vmalloc.h>
-#include <lttng-tracer.h>
+#include <lttng/tracer.h>
static
size_t cpu_id_get_size(size_t offset)
#include <linux/module.h>
#include <linux/sched.h>
-#include <lttng-events.h>
-#include <lttng-tracer.h>
+#include <lttng/events.h>
+#include <lttng/tracer.h>
#include <ringbuffer/frontend_types.h>
#include <wrapper/vmalloc.h>
#include <wrapper/user_namespace.h>
#include <linux/module.h>
#include <linux/sched.h>
-#include <lttng-events.h>
-#include <lttng-tracer.h>
+#include <lttng/events.h>
+#include <lttng/tracer.h>
#include <ringbuffer/frontend_types.h>
#include <wrapper/vmalloc.h>
#include <wrapper/user_namespace.h>
#include <linux/module.h>
#include <linux/sched.h>
-#include <lttng-events.h>
-#include <lttng-tracer.h>
+#include <lttng/events.h>
+#include <lttng/tracer.h>
#include <ringbuffer/frontend_types.h>
#include <wrapper/vmalloc.h>
#include <wrapper/user_namespace.h>
#include <linux/slab.h>
#include <linux/sched.h>
#include <linux/utsname.h>
-#include <lttng-events.h>
+#include <lttng/events.h>
#include <ringbuffer/frontend_types.h>
#include <wrapper/vmalloc.h>
-#include <lttng-tracer.h>
+#include <lttng/tracer.h>
#define LTTNG_HOSTNAME_CTX_LEN (__NEW_UTS_LEN + 1)
#include <linux/slab.h>
#include <linux/sched.h>
#include <linux/irqflags.h>
-#include <lttng-events.h>
+#include <lttng/events.h>
#include <ringbuffer/frontend_types.h>
#include <wrapper/vmalloc.h>
-#include <lttng-tracer.h>
+#include <lttng/tracer.h>
/*
* Interruptible at value -1 means "unknown".
#include <linux/slab.h>
#include <linux/sched.h>
#include <linux/ipc_namespace.h>
-#include <lttng-events.h>
+#include <lttng/events.h>
#include <ringbuffer/frontend_types.h>
#include <wrapper/vmalloc.h>
#include <wrapper/namespace.h>
-#include <lttng-tracer.h>
+#include <lttng/tracer.h>
#if defined(CONFIG_IPC_NS) && \
(LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0))
#include <linux/slab.h>
#include <linux/sched.h>
#include <linux/irqflags.h>
-#include <lttng-events.h>
+#include <lttng/events.h>
#include <ringbuffer/frontend_types.h>
#include <wrapper/vmalloc.h>
-#include <lttng-tracer.h>
+#include <lttng/tracer.h>
static
size_t migratable_get_size(size_t offset)
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/sched.h>
-#include <lttng-events.h>
+#include <lttng/events.h>
#include <linux/nsproxy.h>
#include <ringbuffer/frontend_types.h>
#include <wrapper/vmalloc.h>
#include <wrapper/namespace.h>
-#include <lttng-tracer.h>
+#include <lttng/tracer.h>
#if !defined(LTTNG_MNT_NS_MISSING_HEADER) && \
(LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0))
#include <linux/slab.h>
#include <linux/sched.h>
#include <linux/irqflags.h>
-#include <lttng-events.h>
+#include <lttng/events.h>
#include <ringbuffer/frontend_types.h>
#include <wrapper/vmalloc.h>
-#include <lttng-tracer.h>
+#include <lttng/tracer.h>
static
size_t need_reschedule_get_size(size_t offset)
#include <linux/sched.h>
#include <linux/nsproxy.h>
#include <net/net_namespace.h>
-#include <lttng-events.h>
+#include <lttng/events.h>
#include <ringbuffer/frontend_types.h>
#include <wrapper/vmalloc.h>
#include <wrapper/namespace.h>
-#include <lttng-tracer.h>
+#include <lttng/tracer.h>
#if defined(CONFIG_NET_NS) && \
(LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0))
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/sched.h>
-#include <lttng-events.h>
+#include <lttng/events.h>
#include <ringbuffer/frontend_types.h>
#include <wrapper/vmalloc.h>
-#include <lttng-tracer.h>
+#include <lttng/tracer.h>
static
size_t nice_get_size(size_t offset)
#include <linux/list.h>
#include <linux/string.h>
#include <linux/cpu.h>
-#include <lttng-events.h>
+#include <lttng/events.h>
#include <ringbuffer/frontend_types.h>
#include <wrapper/vmalloc.h>
#include <wrapper/perf.h>
-#include <lttng-tracer.h>
+#include <lttng/tracer.h>
static
size_t perf_counter_get_size(size_t offset)
#include <linux/slab.h>
#include <linux/sched.h>
#include <linux/pid_namespace.h>
-#include <lttng-events.h>
+#include <lttng/events.h>
#include <ringbuffer/frontend_types.h>
#include <wrapper/vmalloc.h>
#include <wrapper/namespace.h>
-#include <lttng-tracer.h>
+#include <lttng/tracer.h>
#if defined(CONFIG_PID_NS) && \
(LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0))
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/sched.h>
-#include <lttng-events.h>
+#include <lttng/events.h>
#include <ringbuffer/frontend_types.h>
#include <wrapper/vmalloc.h>
-#include <lttng-tracer.h>
+#include <lttng/tracer.h>
static
size_t pid_get_size(size_t offset)
#include <linux/slab.h>
#include <linux/sched.h>
#include <linux/syscalls.h>
-#include <lttng-events.h>
+#include <lttng/events.h>
#include <ringbuffer/frontend_types.h>
#include <wrapper/vmalloc.h>
-#include <lttng-tracer.h>
+#include <lttng/tracer.h>
static
size_t ppid_get_size(size_t offset)
#include <linux/slab.h>
#include <linux/sched.h>
#include <linux/irqflags.h>
-#include <lttng-events.h>
+#include <lttng/events.h>
#include <ringbuffer/frontend_types.h>
#include <wrapper/vmalloc.h>
-#include <lttng-tracer.h>
+#include <lttng/tracer.h>
/*
* We nest twice in preempt disabling within LTTng: one nesting is done
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/sched.h>
-#include <lttng-events.h>
+#include <lttng/events.h>
#include <ringbuffer/frontend_types.h>
#include <wrapper/vmalloc.h>
#include <wrapper/kallsyms.h>
-#include <lttng-tracer.h>
+#include <lttng/tracer.h>
static
int (*wrapper_task_prio_sym)(struct task_struct *t);
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/sched.h>
-#include <lttng-events.h>
+#include <lttng/events.h>
#include <ringbuffer/frontend_types.h>
#include <wrapper/vmalloc.h>
-#include <lttng-tracer.h>
-#include <lttng-endian.h>
+#include <lttng/tracer.h>
+#include <lttng/endian.h>
static
size_t procname_get_size(size_t offset)
#include <linux/module.h>
#include <linux/sched.h>
-#include <lttng-events.h>
-#include <lttng-tracer.h>
+#include <lttng/events.h>
+#include <lttng/tracer.h>
#include <ringbuffer/frontend_types.h>
#include <wrapper/vmalloc.h>
#include <wrapper/user_namespace.h>
#include <linux/module.h>
#include <linux/sched.h>
-#include <lttng-events.h>
-#include <lttng-tracer.h>
+#include <lttng/events.h>
+#include <lttng/tracer.h>
#include <ringbuffer/frontend_types.h>
#include <wrapper/vmalloc.h>
#include <wrapper/user_namespace.h>
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/sched.h>
-#include <lttng-events.h>
+#include <lttng/events.h>
#include <ringbuffer/frontend_types.h>
#include <wrapper/vmalloc.h>
-#include <lttng-tracer.h>
+#include <lttng/tracer.h>
static
size_t tid_get_size(size_t offset)
#include <linux/module.h>
#include <linux/sched.h>
-#include <lttng-events.h>
-#include <lttng-tracer.h>
+#include <lttng/events.h>
+#include <lttng/tracer.h>
#include <ringbuffer/frontend_types.h>
#include <wrapper/vmalloc.h>
#include <wrapper/user_namespace.h>
#include <linux/slab.h>
#include <linux/sched.h>
#include <linux/user_namespace.h>
-#include <lttng-events.h>
+#include <lttng/events.h>
#include <ringbuffer/frontend_types.h>
#include <wrapper/vmalloc.h>
#include <wrapper/namespace.h>
-#include <lttng-tracer.h>
+#include <lttng/tracer.h>
#if defined(CONFIG_USER_NS) && \
(LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0))
#include <linux/slab.h>
#include <linux/sched.h>
#include <linux/utsname.h>
-#include <lttng-events.h>
+#include <lttng/events.h>
#include <ringbuffer/frontend_types.h>
#include <wrapper/vmalloc.h>
#include <wrapper/namespace.h>
-#include <lttng-tracer.h>
+#include <lttng/tracer.h>
#if defined(CONFIG_UTS_NS) && \
(LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0))
#include <linux/module.h>
#include <linux/sched.h>
-#include <lttng-events.h>
-#include <lttng-tracer.h>
+#include <lttng/events.h>
+#include <lttng/tracer.h>
#include <ringbuffer/frontend_types.h>
#include <wrapper/vmalloc.h>
#include <wrapper/user_namespace.h>
#include <linux/module.h>
#include <linux/sched.h>
-#include <lttng-events.h>
-#include <lttng-tracer.h>
+#include <lttng/events.h>
+#include <lttng/tracer.h>
#include <ringbuffer/frontend_types.h>
#include <wrapper/vmalloc.h>
#include <wrapper/user_namespace.h>
#include <linux/module.h>
#include <linux/sched.h>
-#include <lttng-events.h>
-#include <lttng-tracer.h>
+#include <lttng/events.h>
+#include <lttng/tracer.h>
#include <ringbuffer/frontend_types.h>
#include <wrapper/vmalloc.h>
#include <wrapper/user_namespace.h>
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/sched.h>
-#include <lttng-events.h>
+#include <lttng/events.h>
#include <ringbuffer/frontend_types.h>
#include <wrapper/vmalloc.h>
-#include <lttng-tracer.h>
+#include <lttng/tracer.h>
static
size_t vpid_get_size(size_t offset)
#include <linux/slab.h>
#include <linux/sched.h>
#include <linux/syscalls.h>
-#include <lttng-events.h>
+#include <lttng/events.h>
#include <ringbuffer/frontend_types.h>
#include <wrapper/vmalloc.h>
-#include <lttng-tracer.h>
+#include <lttng/tracer.h>
static
size_t vppid_get_size(size_t offset)
#include <linux/module.h>
#include <linux/sched.h>
-#include <lttng-events.h>
-#include <lttng-tracer.h>
+#include <lttng/events.h>
+#include <lttng/tracer.h>
#include <ringbuffer/frontend_types.h>
#include <wrapper/vmalloc.h>
#include <wrapper/user_namespace.h>
#include <linux/module.h>
#include <linux/sched.h>
-#include <lttng-events.h>
-#include <lttng-tracer.h>
+#include <lttng/events.h>
+#include <lttng/tracer.h>
#include <ringbuffer/frontend_types.h>
#include <wrapper/vmalloc.h>
#include <wrapper/user_namespace.h>
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/sched.h>
-#include <lttng-events.h>
+#include <lttng/events.h>
#include <ringbuffer/frontend_types.h>
#include <wrapper/vmalloc.h>
-#include <lttng-tracer.h>
+#include <lttng/tracer.h>
static
size_t vtid_get_size(size_t offset)
#include <linux/module.h>
#include <linux/sched.h>
-#include <lttng-events.h>
-#include <lttng-tracer.h>
+#include <lttng/events.h>
+#include <lttng/tracer.h>
#include <ringbuffer/frontend_types.h>
#include <wrapper/vmalloc.h>
#include <wrapper/user_namespace.h>
#include <linux/mutex.h>
#include <linux/slab.h>
#include <wrapper/vmalloc.h> /* for wrapper_vmalloc_sync_mappings() */
-#include <lttng-events.h>
-#include <lttng-tracer.h>
+#include <lttng/events.h>
+#include <lttng/tracer.h>
/*
* The filter implementation requires that two consecutive "get" for the
+++ /dev/null
-/* SPDX-License-Identifier: (GPL-2.0-only or LGPL-2.1-only)
- *
- * lttng-cpuhotplug.h
- *
- * Copyright (C) 2016 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- */
-
-#ifndef LTTNG_CPUHOTPLUG_H
-#define LTTNG_CPUHOTPLUG_H
-
-struct lttng_cpuhp_node;
-
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,10,0))
-
-#include <linux/cpuhotplug.h>
-
-enum lttng_cpuhp_component {
- LTTNG_RING_BUFFER_FRONTEND,
- LTTNG_RING_BUFFER_BACKEND,
- LTTNG_RING_BUFFER_ITER,
- LTTNG_CONTEXT_PERF_COUNTERS,
-};
-
-struct lttng_cpuhp_node {
- enum lttng_cpuhp_component component;
- struct hlist_node node;
-};
-
-extern enum cpuhp_state lttng_hp_prepare;
-extern enum cpuhp_state lttng_hp_online;
-
-int lttng_cpuhp_rb_backend_prepare(unsigned int cpu,
- struct lttng_cpuhp_node *node);
-int lttng_cpuhp_rb_frontend_dead(unsigned int cpu,
- struct lttng_cpuhp_node *node);
-int lttng_cpuhp_rb_frontend_online(unsigned int cpu,
- struct lttng_cpuhp_node *node);
-int lttng_cpuhp_rb_frontend_offline(unsigned int cpu,
- struct lttng_cpuhp_node *node);
-int lttng_cpuhp_rb_iter_online(unsigned int cpu,
- struct lttng_cpuhp_node *node);
-
-/* Ring buffer is a separate library. */
-void lttng_rb_set_hp_prepare(enum cpuhp_state val);
-void lttng_rb_set_hp_online(enum cpuhp_state val);
-
-extern enum cpuhp_state lttng_rb_hp_prepare;
-extern enum cpuhp_state lttng_rb_hp_online;
-
-#endif
-
-#endif /* LTTNG_CPUHOTPLUG_H */
+++ /dev/null
-/* SPDX-License-Identifier: (GPL-2.0-only or LGPL-2.1-only) */
-#ifndef _LTTNG_ENDIAN_H
-#define _LTTNG_ENDIAN_H
-
-/*
- * lttng-endian.h
- *
- * Copyright (C) 2010-2012 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- */
-
-#ifdef __KERNEL__
-# include <asm/byteorder.h>
-# ifdef __BIG_ENDIAN
-# define __BYTE_ORDER __BIG_ENDIAN
-# elif defined(__LITTLE_ENDIAN)
-# define __BYTE_ORDER __LITTLE_ENDIAN
-# else
-# error "unknown endianness"
-# endif
-#ifndef __BIG_ENDIAN
-# define __BIG_ENDIAN 4321
-#endif
-#ifndef __LITTLE_ENDIAN
-# define __LITTLE_ENDIAN 1234
-#endif
-#else
-# include <endian.h>
-#endif
-
-#endif /* _LTTNG_ENDIAN_H */
#include <wrapper/tracepoint.h>
#include <wrapper/list.h>
#include <wrapper/types.h>
-#include <lttng-kernel-version.h>
-#include <lttng-events.h>
-#include <lttng-tracer.h>
-#include <lttng-abi-old.h>
-#include <lttng-endian.h>
-#include <lttng-string-utils.h>
+#include <lttng/kernel-version.h>
+#include <lttng/events.h>
+#include <lttng/tracer.h>
+#include <lttng/abi-old.h>
+#include <lttng/endian.h>
+#include <lttng/string-utils.h>
#include <ringbuffer/backend.h>
#include <ringbuffer/frontend.h>
#include <wrapper/time.h>
+++ /dev/null
-/* SPDX-License-Identifier: (GPL-2.0-only or LGPL-2.1-only)
- *
- * lttng-events.h
- *
- * Holds LTTng per-session event registry.
- *
- * Copyright (C) 2010-2012 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- */
-
-#ifndef _LTTNG_EVENTS_H
-#define _LTTNG_EVENTS_H
-
-#include <linux/version.h>
-#include <linux/list.h>
-#include <linux/kprobes.h>
-#include <linux/kref.h>
-#include <lttng-cpuhotplug.h>
-#include <linux/uuid.h>
-#include <wrapper/uprobes.h>
-#include <lttng-tracer.h>
-#include <lttng-abi.h>
-#include <lttng-abi-old.h>
-#include <lttng-endian.h>
-
-#define lttng_is_signed_type(type) (((type)(-1)) < 0)
-
-struct lttng_channel;
-struct lttng_session;
-struct lttng_metadata_cache;
-struct lib_ring_buffer_ctx;
-struct perf_event;
-struct perf_event_attr;
-struct lib_ring_buffer_config;
-
-/* Type description */
-
-enum abstract_types {
- atype_integer,
- atype_string,
- atype_enum_nestable,
- atype_array_nestable,
- atype_sequence_nestable,
- atype_struct_nestable,
- atype_variant_nestable,
- NR_ABSTRACT_TYPES,
-};
-
-enum lttng_string_encodings {
- lttng_encode_none = 0,
- lttng_encode_UTF8 = 1,
- lttng_encode_ASCII = 2,
- NR_STRING_ENCODINGS,
-};
-
-enum channel_type {
- PER_CPU_CHANNEL,
- METADATA_CHANNEL,
-};
-
-struct lttng_enum_value {
- unsigned long long value;
- unsigned int signedness:1;
-};
-
-struct lttng_enum_entry {
- struct lttng_enum_value start, end; /* start and end are inclusive */
- const char *string;
- struct {
- unsigned int is_auto:1;
- } options;
-};
-
-#define __type_integer(_type, _size, _alignment, _signedness, \
- _byte_order, _base, _encoding) \
- { \
- .atype = atype_integer, \
- .u.integer = \
- { \
- .size = (_size) ? : sizeof(_type) * CHAR_BIT, \
- .alignment = (_alignment) ? : lttng_alignof(_type) * CHAR_BIT, \
- .signedness = (_signedness) >= 0 ? (_signedness) : lttng_is_signed_type(_type), \
- .reverse_byte_order = _byte_order != __BYTE_ORDER, \
- .base = _base, \
- .encoding = lttng_encode_##_encoding, \
- }, \
- } \
-
-struct lttng_integer_type {
- unsigned int size; /* in bits */
- unsigned short alignment; /* in bits */
- unsigned int signedness:1,
- reverse_byte_order:1;
- unsigned int base; /* 2, 8, 10, 16, for pretty print */
- enum lttng_string_encodings encoding;
-};
-
-struct lttng_type {
- enum abstract_types atype;
- union {
- struct lttng_integer_type integer;
- struct {
- enum lttng_string_encodings encoding;
- } string;
- struct {
- const struct lttng_enum_desc *desc; /* Enumeration mapping */
- const struct lttng_type *container_type;
- } enum_nestable;
- struct {
- const struct lttng_type *elem_type;
- unsigned int length; /* Num. elems. */
- unsigned int alignment;
- } array_nestable;
- struct {
- const char *length_name; /* Length field name. */
- const struct lttng_type *elem_type;
- unsigned int alignment; /* Alignment before elements. */
- } sequence_nestable;
- struct {
- unsigned int nr_fields;
- const struct lttng_event_field *fields; /* Array of fields. */
- unsigned int alignment;
- } struct_nestable;
- struct {
- const char *tag_name;
- const struct lttng_event_field *choices; /* Array of fields. */
- unsigned int nr_choices;
- unsigned int alignment;
- } variant_nestable;
- } u;
-};
-
-struct lttng_enum_desc {
- const char *name;
- const struct lttng_enum_entry *entries;
- unsigned int nr_entries;
-};
-
-/* Event field description */
-
-struct lttng_event_field {
- const char *name;
- struct lttng_type type;
- unsigned int nowrite:1, /* do not write into trace */
- user:1, /* fetch from user-space */
- nofilter:1; /* do not consider for filter */
-};
-
-union lttng_ctx_value {
- int64_t s64;
- const char *str;
- double d;
-};
-
-/*
- * We need to keep this perf counter field separately from struct
- * lttng_ctx_field because cpu hotplug needs fixed-location addresses.
- */
-struct lttng_perf_counter_field {
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,10,0))
- struct lttng_cpuhp_node cpuhp_prepare;
- struct lttng_cpuhp_node cpuhp_online;
-#else
- struct notifier_block nb;
- int hp_enable;
-#endif
- struct perf_event_attr *attr;
- struct perf_event **e; /* per-cpu array */
-};
-
-struct lttng_probe_ctx {
- struct lttng_event *event;
- uint8_t interruptible;
-};
-
-struct lttng_ctx_field {
- struct lttng_event_field event_field;
- size_t (*get_size)(size_t offset);
- size_t (*get_size_arg)(size_t offset, struct lttng_ctx_field *field,
- struct lib_ring_buffer_ctx *ctx,
- struct lttng_channel *chan);
- void (*record)(struct lttng_ctx_field *field,
- struct lib_ring_buffer_ctx *ctx,
- struct lttng_channel *chan);
- void (*get_value)(struct lttng_ctx_field *field,
- struct lttng_probe_ctx *lttng_probe_ctx,
- union lttng_ctx_value *value);
- union {
- struct lttng_perf_counter_field *perf_counter;
- } u;
- void (*destroy)(struct lttng_ctx_field *field);
- /*
- * Private data to keep state between get_size and record.
- * User must perform its own synchronization to protect against
- * concurrent and reentrant contexts.
- */
- void *priv;
-};
-
-struct lttng_ctx {
- struct lttng_ctx_field *fields;
- unsigned int nr_fields;
- unsigned int allocated_fields;
- size_t largest_align; /* in bytes */
-};
-
-struct lttng_event_desc {
- const char *name; /* lttng-modules name */
- const char *kname; /* Linux kernel name (tracepoints) */
- void *probe_callback;
- const struct lttng_event_ctx *ctx; /* context */
- const struct lttng_event_field *fields; /* event payload */
- unsigned int nr_fields;
- struct module *owner;
-};
-
-struct lttng_probe_desc {
- const char *provider;
- const struct lttng_event_desc **event_desc;
- unsigned int nr_events;
- struct list_head head; /* chain registered probes */
- struct list_head lazy_init_head;
- int lazy; /* lazy registration */
-};
-
-struct lttng_krp; /* Kretprobe handling */
-
-enum lttng_event_type {
- LTTNG_TYPE_EVENT = 0,
- LTTNG_TYPE_ENABLER = 1,
-};
-
-struct lttng_filter_bytecode_node {
- struct list_head node;
- struct lttng_enabler *enabler;
- /*
- * struct lttng_kernel_filter_bytecode has var. sized array, must be
- * last field.
- */
- struct lttng_kernel_filter_bytecode bc;
-};
-
-/*
- * Filter return value masks.
- */
-enum lttng_filter_ret {
- LTTNG_FILTER_DISCARD = 0,
- LTTNG_FILTER_RECORD_FLAG = (1ULL << 0),
- /* Other bits are kept for future use. */
-};
-
-struct lttng_bytecode_runtime {
- /* Associated bytecode */
- struct lttng_filter_bytecode_node *bc;
- uint64_t (*filter)(void *filter_data, struct lttng_probe_ctx *lttng_probe_ctx,
- const char *filter_stack_data);
- int link_failed;
- struct list_head node; /* list of bytecode runtime in event */
- struct lttng_event *event;
-};
-
-/*
- * Objects in a linked-list of enablers, owned by an event.
- */
-struct lttng_enabler_ref {
- struct list_head node; /* enabler ref list */
- struct lttng_enabler *ref; /* backward ref */
-};
-
-struct lttng_uprobe_handler {
- struct lttng_event *event;
- loff_t offset;
- struct uprobe_consumer up_consumer;
- struct list_head node;
-};
-
-/*
- * lttng_event structure is referred to by the tracing fast path. It must be
- * kept small.
- */
-struct lttng_event {
- enum lttng_event_type evtype; /* First field. */
- unsigned int id;
- struct lttng_channel *chan;
- int enabled;
- const struct lttng_event_desc *desc;
- void *filter;
- struct lttng_ctx *ctx;
- enum lttng_kernel_instrumentation instrumentation;
- union {
- struct {
- struct kprobe kp;
- char *symbol_name;
- } kprobe;
- struct {
- struct lttng_krp *lttng_krp;
- char *symbol_name;
- } kretprobe;
- struct {
- struct inode *inode;
- struct list_head head;
- } uprobe;
- } u;
- struct list_head list; /* Event list in session */
- unsigned int metadata_dumped:1;
-
- /* Backward references: list of lttng_enabler_ref (ref to enablers) */
- struct list_head enablers_ref_head;
- struct hlist_node hlist; /* session ht of events */
- int registered; /* has reg'd tracepoint probe */
- /* list of struct lttng_bytecode_runtime, sorted by seqnum */
- struct list_head bytecode_runtime_head;
- int has_enablers_without_bytecode;
-};
-
-enum lttng_enabler_type {
- LTTNG_ENABLER_STAR_GLOB,
- LTTNG_ENABLER_NAME,
-};
-
-/*
- * Enabler field, within whatever object is enabling an event. Target of
- * backward reference.
- */
-struct lttng_enabler {
- enum lttng_event_type evtype; /* First field. */
-
- enum lttng_enabler_type type;
-
- struct list_head node; /* per-session list of enablers */
- /* head list of struct lttng_ust_filter_bytecode_node */
- struct list_head filter_bytecode_head;
-
- struct lttng_kernel_event event_param;
- struct lttng_channel *chan;
- struct lttng_ctx *ctx;
- unsigned int enabled:1;
-};
-
-struct lttng_channel_ops {
- struct channel *(*channel_create)(const char *name,
- struct lttng_channel *lttng_chan,
- void *buf_addr,
- size_t subbuf_size, size_t num_subbuf,
- unsigned int switch_timer_interval,
- unsigned int read_timer_interval);
- void (*channel_destroy)(struct channel *chan);
- struct lib_ring_buffer *(*buffer_read_open)(struct channel *chan);
- int (*buffer_has_read_closed_stream)(struct channel *chan);
- void (*buffer_read_close)(struct lib_ring_buffer *buf);
- int (*event_reserve)(struct lib_ring_buffer_ctx *ctx,
- uint32_t event_id);
- void (*event_commit)(struct lib_ring_buffer_ctx *ctx);
- void (*event_write)(struct lib_ring_buffer_ctx *ctx, const void *src,
- size_t len);
- void (*event_write_from_user)(struct lib_ring_buffer_ctx *ctx,
- const void *src, size_t len);
- void (*event_memset)(struct lib_ring_buffer_ctx *ctx,
- int c, size_t len);
- void (*event_strcpy)(struct lib_ring_buffer_ctx *ctx, const char *src,
- size_t len);
- void (*event_strcpy_from_user)(struct lib_ring_buffer_ctx *ctx,
- const char __user *src, size_t len);
- /*
- * packet_avail_size returns the available size in the current
- * packet. Note that the size returned is only a hint, since it
- * may change due to concurrent writes.
- */
- size_t (*packet_avail_size)(struct channel *chan);
- wait_queue_head_t *(*get_writer_buf_wait_queue)(struct channel *chan, int cpu);
- wait_queue_head_t *(*get_hp_wait_queue)(struct channel *chan);
- int (*is_finalized)(struct channel *chan);
- int (*is_disabled)(struct channel *chan);
- int (*timestamp_begin) (const struct lib_ring_buffer_config *config,
- struct lib_ring_buffer *bufb,
- uint64_t *timestamp_begin);
- int (*timestamp_end) (const struct lib_ring_buffer_config *config,
- struct lib_ring_buffer *bufb,
- uint64_t *timestamp_end);
- int (*events_discarded) (const struct lib_ring_buffer_config *config,
- struct lib_ring_buffer *bufb,
- uint64_t *events_discarded);
- int (*content_size) (const struct lib_ring_buffer_config *config,
- struct lib_ring_buffer *bufb,
- uint64_t *content_size);
- int (*packet_size) (const struct lib_ring_buffer_config *config,
- struct lib_ring_buffer *bufb,
- uint64_t *packet_size);
- int (*stream_id) (const struct lib_ring_buffer_config *config,
- struct lib_ring_buffer *bufb,
- uint64_t *stream_id);
- int (*current_timestamp) (const struct lib_ring_buffer_config *config,
- struct lib_ring_buffer *bufb,
- uint64_t *ts);
- int (*sequence_number) (const struct lib_ring_buffer_config *config,
- struct lib_ring_buffer *bufb,
- uint64_t *seq);
- int (*instance_id) (const struct lib_ring_buffer_config *config,
- struct lib_ring_buffer *bufb,
- uint64_t *id);
-};
-
-struct lttng_transport {
- char *name;
- struct module *owner;
- struct list_head node;
- struct lttng_channel_ops ops;
-};
-
-struct lttng_syscall_filter;
-
-#define LTTNG_EVENT_HT_BITS 12
-#define LTTNG_EVENT_HT_SIZE (1U << LTTNG_EVENT_HT_BITS)
-
-struct lttng_event_ht {
- struct hlist_head table[LTTNG_EVENT_HT_SIZE];
-};
-
-struct lttng_channel {
- unsigned int id;
- struct channel *chan; /* Channel buffers */
- int enabled;
- struct lttng_ctx *ctx;
- /* Event ID management */
- struct lttng_session *session;
- struct file *file; /* File associated to channel */
- unsigned int free_event_id; /* Next event ID to allocate */
- struct list_head list; /* Channel list */
- struct lttng_channel_ops *ops;
- struct lttng_transport *transport;
- struct lttng_event **sc_table; /* for syscall tracing */
- struct lttng_event **compat_sc_table;
- struct lttng_event **sc_exit_table; /* for syscall exit tracing */
- struct lttng_event **compat_sc_exit_table;
- struct lttng_event *sc_unknown; /* for unknown syscalls */
- struct lttng_event *sc_compat_unknown;
- struct lttng_event *sc_exit_unknown;
- struct lttng_event *compat_sc_exit_unknown;
- struct lttng_syscall_filter *sc_filter;
- int header_type; /* 0: unset, 1: compact, 2: large */
- enum channel_type channel_type;
- unsigned int metadata_dumped:1,
- sys_enter_registered:1,
- sys_exit_registered:1,
- syscall_all:1,
- tstate:1; /* Transient enable state */
-};
-
-struct lttng_metadata_stream {
- void *priv; /* Ring buffer private data */
- struct lttng_metadata_cache *metadata_cache;
- unsigned int metadata_in; /* Bytes read from the cache */
- unsigned int metadata_out; /* Bytes consumed from stream */
- int finalized; /* Has channel been finalized */
- wait_queue_head_t read_wait; /* Reader buffer-level wait queue */
- struct list_head list; /* Stream list */
- struct lttng_transport *transport;
- uint64_t version; /* Current version of the metadata cache */
-};
-
-#define LTTNG_DYNAMIC_LEN_STACK_SIZE 128
-
-struct lttng_dynamic_len_stack {
- size_t stack[LTTNG_DYNAMIC_LEN_STACK_SIZE];
- size_t offset;
-};
-
-DECLARE_PER_CPU(struct lttng_dynamic_len_stack, lttng_dynamic_len_stack);
-
-/*
- * struct lttng_id_tracker declared in header due to deferencing of *v
- * in RCU_INITIALIZER(v).
- */
-#define LTTNG_ID_HASH_BITS 6
-#define LTTNG_ID_TABLE_SIZE (1 << LTTNG_ID_HASH_BITS)
-
-enum tracker_type {
- TRACKER_PID,
- TRACKER_VPID,
- TRACKER_UID,
- TRACKER_VUID,
- TRACKER_GID,
- TRACKER_VGID,
-
- TRACKER_UNKNOWN,
-};
-
-struct lttng_id_tracker_rcu {
- struct hlist_head id_hash[LTTNG_ID_TABLE_SIZE];
-};
-
-struct lttng_id_tracker {
- struct lttng_session *session;
- enum tracker_type tracker_type;
- struct lttng_id_tracker_rcu *p; /* RCU dereferenced. */
-};
-
-struct lttng_id_hash_node {
- struct hlist_node hlist;
- int id;
-};
-
-struct lttng_session {
- int active; /* Is trace session active ? */
- int been_active; /* Has trace session been active ? */
- struct file *file; /* File associated to session */
- struct list_head chan; /* Channel list head */
- struct list_head events; /* Event list head */
- struct list_head list; /* Session list */
- unsigned int free_chan_id; /* Next chan ID to allocate */
- uuid_le uuid; /* Trace session unique ID */
- struct lttng_metadata_cache *metadata_cache;
- struct lttng_id_tracker pid_tracker;
- struct lttng_id_tracker vpid_tracker;
- struct lttng_id_tracker uid_tracker;
- struct lttng_id_tracker vuid_tracker;
- struct lttng_id_tracker gid_tracker;
- struct lttng_id_tracker vgid_tracker;
- unsigned int metadata_dumped:1,
- tstate:1; /* Transient enable state */
- /* List of enablers */
- struct list_head enablers_head;
- /* Hash table of events */
- struct lttng_event_ht events_ht;
- char name[LTTNG_KERNEL_SESSION_NAME_LEN];
- char creation_time[LTTNG_KERNEL_SESSION_CREATION_TIME_ISO8601_LEN];
-};
-
-struct lttng_metadata_cache {
- char *data; /* Metadata cache */
- unsigned int cache_alloc; /* Metadata allocated size (bytes) */
- unsigned int metadata_written; /* Number of bytes written in metadata cache */
- struct kref refcount; /* Metadata cache usage */
- struct list_head metadata_stream; /* Metadata stream list */
- uuid_le uuid; /* Trace session unique ID (copy) */
- struct mutex lock; /* Produce/consume lock */
- uint64_t version; /* Current version of the metadata */
-};
-
-void lttng_lock_sessions(void);
-void lttng_unlock_sessions(void);
-
-struct list_head *lttng_get_probe_list_head(void);
-
-struct lttng_enabler *lttng_enabler_create(enum lttng_enabler_type type,
- struct lttng_kernel_event *event_param,
- struct lttng_channel *chan);
-
-int lttng_enabler_enable(struct lttng_enabler *enabler);
-int lttng_enabler_disable(struct lttng_enabler *enabler);
-int lttng_fix_pending_events(void);
-int lttng_session_active(void);
-
-struct lttng_session *lttng_session_create(void);
-int lttng_session_enable(struct lttng_session *session);
-int lttng_session_disable(struct lttng_session *session);
-void lttng_session_destroy(struct lttng_session *session);
-int lttng_session_metadata_regenerate(struct lttng_session *session);
-int lttng_session_statedump(struct lttng_session *session);
-void metadata_cache_destroy(struct kref *kref);
-
-struct lttng_channel *lttng_channel_create(struct lttng_session *session,
- const char *transport_name,
- void *buf_addr,
- size_t subbuf_size, size_t num_subbuf,
- unsigned int switch_timer_interval,
- unsigned int read_timer_interval,
- enum channel_type channel_type);
-struct lttng_channel *lttng_global_channel_create(struct lttng_session *session,
- int overwrite, void *buf_addr,
- size_t subbuf_size, size_t num_subbuf,
- unsigned int switch_timer_interval,
- unsigned int read_timer_interval);
-
-void lttng_metadata_channel_destroy(struct lttng_channel *chan);
-struct lttng_event *lttng_event_create(struct lttng_channel *chan,
- struct lttng_kernel_event *event_param,
- void *filter,
- const struct lttng_event_desc *event_desc,
- enum lttng_kernel_instrumentation itype);
-struct lttng_event *_lttng_event_create(struct lttng_channel *chan,
- struct lttng_kernel_event *event_param,
- void *filter,
- const struct lttng_event_desc *event_desc,
- enum lttng_kernel_instrumentation itype);
-struct lttng_event *lttng_event_compat_old_create(struct lttng_channel *chan,
- struct lttng_kernel_old_event *old_event_param,
- void *filter,
- const struct lttng_event_desc *internal_desc);
-
-int lttng_channel_enable(struct lttng_channel *channel);
-int lttng_channel_disable(struct lttng_channel *channel);
-int lttng_event_enable(struct lttng_event *event);
-int lttng_event_disable(struct lttng_event *event);
-
-void lttng_transport_register(struct lttng_transport *transport);
-void lttng_transport_unregister(struct lttng_transport *transport);
-
-void synchronize_trace(void);
-int lttng_abi_init(void);
-int lttng_abi_compat_old_init(void);
-void lttng_abi_exit(void);
-void lttng_abi_compat_old_exit(void);
-
-int lttng_probe_register(struct lttng_probe_desc *desc);
-void lttng_probe_unregister(struct lttng_probe_desc *desc);
-const struct lttng_event_desc *lttng_event_get(const char *name);
-void lttng_event_put(const struct lttng_event_desc *desc);
-int lttng_probes_init(void);
-void lttng_probes_exit(void);
-
-int lttng_metadata_output_channel(struct lttng_metadata_stream *stream,
- struct channel *chan);
-
-int lttng_id_tracker_get_node_id(const struct lttng_id_hash_node *node);
-int lttng_id_tracker_empty_set(struct lttng_id_tracker *lf);
-void lttng_id_tracker_destroy(struct lttng_id_tracker *lf, bool rcu);
-bool lttng_id_tracker_lookup(struct lttng_id_tracker_rcu *p, int id);
-int lttng_id_tracker_add(struct lttng_id_tracker *lf, int id);
-int lttng_id_tracker_del(struct lttng_id_tracker *lf, int id);
-
-int lttng_session_track_id(struct lttng_session *session,
- enum tracker_type tracker_type, int id);
-int lttng_session_untrack_id(struct lttng_session *session,
- enum tracker_type tracker_type, int id);
-
-int lttng_session_list_tracker_ids(struct lttng_session *session,
- enum tracker_type tracker_type);
-
-void lttng_clock_ref(void);
-void lttng_clock_unref(void);
-
-#if defined(CONFIG_HAVE_SYSCALL_TRACEPOINTS)
-int lttng_syscalls_register(struct lttng_channel *chan, void *filter);
-int lttng_syscalls_unregister(struct lttng_channel *chan);
-int lttng_syscall_filter_enable(struct lttng_channel *chan,
- const char *name);
-int lttng_syscall_filter_disable(struct lttng_channel *chan,
- const char *name);
-long lttng_channel_syscall_mask(struct lttng_channel *channel,
- struct lttng_kernel_syscall_mask __user *usyscall_mask);
-#else
-static inline int lttng_syscalls_register(struct lttng_channel *chan, void *filter)
-{
- return -ENOSYS;
-}
-
-static inline int lttng_syscalls_unregister(struct lttng_channel *chan)
-{
- return 0;
-}
-
-static inline int lttng_syscall_filter_enable(struct lttng_channel *chan,
- const char *name)
-{
- return -ENOSYS;
-}
-
-static inline int lttng_syscall_filter_disable(struct lttng_channel *chan,
- const char *name)
-{
- return -ENOSYS;
-}
-
-static inline long lttng_channel_syscall_mask(struct lttng_channel *channel,
- struct lttng_kernel_syscall_mask __user *usyscall_mask)
-{
- return -ENOSYS;
-}
-#endif
-
-void lttng_filter_sync_state(struct lttng_bytecode_runtime *runtime);
-int lttng_enabler_attach_bytecode(struct lttng_enabler *enabler,
- struct lttng_kernel_filter_bytecode __user *bytecode);
-void lttng_enabler_event_link_bytecode(struct lttng_event *event,
- struct lttng_enabler *enabler);
-
-int lttng_probes_init(void);
-
-extern struct lttng_ctx *lttng_static_ctx;
-
-int lttng_context_init(void);
-void lttng_context_exit(void);
-struct lttng_ctx_field *lttng_append_context(struct lttng_ctx **ctx);
-void lttng_context_update(struct lttng_ctx *ctx);
-int lttng_find_context(struct lttng_ctx *ctx, const char *name);
-int lttng_get_context_index(struct lttng_ctx *ctx, const char *name);
-void lttng_remove_context_field(struct lttng_ctx **ctx,
- struct lttng_ctx_field *field);
-void lttng_destroy_context(struct lttng_ctx *ctx);
-int lttng_add_pid_to_ctx(struct lttng_ctx **ctx);
-int lttng_add_cpu_id_to_ctx(struct lttng_ctx **ctx);
-int lttng_add_procname_to_ctx(struct lttng_ctx **ctx);
-int lttng_add_prio_to_ctx(struct lttng_ctx **ctx);
-int lttng_add_nice_to_ctx(struct lttng_ctx **ctx);
-int lttng_add_vpid_to_ctx(struct lttng_ctx **ctx);
-int lttng_add_tid_to_ctx(struct lttng_ctx **ctx);
-int lttng_add_vtid_to_ctx(struct lttng_ctx **ctx);
-int lttng_add_ppid_to_ctx(struct lttng_ctx **ctx);
-int lttng_add_vppid_to_ctx(struct lttng_ctx **ctx);
-int lttng_add_hostname_to_ctx(struct lttng_ctx **ctx);
-int lttng_add_interruptible_to_ctx(struct lttng_ctx **ctx);
-int lttng_add_need_reschedule_to_ctx(struct lttng_ctx **ctx);
-#if defined(CONFIG_PREEMPT_RT_FULL) || defined(CONFIG_PREEMPT)
-int lttng_add_preemptible_to_ctx(struct lttng_ctx **ctx);
-#else
-static inline
-int lttng_add_preemptible_to_ctx(struct lttng_ctx **ctx)
-{
- return -ENOSYS;
-}
-#endif
-#ifdef CONFIG_PREEMPT_RT_FULL
-int lttng_add_migratable_to_ctx(struct lttng_ctx **ctx);
-#else
-static inline
-int lttng_add_migratable_to_ctx(struct lttng_ctx **ctx)
-{
- return -ENOSYS;
-}
-#endif
-
-int lttng_add_callstack_to_ctx(struct lttng_ctx **ctx, int type);
-
-#if defined(CONFIG_CGROUPS) && \
- ((LINUX_VERSION_CODE >= KERNEL_VERSION(4,6,0)) || \
- LTTNG_UBUNTU_KERNEL_RANGE(4,4,0,0, 4,5,0,0))
-int lttng_add_cgroup_ns_to_ctx(struct lttng_ctx **ctx);
-#else
-static inline
-int lttng_add_cgroup_ns_to_ctx(struct lttng_ctx **ctx)
-{
- return -ENOSYS;
-}
-#endif
-
-#if defined(CONFIG_IPC_NS) && \
- (LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0))
-int lttng_add_ipc_ns_to_ctx(struct lttng_ctx **ctx);
-#else
-static inline
-int lttng_add_ipc_ns_to_ctx(struct lttng_ctx **ctx)
-{
- return -ENOSYS;
-}
-#endif
-
-#if !defined(LTTNG_MNT_NS_MISSING_HEADER) && \
- (LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0))
-int lttng_add_mnt_ns_to_ctx(struct lttng_ctx **ctx);
-#else
-static inline
-int lttng_add_mnt_ns_to_ctx(struct lttng_ctx **ctx)
-{
- return -ENOSYS;
-}
-#endif
-
-#if defined(CONFIG_NET_NS) && \
- (LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0))
-int lttng_add_net_ns_to_ctx(struct lttng_ctx **ctx);
-#else
-static inline
-int lttng_add_net_ns_to_ctx(struct lttng_ctx **ctx)
-{
- return -ENOSYS;
-}
-#endif
-
-#if defined(CONFIG_PID_NS) && \
- (LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0))
-int lttng_add_pid_ns_to_ctx(struct lttng_ctx **ctx);
-#else
-static inline
-int lttng_add_pid_ns_to_ctx(struct lttng_ctx **ctx)
-{
- return -ENOSYS;
-}
-#endif
-
-#if defined(CONFIG_USER_NS) && \
- (LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0))
-int lttng_add_user_ns_to_ctx(struct lttng_ctx **ctx);
-#else
-static inline
-int lttng_add_user_ns_to_ctx(struct lttng_ctx **ctx)
-{
- return -ENOSYS;
-}
-#endif
-
-#if defined(CONFIG_UTS_NS) && \
- (LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0))
-int lttng_add_uts_ns_to_ctx(struct lttng_ctx **ctx);
-#else
-static inline
-int lttng_add_uts_ns_to_ctx(struct lttng_ctx **ctx)
-{
- return -ENOSYS;
-}
-#endif
-
-int lttng_add_uid_to_ctx(struct lttng_ctx **ctx);
-int lttng_add_euid_to_ctx(struct lttng_ctx **ctx);
-int lttng_add_suid_to_ctx(struct lttng_ctx **ctx);
-int lttng_add_gid_to_ctx(struct lttng_ctx **ctx);
-int lttng_add_egid_to_ctx(struct lttng_ctx **ctx);
-int lttng_add_sgid_to_ctx(struct lttng_ctx **ctx);
-int lttng_add_vuid_to_ctx(struct lttng_ctx **ctx);
-int lttng_add_veuid_to_ctx(struct lttng_ctx **ctx);
-int lttng_add_vsuid_to_ctx(struct lttng_ctx **ctx);
-int lttng_add_vgid_to_ctx(struct lttng_ctx **ctx);
-int lttng_add_vegid_to_ctx(struct lttng_ctx **ctx);
-int lttng_add_vsgid_to_ctx(struct lttng_ctx **ctx);
-
-#if defined(CONFIG_PERF_EVENTS)
-int lttng_add_perf_counter_to_ctx(uint32_t type,
- uint64_t config,
- const char *name,
- struct lttng_ctx **ctx);
-int lttng_cpuhp_perf_counter_online(unsigned int cpu,
- struct lttng_cpuhp_node *node);
-int lttng_cpuhp_perf_counter_dead(unsigned int cpu,
- struct lttng_cpuhp_node *node);
-#else
-static inline
-int lttng_add_perf_counter_to_ctx(uint32_t type,
- uint64_t config,
- const char *name,
- struct lttng_ctx **ctx)
-{
- return -ENOSYS;
-}
-static inline
-int lttng_cpuhp_perf_counter_online(unsigned int cpu,
- struct lttng_cpuhp_node *node)
-{
- return 0;
-}
-static inline
-int lttng_cpuhp_perf_counter_dead(unsigned int cpu,
- struct lttng_cpuhp_node *node)
-{
- return 0;
-}
-#endif
-
-int lttng_logger_init(void);
-void lttng_logger_exit(void);
-
-extern int lttng_statedump_start(struct lttng_session *session);
-
-#ifdef CONFIG_KPROBES
-int lttng_kprobes_register(const char *name,
- const char *symbol_name,
- uint64_t offset,
- uint64_t addr,
- struct lttng_event *event);
-void lttng_kprobes_unregister(struct lttng_event *event);
-void lttng_kprobes_destroy_private(struct lttng_event *event);
-#else
-static inline
-int lttng_kprobes_register(const char *name,
- const char *symbol_name,
- uint64_t offset,
- uint64_t addr,
- struct lttng_event *event)
-{
- return -ENOSYS;
-}
-
-static inline
-void lttng_kprobes_unregister(struct lttng_event *event)
-{
-}
-
-static inline
-void lttng_kprobes_destroy_private(struct lttng_event *event)
-{
-}
-#endif
-
-int lttng_event_add_callsite(struct lttng_event *event,
- struct lttng_kernel_event_callsite *callsite);
-
-#ifdef CONFIG_UPROBES
-int lttng_uprobes_register(const char *name,
- int fd, struct lttng_event *event);
-int lttng_uprobes_add_callsite(struct lttng_event *event,
- struct lttng_kernel_event_callsite *callsite);
-void lttng_uprobes_unregister(struct lttng_event *event);
-void lttng_uprobes_destroy_private(struct lttng_event *event);
-#else
-static inline
-int lttng_uprobes_register(const char *name,
- int fd, struct lttng_event *event)
-{
- return -ENOSYS;
-}
-
-static inline
-int lttng_uprobes_add_callsite(struct lttng_event *event,
- struct lttng_kernel_event_callsite *callsite)
-{
- return -ENOSYS;
-}
-
-static inline
-void lttng_uprobes_unregister(struct lttng_event *event)
-{
-}
-
-static inline
-void lttng_uprobes_destroy_private(struct lttng_event *event)
-{
-}
-#endif
-
-#ifdef CONFIG_KRETPROBES
-int lttng_kretprobes_register(const char *name,
- const char *symbol_name,
- uint64_t offset,
- uint64_t addr,
- struct lttng_event *event_entry,
- struct lttng_event *event_exit);
-void lttng_kretprobes_unregister(struct lttng_event *event);
-void lttng_kretprobes_destroy_private(struct lttng_event *event);
-int lttng_kretprobes_event_enable_state(struct lttng_event *event,
- int enable);
-#else
-static inline
-int lttng_kretprobes_register(const char *name,
- const char *symbol_name,
- uint64_t offset,
- uint64_t addr,
- struct lttng_event *event_entry,
- struct lttng_event *event_exit)
-{
- return -ENOSYS;
-}
-
-static inline
-void lttng_kretprobes_unregister(struct lttng_event *event)
-{
-}
-
-static inline
-void lttng_kretprobes_destroy_private(struct lttng_event *event)
-{
-}
-
-static inline
-int lttng_kretprobes_event_enable_state(struct lttng_event *event,
- int enable)
-{
- return -ENOSYS;
-}
-#endif
-
-int lttng_calibrate(struct lttng_kernel_calibrate *calibrate);
-
-extern const struct file_operations lttng_tracepoint_list_fops;
-extern const struct file_operations lttng_syscall_list_fops;
-
-#define TRACEPOINT_HAS_DATA_ARG
-
-static inline bool lttng_is_bytewise_integer(const struct lttng_type *type)
-{
- if (type->atype != atype_integer)
- return false;
- switch (type->u.integer.size) {
- case 8: /* Fall-through. */
- case 16: /* Fall-through. */
- case 32: /* Fall-through. */
- case 64:
- break;
- default:
- return false;
- }
- return true;
-}
-
-#endif /* _LTTNG_EVENTS_H */
#include <wrapper/types.h>
#include <linux/swab.h>
-#include <lttng-filter.h>
-#include <lttng-string-utils.h>
+#include <lttng/filter.h>
+#include <lttng/string-utils.h>
LTTNG_STACK_FRAME_NON_STANDARD(lttng_filter_interpret_bytecode);
*/
#include <linux/slab.h>
-#include <lttng-filter.h>
+#include <lttng/filter.h>
#include <lttng/align.h>
static ssize_t bytecode_reserve_data(struct bytecode_runtime *runtime,
#include <linux/slab.h>
#include <wrapper/list.h>
-#include <lttng-filter.h>
+#include <lttng/filter.h>
#define MERGE_POINT_TABLE_BITS 7
#define MERGE_POINT_TABLE_SIZE (1U << MERGE_POINT_TABLE_BITS)
#include <linux/list.h>
#include <linux/slab.h>
-#include <lttng-filter.h>
+#include <lttng/filter.h>
static const char *opnames[] = {
[ FILTER_OP_UNKNOWN ] = "UNKNOWN",
+++ /dev/null
-/* SPDX-License-Identifier: MIT
- *
- * lttng-filter.h
- *
- * LTTng modules filter header.
- *
- * Copyright (C) 2010-2016 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- */
-
-#ifndef _LTTNG_FILTER_H
-#define _LTTNG_FILTER_H
-
-#include <linux/kernel.h>
-
-#include <lttng-events.h>
-#include <filter-bytecode.h>
-
-/* Filter stack length, in number of entries */
-#define FILTER_STACK_LEN 10 /* includes 2 dummy */
-#define FILTER_STACK_EMPTY 1
-
-#define FILTER_MAX_DATA_LEN 65536
-
-#ifdef DEBUG
-#define dbg_printk(fmt, args...) \
- printk(KERN_DEBUG "[debug bytecode in %s:%s@%u] " fmt, \
- __FILE__, __func__, __LINE__, ## args)
-#else
-#define dbg_printk(fmt, args...) \
-do { \
- /* do nothing but check printf format */ \
- if (0) \
- printk(KERN_DEBUG "[debug bytecode in %s:%s@%u] " fmt, \
- __FILE__, __func__, __LINE__, ## args); \
-} while (0)
-#endif
-
-/* Linked bytecode. Child of struct lttng_bytecode_runtime. */
-struct bytecode_runtime {
- struct lttng_bytecode_runtime p;
- size_t data_len;
- size_t data_alloc_len;
- char *data;
- uint16_t len;
- char code[0];
-};
-
-enum entry_type {
- REG_S64,
- REG_DOUBLE,
- REG_STRING,
- REG_STAR_GLOB_STRING,
- REG_TYPE_UNKNOWN,
- REG_PTR,
-};
-
-enum load_type {
- LOAD_ROOT_CONTEXT,
- LOAD_ROOT_APP_CONTEXT,
- LOAD_ROOT_PAYLOAD,
- LOAD_OBJECT,
-};
-
-enum object_type {
- OBJECT_TYPE_S8,
- OBJECT_TYPE_S16,
- OBJECT_TYPE_S32,
- OBJECT_TYPE_S64,
- OBJECT_TYPE_U8,
- OBJECT_TYPE_U16,
- OBJECT_TYPE_U32,
- OBJECT_TYPE_U64,
-
- OBJECT_TYPE_DOUBLE,
- OBJECT_TYPE_STRING,
- OBJECT_TYPE_STRING_SEQUENCE,
-
- OBJECT_TYPE_SEQUENCE,
- OBJECT_TYPE_ARRAY,
- OBJECT_TYPE_STRUCT,
- OBJECT_TYPE_VARIANT,
-
- OBJECT_TYPE_DYNAMIC,
-};
-
-struct filter_get_index_data {
- uint64_t offset; /* in bytes */
- size_t ctx_index;
- size_t array_len;
- struct {
- size_t len;
- enum object_type type;
- bool rev_bo; /* reverse byte order */
- } elem;
-};
-
-/* Validation stack */
-struct vstack_load {
- enum load_type type;
- enum object_type object_type;
- const struct lttng_event_field *field;
- bool rev_bo; /* reverse byte order */
-};
-
-struct vstack_entry {
- enum entry_type type;
- struct vstack_load load;
-};
-
-struct vstack {
- int top; /* top of stack */
- struct vstack_entry e[FILTER_STACK_LEN];
-};
-
-static inline
-void vstack_init(struct vstack *stack)
-{
- stack->top = -1;
-}
-
-static inline
-struct vstack_entry *vstack_ax(struct vstack *stack)
-{
- if (unlikely(stack->top < 0))
- return NULL;
- return &stack->e[stack->top];
-}
-
-static inline
-struct vstack_entry *vstack_bx(struct vstack *stack)
-{
- if (unlikely(stack->top < 1))
- return NULL;
- return &stack->e[stack->top - 1];
-}
-
-static inline
-int vstack_push(struct vstack *stack)
-{
- if (stack->top >= FILTER_STACK_LEN - 1) {
- printk(KERN_WARNING "Stack full\n");
- return -EINVAL;
- }
- ++stack->top;
- return 0;
-}
-
-static inline
-int vstack_pop(struct vstack *stack)
-{
- if (unlikely(stack->top < 0)) {
- printk(KERN_WARNING "Stack empty\n");
- return -EINVAL;
- }
- stack->top--;
- return 0;
-}
-
-/* Execution stack */
-enum estack_string_literal_type {
- ESTACK_STRING_LITERAL_TYPE_NONE,
- ESTACK_STRING_LITERAL_TYPE_PLAIN,
- ESTACK_STRING_LITERAL_TYPE_STAR_GLOB,
-};
-
-struct load_ptr {
- enum load_type type;
- enum object_type object_type;
- const void *ptr;
- bool rev_bo;
- /* Temporary place-holders for contexts. */
- union {
- int64_t s64;
- uint64_t u64;
- double d;
- } u;
- /*
- * "field" is only needed when nested under a variant, in which
- * case we cannot specialize the nested operations.
- */
- const struct lttng_event_field *field;
-};
-
-struct estack_entry {
- union {
- int64_t v;
-
- struct {
- const char *str;
- const char __user *user_str;
- size_t seq_len;
- enum estack_string_literal_type literal_type;
- int user; /* is string from userspace ? */
- } s;
- struct load_ptr ptr;
- } u;
-};
-
-struct estack {
- int top; /* top of stack */
- struct estack_entry e[FILTER_STACK_LEN];
-};
-
-#define estack_ax_v ax
-#define estack_bx_v bx
-
-#define estack_ax(stack, top) \
- ({ \
- BUG_ON((top) <= FILTER_STACK_EMPTY); \
- &(stack)->e[top]; \
- })
-
-#define estack_bx(stack, top) \
- ({ \
- BUG_ON((top) <= FILTER_STACK_EMPTY + 1); \
- &(stack)->e[(top) - 1]; \
- })
-
-#define estack_push(stack, top, ax, bx) \
- do { \
- BUG_ON((top) >= FILTER_STACK_LEN - 1); \
- (stack)->e[(top) - 1].u.v = (bx); \
- (bx) = (ax); \
- ++(top); \
- } while (0)
-
-#define estack_pop(stack, top, ax, bx) \
- do { \
- BUG_ON((top) <= FILTER_STACK_EMPTY); \
- (ax) = (bx); \
- (bx) = (stack)->e[(top) - 2].u.v; \
- (top)--; \
- } while (0)
-
-const char *lttng_filter_print_op(enum filter_op op);
-
-int lttng_filter_validate_bytecode(struct bytecode_runtime *bytecode);
-int lttng_filter_specialize_bytecode(struct lttng_event *event,
- struct bytecode_runtime *bytecode);
-
-uint64_t lttng_filter_false(void *filter_data,
- struct lttng_probe_ctx *lttng_probe_ctx,
- const char *filter_stack_data);
-uint64_t lttng_filter_interpret_bytecode(void *filter_data,
- struct lttng_probe_ctx *lttng_probe_ctx,
- const char *filter_stack_data);
-
-#endif /* _LTTNG_FILTER_H */
+++ /dev/null
-/* SPDX-License-Identifier: (GPL-2.0-only or LGPL-2.1-only)
- *
- * lttng-kernel-version.h
- *
- * Contains helpers to check more complex kernel version conditions.
- *
- * Copyright (C) 2012 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- */
-
-#ifndef _LTTNG_KERNEL_VERSION_H
-#define _LTTNG_KERNEL_VERSION_H
-
-#include <linux/version.h>
-#include <generated/utsrelease.h>
-
-/*
- * This macro checks if the kernel version is between the two specified
- * versions (lower limit inclusive, upper limit exclusive).
- */
-#define LTTNG_KERNEL_RANGE(a_low, b_low, c_low, a_high, b_high, c_high) \
- (LINUX_VERSION_CODE >= KERNEL_VERSION(a_low, b_low, c_low) && \
- LINUX_VERSION_CODE < KERNEL_VERSION(a_high, b_high, c_high))
-
-/* Ubuntu */
-
-#define LTTNG_UBUNTU_KERNEL_VERSION(a, b, c, d) \
- (((a) << 24) + ((b) << 16) + ((c) << 8) + (d))
-
-#ifdef UTS_UBUNTU_RELEASE_ABI
-#define LTTNG_UBUNTU_VERSION_CODE \
- ((LINUX_VERSION_CODE << 8) + UTS_UBUNTU_RELEASE_ABI)
-#else
-#define LTTNG_UBUNTU_VERSION_CODE 0
-#endif
-
-#define LTTNG_UBUNTU_KERNEL_RANGE(a_low, b_low, c_low, d_low, \
- a_high, b_high, c_high, d_high) \
- (LTTNG_UBUNTU_VERSION_CODE >= \
- LTTNG_UBUNTU_KERNEL_VERSION(a_low, b_low, c_low, d_low) && \
- LTTNG_UBUNTU_VERSION_CODE < \
- LTTNG_UBUNTU_KERNEL_VERSION(a_high, b_high, c_high, d_high))
-
-/* Debian */
-
-#define LTTNG_DEBIAN_KERNEL_VERSION(a, b, c, d, e, f) \
- (((((a) << 16) + ((b) << 8) + (c)) * 1000000ULL) + ((d) * 10000) + ((e) * 100) + (f))
-
-#ifdef DEBIAN_API_VERSION
-#define LTTNG_DEBIAN_VERSION_CODE \
- ((LINUX_VERSION_CODE * 1000000ULL) + DEBIAN_API_VERSION)
-#else
-#define LTTNG_DEBIAN_VERSION_CODE 0
-#endif
-
-#define LTTNG_DEBIAN_KERNEL_RANGE(a_low, b_low, c_low, d_low, e_low, f_low, \
- a_high, b_high, c_high, d_high, e_high, f_high) \
- (LTTNG_DEBIAN_VERSION_CODE >= \
- LTTNG_DEBIAN_KERNEL_VERSION(a_low, b_low, c_low, d_low, e_low, f_low) && \
- LTTNG_DEBIAN_VERSION_CODE < \
- LTTNG_DEBIAN_KERNEL_VERSION(a_high, b_high, c_high, d_high, e_high, f_high))
-
-#define LTTNG_RHEL_KERNEL_VERSION(a, b, c, d, e, f) \
- (((((a) << 16) + ((b) << 8) + (c)) * 10000000ULL) + ((d) * 10000) + ((e) * 100) + (f))
-
-/* RHEL */
-
-#ifdef RHEL_API_VERSION
-#define LTTNG_RHEL_VERSION_CODE \
- ((LINUX_VERSION_CODE * 10000000ULL) + RHEL_API_VERSION)
-#else
-#define LTTNG_RHEL_VERSION_CODE 0
-#endif
-
-#define LTTNG_RHEL_KERNEL_RANGE(a_low, b_low, c_low, d_low, e_low, f_low, \
- a_high, b_high, c_high, d_high, e_high, f_high) \
- (LTTNG_RHEL_VERSION_CODE >= \
- LTTNG_RHEL_KERNEL_VERSION(a_low, b_low, c_low, d_low, e_low, f_low) && \
- LTTNG_RHEL_VERSION_CODE < \
- LTTNG_RHEL_KERNEL_VERSION(a_high, b_high, c_high, d_high, e_high, f_high))
-
-/* SUSE Linux enterprise */
-
-#define LTTNG_SLE_KERNEL_VERSION(a, b, c, d, e, f) \
- (((((a) << 16) + ((b) << 8) + (c)) * 10000000ULL) + ((d) * 10000) + ((e) * 100) + (f))
-
-#ifdef SLE_API_VERSION
-#define LTTNG_SLE_VERSION_CODE \
- ((LINUX_VERSION_CODE * 10000000ULL) + SLE_API_VERSION)
-#else
-#define LTTNG_SLE_VERSION_CODE 0
-#endif
-
-#define LTTNG_SLE_KERNEL_RANGE(a_low, b_low, c_low, d_low, e_low, f_low, \
- a_high, b_high, c_high, d_high, e_high, f_high) \
- (LTTNG_SLE_VERSION_CODE >= \
- LTTNG_SLE_KERNEL_VERSION(a_low, b_low, c_low, d_low, e_low, f_low) && \
- LTTNG_SLE_VERSION_CODE < \
- LTTNG_SLE_KERNEL_VERSION(a_high, b_high, c_high, d_high, e_high, f_high))
-
-/* Fedora */
-
-#define LTTNG_FEDORA_KERNEL_VERSION(a, b, c, d) \
- (((((a) << 16) + ((b) << 8) + (c)) * 10000ULL) + (d))
-
-#ifdef FEDORA_REVISION_VERSION
-#define LTTNG_FEDORA_VERSION_CODE \
- ((LINUX_VERSION_CODE * 10000ULL) + FEDORA_REVISION_VERSION)
-#else
-#define LTTNG_FEDORA_VERSION_CODE 0
-#endif
-
-#define LTTNG_FEDORA_KERNEL_RANGE(a_low, b_low, c_low, d_low, \
- a_high, b_high, c_high, d_high) \
- (LTTNG_FEDORA_VERSION_CODE >= \
- LTTNG_FEDORA_KERNEL_VERSION(a_low, b_low, c_low, d_low) && \
- LTTNG_FEDORA_VERSION_CODE < \
- LTTNG_FEDORA_KERNEL_VERSION(a_high, b_high, c_high, d_high))
-
-/* RT patch */
-
-#define LTTNG_RT_KERNEL_VERSION(a, b, c, d) \
- (((a) << 24) + ((b) << 16) + ((c) << 8) + (d))
-
-#ifdef RT_PATCH_VERSION
-#define LTTNG_RT_VERSION_CODE \
- ((LINUX_VERSION_CODE << 8) + RT_PATCH_VERSION)
-#else
-#define LTTNG_RT_VERSION_CODE 0
-#endif
-
-#define LTTNG_RT_KERNEL_RANGE(a_low, b_low, c_low, d_low, \
- a_high, b_high, c_high, d_high) \
- (LTTNG_RT_VERSION_CODE >= \
- LTTNG_RT_KERNEL_VERSION(a_low, b_low, c_low, d_low) && \
- LTTNG_RT_VERSION_CODE < \
- LTTNG_RT_KERNEL_VERSION(a_high, b_high, c_high, d_high))
-
-#endif /* _LTTNG_KERNEL_VERSION_H */
#include <linux/mutex.h>
#include <linux/seq_file.h>
-#include <lttng-events.h>
+#include <lttng/events.h>
/*
* probe list is protected by sessions lock.
*/
#include <linux/module.h>
-#include <lttng-tracer.h>
+#include <lttng/tracer.h>
#define RING_BUFFER_MODE_TEMPLATE RING_BUFFER_DISCARD
#define RING_BUFFER_MODE_TEMPLATE_STRING "discard"
*/
#include <linux/module.h>
-#include <lttng-tracer.h>
+#include <lttng/tracer.h>
#define RING_BUFFER_MODE_TEMPLATE RING_BUFFER_DISCARD
#define RING_BUFFER_MODE_TEMPLATE_STRING "discard-mmap"
*/
#include <linux/module.h>
-#include <lttng-tracer.h>
+#include <lttng/tracer.h>
#define RING_BUFFER_MODE_TEMPLATE RING_BUFFER_OVERWRITE
#define RING_BUFFER_MODE_TEMPLATE_STRING "overwrite-mmap"
*/
#include <linux/module.h>
-#include <lttng-tracer.h>
+#include <lttng/tracer.h>
#define RING_BUFFER_MODE_TEMPLATE RING_BUFFER_OVERWRITE
#define RING_BUFFER_MODE_TEMPLATE_STRING "overwrite"
#include <lttng/bitfield.h>
#include <wrapper/vmalloc.h> /* for wrapper_vmalloc_sync_mappings() */
#include <wrapper/trace-clock.h>
-#include <lttng-events.h>
-#include <lttng-tracer.h>
+#include <lttng/events.h>
+#include <lttng/tracer.h>
#include <ringbuffer/frontend_types.h>
#define LTTNG_COMPACT_EVENT_BITS 5
*/
#include <linux/module.h>
-#include <lttng-tracer.h>
+#include <lttng/tracer.h>
#define RING_BUFFER_MODE_TEMPLATE RING_BUFFER_DISCARD
#define RING_BUFFER_MODE_TEMPLATE_STRING "metadata"
#include <linux/module.h>
#include <linux/types.h>
#include <wrapper/vmalloc.h> /* for wrapper_vmalloc_sync_mappings() */
-#include <lttng-events.h>
-#include <lttng-tracer.h>
+#include <lttng/events.h>
+#include <lttng/tracer.h>
static struct lttng_transport lttng_relay_transport;
*/
#include <linux/module.h>
-#include <lttng-tracer.h>
+#include <lttng/tracer.h>
#define RING_BUFFER_MODE_TEMPLATE RING_BUFFER_DISCARD
#define RING_BUFFER_MODE_TEMPLATE_STRING "metadata-mmap"
#include <linux/mutex.h>
#include <linux/device.h>
-#include <lttng-events.h>
-#include <lttng-tracer.h>
+#include <lttng/events.h>
+#include <lttng/tracer.h>
#include <wrapper/irqdesc.h>
#include <wrapper/fdtable.h>
#include <wrapper/namespace.h>
#include <linux/types.h>
-#include <lttng-string-utils.h>
+#include <lttng/string-utils.h>
enum star_glob_pattern_type_flags {
STAR_GLOB_PATTERN_TYPE_FLAG_NONE = 0,
+++ /dev/null
-/* SPDX-License-Identifier: (GPL-2.0-only or LGPL-2.1-only) */
-#ifndef _LTTNG_STRING_UTILS_H
-#define _LTTNG_STRING_UTILS_H
-
-/*
- * Copyright (C) 2017 Philippe Proulx <pproulx@efficios.com>
- */
-
-#include <stdbool.h>
-
-typedef char (*strutils_get_char_at_cb)(size_t, void *);
-
-bool strutils_is_star_glob_pattern(const char *pattern);
-bool strutils_is_star_at_the_end_only_glob_pattern(const char *pattern);
-bool strutils_star_glob_match(const char *pattern, size_t pattern_len,
- const char *candidate, size_t candidate_len);
-bool strutils_star_glob_match_char_cb(
- strutils_get_char_at_cb pattern_get_char_at_cb,
- void *pattern_get_char_at_cb_data,
- strutils_get_char_at_cb candidate_get_char_at_cb,
- void *candidate_get_char_at_cb_data);
-
-#endif /* _LTTNG_STRING_UTILS_H */
#include <wrapper/file.h>
#include <wrapper/rcu.h>
#include <wrapper/syscall.h>
-#include <lttng-events.h>
+#include <lttng/events.h>
#ifndef CONFIG_COMPAT
# ifndef is_compat_task
#include <linux/slab.h>
#include <linux/percpu.h>
-#include <lttng-tp-mempool.h>
+#include <lttng/tp-mempool.h>
struct lttng_tp_buf_entry {
int cpu; /* To make sure we return the entry to the right pool. */
+++ /dev/null
-/* SPDX-License-Identifier: (GPL-2.0-only or LGPL-2.1-only)
- *
- * lttng-tp-mempool.h
- *
- * Copyright (C) 2018 Julien Desfossez <jdesfossez@efficios.com>
- */
-
-#ifndef LTTNG_TP_MEMPOOL_H
-#define LTTNG_TP_MEMPOOL_H
-
-#include <linux/percpu.h>
-
-#define LTTNG_TP_MEMPOOL_NR_BUF_PER_CPU 4
-#define LTTNG_TP_MEMPOOL_BUF_SIZE 4096
-
-/*
- * Initialize the pool, only performed once. The pool is a set of
- * LTTNG_TP_MEMPOOL_NR_BUF_PER_CPU buffers of size LTTNG_TP_MEMPOOL_BUF_SIZE
- * per-cpu.
- *
- * Returns 0 on success, a negative value on error.
- */
-int lttng_tp_mempool_init(void);
-
-/*
- * Destroy the pool and free all the memory allocated.
- */
-void lttng_tp_mempool_destroy(void);
-
-/*
- * Ask for a buffer on the current cpu.
- *
- * The pool is per-cpu, but there is no exclusive access guarantee on the
- * per-cpu free-list, the caller needs to ensure it cannot get preempted or
- * interrupted while performing the allocation.
- *
- * The maximum size that can be allocated is LTTNG_TP_MEMPOOL_BUF_SIZE, and the
- * maximum number of buffers allocated simultaneously on the same CPU is
- * LTTNG_TP_MEMPOOL_NR_BUF_PER_CPU.
- *
- * Return a pointer to a buffer on success, NULL on error.
- */
-void *lttng_tp_mempool_alloc(size_t size);
-
-/*
- * Release the memory reserved. Same concurrency limitations as the allocation.
- */
-void lttng_tp_mempool_free(void *ptr);
-
-#endif /* LTTNG_TP_MEMPOOL_H */
#include <linux/jhash.h>
#include <linux/module.h>
-#include <lttng-tracepoint.h>
+#include <lttng/tracepoint.h>
#include <wrapper/list.h>
#include <wrapper/tracepoint.h>
+++ /dev/null
-/* SPDX-License-Identifier: (GPL-2.0-only or LGPL-2.1-only)
- *
- * lttng-tracepoint.h
- *
- * LTTng adaptation layer for Linux kernel 3.15+ tracepoints.
- *
- * Copyright (C) 2014 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- */
-
-#ifndef _LTTNG_TRACEPOINT_H
-#define _LTTNG_TRACEPOINT_H
-
-int lttng_tracepoint_probe_register(const char *name, void *probe, void *data);
-int lttng_tracepoint_probe_unregister(const char *name, void *probe, void *data);
-int lttng_tracepoint_init(void);
-void lttng_tracepoint_exit(void);
-
-#endif /* _LTTNG_TRACEPOINT_H */
+++ /dev/null
-/* SPDX-License-Identifier: (GPL-2.0-only or LGPL-2.1-only)
- *
- * lttng-tracer-core.h
- *
- * This contains the core definitions for the Linux Trace Toolkit Next
- * Generation tracer.
- *
- * Copyright (C) 2005-2012 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- */
-
-#ifndef LTTNG_TRACER_CORE_H
-#define LTTNG_TRACER_CORE_H
-
-#include <linux/list.h>
-#include <linux/percpu.h>
-
-#ifndef CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS
-/* Align data on its natural alignment */
-#define RING_BUFFER_ALIGN
-#endif
-
-#include <ringbuffer/config.h>
-
-struct lttng_session;
-struct lttng_channel;
-struct lttng_event;
-
-#endif /* LTTNG_TRACER_CORE_H */
+++ /dev/null
-/* SPDX-License-Identifier: (GPL-2.0-only or LGPL-2.1-only) */
-#ifndef _LTTNG_TRACER_H
-#define _LTTNG_TRACER_H
-
-/*
- * lttng-tracer.h
- *
- * This contains the definitions for the Linux Trace Toolkit Next
- * Generation tracer.
- *
- * Copyright (C) 2005-2012 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- */
-
-#include <stdarg.h>
-#include <linux/types.h>
-#include <linux/limits.h>
-#include <linux/list.h>
-#include <linux/cache.h>
-#include <linux/timex.h>
-#include <linux/wait.h>
-#include <asm/atomic.h>
-#include <asm/local.h>
-
-#include <wrapper/trace-clock.h>
-#include <wrapper/compiler.h>
-#include <wrapper/vmalloc.h>
-#include <lttng-tracer-core.h>
-#include <lttng-events.h>
-
-#define LTTNG_MODULES_MAJOR_VERSION 2
-#define LTTNG_MODULES_MINOR_VERSION 12
-#define LTTNG_MODULES_PATCHLEVEL_VERSION 0
-#define LTTNG_MODULES_EXTRAVERSION "-rc1"
-
-#define LTTNG_VERSION_NAME "(Ta) Meilleure"
-#define LTTNG_VERSION_DESCRIPTION "Ta Meilleure is a Northeast IPA beer brewed by Lagabière. Translating to \"Your best one\", this beer gives out strong aromas of passion fruit, lemon, and peaches. Tastewise, expect a lot of fruit, a creamy texture, and a smooth lingering hop bitterness."
-
-#ifndef CHAR_BIT
-#define CHAR_BIT 8
-#endif
-
-/* Number of bytes to log with a read/write event */
-#define LTTNG_LOG_RW_SIZE 32L
-#define LTTNG_MAX_SMALL_SIZE 0xFFFFU
-
-#ifdef RING_BUFFER_ALIGN
-#define lttng_alignof(type) __alignof__(type)
-#else
-#define lttng_alignof(type) 1
-#endif
-
-/* Tracer properties */
-#define CTF_MAGIC_NUMBER 0xC1FC1FC1
-#define TSDL_MAGIC_NUMBER 0x75D11D57
-
-/* CTF specification version followed */
-#define CTF_SPEC_MAJOR 1
-#define CTF_SPEC_MINOR 8
-
-/*
- * Number of milliseconds to retry before failing metadata writes on buffer full
- * condition. (10 seconds)
- */
-#define LTTNG_METADATA_TIMEOUT_MSEC 10000
-
-#define LTTNG_RFLAG_EXTENDED RING_BUFFER_RFLAG_END
-#define LTTNG_RFLAG_END (LTTNG_RFLAG_EXTENDED << 1)
-
-#endif /* _LTTNG_TRACER_H */
#include <wrapper/tracepoint.h>
#include <wrapper/rcu.h>
#include <wrapper/list.h>
-#include <lttng-events.h>
+#include <lttng/events.h>
/*
* Hash table is allocated and freed when there are no possible
*/
#include <linux/module.h>
-#include <lttng-tracer.h>
+#include <lttng/tracer.h>
static int __init lttng_wrapper_init(void)
{
#include <linux/module.h>
#include <linux/kprobes.h>
#include <linux/slab.h>
-#include <lttng-events.h>
+#include <lttng/events.h>
#include <ringbuffer/frontend_types.h>
#include <wrapper/vmalloc.h>
#include <wrapper/irqflags.h>
-#include <lttng-tracer.h>
+#include <lttng/tracer.h>
#include <blacklist/kprobes.h>
static
#include <linux/kprobes.h>
#include <linux/slab.h>
#include <linux/kref.h>
-#include <lttng-events.h>
+#include <lttng/events.h>
#include <ringbuffer/frontend_types.h>
#include <wrapper/vmalloc.h>
#include <wrapper/irqflags.h>
-#include <lttng-tracer.h>
+#include <lttng/tracer.h>
#include <blacklist/kprobes.h>
enum lttng_kretprobe_type {
#include <linux/module.h>
#include <net/9p/9p.h>
#include <net/9p/client.h>
-#include <lttng-tracer.h>
+#include <lttng/tracer.h>
/*
* Create the tracepoint static inlines from the kernel to validate that our
#include <linux/module.h>
#include <sound/jack.h>
#include <sound/soc.h>
-#include <lttng-tracer.h>
+#include <lttng/tracer.h>
/*
* Create the tracepoint static inlines from the kernel to validate that our
#include <linux/module.h>
#include <linux/blktrace_api.h>
-#include <lttng-tracer.h>
-#include <lttng-kernel-version.h>
+#include <lttng/tracer.h>
+#include <lttng/kernel-version.h>
/*
* Create the tracepoint static inlines from the kernel to validate that our
#include <../fs/btrfs/block-group.h>
#endif
#include <linux/dcache.h>
-#include <lttng-tracer.h>
+#include <lttng/tracer.h>
/*
* Create the tracepoint static inlines from the kernel to validate that our
*/
#include <linux/module.h>
-#include <lttng-tracer.h>
+#include <lttng/tracer.h>
/*
* Create the tracepoint static inlines from the kernel to validate that our
#include <linux/fs.h>
#include <linux/dcache.h>
#include <linux/version.h>
-#include <lttng-tracer.h>
+#include <lttng/tracer.h>
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0))
#include <../fs/ext3/ext3.h>
#include <../fs/ext4/mballoc.h>
#include <../fs/ext4/ext4_extents.h>
#include <linux/dcache.h>
-#include <lttng-tracer.h>
+#include <lttng/tracer.h>
/*
* Create the tracepoint static inlines from the kernel to validate that our
*/
#include <trace/events/ext4.h>
-#include <lttng-kernel-version.h>
+#include <lttng/kernel-version.h>
#include <wrapper/tracepoint.h>
/*
*/
#include <linux/module.h>
-#include <lttng-tracer.h>
+#include <lttng/tracer.h>
/*
* Create the tracepoint static inlines from the kernel to validate that our
#include <linux/module.h>
#include <linux/moduleparam.h>
-#include <lttng-tracer.h>
+#include <lttng/tracer.h>
/*
* Create the tracepoint static inlines from the kernel to validate that our
#include <linux/module.h>
#include <linux/interrupt.h>
-#include <lttng-tracer.h>
+#include <lttng/tracer.h>
/*
* Create the tracepoint static inlines from the kernel to validate that our
*/
#include <linux/module.h>
-#include <lttng-tracer.h>
+#include <lttng/tracer.h>
/*
* Create the tracepoint static inlines from the kernel to validate that our
*/
#include <linux/module.h>
-#include <lttng-tracer.h>
+#include <lttng/tracer.h>
/*
* Create the tracepoint static inlines from the kernel to validate that our
#include <wrapper/page_alloc.h>
#include <linux/module.h>
#include <linux/mm.h>
-#include <lttng-tracer.h>
+#include <lttng/tracer.h>
/*
* Create the tracepoint static inlines from the kernel to validate that our
#include <linux/module.h>
#include <linux/kvm_host.h>
-#include <lttng-tracer.h>
-#include <lttng-kernel-version.h>
+#include <lttng/tracer.h>
+#include <lttng/kernel-version.h>
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,1,0))
#include <kvm/iodev.h>
#include <linux/module.h>
#include <linux/kvm_host.h>
-#include <lttng-tracer.h>
-#include <lttng-kernel-version.h>
+#include <lttng/tracer.h>
+#include <lttng/kernel-version.h>
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,7,0))
#include <kvm_emulate.h>
#include <linux/module.h>
#include <linux/kvm_host.h>
-#include <lttng-tracer.h>
+#include <lttng/tracer.h>
/*
* Create the tracepoint static inlines from the kernel to validate that our
#include <linux/module.h>
#include <linux/version.h>
-#include <lttng-tracer.h>
+#include <lttng/tracer.h>
/*
* Create the tracepoint static inlines from the kernel to validate that our
*/
#include <linux/module.h>
-#include <lttng-tracer.h>
+#include <lttng/tracer.h>
/*
* Create the tracepoint static inlines from the kernel to validate that our
*/
#include <linux/module.h>
-#include <lttng-tracer.h>
+#include <lttng/tracer.h>
/*
* Create the tracepoint static inlines from the kernel to validate that our
*/
#include <linux/module.h>
-#include <lttng-tracer.h>
+#include <lttng/tracer.h>
/*
* Create the tracepoint static inlines from the kernel to validate that our
*/
#include <linux/module.h>
-#include <lttng-tracer.h>
+#include <lttng/tracer.h>
/*
* Create the tracepoint static inlines from the kernel to validate that our
#include <linux/module.h>
#include <linux/uaccess.h>
-#include <lttng-tracer.h>
+#include <lttng/tracer.h>
/*
* Create the tracepoint static inlines from the kernel to validate that our
*/
#include <linux/module.h>
-#include <lttng-tracer.h>
+#include <lttng/tracer.h>
/*
* Create the tracepoint static inlines from the kernel to validate that our
*/
#include <linux/module.h>
-#include <lttng-tracer.h>
+#include <lttng/tracer.h>
/*
* Create the tracepoint static inlines from the kernel to validate that our
#include <linux/module.h>
#include <linux/rcupdate.h>
-#include <lttng-tracer.h>
+#include <lttng/tracer.h>
/*
* Create the tracepoint static inlines from the kernel to validate that our
#include <linux/module.h>
#include <linux/device.h>
-#include <lttng-kernel-version.h>
-#include <lttng-tracer.h>
+#include <lttng/kernel-version.h>
+#include <lttng/tracer.h>
/*
* Create the tracepoint static inlines from the kernel to validate that our
*/
#include <linux/module.h>
-#include <lttng-tracer.h>
+#include <lttng/tracer.h>
/*
* Create the tracepoint static inlines from the kernel to validate that our
#include <linux/module.h>
#include <linux/device.h>
-#include <lttng-tracer.h>
+#include <lttng/tracer.h>
/*
* Create the tracepoint static inlines from the kernel to validate that our
*/
#include <linux/module.h>
-#include <lttng-tracer.h>
+#include <lttng/tracer.h>
/*
* Create the tracepoint static inlines from the kernel to validate that our
#include <linux/module.h>
#include <scsi/scsi_device.h>
-#include <lttng-tracer.h>
+#include <lttng/tracer.h>
/*
* Create the tracepoint static inlines from the kernel to validate that our
*/
#include <linux/module.h>
-#include <lttng-tracer.h>
+#include <lttng/tracer.h>
/*
* Create the tracepoint static inlines from the kernel to validate that our
*/
#include <linux/module.h>
-#include <lttng-tracer.h>
+#include <lttng/tracer.h>
/*
* Create the tracepoint static inlines from the kernel to validate that our
*/
#include <linux/module.h>
-#include <lttng-tracer.h>
+#include <lttng/tracer.h>
/*
* Create the tracepoint static inlines from the kernel to validate that our
#include <linux/netdevice.h>
#include <linux/inetdevice.h>
#include <linux/sched.h>
-#include <lttng-events.h>
-#include <lttng-tracer.h>
+#include <lttng/events.h>
+#include <lttng/tracer.h>
/*
* Create LTTng tracepoint probes.
*/
#include <linux/module.h>
-#include <lttng-tracer.h>
+#include <lttng/tracer.h>
/*
* Create the tracepoint static inlines from the kernel to validate that our
*/
#include <linux/module.h>
-#include <lttng-tracer.h>
+#include <lttng/tracer.h>
/*
* Create the tracepoint static inlines from the kernel to validate that our
*/
#include <linux/module.h>
-#include <lttng-tracer.h>
+#include <lttng/tracer.h>
/*
* Create the tracepoint static inlines from the kernel to validate that our
#include <linux/videodev2.h>
#include <media/videobuf2-core.h>
#include <media/v4l2-common.h>
-#include <lttng-tracer.h>
+#include <lttng/tracer.h>
/*
* Create the tracepoint static inlines from the kernel to validate that our
* trace event macros match the kernel we run on.
*/
#include <linux/module.h>
-#include <lttng-tracer.h>
+#include <lttng/tracer.h>
/*
* Create the tracepoint static inlines from the kernel to validate that our
*/
#include <trace/events/vmscan.h>
-#include <lttng-kernel-version.h>
+#include <lttng/kernel-version.h>
/*
* Create LTTng tracepoint probes.
#include <linux/module.h>
#include <linux/idr.h>
-#include <lttng-tracer.h>
+#include <lttng/tracer.h>
struct cpu_workqueue_struct;
struct pool_workqueue;
#include <linux/module.h>
#include <linux/device.h>
#include <linux/mm.h>
-#include <lttng-tracer.h>
+#include <lttng/tracer.h>
/*
* Create the tracepoint static inlines from the kernel to validate that our
*/
#include <trace/events/writeback.h>
-#include <lttng-kernel-version.h>
+#include <lttng/kernel-version.h>
#include <wrapper/writeback.h>
/* #if <check version number if global_dirty_limit will be exported> */
*/
#include <linux/module.h>
-#include <lttng-tracer.h>
+#include <lttng/tracer.h>
/*
* Create the tracepoint static inlines from the kernel to validate that our
*/
#include <linux/module.h>
-#include <lttng-tracer.h>
+#include <lttng/tracer.h>
/*
* Create the tracepoint static inlines from the kernel to validate that our
#include <linux/namei.h>
#include <linux/slab.h>
#include <linux/uaccess.h>
-#include <lttng-events.h>
-#include <lttng-tracer.h>
+#include <lttng/events.h>
+#include <lttng/tracer.h>
#include <wrapper/irqflags.h>
#include <ringbuffer/frontend_types.h>
#include <wrapper/uprobes.h>
#include <linux/mm.h>
#include <linux/miscdevice.h>
#include <wrapper/vmalloc.h>
-#include <lttng-events.h>
+#include <lttng/events.h>
#define TP_MODULE_NOAUTOLOAD
#define LTTNG_PACKAGE_BUILD
#include <linux/hrtimer.h>
#include <linux/time.h>
-#include <lttng-tracer.h>
-#include <lttng-clock.h> /* From lttng-modules */
+#include <lttng/tracer.h>
+#include <lttng/clock.h> /* From lttng-modules */
static u64 trace_clock_read64_example(void)
{
#include <linux/byteorder/generic.h>
#include <asm/byteorder.h>
-#include <lttng-events.h>
-#include <lttng-tracer.h>
+#include <lttng/events.h>
+#include <lttng/tracer.h>
#include <wrapper/tracepoint.h>
#define TP_MODULE_NOAUTOLOAD
* Copyright (C) 2011-2012 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
*/
-#include <lttng-kernel-version.h>
+#include <lttng/kernel-version.h>
#if (defined(CONFIG_KALLSYMS) \
&& (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)))
#include <linux/mm.h>
#include <linux/oom.h>
-#include <lttng-kernel-version.h>
+#include <lttng/kernel-version.h>
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,6,0) \
|| LTTNG_UBUNTU_KERNEL_RANGE(4,4,25,44, 4,5,0,0))
* Copyright (C) 2015 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
*/
-#include <lttng-kernel-version.h>
+#include <lttng/kernel-version.h>
#if (defined(CONFIG_KALLSYMS) \
&& (LINUX_VERSION_CODE >= KERNEL_VERSION(3,19,2) \
#ifndef _LTTNG_WRAPPER_PAGE_ALLOC_H
#define _LTTNG_WRAPPER_PAGE_ALLOC_H
-#include <lttng-kernel-version.h>
+#include <lttng/kernel-version.h>
/*
* We need to redefine get_pfnblock_flags_mask to our wrapper, because
#ifndef _LTTNG_WRAPPER_RANDOM_H
#define _LTTNG_WRAPPER_RANDOM_H
-#include <lttng-clock.h>
+#include <lttng/clock.h>
#define BOOT_ID_LEN LTTNG_MODULES_UUID_STR_LEN
* Copyright (C) 2011-2012 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
*/
-#include <lttng-kernel-version.h>
+#include <lttng/kernel-version.h>
#if (defined(CONFIG_KALLSYMS) \
&& (LINUX_VERSION_CODE < KERNEL_VERSION(4,2,0)))
#define _LTTNG_WRAPPER_SYSCALL_H
#include <asm/syscall.h>
-#include <lttng-kernel-version.h>
+#include <lttng/kernel-version.h>
#define LTTNG_SYSCALL_NR_ARGS 6
#include <linux/version.h>
#include <linux/timer.h>
-#include <lttng-kernel-version.h>
+#include <lttng/kernel-version.h>
/*
* In the olden days, pinned timers were initialized normaly with init_timer()
#include <linux/percpu.h>
#include <linux/version.h>
#include <asm/local.h>
-#include <lttng-kernel-version.h>
-#include <lttng-clock.h>
+#include <lttng/kernel-version.h>
+#include <lttng/clock.h>
#include <wrapper/compiler.h>
#include <wrapper/percpu-defs.h>
#include <wrapper/random.h>
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,15,0))
-#include <lttng-tracepoint.h>
+#include <lttng/tracepoint.h>
#define lttng_wrapper_tracepoint_probe_register lttng_tracepoint_probe_register
#define lttng_wrapper_tracepoint_probe_unregister lttng_tracepoint_probe_unregister
#define _LTTNG_WRAPPER_UACCESS_H
#include <linux/uaccess.h>
-#include <lttng-kernel-version.h>
+#include <lttng/kernel-version.h>
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,0,0) || \
LTTNG_RHEL_KERNEL_RANGE(4,18,0,147,0,0, 4,19,0,0,0,0))
#ifndef _LTTNG_WRAPPER_WRITEBACK_H
#define _LTTNG_WRAPPER_WRITEBACK_H
-#include <lttng-kernel-version.h>
+#include <lttng/kernel-version.h>
#ifdef CONFIG_KALLSYMS_ALL
#include <linux/kallsyms.h>