root / lab4 / .minix-src / include / sys / sdt.h @ 14
History | View | Annotate | Download (17.6 KB)
1 | 13 | up20180614 | /*-
|
---|---|---|---|
2 | * Copyright 2006-2008 John Birrell <jb@FreeBSD.org>
|
||
3 | *
|
||
4 | * Redistribution and use in source and binary forms, with or without
|
||
5 | * modification, are permitted provided that the following conditions
|
||
6 | * are met:
|
||
7 | * 1. Redistributions of source code must retain the above copyright
|
||
8 | * notice, this list of conditions and the following disclaimer.
|
||
9 | * 2. Redistributions in binary form must reproduce the above copyright
|
||
10 | * notice, this list of conditions and the following disclaimer in the
|
||
11 | * documentation and/or other materials provided with the distribution.
|
||
12 | *
|
||
13 | * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||
14 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||
15 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||
16 | * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
|
||
17 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||
18 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||
19 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||
20 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||
21 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||
22 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||
23 | * SUCH DAMAGE.
|
||
24 | *
|
||
25 | * $FreeBSD: head/sys/sys/sdt.h 270990 2014-09-02 23:43:06Z markj $
|
||
26 | *
|
||
27 | * Statically Defined Tracing (SDT) definitions.
|
||
28 | *
|
||
29 | */
|
||
30 | |||
31 | #ifndef _SYS_SDT_H
|
||
32 | #define _SYS_SDT_H
|
||
33 | |||
34 | #ifndef _KERNEL
|
||
35 | |||
36 | #define _DTRACE_VERSION 1 |
||
37 | |||
38 | #define DTRACE_PROBE(prov, name) { \
|
||
39 | extern void __dtrace_##prov##___##name(void); \ |
||
40 | __dtrace_##prov##___##name(); \ |
||
41 | } |
||
42 | |||
43 | #define DTRACE_PROBE1(prov, name, arg1) { \
|
||
44 | extern void __dtrace_##prov##___##name(unsigned long); \ |
||
45 | __dtrace_##prov##___##name((unsigned long)arg1); \ |
||
46 | } |
||
47 | |||
48 | #define DTRACE_PROBE2(prov, name, arg1, arg2) { \
|
||
49 | extern void __dtrace_##prov##___##name(unsigned long, \ |
||
50 | unsigned long); \ |
||
51 | __dtrace_##prov##___##name((unsigned long)arg1, \ |
||
52 | (unsigned long)arg2); \ |
||
53 | } |
||
54 | |||
55 | #define DTRACE_PROBE3(prov, name, arg1, arg2, arg3) { \
|
||
56 | extern void __dtrace_##prov##___##name(unsigned long, \ |
||
57 | unsigned long, unsigned long); \ |
||
58 | __dtrace_##prov##___##name((unsigned long)arg1, \ |
||
59 | (unsigned long)arg2, (unsigned long)arg3); \ |
||
60 | } |
||
61 | |||
62 | #define DTRACE_PROBE4(prov, name, arg1, arg2, arg3, arg4) { \
|
||
63 | extern void __dtrace_##prov##___##name(unsigned long, \ |
||
64 | unsigned long, unsigned long, unsigned long); \ |
||
65 | __dtrace_##prov##___##name((unsigned long)arg1, \ |
||
66 | (unsigned long)arg2, (unsigned long)arg3, \ |
||
67 | (unsigned long)arg4); \ |
||
68 | } |
||
69 | |||
70 | #define DTRACE_PROBE5(prov, name, arg1, arg2, arg3, arg4, arg5) { \
|
||
71 | extern void __dtrace_##prov##___##name(unsigned long, \ |
||
72 | unsigned long, unsigned long, unsigned long, unsigned long);\ |
||
73 | __dtrace_##prov##___##name((unsigned long)arg1, \ |
||
74 | (unsigned long)arg2, (unsigned long)arg3, \ |
||
75 | (unsigned long)arg4, (unsigned long)arg5); \ |
||
76 | } |
||
77 | |||
78 | #else /* _KERNEL */ |
||
79 | |||
80 | #include <sys/cdefs.h> |
||
81 | |||
82 | #ifndef KDTRACE_HOOKS
|
||
83 | |||
84 | #define SDT_PROVIDER_DEFINE(prov)
|
||
85 | #define SDT_PROVIDER_DECLARE(prov)
|
||
86 | #define SDT_PROBE_DEFINE(prov, mod, func, name)
|
||
87 | #define SDT_PROBE_DECLARE(prov, mod, func, name)
|
||
88 | #define SDT_PROBE(prov, mod, func, name, arg0, arg1, arg2, arg3, arg4)
|
||
89 | #define SDT_PROBE_ARGTYPE(prov, mod, func, name, num, type, xtype)
|
||
90 | |||
91 | #define SDT_PROBE_DEFINE0(prov, mod, func, name)
|
||
92 | #define SDT_PROBE_DEFINE1(prov, mod, func, name, arg0)
|
||
93 | #define SDT_PROBE_DEFINE2(prov, mod, func, name, arg0, arg1)
|
||
94 | #define SDT_PROBE_DEFINE3(prov, mod, func, name, arg0, arg1, arg2)
|
||
95 | #define SDT_PROBE_DEFINE4(prov, mod, func, name, arg0, arg1, arg2, arg3)
|
||
96 | #define SDT_PROBE_DEFINE5(prov, mod, func, name, arg0, arg1, arg2, arg3, arg4)
|
||
97 | #define SDT_PROBE_DEFINE6(prov, mod, func, name, arg0, arg1, arg2, \
|
||
98 | arg3, arg4, arg5) |
||
99 | #define SDT_PROBE_DEFINE7(prov, mod, func, name, arg0, arg1, arg2, \
|
||
100 | arg3, arg4, arg5, arg6) |
||
101 | |||
102 | #define SDT_PROBE0(prov, mod, func, name)
|
||
103 | #define SDT_PROBE1(prov, mod, func, name, arg0)
|
||
104 | #define SDT_PROBE2(prov, mod, func, name, arg0, arg1)
|
||
105 | #define SDT_PROBE3(prov, mod, func, name, arg0, arg1, arg2)
|
||
106 | #define SDT_PROBE4(prov, mod, func, name, arg0, arg1, arg2, arg3)
|
||
107 | #define SDT_PROBE5(prov, mod, func, name, arg0, arg1, arg2, arg3, arg4)
|
||
108 | #define SDT_PROBE6(prov, mod, func, name, arg0, arg1, arg2, arg3, arg4, arg5)
|
||
109 | #define SDT_PROBE7(prov, mod, func, name, arg0, arg1, arg2, arg3, arg4, arg5, \
|
||
110 | arg6) |
||
111 | |||
112 | #define SDT_PROBE_DEFINE0_XLATE(prov, mod, func, name)
|
||
113 | #define SDT_PROBE_DEFINE1_XLATE(prov, mod, func, name, arg0, xarg0)
|
||
114 | #define SDT_PROBE_DEFINE2_XLATE(prov, mod, func, name, arg0, xarg0, \
|
||
115 | arg1, xarg1) |
||
116 | #define SDT_PROBE_DEFINE3_XLATE(prov, mod, func, name, arg0, xarg0, \
|
||
117 | arg1, xarg1, arg2, xarg2) |
||
118 | #define SDT_PROBE_DEFINE4_XLATE(prov, mod, func, name, arg0, xarg0, \
|
||
119 | arg1, xarg1, arg2, xarg2, arg3, xarg3) |
||
120 | #define SDT_PROBE_DEFINE5_XLATE(prov, mod, func, name, arg0, xarg0, \
|
||
121 | arg1, xarg1, arg2, xarg2, arg3, xarg3, arg4, xarg4) |
||
122 | #define SDT_PROBE_DEFINE6_XLATE(prov, mod, func, name, arg0, xarg0, \
|
||
123 | arg1, xarg1, arg2, xarg2, arg3, xarg3, arg4, xarg4, arg5, xarg5) |
||
124 | #define SDT_PROBE_DEFINE7_XLATE(prov, mod, func, name, arg0, xarg0, \
|
||
125 | arg1, xarg1, arg2, xarg2, arg3, xarg3, arg4, xarg4, arg5, xarg5, arg6, \ |
||
126 | xarg6) |
||
127 | |||
128 | #define DTRACE_PROBE(name)
|
||
129 | #define DTRACE_PROBE1(name, type0, arg0)
|
||
130 | #define DTRACE_PROBE2(name, type0, arg0, type1, arg1)
|
||
131 | #define DTRACE_PROBE3(name, type0, arg0, type1, arg1, type2, arg2)
|
||
132 | #define DTRACE_PROBE4(name, type0, arg0, type1, arg1, type2, arg2, type3, arg3)
|
||
133 | #define DTRACE_PROBE5(name, type0, arg0, type1, arg1, type2, arg2, type3, arg3,\
|
||
134 | type4, arg4) |
||
135 | |||
136 | #else
|
||
137 | |||
138 | #define SDT_PROVIDER_DEFINE(prov) \
|
||
139 | struct sdt_provider sdt_provider_##prov[1] = { \ |
||
140 | { #prov, { NULL, NULL }, 0, 0 } \ |
||
141 | }; \ |
||
142 | __link_set_add_data(sdt_providers_set, sdt_provider_##prov); |
||
143 | |||
144 | #define SDT_PROVIDER_DECLARE(prov) \
|
||
145 | extern struct sdt_provider sdt_provider_##prov[1] |
||
146 | |||
147 | #define SDT_PROBE_DEFINE(prov, mod, func, name) \
|
||
148 | struct sdt_probe sdt_##prov##_##mod##_##func##_##name[1] = { \ |
||
149 | { sizeof(struct sdt_probe), sdt_provider_##prov, \ |
||
150 | { NULL, NULL }, { NULL, NULL }, #mod, #func, #name, 0, 0, \ |
||
151 | NULL } \
|
||
152 | }; \ |
||
153 | __link_set_add_data(sdt_probes_set, sdt_##prov##_##mod##_##func##_##name); |
||
154 | |||
155 | #define SDT_PROBE_DECLARE(prov, mod, func, name) \
|
||
156 | extern struct sdt_probe sdt_##prov##_##mod##_##func##_##name[1] |
||
157 | |||
158 | #define SDT_PROBE(prov, mod, func, name, arg0, arg1, arg2, arg3, arg4) do { \ |
||
159 | if (sdt_##prov##_##mod##_##func##_##name->id) \ |
||
160 | (*sdt_probe_func)(sdt_##prov##_##mod##_##func##_##name->id, \ |
||
161 | (uintptr_t) arg0, (uintptr_t) arg1, (uintptr_t) arg2, \ |
||
162 | (uintptr_t) arg3, (uintptr_t) arg4); \ |
||
163 | } while (0) |
||
164 | |||
165 | #define SDT_PROBE_ARGTYPE(prov, mod, func, name, num, type, xtype) \
|
||
166 | static struct sdt_argtype sdta_##prov##_##mod##_##func##_##name##num[1] \ |
||
167 | = { { num, type, xtype, { NULL, NULL }, \ |
||
168 | sdt_##prov##_##mod##_##func##_##name } \ |
||
169 | }; \ |
||
170 | __link_set_add_data(sdt_argtypes_set, sdta_##prov##_##mod##_##func##_##name##num); |
||
171 | |||
172 | #define SDT_PROBE_DEFINE0(prov, mod, func, name) \
|
||
173 | SDT_PROBE_DEFINE(prov, mod, func, name) |
||
174 | |||
175 | #define SDT_PROBE_DEFINE1(prov, mod, func, name, arg0) \
|
||
176 | SDT_PROBE_DEFINE(prov, mod, func, name); \ |
||
177 | SDT_PROBE_ARGTYPE(prov, mod, func, name, 0, arg0, NULL) |
||
178 | |||
179 | #define SDT_PROBE_DEFINE2(prov, mod, func, name, arg0, arg1) \
|
||
180 | SDT_PROBE_DEFINE(prov, mod, func, name); \ |
||
181 | SDT_PROBE_ARGTYPE(prov, mod, func, name, 0, arg0, NULL); \ |
||
182 | SDT_PROBE_ARGTYPE(prov, mod, func, name, 1, arg1, NULL) |
||
183 | |||
184 | #define SDT_PROBE_DEFINE3(prov, mod, func, name, arg0, arg1, arg2)\
|
||
185 | SDT_PROBE_DEFINE(prov, mod, func, name); \ |
||
186 | SDT_PROBE_ARGTYPE(prov, mod, func, name, 0, arg0, NULL); \ |
||
187 | SDT_PROBE_ARGTYPE(prov, mod, func, name, 1, arg1, NULL); \ |
||
188 | SDT_PROBE_ARGTYPE(prov, mod, func, name, 2, arg2, NULL) |
||
189 | |||
190 | #define SDT_PROBE_DEFINE4(prov, mod, func, name, arg0, arg1, arg2, arg3) \
|
||
191 | SDT_PROBE_DEFINE(prov, mod, func, name); \ |
||
192 | SDT_PROBE_ARGTYPE(prov, mod, func, name, 0, arg0, NULL); \ |
||
193 | SDT_PROBE_ARGTYPE(prov, mod, func, name, 1, arg1, NULL); \ |
||
194 | SDT_PROBE_ARGTYPE(prov, mod, func, name, 2, arg2, NULL); \ |
||
195 | SDT_PROBE_ARGTYPE(prov, mod, func, name, 3, arg3, NULL) |
||
196 | |||
197 | #define SDT_PROBE_DEFINE5(prov, mod, func, name, arg0, arg1, arg2, arg3, arg4) \
|
||
198 | SDT_PROBE_DEFINE(prov, mod, func, name); \ |
||
199 | SDT_PROBE_ARGTYPE(prov, mod, func, name, 0, arg0, NULL); \ |
||
200 | SDT_PROBE_ARGTYPE(prov, mod, func, name, 1, arg1, NULL); \ |
||
201 | SDT_PROBE_ARGTYPE(prov, mod, func, name, 2, arg2, NULL); \ |
||
202 | SDT_PROBE_ARGTYPE(prov, mod, func, name, 3, arg3, NULL); \ |
||
203 | SDT_PROBE_ARGTYPE(prov, mod, func, name, 4, arg4, NULL) |
||
204 | |||
205 | #define SDT_PROBE_DEFINE6(prov, mod, func, name, arg0, arg1, arg2, arg3,\
|
||
206 | arg4, arg5) \ |
||
207 | SDT_PROBE_DEFINE(prov, mod, func, name); \ |
||
208 | SDT_PROBE_ARGTYPE(prov, mod, func, name, 0, arg0, NULL); \ |
||
209 | SDT_PROBE_ARGTYPE(prov, mod, func, name, 1, arg1, NULL); \ |
||
210 | SDT_PROBE_ARGTYPE(prov, mod, func, name, 2, arg2, NULL); \ |
||
211 | SDT_PROBE_ARGTYPE(prov, mod, func, name, 3, arg3, NULL); \ |
||
212 | SDT_PROBE_ARGTYPE(prov, mod, func, name, 4, arg4, NULL); \ |
||
213 | SDT_PROBE_ARGTYPE(prov, mod, func, name, 5, arg5, NULL) |
||
214 | |||
215 | #define SDT_PROBE_DEFINE7(prov, mod, func, name, arg0, arg1, arg2, arg3,\
|
||
216 | arg4, arg5, arg6) \ |
||
217 | SDT_PROBE_DEFINE(prov, mod, func, name); \ |
||
218 | SDT_PROBE_ARGTYPE(prov, mod, func, name, 0, arg0, NULL); \ |
||
219 | SDT_PROBE_ARGTYPE(prov, mod, func, name, 1, arg1, NULL); \ |
||
220 | SDT_PROBE_ARGTYPE(prov, mod, func, name, 2, arg2, NULL); \ |
||
221 | SDT_PROBE_ARGTYPE(prov, mod, func, name, 3, arg3, NULL); \ |
||
222 | SDT_PROBE_ARGTYPE(prov, mod, func, name, 4, arg4, NULL); \ |
||
223 | SDT_PROBE_ARGTYPE(prov, mod, func, name, 5, arg5, NULL); \ |
||
224 | SDT_PROBE_ARGTYPE(prov, mod, func, name, 6, arg6, NULL) |
||
225 | |||
226 | #define SDT_PROBE_DEFINE0_XLATE(prov, mod, func, name) \
|
||
227 | SDT_PROBE_DEFINE(prov, mod, func, name) |
||
228 | |||
229 | #define SDT_PROBE_DEFINE1_XLATE(prov, mod, func, name, arg0, xarg0) \
|
||
230 | SDT_PROBE_DEFINE(prov, mod, func, name); \ |
||
231 | SDT_PROBE_ARGTYPE(prov, mod, func, name, 0, arg0, xarg0)
|
||
232 | |||
233 | #define SDT_PROBE_DEFINE2_XLATE(prov, mod, func, name, arg0, xarg0, \
|
||
234 | arg1, xarg1) \ |
||
235 | SDT_PROBE_DEFINE(prov, mod, func, name); \ |
||
236 | SDT_PROBE_ARGTYPE(prov, mod, func, name, 0, arg0, xarg0); \
|
||
237 | SDT_PROBE_ARGTYPE(prov, mod, func, name, 1, arg1, xarg1)
|
||
238 | |||
239 | #define SDT_PROBE_DEFINE3_XLATE(prov, mod, func, name, arg0, xarg0, \
|
||
240 | arg1, xarg1, arg2, xarg2) \ |
||
241 | SDT_PROBE_DEFINE(prov, mod, func, name); \ |
||
242 | SDT_PROBE_ARGTYPE(prov, mod, func, name, 0, arg0, xarg0); \
|
||
243 | SDT_PROBE_ARGTYPE(prov, mod, func, name, 1, arg1, xarg1); \
|
||
244 | SDT_PROBE_ARGTYPE(prov, mod, func, name, 2, arg2, xarg2)
|
||
245 | |||
246 | #define SDT_PROBE_DEFINE4_XLATE(prov, mod, func, name, arg0, xarg0, \
|
||
247 | arg1, xarg1, arg2, xarg2, arg3, xarg3) \ |
||
248 | SDT_PROBE_DEFINE(prov, mod, func, name); \ |
||
249 | SDT_PROBE_ARGTYPE(prov, mod, func, name, 0, arg0, xarg0); \
|
||
250 | SDT_PROBE_ARGTYPE(prov, mod, func, name, 1, arg1, xarg1); \
|
||
251 | SDT_PROBE_ARGTYPE(prov, mod, func, name, 2, arg2, xarg2); \
|
||
252 | SDT_PROBE_ARGTYPE(prov, mod, func, name, 3, arg3, xarg3)
|
||
253 | |||
254 | #define SDT_PROBE_DEFINE5_XLATE(prov, mod, func, name, arg0, xarg0, \
|
||
255 | arg1, xarg1, arg2, xarg2, arg3, xarg3, arg4, xarg4) \ |
||
256 | SDT_PROBE_DEFINE(prov, mod, func, name); \ |
||
257 | SDT_PROBE_ARGTYPE(prov, mod, func, name, 0, arg0, xarg0); \
|
||
258 | SDT_PROBE_ARGTYPE(prov, mod, func, name, 1, arg1, xarg1); \
|
||
259 | SDT_PROBE_ARGTYPE(prov, mod, func, name, 2, arg2, xarg2); \
|
||
260 | SDT_PROBE_ARGTYPE(prov, mod, func, name, 3, arg3, xarg3); \
|
||
261 | SDT_PROBE_ARGTYPE(prov, mod, func, name, 4, arg4, xarg4)
|
||
262 | |||
263 | #define SDT_PROBE_DEFINE6_XLATE(prov, mod, func, name, arg0, xarg0, \
|
||
264 | arg1, xarg1, arg2, xarg2, arg3, xarg3, arg4, xarg4, arg5, xarg5) \ |
||
265 | SDT_PROBE_DEFINE(prov, mod, func, name); \ |
||
266 | SDT_PROBE_ARGTYPE(prov, mod, func, name, 0, arg0, xarg0); \
|
||
267 | SDT_PROBE_ARGTYPE(prov, mod, func, name, 1, arg1, xarg1); \
|
||
268 | SDT_PROBE_ARGTYPE(prov, mod, func, name, 2, arg2, xarg2); \
|
||
269 | SDT_PROBE_ARGTYPE(prov, mod, func, name, 3, arg3, xarg3); \
|
||
270 | SDT_PROBE_ARGTYPE(prov, mod, func, name, 4, arg4, xarg4); \
|
||
271 | SDT_PROBE_ARGTYPE(prov, mod, func, name, 5, arg5, xarg5)
|
||
272 | |||
273 | #define SDT_PROBE_DEFINE7_XLATE(prov, mod, func, name, arg0, xarg0, \
|
||
274 | arg1, xarg1, arg2, xarg2, arg3, xarg3, arg4, xarg4, arg5, xarg5, arg6, \ |
||
275 | xarg6) \ |
||
276 | SDT_PROBE_DEFINE(prov, mod, func, name); \ |
||
277 | SDT_PROBE_ARGTYPE(prov, mod, func, name, 0, arg0, xarg0); \
|
||
278 | SDT_PROBE_ARGTYPE(prov, mod, func, name, 1, arg1, xarg1); \
|
||
279 | SDT_PROBE_ARGTYPE(prov, mod, func, name, 2, arg2, xarg2); \
|
||
280 | SDT_PROBE_ARGTYPE(prov, mod, func, name, 3, arg3, xarg3); \
|
||
281 | SDT_PROBE_ARGTYPE(prov, mod, func, name, 4, arg4, xarg4); \
|
||
282 | SDT_PROBE_ARGTYPE(prov, mod, func, name, 5, arg5, xarg5); \
|
||
283 | SDT_PROBE_ARGTYPE(prov, mod, func, name, 6, arg6, xarg6)
|
||
284 | |||
285 | #define SDT_PROBE0(prov, mod, func, name) \
|
||
286 | SDT_PROBE(prov, mod, func, name, 0, 0, 0, 0, 0) |
||
287 | #define SDT_PROBE1(prov, mod, func, name, arg0) \
|
||
288 | SDT_PROBE(prov, mod, func, name, arg0, 0, 0, 0, 0) |
||
289 | #define SDT_PROBE2(prov, mod, func, name, arg0, arg1) \
|
||
290 | SDT_PROBE(prov, mod, func, name, arg0, arg1, 0, 0, 0) |
||
291 | #define SDT_PROBE3(prov, mod, func, name, arg0, arg1, arg2) \
|
||
292 | SDT_PROBE(prov, mod, func, name, arg0, arg1, arg2, 0, 0) |
||
293 | #define SDT_PROBE4(prov, mod, func, name, arg0, arg1, arg2, arg3) \
|
||
294 | SDT_PROBE(prov, mod, func, name, arg0, arg1, arg2, arg3, 0)
|
||
295 | #define SDT_PROBE5(prov, mod, func, name, arg0, arg1, arg2, arg3, arg4) \
|
||
296 | SDT_PROBE(prov, mod, func, name, arg0, arg1, arg2, arg3, arg4) |
||
297 | #define SDT_PROBE6(prov, mod, func, name, arg0, arg1, arg2, arg3, arg4, arg5) \
|
||
298 | do { \
|
||
299 | if (sdt_##prov##_##mod##_##func##_##name->id) \ |
||
300 | (*(void (*)(uint32_t, uintptr_t, uintptr_t, uintptr_t, \
|
||
301 | uintptr_t, uintptr_t, uintptr_t))sdt_probe_func)( \ |
||
302 | sdt_##prov##_##mod##_##func##_##name->id, \ |
||
303 | (uintptr_t)arg0, (uintptr_t)arg1, (uintptr_t)arg2, \ |
||
304 | (uintptr_t)arg3, (uintptr_t)arg4, (uintptr_t)arg5);\ |
||
305 | } while (0) |
||
306 | #define SDT_PROBE7(prov, mod, func, name, arg0, arg1, arg2, arg3, arg4, arg5, \
|
||
307 | arg6) \ |
||
308 | do { \
|
||
309 | if (sdt_##prov##_##mod##_##func##_##name->id) \ |
||
310 | (*(void (*)(uint32_t, uintptr_t, uintptr_t, uintptr_t, \
|
||
311 | uintptr_t, uintptr_t, uintptr_t, uintptr_t)) \ |
||
312 | sdt_probe_func)( \ |
||
313 | sdt_##prov##_##mod##_##func##_##name->id, \ |
||
314 | (uintptr_t)arg0, (uintptr_t)arg1, (uintptr_t)arg2, \ |
||
315 | (uintptr_t)arg3, (uintptr_t)arg4, (uintptr_t)arg5, \ |
||
316 | (uintptr_t)arg6); \ |
||
317 | } while (0) |
||
318 | |||
319 | #define DTRACE_PROBE_IMPL_START(name, arg0, arg1, arg2, arg3, arg4) do { \ |
||
320 | static SDT_PROBE_DEFINE(sdt, , , name); \
|
||
321 | SDT_PROBE(sdt, , , name, arg0, arg1, arg2, arg3, arg4); |
||
322 | #define DTRACE_PROBE_IMPL_END } while (0) |
||
323 | |||
324 | #define DTRACE_PROBE(name) \
|
||
325 | DTRACE_PROBE_IMPL_START(name, 0, 0, 0, 0, 0) \ |
||
326 | DTRACE_PROBE_IMPL_END |
||
327 | |||
328 | #define DTRACE_PROBE1(name, type0, arg0) \
|
||
329 | DTRACE_PROBE_IMPL_START(name, arg0, 0, 0, 0, 0) \ |
||
330 | SDT_PROBE_ARGTYPE(sdt, , , name, 0, #type0, NULL); \ |
||
331 | DTRACE_PROBE_IMPL_END |
||
332 | |||
333 | #define DTRACE_PROBE2(name, type0, arg0, type1, arg1) \
|
||
334 | DTRACE_PROBE_IMPL_START(name, arg0, arg1, 0, 0, 0) \ |
||
335 | SDT_PROBE_ARGTYPE(sdt, , , name, 0, #type0, NULL); \ |
||
336 | SDT_PROBE_ARGTYPE(sdt, , , name, 1, #type1, NULL); \ |
||
337 | DTRACE_PROBE_IMPL_END |
||
338 | |||
339 | #define DTRACE_PROBE3(name, type0, arg0, type1, arg1, type2, arg2) \
|
||
340 | DTRACE_PROBE_IMPL_START(name, arg0, arg1, arg2, 0, 0) \ |
||
341 | SDT_PROBE_ARGTYPE(sdt, , , name, 0, #type0, NULL); \ |
||
342 | SDT_PROBE_ARGTYPE(sdt, , , name, 1, #type1, NULL); \ |
||
343 | SDT_PROBE_ARGTYPE(sdt, , , name, 2, #type2, NULL); \ |
||
344 | DTRACE_PROBE_IMPL_END |
||
345 | |||
346 | #define DTRACE_PROBE4(name, type0, arg0, type1, arg1, type2, arg2, type3, arg3) \
|
||
347 | DTRACE_PROBE_IMPL_START(name, arg0, arg1, arg2, arg3, 0) \
|
||
348 | SDT_PROBE_ARGTYPE(sdt, , , name, 0, #type0, NULL); \ |
||
349 | SDT_PROBE_ARGTYPE(sdt, , , name, 1, #type1, NULL); \ |
||
350 | SDT_PROBE_ARGTYPE(sdt, , , name, 2, #type2, NULL); \ |
||
351 | SDT_PROBE_ARGTYPE(sdt, , , name, 3, #type3, NULL); \ |
||
352 | DTRACE_PROBE_IMPL_END |
||
353 | |||
354 | #define DTRACE_PROBE5(name, type0, arg0, type1, arg1, type2, arg2, type3, arg3, \
|
||
355 | type4, arg4) \ |
||
356 | DTRACE_PROBE_IMPL_START(name, arg0, arg1, arg2, arg3, arg4) \ |
||
357 | SDT_PROBE_ARGTYPE(sdt, , , name, 0, #type0, NULL); \ |
||
358 | SDT_PROBE_ARGTYPE(sdt, , , name, 1, #type1, NULL); \ |
||
359 | SDT_PROBE_ARGTYPE(sdt, , , name, 2, #type2, NULL); \ |
||
360 | SDT_PROBE_ARGTYPE(sdt, , , name, 3, #type3, NULL); \ |
||
361 | SDT_PROBE_ARGTYPE(sdt, , , name, 4, #type4, NULL); \ |
||
362 | DTRACE_PROBE_IMPL_END |
||
363 | |||
364 | #endif /* KDTRACE_HOOKS */ |
||
365 | |||
366 | /*
|
||
367 | * This type definition must match that of dtrace_probe. It is defined this
|
||
368 | * way to avoid having to rely on CDDL code.
|
||
369 | */
|
||
370 | typedef void (*sdt_probe_func_t)(uint32_t, uintptr_t arg0, uintptr_t arg1, |
||
371 | uintptr_t arg2, uintptr_t arg3, uintptr_t arg4); |
||
372 | |||
373 | /*
|
||
374 | * The 'sdt' provider will set it to dtrace_probe when it loads.
|
||
375 | */
|
||
376 | extern sdt_probe_func_t sdt_probe_func;
|
||
377 | |||
378 | struct sdt_probe;
|
||
379 | struct sdt_provider;
|
||
380 | struct linker_file;
|
||
381 | |||
382 | struct sdt_argtype {
|
||
383 | int ndx; /* Argument index. */ |
||
384 | const char *type; /* Argument type string. */ |
||
385 | const char *xtype; /* Translated argument type. */ |
||
386 | TAILQ_ENTRY(sdt_argtype) |
||
387 | argtype_entry; /* Argument type list entry. */
|
||
388 | struct sdt_probe *probe; /* Ptr to the probe structure. */ |
||
389 | }; |
||
390 | |||
391 | struct sdt_probe {
|
||
392 | int version; /* Set to sizeof(struct sdt_probe). */ |
||
393 | struct sdt_provider *prov; /* Ptr to the provider structure. */ |
||
394 | TAILQ_ENTRY(sdt_probe) |
||
395 | probe_entry; /* SDT probe list entry. */
|
||
396 | TAILQ_HEAD(argtype_list_head, sdt_argtype) argtype_list; |
||
397 | const char *mod; |
||
398 | const char *func; |
||
399 | const char *name; |
||
400 | id_t id; /* DTrace probe ID. */
|
||
401 | int n_args; /* Number of arguments. */ |
||
402 | struct linker_file *sdtp_lf; /* Module in which we're defined. */ |
||
403 | }; |
||
404 | |||
405 | struct sdt_provider {
|
||
406 | const char *name; /* Provider name. */ |
||
407 | TAILQ_ENTRY(sdt_provider) |
||
408 | prov_entry; /* SDT provider list entry. */
|
||
409 | uintptr_t id; /* DTrace provider ID. */
|
||
410 | int sdt_refs; /* Number of module references. */ |
||
411 | }; |
||
412 | |||
413 | void sdt_probe_stub(uint32_t, uintptr_t, uintptr_t, uintptr_t, uintptr_t,
|
||
414 | uintptr_t); |
||
415 | |||
416 | SDT_PROVIDER_DECLARE(sdt); |
||
417 | |||
418 | void sdt_init(void *); |
||
419 | void sdt_exit(void); |
||
420 | |||
421 | |||
422 | #endif /* _KERNEL */ |
||
423 | |||
424 | #endif /* _SYS_SDT_H */ |