License header fixes
[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
MD
6 *
7 * Copyright 2010-2011 (c) - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 *
9 * LTTng-UST ABI header
10 *
3f3c65dc
MD
11 * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
12 * OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
13 *
14 * Permission is hereby granted to use or copy this program
15 * for any purpose, provided the above notices are retained on all copies.
16 * Permission to modify the code and to distribute modified code is granted,
17 * provided the above notices are retained, and a notice that the code was
18 * modified is included with the above copyright notice.
3bd1e081
MD
19 */
20
21#include <stdint.h>
22
57ab7638 23#define LTTNG_UST_SYM_NAME_LEN 256
3bd1e081 24
3f3c65dc
MD
25#define LTTNG_UST_COMM_VERSION_MAJOR 2
26#define LTTNG_UST_COMM_VERSION_MINOR 0
3bd1e081
MD
27
28enum lttng_ust_instrumentation {
177f8533
MD
29 LTTNG_UST_TRACEPOINT = 0,
30 LTTNG_UST_PROBE = 1,
31 LTTNG_UST_FUNCTION = 2,
0cda4f28
MD
32};
33
34enum lttng_ust_loglevel_type {
8005f29a
MD
35 LTTNG_UST_LOGLEVEL_ALL = 0,
36 LTTNG_UST_LOGLEVEL_RANGE = 1,
37 LTTNG_UST_LOGLEVEL_SINGLE = 2,
3bd1e081
MD
38};
39
40enum lttng_ust_output {
41 LTTNG_UST_MMAP = 0,
42};
43
44struct lttng_ust_tracer_version {
3f3c65dc
MD
45 uint32_t major;
46 uint32_t minor;
3bd1e081 47 uint32_t patchlevel;
3bd1e081
MD
48};
49
3f3c65dc 50#define LTTNG_UST_CHANNEL_PADDING LTTNG_UST_SYM_NAME_LEN + 32
3bd1e081
MD
51struct lttng_ust_channel {
52 int overwrite; /* 1: overwrite, 0: discard */
53 uint64_t subbuf_size; /* in bytes */
54 uint64_t num_subbuf;
55 unsigned int switch_timer_interval; /* usecs */
56 unsigned int read_timer_interval; /* usecs */
57 enum lttng_ust_output output; /* output mode */
3f3c65dc
MD
58 char padding[LTTNG_UST_CHANNEL_PADDING];
59};
60
61#define LTTNG_UST_STREAM_PADDING1 16
62#define LTTNG_UST_STREAM_PADDING2 LTTNG_UST_SYM_NAME_LEN + 32
63struct lttng_ust_stream {
64 char padding[LTTNG_UST_STREAM_PADDING1];
65
66 union {
67 char padding[LTTNG_UST_STREAM_PADDING2];
68 } u;
3bd1e081
MD
69};
70
3f3c65dc
MD
71#define LTTNG_UST_EVENT_PADDING1 16
72#define LTTNG_UST_EVENT_PADDING2 LTTNG_UST_SYM_NAME_LEN + 32
3bd1e081 73struct lttng_ust_event {
69892bbb 74 enum lttng_ust_instrumentation instrumentation;
0cda4f28
MD
75 char name[LTTNG_UST_SYM_NAME_LEN]; /* event name */
76
77 enum lttng_ust_loglevel_type loglevel_type;
8005f29a 78 int loglevel; /* value, -1: all */
3f3c65dc 79 char padding[LTTNG_UST_EVENT_PADDING1];
0cda4f28 80
3bd1e081
MD
81 /* Per instrumentation type configuration */
82 union {
3f3c65dc 83 char padding[LTTNG_UST_EVENT_PADDING2];
3bd1e081
MD
84 } u;
85};
86
87enum lttng_ust_context_type {
88 LTTNG_UST_CONTEXT_VTID = 0,
89 LTTNG_UST_CONTEXT_VPID = 1,
90 LTTNG_UST_CONTEXT_PTHREAD_ID = 2,
91 LTTNG_UST_CONTEXT_PROCNAME = 3,
92};
93
3f3c65dc
MD
94#define LTTNG_UST_CONTEXT_PADDING1 16
95#define LTTNG_UST_CONTEXT_PADDING2 LTTNG_UST_SYM_NAME_LEN + 32
3bd1e081
MD
96struct lttng_ust_context {
97 enum lttng_ust_context_type ctx;
3f3c65dc
MD
98 char padding[LTTNG_UST_CONTEXT_PADDING1];
99
3bd1e081 100 union {
3f3c65dc 101 char padding[LTTNG_UST_CONTEXT_PADDING2];
3bd1e081
MD
102 } u;
103};
104
13161846
DG
105/*
106 * Tracer channel attributes.
107 */
3f3c65dc 108#define LTTNG_UST_CHANNEL_ATTR_PADDING LTTNG_UST_SYM_NAME_LEN + 32
13161846
DG
109struct lttng_ust_channel_attr {
110 int overwrite; /* 1: overwrite, 0: discard */
111 uint64_t subbuf_size; /* bytes */
112 uint64_t num_subbuf; /* power of 2 */
113 unsigned int switch_timer_interval; /* usec */
114 unsigned int read_timer_interval; /* usec */
115 enum lttng_ust_output output; /* splice, mmap */
3f3c65dc 116 char padding[LTTNG_UST_CHANNEL_ATTR_PADDING];
13161846
DG
117};
118
3f3c65dc 119#define LTTNG_UST_TRACEPOINT_ITER_PADDING 16
177f8533
MD
120struct lttng_ust_tracepoint_iter {
121 char name[LTTNG_UST_SYM_NAME_LEN]; /* provider:name */
8005f29a 122 int loglevel;
3f3c65dc 123 char padding[LTTNG_UST_TRACEPOINT_ITER_PADDING];
177f8533
MD
124};
125
3f3c65dc 126#define LTTNG_UST_OBJECT_DATA_PADDING LTTNG_UST_SYM_NAME_LEN + 32
13161846
DG
127struct lttng_ust_object_data {
128 int handle;
129 int shm_fd;
130 int wait_fd;
131 uint64_t memory_map_size;
3f3c65dc 132 char padding[LTTNG_UST_OBJECT_DATA_PADDING];
13161846
DG
133};
134
f7e1a950
DG
135enum lttng_ust_calibrate_type {
136 LTTNG_UST_CALIBRATE_TRACEPOINT,
137};
138
3f3c65dc
MD
139#define LTTNG_UST_CALIBRATE_PADDING1 16
140#define LTTNG_UST_CALIBRATE_PADDING2 LTTNG_UST_SYM_NAME_LEN + 32
f7e1a950 141struct lttng_ust_calibrate {
3f3c65dc
MD
142 enum lttng_ust_calibrate_type type; /* type (input) */
143 char padding[LTTNG_UST_CALIBRATE_PADDING1];
144
145 union {
146 char padding[LTTNG_UST_CALIBRATE_PADDING2];
147 } u;
f7e1a950
DG
148};
149
3bd1e081
MD
150#define _UST_CMD(minor) (minor)
151#define _UST_CMDR(minor, type) (minor)
152#define _UST_CMDW(minor, type) (minor)
153
154/* Handled by object descriptor */
155#define LTTNG_UST_RELEASE _UST_CMD(0x1)
156
157/* Handled by object cmd */
158
159/* LTTng-UST commands */
160#define LTTNG_UST_SESSION _UST_CMD(0x40)
161#define LTTNG_UST_TRACER_VERSION \
162 _UST_CMDR(0x41, struct lttng_ust_tracer_version)
163#define LTTNG_UST_TRACEPOINT_LIST _UST_CMD(0x42)
164#define LTTNG_UST_WAIT_QUIESCENT _UST_CMD(0x43)
165#define LTTNG_UST_REGISTER_DONE _UST_CMD(0x44)
166
167/* Session FD commands */
168#define LTTNG_UST_METADATA \
169 _UST_CMDW(0x50, struct lttng_ust_channel)
170#define LTTNG_UST_CHANNEL \
171 _UST_CMDW(0x51, struct lttng_ust_channel)
172#define LTTNG_UST_SESSION_START _UST_CMD(0x52)
173#define LTTNG_UST_SESSION_STOP _UST_CMD(0x53)
174
175/* Channel FD commands */
176#define LTTNG_UST_STREAM _UST_CMD(0x60)
177#define LTTNG_UST_EVENT \
178 _UST_CMDW(0x61, struct lttng_ust_event)
179
180/* Event and Channel FD commands */
181#define LTTNG_UST_CONTEXT \
182 _UST_CMDW(0x70, struct lttng_ust_context)
2bdd86d4
MD
183#define LTTNG_UST_FLUSH_BUFFER \
184 _UST_CMD(0x71)
3bd1e081
MD
185
186/* Event, Channel and Session commands */
187#define LTTNG_UST_ENABLE _UST_CMD(0x80)
188#define LTTNG_UST_DISABLE _UST_CMD(0x81)
189
8ec2d32a
MD
190/* Tracepoint list commands */
191#define LTTNG_UST_TRACEPOINT_LIST_GET _UST_CMD(0x90)
192
3bd1e081
MD
193#define LTTNG_UST_ROOT_HANDLE 0
194
9df8df5e 195struct lttng_ust_obj;
3bd1e081 196
18cef803
MD
197union ust_args {
198 struct {
199 int *shm_fd;
200 int *wait_fd;
201 uint64_t *memory_map_size;
202 } channel;
203 struct {
204 int *shm_fd;
205 int *wait_fd;
206 uint64_t *memory_map_size;
207 } stream;
208};
209
9df8df5e 210struct lttng_ust_objd_ops {
18cef803
MD
211 long (*cmd)(int objd, unsigned int cmd, unsigned long arg,
212 union ust_args *args);
3bd1e081
MD
213 int (*release)(int objd);
214};
215
216/* Create root handle. Always ID 0. */
217int lttng_abi_create_root_handle(void);
218
9df8df5e
DG
219const struct lttng_ust_objd_ops *objd_ops(int id);
220int lttng_ust_objd_unref(int id);
3bd1e081
MD
221
222void lttng_ust_abi_exit(void);
9df8df5e 223void lttng_ust_events_exit(void);
3bd1e081
MD
224
225#endif /* _LTTNG_UST_ABI_H */
This page took 0.053257 seconds and 4 git commands to generate.