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 /* 22e1adf50cSahl * Copyright 2008 Sun Microsystems, Inc. All rights reserved. 237c478bd9Sstevel@tonic-gate * Use is subject to license terms. 247c478bd9Sstevel@tonic-gate */ 257c478bd9Sstevel@tonic-gate 267c478bd9Sstevel@tonic-gate #ifndef _SYS_SDT_H 277c478bd9Sstevel@tonic-gate #define _SYS_SDT_H 287c478bd9Sstevel@tonic-gate 297c478bd9Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 307c478bd9Sstevel@tonic-gate 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 1007c478bd9Sstevel@tonic-gate #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 108*10e6dadfSbrendan #define DTRACE_PROBE5(name, type1, arg1, type2, arg2, \ 109*10e6dadfSbrendan type3, arg3, type4, arg4, type5, arg5) { \ 110*10e6dadfSbrendan extern void __dtrace_probe_##name(uintptr_t, uintptr_t, \ 111*10e6dadfSbrendan uintptr_t, uintptr_t, uintptr_t); \ 112*10e6dadfSbrendan __dtrace_probe_##name((uintptr_t)(arg1), (uintptr_t)(arg2), \ 113*10e6dadfSbrendan (uintptr_t)(arg3), (uintptr_t)(arg4), (uintptr_t)(arg5)); \ 114*10e6dadfSbrendan } 115*10e6dadfSbrendan 116*10e6dadfSbrendan #define DTRACE_PROBE6(name, type1, arg1, type2, arg2, \ 117*10e6dadfSbrendan type3, arg3, type4, arg4, type5, arg5, type6, arg6) { \ 118*10e6dadfSbrendan extern void __dtrace_probe_##name(uintptr_t, uintptr_t, \ 119*10e6dadfSbrendan uintptr_t, uintptr_t, uintptr_t, uintptr_t); \ 120*10e6dadfSbrendan __dtrace_probe_##name((uintptr_t)(arg1), (uintptr_t)(arg2), \ 121*10e6dadfSbrendan (uintptr_t)(arg3), (uintptr_t)(arg4), (uintptr_t)(arg5), \ 122*10e6dadfSbrendan (uintptr_t)(arg6)); \ 123*10e6dadfSbrendan } 124*10e6dadfSbrendan 125*10e6dadfSbrendan #define DTRACE_PROBE7(name, type1, arg1, type2, arg2, type3, arg3, \ 126*10e6dadfSbrendan type4, arg4, type5, arg5, type6, arg6, type7, arg7) { \ 127*10e6dadfSbrendan extern void __dtrace_probe_##name(uintptr_t, uintptr_t, \ 128*10e6dadfSbrendan uintptr_t, uintptr_t, uintptr_t, uintptr_t, uintptr_t); \ 129*10e6dadfSbrendan __dtrace_probe_##name((uintptr_t)(arg1), (uintptr_t)(arg2), \ 130*10e6dadfSbrendan (uintptr_t)(arg3), (uintptr_t)(arg4), (uintptr_t)(arg5), \ 131*10e6dadfSbrendan (uintptr_t)(arg6), (uintptr_t)(arg7)); \ 132*10e6dadfSbrendan } 133*10e6dadfSbrendan 1347c478bd9Sstevel@tonic-gate #define DTRACE_SCHED(name) \ 1357c478bd9Sstevel@tonic-gate DTRACE_PROBE(__sched_##name); 1367c478bd9Sstevel@tonic-gate 1377c478bd9Sstevel@tonic-gate #define DTRACE_SCHED1(name, type1, arg1) \ 1387c478bd9Sstevel@tonic-gate DTRACE_PROBE1(__sched_##name, type1, arg1); 1397c478bd9Sstevel@tonic-gate 1407c478bd9Sstevel@tonic-gate #define DTRACE_SCHED2(name, type1, arg1, type2, arg2) \ 1417c478bd9Sstevel@tonic-gate DTRACE_PROBE2(__sched_##name, type1, arg1, type2, arg2); 1427c478bd9Sstevel@tonic-gate 1437c478bd9Sstevel@tonic-gate #define DTRACE_SCHED3(name, type1, arg1, type2, arg2, type3, arg3) \ 1447c478bd9Sstevel@tonic-gate DTRACE_PROBE3(__sched_##name, type1, arg1, type2, arg2, type3, arg3); 1457c478bd9Sstevel@tonic-gate 1467c478bd9Sstevel@tonic-gate #define DTRACE_SCHED4(name, type1, arg1, type2, arg2, \ 1477c478bd9Sstevel@tonic-gate type3, arg3, type4, arg4) \ 1487c478bd9Sstevel@tonic-gate DTRACE_PROBE4(__sched_##name, type1, arg1, type2, arg2, \ 1497c478bd9Sstevel@tonic-gate type3, arg3, type4, arg4); 1507c478bd9Sstevel@tonic-gate 1517c478bd9Sstevel@tonic-gate #define DTRACE_PROC(name) \ 1527c478bd9Sstevel@tonic-gate DTRACE_PROBE(__proc_##name); 1537c478bd9Sstevel@tonic-gate 1547c478bd9Sstevel@tonic-gate #define DTRACE_PROC1(name, type1, arg1) \ 1557c478bd9Sstevel@tonic-gate DTRACE_PROBE1(__proc_##name, type1, arg1); 1567c478bd9Sstevel@tonic-gate 1577c478bd9Sstevel@tonic-gate #define DTRACE_PROC2(name, type1, arg1, type2, arg2) \ 1587c478bd9Sstevel@tonic-gate DTRACE_PROBE2(__proc_##name, type1, arg1, type2, arg2); 1597c478bd9Sstevel@tonic-gate 1607c478bd9Sstevel@tonic-gate #define DTRACE_PROC3(name, type1, arg1, type2, arg2, type3, arg3) \ 1617c478bd9Sstevel@tonic-gate DTRACE_PROBE3(__proc_##name, type1, arg1, type2, arg2, type3, arg3); 1627c478bd9Sstevel@tonic-gate 1637c478bd9Sstevel@tonic-gate #define DTRACE_PROC4(name, type1, arg1, type2, arg2, \ 1647c478bd9Sstevel@tonic-gate type3, arg3, type4, arg4) \ 1657c478bd9Sstevel@tonic-gate DTRACE_PROBE4(__proc_##name, type1, arg1, type2, arg2, \ 1667c478bd9Sstevel@tonic-gate type3, arg3, type4, arg4); 1677c478bd9Sstevel@tonic-gate 1687c478bd9Sstevel@tonic-gate #define DTRACE_IO(name) \ 1697c478bd9Sstevel@tonic-gate DTRACE_PROBE(__io_##name); 1707c478bd9Sstevel@tonic-gate 1717c478bd9Sstevel@tonic-gate #define DTRACE_IO1(name, type1, arg1) \ 1727c478bd9Sstevel@tonic-gate DTRACE_PROBE1(__io_##name, type1, arg1); 1737c478bd9Sstevel@tonic-gate 1747c478bd9Sstevel@tonic-gate #define DTRACE_IO2(name, type1, arg1, type2, arg2) \ 1757c478bd9Sstevel@tonic-gate DTRACE_PROBE2(__io_##name, type1, arg1, type2, arg2); 1767c478bd9Sstevel@tonic-gate 1777c478bd9Sstevel@tonic-gate #define DTRACE_IO3(name, type1, arg1, type2, arg2, type3, arg3) \ 1787c478bd9Sstevel@tonic-gate DTRACE_PROBE3(__io_##name, type1, arg1, type2, arg2, type3, arg3); 1797c478bd9Sstevel@tonic-gate 1807c478bd9Sstevel@tonic-gate #define DTRACE_IO4(name, type1, arg1, type2, arg2, \ 1817c478bd9Sstevel@tonic-gate type3, arg3, type4, arg4) \ 1827c478bd9Sstevel@tonic-gate DTRACE_PROBE4(__io_##name, type1, arg1, type2, arg2, \ 1837c478bd9Sstevel@tonic-gate type3, arg3, type4, arg4); 1847c478bd9Sstevel@tonic-gate 185e1adf50cSahl #define DTRACE_NFSV3_3(name, type1, arg1, type2, arg2, \ 186e1adf50cSahl type3, arg3) \ 187e1adf50cSahl DTRACE_PROBE3(__nfsv3_##name, type1, arg1, type2, arg2, \ 188e1adf50cSahl type3, arg3); 189e1adf50cSahl #define DTRACE_NFSV3_4(name, type1, arg1, type2, arg2, \ 190e1adf50cSahl type3, arg3, type4, arg4) \ 191e1adf50cSahl DTRACE_PROBE4(__nfsv3_##name, type1, arg1, type2, arg2, \ 192e1adf50cSahl type3, arg3, type4, arg4); 193e1adf50cSahl 194f3b585ceSsamf #define DTRACE_NFSV4_1(name, type1, arg1) \ 195f3b585ceSsamf DTRACE_PROBE1(__nfsv4_##name, type1, arg1); 196f3b585ceSsamf 197f3b585ceSsamf #define DTRACE_NFSV4_2(name, type1, arg1, type2, arg2) \ 198f3b585ceSsamf DTRACE_PROBE2(__nfsv4_##name, type1, arg1, type2, arg2); 199f3b585ceSsamf 200f3b585ceSsamf #define DTRACE_NFSV4_3(name, type1, arg1, type2, arg2, type3, arg3) \ 201f3b585ceSsamf DTRACE_PROBE3(__nfsv4_##name, type1, arg1, type2, arg2, type3, arg3); 202f3b585ceSsamf 203faa1795aSjb #define DTRACE_SMB_1(name, type1, arg1) \ 204faa1795aSjb DTRACE_PROBE1(__smb_##name, type1, arg1); 205faa1795aSjb 206faa1795aSjb #define DTRACE_SMB_2(name, type1, arg1, type2, arg2) \ 207faa1795aSjb DTRACE_PROBE2(__smb_##name, type1, arg1, type2, arg2); 208faa1795aSjb 209*10e6dadfSbrendan #define DTRACE_IP(name) \ 210*10e6dadfSbrendan DTRACE_PROBE(__ip_##name); 211*10e6dadfSbrendan 212*10e6dadfSbrendan #define DTRACE_IP1(name, type1, arg1) \ 213*10e6dadfSbrendan DTRACE_PROBE1(__ip_##name, type1, arg1); 214*10e6dadfSbrendan 215*10e6dadfSbrendan #define DTRACE_IP2(name, type1, arg1, type2, arg2) \ 216*10e6dadfSbrendan DTRACE_PROBE2(__ip_##name, type1, arg1, type2, arg2); 217*10e6dadfSbrendan 218*10e6dadfSbrendan #define DTRACE_IP3(name, type1, arg1, type2, arg2, type3, arg3) \ 219*10e6dadfSbrendan DTRACE_PROBE3(__ip_##name, type1, arg1, type2, arg2, type3, arg3); 220*10e6dadfSbrendan 221*10e6dadfSbrendan #define DTRACE_IP4(name, type1, arg1, type2, arg2, \ 222*10e6dadfSbrendan type3, arg3, type4, arg4) \ 223*10e6dadfSbrendan DTRACE_PROBE4(__ip_##name, type1, arg1, type2, arg2, \ 224*10e6dadfSbrendan type3, arg3, type4, arg4); 225*10e6dadfSbrendan 226*10e6dadfSbrendan #define DTRACE_IP5(name, type1, arg1, type2, arg2, \ 227*10e6dadfSbrendan type3, arg3, type4, arg4, type5, arg5) \ 228*10e6dadfSbrendan DTRACE_PROBE5(__ip_##name, type1, arg1, type2, arg2, \ 229*10e6dadfSbrendan type3, arg3, type4, arg4, type5, arg5); 230*10e6dadfSbrendan 231*10e6dadfSbrendan #define DTRACE_IP6(name, type1, arg1, type2, arg2, \ 232*10e6dadfSbrendan type3, arg3, type4, arg4, type5, arg5, type6, arg6) \ 233*10e6dadfSbrendan DTRACE_PROBE6(__ip_##name, type1, arg1, type2, arg2, \ 234*10e6dadfSbrendan type3, arg3, type4, arg4, type5, arg5, type6, arg6); 235*10e6dadfSbrendan 236*10e6dadfSbrendan #define DTRACE_IP7(name, type1, arg1, type2, arg2, type3, arg3, \ 237*10e6dadfSbrendan type4, arg4, type5, arg5, type6, arg6, type7, arg7) \ 238*10e6dadfSbrendan DTRACE_PROBE7(__ip_##name, type1, arg1, type2, arg2, \ 239*10e6dadfSbrendan type3, arg3, type4, arg4, type5, arg5, type6, arg6, \ 240*10e6dadfSbrendan type7, arg7); 241*10e6dadfSbrendan 242e04145d0Seschrock #define DTRACE_SYSEVENT2(name, type1, arg1, type2, arg2) \ 243e04145d0Seschrock DTRACE_PROBE2(__sysevent_##name, type1, arg1, type2, arg2); 244e04145d0Seschrock 245843e1988Sjohnlev #define DTRACE_XPV(name) \ 246843e1988Sjohnlev DTRACE_PROBE(__xpv_##name); 247843e1988Sjohnlev 248843e1988Sjohnlev #define DTRACE_XPV1(name, type1, arg1) \ 249843e1988Sjohnlev DTRACE_PROBE1(__xpv_##name, type1, arg1); 250843e1988Sjohnlev 251843e1988Sjohnlev #define DTRACE_XPV2(name, type1, arg1, type2, arg2) \ 252843e1988Sjohnlev DTRACE_PROBE2(__xpv_##name, type1, arg1, type2, arg2); 253843e1988Sjohnlev 254843e1988Sjohnlev #define DTRACE_XPV3(name, type1, arg1, type2, arg2, type3, arg3) \ 255843e1988Sjohnlev DTRACE_PROBE3(__xpv_##name, type1, arg1, type2, arg2, type3, arg3); 256843e1988Sjohnlev 257843e1988Sjohnlev #define DTRACE_XPV4(name, type1, arg1, type2, arg2, type3, arg3, \ 258843e1988Sjohnlev type4, arg4) \ 259843e1988Sjohnlev DTRACE_PROBE4(__xpv_##name, type1, arg1, type2, arg2, \ 260843e1988Sjohnlev type3, arg3, type4, arg4); 261843e1988Sjohnlev 2627c478bd9Sstevel@tonic-gate #endif /* _KERNEL */ 2637c478bd9Sstevel@tonic-gate 2647c478bd9Sstevel@tonic-gate extern const char *sdt_prefix; 2657c478bd9Sstevel@tonic-gate 2667c478bd9Sstevel@tonic-gate typedef struct sdt_probedesc { 2677c478bd9Sstevel@tonic-gate char *sdpd_name; /* name of this probe */ 2687c478bd9Sstevel@tonic-gate unsigned long sdpd_offset; /* offset of call in text */ 2697c478bd9Sstevel@tonic-gate struct sdt_probedesc *sdpd_next; /* next static probe */ 2707c478bd9Sstevel@tonic-gate } sdt_probedesc_t; 2717c478bd9Sstevel@tonic-gate 2727c478bd9Sstevel@tonic-gate #ifdef __cplusplus 2737c478bd9Sstevel@tonic-gate } 2747c478bd9Sstevel@tonic-gate #endif 2757c478bd9Sstevel@tonic-gate 2767c478bd9Sstevel@tonic-gate #endif /* _SYS_SDT_H */ 277