System call filtering
[lttng-modules.git] / lttng-abi.h
1 #ifndef _LTTNG_ABI_H
2 #define _LTTNG_ABI_H
3
4 /*
5 * lttng-abi.h
6 *
7 * LTTng ABI header
8 *
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
24 */
25
26 #include <linux/fs.h>
27
28 #define LTTNG_KERNEL_SYM_NAME_LEN 256
29
30 enum lttng_kernel_instrumentation {
31 LTTNG_KERNEL_TRACEPOINT = 0,
32 LTTNG_KERNEL_KPROBE = 1,
33 LTTNG_KERNEL_FUNCTION = 2,
34 LTTNG_KERNEL_KRETPROBE = 3,
35 LTTNG_KERNEL_NOOP = 4, /* not hooked */
36 LTTNG_KERNEL_SYSCALL = 5,
37 };
38
39 /*
40 * LTTng consumer mode
41 */
42 enum lttng_kernel_output {
43 LTTNG_KERNEL_SPLICE = 0,
44 LTTNG_KERNEL_MMAP = 1,
45 };
46
47 /*
48 * LTTng DebugFS ABI structures.
49 */
50 #define LTTNG_KERNEL_CHANNEL_PADDING LTTNG_KERNEL_SYM_NAME_LEN + 32
51 struct lttng_kernel_channel {
52 uint64_t subbuf_size; /* in bytes */
53 uint64_t num_subbuf;
54 unsigned int switch_timer_interval; /* usecs */
55 unsigned int read_timer_interval; /* usecs */
56 enum lttng_kernel_output output; /* splice, mmap */
57 int overwrite; /* 1: overwrite, 0: discard */
58 char padding[LTTNG_KERNEL_CHANNEL_PADDING];
59 }__attribute__((packed));
60
61 struct lttng_kernel_kretprobe {
62 uint64_t addr;
63
64 uint64_t offset;
65 char symbol_name[LTTNG_KERNEL_SYM_NAME_LEN];
66 }__attribute__((packed));
67
68 /*
69 * Either addr is used, or symbol_name and offset.
70 */
71 struct lttng_kernel_kprobe {
72 uint64_t addr;
73
74 uint64_t offset;
75 char symbol_name[LTTNG_KERNEL_SYM_NAME_LEN];
76 }__attribute__((packed));
77
78 struct lttng_kernel_function_tracer {
79 char symbol_name[LTTNG_KERNEL_SYM_NAME_LEN];
80 }__attribute__((packed));
81
82 struct lttng_kernel_syscall {
83 char disable;
84 } __attribute__((packed));
85
86 /*
87 * For syscall tracing, name = '\0' means "enable all".
88 */
89 #define LTTNG_KERNEL_EVENT_PADDING1 16
90 #define LTTNG_KERNEL_EVENT_PADDING2 LTTNG_KERNEL_SYM_NAME_LEN + 32
91 struct lttng_kernel_event {
92 char name[LTTNG_KERNEL_SYM_NAME_LEN]; /* event name */
93 enum lttng_kernel_instrumentation instrumentation;
94 char padding[LTTNG_KERNEL_EVENT_PADDING1];
95
96 /* Per instrumentation type configuration */
97 union {
98 struct lttng_kernel_kretprobe kretprobe;
99 struct lttng_kernel_kprobe kprobe;
100 struct lttng_kernel_function_tracer ftrace;
101 struct lttng_kernel_syscall syscall;
102 char padding[LTTNG_KERNEL_EVENT_PADDING2];
103 } u;
104 }__attribute__((packed));
105
106 struct lttng_kernel_tracer_version {
107 uint32_t major;
108 uint32_t minor;
109 uint32_t patchlevel;
110 }__attribute__((packed));
111
112 enum lttng_kernel_calibrate_type {
113 LTTNG_KERNEL_CALIBRATE_KRETPROBE,
114 };
115
116 struct lttng_kernel_calibrate {
117 enum lttng_kernel_calibrate_type type; /* type (input) */
118 }__attribute__((packed));
119
120 enum lttng_kernel_context_type {
121 LTTNG_KERNEL_CONTEXT_PID = 0,
122 LTTNG_KERNEL_CONTEXT_PERF_COUNTER = 1,
123 LTTNG_KERNEL_CONTEXT_PROCNAME = 2,
124 LTTNG_KERNEL_CONTEXT_PRIO = 3,
125 LTTNG_KERNEL_CONTEXT_NICE = 4,
126 LTTNG_KERNEL_CONTEXT_VPID = 5,
127 LTTNG_KERNEL_CONTEXT_TID = 6,
128 LTTNG_KERNEL_CONTEXT_VTID = 7,
129 LTTNG_KERNEL_CONTEXT_PPID = 8,
130 LTTNG_KERNEL_CONTEXT_VPPID = 9,
131 LTTNG_KERNEL_CONTEXT_HOSTNAME = 10,
132 };
133
134 struct lttng_kernel_perf_counter_ctx {
135 uint32_t type;
136 uint64_t config;
137 char name[LTTNG_KERNEL_SYM_NAME_LEN];
138 }__attribute__((packed));
139
140 #define LTTNG_KERNEL_CONTEXT_PADDING1 16
141 #define LTTNG_KERNEL_CONTEXT_PADDING2 LTTNG_KERNEL_SYM_NAME_LEN + 32
142 struct lttng_kernel_context {
143 enum lttng_kernel_context_type ctx;
144 char padding[LTTNG_KERNEL_CONTEXT_PADDING1];
145
146 union {
147 struct lttng_kernel_perf_counter_ctx perf_counter;
148 char padding[LTTNG_KERNEL_CONTEXT_PADDING2];
149 } u;
150 }__attribute__((packed));
151
152 /* LTTng file descriptor ioctl */
153 #define LTTNG_KERNEL_SESSION _IO(0xF6, 0x45)
154 #define LTTNG_KERNEL_TRACER_VERSION \
155 _IOR(0xF6, 0x46, struct lttng_kernel_tracer_version)
156 #define LTTNG_KERNEL_TRACEPOINT_LIST _IO(0xF6, 0x47)
157 #define LTTNG_KERNEL_WAIT_QUIESCENT _IO(0xF6, 0x48)
158 #define LTTNG_KERNEL_CALIBRATE \
159 _IOWR(0xF6, 0x49, struct lttng_kernel_calibrate)
160
161 /* Session FD ioctl */
162 #define LTTNG_KERNEL_METADATA \
163 _IOW(0xF6, 0x54, struct lttng_kernel_channel)
164 #define LTTNG_KERNEL_CHANNEL \
165 _IOW(0xF6, 0x55, struct lttng_kernel_channel)
166 #define LTTNG_KERNEL_SESSION_START _IO(0xF6, 0x56)
167 #define LTTNG_KERNEL_SESSION_STOP _IO(0xF6, 0x57)
168
169 /* Channel FD ioctl */
170 #define LTTNG_KERNEL_STREAM _IO(0xF6, 0x62)
171 #define LTTNG_KERNEL_EVENT \
172 _IOW(0xF6, 0x63, struct lttng_kernel_event)
173
174 /* Event and Channel FD ioctl */
175 #define LTTNG_KERNEL_CONTEXT \
176 _IOW(0xF6, 0x71, struct lttng_kernel_context)
177
178 /* Event, Channel and Session ioctl */
179 #define LTTNG_KERNEL_ENABLE _IO(0xF6, 0x82)
180 #define LTTNG_KERNEL_DISABLE _IO(0xF6, 0x83)
181
182 /* LTTng-specific ioctls for the lib ringbuffer */
183 /* returns the timestamp begin of the current sub-buffer */
184 #define LTTNG_RING_BUFFER_GET_TIMESTAMP_BEGIN _IOR(0xF6, 0x20, uint64_t)
185 /* returns the timestamp end of the current sub-buffer */
186 #define LTTNG_RING_BUFFER_GET_TIMESTAMP_END _IOR(0xF6, 0x21, uint64_t)
187 /* returns the number of events discarded */
188 #define LTTNG_RING_BUFFER_GET_EVENTS_DISCARDED _IOR(0xF6, 0x22, uint64_t)
189 /* returns the packet payload size */
190 #define LTTNG_RING_BUFFER_GET_CONTENT_SIZE _IOR(0xF6, 0x23, uint64_t)
191 /* returns the actual packet size */
192 #define LTTNG_RING_BUFFER_GET_PACKET_SIZE _IOR(0xF6, 0x24, uint64_t)
193 /* returns the stream id */
194 #define LTTNG_RING_BUFFER_GET_STREAM_ID _IOR(0xF6, 0x25, uint64_t)
195 /* returns the current timestamp */
196 #define LTTNG_RING_BUFFER_GET_CURRENT_TIMESTAMP _IOR(0xF6, 0x26, uint64_t)
197
198 #ifdef CONFIG_COMPAT
199 /* returns the timestamp begin of the current sub-buffer */
200 #define LTTNG_RING_BUFFER_COMPAT_GET_TIMESTAMP_BEGIN \
201 LTTNG_RING_BUFFER_GET_TIMESTAMP_BEGIN
202 /* returns the timestamp end of the current sub-buffer */
203 #define LTTNG_RING_BUFFER_COMPAT_GET_TIMESTAMP_END \
204 LTTNG_RING_BUFFER_GET_TIMESTAMP_END
205 /* returns the number of events discarded */
206 #define LTTNG_RING_BUFFER_COMPAT_GET_EVENTS_DISCARDED \
207 LTTNG_RING_BUFFER_GET_EVENTS_DISCARDED
208 /* returns the packet payload size */
209 #define LTTNG_RING_BUFFER_COMPAT_GET_CONTENT_SIZE \
210 LTTNG_RING_BUFFER_GET_CONTENT_SIZE
211 /* returns the actual packet size */
212 #define LTTNG_RING_BUFFER_COMPAT_GET_PACKET_SIZE \
213 LTTNG_RING_BUFFER_GET_PACKET_SIZE
214 /* returns the stream id */
215 #define LTTNG_RING_BUFFER_COMPAT_GET_STREAM_ID \
216 LTTNG_RING_BUFFER_GET_STREAM_ID
217 /* returns the current timestamp */
218 #define LTTNG_RING_BUFFER_COMPAT_GET_CURRENT_TIMESTAMP \
219 LTTNG_RING_BUFFER_GET_CURRENT_TIMESTAMP
220 #endif /* CONFIG_COMPAT */
221
222 #endif /* _LTTNG_ABI_H */
This page took 0.039282 seconds and 5 git commands to generate.