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 /* 23 * Copyright 2006 Sun Microsystems, Inc. All rights reserved. 24 * Use is subject to license terms. 25 */ 26 27 #pragma ident "%Z%%M% %I% %E% SMI" 28 29 #include <sys/dtrace.h> 30 31 #define INTFUNC(x) \ 32 BEGIN \ 33 /*DSTYLED*/ \ 34 { \ 35 subr++; \ 36 @[(long)x] = sum(1); \ 37 /*DSTYLED*/ \ 38 } 39 40 #define STRFUNC(x) \ 41 BEGIN \ 42 /*DSTYLED*/ \ 43 { \ 44 subr++; \ 45 @str[x] = sum(1); \ 46 /*DSTYLED*/ \ 47 } 48 49 #define VOIDFUNC(x) \ 50 BEGIN \ 51 /*DSTYLED*/ \ 52 { \ 53 subr++; \ 54 /*DSTYLED*/ \ 55 } 56 57 INTFUNC(rand()) 58 INTFUNC(mutex_owned(&`cpu_lock)) 59 INTFUNC(mutex_owner(&`cpu_lock)) 60 INTFUNC(mutex_type_adaptive(&`cpu_lock)) 61 INTFUNC(mutex_type_spin(&`cpu_lock)) 62 INTFUNC(rw_read_held(&`vfssw_lock)) 63 INTFUNC(rw_write_held(&`vfssw_lock)) 64 INTFUNC(rw_iswriter(&`vfssw_lock)) 65 INTFUNC(copyin(NULL, 1)) 66 STRFUNC(copyinstr(NULL, 1)) 67 INTFUNC(speculation()) 68 INTFUNC(progenyof($pid)) 69 INTFUNC(strlen("fooey")) 70 VOIDFUNC(copyout) 71 VOIDFUNC(copyoutstr) 72 INTFUNC(alloca(10)) 73 VOIDFUNC(bcopy) 74 VOIDFUNC(copyinto) 75 INTFUNC(msgdsize(NULL)) 76 INTFUNC(msgsize(NULL)) 77 INTFUNC(getmajor(0)) 78 INTFUNC(getminor(0)) 79 STRFUNC(ddi_pathname(NULL, 0)) 80 STRFUNC(strjoin("foo", "bar")) 81 STRFUNC(lltostr(12373)) 82 STRFUNC(basename("/var/crash/systemtap")) 83 STRFUNC(dirname("/var/crash/systemtap")) 84 STRFUNC(cleanpath("/var/crash/systemtap")) 85 STRFUNC(strchr("The SystemTap, The.", 't')) 86 STRFUNC(strrchr("The SystemTap, The.", 't')) 87 STRFUNC(strstr("The SystemTap, The.", "The")) 88 STRFUNC(strtok("The SystemTap, The.", "T")) 89 STRFUNC(substr("The SystemTap, The.", 0)) 90 INTFUNC(index("The SystemTap, The.", "The")) 91 INTFUNC(rindex("The SystemTap, The.", "The")) 92 INTFUNC(htons(0x1234)) 93 INTFUNC(htonl(0x12345678)) 94 INTFUNC(htonll(0x1234567890abcdefL)) 95 INTFUNC(ntohs(0x1234)) 96 INTFUNC(ntohl(0x12345678)) 97 INTFUNC(ntohll(0x1234567890abcdefL)) 98 99 BEGIN 100 /subr == DIF_SUBR_MAX + 1/ 101 { 102 exit(0); 103 } 104 105 BEGIN 106 { 107 printf("found %d subroutines, expected %d\n", subr, DIF_SUBR_MAX + 1); 108 exit(1); 109 } 110