xref: /titanic_41/usr/src/cmd/dtrace/test/tst/common/java_api/tst.ProbeData.c (revision 73427c57f824c3ec3b396181b163f37d50c5b3b1)
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 2007 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 typedef void f(char *);
30 
31 static void
f_a(char * a)32 f_a(char *a)
33 {
34 }
35 
36 static void
f_b(char * a)37 f_b(char *a)
38 {
39 }
40 
41 static void
f_c(char * a)42 f_c(char *a)
43 {
44 }
45 
46 static void
f_d(char * a)47 f_d(char *a)
48 {
49 }
50 
51 static void
f_e(char * a)52 f_e(char *a)
53 {
54 }
55 
56 static void
fN(f func,char * a,int i)57 fN(f func, char *a, int i)
58 {
59 	func(a);
60 }
61 
62 static void
fN2(f func,char * a,int i)63 fN2(f func, char *a, int i)
64 {
65 	func(a);
66 }
67 
68 int
main()69 main()
70 {
71 	/*
72 	 * Avoid length of 1, 2, 4, or 8 bytes so DTrace will treat the data as
73 	 * a byte array.
74 	 */
75 	char a[] = {(char)-7, (char)201, (char)0, (char)0, (char)28, (char)1};
76 	char b[] = {(char)84, (char)69, (char)0, (char)0, (char)28, (char)0};
77 	char c[] = {(char)84, (char)69, (char)0, (char)0, (char)28, (char)1};
78 	char d[] = {(char)-7, (char)201, (char)0, (char)0, (char)29, (char)0};
79 	char e[] = {(char)84, (char)69, (char)0, (char)0, (char)28, (char)0};
80 
81 	fN(f_a, a, 1);
82 	fN(f_b, b, 0);
83 	fN(f_d, d, 102);
84 	fN2(f_e, e, -2);
85 	fN(f_c, c, 0);
86 	fN(f_a, a, -1);
87 	fN(f_d, d, 101);
88 	fN(f_e, e, -2);
89 	fN(f_e, e, 2);
90 	fN2(f_e, e, 2);
91 
92 	return (0);
93 }
94