xref: /titanic_44/usr/src/uts/common/sys/sdt.h (revision 269e59f9a28bf47e0f463e64fc5af4a408b73b21)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 /*
22  * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
23  */
24 
25 #ifndef _SYS_SDT_H
26 #define	_SYS_SDT_H
27 
28 #ifdef	__cplusplus
29 extern "C" {
30 #endif
31 
32 #ifndef _KERNEL
33 
34 #define	DTRACE_PROBE(provider, name) {					\
35 	extern void __dtrace_##provider##___##name(void);		\
36 	__dtrace_##provider##___##name();				\
37 }
38 
39 #define	DTRACE_PROBE1(provider, name, arg1) {				\
40 	extern void __dtrace_##provider##___##name(unsigned long);	\
41 	__dtrace_##provider##___##name((unsigned long)arg1);		\
42 }
43 
44 #define	DTRACE_PROBE2(provider, name, arg1, arg2) {			\
45 	extern void __dtrace_##provider##___##name(unsigned long,	\
46 	    unsigned long);						\
47 	__dtrace_##provider##___##name((unsigned long)arg1,		\
48 	    (unsigned long)arg2);					\
49 }
50 
51 #define	DTRACE_PROBE3(provider, name, arg1, arg2, arg3) {		\
52 	extern void __dtrace_##provider##___##name(unsigned long,	\
53 	    unsigned long, unsigned long);				\
54 	__dtrace_##provider##___##name((unsigned long)arg1,		\
55 	    (unsigned long)arg2, (unsigned long)arg3);			\
56 }
57 
58 #define	DTRACE_PROBE4(provider, name, arg1, arg2, arg3, arg4) {		\
59 	extern void __dtrace_##provider##___##name(unsigned long,	\
60 	    unsigned long, unsigned long, unsigned long);		\
61 	__dtrace_##provider##___##name((unsigned long)arg1,		\
62 	    (unsigned long)arg2, (unsigned long)arg3,			\
63 	    (unsigned long)arg4);					\
64 }
65 
66 #define	DTRACE_PROBE5(provider, name, arg1, arg2, arg3, arg4, arg5) {	\
67 	extern void __dtrace_##provider##___##name(unsigned long,	\
68 	    unsigned long, unsigned long, unsigned long, unsigned long);\
69 	__dtrace_##provider##___##name((unsigned long)arg1,		\
70 	    (unsigned long)arg2, (unsigned long)arg3,			\
71 	    (unsigned long)arg4, (unsigned long)arg5);			\
72 }
73 
74 #else /* _KERNEL */
75 
76 #define	DTRACE_PROBE(name)	{					\
77 	extern void __dtrace_probe_##name(void);			\
78 	__dtrace_probe_##name();					\
79 }
80 
81 #define	DTRACE_PROBE1(name, type1, arg1) {				\
82 	extern void __dtrace_probe_##name(uintptr_t);			\
83 	__dtrace_probe_##name((uintptr_t)(arg1));			\
84 }
85 
86 #define	DTRACE_PROBE2(name, type1, arg1, type2, arg2) {			\
87 	extern void __dtrace_probe_##name(uintptr_t, uintptr_t);	\
88 	__dtrace_probe_##name((uintptr_t)(arg1), (uintptr_t)(arg2));	\
89 }
90 
91 #define	DTRACE_PROBE3(name, type1, arg1, type2, arg2, type3, arg3) {	\
92 	extern void __dtrace_probe_##name(uintptr_t, uintptr_t, uintptr_t); \
93 	__dtrace_probe_##name((uintptr_t)(arg1), (uintptr_t)(arg2),	\
94 	    (uintptr_t)(arg3));						\
95 }
96 
97 #define	DTRACE_PROBE4(name, type1, arg1, type2, arg2, 			\
98     type3, arg3, type4, arg4) {						\
99 	extern void __dtrace_probe_##name(uintptr_t, uintptr_t,		\
100 	    uintptr_t, uintptr_t);					\
101 	__dtrace_probe_##name((uintptr_t)(arg1), (uintptr_t)(arg2),	\
102 	    (uintptr_t)(arg3), (uintptr_t)(arg4));			\
103 }
104 
105 #define	DTRACE_PROBE5(name, type1, arg1, type2, arg2, 			\
106     type3, arg3, type4, arg4, type5, arg5) {				\
107 	extern void __dtrace_probe_##name(uintptr_t, uintptr_t,		\
108 	    uintptr_t, uintptr_t, uintptr_t);				\
109 	__dtrace_probe_##name((uintptr_t)(arg1), (uintptr_t)(arg2),	\
110 	    (uintptr_t)(arg3), (uintptr_t)(arg4), (uintptr_t)(arg5));	\
111 }
112 
113 #define	DTRACE_PROBE6(name, type1, arg1, type2, arg2, 			\
114     type3, arg3, type4, arg4, type5, arg5, type6, arg6) {		\
115 	extern void __dtrace_probe_##name(uintptr_t, uintptr_t,		\
116 	    uintptr_t, uintptr_t, uintptr_t, uintptr_t);		\
117 	__dtrace_probe_##name((uintptr_t)(arg1), (uintptr_t)(arg2),	\
118 	    (uintptr_t)(arg3), (uintptr_t)(arg4), (uintptr_t)(arg5),	\
119 	    (uintptr_t)(arg6));						\
120 }
121 
122 #define	DTRACE_PROBE7(name, type1, arg1, type2, arg2, type3, arg3,	\
123     type4, arg4, type5, arg5, type6, arg6, type7, arg7) {		\
124 	extern void __dtrace_probe_##name(uintptr_t, uintptr_t,		\
125 	    uintptr_t, uintptr_t, uintptr_t, uintptr_t, uintptr_t);	\
126 	__dtrace_probe_##name((uintptr_t)(arg1), (uintptr_t)(arg2),	\
127 	    (uintptr_t)(arg3), (uintptr_t)(arg4), (uintptr_t)(arg5),	\
128 	    (uintptr_t)(arg6), (uintptr_t)(arg7));			\
129 }
130 
131 #define	DTRACE_PROBE8(name, type1, arg1, type2, arg2, type3, arg3,	\
132     type4, arg4, type5, arg5, type6, arg6, type7, arg7, type8, arg8) {	\
133 	extern void __dtrace_probe_##name(uintptr_t, uintptr_t,		\
134 	    uintptr_t, uintptr_t, uintptr_t, uintptr_t,			\
135 	    uintptr_t, uintptr_t);					\
136 	__dtrace_probe_##name((uintptr_t)(arg1), (uintptr_t)(arg2),	\
137 	    (uintptr_t)(arg3), (uintptr_t)(arg4), (uintptr_t)(arg5),	\
138 	    (uintptr_t)(arg6), (uintptr_t)(arg7), (uintptr_t)(arg8));	\
139 }
140 
141 #define	DTRACE_SCHED(name)						\
142 	DTRACE_PROBE(__sched_##name);
143 
144 #define	DTRACE_SCHED1(name, type1, arg1)				\
145 	DTRACE_PROBE1(__sched_##name, type1, arg1);
146 
147 #define	DTRACE_SCHED2(name, type1, arg1, type2, arg2)			\
148 	DTRACE_PROBE2(__sched_##name, type1, arg1, type2, arg2);
149 
150 #define	DTRACE_SCHED3(name, type1, arg1, type2, arg2, type3, arg3)	\
151 	DTRACE_PROBE3(__sched_##name, type1, arg1, type2, arg2, type3, arg3);
152 
153 #define	DTRACE_SCHED4(name, type1, arg1, type2, arg2, 			\
154     type3, arg3, type4, arg4)						\
155 	DTRACE_PROBE4(__sched_##name, type1, arg1, type2, arg2, 	\
156 	    type3, arg3, type4, arg4);
157 
158 #define	DTRACE_PROC(name)						\
159 	DTRACE_PROBE(__proc_##name);
160 
161 #define	DTRACE_PROC1(name, type1, arg1)					\
162 	DTRACE_PROBE1(__proc_##name, type1, arg1);
163 
164 #define	DTRACE_PROC2(name, type1, arg1, type2, arg2)			\
165 	DTRACE_PROBE2(__proc_##name, type1, arg1, type2, arg2);
166 
167 #define	DTRACE_PROC3(name, type1, arg1, type2, arg2, type3, arg3)	\
168 	DTRACE_PROBE3(__proc_##name, type1, arg1, type2, arg2, type3, arg3);
169 
170 #define	DTRACE_PROC4(name, type1, arg1, type2, arg2, 			\
171     type3, arg3, type4, arg4)						\
172 	DTRACE_PROBE4(__proc_##name, type1, arg1, type2, arg2, 		\
173 	    type3, arg3, type4, arg4);
174 
175 #define	DTRACE_IO(name)							\
176 	DTRACE_PROBE(__io_##name);
177 
178 #define	DTRACE_IO1(name, type1, arg1)					\
179 	DTRACE_PROBE1(__io_##name, type1, arg1);
180 
181 #define	DTRACE_IO2(name, type1, arg1, type2, arg2)			\
182 	DTRACE_PROBE2(__io_##name, type1, arg1, type2, arg2);
183 
184 #define	DTRACE_IO3(name, type1, arg1, type2, arg2, type3, arg3)	\
185 	DTRACE_PROBE3(__io_##name, type1, arg1, type2, arg2, type3, arg3);
186 
187 #define	DTRACE_IO4(name, type1, arg1, type2, arg2, 			\
188     type3, arg3, type4, arg4)						\
189 	DTRACE_PROBE4(__io_##name, type1, arg1, type2, arg2, 		\
190 	    type3, arg3, type4, arg4);
191 
192 #define	DTRACE_ISCSI_2(name, type1, arg1, type2, arg2)			\
193 	DTRACE_PROBE2(__iscsi_##name, type1, arg1, type2, arg2);
194 
195 #define	DTRACE_ISCSI_3(name, type1, arg1, type2, arg2, type3, arg3)	\
196 	DTRACE_PROBE3(__iscsi_##name, type1, arg1, type2, arg2, type3, arg3);
197 
198 #define	DTRACE_ISCSI_4(name, type1, arg1, type2, arg2,			\
199     type3, arg3, type4, arg4)						\
200 	DTRACE_PROBE4(__iscsi_##name, type1, arg1, type2, arg2,		\
201 	    type3, arg3, type4, arg4);
202 
203 #define	DTRACE_ISCSI_5(name, type1, arg1, type2, arg2,			\
204     type3, arg3, type4, arg4, type5, arg5)				\
205 	DTRACE_PROBE5(__iscsi_##name, type1, arg1, type2, arg2,		\
206 	    type3, arg3, type4, arg4, type5, arg5);
207 
208 #define	DTRACE_ISCSI_6(name, type1, arg1, type2, arg2,			\
209     type3, arg3, type4, arg4, type5, arg5, type6, arg6)			\
210 	DTRACE_PROBE6(__iscsi_##name, type1, arg1, type2, arg2,		\
211 	    type3, arg3, type4, arg4, type5, arg5, type6, arg6);
212 
213 #define	DTRACE_ISCSI_7(name, type1, arg1, type2, arg2,			\
214     type3, arg3, type4, arg4, type5, arg5, type6, arg6, type7, arg7)	\
215 	DTRACE_PROBE7(__iscsi_##name, type1, arg1, type2, arg2,		\
216 	    type3, arg3, type4, arg4, type5, arg5, type6, arg6,		\
217 	    type7, arg7);
218 
219 #define	DTRACE_ISCSI_8(name, type1, arg1, type2, arg2,			\
220     type3, arg3, type4, arg4, type5, arg5, type6, arg6,			\
221     type7, arg7, type8, arg8)						\
222 	DTRACE_PROBE8(__iscsi_##name, type1, arg1, type2, arg2,		\
223 	    type3, arg3, type4, arg4, type5, arg5, type6, arg6,		\
224 	    type7, arg7, type8, arg8);
225 
226 #define	DTRACE_NFSV3_3(name, type1, arg1, type2, arg2, 			\
227     type3, arg3)							\
228 	DTRACE_PROBE3(__nfsv3_##name, type1, arg1, type2, arg2,		\
229 	    type3, arg3);
230 #define	DTRACE_NFSV3_4(name, type1, arg1, type2, arg2, 			\
231     type3, arg3, type4, arg4)						\
232 	DTRACE_PROBE4(__nfsv3_##name, type1, arg1, type2, arg2,		\
233 	    type3, arg3, type4, arg4);
234 
235 #define	DTRACE_NFSV4_1(name, type1, arg1) \
236 	DTRACE_PROBE1(__nfsv4_##name, type1, arg1);
237 
238 #define	DTRACE_NFSV4_2(name, type1, arg1, type2, arg2) \
239 	DTRACE_PROBE2(__nfsv4_##name, type1, arg1, type2, arg2);
240 
241 #define	DTRACE_NFSV4_3(name, type1, arg1, type2, arg2, type3, arg3) \
242 	DTRACE_PROBE3(__nfsv4_##name, type1, arg1, type2, arg2, type3, arg3);
243 
244 #define	DTRACE_SMB_1(name, type1, arg1) \
245 	DTRACE_PROBE1(__smb_##name, type1, arg1);
246 
247 #define	DTRACE_SMB_2(name, type1, arg1, type2, arg2) \
248 	DTRACE_PROBE2(__smb_##name, type1, arg1, type2, arg2);
249 
250 #define	DTRACE_IP(name)						\
251 	DTRACE_PROBE(__ip_##name);
252 
253 #define	DTRACE_IP1(name, type1, arg1)					\
254 	DTRACE_PROBE1(__ip_##name, type1, arg1);
255 
256 #define	DTRACE_IP2(name, type1, arg1, type2, arg2)			\
257 	DTRACE_PROBE2(__ip_##name, type1, arg1, type2, arg2);
258 
259 #define	DTRACE_IP3(name, type1, arg1, type2, arg2, type3, arg3)	\
260 	DTRACE_PROBE3(__ip_##name, type1, arg1, type2, arg2, type3, arg3);
261 
262 #define	DTRACE_IP4(name, type1, arg1, type2, arg2, 			\
263     type3, arg3, type4, arg4)						\
264 	DTRACE_PROBE4(__ip_##name, type1, arg1, type2, arg2, 		\
265 	    type3, arg3, type4, arg4);
266 
267 #define	DTRACE_IP5(name, type1, arg1, type2, arg2, 			\
268     type3, arg3, type4, arg4, type5, arg5)				\
269 	DTRACE_PROBE5(__ip_##name, type1, arg1, type2, arg2, 		\
270 	    type3, arg3, type4, arg4, type5, arg5);
271 
272 #define	DTRACE_IP6(name, type1, arg1, type2, arg2, 			\
273     type3, arg3, type4, arg4, type5, arg5, type6, arg6)			\
274 	DTRACE_PROBE6(__ip_##name, type1, arg1, type2, arg2, 		\
275 	    type3, arg3, type4, arg4, type5, arg5, type6, arg6);
276 
277 #define	DTRACE_IP7(name, type1, arg1, type2, arg2, type3, arg3,		\
278     type4, arg4, type5, arg5, type6, arg6, type7, arg7)			\
279 	DTRACE_PROBE7(__ip_##name, type1, arg1, type2, arg2, 		\
280 	    type3, arg3, type4, arg4, type5, arg5, type6, arg6,		\
281 	    type7, arg7);
282 
283 #define	DTRACE_TCP(name)						\
284 	DTRACE_PROBE(__tcp_##name);
285 
286 #define	DTRACE_TCP1(name, type1, arg1)					\
287 	DTRACE_PROBE1(__tcp_##name, type1, arg1);
288 
289 #define	DTRACE_TCP2(name, type1, arg1, type2, arg2)			\
290 	DTRACE_PROBE2(__tcp_##name, type1, arg1, type2, arg2);
291 
292 #define	DTRACE_TCP3(name, type1, arg1, type2, arg2, type3, arg3)	\
293 	DTRACE_PROBE3(__tcp_##name, type1, arg1, type2, arg2, type3, arg3);
294 
295 #define	DTRACE_TCP4(name, type1, arg1, type2, arg2,			\
296     type3, arg3, type4, arg4)						\
297 	DTRACE_PROBE4(__tcp_##name, type1, arg1, type2, arg2,		\
298 	    type3, arg3, type4, arg4);
299 
300 #define	DTRACE_TCP5(name, type1, arg1, type2, arg2,			\
301     type3, arg3, type4, arg4, type5, arg5)				\
302 	DTRACE_PROBE5(__tcp_##name, type1, arg1, type2, arg2,		\
303 	    type3, arg3, type4, arg4, type5, arg5);
304 
305 #define	DTRACE_TCP6(name, type1, arg1, type2, arg2,			\
306     type3, arg3, type4, arg4, type5, arg5, type6, arg6)			\
307 	DTRACE_PROBE6(__tcp_##name, type1, arg1, type2, arg2,		\
308 	    type3, arg3, type4, arg4, type5, arg5, type6, arg6);
309 
310 #define	DTRACE_UDP(name)						\
311 	DTRACE_PROBE(__udp_##name);
312 
313 #define	DTRACE_UDP1(name, type1, arg1)					\
314 	DTRACE_PROBE1(__udp_##name, type1, arg1);
315 
316 #define	DTRACE_UDP2(name, type1, arg1, type2, arg2)			\
317 	DTRACE_PROBE2(__udp_##name, type1, arg1, type2, arg2);
318 
319 #define	DTRACE_UDP3(name, type1, arg1, type2, arg2, type3, arg3)	\
320 	DTRACE_PROBE3(__udp_##name, type1, arg1, type2, arg2, type3, arg3);
321 
322 #define	DTRACE_UDP4(name, type1, arg1, type2, arg2,			\
323     type3, arg3, type4, arg4)						\
324 	DTRACE_PROBE4(__udp_##name, type1, arg1, type2, arg2,		\
325 	    type3, arg3, type4, arg4);
326 
327 #define	DTRACE_UDP5(name, type1, arg1, type2, arg2,			\
328     type3, arg3, type4, arg4, type5, arg5)				\
329 	DTRACE_PROBE5(__udp_##name, type1, arg1, type2, arg2,		\
330 	    type3, arg3, type4, arg4, type5, arg5);
331 
332 
333 #define	DTRACE_SYSEVENT2(name, type1, arg1, type2, arg2)		\
334 	DTRACE_PROBE2(__sysevent_##name, type1, arg1, type2, arg2);
335 
336 #define	DTRACE_XPV(name)						\
337 	DTRACE_PROBE(__xpv_##name);
338 
339 #define	DTRACE_XPV1(name, type1, arg1)					\
340 	DTRACE_PROBE1(__xpv_##name, type1, arg1);
341 
342 #define	DTRACE_XPV2(name, type1, arg1, type2, arg2)			\
343 	DTRACE_PROBE2(__xpv_##name, type1, arg1, type2, arg2);
344 
345 #define	DTRACE_XPV3(name, type1, arg1, type2, arg2, type3, arg3)	\
346 	DTRACE_PROBE3(__xpv_##name, type1, arg1, type2, arg2, type3, arg3);
347 
348 #define	DTRACE_XPV4(name, type1, arg1, type2, arg2, type3, arg3,	\
349 	    type4, arg4)						\
350 	DTRACE_PROBE4(__xpv_##name, type1, arg1, type2, arg2, 		\
351 	    type3, arg3, type4, arg4);
352 
353 #define	DTRACE_FC_1(name, type1, arg1) \
354 	DTRACE_PROBE1(__fc_##name, type1, arg1);
355 
356 #define	DTRACE_FC_2(name, type1, arg1, type2, arg2) \
357 	DTRACE_PROBE2(__fc_##name, type1, arg1, type2, arg2);
358 
359 #define	DTRACE_FC_3(name, type1, arg1, type2, arg2, type3, arg3) \
360 	DTRACE_PROBE3(__fc_##name, type1, arg1, type2, arg2, type3, arg3);
361 
362 #define	DTRACE_FC_4(name, type1, arg1, type2, arg2, type3, arg3, type4, arg4) \
363 	DTRACE_PROBE4(__fc_##name, type1, arg1, type2, arg2, type3, arg3, \
364 	    type4, arg4);
365 
366 #define	DTRACE_FC_5(name, type1, arg1, type2, arg2, type3, arg3, 	\
367 	    type4, arg4, type5, arg5)					\
368 	DTRACE_PROBE5(__fc_##name, type1, arg1, type2, arg2, type3, arg3, \
369 	    type4, arg4, type5, arg5);
370 
371 #define	DTRACE_SRP_1(name, type1, arg1)					\
372 	DTRACE_PROBE1(__srp_##name, type1, arg1);
373 
374 #define	DTRACE_SRP_2(name, type1, arg1, type2, arg2)			\
375 	DTRACE_PROBE2(__srp_##name, type1, arg1, type2, arg2);
376 
377 #define	DTRACE_SRP_3(name, type1, arg1, type2, arg2, type3, arg3)	\
378 	DTRACE_PROBE3(__srp_##name, type1, arg1, type2, arg2, type3, arg3);
379 
380 #define	DTRACE_SRP_4(name, type1, arg1, type2, arg2, type3, arg3,	\
381 	    type4, arg4)						\
382 	DTRACE_PROBE4(__srp_##name, type1, arg1, type2, arg2, 		\
383 	    type3, arg3, type4, arg4);
384 
385 #define	DTRACE_SRP_5(name, type1, arg1, type2, arg2, type3, arg3,	\
386 	    type4, arg4, type5, arg5)					\
387 	DTRACE_PROBE5(__srp_##name, type1, arg1, type2, arg2, 		\
388 	    type3, arg3, type4, arg4, type5, arg5);
389 
390 #define	DTRACE_SRP_6(name, type1, arg1, type2, arg2, type3, arg3,	\
391 	    type4, arg4, type5, arg5, type6, arg6)			\
392 	DTRACE_PROBE6(__srp_##name, type1, arg1, type2, arg2, 		\
393 	    type3, arg3, type4, arg4, type5, arg5, type6, arg6);
394 
395 #define	DTRACE_SRP_7(name, type1, arg1, type2, arg2, type3, arg3,	\
396 	    type4, arg4, type5, arg5, type6, arg6, type7, arg7)		\
397 	DTRACE_PROBE7(__srp_##name, type1, arg1, type2, arg2, 		\
398 	    type3, arg3, type4, arg4, type5, arg5, type6, arg6, type7, arg7);
399 
400 #define	DTRACE_SRP_8(name, type1, arg1, type2, arg2, type3, arg3,	\
401 	    type4, arg4, type5, arg5, type6, arg6, type7, arg7, type8, arg8) \
402 	DTRACE_PROBE8(__srp_##name, type1, arg1, type2, arg2, 		\
403 	    type3, arg3, type4, arg4, type5, arg5, type6, arg6,		\
404 	    type7, arg7, type8, arg8);
405 
406 #endif /* _KERNEL */
407 
408 extern const char *sdt_prefix;
409 
410 typedef struct sdt_probedesc {
411 	char			*sdpd_name;	/* name of this probe */
412 	unsigned long		sdpd_offset;	/* offset of call in text */
413 	struct sdt_probedesc	*sdpd_next;	/* next static probe */
414 } sdt_probedesc_t;
415 
416 #ifdef	__cplusplus
417 }
418 #endif
419 
420 #endif	/* _SYS_SDT_H */
421