Fix: compile lttng_statedump_process_ns on Ubuntu
[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 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 30enum 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 */
42enum 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 51struct lttng_kernel_channel {
9e245ead 52 uint64_t subbuf_size; /* in bytes */
80c16bcf 53 uint64_t num_subbuf;
9e245ead
MD
54 unsigned int switch_timer_interval; /* usecs */
55 unsigned int read_timer_interval; /* usecs */
96ba7208 56 enum lttng_kernel_output output; /* splice, mmap */
6dccd6c1 57 int overwrite; /* 1: overwrite, 0: discard */
8e099bae 58 char padding[LTTNG_KERNEL_CHANNEL_PADDING];
1a598612 59} __attribute__((packed));
57a13317 60
7371f44c
MD
61struct lttng_kernel_kretprobe {
62 uint64_t addr;
63
64 uint64_t offset;
f8695253 65 char symbol_name[LTTNG_KERNEL_SYM_NAME_LEN];
1a598612 66} __attribute__((packed));
7371f44c 67
38d024ae
MD
68/*
69 * Either addr is used, or symbol_name and offset.
70 */
71struct 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];
1a598612 76} __attribute__((packed));
d6d808f3 77
f17701fb 78struct lttng_kernel_function_tracer {
f8695253 79 char symbol_name[LTTNG_KERNEL_SYM_NAME_LEN];
1a598612 80} __attribute__((packed));
f17701fb 81
80f87dd2 82struct lttng_kernel_syscall {
4ee2453d 83 char enable;
80f87dd2
MD
84} __attribute__((packed));
85
43880ee8
MD
86/*
87 * For syscall tracing, name = '\0' means "enable all".
88 */
8e099bae
MD
89#define LTTNG_KERNEL_EVENT_PADDING1 16
90#define LTTNG_KERNEL_EVENT_PADDING2 LTTNG_KERNEL_SYM_NAME_LEN + 32
d6d808f3 91struct lttng_kernel_event {
f8695253 92 char name[LTTNG_KERNEL_SYM_NAME_LEN]; /* event name */
d6d808f3 93 enum lttng_kernel_instrumentation instrumentation;
8e099bae
MD
94 char padding[LTTNG_KERNEL_EVENT_PADDING1];
95
d6d808f3
MD
96 /* Per instrumentation type configuration */
97 union {
7371f44c 98 struct lttng_kernel_kretprobe kretprobe;
d6d808f3 99 struct lttng_kernel_kprobe kprobe;
f17701fb 100 struct lttng_kernel_function_tracer ftrace;
80f87dd2 101 struct lttng_kernel_syscall syscall;
8e099bae 102 char padding[LTTNG_KERNEL_EVENT_PADDING2];
d6d808f3 103 } u;
1a598612 104} __attribute__((packed));
c099397a 105
80c16bcf 106struct lttng_kernel_tracer_version {
c6c9e10f
MD
107 uint32_t major;
108 uint32_t minor;
80c16bcf 109 uint32_t patchlevel;
1a598612 110} __attribute__((packed));
80c16bcf 111
3db41b2c
MD
112enum lttng_kernel_calibrate_type {
113 LTTNG_KERNEL_CALIBRATE_KRETPROBE,
57105fc2
MD
114};
115
3db41b2c
MD
116struct lttng_kernel_calibrate {
117 enum lttng_kernel_calibrate_type type; /* type (input) */
1a598612 118} __attribute__((packed));
57105fc2 119
12e579db
MD
120struct lttng_kernel_syscall_mask {
121 uint32_t len; /* in bits */
122 char mask[];
123} __attribute__((packed));
124
12a313a5 125enum lttng_kernel_context_type {
4c183524
MD
126 LTTNG_KERNEL_CONTEXT_PID = 0,
127 LTTNG_KERNEL_CONTEXT_PERF_COUNTER = 1,
a2563e83 128 LTTNG_KERNEL_CONTEXT_PROCNAME = 2,
4c183524
MD
129 LTTNG_KERNEL_CONTEXT_PRIO = 3,
130 LTTNG_KERNEL_CONTEXT_NICE = 4,
131 LTTNG_KERNEL_CONTEXT_VPID = 5,
132 LTTNG_KERNEL_CONTEXT_TID = 6,
133 LTTNG_KERNEL_CONTEXT_VTID = 7,
134 LTTNG_KERNEL_CONTEXT_PPID = 8,
135 LTTNG_KERNEL_CONTEXT_VPPID = 9,
975da2c0 136 LTTNG_KERNEL_CONTEXT_HOSTNAME = 10,
8070f5c0
MD
137};
138
139struct lttng_kernel_perf_counter_ctx {
140 uint32_t type;
141 uint64_t config;
f8695253 142 char name[LTTNG_KERNEL_SYM_NAME_LEN];
1a598612 143} __attribute__((packed));
8070f5c0 144
8e099bae
MD
145#define LTTNG_KERNEL_CONTEXT_PADDING1 16
146#define LTTNG_KERNEL_CONTEXT_PADDING2 LTTNG_KERNEL_SYM_NAME_LEN + 32
8070f5c0 147struct lttng_kernel_context {
12a313a5 148 enum lttng_kernel_context_type ctx;
8e099bae
MD
149 char padding[LTTNG_KERNEL_CONTEXT_PADDING1];
150
8070f5c0 151 union {
8070f5c0 152 struct lttng_kernel_perf_counter_ctx perf_counter;
8e099bae 153 char padding[LTTNG_KERNEL_CONTEXT_PADDING2];
8070f5c0 154 } u;
1a598612 155} __attribute__((packed));
8070f5c0 156
33749530 157/* LTTng file descriptor ioctl */
6dccd6c1 158#define LTTNG_KERNEL_SESSION _IO(0xF6, 0x45)
33749530 159#define LTTNG_KERNEL_TRACER_VERSION \
6dccd6c1
JD
160 _IOR(0xF6, 0x46, struct lttng_kernel_tracer_version)
161#define LTTNG_KERNEL_TRACEPOINT_LIST _IO(0xF6, 0x47)
162#define LTTNG_KERNEL_WAIT_QUIESCENT _IO(0xF6, 0x48)
57105fc2 163#define LTTNG_KERNEL_CALIBRATE \
6dccd6c1 164 _IOWR(0xF6, 0x49, struct lttng_kernel_calibrate)
2d2464bd 165#define LTTNG_KERNEL_SYSCALL_LIST _IO(0xF6, 0x49)
33749530
MD
166
167/* Session FD ioctl */
168#define LTTNG_KERNEL_METADATA \
6dccd6c1 169 _IOW(0xF6, 0x54, struct lttng_kernel_channel)
ab2277d6 170#define LTTNG_KERNEL_CHANNEL \
6dccd6c1
JD
171 _IOW(0xF6, 0x55, struct lttng_kernel_channel)
172#define LTTNG_KERNEL_SESSION_START _IO(0xF6, 0x56)
173#define LTTNG_KERNEL_SESSION_STOP _IO(0xF6, 0x57)
33749530
MD
174
175/* Channel FD ioctl */
6dccd6c1 176#define LTTNG_KERNEL_STREAM _IO(0xF6, 0x62)
ab2277d6 177#define LTTNG_KERNEL_EVENT \
6dccd6c1 178 _IOW(0xF6, 0x63, struct lttng_kernel_event)
12e579db
MD
179#define LTTNG_KERNEL_SYSCALL_MASK \
180 _IOWR(0xF6, 0x64, struct lttng_kernel_syscall_mask)
57a13317 181
8070f5c0
MD
182/* Event and Channel FD ioctl */
183#define LTTNG_KERNEL_CONTEXT \
6dccd6c1 184 _IOW(0xF6, 0x71, struct lttng_kernel_context)
8070f5c0 185
e64957da 186/* Event, Channel and Session ioctl */
6dccd6c1
JD
187#define LTTNG_KERNEL_ENABLE _IO(0xF6, 0x82)
188#define LTTNG_KERNEL_DISABLE _IO(0xF6, 0x83)
e64957da 189
3b731ab1
JD
190/* LTTng-specific ioctls for the lib ringbuffer */
191/* returns the timestamp begin of the current sub-buffer */
192#define LTTNG_RING_BUFFER_GET_TIMESTAMP_BEGIN _IOR(0xF6, 0x20, uint64_t)
193/* returns the timestamp end of the current sub-buffer */
194#define LTTNG_RING_BUFFER_GET_TIMESTAMP_END _IOR(0xF6, 0x21, uint64_t)
195/* returns the number of events discarded */
196#define LTTNG_RING_BUFFER_GET_EVENTS_DISCARDED _IOR(0xF6, 0x22, uint64_t)
197/* returns the packet payload size */
198#define LTTNG_RING_BUFFER_GET_CONTENT_SIZE _IOR(0xF6, 0x23, uint64_t)
199/* returns the actual packet size */
200#define LTTNG_RING_BUFFER_GET_PACKET_SIZE _IOR(0xF6, 0x24, uint64_t)
201/* returns the stream id */
202#define LTTNG_RING_BUFFER_GET_STREAM_ID _IOR(0xF6, 0x25, uint64_t)
2348ca17
JD
203/* returns the current timestamp */
204#define LTTNG_RING_BUFFER_GET_CURRENT_TIMESTAMP _IOR(0xF6, 0x26, uint64_t)
3b731ab1
JD
205
206#ifdef CONFIG_COMPAT
207/* returns the timestamp begin of the current sub-buffer */
208#define LTTNG_RING_BUFFER_COMPAT_GET_TIMESTAMP_BEGIN \
209 LTTNG_RING_BUFFER_GET_TIMESTAMP_BEGIN
210/* returns the timestamp end of the current sub-buffer */
211#define LTTNG_RING_BUFFER_COMPAT_GET_TIMESTAMP_END \
212 LTTNG_RING_BUFFER_GET_TIMESTAMP_END
213/* returns the number of events discarded */
214#define LTTNG_RING_BUFFER_COMPAT_GET_EVENTS_DISCARDED \
215 LTTNG_RING_BUFFER_GET_EVENTS_DISCARDED
216/* returns the packet payload size */
217#define LTTNG_RING_BUFFER_COMPAT_GET_CONTENT_SIZE \
218 LTTNG_RING_BUFFER_GET_CONTENT_SIZE
219/* returns the actual packet size */
220#define LTTNG_RING_BUFFER_COMPAT_GET_PACKET_SIZE \
221 LTTNG_RING_BUFFER_GET_PACKET_SIZE
222/* returns the stream id */
223#define LTTNG_RING_BUFFER_COMPAT_GET_STREAM_ID \
224 LTTNG_RING_BUFFER_GET_STREAM_ID
2348ca17
JD
225/* returns the current timestamp */
226#define LTTNG_RING_BUFFER_COMPAT_GET_CURRENT_TIMESTAMP \
227 LTTNG_RING_BUFFER_GET_CURRENT_TIMESTAMP
3b731ab1
JD
228#endif /* CONFIG_COMPAT */
229
e8951e63 230#endif /* _LTTNG_ABI_H */
This page took 0.038763 seconds and 4 git commands to generate.