19512fe85Sahl /* 29512fe85Sahl * CDDL HEADER START 39512fe85Sahl * 49512fe85Sahl * The contents of this file are subject to the terms of the 59512fe85Sahl * Common Development and Distribution License (the "License"). 69512fe85Sahl * You may not use this file except in compliance with the License. 79512fe85Sahl * 89512fe85Sahl * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 99512fe85Sahl * or http://www.opensolaris.org/os/licensing. 109512fe85Sahl * See the License for the specific language governing permissions 119512fe85Sahl * and limitations under the License. 129512fe85Sahl * 139512fe85Sahl * When distributing Covered Code, include this CDDL HEADER in each 149512fe85Sahl * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 159512fe85Sahl * If applicable, add the following below this CDDL HEADER, with the 169512fe85Sahl * fields enclosed by brackets "[]" replaced with your own identifying 179512fe85Sahl * information: Portions Copyright [yyyy] [name of copyright owner] 189512fe85Sahl * 199512fe85Sahl * CDDL HEADER END 209512fe85Sahl */ 219512fe85Sahl 229512fe85Sahl /* 234edabff4Sbrendan * Copyright 2007 Sun Microsystems, Inc. All rights reserved. 249512fe85Sahl * Use is subject to license terms. 25*17abec59SJohn Levon * Copyright 2020 Joyent, Inc. 269512fe85Sahl */ 279512fe85Sahl 289512fe85Sahl #include <sys/dtrace.h> 299512fe85Sahl 309512fe85Sahl #define INTFUNC(x) \ 319512fe85Sahl BEGIN \ 329512fe85Sahl /*DSTYLED*/ \ 339512fe85Sahl { \ 349512fe85Sahl subr++; \ 359512fe85Sahl @[(long)x] = sum(1); \ 369512fe85Sahl /*DSTYLED*/ \ 379512fe85Sahl } 389512fe85Sahl 399512fe85Sahl #define STRFUNC(x) \ 409512fe85Sahl BEGIN \ 419512fe85Sahl /*DSTYLED*/ \ 429512fe85Sahl { \ 439512fe85Sahl subr++; \ 449512fe85Sahl @str[x] = sum(1); \ 459512fe85Sahl /*DSTYLED*/ \ 469512fe85Sahl } 479512fe85Sahl 489512fe85Sahl #define VOIDFUNC(x) \ 499512fe85Sahl BEGIN \ 509512fe85Sahl /*DSTYLED*/ \ 519512fe85Sahl { \ 529512fe85Sahl subr++; \ 539512fe85Sahl /*DSTYLED*/ \ 549512fe85Sahl } 559512fe85Sahl 569512fe85Sahl INTFUNC(rand()) 579512fe85Sahl INTFUNC(mutex_owned(&`cpu_lock)) 589512fe85Sahl INTFUNC(mutex_owner(&`cpu_lock)) 599512fe85Sahl INTFUNC(mutex_type_adaptive(&`cpu_lock)) 609512fe85Sahl INTFUNC(mutex_type_spin(&`cpu_lock)) 619512fe85Sahl INTFUNC(rw_read_held(&`vfssw_lock)) 629512fe85Sahl INTFUNC(rw_write_held(&`vfssw_lock)) 639512fe85Sahl INTFUNC(rw_iswriter(&`vfssw_lock)) 64*17abec59SJohn Levon INTFUNC(copyin((uintptr_t)NULL, 1)) 65*17abec59SJohn Levon STRFUNC(copyinstr((uintptr_t)NULL, 1)) 669512fe85Sahl INTFUNC(speculation()) 679512fe85Sahl INTFUNC(progenyof($pid)) 689512fe85Sahl INTFUNC(strlen("fooey")) 699512fe85Sahl VOIDFUNC(copyout) 709512fe85Sahl VOIDFUNC(copyoutstr) 719512fe85Sahl INTFUNC(alloca(10)) 729512fe85Sahl VOIDFUNC(bcopy) 739512fe85Sahl VOIDFUNC(copyinto) 749512fe85Sahl INTFUNC(msgdsize(NULL)) 759512fe85Sahl INTFUNC(msgsize(NULL)) 769512fe85Sahl INTFUNC(getmajor(0)) 779512fe85Sahl INTFUNC(getminor(0)) 789512fe85Sahl STRFUNC(ddi_pathname(NULL, 0)) 799512fe85Sahl STRFUNC(strjoin("foo", "bar")) 809512fe85Sahl STRFUNC(lltostr(12373)) 819512fe85Sahl STRFUNC(basename("/var/crash/systemtap")) 829512fe85Sahl STRFUNC(dirname("/var/crash/systemtap")) 839512fe85Sahl STRFUNC(cleanpath("/var/crash/systemtap")) 849512fe85Sahl STRFUNC(strchr("The SystemTap, The.", 't')) 859512fe85Sahl STRFUNC(strrchr("The SystemTap, The.", 't')) 869512fe85Sahl STRFUNC(strstr("The SystemTap, The.", "The")) 879512fe85Sahl STRFUNC(strtok("The SystemTap, The.", "T")) 889512fe85Sahl STRFUNC(substr("The SystemTap, The.", 0)) 899512fe85Sahl INTFUNC(index("The SystemTap, The.", "The")) 909512fe85Sahl INTFUNC(rindex("The SystemTap, The.", "The")) 912b6e762cSahl INTFUNC(htons(0x1234)) 922b6e762cSahl INTFUNC(htonl(0x12345678)) 932b6e762cSahl INTFUNC(htonll(0x1234567890abcdefL)) 942b6e762cSahl INTFUNC(ntohs(0x1234)) 952b6e762cSahl INTFUNC(ntohl(0x12345678)) 962b6e762cSahl INTFUNC(ntohll(0x1234567890abcdefL)) 974edabff4Sbrendan STRFUNC(inet_ntoa((ipaddr_t *)alloca(sizeof (ipaddr_t)))) 984edabff4Sbrendan STRFUNC(inet_ntoa6((in6_addr_t *)alloca(sizeof (in6_addr_t)))) 994edabff4Sbrendan STRFUNC(inet_ntop(AF_INET, (void *)alloca(sizeof (ipaddr_t)))) 10014c0b031SBryan Cantrill STRFUNC(toupper("foo")) 10114c0b031SBryan Cantrill STRFUNC(tolower("BAR")) 102b0f673c4SBryan Cantrill INTFUNC(getf(0)) 103f497f9feSJoshua M. Clulow INTFUNC(strtoll("0x12EE5D5", 16)) 104f497f9feSJoshua M. Clulow STRFUNC(json("{\"systemtap\": false}", "systemtap")) 1059512fe85Sahl 1069512fe85Sahl BEGIN 1079512fe85Sahl /subr == DIF_SUBR_MAX + 1/ 1089512fe85Sahl { 1099512fe85Sahl exit(0); 1109512fe85Sahl } 1119512fe85Sahl 1129512fe85Sahl BEGIN 1139512fe85Sahl { 1149512fe85Sahl printf("found %d subroutines, expected %d\n", subr, DIF_SUBR_MAX + 1); 1159512fe85Sahl exit(1); 1169512fe85Sahl } 117