xref: /onnv-gate/usr/src/cmd/dtrace/test/tst/common/ustack/tst.bigstack.c (revision 3944:75371f172291)
13682Sjhaslam /*
23682Sjhaslam  * CDDL HEADER START
33682Sjhaslam  *
43682Sjhaslam  * The contents of this file are subject to the terms of the
53682Sjhaslam  * Common Development and Distribution License (the "License").
63682Sjhaslam  * You may not use this file except in compliance with the License.
73682Sjhaslam  *
83682Sjhaslam  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
93682Sjhaslam  * or http://www.opensolaris.org/os/licensing.
103682Sjhaslam  * See the License for the specific language governing permissions
113682Sjhaslam  * and limitations under the License.
123682Sjhaslam  *
133682Sjhaslam  * When distributing Covered Code, include this CDDL HEADER in each
143682Sjhaslam  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
153682Sjhaslam  * If applicable, add the following below this CDDL HEADER, with the
163682Sjhaslam  * fields enclosed by brackets "[]" replaced with your own identifying
173682Sjhaslam  * information: Portions Copyright [yyyy] [name of copyright owner]
183682Sjhaslam  *
193682Sjhaslam  * CDDL HEADER END
203682Sjhaslam  */
213682Sjhaslam 
223682Sjhaslam /*
233682Sjhaslam  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
243682Sjhaslam  * Use is subject to license terms.
253682Sjhaslam  */
263682Sjhaslam 
273682Sjhaslam #pragma ident	"%Z%%M%	%I%	%E% SMI"
283682Sjhaslam 
293682Sjhaslam #include <stdio.h>
303682Sjhaslam #include <stdlib.h>
313682Sjhaslam #include <unistd.h>
323682Sjhaslam 
333682Sjhaslam void grow1(int);
343682Sjhaslam 
353682Sjhaslam void
grow(int frame)363682Sjhaslam grow(int frame)
373682Sjhaslam {
383682Sjhaslam 	/*
393682Sjhaslam 	 * Create a ridiculously large stack - enough to push us over
403682Sjhaslam 	 * the default setting of 'dtrace_ustackdepth_max' (2048).
413682Sjhaslam 	 */
423682Sjhaslam 	if (frame >= 2048)
433682Sjhaslam 		for (;;)
443682Sjhaslam 			getpid();
453682Sjhaslam 
463682Sjhaslam 	grow1(++frame);
473682Sjhaslam }
483682Sjhaslam 
493682Sjhaslam void
grow1(int frame)503682Sjhaslam grow1(int frame)
513682Sjhaslam {
523682Sjhaslam 	grow(++frame);
533682Sjhaslam }
543682Sjhaslam 
553682Sjhaslam int
main(int argc,char * argv[])563682Sjhaslam main(int argc, char *argv[])
573682Sjhaslam {
583682Sjhaslam 	grow(1);
59*3944Sahl 
60*3944Sahl 	return (0);
613682Sjhaslam }
62