xref: /illumos-gate/usr/src/uts/common/sys/sdt.h (revision 0dfe541e)
17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * CDDL HEADER START
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5e04145d0Seschrock  * Common Development and Distribution License (the "License").
6e04145d0Seschrock  * You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate  *
87c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate  * and limitations under the License.
127c478bd9Sstevel@tonic-gate  *
137c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate  *
197c478bd9Sstevel@tonic-gate  * CDDL HEADER END
207c478bd9Sstevel@tonic-gate  */
217c478bd9Sstevel@tonic-gate /*
229cd928feSAlan Maguire  * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
23be6fd75aSMatthew Ahrens  * Copyright (c) 2013 by Delphix. All rights reserved.
24*0dfe541eSEvan Layton  * Copyright 2018 Nexenta Systems, Inc.  All rights reserved.
257c478bd9Sstevel@tonic-gate  */
267c478bd9Sstevel@tonic-gate 
277c478bd9Sstevel@tonic-gate #ifndef _SYS_SDT_H
287c478bd9Sstevel@tonic-gate #define	_SYS_SDT_H
297c478bd9Sstevel@tonic-gate 
30be6fd75aSMatthew Ahrens #include <sys/stdint.h>
31be6fd75aSMatthew Ahrens 
327c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
337c478bd9Sstevel@tonic-gate extern "C" {
347c478bd9Sstevel@tonic-gate #endif
357c478bd9Sstevel@tonic-gate 
367c478bd9Sstevel@tonic-gate #ifndef _KERNEL
377c478bd9Sstevel@tonic-gate 
387c478bd9Sstevel@tonic-gate #define	DTRACE_PROBE(provider, name) {					\
397c478bd9Sstevel@tonic-gate 	extern void __dtrace_##provider##___##name(void);		\
407c478bd9Sstevel@tonic-gate 	__dtrace_##provider##___##name();				\
417c478bd9Sstevel@tonic-gate }
427c478bd9Sstevel@tonic-gate 
437c478bd9Sstevel@tonic-gate #define	DTRACE_PROBE1(provider, name, arg1) {				\
447c478bd9Sstevel@tonic-gate 	extern void __dtrace_##provider##___##name(unsigned long);	\
457c478bd9Sstevel@tonic-gate 	__dtrace_##provider##___##name((unsigned long)arg1);		\
467c478bd9Sstevel@tonic-gate }
477c478bd9Sstevel@tonic-gate 
487c478bd9Sstevel@tonic-gate #define	DTRACE_PROBE2(provider, name, arg1, arg2) {			\
497c478bd9Sstevel@tonic-gate 	extern void __dtrace_##provider##___##name(unsigned long,	\
507c478bd9Sstevel@tonic-gate 	    unsigned long);						\
517c478bd9Sstevel@tonic-gate 	__dtrace_##provider##___##name((unsigned long)arg1,		\
527c478bd9Sstevel@tonic-gate 	    (unsigned long)arg2);					\
537c478bd9Sstevel@tonic-gate }
547c478bd9Sstevel@tonic-gate 
557c478bd9Sstevel@tonic-gate #define	DTRACE_PROBE3(provider, name, arg1, arg2, arg3) {		\
567c478bd9Sstevel@tonic-gate 	extern void __dtrace_##provider##___##name(unsigned long,	\
577c478bd9Sstevel@tonic-gate 	    unsigned long, unsigned long);				\
587c478bd9Sstevel@tonic-gate 	__dtrace_##provider##___##name((unsigned long)arg1,		\
597c478bd9Sstevel@tonic-gate 	    (unsigned long)arg2, (unsigned long)arg3);			\
607c478bd9Sstevel@tonic-gate }
617c478bd9Sstevel@tonic-gate 
627c478bd9Sstevel@tonic-gate #define	DTRACE_PROBE4(provider, name, arg1, arg2, arg3, arg4) {		\
637c478bd9Sstevel@tonic-gate 	extern void __dtrace_##provider##___##name(unsigned long,	\
647c478bd9Sstevel@tonic-gate 	    unsigned long, unsigned long, unsigned long);		\
657c478bd9Sstevel@tonic-gate 	__dtrace_##provider##___##name((unsigned long)arg1,		\
667c478bd9Sstevel@tonic-gate 	    (unsigned long)arg2, (unsigned long)arg3,			\
677c478bd9Sstevel@tonic-gate 	    (unsigned long)arg4);					\
687c478bd9Sstevel@tonic-gate }
697c478bd9Sstevel@tonic-gate 
707c478bd9Sstevel@tonic-gate #define	DTRACE_PROBE5(provider, name, arg1, arg2, arg3, arg4, arg5) {	\
717c478bd9Sstevel@tonic-gate 	extern void __dtrace_##provider##___##name(unsigned long,	\
727c478bd9Sstevel@tonic-gate 	    unsigned long, unsigned long, unsigned long, unsigned long);\
737c478bd9Sstevel@tonic-gate 	__dtrace_##provider##___##name((unsigned long)arg1,		\
747c478bd9Sstevel@tonic-gate 	    (unsigned long)arg2, (unsigned long)arg3,			\
757c478bd9Sstevel@tonic-gate 	    (unsigned long)arg4, (unsigned long)arg5);			\
767c478bd9Sstevel@tonic-gate }
777c478bd9Sstevel@tonic-gate 
787c478bd9Sstevel@tonic-gate #else /* _KERNEL */
797c478bd9Sstevel@tonic-gate 
807c478bd9Sstevel@tonic-gate #define	DTRACE_PROBE(name)	{					\
817c478bd9Sstevel@tonic-gate 	extern void __dtrace_probe_##name(void);			\
827c478bd9Sstevel@tonic-gate 	__dtrace_probe_##name();					\
837c478bd9Sstevel@tonic-gate }
847c478bd9Sstevel@tonic-gate 
857c478bd9Sstevel@tonic-gate #define	DTRACE_PROBE1(name, type1, arg1) {				\
867c478bd9Sstevel@tonic-gate 	extern void __dtrace_probe_##name(uintptr_t);			\
877c478bd9Sstevel@tonic-gate 	__dtrace_probe_##name((uintptr_t)(arg1));			\
887c478bd9Sstevel@tonic-gate }
897c478bd9Sstevel@tonic-gate 
907c478bd9Sstevel@tonic-gate #define	DTRACE_PROBE2(name, type1, arg1, type2, arg2) {			\
917c478bd9Sstevel@tonic-gate 	extern void __dtrace_probe_##name(uintptr_t, uintptr_t);	\
927c478bd9Sstevel@tonic-gate 	__dtrace_probe_##name((uintptr_t)(arg1), (uintptr_t)(arg2));	\
937c478bd9Sstevel@tonic-gate }
947c478bd9Sstevel@tonic-gate 
957c478bd9Sstevel@tonic-gate #define	DTRACE_PROBE3(name, type1, arg1, type2, arg2, type3, arg3) {	\
967c478bd9Sstevel@tonic-gate 	extern void __dtrace_probe_##name(uintptr_t, uintptr_t, uintptr_t); \
977c478bd9Sstevel@tonic-gate 	__dtrace_probe_##name((uintptr_t)(arg1), (uintptr_t)(arg2),	\
987c478bd9Sstevel@tonic-gate 	    (uintptr_t)(arg3));						\
997c478bd9Sstevel@tonic-gate }
1007c478bd9Sstevel@tonic-gate 
101be6fd75aSMatthew Ahrens #define	DTRACE_PROBE4(name, type1, arg1, type2, arg2,			\
1027c478bd9Sstevel@tonic-gate     type3, arg3, type4, arg4) {						\
1037c478bd9Sstevel@tonic-gate 	extern void __dtrace_probe_##name(uintptr_t, uintptr_t,		\
1047c478bd9Sstevel@tonic-gate 	    uintptr_t, uintptr_t);					\
1057c478bd9Sstevel@tonic-gate 	__dtrace_probe_##name((uintptr_t)(arg1), (uintptr_t)(arg2),	\
1067c478bd9Sstevel@tonic-gate 	    (uintptr_t)(arg3), (uintptr_t)(arg4));			\
1077c478bd9Sstevel@tonic-gate }
1087c478bd9Sstevel@tonic-gate 
109be6fd75aSMatthew Ahrens #define	DTRACE_PROBE5(name, type1, arg1, type2, arg2,			\
11010e6dadfSbrendan     type3, arg3, type4, arg4, type5, arg5) {				\
11110e6dadfSbrendan 	extern void __dtrace_probe_##name(uintptr_t, uintptr_t,		\
11210e6dadfSbrendan 	    uintptr_t, uintptr_t, uintptr_t);				\
11310e6dadfSbrendan 	__dtrace_probe_##name((uintptr_t)(arg1), (uintptr_t)(arg2),	\
11410e6dadfSbrendan 	    (uintptr_t)(arg3), (uintptr_t)(arg4), (uintptr_t)(arg5));	\
11510e6dadfSbrendan }
11610e6dadfSbrendan 
117be6fd75aSMatthew Ahrens #define	DTRACE_PROBE6(name, type1, arg1, type2, arg2,			\
11810e6dadfSbrendan     type3, arg3, type4, arg4, type5, arg5, type6, arg6) {		\
11910e6dadfSbrendan 	extern void __dtrace_probe_##name(uintptr_t, uintptr_t,		\
12010e6dadfSbrendan 	    uintptr_t, uintptr_t, uintptr_t, uintptr_t);		\
12110e6dadfSbrendan 	__dtrace_probe_##name((uintptr_t)(arg1), (uintptr_t)(arg2),	\
12210e6dadfSbrendan 	    (uintptr_t)(arg3), (uintptr_t)(arg4), (uintptr_t)(arg5),	\
12310e6dadfSbrendan 	    (uintptr_t)(arg6));						\
12410e6dadfSbrendan }
12510e6dadfSbrendan 
12610e6dadfSbrendan #define	DTRACE_PROBE7(name, type1, arg1, type2, arg2, type3, arg3,	\
12710e6dadfSbrendan     type4, arg4, type5, arg5, type6, arg6, type7, arg7) {		\
12810e6dadfSbrendan 	extern void __dtrace_probe_##name(uintptr_t, uintptr_t,		\
12910e6dadfSbrendan 	    uintptr_t, uintptr_t, uintptr_t, uintptr_t, uintptr_t);	\
13010e6dadfSbrendan 	__dtrace_probe_##name((uintptr_t)(arg1), (uintptr_t)(arg2),	\
13110e6dadfSbrendan 	    (uintptr_t)(arg3), (uintptr_t)(arg4), (uintptr_t)(arg5),	\
13210e6dadfSbrendan 	    (uintptr_t)(arg6), (uintptr_t)(arg7));			\
13310e6dadfSbrendan }
13410e6dadfSbrendan 
135a668b114SPriya Krishnan #define	DTRACE_PROBE8(name, type1, arg1, type2, arg2, type3, arg3,	\
136a668b114SPriya Krishnan     type4, arg4, type5, arg5, type6, arg6, type7, arg7, type8, arg8) {	\
137a668b114SPriya Krishnan 	extern void __dtrace_probe_##name(uintptr_t, uintptr_t,		\
138a668b114SPriya Krishnan 	    uintptr_t, uintptr_t, uintptr_t, uintptr_t,			\
139a668b114SPriya Krishnan 	    uintptr_t, uintptr_t);					\
140a668b114SPriya Krishnan 	__dtrace_probe_##name((uintptr_t)(arg1), (uintptr_t)(arg2),	\
141a668b114SPriya Krishnan 	    (uintptr_t)(arg3), (uintptr_t)(arg4), (uintptr_t)(arg5),	\
142a668b114SPriya Krishnan 	    (uintptr_t)(arg6), (uintptr_t)(arg7), (uintptr_t)(arg8));	\
143a668b114SPriya Krishnan }
144a668b114SPriya Krishnan 
1457c478bd9Sstevel@tonic-gate #define	DTRACE_SCHED(name)						\
1467c478bd9Sstevel@tonic-gate 	DTRACE_PROBE(__sched_##name);
1477c478bd9Sstevel@tonic-gate 
1487c478bd9Sstevel@tonic-gate #define	DTRACE_SCHED1(name, type1, arg1)				\
1497c478bd9Sstevel@tonic-gate 	DTRACE_PROBE1(__sched_##name, type1, arg1);
1507c478bd9Sstevel@tonic-gate 
1517c478bd9Sstevel@tonic-gate #define	DTRACE_SCHED2(name, type1, arg1, type2, arg2)			\
1527c478bd9Sstevel@tonic-gate 	DTRACE_PROBE2(__sched_##name, type1, arg1, type2, arg2);
1537c478bd9Sstevel@tonic-gate 
1547c478bd9Sstevel@tonic-gate #define	DTRACE_SCHED3(name, type1, arg1, type2, arg2, type3, arg3)	\
1557c478bd9Sstevel@tonic-gate 	DTRACE_PROBE3(__sched_##name, type1, arg1, type2, arg2, type3, arg3);
1567c478bd9Sstevel@tonic-gate 
157be6fd75aSMatthew Ahrens #define	DTRACE_SCHED4(name, type1, arg1, type2, arg2,			\
1587c478bd9Sstevel@tonic-gate     type3, arg3, type4, arg4)						\
159be6fd75aSMatthew Ahrens 	DTRACE_PROBE4(__sched_##name, type1, arg1, type2, arg2,		\
1607c478bd9Sstevel@tonic-gate 	    type3, arg3, type4, arg4);
1617c478bd9Sstevel@tonic-gate 
1627c478bd9Sstevel@tonic-gate #define	DTRACE_PROC(name)						\
1637c478bd9Sstevel@tonic-gate 	DTRACE_PROBE(__proc_##name);
1647c478bd9Sstevel@tonic-gate 
1657c478bd9Sstevel@tonic-gate #define	DTRACE_PROC1(name, type1, arg1)					\
1667c478bd9Sstevel@tonic-gate 	DTRACE_PROBE1(__proc_##name, type1, arg1);
1677c478bd9Sstevel@tonic-gate 
1687c478bd9Sstevel@tonic-gate #define	DTRACE_PROC2(name, type1, arg1, type2, arg2)			\
1697c478bd9Sstevel@tonic-gate 	DTRACE_PROBE2(__proc_##name, type1, arg1, type2, arg2);
1707c478bd9Sstevel@tonic-gate 
1717c478bd9Sstevel@tonic-gate #define	DTRACE_PROC3(name, type1, arg1, type2, arg2, type3, arg3)	\
1727c478bd9Sstevel@tonic-gate 	DTRACE_PROBE3(__proc_##name, type1, arg1, type2, arg2, type3, arg3);
1737c478bd9Sstevel@tonic-gate 
174be6fd75aSMatthew Ahrens #define	DTRACE_PROC4(name, type1, arg1, type2, arg2,			\
1757c478bd9Sstevel@tonic-gate     type3, arg3, type4, arg4)						\
176be6fd75aSMatthew Ahrens 	DTRACE_PROBE4(__proc_##name, type1, arg1, type2, arg2,		\
1777c478bd9Sstevel@tonic-gate 	    type3, arg3, type4, arg4);
1787c478bd9Sstevel@tonic-gate 
1797c478bd9Sstevel@tonic-gate #define	DTRACE_IO(name)							\
1807c478bd9Sstevel@tonic-gate 	DTRACE_PROBE(__io_##name);
1817c478bd9Sstevel@tonic-gate 
1827c478bd9Sstevel@tonic-gate #define	DTRACE_IO1(name, type1, arg1)					\
1837c478bd9Sstevel@tonic-gate 	DTRACE_PROBE1(__io_##name, type1, arg1);
1847c478bd9Sstevel@tonic-gate 
1857c478bd9Sstevel@tonic-gate #define	DTRACE_IO2(name, type1, arg1, type2, arg2)			\
1867c478bd9Sstevel@tonic-gate 	DTRACE_PROBE2(__io_##name, type1, arg1, type2, arg2);
1877c478bd9Sstevel@tonic-gate 
1887c478bd9Sstevel@tonic-gate #define	DTRACE_IO3(name, type1, arg1, type2, arg2, type3, arg3)	\
1897c478bd9Sstevel@tonic-gate 	DTRACE_PROBE3(__io_##name, type1, arg1, type2, arg2, type3, arg3);
1907c478bd9Sstevel@tonic-gate 
191be6fd75aSMatthew Ahrens #define	DTRACE_IO4(name, type1, arg1, type2, arg2,			\
1927c478bd9Sstevel@tonic-gate     type3, arg3, type4, arg4)						\
193be6fd75aSMatthew Ahrens 	DTRACE_PROBE4(__io_##name, type1, arg1, type2, arg2,		\
1947c478bd9Sstevel@tonic-gate 	    type3, arg3, type4, arg4);
1957c478bd9Sstevel@tonic-gate 
196a668b114SPriya Krishnan #define	DTRACE_ISCSI_2(name, type1, arg1, type2, arg2)			\
197a668b114SPriya Krishnan 	DTRACE_PROBE2(__iscsi_##name, type1, arg1, type2, arg2);
198a668b114SPriya Krishnan 
199a668b114SPriya Krishnan #define	DTRACE_ISCSI_3(name, type1, arg1, type2, arg2, type3, arg3)	\
200a668b114SPriya Krishnan 	DTRACE_PROBE3(__iscsi_##name, type1, arg1, type2, arg2, type3, arg3);
201a668b114SPriya Krishnan 
202a668b114SPriya Krishnan #define	DTRACE_ISCSI_4(name, type1, arg1, type2, arg2,			\
203a668b114SPriya Krishnan     type3, arg3, type4, arg4)						\
204a668b114SPriya Krishnan 	DTRACE_PROBE4(__iscsi_##name, type1, arg1, type2, arg2,		\
205a668b114SPriya Krishnan 	    type3, arg3, type4, arg4);
206a668b114SPriya Krishnan 
207a668b114SPriya Krishnan #define	DTRACE_ISCSI_5(name, type1, arg1, type2, arg2,			\
208a668b114SPriya Krishnan     type3, arg3, type4, arg4, type5, arg5)				\
209a668b114SPriya Krishnan 	DTRACE_PROBE5(__iscsi_##name, type1, arg1, type2, arg2,		\
210a668b114SPriya Krishnan 	    type3, arg3, type4, arg4, type5, arg5);
211a668b114SPriya Krishnan 
212a668b114SPriya Krishnan #define	DTRACE_ISCSI_6(name, type1, arg1, type2, arg2,			\
213a668b114SPriya Krishnan     type3, arg3, type4, arg4, type5, arg5, type6, arg6)			\
214a668b114SPriya Krishnan 	DTRACE_PROBE6(__iscsi_##name, type1, arg1, type2, arg2,		\
215a668b114SPriya Krishnan 	    type3, arg3, type4, arg4, type5, arg5, type6, arg6);
216a668b114SPriya Krishnan 
217a668b114SPriya Krishnan #define	DTRACE_ISCSI_7(name, type1, arg1, type2, arg2,			\
218a668b114SPriya Krishnan     type3, arg3, type4, arg4, type5, arg5, type6, arg6, type7, arg7)	\
219a668b114SPriya Krishnan 	DTRACE_PROBE7(__iscsi_##name, type1, arg1, type2, arg2,		\
220a668b114SPriya Krishnan 	    type3, arg3, type4, arg4, type5, arg5, type6, arg6,		\
221a668b114SPriya Krishnan 	    type7, arg7);
222a668b114SPriya Krishnan 
223a668b114SPriya Krishnan #define	DTRACE_ISCSI_8(name, type1, arg1, type2, arg2,			\
224a668b114SPriya Krishnan     type3, arg3, type4, arg4, type5, arg5, type6, arg6,			\
225a668b114SPriya Krishnan     type7, arg7, type8, arg8)						\
226a668b114SPriya Krishnan 	DTRACE_PROBE8(__iscsi_##name, type1, arg1, type2, arg2,		\
227a668b114SPriya Krishnan 	    type3, arg3, type4, arg4, type5, arg5, type6, arg6,		\
228a668b114SPriya Krishnan 	    type7, arg7, type8, arg8);
229a668b114SPriya Krishnan 
230be6fd75aSMatthew Ahrens #define	DTRACE_NFSV3_3(name, type1, arg1, type2, arg2,			\
231e1adf50cSahl     type3, arg3)							\
232e1adf50cSahl 	DTRACE_PROBE3(__nfsv3_##name, type1, arg1, type2, arg2,		\
233e1adf50cSahl 	    type3, arg3);
234*0dfe541eSEvan Layton 
235be6fd75aSMatthew Ahrens #define	DTRACE_NFSV3_4(name, type1, arg1, type2, arg2,			\
236e1adf50cSahl     type3, arg3, type4, arg4)						\
237e1adf50cSahl 	DTRACE_PROBE4(__nfsv3_##name, type1, arg1, type2, arg2,		\
238e1adf50cSahl 	    type3, arg3, type4, arg4);
239e1adf50cSahl 
240*0dfe541eSEvan Layton #define	DTRACE_NFSV3_5(name, type1, arg1, type2, arg2,			\
241*0dfe541eSEvan Layton     type3, arg3, type4, arg4, type5, arg5)				\
242*0dfe541eSEvan Layton 	DTRACE_PROBE5(__nfsv3_##name, type1, arg1, type2, arg2,		\
243*0dfe541eSEvan Layton 	    type3, arg3, type4, arg4, type5, arg5);
244*0dfe541eSEvan Layton 
245f3b585ceSsamf #define	DTRACE_NFSV4_1(name, type1, arg1) \
246f3b585ceSsamf 	DTRACE_PROBE1(__nfsv4_##name, type1, arg1);
247f3b585ceSsamf 
248f3b585ceSsamf #define	DTRACE_NFSV4_2(name, type1, arg1, type2, arg2) \
249f3b585ceSsamf 	DTRACE_PROBE2(__nfsv4_##name, type1, arg1, type2, arg2);
250f3b585ceSsamf 
251f3b585ceSsamf #define	DTRACE_NFSV4_3(name, type1, arg1, type2, arg2, type3, arg3) \
252f3b585ceSsamf 	DTRACE_PROBE3(__nfsv4_##name, type1, arg1, type2, arg2, type3, arg3);
253f3b585ceSsamf 
25493bc28dbSGordon Ross /*
25593bc28dbSGordon Ross  * The SMB probes are done a little differently from the other probes
25693bc28dbSGordon Ross  * in this file for the benefit of the libfksmbsrv USDT provider.
25793bc28dbSGordon Ross  * See: lib/smbsrv/libfksmbsrv/common/sys/sdt.h
25893bc28dbSGordon Ross  */
25993bc28dbSGordon Ross #define	DTRACE_SMB_START(name, type1, arg1) \
26093bc28dbSGordon Ross 	DTRACE_PROBE1(__smb_##name##__start, type1, arg1);
26193bc28dbSGordon Ross #define	DTRACE_SMB_DONE(name, type1, arg1) \
26293bc28dbSGordon Ross 	DTRACE_PROBE1(__smb_##name##__done, type1, arg1);
26393bc28dbSGordon Ross 
26493bc28dbSGordon Ross #define	DTRACE_SMB2_START(name, type1, arg1) \
26593bc28dbSGordon Ross 	DTRACE_PROBE1(__smb2_##name##__start, type1, arg1);
26693bc28dbSGordon Ross #define	DTRACE_SMB2_DONE(name, type1, arg1) \
26793bc28dbSGordon Ross 	DTRACE_PROBE1(__smb2_##name##__done, type1, arg1);
268faa1795aSjb 
26910e6dadfSbrendan #define	DTRACE_IP(name)						\
27010e6dadfSbrendan 	DTRACE_PROBE(__ip_##name);
27110e6dadfSbrendan 
27210e6dadfSbrendan #define	DTRACE_IP1(name, type1, arg1)					\
27310e6dadfSbrendan 	DTRACE_PROBE1(__ip_##name, type1, arg1);
27410e6dadfSbrendan 
27510e6dadfSbrendan #define	DTRACE_IP2(name, type1, arg1, type2, arg2)			\
27610e6dadfSbrendan 	DTRACE_PROBE2(__ip_##name, type1, arg1, type2, arg2);
27710e6dadfSbrendan 
27810e6dadfSbrendan #define	DTRACE_IP3(name, type1, arg1, type2, arg2, type3, arg3)	\
27910e6dadfSbrendan 	DTRACE_PROBE3(__ip_##name, type1, arg1, type2, arg2, type3, arg3);
28010e6dadfSbrendan 
281be6fd75aSMatthew Ahrens #define	DTRACE_IP4(name, type1, arg1, type2, arg2,			\
28210e6dadfSbrendan     type3, arg3, type4, arg4)						\
283be6fd75aSMatthew Ahrens 	DTRACE_PROBE4(__ip_##name, type1, arg1, type2, arg2,		\
28410e6dadfSbrendan 	    type3, arg3, type4, arg4);
28510e6dadfSbrendan 
286be6fd75aSMatthew Ahrens #define	DTRACE_IP5(name, type1, arg1, type2, arg2,			\
28710e6dadfSbrendan     type3, arg3, type4, arg4, type5, arg5)				\
288be6fd75aSMatthew Ahrens 	DTRACE_PROBE5(__ip_##name, type1, arg1, type2, arg2,		\
28910e6dadfSbrendan 	    type3, arg3, type4, arg4, type5, arg5);
29010e6dadfSbrendan 
291be6fd75aSMatthew Ahrens #define	DTRACE_IP6(name, type1, arg1, type2, arg2,			\
29210e6dadfSbrendan     type3, arg3, type4, arg4, type5, arg5, type6, arg6)			\
293be6fd75aSMatthew Ahrens 	DTRACE_PROBE6(__ip_##name, type1, arg1, type2, arg2,		\
29410e6dadfSbrendan 	    type3, arg3, type4, arg4, type5, arg5, type6, arg6);
29510e6dadfSbrendan 
29610e6dadfSbrendan #define	DTRACE_IP7(name, type1, arg1, type2, arg2, type3, arg3,		\
29710e6dadfSbrendan     type4, arg4, type5, arg5, type6, arg6, type7, arg7)			\
298be6fd75aSMatthew Ahrens 	DTRACE_PROBE7(__ip_##name, type1, arg1, type2, arg2,		\
29910e6dadfSbrendan 	    type3, arg3, type4, arg4, type5, arg5, type6, arg6,		\
30010e6dadfSbrendan 	    type7, arg7);
30110e6dadfSbrendan 
3029cd928feSAlan Maguire #define	DTRACE_TCP(name)						\
3039cd928feSAlan Maguire 	DTRACE_PROBE(__tcp_##name);
3049cd928feSAlan Maguire 
3059cd928feSAlan Maguire #define	DTRACE_TCP1(name, type1, arg1)					\
3069cd928feSAlan Maguire 	DTRACE_PROBE1(__tcp_##name, type1, arg1);
3079cd928feSAlan Maguire 
3089cd928feSAlan Maguire #define	DTRACE_TCP2(name, type1, arg1, type2, arg2)			\
3099cd928feSAlan Maguire 	DTRACE_PROBE2(__tcp_##name, type1, arg1, type2, arg2);
3109cd928feSAlan Maguire 
3119cd928feSAlan Maguire #define	DTRACE_TCP3(name, type1, arg1, type2, arg2, type3, arg3)	\
3129cd928feSAlan Maguire 	DTRACE_PROBE3(__tcp_##name, type1, arg1, type2, arg2, type3, arg3);
3139cd928feSAlan Maguire 
3149cd928feSAlan Maguire #define	DTRACE_TCP4(name, type1, arg1, type2, arg2,			\
3159cd928feSAlan Maguire     type3, arg3, type4, arg4)						\
3169cd928feSAlan Maguire 	DTRACE_PROBE4(__tcp_##name, type1, arg1, type2, arg2,		\
3179cd928feSAlan Maguire 	    type3, arg3, type4, arg4);
3189cd928feSAlan Maguire 
3199cd928feSAlan Maguire #define	DTRACE_TCP5(name, type1, arg1, type2, arg2,			\
3209cd928feSAlan Maguire     type3, arg3, type4, arg4, type5, arg5)				\
3219cd928feSAlan Maguire 	DTRACE_PROBE5(__tcp_##name, type1, arg1, type2, arg2,		\
3229cd928feSAlan Maguire 	    type3, arg3, type4, arg4, type5, arg5);
3239cd928feSAlan Maguire 
3249cd928feSAlan Maguire #define	DTRACE_TCP6(name, type1, arg1, type2, arg2,			\
3259cd928feSAlan Maguire     type3, arg3, type4, arg4, type5, arg5, type6, arg6)			\
3269cd928feSAlan Maguire 	DTRACE_PROBE6(__tcp_##name, type1, arg1, type2, arg2,		\
3279cd928feSAlan Maguire 	    type3, arg3, type4, arg4, type5, arg5, type6, arg6);
3289cd928feSAlan Maguire 
3299cd928feSAlan Maguire #define	DTRACE_UDP(name)						\
3309cd928feSAlan Maguire 	DTRACE_PROBE(__udp_##name);
3319cd928feSAlan Maguire 
3329cd928feSAlan Maguire #define	DTRACE_UDP1(name, type1, arg1)					\
3339cd928feSAlan Maguire 	DTRACE_PROBE1(__udp_##name, type1, arg1);
3349cd928feSAlan Maguire 
3359cd928feSAlan Maguire #define	DTRACE_UDP2(name, type1, arg1, type2, arg2)			\
3369cd928feSAlan Maguire 	DTRACE_PROBE2(__udp_##name, type1, arg1, type2, arg2);
3379cd928feSAlan Maguire 
3389cd928feSAlan Maguire #define	DTRACE_UDP3(name, type1, arg1, type2, arg2, type3, arg3)	\
3399cd928feSAlan Maguire 	DTRACE_PROBE3(__udp_##name, type1, arg1, type2, arg2, type3, arg3);
3409cd928feSAlan Maguire 
3419cd928feSAlan Maguire #define	DTRACE_UDP4(name, type1, arg1, type2, arg2,			\
3429cd928feSAlan Maguire     type3, arg3, type4, arg4)						\
3439cd928feSAlan Maguire 	DTRACE_PROBE4(__udp_##name, type1, arg1, type2, arg2,		\
3449cd928feSAlan Maguire 	    type3, arg3, type4, arg4);
3459cd928feSAlan Maguire 
3469cd928feSAlan Maguire #define	DTRACE_UDP5(name, type1, arg1, type2, arg2,			\
3479cd928feSAlan Maguire     type3, arg3, type4, arg4, type5, arg5)				\
3489cd928feSAlan Maguire 	DTRACE_PROBE5(__udp_##name, type1, arg1, type2, arg2,		\
3499cd928feSAlan Maguire 	    type3, arg3, type4, arg4, type5, arg5);
3509cd928feSAlan Maguire 
3519cd928feSAlan Maguire 
352e04145d0Seschrock #define	DTRACE_SYSEVENT2(name, type1, arg1, type2, arg2)		\
353e04145d0Seschrock 	DTRACE_PROBE2(__sysevent_##name, type1, arg1, type2, arg2);
354e04145d0Seschrock 
355843e1988Sjohnlev #define	DTRACE_XPV(name)						\
356843e1988Sjohnlev 	DTRACE_PROBE(__xpv_##name);
357843e1988Sjohnlev 
358843e1988Sjohnlev #define	DTRACE_XPV1(name, type1, arg1)					\
359843e1988Sjohnlev 	DTRACE_PROBE1(__xpv_##name, type1, arg1);
360843e1988Sjohnlev 
361843e1988Sjohnlev #define	DTRACE_XPV2(name, type1, arg1, type2, arg2)			\
362843e1988Sjohnlev 	DTRACE_PROBE2(__xpv_##name, type1, arg1, type2, arg2);
363843e1988Sjohnlev 
364843e1988Sjohnlev #define	DTRACE_XPV3(name, type1, arg1, type2, arg2, type3, arg3)	\
365843e1988Sjohnlev 	DTRACE_PROBE3(__xpv_##name, type1, arg1, type2, arg2, type3, arg3);
366843e1988Sjohnlev 
367843e1988Sjohnlev #define	DTRACE_XPV4(name, type1, arg1, type2, arg2, type3, arg3,	\
368843e1988Sjohnlev 	    type4, arg4)						\
369be6fd75aSMatthew Ahrens 	DTRACE_PROBE4(__xpv_##name, type1, arg1, type2, arg2,		\
370843e1988Sjohnlev 	    type3, arg3, type4, arg4);
371843e1988Sjohnlev 
372d8c54e3dSSam Cramer #define	DTRACE_FC_1(name, type1, arg1) \
373d8c54e3dSSam Cramer 	DTRACE_PROBE1(__fc_##name, type1, arg1);
374d8c54e3dSSam Cramer 
375d8c54e3dSSam Cramer #define	DTRACE_FC_2(name, type1, arg1, type2, arg2) \
376d8c54e3dSSam Cramer 	DTRACE_PROBE2(__fc_##name, type1, arg1, type2, arg2);
377d8c54e3dSSam Cramer 
378d8c54e3dSSam Cramer #define	DTRACE_FC_3(name, type1, arg1, type2, arg2, type3, arg3) \
379d8c54e3dSSam Cramer 	DTRACE_PROBE3(__fc_##name, type1, arg1, type2, arg2, type3, arg3);
380d8c54e3dSSam Cramer 
381d8c54e3dSSam Cramer #define	DTRACE_FC_4(name, type1, arg1, type2, arg2, type3, arg3, type4, arg4) \
382d8c54e3dSSam Cramer 	DTRACE_PROBE4(__fc_##name, type1, arg1, type2, arg2, type3, arg3, \
383d8c54e3dSSam Cramer 	    type4, arg4);
384d8c54e3dSSam Cramer 
385be6fd75aSMatthew Ahrens #define	DTRACE_FC_5(name, type1, arg1, type2, arg2, type3, arg3,	\
386d8c54e3dSSam Cramer 	    type4, arg4, type5, arg5)					\
387d8c54e3dSSam Cramer 	DTRACE_PROBE5(__fc_##name, type1, arg1, type2, arg2, type3, arg3, \
388d8c54e3dSSam Cramer 	    type4, arg4, type5, arg5);
389d8c54e3dSSam Cramer 
390191c289bSCharles Ting #define	DTRACE_SRP_1(name, type1, arg1)					\
391191c289bSCharles Ting 	DTRACE_PROBE1(__srp_##name, type1, arg1);
392d8c54e3dSSam Cramer 
393191c289bSCharles Ting #define	DTRACE_SRP_2(name, type1, arg1, type2, arg2)			\
394191c289bSCharles Ting 	DTRACE_PROBE2(__srp_##name, type1, arg1, type2, arg2);
395191c289bSCharles Ting 
396191c289bSCharles Ting #define	DTRACE_SRP_3(name, type1, arg1, type2, arg2, type3, arg3)	\
397191c289bSCharles Ting 	DTRACE_PROBE3(__srp_##name, type1, arg1, type2, arg2, type3, arg3);
398191c289bSCharles Ting 
399191c289bSCharles Ting #define	DTRACE_SRP_4(name, type1, arg1, type2, arg2, type3, arg3,	\
400191c289bSCharles Ting 	    type4, arg4)						\
401be6fd75aSMatthew Ahrens 	DTRACE_PROBE4(__srp_##name, type1, arg1, type2, arg2,		\
402191c289bSCharles Ting 	    type3, arg3, type4, arg4);
403191c289bSCharles Ting 
404191c289bSCharles Ting #define	DTRACE_SRP_5(name, type1, arg1, type2, arg2, type3, arg3,	\
405191c289bSCharles Ting 	    type4, arg4, type5, arg5)					\
406be6fd75aSMatthew Ahrens 	DTRACE_PROBE5(__srp_##name, type1, arg1, type2, arg2,		\
407191c289bSCharles Ting 	    type3, arg3, type4, arg4, type5, arg5);
408191c289bSCharles Ting 
409191c289bSCharles Ting #define	DTRACE_SRP_6(name, type1, arg1, type2, arg2, type3, arg3,	\
410191c289bSCharles Ting 	    type4, arg4, type5, arg5, type6, arg6)			\
411be6fd75aSMatthew Ahrens 	DTRACE_PROBE6(__srp_##name, type1, arg1, type2, arg2,		\
412191c289bSCharles Ting 	    type3, arg3, type4, arg4, type5, arg5, type6, arg6);
413191c289bSCharles Ting 
414191c289bSCharles Ting #define	DTRACE_SRP_7(name, type1, arg1, type2, arg2, type3, arg3,	\
415191c289bSCharles Ting 	    type4, arg4, type5, arg5, type6, arg6, type7, arg7)		\
416be6fd75aSMatthew Ahrens 	DTRACE_PROBE7(__srp_##name, type1, arg1, type2, arg2,		\
417191c289bSCharles Ting 	    type3, arg3, type4, arg4, type5, arg5, type6, arg6, type7, arg7);
418d8c54e3dSSam Cramer 
4197830165bSCharles Ting #define	DTRACE_SRP_8(name, type1, arg1, type2, arg2, type3, arg3,	\
4207830165bSCharles Ting 	    type4, arg4, type5, arg5, type6, arg6, type7, arg7, type8, arg8) \
421be6fd75aSMatthew Ahrens 	DTRACE_PROBE8(__srp_##name, type1, arg1, type2, arg2,		\
4227830165bSCharles Ting 	    type3, arg3, type4, arg4, type5, arg5, type6, arg6,		\
4237830165bSCharles Ting 	    type7, arg7, type8, arg8);
4247830165bSCharles Ting 
425be6fd75aSMatthew Ahrens /*
4265d7b4d43SMatthew Ahrens  * The set-error SDT probe is extra static, in that we declare its fake
427be6fd75aSMatthew Ahrens  * function literally, rather than with the DTRACE_PROBE1() macro.  This is
428be6fd75aSMatthew Ahrens  * necessary so that SET_ERROR() can evaluate to a value, which wouldn't
429be6fd75aSMatthew Ahrens  * be possible if it required multiple statements (to declare the function
430be6fd75aSMatthew Ahrens  * and then call it).
431be6fd75aSMatthew Ahrens  *
432be6fd75aSMatthew Ahrens  * SET_ERROR() uses the comma operator so that it can be used without much
433be6fd75aSMatthew Ahrens  * additional code.  For example, "return (EINVAL);" becomes
434be6fd75aSMatthew Ahrens  * "return (SET_ERROR(EINVAL));".  Note that the argument will be evaluated
435be6fd75aSMatthew Ahrens  * twice, so it should not have side effects (e.g. something like:
436be6fd75aSMatthew Ahrens  * "return (SET_ERROR(log_error(EINVAL, info)));" would log the error twice).
437be6fd75aSMatthew Ahrens  */
438be6fd75aSMatthew Ahrens extern void __dtrace_probe_set__error(uintptr_t);
439be6fd75aSMatthew Ahrens #define	SET_ERROR(err) (__dtrace_probe_set__error(err), err)
440be6fd75aSMatthew Ahrens 
4417c478bd9Sstevel@tonic-gate #endif /* _KERNEL */
4427c478bd9Sstevel@tonic-gate 
4437c478bd9Sstevel@tonic-gate extern const char *sdt_prefix;
4447c478bd9Sstevel@tonic-gate 
4457c478bd9Sstevel@tonic-gate typedef struct sdt_probedesc {
4467c478bd9Sstevel@tonic-gate 	char			*sdpd_name;	/* name of this probe */
4477c478bd9Sstevel@tonic-gate 	unsigned long		sdpd_offset;	/* offset of call in text */
4487c478bd9Sstevel@tonic-gate 	struct sdt_probedesc	*sdpd_next;	/* next static probe */
4497c478bd9Sstevel@tonic-gate } sdt_probedesc_t;
4507c478bd9Sstevel@tonic-gate 
4517c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
4527c478bd9Sstevel@tonic-gate }
4537c478bd9Sstevel@tonic-gate #endif
4547c478bd9Sstevel@tonic-gate 
4557c478bd9Sstevel@tonic-gate #endif	/* _SYS_SDT_H */
456