Commit | Line | Data |
---|---|---|
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 | * | |
bf74a86d AM |
14 | * Permission is hereby granted, free of charge, to any person obtaining a copy |
15 | * of this software and associated documentation files (the "Software"), to deal | |
16 | * in the Software without restriction, including without limitation the rights | |
17 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
18 | * copies of the Software, and to permit persons to whom the Software is | |
19 | * furnished to do so, subject to the following conditions: | |
20 | * | |
21 | * The above copyright notice and this permission notice shall be included in | |
22 | * all copies or substantial portions of the Software. | |
3bd1e081 MD |
23 | */ |
24 | ||
25 | #include <stdint.h> | |
26 | ||
57ab7638 | 27 | #define LTTNG_UST_SYM_NAME_LEN 256 |
3bd1e081 | 28 | |
3f3c65dc MD |
29 | #define LTTNG_UST_COMM_VERSION_MAJOR 2 |
30 | #define LTTNG_UST_COMM_VERSION_MINOR 0 | |
3bd1e081 MD |
31 | |
32 | enum lttng_ust_instrumentation { | |
177f8533 MD |
33 | LTTNG_UST_TRACEPOINT = 0, |
34 | LTTNG_UST_PROBE = 1, | |
35 | LTTNG_UST_FUNCTION = 2, | |
0cda4f28 MD |
36 | }; |
37 | ||
38 | enum lttng_ust_loglevel_type { | |
8005f29a MD |
39 | LTTNG_UST_LOGLEVEL_ALL = 0, |
40 | LTTNG_UST_LOGLEVEL_RANGE = 1, | |
41 | LTTNG_UST_LOGLEVEL_SINGLE = 2, | |
3bd1e081 MD |
42 | }; |
43 | ||
44 | enum lttng_ust_output { | |
45 | LTTNG_UST_MMAP = 0, | |
46 | }; | |
47 | ||
48 | struct lttng_ust_tracer_version { | |
3f3c65dc MD |
49 | uint32_t major; |
50 | uint32_t minor; | |
3bd1e081 | 51 | uint32_t patchlevel; |
3bd1e081 MD |
52 | }; |
53 | ||
3f3c65dc | 54 | #define LTTNG_UST_CHANNEL_PADDING LTTNG_UST_SYM_NAME_LEN + 32 |
3bd1e081 MD |
55 | struct lttng_ust_channel { |
56 | int overwrite; /* 1: overwrite, 0: discard */ | |
57 | uint64_t subbuf_size; /* in bytes */ | |
58 | uint64_t num_subbuf; | |
59 | unsigned int switch_timer_interval; /* usecs */ | |
60 | unsigned int read_timer_interval; /* usecs */ | |
61 | enum lttng_ust_output output; /* output mode */ | |
3f3c65dc MD |
62 | char padding[LTTNG_UST_CHANNEL_PADDING]; |
63 | }; | |
64 | ||
65 | #define LTTNG_UST_STREAM_PADDING1 16 | |
66 | #define LTTNG_UST_STREAM_PADDING2 LTTNG_UST_SYM_NAME_LEN + 32 | |
67 | struct lttng_ust_stream { | |
68 | char padding[LTTNG_UST_STREAM_PADDING1]; | |
69 | ||
70 | union { | |
71 | char padding[LTTNG_UST_STREAM_PADDING2]; | |
72 | } u; | |
3bd1e081 MD |
73 | }; |
74 | ||
3f3c65dc MD |
75 | #define LTTNG_UST_EVENT_PADDING1 16 |
76 | #define LTTNG_UST_EVENT_PADDING2 LTTNG_UST_SYM_NAME_LEN + 32 | |
3bd1e081 | 77 | struct lttng_ust_event { |
69892bbb | 78 | enum lttng_ust_instrumentation instrumentation; |
0cda4f28 MD |
79 | char name[LTTNG_UST_SYM_NAME_LEN]; /* event name */ |
80 | ||
81 | enum lttng_ust_loglevel_type loglevel_type; | |
8005f29a | 82 | int loglevel; /* value, -1: all */ |
3f3c65dc | 83 | char padding[LTTNG_UST_EVENT_PADDING1]; |
0cda4f28 | 84 | |
3bd1e081 MD |
85 | /* Per instrumentation type configuration */ |
86 | union { | |
3f3c65dc | 87 | char padding[LTTNG_UST_EVENT_PADDING2]; |
3bd1e081 MD |
88 | } u; |
89 | }; | |
90 | ||
91 | enum lttng_ust_context_type { | |
92 | LTTNG_UST_CONTEXT_VTID = 0, | |
93 | LTTNG_UST_CONTEXT_VPID = 1, | |
94 | LTTNG_UST_CONTEXT_PTHREAD_ID = 2, | |
95 | LTTNG_UST_CONTEXT_PROCNAME = 3, | |
96 | }; | |
97 | ||
3f3c65dc MD |
98 | #define LTTNG_UST_CONTEXT_PADDING1 16 |
99 | #define LTTNG_UST_CONTEXT_PADDING2 LTTNG_UST_SYM_NAME_LEN + 32 | |
3bd1e081 MD |
100 | struct lttng_ust_context { |
101 | enum lttng_ust_context_type ctx; | |
3f3c65dc MD |
102 | char padding[LTTNG_UST_CONTEXT_PADDING1]; |
103 | ||
3bd1e081 | 104 | union { |
3f3c65dc | 105 | char padding[LTTNG_UST_CONTEXT_PADDING2]; |
3bd1e081 MD |
106 | } u; |
107 | }; | |
108 | ||
13161846 DG |
109 | /* |
110 | * Tracer channel attributes. | |
111 | */ | |
3f3c65dc | 112 | #define LTTNG_UST_CHANNEL_ATTR_PADDING LTTNG_UST_SYM_NAME_LEN + 32 |
13161846 DG |
113 | struct lttng_ust_channel_attr { |
114 | int overwrite; /* 1: overwrite, 0: discard */ | |
115 | uint64_t subbuf_size; /* bytes */ | |
116 | uint64_t num_subbuf; /* power of 2 */ | |
117 | unsigned int switch_timer_interval; /* usec */ | |
118 | unsigned int read_timer_interval; /* usec */ | |
119 | enum lttng_ust_output output; /* splice, mmap */ | |
3f3c65dc | 120 | char padding[LTTNG_UST_CHANNEL_ATTR_PADDING]; |
13161846 DG |
121 | }; |
122 | ||
3f3c65dc | 123 | #define LTTNG_UST_TRACEPOINT_ITER_PADDING 16 |
177f8533 MD |
124 | struct lttng_ust_tracepoint_iter { |
125 | char name[LTTNG_UST_SYM_NAME_LEN]; /* provider:name */ | |
8005f29a | 126 | int loglevel; |
3f3c65dc | 127 | char padding[LTTNG_UST_TRACEPOINT_ITER_PADDING]; |
177f8533 MD |
128 | }; |
129 | ||
3f3c65dc | 130 | #define LTTNG_UST_OBJECT_DATA_PADDING LTTNG_UST_SYM_NAME_LEN + 32 |
13161846 DG |
131 | struct lttng_ust_object_data { |
132 | int handle; | |
133 | int shm_fd; | |
6684bfa4 | 134 | char *shm_path; |
13161846 | 135 | int wait_fd; |
6684bfa4 | 136 | char *wait_pipe_path; |
13161846 | 137 | uint64_t memory_map_size; |
3f3c65dc | 138 | char padding[LTTNG_UST_OBJECT_DATA_PADDING]; |
13161846 DG |
139 | }; |
140 | ||
f7e1a950 DG |
141 | enum lttng_ust_calibrate_type { |
142 | LTTNG_UST_CALIBRATE_TRACEPOINT, | |
143 | }; | |
144 | ||
3f3c65dc MD |
145 | #define LTTNG_UST_CALIBRATE_PADDING1 16 |
146 | #define LTTNG_UST_CALIBRATE_PADDING2 LTTNG_UST_SYM_NAME_LEN + 32 | |
f7e1a950 | 147 | struct lttng_ust_calibrate { |
3f3c65dc MD |
148 | enum lttng_ust_calibrate_type type; /* type (input) */ |
149 | char padding[LTTNG_UST_CALIBRATE_PADDING1]; | |
150 | ||
151 | union { | |
152 | char padding[LTTNG_UST_CALIBRATE_PADDING2]; | |
153 | } u; | |
f7e1a950 DG |
154 | }; |
155 | ||
3bd1e081 MD |
156 | #define _UST_CMD(minor) (minor) |
157 | #define _UST_CMDR(minor, type) (minor) | |
158 | #define _UST_CMDW(minor, type) (minor) | |
159 | ||
160 | /* Handled by object descriptor */ | |
161 | #define LTTNG_UST_RELEASE _UST_CMD(0x1) | |
162 | ||
163 | /* Handled by object cmd */ | |
164 | ||
165 | /* LTTng-UST commands */ | |
166 | #define LTTNG_UST_SESSION _UST_CMD(0x40) | |
167 | #define LTTNG_UST_TRACER_VERSION \ | |
168 | _UST_CMDR(0x41, struct lttng_ust_tracer_version) | |
169 | #define LTTNG_UST_TRACEPOINT_LIST _UST_CMD(0x42) | |
170 | #define LTTNG_UST_WAIT_QUIESCENT _UST_CMD(0x43) | |
171 | #define LTTNG_UST_REGISTER_DONE _UST_CMD(0x44) | |
172 | ||
173 | /* Session FD commands */ | |
174 | #define LTTNG_UST_METADATA \ | |
175 | _UST_CMDW(0x50, struct lttng_ust_channel) | |
176 | #define LTTNG_UST_CHANNEL \ | |
177 | _UST_CMDW(0x51, struct lttng_ust_channel) | |
178 | #define LTTNG_UST_SESSION_START _UST_CMD(0x52) | |
179 | #define LTTNG_UST_SESSION_STOP _UST_CMD(0x53) | |
180 | ||
181 | /* Channel FD commands */ | |
182 | #define LTTNG_UST_STREAM _UST_CMD(0x60) | |
183 | #define LTTNG_UST_EVENT \ | |
184 | _UST_CMDW(0x61, struct lttng_ust_event) | |
840a7334 | 185 | #define LTTNG_UST_STREAM_PIPE _UST_CMD(0x62) |
3bd1e081 MD |
186 | /* Event and Channel FD commands */ |
187 | #define LTTNG_UST_CONTEXT \ | |
188 | _UST_CMDW(0x70, struct lttng_ust_context) | |
2bdd86d4 MD |
189 | #define LTTNG_UST_FLUSH_BUFFER \ |
190 | _UST_CMD(0x71) | |
3bd1e081 MD |
191 | |
192 | /* Event, Channel and Session commands */ | |
193 | #define LTTNG_UST_ENABLE _UST_CMD(0x80) | |
194 | #define LTTNG_UST_DISABLE _UST_CMD(0x81) | |
195 | ||
8ec2d32a MD |
196 | /* Tracepoint list commands */ |
197 | #define LTTNG_UST_TRACEPOINT_LIST_GET _UST_CMD(0x90) | |
198 | ||
3bd1e081 MD |
199 | #define LTTNG_UST_ROOT_HANDLE 0 |
200 | ||
9df8df5e | 201 | struct lttng_ust_obj; |
3bd1e081 | 202 | |
18cef803 MD |
203 | union ust_args { |
204 | struct { | |
205 | int *shm_fd; | |
6684bfa4 | 206 | char *shm_path; |
18cef803 | 207 | int *wait_fd; |
6684bfa4 | 208 | char *wait_pipe_path; |
18cef803 MD |
209 | uint64_t *memory_map_size; |
210 | } channel; | |
211 | struct { | |
212 | int *shm_fd; | |
6684bfa4 | 213 | char *shm_path; |
18cef803 | 214 | int *wait_fd; |
6684bfa4 | 215 | char *wait_pipe_path; |
18cef803 MD |
216 | uint64_t *memory_map_size; |
217 | } stream; | |
218 | }; | |
219 | ||
9df8df5e | 220 | struct lttng_ust_objd_ops { |
18cef803 MD |
221 | long (*cmd)(int objd, unsigned int cmd, unsigned long arg, |
222 | union ust_args *args); | |
3bd1e081 MD |
223 | int (*release)(int objd); |
224 | }; | |
225 | ||
226 | /* Create root handle. Always ID 0. */ | |
227 | int lttng_abi_create_root_handle(void); | |
228 | ||
9df8df5e DG |
229 | const struct lttng_ust_objd_ops *objd_ops(int id); |
230 | int lttng_ust_objd_unref(int id); | |
3bd1e081 MD |
231 | |
232 | void lttng_ust_abi_exit(void); | |
9df8df5e | 233 | void lttng_ust_events_exit(void); |
3bd1e081 MD |
234 | |
235 | #endif /* _LTTNG_UST_ABI_H */ |