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]
23 # Copyright (c) 2012, Joyent, Inc. All rights reserved.
27 # First, make sure that we can successfully enable the io provider
29 if ! dtrace
-P io
-n BEGIN
'{exit(0)}' > /dev
/null
2>&1 ; then
30 echo failed to
enable io provider with full privs
34 ppriv
-s A
=basic
,dtrace_proc
,dtrace_user $$
37 # Now make sure that we cannot enable the io provider with reduced privs
39 if ! dtrace
-x errtags
-P io
-n BEGIN
'{exit(1)}' 2>&1 | \
40 grep D_PDESC_ZERO
> /dev
/null
2>&1 ; then
41 echo successfully enabled the io provider with reduced privs
46 # Keeping our reduced privs, we want to assure that we can see every provider
47 # that we think we should be able to see -- and that we can see curpsinfo
48 # state but can't otherwise see arguments.
50 /usr
/sbin
/dtrace
-wq -Cs /dev
/stdin
<<EOF
55 #define CANENABLE(provider) \
57 /err == 0 && progenyof(\$pid) && !seen["provider"]/ \
60 printf("\nsuccessful trace of arg0 in %s:%s:%s:%s\n", \
61 probeprov, probemod, probefunc, probename); \
74 errstr = "provider"; \
75 this->ignore = stringof(curpsinfo->pr_psargs); \
80 /err == 0 && !seen["provider"]/ \
82 printf("no probes from provider\n"); \
89 printf("saw %d probes from provider\n", seen["provider"]); \
100 * We'll kick off a system of a do-nothing command -- which should be
101 * enough to kick proc, sched, vminfo and sysinfo probes.
103 system("echo > /dev/null");
107 /err == 0 && errstr != ""/
109 printf("fatal error: couldn't read curpsinfo->pr_psargs in ");
110 printf("%s-provided probe\n", errstr);
123 printf("exit probe did not seem to fire\n");