Allow open /proc/lttng for read & write
[lttng-modules.git] / lttng-abi.h
CommitLineData
e8951e63
MD
1#ifndef _LTTNG_ABI_H
2#define _LTTNG_ABI_H
57a13317
MD
3
4/*
e8951e63 5 * lttng-abi.h
57a13317
MD
6 *
7 * Copyright 2010 (c) - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 *
80996790 9 * LTTng ABI header
17baffe2
MD
10 *
11 * Dual LGPL v2.1/GPL v2 license.
57a13317
MD
12 */
13
14#include <linux/fs.h>
15
f8695253 16#define LTTNG_KERNEL_SYM_NAME_LEN 256
d6d808f3 17
38d024ae 18enum lttng_kernel_instrumentation {
4c183524
MD
19 LTTNG_KERNEL_TRACEPOINT = 0,
20 LTTNG_KERNEL_KPROBE = 1,
21 LTTNG_KERNEL_FUNCTION = 2,
7371f44c 22 LTTNG_KERNEL_KRETPROBE = 3,
1ec65de1 23 LTTNG_KERNEL_NOOP = 4, /* not hooked */
43880ee8 24 LTTNG_KERNEL_SYSCALL = 5,
57a13317
MD
25};
26
96ba7208
JD
27/*
28 * LTTng consumer mode
29 */
30enum lttng_kernel_output {
31 LTTNG_KERNEL_SPLICE = 0,
32 LTTNG_KERNEL_MMAP = 1,
33};
34
57a13317
MD
35/*
36 * LTTng DebugFS ABI structures.
37 */
8e099bae 38#define LTTNG_KERNEL_CHANNEL_PADDING LTTNG_KERNEL_SYM_NAME_LEN + 32
38d024ae 39struct lttng_kernel_channel {
9e245ead
MD
40 int overwrite; /* 1: overwrite, 0: discard */
41 uint64_t subbuf_size; /* in bytes */
80c16bcf 42 uint64_t num_subbuf;
9e245ead
MD
43 unsigned int switch_timer_interval; /* usecs */
44 unsigned int read_timer_interval; /* usecs */
96ba7208 45 enum lttng_kernel_output output; /* splice, mmap */
8e099bae 46 char padding[LTTNG_KERNEL_CHANNEL_PADDING];
57a13317
MD
47};
48
7371f44c
MD
49struct lttng_kernel_kretprobe {
50 uint64_t addr;
51
52 uint64_t offset;
f8695253 53 char symbol_name[LTTNG_KERNEL_SYM_NAME_LEN];
7371f44c
MD
54};
55
38d024ae
MD
56/*
57 * Either addr is used, or symbol_name and offset.
58 */
59struct lttng_kernel_kprobe {
80c16bcf 60 uint64_t addr;
38d024ae 61
80c16bcf 62 uint64_t offset;
f8695253 63 char symbol_name[LTTNG_KERNEL_SYM_NAME_LEN];
d6d808f3
MD
64};
65
f17701fb 66struct lttng_kernel_function_tracer {
f8695253 67 char symbol_name[LTTNG_KERNEL_SYM_NAME_LEN];
f17701fb
MD
68};
69
43880ee8
MD
70/*
71 * For syscall tracing, name = '\0' means "enable all".
72 */
8e099bae
MD
73#define LTTNG_KERNEL_EVENT_PADDING1 16
74#define LTTNG_KERNEL_EVENT_PADDING2 LTTNG_KERNEL_SYM_NAME_LEN + 32
d6d808f3 75struct lttng_kernel_event {
f8695253 76 char name[LTTNG_KERNEL_SYM_NAME_LEN]; /* event name */
d6d808f3 77 enum lttng_kernel_instrumentation instrumentation;
8e099bae
MD
78 char padding[LTTNG_KERNEL_EVENT_PADDING1];
79
d6d808f3
MD
80 /* Per instrumentation type configuration */
81 union {
7371f44c 82 struct lttng_kernel_kretprobe kretprobe;
d6d808f3 83 struct lttng_kernel_kprobe kprobe;
f17701fb 84 struct lttng_kernel_function_tracer ftrace;
8e099bae 85 char padding[LTTNG_KERNEL_EVENT_PADDING2];
d6d808f3 86 } u;
38d024ae 87};
c099397a 88
80c16bcf
MD
89struct lttng_kernel_tracer_version {
90 uint32_t version;
91 uint32_t patchlevel;
92 uint32_t sublevel;
93};
94
3db41b2c
MD
95enum lttng_kernel_calibrate_type {
96 LTTNG_KERNEL_CALIBRATE_KRETPROBE,
57105fc2
MD
97};
98
3db41b2c
MD
99struct lttng_kernel_calibrate {
100 enum lttng_kernel_calibrate_type type; /* type (input) */
57105fc2
MD
101};
102
12a313a5 103enum lttng_kernel_context_type {
4c183524
MD
104 LTTNG_KERNEL_CONTEXT_PID = 0,
105 LTTNG_KERNEL_CONTEXT_PERF_COUNTER = 1,
a2563e83 106 LTTNG_KERNEL_CONTEXT_PROCNAME = 2,
4c183524
MD
107 LTTNG_KERNEL_CONTEXT_PRIO = 3,
108 LTTNG_KERNEL_CONTEXT_NICE = 4,
109 LTTNG_KERNEL_CONTEXT_VPID = 5,
110 LTTNG_KERNEL_CONTEXT_TID = 6,
111 LTTNG_KERNEL_CONTEXT_VTID = 7,
112 LTTNG_KERNEL_CONTEXT_PPID = 8,
113 LTTNG_KERNEL_CONTEXT_VPPID = 9,
8070f5c0
MD
114};
115
116struct lttng_kernel_perf_counter_ctx {
117 uint32_t type;
118 uint64_t config;
f8695253 119 char name[LTTNG_KERNEL_SYM_NAME_LEN];
8070f5c0
MD
120};
121
8e099bae
MD
122#define LTTNG_KERNEL_CONTEXT_PADDING1 16
123#define LTTNG_KERNEL_CONTEXT_PADDING2 LTTNG_KERNEL_SYM_NAME_LEN + 32
8070f5c0 124struct lttng_kernel_context {
12a313a5 125 enum lttng_kernel_context_type ctx;
8e099bae
MD
126 char padding[LTTNG_KERNEL_CONTEXT_PADDING1];
127
8070f5c0 128 union {
8070f5c0 129 struct lttng_kernel_perf_counter_ctx perf_counter;
8e099bae 130 char padding[LTTNG_KERNEL_CONTEXT_PADDING2];
8070f5c0
MD
131 } u;
132};
133
33749530 134/* LTTng file descriptor ioctl */
ab2277d6 135#define LTTNG_KERNEL_SESSION _IO(0xF6, 0x40)
33749530
MD
136#define LTTNG_KERNEL_TRACER_VERSION \
137 _IOR(0xF6, 0x41, struct lttng_kernel_tracer_version)
271b6681 138#define LTTNG_KERNEL_TRACEPOINT_LIST _IO(0xF6, 0x42)
360f38ea 139#define LTTNG_KERNEL_WAIT_QUIESCENT _IO(0xF6, 0x43)
57105fc2 140#define LTTNG_KERNEL_CALIBRATE \
3db41b2c 141 _IOWR(0xF6, 0x44, struct lttng_kernel_calibrate)
33749530
MD
142
143/* Session FD ioctl */
144#define LTTNG_KERNEL_METADATA \
145 _IOW(0xF6, 0x50, struct lttng_kernel_channel)
ab2277d6 146#define LTTNG_KERNEL_CHANNEL \
33749530
MD
147 _IOW(0xF6, 0x51, struct lttng_kernel_channel)
148#define LTTNG_KERNEL_SESSION_START _IO(0xF6, 0x52)
149#define LTTNG_KERNEL_SESSION_STOP _IO(0xF6, 0x53)
150
151/* Channel FD ioctl */
152#define LTTNG_KERNEL_STREAM _IO(0xF6, 0x60)
ab2277d6 153#define LTTNG_KERNEL_EVENT \
33749530 154 _IOW(0xF6, 0x61, struct lttng_kernel_event)
57a13317 155
8070f5c0
MD
156/* Event and Channel FD ioctl */
157#define LTTNG_KERNEL_CONTEXT \
158 _IOW(0xF6, 0x70, struct lttng_kernel_context)
159
e64957da
MD
160/* Event, Channel and Session ioctl */
161#define LTTNG_KERNEL_ENABLE _IO(0xF6, 0x80)
162#define LTTNG_KERNEL_DISABLE _IO(0xF6, 0x81)
163
e8951e63 164#endif /* _LTTNG_ABI_H */
This page took 0.036132 seconds and 4 git commands to generate.