xref: /onnv-gate/usr/src/cmd/dtrace/test/tst/common/privs/tst.op_access.ksh (revision 2870:a343ed00e23c)
1*2870Sdp#
2*2870Sdp# CDDL HEADER START
3*2870Sdp#
4*2870Sdp# The contents of this file are subject to the terms of the
5*2870Sdp# Common Development and Distribution License (the "License").
6*2870Sdp# You may not use this file except in compliance with the License.
7*2870Sdp#
8*2870Sdp# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9*2870Sdp# or http://www.opensolaris.org/os/licensing.
10*2870Sdp# See the License for the specific language governing permissions
11*2870Sdp# and limitations under the License.
12*2870Sdp#
13*2870Sdp# When distributing Covered Code, include this CDDL HEADER in each
14*2870Sdp# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15*2870Sdp# If applicable, add the following below this CDDL HEADER, with the
16*2870Sdp# fields enclosed by brackets "[]" replaced with your own identifying
17*2870Sdp# information: Portions Copyright [yyyy] [name of copyright owner]
18*2870Sdp#
19*2870Sdp# CDDL HEADER END
20*2870Sdp#
21*2870Sdp
22*2870Sdp#
23*2870Sdp# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
24*2870Sdp# Use is subject to license terms.
25*2870Sdp#
26*2870Sdp#ident	"%Z%%M%	%I%	%E% SMI"
27*2870Sdp
28*2870Sdpppriv -s A=basic,dtrace_proc,dtrace_user $$
29*2870Sdp
30*2870Sdp/usr/sbin/dtrace -q -s /dev/stdin <<"EOF"
31*2870SdpBEGIN {
32*2870Sdp	errorcount = 0;
33*2870Sdp	expected_errorcount = 7;
34*2870Sdp}
35*2870Sdp
36*2870Sdp/* BYREF */
37*2870SdpBEGIN { trace(`utsname); }
38*2870SdpBEGIN { trace(`kmem_flags); }
39*2870Sdp
40*2870Sdp/* DIF_OP_SCMP */
41*2870SdpBEGIN /`initname == "/sbin/init"/ { trace("bad"); }
42*2870Sdp
43*2870Sdp/* DIF_OP_COPYS */
44*2870SdpBEGIN { p = `p0; trace(p); }
45*2870Sdp
46*2870Sdp/* DIF_OP_STTS */
47*2870SdpBEGIN { self->p = `p0; trace(self->p); }
48*2870Sdp
49*2870Sdp/* DIF_OP_STGAA */
50*2870SdpBEGIN { a[stringof(`initname)] = 42; trace(a["/sbin/init"]); }
51*2870Sdp
52*2870Sdp/* DIF_OP_STTAA */
53*2870SdpBEGIN { self->a[stringof(`initname)] = 42; trace(self->a["/sbin/init"]); }
54*2870Sdp
55*2870SdpERROR {
56*2870Sdp	errorcount++;
57*2870Sdp}
58*2870Sdp
59*2870SdpBEGIN /errorcount == expected_errorcount/ {
60*2870Sdp	trace("pass");
61*2870Sdp	exit(0);
62*2870Sdp}
63*2870Sdp
64*2870SdpBEGIN /errorcount != expected_errorcount/ {
65*2870Sdp	printf("fail: expected %d.  saw %d.", expected_errorcount, errorcount);
66*2870Sdp	exit(1);
67*2870Sdp}
68*2870SdpEOF
69*2870Sdp
70*2870Sdpexit $?
71