Cleanup lttng-gen-tp: Help not showing when using -h,--help
[lttng-ust.git] / include / lttng / ust-abi.h
CommitLineData
9f3fdbc6
MD
1#ifndef _LTTNG_UST_ABI_H
2#define _LTTNG_UST_ABI_H
3
4/*
4318ae1b 5 * lttng/ust-abi.h
9f3fdbc6 6 *
9f3fdbc6
MD
7 * LTTng-UST ABI header
8 *
e92f3e28
MD
9 * Copyright 2010-2012 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 *
11 * Permission is hereby granted, free of charge, to any person obtaining a copy
12 * of this software and associated documentation files (the "Software"), to deal
13 * in the Software without restriction, including without limitation the rights
14 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15 * copies of the Software, and to permit persons to whom the Software is
16 * furnished to do so, subject to the following conditions:
a60d70e6 17 *
e92f3e28
MD
18 * The above copyright notice and this permission notice shall be included in
19 * all copies or substantial portions of the Software.
d2428e87
MD
20 *
21 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27 * SOFTWARE.
9f3fdbc6
MD
28 */
29
0a42beb6
MD
30#include <stdint.h>
31
f56cd1d5 32#define LTTNG_UST_SYM_NAME_LEN 256
9f3fdbc6 33
0f4eaec3 34/* Version for comm protocol between sessiond and ust */
1332bb04
MD
35#define LTTNG_UST_COMM_VERSION_MAJOR 2
36#define LTTNG_UST_COMM_VERSION_MINOR 0
b35d179d 37
0f4eaec3
MD
38/* Version for ABI between liblttng-ust, sessiond, consumerd */
39#define LTTNG_UST_INTERNAL_MAJOR_VERSION 3
40#define LTTNG_UST_INTERNAL_MINOR_VERSION 0
41#define LTTNG_UST_INTERNAL_PATCHLEVEL_VERSION 0
42
9f3fdbc6 43enum lttng_ust_instrumentation {
df854e41
MD
44 LTTNG_UST_TRACEPOINT = 0,
45 LTTNG_UST_PROBE = 1,
46 LTTNG_UST_FUNCTION = 2,
6b0e60f1
MD
47};
48
49enum lttng_ust_loglevel_type {
882a56d7
MD
50 LTTNG_UST_LOGLEVEL_ALL = 0,
51 LTTNG_UST_LOGLEVEL_RANGE = 1,
52 LTTNG_UST_LOGLEVEL_SINGLE = 2,
9f3fdbc6
MD
53};
54
9f3fdbc6 55enum lttng_ust_output {
b35d179d 56 LTTNG_UST_MMAP = 0,
9f3fdbc6
MD
57};
58
b35d179d 59struct lttng_ust_tracer_version {
b728d87e
MD
60 uint32_t major;
61 uint32_t minor;
b35d179d 62 uint32_t patchlevel;
b35d179d 63};
9f3fdbc6 64
1332bb04 65#define LTTNG_UST_CHANNEL_PADDING LTTNG_UST_SYM_NAME_LEN + 32
9f3fdbc6
MD
66struct lttng_ust_channel {
67 int overwrite; /* 1: overwrite, 0: discard */
68 uint64_t subbuf_size; /* in bytes */
69 uint64_t num_subbuf;
70 unsigned int switch_timer_interval; /* usecs */
71 unsigned int read_timer_interval; /* usecs */
b35d179d 72 enum lttng_ust_output output; /* output mode */
1332bb04 73 char padding[LTTNG_UST_CHANNEL_PADDING];
9f3fdbc6
MD
74};
75
1332bb04
MD
76#define LTTNG_UST_STREAM_PADDING1 16
77#define LTTNG_UST_STREAM_PADDING2 LTTNG_UST_SYM_NAME_LEN + 32
381c0f1e 78struct lttng_ust_stream {
1332bb04
MD
79 char padding[LTTNG_UST_STREAM_PADDING1];
80
81 union {
82 char padding[LTTNG_UST_STREAM_PADDING2];
83 } u;
381c0f1e
MD
84};
85
1332bb04
MD
86#define LTTNG_UST_EVENT_PADDING1 16
87#define LTTNG_UST_EVENT_PADDING2 LTTNG_UST_SYM_NAME_LEN + 32
9f3fdbc6 88struct lttng_ust_event {
9f3fdbc6 89 enum lttng_ust_instrumentation instrumentation;
6b0e60f1
MD
90 char name[LTTNG_UST_SYM_NAME_LEN]; /* event name */
91
92 enum lttng_ust_loglevel_type loglevel_type;
882a56d7 93 int loglevel; /* value, -1: all */
1332bb04 94 char padding[LTTNG_UST_EVENT_PADDING1];
6b0e60f1 95
9f3fdbc6
MD
96 /* Per instrumentation type configuration */
97 union {
1332bb04 98 char padding[LTTNG_UST_EVENT_PADDING2];
9f3fdbc6
MD
99 } u;
100};
101
06d4f27e
MD
102enum lttng_ust_field_type {
103 LTTNG_UST_FIELD_OTHER = 0,
104 LTTNG_UST_FIELD_INTEGER = 1,
105 LTTNG_UST_FIELD_ENUM = 2,
106 LTTNG_UST_FIELD_FLOAT = 3,
107 LTTNG_UST_FIELD_STRING = 4,
108};
109
38cb8991 110#define LTTNG_UST_FIELD_ITER_PADDING LTTNG_UST_SYM_NAME_LEN + 28
06d4f27e
MD
111struct lttng_ust_field_iter {
112 char event_name[LTTNG_UST_SYM_NAME_LEN];
113 char field_name[LTTNG_UST_SYM_NAME_LEN];
114 enum lttng_ust_field_type type;
115 int loglevel; /* event loglevel */
180901e6 116 int nowrite;
06d4f27e
MD
117 char padding[LTTNG_UST_FIELD_ITER_PADDING];
118};
119
9f3fdbc6 120enum lttng_ust_context_type {
3b402b40 121 LTTNG_UST_CONTEXT_VTID = 0,
c1ef86f0
MD
122 LTTNG_UST_CONTEXT_VPID = 1,
123 LTTNG_UST_CONTEXT_PTHREAD_ID = 2,
4847e9bb 124 LTTNG_UST_CONTEXT_PROCNAME = 3,
9f3fdbc6
MD
125};
126
1332bb04
MD
127#define LTTNG_UST_CONTEXT_PADDING1 16
128#define LTTNG_UST_CONTEXT_PADDING2 LTTNG_UST_SYM_NAME_LEN + 32
9f3fdbc6
MD
129struct lttng_ust_context {
130 enum lttng_ust_context_type ctx;
1332bb04
MD
131 char padding[LTTNG_UST_CONTEXT_PADDING1];
132
9f3fdbc6 133 union {
1332bb04 134 char padding[LTTNG_UST_CONTEXT_PADDING2];
9f3fdbc6
MD
135 } u;
136};
137
92462b01
MD
138/*
139 * Tracer channel attributes.
140 */
1332bb04 141#define LTTNG_UST_CHANNEL_ATTR_PADDING LTTNG_UST_SYM_NAME_LEN + 32
92462b01
MD
142struct lttng_ust_channel_attr {
143 int overwrite; /* 1: overwrite, 0: discard */
144 uint64_t subbuf_size; /* bytes */
145 uint64_t num_subbuf; /* power of 2 */
146 unsigned int switch_timer_interval; /* usec */
147 unsigned int read_timer_interval; /* usec */
148 enum lttng_ust_output output; /* splice, mmap */
1332bb04 149 char padding[LTTNG_UST_CHANNEL_ATTR_PADDING];
92462b01
MD
150};
151
1332bb04 152#define LTTNG_UST_TRACEPOINT_ITER_PADDING 16
cbef6901
MD
153struct lttng_ust_tracepoint_iter {
154 char name[LTTNG_UST_SYM_NAME_LEN]; /* provider:name */
882a56d7 155 int loglevel;
1332bb04 156 char padding[LTTNG_UST_TRACEPOINT_ITER_PADDING];
cbef6901
MD
157};
158
1332bb04 159#define LTTNG_UST_OBJECT_DATA_PADDING LTTNG_UST_SYM_NAME_LEN + 32
92462b01
MD
160struct lttng_ust_object_data {
161 int handle;
162 int shm_fd;
163 int wait_fd;
164 uint64_t memory_map_size;
1332bb04 165 char padding[LTTNG_UST_OBJECT_DATA_PADDING];
92462b01
MD
166};
167
d9a9a33b
MD
168enum lttng_ust_calibrate_type {
169 LTTNG_UST_CALIBRATE_TRACEPOINT,
170};
171
1332bb04
MD
172#define LTTNG_UST_CALIBRATE_PADDING1 16
173#define LTTNG_UST_CALIBRATE_PADDING2 LTTNG_UST_SYM_NAME_LEN + 32
d9a9a33b
MD
174struct lttng_ust_calibrate {
175 enum lttng_ust_calibrate_type type; /* type (input) */
1332bb04
MD
176 char padding[LTTNG_UST_CALIBRATE_PADDING1];
177
178 union {
179 char padding[LTTNG_UST_CALIBRATE_PADDING2];
180 } u;
d9a9a33b
MD
181};
182
5b4839a8 183#define FILTER_BYTECODE_MAX_LEN 65536
a5930599 184#define LTTNG_UST_FILTER_PADDING 32
2d78951a 185struct lttng_ust_filter_bytecode {
2734ca65
CB
186 uint32_t len;
187 uint32_t reloc_offset;
3f6fd224 188 uint64_t seqnum;
a5930599 189 char padding[LTTNG_UST_FILTER_PADDING];
2d78951a
MD
190 char data[0];
191};
192
9f3fdbc6
MD
193#define _UST_CMD(minor) (minor)
194#define _UST_CMDR(minor, type) (minor)
195#define _UST_CMDW(minor, type) (minor)
196
46050b1a
MD
197/* Handled by object descriptor */
198#define LTTNG_UST_RELEASE _UST_CMD(0x1)
199
200/* Handled by object cmd */
201
9f3fdbc6
MD
202/* LTTng-UST commands */
203#define LTTNG_UST_SESSION _UST_CMD(0x40)
204#define LTTNG_UST_TRACER_VERSION \
205 _UST_CMDR(0x41, struct lttng_ust_tracer_version)
206#define LTTNG_UST_TRACEPOINT_LIST _UST_CMD(0x42)
207#define LTTNG_UST_WAIT_QUIESCENT _UST_CMD(0x43)
11ff9c7d 208#define LTTNG_UST_REGISTER_DONE _UST_CMD(0x44)
06d4f27e 209#define LTTNG_UST_TRACEPOINT_FIELD_LIST _UST_CMD(0x45)
9f3fdbc6 210
46050b1a 211/* Session FD commands */
9f3fdbc6
MD
212#define LTTNG_UST_METADATA \
213 _UST_CMDW(0x50, struct lttng_ust_channel)
214#define LTTNG_UST_CHANNEL \
215 _UST_CMDW(0x51, struct lttng_ust_channel)
216#define LTTNG_UST_SESSION_START _UST_CMD(0x52)
217#define LTTNG_UST_SESSION_STOP _UST_CMD(0x53)
218
46050b1a 219/* Channel FD commands */
9f3fdbc6
MD
220#define LTTNG_UST_STREAM _UST_CMD(0x60)
221#define LTTNG_UST_EVENT \
222 _UST_CMDW(0x61, struct lttng_ust_event)
223
46050b1a 224/* Event and Channel FD commands */
9f3fdbc6
MD
225#define LTTNG_UST_CONTEXT \
226 _UST_CMDW(0x70, struct lttng_ust_context)
43d330a4 227#define LTTNG_UST_FLUSH_BUFFER \
43861eab 228 _UST_CMD(0x71)
9f3fdbc6 229
46050b1a 230/* Event, Channel and Session commands */
9f3fdbc6
MD
231#define LTTNG_UST_ENABLE _UST_CMD(0x80)
232#define LTTNG_UST_DISABLE _UST_CMD(0x81)
233
51489cad
MD
234/* Tracepoint list commands */
235#define LTTNG_UST_TRACEPOINT_LIST_GET _UST_CMD(0x90)
06d4f27e 236#define LTTNG_UST_TRACEPOINT_FIELD_LIST_GET _UST_CMD(0x91)
51489cad 237
2d78951a
MD
238/* Event FD commands */
239#define LTTNG_UST_FILTER _UST_CMD(0xA0)
240
46050b1a
MD
241#define LTTNG_UST_ROOT_HANDLE 0
242
b61ce3b2 243struct lttng_ust_obj;
46050b1a 244
ef9ff354
MD
245union ust_args {
246 struct {
247 int *shm_fd;
248 int *wait_fd;
249 uint64_t *memory_map_size;
250 } channel;
251 struct {
252 int *shm_fd;
253 int *wait_fd;
254 uint64_t *memory_map_size;
255 } stream;
40003310
MD
256 struct {
257 struct lttng_ust_field_iter entry;
258 } field_list;
ef9ff354
MD
259};
260
b61ce3b2 261struct lttng_ust_objd_ops {
ef9ff354 262 long (*cmd)(int objd, unsigned int cmd, unsigned long arg,
f59ed768 263 union ust_args *args, void *owner);
46050b1a
MD
264 int (*release)(int objd);
265};
266
267/* Create root handle. Always ID 0. */
268int lttng_abi_create_root_handle(void);
269
b61ce3b2 270const struct lttng_ust_objd_ops *objd_ops(int id);
d4419b81 271int lttng_ust_objd_unref(int id);
46050b1a
MD
272
273void lttng_ust_abi_exit(void);
003fedf4 274void lttng_ust_events_exit(void);
f59ed768 275void lttng_ust_objd_table_owner_cleanup(void *owner);
b35d179d 276
9f3fdbc6 277#endif /* _LTTNG_UST_ABI_H */
This page took 0.040648 seconds and 4 git commands to generate.