Fix: add packed attribute to filter structure
[lttng-tools.git] / src / bin / lttng-sessiond / lttng-ust-abi.h
CommitLineData
3bd1e081
MD
1#ifndef _LTTNG_UST_ABI_H
2#define _LTTNG_UST_ABI_H
3
4/*
9df8df5e 5 * lttng/ust-abi.h
3bd1e081 6 *
3bd1e081
MD
7 * LTTng-UST ABI header
8 *
ab6a6569 9 * Copyright 2010-2012 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3f3c65dc 10 *
bf74a86d
AM
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:
17 *
18 * The above copyright notice and this permission notice shall be included in
19 * all copies or substantial portions of the Software.
3bd1e081
MD
20 */
21
22#include <stdint.h>
23
57ab7638 24#define LTTNG_UST_SYM_NAME_LEN 256
3bd1e081 25
ab6a6569 26/* Version for comm protocol between sessiond and ust */
3f3c65dc
MD
27#define LTTNG_UST_COMM_VERSION_MAJOR 2
28#define LTTNG_UST_COMM_VERSION_MINOR 0
3bd1e081 29
ab6a6569
DG
30/* Version for ABI between liblttng-ust, sessiond, consumerd */
31#define LTTNG_UST_INTERNAL_MAJOR_VERSION 3
32#define LTTNG_UST_INTERNAL_MINOR_VERSION 0
33#define LTTNG_UST_INTERNAL_PATCHLEVEL_VERSION 0
34
3bd1e081 35enum lttng_ust_instrumentation {
177f8533
MD
36 LTTNG_UST_TRACEPOINT = 0,
37 LTTNG_UST_PROBE = 1,
38 LTTNG_UST_FUNCTION = 2,
0cda4f28
MD
39};
40
41enum lttng_ust_loglevel_type {
8005f29a
MD
42 LTTNG_UST_LOGLEVEL_ALL = 0,
43 LTTNG_UST_LOGLEVEL_RANGE = 1,
44 LTTNG_UST_LOGLEVEL_SINGLE = 2,
3bd1e081
MD
45};
46
47enum lttng_ust_output {
48 LTTNG_UST_MMAP = 0,
49};
50
51struct lttng_ust_tracer_version {
3f3c65dc
MD
52 uint32_t major;
53 uint32_t minor;
3bd1e081 54 uint32_t patchlevel;
3bd1e081
MD
55};
56
3f3c65dc 57#define LTTNG_UST_CHANNEL_PADDING LTTNG_UST_SYM_NAME_LEN + 32
3bd1e081 58struct lttng_ust_channel {
3bd1e081
MD
59 uint64_t subbuf_size; /* in bytes */
60 uint64_t num_subbuf;
6f30f9b8 61 int overwrite; /* 1: overwrite, 0: discard */
3bd1e081
MD
62 unsigned int switch_timer_interval; /* usecs */
63 unsigned int read_timer_interval; /* usecs */
64 enum lttng_ust_output output; /* output mode */
3f3c65dc
MD
65 char padding[LTTNG_UST_CHANNEL_PADDING];
66};
67
68#define LTTNG_UST_STREAM_PADDING1 16
69#define LTTNG_UST_STREAM_PADDING2 LTTNG_UST_SYM_NAME_LEN + 32
70struct lttng_ust_stream {
71 char padding[LTTNG_UST_STREAM_PADDING1];
72
73 union {
74 char padding[LTTNG_UST_STREAM_PADDING2];
75 } u;
3bd1e081
MD
76};
77
3f3c65dc
MD
78#define LTTNG_UST_EVENT_PADDING1 16
79#define LTTNG_UST_EVENT_PADDING2 LTTNG_UST_SYM_NAME_LEN + 32
3bd1e081 80struct lttng_ust_event {
69892bbb 81 enum lttng_ust_instrumentation instrumentation;
0cda4f28
MD
82 char name[LTTNG_UST_SYM_NAME_LEN]; /* event name */
83
84 enum lttng_ust_loglevel_type loglevel_type;
8005f29a 85 int loglevel; /* value, -1: all */
3f3c65dc 86 char padding[LTTNG_UST_EVENT_PADDING1];
0cda4f28 87
3bd1e081
MD
88 /* Per instrumentation type configuration */
89 union {
3f3c65dc 90 char padding[LTTNG_UST_EVENT_PADDING2];
3bd1e081
MD
91 } u;
92};
93
f214d69a
MD
94enum lttng_ust_field_type {
95 LTTNG_UST_FIELD_OTHER = 0,
96 LTTNG_UST_FIELD_INTEGER = 1,
97 LTTNG_UST_FIELD_ENUM = 2,
98 LTTNG_UST_FIELD_FLOAT = 3,
99 LTTNG_UST_FIELD_STRING = 4,
100};
101
ab6a6569 102#define LTTNG_UST_FIELD_ITER_PADDING LTTNG_UST_SYM_NAME_LEN + 28
f214d69a
MD
103struct lttng_ust_field_iter {
104 char event_name[LTTNG_UST_SYM_NAME_LEN];
105 char field_name[LTTNG_UST_SYM_NAME_LEN];
106 enum lttng_ust_field_type type;
107 int loglevel; /* event loglevel */
590b9e3c 108 int nowrite;
f214d69a
MD
109 char padding[LTTNG_UST_FIELD_ITER_PADDING];
110};
111
3bd1e081
MD
112enum lttng_ust_context_type {
113 LTTNG_UST_CONTEXT_VTID = 0,
114 LTTNG_UST_CONTEXT_VPID = 1,
115 LTTNG_UST_CONTEXT_PTHREAD_ID = 2,
116 LTTNG_UST_CONTEXT_PROCNAME = 3,
117};
118
3f3c65dc
MD
119#define LTTNG_UST_CONTEXT_PADDING1 16
120#define LTTNG_UST_CONTEXT_PADDING2 LTTNG_UST_SYM_NAME_LEN + 32
3bd1e081
MD
121struct lttng_ust_context {
122 enum lttng_ust_context_type ctx;
3f3c65dc
MD
123 char padding[LTTNG_UST_CONTEXT_PADDING1];
124
3bd1e081 125 union {
3f3c65dc 126 char padding[LTTNG_UST_CONTEXT_PADDING2];
3bd1e081
MD
127 } u;
128};
129
13161846
DG
130/*
131 * Tracer channel attributes.
132 */
3f3c65dc 133#define LTTNG_UST_CHANNEL_ATTR_PADDING LTTNG_UST_SYM_NAME_LEN + 32
13161846 134struct lttng_ust_channel_attr {
13161846
DG
135 uint64_t subbuf_size; /* bytes */
136 uint64_t num_subbuf; /* power of 2 */
6f30f9b8 137 int overwrite; /* 1: overwrite, 0: discard */
13161846
DG
138 unsigned int switch_timer_interval; /* usec */
139 unsigned int read_timer_interval; /* usec */
140 enum lttng_ust_output output; /* splice, mmap */
3f3c65dc 141 char padding[LTTNG_UST_CHANNEL_ATTR_PADDING];
13161846
DG
142};
143
3f3c65dc 144#define LTTNG_UST_TRACEPOINT_ITER_PADDING 16
177f8533
MD
145struct lttng_ust_tracepoint_iter {
146 char name[LTTNG_UST_SYM_NAME_LEN]; /* provider:name */
8005f29a 147 int loglevel;
3f3c65dc 148 char padding[LTTNG_UST_TRACEPOINT_ITER_PADDING];
177f8533
MD
149};
150
3f3c65dc 151#define LTTNG_UST_OBJECT_DATA_PADDING LTTNG_UST_SYM_NAME_LEN + 32
13161846
DG
152struct lttng_ust_object_data {
153 int handle;
154 int shm_fd;
155 int wait_fd;
156 uint64_t memory_map_size;
3f3c65dc 157 char padding[LTTNG_UST_OBJECT_DATA_PADDING];
13161846
DG
158};
159
f7e1a950
DG
160enum lttng_ust_calibrate_type {
161 LTTNG_UST_CALIBRATE_TRACEPOINT,
162};
163
3f3c65dc
MD
164#define LTTNG_UST_CALIBRATE_PADDING1 16
165#define LTTNG_UST_CALIBRATE_PADDING2 LTTNG_UST_SYM_NAME_LEN + 32
f7e1a950 166struct lttng_ust_calibrate {
3f3c65dc
MD
167 enum lttng_ust_calibrate_type type; /* type (input) */
168 char padding[LTTNG_UST_CALIBRATE_PADDING1];
169
170 union {
171 char padding[LTTNG_UST_CALIBRATE_PADDING2];
172 } u;
f7e1a950
DG
173};
174
d93c4f1f 175#define FILTER_BYTECODE_MAX_LEN 65536
b6bbed5f 176#define LTTNG_UST_FILTER_PADDING 32
53a80697 177struct lttng_ust_filter_bytecode {
d93c4f1f
CB
178 uint32_t len;
179 uint32_t reloc_offset;
b6bbed5f
DG
180 uint64_t seqnum;
181 char padding[LTTNG_UST_FILTER_PADDING];
53a80697
MD
182 char data[0];
183};
184
3bd1e081
MD
185#define _UST_CMD(minor) (minor)
186#define _UST_CMDR(minor, type) (minor)
187#define _UST_CMDW(minor, type) (minor)
188
189/* Handled by object descriptor */
190#define LTTNG_UST_RELEASE _UST_CMD(0x1)
191
192/* Handled by object cmd */
193
194/* LTTng-UST commands */
195#define LTTNG_UST_SESSION _UST_CMD(0x40)
196#define LTTNG_UST_TRACER_VERSION \
197 _UST_CMDR(0x41, struct lttng_ust_tracer_version)
198#define LTTNG_UST_TRACEPOINT_LIST _UST_CMD(0x42)
199#define LTTNG_UST_WAIT_QUIESCENT _UST_CMD(0x43)
200#define LTTNG_UST_REGISTER_DONE _UST_CMD(0x44)
f214d69a 201#define LTTNG_UST_TRACEPOINT_FIELD_LIST _UST_CMD(0x45)
3bd1e081
MD
202
203/* Session FD commands */
204#define LTTNG_UST_METADATA \
205 _UST_CMDW(0x50, struct lttng_ust_channel)
206#define LTTNG_UST_CHANNEL \
207 _UST_CMDW(0x51, struct lttng_ust_channel)
208#define LTTNG_UST_SESSION_START _UST_CMD(0x52)
209#define LTTNG_UST_SESSION_STOP _UST_CMD(0x53)
210
211/* Channel FD commands */
212#define LTTNG_UST_STREAM _UST_CMD(0x60)
213#define LTTNG_UST_EVENT \
214 _UST_CMDW(0x61, struct lttng_ust_event)
215
216/* Event and Channel FD commands */
217#define LTTNG_UST_CONTEXT \
218 _UST_CMDW(0x70, struct lttng_ust_context)
2bdd86d4
MD
219#define LTTNG_UST_FLUSH_BUFFER \
220 _UST_CMD(0x71)
3bd1e081
MD
221
222/* Event, Channel and Session commands */
223#define LTTNG_UST_ENABLE _UST_CMD(0x80)
224#define LTTNG_UST_DISABLE _UST_CMD(0x81)
225
8ec2d32a
MD
226/* Tracepoint list commands */
227#define LTTNG_UST_TRACEPOINT_LIST_GET _UST_CMD(0x90)
f214d69a 228#define LTTNG_UST_TRACEPOINT_FIELD_LIST_GET _UST_CMD(0x91)
8ec2d32a 229
ab6a6569
DG
230/* Event FD commands */
231#define LTTNG_UST_FILTER _UST_CMD(0xA0)
232
3bd1e081
MD
233#define LTTNG_UST_ROOT_HANDLE 0
234
9df8df5e 235struct lttng_ust_obj;
3bd1e081 236
18cef803
MD
237union ust_args {
238 struct {
239 int *shm_fd;
240 int *wait_fd;
241 uint64_t *memory_map_size;
242 } channel;
243 struct {
244 int *shm_fd;
245 int *wait_fd;
246 uint64_t *memory_map_size;
247 } stream;
da0bdb87
MD
248 struct {
249 struct lttng_ust_field_iter entry;
250 } field_list;
18cef803
MD
251};
252
9df8df5e 253struct lttng_ust_objd_ops {
18cef803
MD
254 long (*cmd)(int objd, unsigned int cmd, unsigned long arg,
255 union ust_args *args);
3bd1e081
MD
256 int (*release)(int objd);
257};
258
259/* Create root handle. Always ID 0. */
260int lttng_abi_create_root_handle(void);
261
9df8df5e
DG
262const struct lttng_ust_objd_ops *objd_ops(int id);
263int lttng_ust_objd_unref(int id);
3bd1e081
MD
264
265void lttng_ust_abi_exit(void);
9df8df5e 266void lttng_ust_events_exit(void);
3bd1e081
MD
267
268#endif /* _LTTNG_UST_ABI_H */
This page took 0.040649 seconds and 4 git commands to generate.