xref: /onnv-gate/usr/src/cmd/dtrace/test/tst/common/aggs/tst.subr.d (revision 4291:2650d270ece9)
12633Sahl /*
22633Sahl  * CDDL HEADER START
32633Sahl  *
42633Sahl  * The contents of this file are subject to the terms of the
52633Sahl  * Common Development and Distribution License (the "License").
62633Sahl  * You may not use this file except in compliance with the License.
72633Sahl  *
82633Sahl  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
92633Sahl  * or http://www.opensolaris.org/os/licensing.
102633Sahl  * See the License for the specific language governing permissions
112633Sahl  * and limitations under the License.
122633Sahl  *
132633Sahl  * When distributing Covered Code, include this CDDL HEADER in each
142633Sahl  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
152633Sahl  * If applicable, add the following below this CDDL HEADER, with the
162633Sahl  * fields enclosed by brackets "[]" replaced with your own identifying
172633Sahl  * information: Portions Copyright [yyyy] [name of copyright owner]
182633Sahl  *
192633Sahl  * CDDL HEADER END
202633Sahl  */
212633Sahl 
222633Sahl /*
23*4291Sbrendan  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
242633Sahl  * Use is subject to license terms.
252633Sahl  */
262633Sahl 
272633Sahl #pragma ident	"%Z%%M%	%I%	%E% SMI"
282633Sahl 
292633Sahl #include <sys/dtrace.h>
302633Sahl 
312633Sahl #define INTFUNC(x)			\
322633Sahl 	BEGIN				\
332633Sahl 	/*DSTYLED*/			\
342633Sahl 	{				\
352633Sahl 		subr++;			\
362633Sahl 		@[(long)x] = sum(1);	\
372633Sahl 	/*DSTYLED*/			\
382633Sahl 	}
392633Sahl 
402633Sahl #define STRFUNC(x)			\
412633Sahl 	BEGIN				\
422633Sahl 	/*DSTYLED*/			\
432633Sahl 	{				\
442633Sahl 		subr++;			\
452633Sahl 		@str[x] = sum(1);	\
462633Sahl 	/*DSTYLED*/			\
472633Sahl 	}
482633Sahl 
492633Sahl #define VOIDFUNC(x)			\
502633Sahl 	BEGIN				\
512633Sahl 	/*DSTYLED*/			\
522633Sahl 	{				\
532633Sahl 		subr++;			\
542633Sahl 	/*DSTYLED*/			\
552633Sahl 	}
562633Sahl 
572633Sahl INTFUNC(rand())
582633Sahl INTFUNC(mutex_owned(&`cpu_lock))
592633Sahl INTFUNC(mutex_owner(&`cpu_lock))
602633Sahl INTFUNC(mutex_type_adaptive(&`cpu_lock))
612633Sahl INTFUNC(mutex_type_spin(&`cpu_lock))
622633Sahl INTFUNC(rw_read_held(&`vfssw_lock))
632633Sahl INTFUNC(rw_write_held(&`vfssw_lock))
642633Sahl INTFUNC(rw_iswriter(&`vfssw_lock))
652633Sahl INTFUNC(copyin(NULL, 1))
662633Sahl STRFUNC(copyinstr(NULL, 1))
672633Sahl INTFUNC(speculation())
682633Sahl INTFUNC(progenyof($pid))
692633Sahl INTFUNC(strlen("fooey"))
702633Sahl VOIDFUNC(copyout)
712633Sahl VOIDFUNC(copyoutstr)
722633Sahl INTFUNC(alloca(10))
732633Sahl VOIDFUNC(bcopy)
742633Sahl VOIDFUNC(copyinto)
752633Sahl INTFUNC(msgdsize(NULL))
762633Sahl INTFUNC(msgsize(NULL))
772633Sahl INTFUNC(getmajor(0))
782633Sahl INTFUNC(getminor(0))
792633Sahl STRFUNC(ddi_pathname(NULL, 0))
802633Sahl STRFUNC(strjoin("foo", "bar"))
812633Sahl STRFUNC(lltostr(12373))
822633Sahl STRFUNC(basename("/var/crash/systemtap"))
832633Sahl STRFUNC(dirname("/var/crash/systemtap"))
842633Sahl STRFUNC(cleanpath("/var/crash/systemtap"))
852633Sahl STRFUNC(strchr("The SystemTap, The.", 't'))
862633Sahl STRFUNC(strrchr("The SystemTap, The.", 't'))
872633Sahl STRFUNC(strstr("The SystemTap, The.", "The"))
882633Sahl STRFUNC(strtok("The SystemTap, The.", "T"))
892633Sahl STRFUNC(substr("The SystemTap, The.", 0))
902633Sahl INTFUNC(index("The SystemTap, The.", "The"))
912633Sahl INTFUNC(rindex("The SystemTap, The.", "The"))
922769Sahl INTFUNC(htons(0x1234))
932769Sahl INTFUNC(htonl(0x12345678))
942769Sahl INTFUNC(htonll(0x1234567890abcdefL))
952769Sahl INTFUNC(ntohs(0x1234))
962769Sahl INTFUNC(ntohl(0x12345678))
972769Sahl INTFUNC(ntohll(0x1234567890abcdefL))
98*4291Sbrendan STRFUNC(inet_ntoa((ipaddr_t *)alloca(sizeof (ipaddr_t))))
99*4291Sbrendan STRFUNC(inet_ntoa6((in6_addr_t *)alloca(sizeof (in6_addr_t))))
100*4291Sbrendan STRFUNC(inet_ntop(AF_INET, (void *)alloca(sizeof (ipaddr_t))))
1012633Sahl 
1022633Sahl BEGIN
1032633Sahl /subr == DIF_SUBR_MAX + 1/
1042633Sahl {
1052633Sahl 	exit(0);
1062633Sahl }
1072633Sahl 
1082633Sahl BEGIN
1092633Sahl {
1102633Sahl 	printf("found %d subroutines, expected %d\n", subr, DIF_SUBR_MAX + 1);
1112633Sahl 	exit(1);
1122633Sahl }
113