Commit | Line | Data |
---|---|---|
e8951e63 MD |
1 | #ifndef _LTTNG_ABI_H |
2 | #define _LTTNG_ABI_H | |
57a13317 MD |
3 | |
4 | /* | |
e8951e63 | 5 | * lttng-abi.h |
57a13317 | 6 | * |
80996790 | 7 | * LTTng ABI header |
17baffe2 | 8 | * |
886d51a3 MD |
9 | * Copyright (C) 2010-2012 Mathieu Desnoyers <mathieu.desnoyers@efficios.com> |
10 | * | |
11 | * This library is free software; you can redistribute it and/or | |
12 | * modify it under the terms of the GNU Lesser General Public | |
13 | * License as published by the Free Software Foundation; only | |
14 | * version 2.1 of the License. | |
15 | * | |
16 | * This library is distributed in the hope that it will be useful, | |
17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
19 | * Lesser General Public License for more details. | |
20 | * | |
21 | * You should have received a copy of the GNU Lesser General Public | |
22 | * License along with this library; if not, write to the Free Software | |
23 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | |
57a13317 MD |
24 | */ |
25 | ||
26 | #include <linux/fs.h> | |
27 | ||
f8695253 | 28 | #define LTTNG_KERNEL_SYM_NAME_LEN 256 |
d6d808f3 | 29 | |
38d024ae | 30 | enum lttng_kernel_instrumentation { |
4c183524 MD |
31 | LTTNG_KERNEL_TRACEPOINT = 0, |
32 | LTTNG_KERNEL_KPROBE = 1, | |
33 | LTTNG_KERNEL_FUNCTION = 2, | |
7371f44c | 34 | LTTNG_KERNEL_KRETPROBE = 3, |
1ec65de1 | 35 | LTTNG_KERNEL_NOOP = 4, /* not hooked */ |
43880ee8 | 36 | LTTNG_KERNEL_SYSCALL = 5, |
57a13317 MD |
37 | }; |
38 | ||
96ba7208 JD |
39 | /* |
40 | * LTTng consumer mode | |
41 | */ | |
42 | enum lttng_kernel_output { | |
43 | LTTNG_KERNEL_SPLICE = 0, | |
44 | LTTNG_KERNEL_MMAP = 1, | |
45 | }; | |
46 | ||
57a13317 MD |
47 | /* |
48 | * LTTng DebugFS ABI structures. | |
49 | */ | |
8e099bae | 50 | #define LTTNG_KERNEL_CHANNEL_PADDING LTTNG_KERNEL_SYM_NAME_LEN + 32 |
38d024ae | 51 | struct lttng_kernel_channel { |
9e245ead MD |
52 | int overwrite; /* 1: overwrite, 0: discard */ |
53 | uint64_t subbuf_size; /* in bytes */ | |
80c16bcf | 54 | uint64_t num_subbuf; |
9e245ead MD |
55 | unsigned int switch_timer_interval; /* usecs */ |
56 | unsigned int read_timer_interval; /* usecs */ | |
96ba7208 | 57 | enum lttng_kernel_output output; /* splice, mmap */ |
8e099bae | 58 | char padding[LTTNG_KERNEL_CHANNEL_PADDING]; |
57a13317 MD |
59 | }; |
60 | ||
7371f44c MD |
61 | struct lttng_kernel_kretprobe { |
62 | uint64_t addr; | |
63 | ||
64 | uint64_t offset; | |
f8695253 | 65 | char symbol_name[LTTNG_KERNEL_SYM_NAME_LEN]; |
7371f44c MD |
66 | }; |
67 | ||
38d024ae MD |
68 | /* |
69 | * Either addr is used, or symbol_name and offset. | |
70 | */ | |
71 | struct lttng_kernel_kprobe { | |
80c16bcf | 72 | uint64_t addr; |
38d024ae | 73 | |
80c16bcf | 74 | uint64_t offset; |
f8695253 | 75 | char symbol_name[LTTNG_KERNEL_SYM_NAME_LEN]; |
d6d808f3 MD |
76 | }; |
77 | ||
f17701fb | 78 | struct lttng_kernel_function_tracer { |
f8695253 | 79 | char symbol_name[LTTNG_KERNEL_SYM_NAME_LEN]; |
f17701fb MD |
80 | }; |
81 | ||
43880ee8 MD |
82 | /* |
83 | * For syscall tracing, name = '\0' means "enable all". | |
84 | */ | |
8e099bae MD |
85 | #define LTTNG_KERNEL_EVENT_PADDING1 16 |
86 | #define LTTNG_KERNEL_EVENT_PADDING2 LTTNG_KERNEL_SYM_NAME_LEN + 32 | |
d6d808f3 | 87 | struct lttng_kernel_event { |
f8695253 | 88 | char name[LTTNG_KERNEL_SYM_NAME_LEN]; /* event name */ |
d6d808f3 | 89 | enum lttng_kernel_instrumentation instrumentation; |
8e099bae MD |
90 | char padding[LTTNG_KERNEL_EVENT_PADDING1]; |
91 | ||
d6d808f3 MD |
92 | /* Per instrumentation type configuration */ |
93 | union { | |
7371f44c | 94 | struct lttng_kernel_kretprobe kretprobe; |
d6d808f3 | 95 | struct lttng_kernel_kprobe kprobe; |
f17701fb | 96 | struct lttng_kernel_function_tracer ftrace; |
8e099bae | 97 | char padding[LTTNG_KERNEL_EVENT_PADDING2]; |
d6d808f3 | 98 | } u; |
38d024ae | 99 | }; |
c099397a | 100 | |
80c16bcf | 101 | struct lttng_kernel_tracer_version { |
c6c9e10f MD |
102 | uint32_t major; |
103 | uint32_t minor; | |
80c16bcf | 104 | uint32_t patchlevel; |
80c16bcf MD |
105 | }; |
106 | ||
3db41b2c MD |
107 | enum lttng_kernel_calibrate_type { |
108 | LTTNG_KERNEL_CALIBRATE_KRETPROBE, | |
57105fc2 MD |
109 | }; |
110 | ||
3db41b2c MD |
111 | struct lttng_kernel_calibrate { |
112 | enum lttng_kernel_calibrate_type type; /* type (input) */ | |
57105fc2 MD |
113 | }; |
114 | ||
12a313a5 | 115 | enum lttng_kernel_context_type { |
4c183524 MD |
116 | LTTNG_KERNEL_CONTEXT_PID = 0, |
117 | LTTNG_KERNEL_CONTEXT_PERF_COUNTER = 1, | |
a2563e83 | 118 | LTTNG_KERNEL_CONTEXT_PROCNAME = 2, |
4c183524 MD |
119 | LTTNG_KERNEL_CONTEXT_PRIO = 3, |
120 | LTTNG_KERNEL_CONTEXT_NICE = 4, | |
121 | LTTNG_KERNEL_CONTEXT_VPID = 5, | |
122 | LTTNG_KERNEL_CONTEXT_TID = 6, | |
123 | LTTNG_KERNEL_CONTEXT_VTID = 7, | |
124 | LTTNG_KERNEL_CONTEXT_PPID = 8, | |
125 | LTTNG_KERNEL_CONTEXT_VPPID = 9, | |
8070f5c0 MD |
126 | }; |
127 | ||
128 | struct lttng_kernel_perf_counter_ctx { | |
129 | uint32_t type; | |
130 | uint64_t config; | |
f8695253 | 131 | char name[LTTNG_KERNEL_SYM_NAME_LEN]; |
8070f5c0 MD |
132 | }; |
133 | ||
8e099bae MD |
134 | #define LTTNG_KERNEL_CONTEXT_PADDING1 16 |
135 | #define LTTNG_KERNEL_CONTEXT_PADDING2 LTTNG_KERNEL_SYM_NAME_LEN + 32 | |
8070f5c0 | 136 | struct lttng_kernel_context { |
12a313a5 | 137 | enum lttng_kernel_context_type ctx; |
8e099bae MD |
138 | char padding[LTTNG_KERNEL_CONTEXT_PADDING1]; |
139 | ||
8070f5c0 | 140 | union { |
8070f5c0 | 141 | struct lttng_kernel_perf_counter_ctx perf_counter; |
8e099bae | 142 | char padding[LTTNG_KERNEL_CONTEXT_PADDING2]; |
8070f5c0 MD |
143 | } u; |
144 | }; | |
145 | ||
33749530 | 146 | /* LTTng file descriptor ioctl */ |
ab2277d6 | 147 | #define LTTNG_KERNEL_SESSION _IO(0xF6, 0x40) |
33749530 MD |
148 | #define LTTNG_KERNEL_TRACER_VERSION \ |
149 | _IOR(0xF6, 0x41, struct lttng_kernel_tracer_version) | |
271b6681 | 150 | #define LTTNG_KERNEL_TRACEPOINT_LIST _IO(0xF6, 0x42) |
360f38ea | 151 | #define LTTNG_KERNEL_WAIT_QUIESCENT _IO(0xF6, 0x43) |
57105fc2 | 152 | #define LTTNG_KERNEL_CALIBRATE \ |
3db41b2c | 153 | _IOWR(0xF6, 0x44, struct lttng_kernel_calibrate) |
33749530 MD |
154 | |
155 | /* Session FD ioctl */ | |
156 | #define LTTNG_KERNEL_METADATA \ | |
157 | _IOW(0xF6, 0x50, struct lttng_kernel_channel) | |
ab2277d6 | 158 | #define LTTNG_KERNEL_CHANNEL \ |
33749530 MD |
159 | _IOW(0xF6, 0x51, struct lttng_kernel_channel) |
160 | #define LTTNG_KERNEL_SESSION_START _IO(0xF6, 0x52) | |
161 | #define LTTNG_KERNEL_SESSION_STOP _IO(0xF6, 0x53) | |
162 | ||
163 | /* Channel FD ioctl */ | |
164 | #define LTTNG_KERNEL_STREAM _IO(0xF6, 0x60) | |
ab2277d6 | 165 | #define LTTNG_KERNEL_EVENT \ |
33749530 | 166 | _IOW(0xF6, 0x61, struct lttng_kernel_event) |
57a13317 | 167 | |
8070f5c0 MD |
168 | /* Event and Channel FD ioctl */ |
169 | #define LTTNG_KERNEL_CONTEXT \ | |
170 | _IOW(0xF6, 0x70, struct lttng_kernel_context) | |
171 | ||
e64957da MD |
172 | /* Event, Channel and Session ioctl */ |
173 | #define LTTNG_KERNEL_ENABLE _IO(0xF6, 0x80) | |
174 | #define LTTNG_KERNEL_DISABLE _IO(0xF6, 0x81) | |
175 | ||
e8951e63 | 176 | #endif /* _LTTNG_ABI_H */ |