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 /* 22e04145d0Seschrock * Copyright 2007 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 1087c478bd9Sstevel@tonic-gate #define DTRACE_SCHED(name) \ 1097c478bd9Sstevel@tonic-gate DTRACE_PROBE(__sched_##name); 1107c478bd9Sstevel@tonic-gate 1117c478bd9Sstevel@tonic-gate #define DTRACE_SCHED1(name, type1, arg1) \ 1127c478bd9Sstevel@tonic-gate DTRACE_PROBE1(__sched_##name, type1, arg1); 1137c478bd9Sstevel@tonic-gate 1147c478bd9Sstevel@tonic-gate #define DTRACE_SCHED2(name, type1, arg1, type2, arg2) \ 1157c478bd9Sstevel@tonic-gate DTRACE_PROBE2(__sched_##name, type1, arg1, type2, arg2); 1167c478bd9Sstevel@tonic-gate 1177c478bd9Sstevel@tonic-gate #define DTRACE_SCHED3(name, type1, arg1, type2, arg2, type3, arg3) \ 1187c478bd9Sstevel@tonic-gate DTRACE_PROBE3(__sched_##name, type1, arg1, type2, arg2, type3, arg3); 1197c478bd9Sstevel@tonic-gate 1207c478bd9Sstevel@tonic-gate #define DTRACE_SCHED4(name, type1, arg1, type2, arg2, \ 1217c478bd9Sstevel@tonic-gate type3, arg3, type4, arg4) \ 1227c478bd9Sstevel@tonic-gate DTRACE_PROBE4(__sched_##name, type1, arg1, type2, arg2, \ 1237c478bd9Sstevel@tonic-gate type3, arg3, type4, arg4); 1247c478bd9Sstevel@tonic-gate 1257c478bd9Sstevel@tonic-gate #define DTRACE_PROC(name) \ 1267c478bd9Sstevel@tonic-gate DTRACE_PROBE(__proc_##name); 1277c478bd9Sstevel@tonic-gate 1287c478bd9Sstevel@tonic-gate #define DTRACE_PROC1(name, type1, arg1) \ 1297c478bd9Sstevel@tonic-gate DTRACE_PROBE1(__proc_##name, type1, arg1); 1307c478bd9Sstevel@tonic-gate 1317c478bd9Sstevel@tonic-gate #define DTRACE_PROC2(name, type1, arg1, type2, arg2) \ 1327c478bd9Sstevel@tonic-gate DTRACE_PROBE2(__proc_##name, type1, arg1, type2, arg2); 1337c478bd9Sstevel@tonic-gate 1347c478bd9Sstevel@tonic-gate #define DTRACE_PROC3(name, type1, arg1, type2, arg2, type3, arg3) \ 1357c478bd9Sstevel@tonic-gate DTRACE_PROBE3(__proc_##name, type1, arg1, type2, arg2, type3, arg3); 1367c478bd9Sstevel@tonic-gate 1377c478bd9Sstevel@tonic-gate #define DTRACE_PROC4(name, type1, arg1, type2, arg2, \ 1387c478bd9Sstevel@tonic-gate type3, arg3, type4, arg4) \ 1397c478bd9Sstevel@tonic-gate DTRACE_PROBE4(__proc_##name, type1, arg1, type2, arg2, \ 1407c478bd9Sstevel@tonic-gate type3, arg3, type4, arg4); 1417c478bd9Sstevel@tonic-gate 1427c478bd9Sstevel@tonic-gate #define DTRACE_IO(name) \ 1437c478bd9Sstevel@tonic-gate DTRACE_PROBE(__io_##name); 1447c478bd9Sstevel@tonic-gate 1457c478bd9Sstevel@tonic-gate #define DTRACE_IO1(name, type1, arg1) \ 1467c478bd9Sstevel@tonic-gate DTRACE_PROBE1(__io_##name, type1, arg1); 1477c478bd9Sstevel@tonic-gate 1487c478bd9Sstevel@tonic-gate #define DTRACE_IO2(name, type1, arg1, type2, arg2) \ 1497c478bd9Sstevel@tonic-gate DTRACE_PROBE2(__io_##name, type1, arg1, type2, arg2); 1507c478bd9Sstevel@tonic-gate 1517c478bd9Sstevel@tonic-gate #define DTRACE_IO3(name, type1, arg1, type2, arg2, type3, arg3) \ 1527c478bd9Sstevel@tonic-gate DTRACE_PROBE3(__io_##name, type1, arg1, type2, arg2, type3, arg3); 1537c478bd9Sstevel@tonic-gate 1547c478bd9Sstevel@tonic-gate #define DTRACE_IO4(name, type1, arg1, type2, arg2, \ 1557c478bd9Sstevel@tonic-gate type3, arg3, type4, arg4) \ 1567c478bd9Sstevel@tonic-gate DTRACE_PROBE4(__io_##name, type1, arg1, type2, arg2, \ 1577c478bd9Sstevel@tonic-gate type3, arg3, type4, arg4); 1587c478bd9Sstevel@tonic-gate 159*f3b585ceSsamf #define DTRACE_NFSV4_1(name, type1, arg1) \ 160*f3b585ceSsamf DTRACE_PROBE1(__nfsv4_##name, type1, arg1); 161*f3b585ceSsamf 162*f3b585ceSsamf #define DTRACE_NFSV4_2(name, type1, arg1, type2, arg2) \ 163*f3b585ceSsamf DTRACE_PROBE2(__nfsv4_##name, type1, arg1, type2, arg2); 164*f3b585ceSsamf 165*f3b585ceSsamf #define DTRACE_NFSV4_3(name, type1, arg1, type2, arg2, type3, arg3) \ 166*f3b585ceSsamf DTRACE_PROBE3(__nfsv4_##name, type1, arg1, type2, arg2, type3, arg3); 167*f3b585ceSsamf 168e04145d0Seschrock #define DTRACE_SYSEVENT2(name, type1, arg1, type2, arg2) \ 169e04145d0Seschrock DTRACE_PROBE2(__sysevent_##name, type1, arg1, type2, arg2); 170e04145d0Seschrock 171843e1988Sjohnlev #define DTRACE_XPV(name) \ 172843e1988Sjohnlev DTRACE_PROBE(__xpv_##name); 173843e1988Sjohnlev 174843e1988Sjohnlev #define DTRACE_XPV1(name, type1, arg1) \ 175843e1988Sjohnlev DTRACE_PROBE1(__xpv_##name, type1, arg1); 176843e1988Sjohnlev 177843e1988Sjohnlev #define DTRACE_XPV2(name, type1, arg1, type2, arg2) \ 178843e1988Sjohnlev DTRACE_PROBE2(__xpv_##name, type1, arg1, type2, arg2); 179843e1988Sjohnlev 180843e1988Sjohnlev #define DTRACE_XPV3(name, type1, arg1, type2, arg2, type3, arg3) \ 181843e1988Sjohnlev DTRACE_PROBE3(__xpv_##name, type1, arg1, type2, arg2, type3, arg3); 182843e1988Sjohnlev 183843e1988Sjohnlev #define DTRACE_XPV4(name, type1, arg1, type2, arg2, type3, arg3, \ 184843e1988Sjohnlev type4, arg4) \ 185843e1988Sjohnlev DTRACE_PROBE4(__xpv_##name, type1, arg1, type2, arg2, \ 186843e1988Sjohnlev type3, arg3, type4, arg4); 187843e1988Sjohnlev 1887c478bd9Sstevel@tonic-gate #endif /* _KERNEL */ 1897c478bd9Sstevel@tonic-gate 1907c478bd9Sstevel@tonic-gate extern const char *sdt_prefix; 1917c478bd9Sstevel@tonic-gate 1927c478bd9Sstevel@tonic-gate typedef struct sdt_probedesc { 1937c478bd9Sstevel@tonic-gate char *sdpd_name; /* name of this probe */ 1947c478bd9Sstevel@tonic-gate unsigned long sdpd_offset; /* offset of call in text */ 1957c478bd9Sstevel@tonic-gate struct sdt_probedesc *sdpd_next; /* next static probe */ 1967c478bd9Sstevel@tonic-gate } sdt_probedesc_t; 1977c478bd9Sstevel@tonic-gate 1987c478bd9Sstevel@tonic-gate #ifdef __cplusplus 1997c478bd9Sstevel@tonic-gate } 2007c478bd9Sstevel@tonic-gate #endif 2017c478bd9Sstevel@tonic-gate 2027c478bd9Sstevel@tonic-gate #endif /* _SYS_SDT_H */ 203