1 #ifndef _LTTNG_UST_ABI_H
2 #define _LTTNG_UST_ABI_H
9 * Copyright 2010-2012 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
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:
18 * The above copyright notice and this permission notice shall be included in
19 * all copies or substantial portions of the Software.
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
31 #include <lttng/ust-compiler.h>
33 #define LTTNG_UST_SYM_NAME_LEN 256
35 /* Version for comm protocol between sessiond and ust */
36 #define LTTNG_UST_COMM_VERSION_MAJOR 2
37 #define LTTNG_UST_COMM_VERSION_MINOR 0
39 /* Version for ABI between liblttng-ust, sessiond, consumerd */
40 #define LTTNG_UST_INTERNAL_MAJOR_VERSION 3
41 #define LTTNG_UST_INTERNAL_MINOR_VERSION 0
42 #define LTTNG_UST_INTERNAL_PATCHLEVEL_VERSION 0
44 enum lttng_ust_instrumentation
{
45 LTTNG_UST_TRACEPOINT
= 0,
47 LTTNG_UST_FUNCTION
= 2,
50 enum lttng_ust_loglevel_type
{
51 LTTNG_UST_LOGLEVEL_ALL
= 0,
52 LTTNG_UST_LOGLEVEL_RANGE
= 1,
53 LTTNG_UST_LOGLEVEL_SINGLE
= 2,
56 enum lttng_ust_output
{
60 struct lttng_ust_tracer_version
{
66 #define LTTNG_UST_CHANNEL_PADDING LTTNG_UST_SYM_NAME_LEN + 32
67 struct lttng_ust_channel
{
68 uint64_t subbuf_size
; /* in bytes */
70 int overwrite
; /* 1: overwrite, 0: discard */
71 unsigned int switch_timer_interval
; /* usecs */
72 unsigned int read_timer_interval
; /* usecs */
73 enum lttng_ust_output output
; /* output mode */
74 char padding
[LTTNG_UST_CHANNEL_PADDING
];
77 #define LTTNG_UST_STREAM_PADDING1 16
78 #define LTTNG_UST_STREAM_PADDING2 LTTNG_UST_SYM_NAME_LEN + 32
79 struct lttng_ust_stream
{
80 char padding
[LTTNG_UST_STREAM_PADDING1
];
83 char padding
[LTTNG_UST_STREAM_PADDING2
];
87 #define LTTNG_UST_EVENT_PADDING1 16
88 #define LTTNG_UST_EVENT_PADDING2 LTTNG_UST_SYM_NAME_LEN + 32
89 struct lttng_ust_event
{
90 enum lttng_ust_instrumentation instrumentation
;
91 char name
[LTTNG_UST_SYM_NAME_LEN
]; /* event name */
93 enum lttng_ust_loglevel_type loglevel_type
;
94 int loglevel
; /* value, -1: all */
95 char padding
[LTTNG_UST_EVENT_PADDING1
];
97 /* Per instrumentation type configuration */
99 char padding
[LTTNG_UST_EVENT_PADDING2
];
103 enum lttng_ust_field_type
{
104 LTTNG_UST_FIELD_OTHER
= 0,
105 LTTNG_UST_FIELD_INTEGER
= 1,
106 LTTNG_UST_FIELD_ENUM
= 2,
107 LTTNG_UST_FIELD_FLOAT
= 3,
108 LTTNG_UST_FIELD_STRING
= 4,
111 #define LTTNG_UST_FIELD_ITER_PADDING LTTNG_UST_SYM_NAME_LEN + 28
112 struct lttng_ust_field_iter
{
113 char event_name
[LTTNG_UST_SYM_NAME_LEN
];
114 char field_name
[LTTNG_UST_SYM_NAME_LEN
];
115 enum lttng_ust_field_type type
;
116 int loglevel
; /* event loglevel */
118 char padding
[LTTNG_UST_FIELD_ITER_PADDING
];
121 enum lttng_ust_context_type
{
122 LTTNG_UST_CONTEXT_VTID
= 0,
123 LTTNG_UST_CONTEXT_VPID
= 1,
124 LTTNG_UST_CONTEXT_PTHREAD_ID
= 2,
125 LTTNG_UST_CONTEXT_PROCNAME
= 3,
128 #define LTTNG_UST_CONTEXT_PADDING1 16
129 #define LTTNG_UST_CONTEXT_PADDING2 LTTNG_UST_SYM_NAME_LEN + 32
130 struct lttng_ust_context
{
131 enum lttng_ust_context_type ctx
;
132 char padding
[LTTNG_UST_CONTEXT_PADDING1
];
135 char padding
[LTTNG_UST_CONTEXT_PADDING2
];
140 * Tracer channel attributes.
142 #define LTTNG_UST_CHANNEL_ATTR_PADDING LTTNG_UST_SYM_NAME_LEN + 32
143 struct lttng_ust_channel_attr
{
144 uint64_t subbuf_size
; /* bytes */
145 uint64_t num_subbuf
; /* power of 2 */
146 int overwrite
; /* 1: overwrite, 0: discard */
147 unsigned int switch_timer_interval
; /* usec */
148 unsigned int read_timer_interval
; /* usec */
149 enum lttng_ust_output output
; /* splice, mmap */
150 char padding
[LTTNG_UST_CHANNEL_ATTR_PADDING
];
153 #define LTTNG_UST_TRACEPOINT_ITER_PADDING 16
154 struct lttng_ust_tracepoint_iter
{
155 char name
[LTTNG_UST_SYM_NAME_LEN
]; /* provider:name */
157 char padding
[LTTNG_UST_TRACEPOINT_ITER_PADDING
];
160 #define LTTNG_UST_OBJECT_DATA_PADDING LTTNG_UST_SYM_NAME_LEN + 32
161 struct lttng_ust_object_data
{
162 uint64_t memory_map_size
;
166 char padding
[LTTNG_UST_OBJECT_DATA_PADDING
];
169 enum lttng_ust_calibrate_type
{
170 LTTNG_UST_CALIBRATE_TRACEPOINT
,
173 #define LTTNG_UST_CALIBRATE_PADDING1 16
174 #define LTTNG_UST_CALIBRATE_PADDING2 LTTNG_UST_SYM_NAME_LEN + 32
175 struct lttng_ust_calibrate
{
176 enum lttng_ust_calibrate_type type
; /* type (input) */
177 char padding
[LTTNG_UST_CALIBRATE_PADDING1
];
180 char padding
[LTTNG_UST_CALIBRATE_PADDING2
];
184 #define FILTER_BYTECODE_MAX_LEN 65536
185 #define LTTNG_UST_FILTER_PADDING 32
186 struct lttng_ust_filter_bytecode
{
188 uint32_t reloc_offset
;
190 char padding
[LTTNG_UST_FILTER_PADDING
];
194 #define _UST_CMD(minor) (minor)
195 #define _UST_CMDR(minor, type) (minor)
196 #define _UST_CMDW(minor, type) (minor)
198 /* Handled by object descriptor */
199 #define LTTNG_UST_RELEASE _UST_CMD(0x1)
201 /* Handled by object cmd */
203 /* LTTng-UST commands */
204 #define LTTNG_UST_SESSION _UST_CMD(0x40)
205 #define LTTNG_UST_TRACER_VERSION \
206 _UST_CMDR(0x41, struct lttng_ust_tracer_version)
207 #define LTTNG_UST_TRACEPOINT_LIST _UST_CMD(0x42)
208 #define LTTNG_UST_WAIT_QUIESCENT _UST_CMD(0x43)
209 #define LTTNG_UST_REGISTER_DONE _UST_CMD(0x44)
210 #define LTTNG_UST_TRACEPOINT_FIELD_LIST _UST_CMD(0x45)
212 /* Session FD commands */
213 #define LTTNG_UST_METADATA \
214 _UST_CMDW(0x50, struct lttng_ust_channel)
215 #define LTTNG_UST_CHANNEL \
216 _UST_CMDW(0x51, struct lttng_ust_channel)
217 #define LTTNG_UST_SESSION_START _UST_CMD(0x52)
218 #define LTTNG_UST_SESSION_STOP _UST_CMD(0x53)
220 /* Channel FD commands */
221 #define LTTNG_UST_STREAM _UST_CMD(0x60)
222 #define LTTNG_UST_EVENT \
223 _UST_CMDW(0x61, struct lttng_ust_event)
225 /* Event and Channel FD commands */
226 #define LTTNG_UST_CONTEXT \
227 _UST_CMDW(0x70, struct lttng_ust_context)
228 #define LTTNG_UST_FLUSH_BUFFER \
231 /* Event, Channel and Session commands */
232 #define LTTNG_UST_ENABLE _UST_CMD(0x80)
233 #define LTTNG_UST_DISABLE _UST_CMD(0x81)
235 /* Tracepoint list commands */
236 #define LTTNG_UST_TRACEPOINT_LIST_GET _UST_CMD(0x90)
237 #define LTTNG_UST_TRACEPOINT_FIELD_LIST_GET _UST_CMD(0x91)
239 /* Event FD commands */
240 #define LTTNG_UST_FILTER _UST_CMD(0xA0)
242 #define LTTNG_UST_ROOT_HANDLE 0
244 struct lttng_ust_obj
;
250 uint64_t *memory_map_size
;
255 uint64_t *memory_map_size
;
258 struct lttng_ust_field_iter entry
;
262 struct lttng_ust_objd_ops
{
263 long (*cmd
)(int objd
, unsigned int cmd
, unsigned long arg
,
264 union ust_args
*args
, void *owner
);
265 int (*release
)(int objd
);
268 /* Create root handle. Always ID 0. */
269 int lttng_abi_create_root_handle(void);
271 const struct lttng_ust_objd_ops
*objd_ops(int id
);
272 int lttng_ust_objd_unref(int id
);
274 void lttng_ust_abi_exit(void);
275 void lttng_ust_events_exit(void);
276 void lttng_ust_objd_table_owner_cleanup(void *owner
);
278 #endif /* _LTTNG_UST_ABI_H */