xref: /src/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/safety/tst.null.d (revision 2be1a816b9ff69588e55be0a84cbe2a31efc0f2f)
112456ea8SJohn Birrell /*
212456ea8SJohn Birrell  * CDDL HEADER START
312456ea8SJohn Birrell  *
412456ea8SJohn Birrell  * The contents of this file are subject to the terms of the
512456ea8SJohn Birrell  * Common Development and Distribution License (the "License").
612456ea8SJohn Birrell  * You may not use this file except in compliance with the License.
712456ea8SJohn Birrell  *
812456ea8SJohn Birrell  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
912456ea8SJohn Birrell  * or http://www.opensolaris.org/os/licensing.
1012456ea8SJohn Birrell  * See the License for the specific language governing permissions
1112456ea8SJohn Birrell  * and limitations under the License.
1212456ea8SJohn Birrell  *
1312456ea8SJohn Birrell  * When distributing Covered Code, include this CDDL HEADER in each
1412456ea8SJohn Birrell  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
1512456ea8SJohn Birrell  * If applicable, add the following below this CDDL HEADER, with the
1612456ea8SJohn Birrell  * fields enclosed by brackets "[]" replaced with your own identifying
1712456ea8SJohn Birrell  * information: Portions Copyright [yyyy] [name of copyright owner]
1812456ea8SJohn Birrell  *
1912456ea8SJohn Birrell  * CDDL HEADER END
2012456ea8SJohn Birrell  */
2112456ea8SJohn Birrell 
2212456ea8SJohn Birrell /*
2312456ea8SJohn Birrell  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
2412456ea8SJohn Birrell  * Use is subject to license terms.
2512456ea8SJohn Birrell  */
2612456ea8SJohn Birrell 
2712456ea8SJohn Birrell #pragma ident	"%Z%%M%	%I%	%E% SMI"
2812456ea8SJohn Birrell 
2912456ea8SJohn Birrell /*
3012456ea8SJohn Birrell  * ASSERTION:
3112456ea8SJohn Birrell  * 	trace with NULL argument - generate a bunch of errors
3212456ea8SJohn Birrell  *
3312456ea8SJohn Birrell  * SECTION: Options and Tunables/bufsize;
3412456ea8SJohn Birrell  * 	Options and Tunables/bufpolicy
3512456ea8SJohn Birrell  */
3612456ea8SJohn Birrell 
3712456ea8SJohn Birrell /*
3812456ea8SJohn Birrell  * We set our buffer size absurdly low to prevent a flood of errors that we
3912456ea8SJohn Birrell  * don't care about.
4012456ea8SJohn Birrell  */
4112456ea8SJohn Birrell 
4212456ea8SJohn Birrell #pragma D option bufsize=16
4312456ea8SJohn Birrell #pragma D option bufpolicy=ring
4412456ea8SJohn Birrell 
4512456ea8SJohn Birrell fbt:::
4612456ea8SJohn Birrell {
4712456ea8SJohn Birrell 	on = (timestamp / 1000000000) & 1;
4812456ea8SJohn Birrell }
4912456ea8SJohn Birrell 
5012456ea8SJohn Birrell fbt:::
5112456ea8SJohn Birrell /on/
5212456ea8SJohn Birrell {
5312456ea8SJohn Birrell 	n++;
5412456ea8SJohn Birrell 	trace(*(int *)NULL);
5512456ea8SJohn Birrell }
5612456ea8SJohn Birrell 
5712456ea8SJohn Birrell dtrace:::ERROR
5812456ea8SJohn Birrell {
5912456ea8SJohn Birrell 	err++;
6012456ea8SJohn Birrell }
6112456ea8SJohn Birrell 
6212456ea8SJohn Birrell tick-1sec
6312456ea8SJohn Birrell /sec++ == 10/
6412456ea8SJohn Birrell {
6512456ea8SJohn Birrell 	exit(2);
6612456ea8SJohn Birrell }
6712456ea8SJohn Birrell 
6812456ea8SJohn Birrell END
6912456ea8SJohn Birrell /n == 0 || err == 0/
7012456ea8SJohn Birrell {
7112456ea8SJohn Birrell 	exit(1);
7212456ea8SJohn Birrell }
7312456ea8SJohn Birrell 
7412456ea8SJohn Birrell END
7512456ea8SJohn Birrell /n != 0 && err != 0/
7612456ea8SJohn Birrell {
7712456ea8SJohn Birrell 	exit(0);
7812456ea8SJohn Birrell }
79