Commit | Line | Data |
---|---|---|
9f3fdbc6 MD |
1 | #ifndef _LTTNG_UST_ABI_H |
2 | #define _LTTNG_UST_ABI_H | |
3 | ||
4 | /* | |
4318ae1b | 5 | * lttng/ust-abi.h |
9f3fdbc6 MD |
6 | * |
7 | * Copyright 2010-2011 (c) - Mathieu Desnoyers <mathieu.desnoyers@efficios.com> | |
8 | * | |
9 | * LTTng-UST ABI header | |
10 | * | |
a60d70e6 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. | |
9f3fdbc6 MD |
19 | */ |
20 | ||
0a42beb6 MD |
21 | #include <stdint.h> |
22 | ||
f56cd1d5 | 23 | #define LTTNG_UST_SYM_NAME_LEN 256 |
9f3fdbc6 | 24 | |
b35d179d MD |
25 | #define LTTNG_UST_COMM_VERSION_MAJOR 0 |
26 | #define LTTNG_UST_COMM_VERSION_MINOR 1 | |
27 | ||
9f3fdbc6 | 28 | enum lttng_ust_instrumentation { |
df854e41 MD |
29 | LTTNG_UST_TRACEPOINT = 0, |
30 | LTTNG_UST_PROBE = 1, | |
31 | LTTNG_UST_FUNCTION = 2, | |
6b0e60f1 MD |
32 | }; |
33 | ||
34 | enum lttng_ust_loglevel_type { | |
882a56d7 MD |
35 | LTTNG_UST_LOGLEVEL_ALL = 0, |
36 | LTTNG_UST_LOGLEVEL_RANGE = 1, | |
37 | LTTNG_UST_LOGLEVEL_SINGLE = 2, | |
9f3fdbc6 MD |
38 | }; |
39 | ||
9f3fdbc6 | 40 | enum lttng_ust_output { |
b35d179d | 41 | LTTNG_UST_MMAP = 0, |
9f3fdbc6 MD |
42 | }; |
43 | ||
b35d179d | 44 | struct lttng_ust_tracer_version { |
b728d87e MD |
45 | uint32_t major; |
46 | uint32_t minor; | |
b35d179d | 47 | uint32_t patchlevel; |
b35d179d | 48 | }; |
9f3fdbc6 MD |
49 | |
50 | struct lttng_ust_channel { | |
51 | int overwrite; /* 1: overwrite, 0: discard */ | |
52 | uint64_t subbuf_size; /* in bytes */ | |
53 | uint64_t num_subbuf; | |
54 | unsigned int switch_timer_interval; /* usecs */ | |
55 | unsigned int read_timer_interval; /* usecs */ | |
b35d179d | 56 | enum lttng_ust_output output; /* output mode */ |
9f3fdbc6 MD |
57 | }; |
58 | ||
381c0f1e | 59 | struct lttng_ust_stream { |
381c0f1e MD |
60 | }; |
61 | ||
9f3fdbc6 | 62 | struct lttng_ust_event { |
9f3fdbc6 | 63 | enum lttng_ust_instrumentation instrumentation; |
6b0e60f1 MD |
64 | char name[LTTNG_UST_SYM_NAME_LEN]; /* event name */ |
65 | ||
66 | enum lttng_ust_loglevel_type loglevel_type; | |
882a56d7 | 67 | int loglevel; /* value, -1: all */ |
6b0e60f1 | 68 | |
9f3fdbc6 MD |
69 | /* Per instrumentation type configuration */ |
70 | union { | |
71 | } u; | |
72 | }; | |
73 | ||
9f3fdbc6 | 74 | enum lttng_ust_context_type { |
3b402b40 | 75 | LTTNG_UST_CONTEXT_VTID = 0, |
c1ef86f0 MD |
76 | LTTNG_UST_CONTEXT_VPID = 1, |
77 | LTTNG_UST_CONTEXT_PTHREAD_ID = 2, | |
4847e9bb | 78 | LTTNG_UST_CONTEXT_PROCNAME = 3, |
9f3fdbc6 MD |
79 | }; |
80 | ||
81 | struct lttng_ust_context { | |
82 | enum lttng_ust_context_type ctx; | |
83 | union { | |
84 | } u; | |
85 | }; | |
86 | ||
92462b01 MD |
87 | /* |
88 | * Tracer channel attributes. | |
89 | */ | |
90 | struct lttng_ust_channel_attr { | |
91 | int overwrite; /* 1: overwrite, 0: discard */ | |
92 | uint64_t subbuf_size; /* bytes */ | |
93 | uint64_t num_subbuf; /* power of 2 */ | |
94 | unsigned int switch_timer_interval; /* usec */ | |
95 | unsigned int read_timer_interval; /* usec */ | |
96 | enum lttng_ust_output output; /* splice, mmap */ | |
97 | }; | |
98 | ||
cbef6901 MD |
99 | struct lttng_ust_tracepoint_iter { |
100 | char name[LTTNG_UST_SYM_NAME_LEN]; /* provider:name */ | |
882a56d7 | 101 | int loglevel; |
cbef6901 MD |
102 | }; |
103 | ||
92462b01 MD |
104 | struct lttng_ust_object_data { |
105 | int handle; | |
106 | int shm_fd; | |
107 | int wait_fd; | |
108 | uint64_t memory_map_size; | |
109 | }; | |
110 | ||
d9a9a33b MD |
111 | enum lttng_ust_calibrate_type { |
112 | LTTNG_UST_CALIBRATE_TRACEPOINT, | |
113 | }; | |
114 | ||
115 | struct lttng_ust_calibrate { | |
116 | enum lttng_ust_calibrate_type type; /* type (input) */ | |
117 | }; | |
118 | ||
9f3fdbc6 MD |
119 | #define _UST_CMD(minor) (minor) |
120 | #define _UST_CMDR(minor, type) (minor) | |
121 | #define _UST_CMDW(minor, type) (minor) | |
122 | ||
46050b1a MD |
123 | /* Handled by object descriptor */ |
124 | #define LTTNG_UST_RELEASE _UST_CMD(0x1) | |
125 | ||
126 | /* Handled by object cmd */ | |
127 | ||
9f3fdbc6 MD |
128 | /* LTTng-UST commands */ |
129 | #define LTTNG_UST_SESSION _UST_CMD(0x40) | |
130 | #define LTTNG_UST_TRACER_VERSION \ | |
131 | _UST_CMDR(0x41, struct lttng_ust_tracer_version) | |
132 | #define LTTNG_UST_TRACEPOINT_LIST _UST_CMD(0x42) | |
133 | #define LTTNG_UST_WAIT_QUIESCENT _UST_CMD(0x43) | |
11ff9c7d | 134 | #define LTTNG_UST_REGISTER_DONE _UST_CMD(0x44) |
9f3fdbc6 | 135 | |
46050b1a | 136 | /* Session FD commands */ |
9f3fdbc6 MD |
137 | #define LTTNG_UST_METADATA \ |
138 | _UST_CMDW(0x50, struct lttng_ust_channel) | |
139 | #define LTTNG_UST_CHANNEL \ | |
140 | _UST_CMDW(0x51, struct lttng_ust_channel) | |
141 | #define LTTNG_UST_SESSION_START _UST_CMD(0x52) | |
142 | #define LTTNG_UST_SESSION_STOP _UST_CMD(0x53) | |
143 | ||
46050b1a | 144 | /* Channel FD commands */ |
9f3fdbc6 MD |
145 | #define LTTNG_UST_STREAM _UST_CMD(0x60) |
146 | #define LTTNG_UST_EVENT \ | |
147 | _UST_CMDW(0x61, struct lttng_ust_event) | |
148 | ||
46050b1a | 149 | /* Event and Channel FD commands */ |
9f3fdbc6 MD |
150 | #define LTTNG_UST_CONTEXT \ |
151 | _UST_CMDW(0x70, struct lttng_ust_context) | |
43d330a4 | 152 | #define LTTNG_UST_FLUSH_BUFFER \ |
43861eab | 153 | _UST_CMD(0x71) |
9f3fdbc6 | 154 | |
46050b1a | 155 | /* Event, Channel and Session commands */ |
9f3fdbc6 MD |
156 | #define LTTNG_UST_ENABLE _UST_CMD(0x80) |
157 | #define LTTNG_UST_DISABLE _UST_CMD(0x81) | |
158 | ||
51489cad MD |
159 | /* Tracepoint list commands */ |
160 | #define LTTNG_UST_TRACEPOINT_LIST_GET _UST_CMD(0x90) | |
161 | ||
46050b1a MD |
162 | #define LTTNG_UST_ROOT_HANDLE 0 |
163 | ||
b61ce3b2 | 164 | struct lttng_ust_obj; |
46050b1a | 165 | |
ef9ff354 MD |
166 | union ust_args { |
167 | struct { | |
168 | int *shm_fd; | |
169 | int *wait_fd; | |
170 | uint64_t *memory_map_size; | |
171 | } channel; | |
172 | struct { | |
173 | int *shm_fd; | |
174 | int *wait_fd; | |
175 | uint64_t *memory_map_size; | |
176 | } stream; | |
177 | }; | |
178 | ||
b61ce3b2 | 179 | struct lttng_ust_objd_ops { |
ef9ff354 MD |
180 | long (*cmd)(int objd, unsigned int cmd, unsigned long arg, |
181 | union ust_args *args); | |
46050b1a MD |
182 | int (*release)(int objd); |
183 | }; | |
184 | ||
185 | /* Create root handle. Always ID 0. */ | |
186 | int lttng_abi_create_root_handle(void); | |
187 | ||
b61ce3b2 | 188 | const struct lttng_ust_objd_ops *objd_ops(int id); |
d4419b81 | 189 | int lttng_ust_objd_unref(int id); |
46050b1a MD |
190 | |
191 | void lttng_ust_abi_exit(void); | |
003fedf4 | 192 | void lttng_ust_events_exit(void); |
b35d179d | 193 | |
9f3fdbc6 | 194 | #endif /* _LTTNG_UST_ABI_H */ |