1130803Smarcel#!/bin/ksh -p
2130803Smarcel#
3130803Smarcel# CDDL HEADER START
4130803Smarcel#
5130803Smarcel# The contents of this file are subject to the terms of the
6130803Smarcel# Common Development and Distribution License (the "License").
7130803Smarcel# You may not use this file except in compliance with the License.
8130803Smarcel#
9130803Smarcel# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10130803Smarcel# or http://www.opensolaris.org/os/licensing.
11130803Smarcel# See the License for the specific language governing permissions
12130803Smarcel# and limitations under the License.
13130803Smarcel#
14130803Smarcel# When distributing Covered Code, include this CDDL HEADER in each
15130803Smarcel# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16130803Smarcel# If applicable, add the following below this CDDL HEADER, with the
17130803Smarcel# fields enclosed by brackets "[]" replaced with your own identifying
18130803Smarcel# information: Portions Copyright [yyyy] [name of copyright owner]
19130803Smarcel#
20130803Smarcel# CDDL HEADER END
21130803Smarcel#
22130803Smarcel
23130803Smarcel#
24130803Smarcel# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
25130803Smarcel# Use is subject to license terms.
26130803Smarcel#
27130803Smarcel
28130803Smarcel#ident	"%Z%%M%	%I%	%E% SMI"
29130803Smarcel
30130803Smarcel##
31130803Smarcel#
32130803Smarcel# ASSERTION:
33130803Smarcel# The -D option can be used to define a name when used in conjunction
34130803Smarcel# with the -C option. The -U option can be used to undefine a name in
35130803Smarcel# conjunction with the -C option. 
36130803Smarcel#
37130803Smarcel# SECTION: dtrace Utility/-C Option;
38130803Smarcel# 	dtrace Utility/-D Option;
39130803Smarcel# 	dtrace Utility/-U Option
40130803Smarcel#
41130803Smarcel##
42130803Smarcel
43130803Smarcelscript()
44130803Smarcel{
45130803Smarcel	$dtrace -C -D VALUE=40 -U VALUE -s /dev/stdin <<EOF
46130803Smarcel	#pragma D option quiet
47130803Smarcel
48130803Smarcel	BEGIN
49130803Smarcel	{
50130803Smarcel		printf("Value of VALUE: %d\n", VALUE);
51130803Smarcel		exit(0);
52130803Smarcel	}
53130803SmarcelEOF
54130803Smarcel}
55130803Smarcel
56130803Smarcelif [ $# != 1 ]; then
57130803Smarcel	echo expected one argument: '<'dtrace-path'>'
58130803Smarcel	exit 2
59130803Smarcelfi
60130803Smarcel
61130803Smarceldtrace=$1
62130803Smarcel
63130803Smarcelscript
64130803Smarcelstatus=$?
65130803Smarcel
66130803Smarcelif [ "$status" -ne 0 ]; then
67130803Smarcel	exit 0
68130803Smarcelfi
69130803Smarcel
70130803Smarcelecho $tst: dtrace failed
71130803Smarcelexit $status
72130803Smarcel