dmake: do not set MAKEFLAGS=k
[unleashed/tickless.git] / usr / src / cmd / dtrace / test / tst / common / privs / tst.getf.ksh
blob3ffb478903967ab1fc3eb911f4c91fd96ee232ae
2 # CDDL HEADER START
4 # The contents of this file are subject to the terms of the
5 # Common Development and Distribution License (the "License").
6 # You may not use this file except in compliance with the License.
8 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 # or http://www.opensolaris.org/os/licensing.
10 # See the License for the specific language governing permissions
11 # and limitations under the License.
13 # When distributing Covered Code, include this CDDL HEADER in each
14 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 # If applicable, add the following below this CDDL HEADER, with the
16 # fields enclosed by brackets "[]" replaced with your own identifying
17 # information: Portions Copyright [yyyy] [name of copyright owner]
19 # CDDL HEADER END
23 # Copyright (c) 2012, Joyent, Inc. All rights reserved.
26 ppriv -s A=basic,dtrace_proc,dtrace_user $$
28 /usr/sbin/dtrace -q -Cs /dev/stdin <<EOF
30 #define CANREAD(field) \
31 BEGIN { this->fp = getf(0); errmsg = "can't read field"; \
32 printf("field: "); trace(this->fp->field); printf("\n"); }
34 #define CANTREAD(field) \
35 BEGIN { errmsg = ""; this->fp = getf(0); trace(this->fp->field); \
36 printf("\nable to successfully read field!"); exit(1); }
38 CANREAD(f_flag)
39 CANREAD(f_vnode)
40 CANREAD(f_offset)
41 CANREAD(f_cred)
42 CANREAD(f_audit_data)
43 CANREAD(f_count)
46 * We can potentially read parts of our cred, but we can't dereference
47 * through cr_zone.
49 CANTREAD(f_cred->cr_zone->zone_id)
51 CANREAD(f_vnode->v_path)
52 CANREAD(f_vnode->v_op)
53 CANREAD(f_vnode->v_op->vnop_name)
55 CANTREAD(f_vnode->v_flag)
56 CANTREAD(f_vnode->v_count)
57 CANTREAD(f_vnode->v_object)
58 CANTREAD(f_vnode->v_object.tree)
59 CANTREAD(f_vnode->v_object.list)
60 CANTREAD(f_vnode->v_object.lock)
61 CANTREAD(f_vnode->v_type)
62 CANTREAD(f_vnode->v_vfsmountedhere)
63 CANTREAD(f_vnode->v_op->vop_open)
65 BEGIN
67 errmsg = "";
68 this->fp = getf(0);
69 this->fp2 = getf(1);
71 trace(this->fp->f_vnode);
72 printf("\nable to successfully read this->fp!");
73 exit(1);
76 BEGIN
78 errmsg = "";
79 this->fp = getf(0);
82 BEGIN
84 trace(this->fp->f_vnode);
85 printf("\nable to successfully read this->fp from prior clause!");
88 BEGIN
90 exit(0);
93 ERROR
94 /errmsg != ""/
96 printf("fatal error: %s", errmsg);
97 exit(1);