xref: /illumos-gate/usr/src/uts/common/sys/sdt.h (revision 5d7b4d43)
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.
247c478bd9Sstevel@tonic-gate  */
257c478bd9Sstevel@tonic-gate 
267c478bd9Sstevel@tonic-gate #ifndef _SYS_SDT_H
277c478bd9Sstevel@tonic-gate #define	_SYS_SDT_H
287c478bd9Sstevel@tonic-gate 
29be6fd75aSMatthew Ahrens #include <sys/stdint.h>
30be6fd75aSMatthew Ahrens 
317c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
327c478bd9Sstevel@tonic-gate extern "C" {
337c478bd9Sstevel@tonic-gate #endif
347c478bd9Sstevel@tonic-gate 
357c478bd9Sstevel@tonic-gate #ifndef _KERNEL
367c478bd9Sstevel@tonic-gate 
377c478bd9Sstevel@tonic-gate #define	DTRACE_PROBE(provider, name) {					\
387c478bd9Sstevel@tonic-gate 	extern void __dtrace_##provider##___##name(void);		\
397c478bd9Sstevel@tonic-gate 	__dtrace_##provider##___##name();				\
407c478bd9Sstevel@tonic-gate }
417c478bd9Sstevel@tonic-gate 
427c478bd9Sstevel@tonic-gate #define	DTRACE_PROBE1(provider, name, arg1) {				\
437c478bd9Sstevel@tonic-gate 	extern void __dtrace_##provider##___##name(unsigned long);	\
447c478bd9Sstevel@tonic-gate 	__dtrace_##provider##___##name((unsigned long)arg1);		\
457c478bd9Sstevel@tonic-gate }
467c478bd9Sstevel@tonic-gate 
477c478bd9Sstevel@tonic-gate #define	DTRACE_PROBE2(provider, name, arg1, arg2) {			\
487c478bd9Sstevel@tonic-gate 	extern void __dtrace_##provider##___##name(unsigned long,	\
497c478bd9Sstevel@tonic-gate 	    unsigned long);						\
507c478bd9Sstevel@tonic-gate 	__dtrace_##provider##___##name((unsigned long)arg1,		\
517c478bd9Sstevel@tonic-gate 	    (unsigned long)arg2);					\
527c478bd9Sstevel@tonic-gate }
537c478bd9Sstevel@tonic-gate 
547c478bd9Sstevel@tonic-gate #define	DTRACE_PROBE3(provider, name, arg1, arg2, arg3) {		\
557c478bd9Sstevel@tonic-gate 	extern void __dtrace_##provider##___##name(unsigned long,	\
567c478bd9Sstevel@tonic-gate 	    unsigned long, unsigned long);				\
577c478bd9Sstevel@tonic-gate 	__dtrace_##provider##___##name((unsigned long)arg1,		\
587c478bd9Sstevel@tonic-gate 	    (unsigned long)arg2, (unsigned long)arg3);			\
597c478bd9Sstevel@tonic-gate }
607c478bd9Sstevel@tonic-gate 
617c478bd9Sstevel@tonic-gate #define	DTRACE_PROBE4(provider, name, arg1, arg2, arg3, arg4) {		\
627c478bd9Sstevel@tonic-gate 	extern void __dtrace_##provider##___##name(unsigned long,	\
637c478bd9Sstevel@tonic-gate 	    unsigned long, unsigned long, unsigned long);		\
647c478bd9Sstevel@tonic-gate 	__dtrace_##provider##___##name((unsigned long)arg1,		\
657c478bd9Sstevel@tonic-gate 	    (unsigned long)arg2, (unsigned long)arg3,			\
667c478bd9Sstevel@tonic-gate 	    (unsigned long)arg4);					\
677c478bd9Sstevel@tonic-gate }
687c478bd9Sstevel@tonic-gate 
697c478bd9Sstevel@tonic-gate #define	DTRACE_PROBE5(provider, name, arg1, arg2, arg3, arg4, arg5) {	\
707c478bd9Sstevel@tonic-gate 	extern void __dtrace_##provider##___##name(unsigned long,	\
717c478bd9Sstevel@tonic-gate 	    unsigned long, unsigned long, unsigned long, unsigned long);\
727c478bd9Sstevel@tonic-gate 	__dtrace_##provider##___##name((unsigned long)arg1,		\
737c478bd9Sstevel@tonic-gate 	    (unsigned long)arg2, (unsigned long)arg3,			\
747c478bd9Sstevel@tonic-gate 	    (unsigned long)arg4, (unsigned long)arg5);			\
757c478bd9Sstevel@tonic-gate }
767c478bd9Sstevel@tonic-gate 
777c478bd9Sstevel@tonic-gate #else /* _KERNEL */
787c478bd9Sstevel@tonic-gate 
797c478bd9Sstevel@tonic-gate #define	DTRACE_PROBE(name)	{					\
807c478bd9Sstevel@tonic-gate 	extern void __dtrace_probe_##name(void);			\
817c478bd9Sstevel@tonic-gate 	__dtrace_probe_##name();					\
827c478bd9Sstevel@tonic-gate }
837c478bd9Sstevel@tonic-gate 
847c478bd9Sstevel@tonic-gate #define	DTRACE_PROBE1(name, type1, arg1) {				\
857c478bd9Sstevel@tonic-gate 	extern void __dtrace_probe_##name(uintptr_t);			\
867c478bd9Sstevel@tonic-gate 	__dtrace_probe_##name((uintptr_t)(arg1));			\
877c478bd9Sstevel@tonic-gate }
887c478bd9Sstevel@tonic-gate 
897c478bd9Sstevel@tonic-gate #define	DTRACE_PROBE2(name, type1, arg1, type2, arg2) {			\
907c478bd9Sstevel@tonic-gate 	extern void __dtrace_probe_##name(uintptr_t, uintptr_t);	\
917c478bd9Sstevel@tonic-gate 	__dtrace_probe_##name((uintptr_t)(arg1), (uintptr_t)(arg2));	\
927c478bd9Sstevel@tonic-gate }
937c478bd9Sstevel@tonic-gate 
947c478bd9Sstevel@tonic-gate #define	DTRACE_PROBE3(name, type1, arg1, type2, arg2, type3, arg3) {	\
957c478bd9Sstevel@tonic-gate 	extern void __dtrace_probe_##name(uintptr_t, uintptr_t, uintptr_t); \
967c478bd9Sstevel@tonic-gate 	__dtrace_probe_##name((uintptr_t)(arg1), (uintptr_t)(arg2),	\
977c478bd9Sstevel@tonic-gate 	    (uintptr_t)(arg3));						\
987c478bd9Sstevel@tonic-gate }
997c478bd9Sstevel@tonic-gate 
100be6fd75aSMatthew Ahrens #define	DTRACE_PROBE4(name, type1, arg1, type2, arg2,			\
1017c478bd9Sstevel@tonic-gate     type3, arg3, type4, arg4) {						\
1027c478bd9Sstevel@tonic-gate 	extern void __dtrace_probe_##name(uintptr_t, uintptr_t,		\
1037c478bd9Sstevel@tonic-gate 	    uintptr_t, uintptr_t);					\
1047c478bd9Sstevel@tonic-gate 	__dtrace_probe_##name((uintptr_t)(arg1), (uintptr_t)(arg2),	\
1057c478bd9Sstevel@tonic-gate 	    (uintptr_t)(arg3), (uintptr_t)(arg4));			\
1067c478bd9Sstevel@tonic-gate }
1077c478bd9Sstevel@tonic-gate 
108be6fd75aSMatthew Ahrens #define	DTRACE_PROBE5(name, type1, arg1, type2, arg2,			\
10910e6dadfSbrendan     type3, arg3, type4, arg4, type5, arg5) {				\
11010e6dadfSbrendan 	extern void __dtrace_probe_##name(uintptr_t, uintptr_t,		\
11110e6dadfSbrendan 	    uintptr_t, uintptr_t, uintptr_t);				\
11210e6dadfSbrendan 	__dtrace_probe_##name((uintptr_t)(arg1), (uintptr_t)(arg2),	\
11310e6dadfSbrendan 	    (uintptr_t)(arg3), (uintptr_t)(arg4), (uintptr_t)(arg5));	\
11410e6dadfSbrendan }
11510e6dadfSbrendan 
116be6fd75aSMatthew Ahrens #define	DTRACE_PROBE6(name, type1, arg1, type2, arg2,			\
11710e6dadfSbrendan     type3, arg3, type4, arg4, type5, arg5, type6, arg6) {		\
11810e6dadfSbrendan 	extern void __dtrace_probe_##name(uintptr_t, uintptr_t,		\
11910e6dadfSbrendan 	    uintptr_t, uintptr_t, uintptr_t, uintptr_t);		\
12010e6dadfSbrendan 	__dtrace_probe_##name((uintptr_t)(arg1), (uintptr_t)(arg2),	\
12110e6dadfSbrendan 	    (uintptr_t)(arg3), (uintptr_t)(arg4), (uintptr_t)(arg5),	\
12210e6dadfSbrendan 	    (uintptr_t)(arg6));						\
12310e6dadfSbrendan }
12410e6dadfSbrendan 
12510e6dadfSbrendan #define	DTRACE_PROBE7(name, type1, arg1, type2, arg2, type3, arg3,	\
12610e6dadfSbrendan     type4, arg4, type5, arg5, type6, arg6, type7, arg7) {		\
12710e6dadfSbrendan 	extern void __dtrace_probe_##name(uintptr_t, uintptr_t,		\
12810e6dadfSbrendan 	    uintptr_t, uintptr_t, uintptr_t, uintptr_t, uintptr_t);	\
12910e6dadfSbrendan 	__dtrace_probe_##name((uintptr_t)(arg1), (uintptr_t)(arg2),	\
13010e6dadfSbrendan 	    (uintptr_t)(arg3), (uintptr_t)(arg4), (uintptr_t)(arg5),	\
13110e6dadfSbrendan 	    (uintptr_t)(arg6), (uintptr_t)(arg7));			\
13210e6dadfSbrendan }
13310e6dadfSbrendan 
134a668b114SPriya Krishnan #define	DTRACE_PROBE8(name, type1, arg1, type2, arg2, type3, arg3,	\
135a668b114SPriya Krishnan     type4, arg4, type5, arg5, type6, arg6, type7, arg7, type8, arg8) {	\
136a668b114SPriya Krishnan 	extern void __dtrace_probe_##name(uintptr_t, uintptr_t,		\
137a668b114SPriya Krishnan 	    uintptr_t, uintptr_t, uintptr_t, uintptr_t,			\
138a668b114SPriya Krishnan 	    uintptr_t, uintptr_t);					\
139a668b114SPriya Krishnan 	__dtrace_probe_##name((uintptr_t)(arg1), (uintptr_t)(arg2),	\
140a668b114SPriya Krishnan 	    (uintptr_t)(arg3), (uintptr_t)(arg4), (uintptr_t)(arg5),	\
141a668b114SPriya Krishnan 	    (uintptr_t)(arg6), (uintptr_t)(arg7), (uintptr_t)(arg8));	\
142a668b114SPriya Krishnan }
143a668b114SPriya Krishnan 
1447c478bd9Sstevel@tonic-gate #define	DTRACE_SCHED(name)						\
1457c478bd9Sstevel@tonic-gate 	DTRACE_PROBE(__sched_##name);
1467c478bd9Sstevel@tonic-gate 
1477c478bd9Sstevel@tonic-gate #define	DTRACE_SCHED1(name, type1, arg1)				\
1487c478bd9Sstevel@tonic-gate 	DTRACE_PROBE1(__sched_##name, type1, arg1);
1497c478bd9Sstevel@tonic-gate 
1507c478bd9Sstevel@tonic-gate #define	DTRACE_SCHED2(name, type1, arg1, type2, arg2)			\
1517c478bd9Sstevel@tonic-gate 	DTRACE_PROBE2(__sched_##name, type1, arg1, type2, arg2);
1527c478bd9Sstevel@tonic-gate 
1537c478bd9Sstevel@tonic-gate #define	DTRACE_SCHED3(name, type1, arg1, type2, arg2, type3, arg3)	\
1547c478bd9Sstevel@tonic-gate 	DTRACE_PROBE3(__sched_##name, type1, arg1, type2, arg2, type3, arg3);
1557c478bd9Sstevel@tonic-gate 
156be6fd75aSMatthew Ahrens #define	DTRACE_SCHED4(name, type1, arg1, type2, arg2,			\
1577c478bd9Sstevel@tonic-gate     type3, arg3, type4, arg4)						\
158be6fd75aSMatthew Ahrens 	DTRACE_PROBE4(__sched_##name, type1, arg1, type2, arg2,		\
1597c478bd9Sstevel@tonic-gate 	    type3, arg3, type4, arg4);
1607c478bd9Sstevel@tonic-gate 
1617c478bd9Sstevel@tonic-gate #define	DTRACE_PROC(name)						\
1627c478bd9Sstevel@tonic-gate 	DTRACE_PROBE(__proc_##name);
1637c478bd9Sstevel@tonic-gate 
1647c478bd9Sstevel@tonic-gate #define	DTRACE_PROC1(name, type1, arg1)					\
1657c478bd9Sstevel@tonic-gate 	DTRACE_PROBE1(__proc_##name, type1, arg1);
1667c478bd9Sstevel@tonic-gate 
1677c478bd9Sstevel@tonic-gate #define	DTRACE_PROC2(name, type1, arg1, type2, arg2)			\
1687c478bd9Sstevel@tonic-gate 	DTRACE_PROBE2(__proc_##name, type1, arg1, type2, arg2);
1697c478bd9Sstevel@tonic-gate 
1707c478bd9Sstevel@tonic-gate #define	DTRACE_PROC3(name, type1, arg1, type2, arg2, type3, arg3)	\
1717c478bd9Sstevel@tonic-gate 	DTRACE_PROBE3(__proc_##name, type1, arg1, type2, arg2, type3, arg3);
1727c478bd9Sstevel@tonic-gate 
173be6fd75aSMatthew Ahrens #define	DTRACE_PROC4(name, type1, arg1, type2, arg2,			\
1747c478bd9Sstevel@tonic-gate     type3, arg3, type4, arg4)						\
175be6fd75aSMatthew Ahrens 	DTRACE_PROBE4(__proc_##name, type1, arg1, type2, arg2,		\
1767c478bd9Sstevel@tonic-gate 	    type3, arg3, type4, arg4);
1777c478bd9Sstevel@tonic-gate 
1787c478bd9Sstevel@tonic-gate #define	DTRACE_IO(name)							\
1797c478bd9Sstevel@tonic-gate 	DTRACE_PROBE(__io_##name);
1807c478bd9Sstevel@tonic-gate 
1817c478bd9Sstevel@tonic-gate #define	DTRACE_IO1(name, type1, arg1)					\
1827c478bd9Sstevel@tonic-gate 	DTRACE_PROBE1(__io_##name, type1, arg1);
1837c478bd9Sstevel@tonic-gate 
1847c478bd9Sstevel@tonic-gate #define	DTRACE_IO2(name, type1, arg1, type2, arg2)			\
1857c478bd9Sstevel@tonic-gate 	DTRACE_PROBE2(__io_##name, type1, arg1, type2, arg2);
1867c478bd9Sstevel@tonic-gate 
1877c478bd9Sstevel@tonic-gate #define	DTRACE_IO3(name, type1, arg1, type2, arg2, type3, arg3)	\
1887c478bd9Sstevel@tonic-gate 	DTRACE_PROBE3(__io_##name, type1, arg1, type2, arg2, type3, arg3);
1897c478bd9Sstevel@tonic-gate 
190be6fd75aSMatthew Ahrens #define	DTRACE_IO4(name, type1, arg1, type2, arg2,			\
1917c478bd9Sstevel@tonic-gate     type3, arg3, type4, arg4)						\
192be6fd75aSMatthew Ahrens 	DTRACE_PROBE4(__io_##name, type1, arg1, type2, arg2,		\
1937c478bd9Sstevel@tonic-gate 	    type3, arg3, type4, arg4);
1947c478bd9Sstevel@tonic-gate 
195a668b114SPriya Krishnan #define	DTRACE_ISCSI_2(name, type1, arg1, type2, arg2)			\
196a668b114SPriya Krishnan 	DTRACE_PROBE2(__iscsi_##name, type1, arg1, type2, arg2);
197a668b114SPriya Krishnan 
198a668b114SPriya Krishnan #define	DTRACE_ISCSI_3(name, type1, arg1, type2, arg2, type3, arg3)	\
199a668b114SPriya Krishnan 	DTRACE_PROBE3(__iscsi_##name, type1, arg1, type2, arg2, type3, arg3);
200a668b114SPriya Krishnan 
201a668b114SPriya Krishnan #define	DTRACE_ISCSI_4(name, type1, arg1, type2, arg2,			\
202a668b114SPriya Krishnan     type3, arg3, type4, arg4)						\
203a668b114SPriya Krishnan 	DTRACE_PROBE4(__iscsi_##name, type1, arg1, type2, arg2,		\
204a668b114SPriya Krishnan 	    type3, arg3, type4, arg4);
205a668b114SPriya Krishnan 
206a668b114SPriya Krishnan #define	DTRACE_ISCSI_5(name, type1, arg1, type2, arg2,			\
207a668b114SPriya Krishnan     type3, arg3, type4, arg4, type5, arg5)				\
208a668b114SPriya Krishnan 	DTRACE_PROBE5(__iscsi_##name, type1, arg1, type2, arg2,		\
209a668b114SPriya Krishnan 	    type3, arg3, type4, arg4, type5, arg5);
210a668b114SPriya Krishnan 
211a668b114SPriya Krishnan #define	DTRACE_ISCSI_6(name, type1, arg1, type2, arg2,			\
212a668b114SPriya Krishnan     type3, arg3, type4, arg4, type5, arg5, type6, arg6)			\
213a668b114SPriya Krishnan 	DTRACE_PROBE6(__iscsi_##name, type1, arg1, type2, arg2,		\
214a668b114SPriya Krishnan 	    type3, arg3, type4, arg4, type5, arg5, type6, arg6);
215a668b114SPriya Krishnan 
216a668b114SPriya Krishnan #define	DTRACE_ISCSI_7(name, type1, arg1, type2, arg2,			\
217a668b114SPriya Krishnan     type3, arg3, type4, arg4, type5, arg5, type6, arg6, type7, arg7)	\
218a668b114SPriya Krishnan 	DTRACE_PROBE7(__iscsi_##name, type1, arg1, type2, arg2,		\
219a668b114SPriya Krishnan 	    type3, arg3, type4, arg4, type5, arg5, type6, arg6,		\
220a668b114SPriya Krishnan 	    type7, arg7);
221a668b114SPriya Krishnan 
222a668b114SPriya Krishnan #define	DTRACE_ISCSI_8(name, type1, arg1, type2, arg2,			\
223a668b114SPriya Krishnan     type3, arg3, type4, arg4, type5, arg5, type6, arg6,			\
224a668b114SPriya Krishnan     type7, arg7, type8, arg8)						\
225a668b114SPriya Krishnan 	DTRACE_PROBE8(__iscsi_##name, type1, arg1, type2, arg2,		\
226a668b114SPriya Krishnan 	    type3, arg3, type4, arg4, type5, arg5, type6, arg6,		\
227a668b114SPriya Krishnan 	    type7, arg7, type8, arg8);
228a668b114SPriya Krishnan 
229be6fd75aSMatthew Ahrens #define	DTRACE_NFSV3_3(name, type1, arg1, type2, arg2,			\
230e1adf50cSahl     type3, arg3)							\
231e1adf50cSahl 	DTRACE_PROBE3(__nfsv3_##name, type1, arg1, type2, arg2,		\
232e1adf50cSahl 	    type3, arg3);
233be6fd75aSMatthew Ahrens #define	DTRACE_NFSV3_4(name, type1, arg1, type2, arg2,			\
234e1adf50cSahl     type3, arg3, type4, arg4)						\
235e1adf50cSahl 	DTRACE_PROBE4(__nfsv3_##name, type1, arg1, type2, arg2,		\
236e1adf50cSahl 	    type3, arg3, type4, arg4);
237e1adf50cSahl 
238f3b585ceSsamf #define	DTRACE_NFSV4_1(name, type1, arg1) \
239f3b585ceSsamf 	DTRACE_PROBE1(__nfsv4_##name, type1, arg1);
240f3b585ceSsamf 
241f3b585ceSsamf #define	DTRACE_NFSV4_2(name, type1, arg1, type2, arg2) \
242f3b585ceSsamf 	DTRACE_PROBE2(__nfsv4_##name, type1, arg1, type2, arg2);
243f3b585ceSsamf 
244f3b585ceSsamf #define	DTRACE_NFSV4_3(name, type1, arg1, type2, arg2, type3, arg3) \
245f3b585ceSsamf 	DTRACE_PROBE3(__nfsv4_##name, type1, arg1, type2, arg2, type3, arg3);
246f3b585ceSsamf 
247faa1795aSjb #define	DTRACE_SMB_1(name, type1, arg1) \
248faa1795aSjb 	DTRACE_PROBE1(__smb_##name, type1, arg1);
249faa1795aSjb 
250faa1795aSjb #define	DTRACE_SMB_2(name, type1, arg1, type2, arg2) \
251faa1795aSjb 	DTRACE_PROBE2(__smb_##name, type1, arg1, type2, arg2);
252faa1795aSjb 
25310e6dadfSbrendan #define	DTRACE_IP(name)						\
25410e6dadfSbrendan 	DTRACE_PROBE(__ip_##name);
25510e6dadfSbrendan 
25610e6dadfSbrendan #define	DTRACE_IP1(name, type1, arg1)					\
25710e6dadfSbrendan 	DTRACE_PROBE1(__ip_##name, type1, arg1);
25810e6dadfSbrendan 
25910e6dadfSbrendan #define	DTRACE_IP2(name, type1, arg1, type2, arg2)			\
26010e6dadfSbrendan 	DTRACE_PROBE2(__ip_##name, type1, arg1, type2, arg2);
26110e6dadfSbrendan 
26210e6dadfSbrendan #define	DTRACE_IP3(name, type1, arg1, type2, arg2, type3, arg3)	\
26310e6dadfSbrendan 	DTRACE_PROBE3(__ip_##name, type1, arg1, type2, arg2, type3, arg3);
26410e6dadfSbrendan 
265be6fd75aSMatthew Ahrens #define	DTRACE_IP4(name, type1, arg1, type2, arg2,			\
26610e6dadfSbrendan     type3, arg3, type4, arg4)						\
267be6fd75aSMatthew Ahrens 	DTRACE_PROBE4(__ip_##name, type1, arg1, type2, arg2,		\
26810e6dadfSbrendan 	    type3, arg3, type4, arg4);
26910e6dadfSbrendan 
270be6fd75aSMatthew Ahrens #define	DTRACE_IP5(name, type1, arg1, type2, arg2,			\
27110e6dadfSbrendan     type3, arg3, type4, arg4, type5, arg5)				\
272be6fd75aSMatthew Ahrens 	DTRACE_PROBE5(__ip_##name, type1, arg1, type2, arg2,		\
27310e6dadfSbrendan 	    type3, arg3, type4, arg4, type5, arg5);
27410e6dadfSbrendan 
275be6fd75aSMatthew Ahrens #define	DTRACE_IP6(name, type1, arg1, type2, arg2,			\
27610e6dadfSbrendan     type3, arg3, type4, arg4, type5, arg5, type6, arg6)			\
277be6fd75aSMatthew Ahrens 	DTRACE_PROBE6(__ip_##name, type1, arg1, type2, arg2,		\
27810e6dadfSbrendan 	    type3, arg3, type4, arg4, type5, arg5, type6, arg6);
27910e6dadfSbrendan 
28010e6dadfSbrendan #define	DTRACE_IP7(name, type1, arg1, type2, arg2, type3, arg3,		\
28110e6dadfSbrendan     type4, arg4, type5, arg5, type6, arg6, type7, arg7)			\
282be6fd75aSMatthew Ahrens 	DTRACE_PROBE7(__ip_##name, type1, arg1, type2, arg2,		\
28310e6dadfSbrendan 	    type3, arg3, type4, arg4, type5, arg5, type6, arg6,		\
28410e6dadfSbrendan 	    type7, arg7);
28510e6dadfSbrendan 
2869cd928feSAlan Maguire #define	DTRACE_TCP(name)						\
2879cd928feSAlan Maguire 	DTRACE_PROBE(__tcp_##name);
2889cd928feSAlan Maguire 
2899cd928feSAlan Maguire #define	DTRACE_TCP1(name, type1, arg1)					\
2909cd928feSAlan Maguire 	DTRACE_PROBE1(__tcp_##name, type1, arg1);
2919cd928feSAlan Maguire 
2929cd928feSAlan Maguire #define	DTRACE_TCP2(name, type1, arg1, type2, arg2)			\
2939cd928feSAlan Maguire 	DTRACE_PROBE2(__tcp_##name, type1, arg1, type2, arg2);
2949cd928feSAlan Maguire 
2959cd928feSAlan Maguire #define	DTRACE_TCP3(name, type1, arg1, type2, arg2, type3, arg3)	\
2969cd928feSAlan Maguire 	DTRACE_PROBE3(__tcp_##name, type1, arg1, type2, arg2, type3, arg3);
2979cd928feSAlan Maguire 
2989cd928feSAlan Maguire #define	DTRACE_TCP4(name, type1, arg1, type2, arg2,			\
2999cd928feSAlan Maguire     type3, arg3, type4, arg4)						\
3009cd928feSAlan Maguire 	DTRACE_PROBE4(__tcp_##name, type1, arg1, type2, arg2,		\
3019cd928feSAlan Maguire 	    type3, arg3, type4, arg4);
3029cd928feSAlan Maguire 
3039cd928feSAlan Maguire #define	DTRACE_TCP5(name, type1, arg1, type2, arg2,			\
3049cd928feSAlan Maguire     type3, arg3, type4, arg4, type5, arg5)				\
3059cd928feSAlan Maguire 	DTRACE_PROBE5(__tcp_##name, type1, arg1, type2, arg2,		\
3069cd928feSAlan Maguire 	    type3, arg3, type4, arg4, type5, arg5);
3079cd928feSAlan Maguire 
3089cd928feSAlan Maguire #define	DTRACE_TCP6(name, type1, arg1, type2, arg2,			\
3099cd928feSAlan Maguire     type3, arg3, type4, arg4, type5, arg5, type6, arg6)			\
3109cd928feSAlan Maguire 	DTRACE_PROBE6(__tcp_##name, type1, arg1, type2, arg2,		\
3119cd928feSAlan Maguire 	    type3, arg3, type4, arg4, type5, arg5, type6, arg6);
3129cd928feSAlan Maguire 
3139cd928feSAlan Maguire #define	DTRACE_UDP(name)						\
3149cd928feSAlan Maguire 	DTRACE_PROBE(__udp_##name);
3159cd928feSAlan Maguire 
3169cd928feSAlan Maguire #define	DTRACE_UDP1(name, type1, arg1)					\
3179cd928feSAlan Maguire 	DTRACE_PROBE1(__udp_##name, type1, arg1);
3189cd928feSAlan Maguire 
3199cd928feSAlan Maguire #define	DTRACE_UDP2(name, type1, arg1, type2, arg2)			\
3209cd928feSAlan Maguire 	DTRACE_PROBE2(__udp_##name, type1, arg1, type2, arg2);
3219cd928feSAlan Maguire 
3229cd928feSAlan Maguire #define	DTRACE_UDP3(name, type1, arg1, type2, arg2, type3, arg3)	\
3239cd928feSAlan Maguire 	DTRACE_PROBE3(__udp_##name, type1, arg1, type2, arg2, type3, arg3);
3249cd928feSAlan Maguire 
3259cd928feSAlan Maguire #define	DTRACE_UDP4(name, type1, arg1, type2, arg2,			\
3269cd928feSAlan Maguire     type3, arg3, type4, arg4)						\
3279cd928feSAlan Maguire 	DTRACE_PROBE4(__udp_##name, type1, arg1, type2, arg2,		\
3289cd928feSAlan Maguire 	    type3, arg3, type4, arg4);
3299cd928feSAlan Maguire 
3309cd928feSAlan Maguire #define	DTRACE_UDP5(name, type1, arg1, type2, arg2,			\
3319cd928feSAlan Maguire     type3, arg3, type4, arg4, type5, arg5)				\
3329cd928feSAlan Maguire 	DTRACE_PROBE5(__udp_##name, type1, arg1, type2, arg2,		\
3339cd928feSAlan Maguire 	    type3, arg3, type4, arg4, type5, arg5);
3349cd928feSAlan Maguire 
3359cd928feSAlan Maguire 
336e04145d0Seschrock #define	DTRACE_SYSEVENT2(name, type1, arg1, type2, arg2)		\
337e04145d0Seschrock 	DTRACE_PROBE2(__sysevent_##name, type1, arg1, type2, arg2);
338e04145d0Seschrock 
339843e1988Sjohnlev #define	DTRACE_XPV(name)						\
340843e1988Sjohnlev 	DTRACE_PROBE(__xpv_##name);
341843e1988Sjohnlev 
342843e1988Sjohnlev #define	DTRACE_XPV1(name, type1, arg1)					\
343843e1988Sjohnlev 	DTRACE_PROBE1(__xpv_##name, type1, arg1);
344843e1988Sjohnlev 
345843e1988Sjohnlev #define	DTRACE_XPV2(name, type1, arg1, type2, arg2)			\
346843e1988Sjohnlev 	DTRACE_PROBE2(__xpv_##name, type1, arg1, type2, arg2);
347843e1988Sjohnlev 
348843e1988Sjohnlev #define	DTRACE_XPV3(name, type1, arg1, type2, arg2, type3, arg3)	\
349843e1988Sjohnlev 	DTRACE_PROBE3(__xpv_##name, type1, arg1, type2, arg2, type3, arg3);
350843e1988Sjohnlev 
351843e1988Sjohnlev #define	DTRACE_XPV4(name, type1, arg1, type2, arg2, type3, arg3,	\
352843e1988Sjohnlev 	    type4, arg4)						\
353be6fd75aSMatthew Ahrens 	DTRACE_PROBE4(__xpv_##name, type1, arg1, type2, arg2,		\
354843e1988Sjohnlev 	    type3, arg3, type4, arg4);
355843e1988Sjohnlev 
356d8c54e3dSSam Cramer #define	DTRACE_FC_1(name, type1, arg1) \
357d8c54e3dSSam Cramer 	DTRACE_PROBE1(__fc_##name, type1, arg1);
358d8c54e3dSSam Cramer 
359d8c54e3dSSam Cramer #define	DTRACE_FC_2(name, type1, arg1, type2, arg2) \
360d8c54e3dSSam Cramer 	DTRACE_PROBE2(__fc_##name, type1, arg1, type2, arg2);
361d8c54e3dSSam Cramer 
362d8c54e3dSSam Cramer #define	DTRACE_FC_3(name, type1, arg1, type2, arg2, type3, arg3) \
363d8c54e3dSSam Cramer 	DTRACE_PROBE3(__fc_##name, type1, arg1, type2, arg2, type3, arg3);
364d8c54e3dSSam Cramer 
365d8c54e3dSSam Cramer #define	DTRACE_FC_4(name, type1, arg1, type2, arg2, type3, arg3, type4, arg4) \
366d8c54e3dSSam Cramer 	DTRACE_PROBE4(__fc_##name, type1, arg1, type2, arg2, type3, arg3, \
367d8c54e3dSSam Cramer 	    type4, arg4);
368d8c54e3dSSam Cramer 
369be6fd75aSMatthew Ahrens #define	DTRACE_FC_5(name, type1, arg1, type2, arg2, type3, arg3,	\
370d8c54e3dSSam Cramer 	    type4, arg4, type5, arg5)					\
371d8c54e3dSSam Cramer 	DTRACE_PROBE5(__fc_##name, type1, arg1, type2, arg2, type3, arg3, \
372d8c54e3dSSam Cramer 	    type4, arg4, type5, arg5);
373d8c54e3dSSam Cramer 
374191c289bSCharles Ting #define	DTRACE_SRP_1(name, type1, arg1)					\
375191c289bSCharles Ting 	DTRACE_PROBE1(__srp_##name, type1, arg1);
376d8c54e3dSSam Cramer 
377191c289bSCharles Ting #define	DTRACE_SRP_2(name, type1, arg1, type2, arg2)			\
378191c289bSCharles Ting 	DTRACE_PROBE2(__srp_##name, type1, arg1, type2, arg2);
379191c289bSCharles Ting 
380191c289bSCharles Ting #define	DTRACE_SRP_3(name, type1, arg1, type2, arg2, type3, arg3)	\
381191c289bSCharles Ting 	DTRACE_PROBE3(__srp_##name, type1, arg1, type2, arg2, type3, arg3);
382191c289bSCharles Ting 
383191c289bSCharles Ting #define	DTRACE_SRP_4(name, type1, arg1, type2, arg2, type3, arg3,	\
384191c289bSCharles Ting 	    type4, arg4)						\
385be6fd75aSMatthew Ahrens 	DTRACE_PROBE4(__srp_##name, type1, arg1, type2, arg2,		\
386191c289bSCharles Ting 	    type3, arg3, type4, arg4);
387191c289bSCharles Ting 
388191c289bSCharles Ting #define	DTRACE_SRP_5(name, type1, arg1, type2, arg2, type3, arg3,	\
389191c289bSCharles Ting 	    type4, arg4, type5, arg5)					\
390be6fd75aSMatthew Ahrens 	DTRACE_PROBE5(__srp_##name, type1, arg1, type2, arg2,		\
391191c289bSCharles Ting 	    type3, arg3, type4, arg4, type5, arg5);
392191c289bSCharles Ting 
393191c289bSCharles Ting #define	DTRACE_SRP_6(name, type1, arg1, type2, arg2, type3, arg3,	\
394191c289bSCharles Ting 	    type4, arg4, type5, arg5, type6, arg6)			\
395be6fd75aSMatthew Ahrens 	DTRACE_PROBE6(__srp_##name, type1, arg1, type2, arg2,		\
396191c289bSCharles Ting 	    type3, arg3, type4, arg4, type5, arg5, type6, arg6);
397191c289bSCharles Ting 
398191c289bSCharles Ting #define	DTRACE_SRP_7(name, type1, arg1, type2, arg2, type3, arg3,	\
399191c289bSCharles Ting 	    type4, arg4, type5, arg5, type6, arg6, type7, arg7)		\
400be6fd75aSMatthew Ahrens 	DTRACE_PROBE7(__srp_##name, type1, arg1, type2, arg2,		\
401191c289bSCharles Ting 	    type3, arg3, type4, arg4, type5, arg5, type6, arg6, type7, arg7);
402d8c54e3dSSam Cramer 
4037830165bSCharles Ting #define	DTRACE_SRP_8(name, type1, arg1, type2, arg2, type3, arg3,	\
4047830165bSCharles Ting 	    type4, arg4, type5, arg5, type6, arg6, type7, arg7, type8, arg8) \
405be6fd75aSMatthew Ahrens 	DTRACE_PROBE8(__srp_##name, type1, arg1, type2, arg2,		\
4067830165bSCharles Ting 	    type3, arg3, type4, arg4, type5, arg5, type6, arg6,		\
4077830165bSCharles Ting 	    type7, arg7, type8, arg8);
4087830165bSCharles Ting 
409be6fd75aSMatthew Ahrens /*
410*5d7b4d43SMatthew Ahrens  * The set-error SDT probe is extra static, in that we declare its fake
411be6fd75aSMatthew Ahrens  * function literally, rather than with the DTRACE_PROBE1() macro.  This is
412be6fd75aSMatthew Ahrens  * necessary so that SET_ERROR() can evaluate to a value, which wouldn't
413be6fd75aSMatthew Ahrens  * be possible if it required multiple statements (to declare the function
414be6fd75aSMatthew Ahrens  * and then call it).
415be6fd75aSMatthew Ahrens  *
416be6fd75aSMatthew Ahrens  * SET_ERROR() uses the comma operator so that it can be used without much
417be6fd75aSMatthew Ahrens  * additional code.  For example, "return (EINVAL);" becomes
418be6fd75aSMatthew Ahrens  * "return (SET_ERROR(EINVAL));".  Note that the argument will be evaluated
419be6fd75aSMatthew Ahrens  * twice, so it should not have side effects (e.g. something like:
420be6fd75aSMatthew Ahrens  * "return (SET_ERROR(log_error(EINVAL, info)));" would log the error twice).
421be6fd75aSMatthew Ahrens  */
422be6fd75aSMatthew Ahrens extern void __dtrace_probe_set__error(uintptr_t);
423be6fd75aSMatthew Ahrens #define	SET_ERROR(err) (__dtrace_probe_set__error(err), err)
424be6fd75aSMatthew Ahrens 
4257c478bd9Sstevel@tonic-gate #endif /* _KERNEL */
4267c478bd9Sstevel@tonic-gate 
4277c478bd9Sstevel@tonic-gate extern const char *sdt_prefix;
4287c478bd9Sstevel@tonic-gate 
4297c478bd9Sstevel@tonic-gate typedef struct sdt_probedesc {
4307c478bd9Sstevel@tonic-gate 	char			*sdpd_name;	/* name of this probe */
4317c478bd9Sstevel@tonic-gate 	unsigned long		sdpd_offset;	/* offset of call in text */
4327c478bd9Sstevel@tonic-gate 	struct sdt_probedesc	*sdpd_next;	/* next static probe */
4337c478bd9Sstevel@tonic-gate } sdt_probedesc_t;
4347c478bd9Sstevel@tonic-gate 
4357c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
4367c478bd9Sstevel@tonic-gate }
4377c478bd9Sstevel@tonic-gate #endif
4387c478bd9Sstevel@tonic-gate 
4397c478bd9Sstevel@tonic-gate #endif	/* _SYS_SDT_H */
440