dmake: do not set MAKEFLAGS=k
[unleashed/tickless.git] / usr / src / cmd / dtrace / test / tst / common / privs / tst.fds.ksh
bloba5aa27137efa1b87ff79bda54edc8930309314ec
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 tmpin=/tmp/tst.fds.$$.d
27 tmpout1=/tmp/tst.fds.$$.out1
28 tmpout2=/tmp/tst.fds.$$.out2
30 cat > $tmpin <<EOF
31 #define DUMPFIELD(fd, fmt, field) \
32 errmsg = "could not dump field"; \
33 printf("%d: field =fmt\n", fd, fds[fd].field);
36 * Note that we are explicitly not looking at fi_mount -- it (by design) does
37 * not work if not running with kernel permissions.
39 #define DUMP(fd) \
40 DUMPFIELD(fd, %s, fi_name); \
41 DUMPFIELD(fd, %s, fi_dirname); \
42 DUMPFIELD(fd, %s, fi_pathname); \
43 DUMPFIELD(fd, %d, fi_offset); \
44 DUMPFIELD(fd, %s, fi_fs); \
45 DUMPFIELD(fd, %o, fi_oflags);
47 BEGIN
49 DUMP(0);
50 DUMP(1);
51 DUMP(2);
52 DUMP(3);
53 DUMP(4);
54 exit(0);
57 ERROR
59 printf("error: %s\n", errmsg);
60 exit(1);
62 EOF
65 # First, with all privs
67 /usr/sbin/dtrace -q -Cs /dev/stdin < $tmpin > $tmpout2
68 mv $tmpout2 $tmpout1
71 # And now with only dtrace_proc and dtrace_user -- the output should be
72 # identical.
74 ppriv -s A=basic,dtrace_proc,dtrace_user $$
76 /usr/sbin/dtrace -q -Cs /dev/stdin < $tmpin > $tmpout2
78 echo ">>> $tmpout1"
79 cat $tmpout1
81 echo ">>> $tmpout2"
82 cat $tmpout2
84 rval=0
86 if ! cmp $tmpout1 $tmpout2 ; then
87 rval=1
90 rm $tmpout1 $tmpout2 $tmpin
91 exit $rval