xref: /onnv-gate/usr/src/cmd/dtrace/test/tst/common/usdt/tst.forker.c (revision 4273:c8eee992faea)
1*4273Sahl /*
2*4273Sahl  * CDDL HEADER START
3*4273Sahl  *
4*4273Sahl  * The contents of this file are subject to the terms of the
5*4273Sahl  * Common Development and Distribution License (the "License").
6*4273Sahl  * You may not use this file except in compliance with the License.
7*4273Sahl  *
8*4273Sahl  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9*4273Sahl  * or http://www.opensolaris.org/os/licensing.
10*4273Sahl  * See the License for the specific language governing permissions
11*4273Sahl  * and limitations under the License.
12*4273Sahl  *
13*4273Sahl  * When distributing Covered Code, include this CDDL HEADER in each
14*4273Sahl  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15*4273Sahl  * If applicable, add the following below this CDDL HEADER, with the
16*4273Sahl  * fields enclosed by brackets "[]" replaced with your own identifying
17*4273Sahl  * information: Portions Copyright [yyyy] [name of copyright owner]
18*4273Sahl  *
19*4273Sahl  * CDDL HEADER END
20*4273Sahl  */
21*4273Sahl 
22*4273Sahl /*
23*4273Sahl  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
24*4273Sahl  * Use is subject to license terms.
25*4273Sahl  */
26*4273Sahl 
27*4273Sahl #pragma ident	"%Z%%M%	%I%	%E% SMI"
28*4273Sahl 
29*4273Sahl #include <unistd.h>
30*4273Sahl 
31*4273Sahl #include "forker.h"
32*4273Sahl 
33*4273Sahl int
main(int argc,char ** argv)34*4273Sahl main(int argc, char **argv)
35*4273Sahl {
36*4273Sahl 	int i;
37*4273Sahl 
38*4273Sahl 	for (i = 0; i < 10000; i++) {
39*4273Sahl 		FORKER_FIRE();
40*4273Sahl 		if (fork() == 0)
41*4273Sahl 			exit(0);
42*4273Sahl 
43*4273Sahl 		(void) wait(NULL);
44*4273Sahl 	}
45*4273Sahl 
46*4273Sahl 	return (0);
47*4273Sahl }
48