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
32 #define LTTNG_UST_SYM_NAME_LEN 256
34 /* Version for comm protocol between sessiond and ust */
35 #define LTTNG_UST_COMM_VERSION_MAJOR 2
36 #define LTTNG_UST_COMM_VERSION_MINOR 0
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
43 enum lttng_ust_instrumentation
{
44 LTTNG_UST_TRACEPOINT
= 0,
46 LTTNG_UST_FUNCTION
= 2,
49 enum lttng_ust_loglevel_type
{
50 LTTNG_UST_LOGLEVEL_ALL
= 0,
51 LTTNG_UST_LOGLEVEL_RANGE
= 1,
52 LTTNG_UST_LOGLEVEL_SINGLE
= 2,
55 enum lttng_ust_output
{
59 struct lttng_ust_tracer_version
{
65 #define LTTNG_UST_CHANNEL_PADDING LTTNG_UST_SYM_NAME_LEN + 32
66 struct lttng_ust_channel
{
67 int overwrite
; /* 1: overwrite, 0: discard */
68 uint64_t subbuf_size
; /* in bytes */
70 unsigned int switch_timer_interval
; /* usecs */
71 unsigned int read_timer_interval
; /* usecs */
72 enum lttng_ust_output output
; /* output mode */
73 char padding
[LTTNG_UST_CHANNEL_PADDING
];
76 #define LTTNG_UST_STREAM_PADDING1 16
77 #define LTTNG_UST_STREAM_PADDING2 LTTNG_UST_SYM_NAME_LEN + 32
78 struct lttng_ust_stream
{
79 char padding
[LTTNG_UST_STREAM_PADDING1
];
82 char padding
[LTTNG_UST_STREAM_PADDING2
];
86 #define LTTNG_UST_EVENT_PADDING1 16
87 #define LTTNG_UST_EVENT_PADDING2 LTTNG_UST_SYM_NAME_LEN + 32
88 struct lttng_ust_event
{
89 enum lttng_ust_instrumentation instrumentation
;
90 char name
[LTTNG_UST_SYM_NAME_LEN
]; /* event name */
92 enum lttng_ust_loglevel_type loglevel_type
;
93 int loglevel
; /* value, -1: all */
94 char padding
[LTTNG_UST_EVENT_PADDING1
];
96 /* Per instrumentation type configuration */
98 char padding
[LTTNG_UST_EVENT_PADDING2
];
102 enum 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,
110 #define LTTNG_UST_FIELD_ITER_PADDING LTTNG_UST_SYM_NAME_LEN + 28
111 struct 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 */
117 char padding
[LTTNG_UST_FIELD_ITER_PADDING
];
120 enum lttng_ust_context_type
{
121 LTTNG_UST_CONTEXT_VTID
= 0,
122 LTTNG_UST_CONTEXT_VPID
= 1,
123 LTTNG_UST_CONTEXT_PTHREAD_ID
= 2,
124 LTTNG_UST_CONTEXT_PROCNAME
= 3,
127 #define LTTNG_UST_CONTEXT_PADDING1 16
128 #define LTTNG_UST_CONTEXT_PADDING2 LTTNG_UST_SYM_NAME_LEN + 32
129 struct lttng_ust_context
{
130 enum lttng_ust_context_type ctx
;
131 char padding
[LTTNG_UST_CONTEXT_PADDING1
];
134 char padding
[LTTNG_UST_CONTEXT_PADDING2
];
139 * Tracer channel attributes.
141 #define LTTNG_UST_CHANNEL_ATTR_PADDING LTTNG_UST_SYM_NAME_LEN + 32
142 struct 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 */
149 char padding
[LTTNG_UST_CHANNEL_ATTR_PADDING
];
152 #define LTTNG_UST_TRACEPOINT_ITER_PADDING 16
153 struct lttng_ust_tracepoint_iter
{
154 char name
[LTTNG_UST_SYM_NAME_LEN
]; /* provider:name */
156 char padding
[LTTNG_UST_TRACEPOINT_ITER_PADDING
];
159 #define LTTNG_UST_OBJECT_DATA_PADDING LTTNG_UST_SYM_NAME_LEN + 32
160 struct lttng_ust_object_data
{
164 uint64_t memory_map_size
;
165 char padding
[LTTNG_UST_OBJECT_DATA_PADDING
];
168 enum lttng_ust_calibrate_type
{
169 LTTNG_UST_CALIBRATE_TRACEPOINT
,
172 #define LTTNG_UST_CALIBRATE_PADDING1 16
173 #define LTTNG_UST_CALIBRATE_PADDING2 LTTNG_UST_SYM_NAME_LEN + 32
174 struct lttng_ust_calibrate
{
175 enum lttng_ust_calibrate_type type
; /* type (input) */
176 char padding
[LTTNG_UST_CALIBRATE_PADDING1
];
179 char padding
[LTTNG_UST_CALIBRATE_PADDING2
];
183 #define FILTER_BYTECODE_MAX_LEN 65536
184 #define LTTNG_UST_FILTER_PADDING 32
185 struct lttng_ust_filter_bytecode
{
187 uint32_t reloc_offset
;
189 char padding
[LTTNG_UST_FILTER_PADDING
];
193 #define _UST_CMD(minor) (minor)
194 #define _UST_CMDR(minor, type) (minor)
195 #define _UST_CMDW(minor, type) (minor)
197 /* Handled by object descriptor */
198 #define LTTNG_UST_RELEASE _UST_CMD(0x1)
200 /* Handled by object cmd */
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)
208 #define LTTNG_UST_REGISTER_DONE _UST_CMD(0x44)
209 #define LTTNG_UST_TRACEPOINT_FIELD_LIST _UST_CMD(0x45)
211 /* Session FD commands */
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)
219 /* Channel FD commands */
220 #define LTTNG_UST_STREAM _UST_CMD(0x60)
221 #define LTTNG_UST_EVENT \
222 _UST_CMDW(0x61, struct lttng_ust_event)
224 /* Event and Channel FD commands */
225 #define LTTNG_UST_CONTEXT \
226 _UST_CMDW(0x70, struct lttng_ust_context)
227 #define LTTNG_UST_FLUSH_BUFFER \
230 /* Event, Channel and Session commands */
231 #define LTTNG_UST_ENABLE _UST_CMD(0x80)
232 #define LTTNG_UST_DISABLE _UST_CMD(0x81)
234 /* Tracepoint list commands */
235 #define LTTNG_UST_TRACEPOINT_LIST_GET _UST_CMD(0x90)
236 #define LTTNG_UST_TRACEPOINT_FIELD_LIST_GET _UST_CMD(0x91)
238 /* Event FD commands */
239 #define LTTNG_UST_FILTER _UST_CMD(0xA0)
241 #define LTTNG_UST_ROOT_HANDLE 0
243 struct lttng_ust_obj
;
249 uint64_t *memory_map_size
;
254 uint64_t *memory_map_size
;
257 struct lttng_ust_field_iter entry
;
261 struct lttng_ust_objd_ops
{
262 long (*cmd
)(int objd
, unsigned int cmd
, unsigned long arg
,
263 union ust_args
*args
, void *owner
);
264 int (*release
)(int objd
);
267 /* Create root handle. Always ID 0. */
268 int lttng_abi_create_root_handle(void);
270 const struct lttng_ust_objd_ops
*objd_ops(int id
);
271 int lttng_ust_objd_unref(int id
);
273 void lttng_ust_abi_exit(void);
274 void lttng_ust_events_exit(void);
275 void lttng_ust_objd_table_owner_cleanup(void *owner
);
277 #endif /* _LTTNG_UST_ABI_H */