MFV OpenSolaris DTrace userland bits.
This commit is contained in:
commit
1670a1c2a4
@ -20,12 +20,10 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright 2007 Sun Microsystems, Inc. All rights reserved.
|
||||
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
|
||||
* Use is subject to license terms.
|
||||
*/
|
||||
|
||||
#pragma ident "%Z%%M% %I% %E% SMI"
|
||||
|
||||
#include <sys/stat.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
@ -162,7 +160,7 @@ main(int argc, char **argv)
|
||||
FILE *fp;
|
||||
unsigned char *dof, *copy;
|
||||
|
||||
if (argc < 1)
|
||||
if (argc < 2)
|
||||
fatal("expected D script as argument\n");
|
||||
|
||||
if ((fp = fopen(filename, "r")) == NULL)
|
||||
|
@ -20,12 +20,10 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
|
||||
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
|
||||
* Use is subject to license terms.
|
||||
*/
|
||||
|
||||
#pragma ident "%Z%%M% %I% %E% SMI"
|
||||
|
||||
#include <strings.h>
|
||||
#include <unistd.h>
|
||||
#include <dtrace.h>
|
||||
@ -35,6 +33,7 @@ static int g_errs;
|
||||
static int g_fd;
|
||||
static int g_verbose;
|
||||
static int g_errexit;
|
||||
static char *g_progname;
|
||||
|
||||
static int
|
||||
probe(dtrace_hdl_t *dtp, const dtrace_probedesc_t *pdp, void *data)
|
||||
@ -91,9 +90,11 @@ main(int argc, char *argv[])
|
||||
int err, c;
|
||||
char *p;
|
||||
|
||||
g_progname = argv[0];
|
||||
|
||||
if ((dtp = dtrace_open(DTRACE_VERSION, 0, &err)) == NULL) {
|
||||
(void) fprintf(stderr, "%s: failed to open dtrace: %s\n",
|
||||
argv[0], dtrace_errmsg(dtp, err));
|
||||
g_progname, dtrace_errmsg(dtp, err));
|
||||
return (1);
|
||||
}
|
||||
|
||||
@ -111,7 +112,7 @@ main(int argc, char *argv[])
|
||||
|
||||
if (dtrace_setopt(dtp, optarg, p) != 0) {
|
||||
(void) fprintf(stderr, "%s: failed to set "
|
||||
"option -x %s: %s\n", argv[0], optarg,
|
||||
"option -x %s: %s\n", g_progname, optarg,
|
||||
dtrace_errmsg(dtp, dtrace_errno(dtp)));
|
||||
return (2);
|
||||
}
|
||||
@ -119,7 +120,7 @@ main(int argc, char *argv[])
|
||||
|
||||
default:
|
||||
(void) fprintf(stderr, "Usage: %s [-ev] "
|
||||
"[-x opt[=arg]] [probedesc]\n", argv[0]);
|
||||
"[-x opt[=arg]] [probedesc]\n", g_progname);
|
||||
return (2);
|
||||
}
|
||||
}
|
||||
@ -128,9 +129,9 @@ main(int argc, char *argv[])
|
||||
argc -= optind;
|
||||
|
||||
if (argc > 0) {
|
||||
if (dtrace_str2desc(dtp, DTRACE_PROBESPEC_NAME, argv[1], &pd)) {
|
||||
if (dtrace_str2desc(dtp, DTRACE_PROBESPEC_NAME, argv[0], &pd)) {
|
||||
(void) fprintf(stderr, "%s: invalid probe description "
|
||||
"%s: %s\n", argv[0], argv[1],
|
||||
"%s: %s\n", g_progname, argv[0],
|
||||
dtrace_errmsg(dtp, dtrace_errno(dtp)));
|
||||
return (2);
|
||||
}
|
||||
|
@ -21,12 +21,11 @@
|
||||
#
|
||||
|
||||
#
|
||||
# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
|
||||
# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
|
||||
# Use is subject to license terms.
|
||||
#
|
||||
#pragma ident "%Z%%M% %I% %E% SMI"
|
||||
|
||||
require 5.6.1;
|
||||
require 5.8.4;
|
||||
|
||||
$PNAME = $0;
|
||||
$PNAME =~ s:.*/::;
|
||||
|
@ -24,9 +24,8 @@
|
||||
# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
|
||||
# Use is subject to license terms.
|
||||
#
|
||||
# ident "%Z%%M% %I% %E% SMI"
|
||||
|
||||
require 5.6.1;
|
||||
require 5.8.4;
|
||||
|
||||
use File::Find;
|
||||
use File::Basename;
|
||||
@ -40,6 +39,7 @@ $OPTSTR = 'abd:fghi:jlnqsx:';
|
||||
$USAGE = "Usage: $PNAME [-abfghjlnqs] [-d dir] [-i isa] "
|
||||
. "[-x opt[=arg]] [file | dir ...]\n";
|
||||
($MACH = `uname -p`) =~ s/\W*\n//;
|
||||
($PLATFORM = `uname -i`) =~ s/\W*\n//;
|
||||
|
||||
@dtrace_argv = ();
|
||||
|
||||
@ -215,17 +215,17 @@ sub is_exception {
|
||||
}
|
||||
|
||||
#
|
||||
# Iterate over the set of test files specified on the command-line or by
|
||||
# a find on "$defdir/common" and "$defdir/$MACH" and execute each one.
|
||||
# If the test file is executable, we fork and exec it. If the test is a
|
||||
# .ksh file, we run it with $ksh_path. Otherwise we run dtrace -s on it.
|
||||
# If the file is named tst.* we assume it should return exit status 0.
|
||||
# If the file is named err.* we assume it should return exit status 1.
|
||||
# If the file is named err.D_[A-Z0-9]+[.*].d we use dtrace -xerrtags and
|
||||
# examine stderr to ensure that a matching error tag was produced.
|
||||
# If the file is named drp.[A-Z0-9]+[.*].d we use dtrace -xdroptags and
|
||||
# examine stderr to ensure that a matching drop tag was produced.
|
||||
# If any *.out or *.err files are found we perform output comparisons.
|
||||
# Iterate over the set of test files specified on the command-line or by a find
|
||||
# on "$defdir/common", "$defdir/$MACH" and "$defdir/$PLATFORM" and execute each
|
||||
# one. If the test file is executable, we fork and exec it. If the test is a
|
||||
# .ksh file, we run it with $ksh_path. Otherwise we run dtrace -s on it. If
|
||||
# the file is named tst.* we assume it should return exit status 0. If the
|
||||
# file is named err.* we assume it should return exit status 1. If the file is
|
||||
# named err.D_[A-Z0-9]+[.*].d we use dtrace -xerrtags and examine stderr to
|
||||
# ensure that a matching error tag was produced. If the file is named
|
||||
# drp.[A-Z0-9]+[.*].d we use dtrace -xdroptags and examine stderr to ensure
|
||||
# that a matching drop tag was produced. If any *.out or *.err files are found
|
||||
# we perform output comparisons.
|
||||
#
|
||||
# run_tests takes two arguments: The first is the pathname of the dtrace
|
||||
# command to invoke when running the tests. The second is the pathname
|
||||
@ -548,6 +548,7 @@ $bindir = -d $dt_bin ? $dt_bin : '.';
|
||||
|
||||
find(\&wanted, "$defdir/common") if (scalar(@ARGV) == 0);
|
||||
find(\&wanted, "$defdir/$MACH") if (scalar(@ARGV) == 0);
|
||||
find(\&wanted, "$defdir/$PLATFORM") if (scalar(@ARGV) == 0);
|
||||
die $USAGE if (scalar(@files) == 0);
|
||||
|
||||
$dtrace_path = '/usr/sbin/dtrace';
|
||||
|
@ -0,0 +1,41 @@
|
||||
/*
|
||||
* CDDL HEADER START
|
||||
*
|
||||
* The contents of this file are subject to the terms of the
|
||||
* Common Development and Distribution License (the "License").
|
||||
* You may not use this file except in compliance with the License.
|
||||
*
|
||||
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
||||
* or http://www.opensolaris.org/os/licensing.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
*
|
||||
* When distributing Covered Code, include this CDDL HEADER in each
|
||||
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
||||
* If applicable, add the following below this CDDL HEADER, with the
|
||||
* fields enclosed by brackets "[]" replaced with your own identifying
|
||||
* information: Portions Copyright [yyyy] [name of copyright owner]
|
||||
*
|
||||
* CDDL HEADER END
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
|
||||
* Use is subject to license terms.
|
||||
*/
|
||||
|
||||
/*
|
||||
* ASSERTION:
|
||||
* stddev() should not accept a non-scalar value
|
||||
*
|
||||
* SECTION: Aggregations/Aggregations
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma D option quiet
|
||||
|
||||
BEGIN
|
||||
{
|
||||
@a[pid] = stddev(probefunc);
|
||||
}
|
||||
|
@ -0,0 +1,41 @@
|
||||
/*
|
||||
* CDDL HEADER START
|
||||
*
|
||||
* The contents of this file are subject to the terms of the
|
||||
* Common Development and Distribution License (the "License").
|
||||
* You may not use this file except in compliance with the License.
|
||||
*
|
||||
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
||||
* or http://www.opensolaris.org/os/licensing.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
*
|
||||
* When distributing Covered Code, include this CDDL HEADER in each
|
||||
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
||||
* If applicable, add the following below this CDDL HEADER, with the
|
||||
* fields enclosed by brackets "[]" replaced with your own identifying
|
||||
* information: Portions Copyright [yyyy] [name of copyright owner]
|
||||
*
|
||||
* CDDL HEADER END
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
|
||||
* Use is subject to license terms.
|
||||
*/
|
||||
|
||||
/*
|
||||
* ASSERTION:
|
||||
* stddev() should not accept a call with no arguments
|
||||
*
|
||||
* SECTION: Aggregations/Aggregations
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma D option quiet
|
||||
|
||||
BEGIN
|
||||
{
|
||||
@a[1] = stddev();
|
||||
}
|
||||
|
@ -0,0 +1,41 @@
|
||||
/*
|
||||
* CDDL HEADER START
|
||||
*
|
||||
* The contents of this file are subject to the terms of the
|
||||
* Common Development and Distribution License (the "License").
|
||||
* You may not use this file except in compliance with the License.
|
||||
*
|
||||
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
||||
* or http://www.opensolaris.org/os/licensing.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
*
|
||||
* When distributing Covered Code, include this CDDL HEADER in each
|
||||
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
||||
* If applicable, add the following below this CDDL HEADER, with the
|
||||
* fields enclosed by brackets "[]" replaced with your own identifying
|
||||
* information: Portions Copyright [yyyy] [name of copyright owner]
|
||||
*
|
||||
* CDDL HEADER END
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
|
||||
* Use is subject to license terms.
|
||||
*/
|
||||
|
||||
/*
|
||||
* ASSERTION:
|
||||
* stddev() should not have more than one argument
|
||||
*
|
||||
* SECTION: Aggregations/Aggregations
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma D option quiet
|
||||
|
||||
BEGIN
|
||||
{
|
||||
@a[1] = stddev(1, 2);
|
||||
}
|
||||
|
@ -0,0 +1,57 @@
|
||||
/*
|
||||
* CDDL HEADER START
|
||||
*
|
||||
* The contents of this file are subject to the terms of the
|
||||
* Common Development and Distribution License (the "License").
|
||||
* You may not use this file except in compliance with the License.
|
||||
*
|
||||
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
||||
* or http://www.opensolaris.org/os/licensing.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
*
|
||||
* When distributing Covered Code, include this CDDL HEADER in each
|
||||
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
||||
* If applicable, add the following below this CDDL HEADER, with the
|
||||
* fields enclosed by brackets "[]" replaced with your own identifying
|
||||
* information: Portions Copyright [yyyy] [name of copyright owner]
|
||||
*
|
||||
* CDDL HEADER END
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
|
||||
* Use is subject to license terms.
|
||||
*/
|
||||
|
||||
/*
|
||||
* ASSERTION:
|
||||
* Positive stddev() test
|
||||
*
|
||||
* SECTION: Aggregations/Aggregations
|
||||
*
|
||||
* NOTES:
|
||||
* Verifies that printing a clear()'d aggregation with an stddev()
|
||||
* aggregation function doesn't cause problems.
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma D option quiet
|
||||
|
||||
tick-10ms
|
||||
/i++ < 5/
|
||||
{
|
||||
@a = stddev(timestamp);
|
||||
}
|
||||
|
||||
tick-10ms
|
||||
/i == 5/
|
||||
{
|
||||
exit(2);
|
||||
}
|
||||
|
||||
END
|
||||
{
|
||||
clear(@a);
|
||||
exit(0);
|
||||
}
|
@ -0,0 +1,2 @@
|
||||
|
||||
0
|
@ -20,15 +20,13 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
|
||||
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
|
||||
* Use is subject to license terms.
|
||||
*/
|
||||
|
||||
#pragma ident "%Z%%M% %I% %E% SMI"
|
||||
|
||||
/*
|
||||
* ASSERTION:
|
||||
* Multiple aggregates can be used within the same D script.
|
||||
* Multiple aggregates can be used within the same D script.
|
||||
*
|
||||
* SECTION: Aggregations/Aggregations
|
||||
*
|
||||
@ -52,9 +50,11 @@ tick-10ms
|
||||
@c[pid] = avg(new_time);
|
||||
@d[pid] = sum(new_time);
|
||||
@e[pid] = quantize(new_time);
|
||||
@f[timestamp] = max(new_time);
|
||||
@g[timestamp] = quantize(new_time);
|
||||
@h[timestamp] = lquantize(new_time, 0, 10000, 1000);
|
||||
@f[pid] = stddev(new_time);
|
||||
@g[timestamp] = max(new_time);
|
||||
@h[timestamp] = quantize(new_time);
|
||||
@i[timestamp] = lquantize(new_time, 0, 10000, 1000);
|
||||
|
||||
time_1 = time_2;
|
||||
i++;
|
||||
}
|
||||
|
@ -20,18 +20,16 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
|
||||
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
|
||||
* Use is subject to license terms.
|
||||
*/
|
||||
|
||||
#pragma ident "%Z%%M% %I% %E% SMI"
|
||||
|
||||
/*
|
||||
* ASSERTION:
|
||||
* Test multiple aggregations and the default output order
|
||||
* Test multiple aggregations and the default output order
|
||||
*
|
||||
* SECTION: Aggregations/Aggregations;
|
||||
* Aggregations/Output
|
||||
* Aggregations/Output
|
||||
*
|
||||
*/
|
||||
|
||||
@ -51,6 +49,7 @@ tick-10ms
|
||||
@d = max(i);
|
||||
@e = quantize(i);
|
||||
@f = lquantize(i, 0, 1000, 100);
|
||||
@g = stddev(i);
|
||||
|
||||
i += 100;
|
||||
}
|
||||
|
@ -34,3 +34,4 @@
|
||||
900 |@@@@ 1
|
||||
>= 1000 | 0
|
||||
|
||||
287
|
||||
|
@ -20,19 +20,17 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
|
||||
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
|
||||
* Use is subject to license terms.
|
||||
*/
|
||||
|
||||
#pragma ident "%Z%%M% %I% %E% SMI"
|
||||
|
||||
/*
|
||||
* ASSERTION:
|
||||
* Test multiple aggregations and overriding default order with
|
||||
* printa() statements.
|
||||
* Test multiple aggregations and overriding default order with
|
||||
* printa() statements.
|
||||
*
|
||||
* SECTION: Aggregations/Aggregations;
|
||||
* Aggregations/Output
|
||||
* Aggregations/Output
|
||||
*
|
||||
* NOTES: This is a simple verifiable test.
|
||||
*
|
||||
@ -55,6 +53,7 @@ tick-10ms
|
||||
@e = max(i);
|
||||
@f = quantize(i);
|
||||
@g = lquantize(i, 0, 1000, 100);
|
||||
@h = stddev(i);
|
||||
|
||||
i += 100;
|
||||
}
|
||||
@ -62,6 +61,7 @@ tick-10ms
|
||||
tick-10ms
|
||||
/i == 1000/
|
||||
{
|
||||
printa("%@d\n", @h);
|
||||
printa("%@d\n", @g);
|
||||
printa("%@d\n", @f);
|
||||
printa("%@d\n", @e);
|
||||
|
@ -1,3 +1,4 @@
|
||||
287
|
||||
|
||||
value ------------- Distribution ------------- count
|
||||
< 0 | 0
|
||||
|
@ -20,20 +20,19 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
|
||||
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
|
||||
* Use is subject to license terms.
|
||||
*/
|
||||
|
||||
#pragma ident "%Z%%M% %I% %E% SMI"
|
||||
|
||||
|
||||
/*
|
||||
* ASSERTION:
|
||||
* Positive stddev() test
|
||||
* Positive stddev() test
|
||||
*
|
||||
* SECTION: Aggregations/Aggregations
|
||||
*
|
||||
* NOTES: This is a simple verifiable positive test of the stddev() function.
|
||||
* printa() for one aggregation, default printing behavior for the other
|
||||
* so that we exercise both code paths.
|
||||
*/
|
||||
|
||||
#pragma D option quiet
|
||||
@ -60,5 +59,6 @@ BEGIN
|
||||
@b = stddev(-5000000700);
|
||||
@b = stddev(-5000000800);
|
||||
@b = stddev(-5000000900);
|
||||
printa("%@d\n", @a);
|
||||
exit(0);
|
||||
}
|
||||
|
@ -1,3 +1,3 @@
|
||||
287
|
||||
|
||||
287
|
||||
287
|
||||
|
@ -0,0 +1,45 @@
|
||||
/*
|
||||
* CDDL HEADER START
|
||||
*
|
||||
* The contents of this file are subject to the terms of the
|
||||
* Common Development and Distribution License (the "License").
|
||||
* You may not use this file except in compliance with the License.
|
||||
*
|
||||
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
||||
* or http://www.opensolaris.org/os/licensing.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
*
|
||||
* When distributing Covered Code, include this CDDL HEADER in each
|
||||
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
||||
* If applicable, add the following below this CDDL HEADER, with the
|
||||
* fields enclosed by brackets "[]" replaced with your own identifying
|
||||
* information: Portions Copyright [yyyy] [name of copyright owner]
|
||||
*
|
||||
* CDDL HEADER END
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
|
||||
* Use is subject to license terms.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Test to check that attempting to enable a valid event with a frequency
|
||||
* lower than the default platform limit will fail.
|
||||
*
|
||||
* This test will fail if:
|
||||
* 1) The system under test does not define the 'PAPI_tot_ins' event.
|
||||
* 2) The 'dcpc-min-overflow' variable in dcpc.conf has been modified.
|
||||
*/
|
||||
|
||||
#pragma D option quiet
|
||||
|
||||
BEGIN
|
||||
{
|
||||
exit(0);
|
||||
}
|
||||
|
||||
cpc:::PAPI_tot_ins-all-100
|
||||
{
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
/*
|
||||
* CDDL HEADER START
|
||||
*
|
||||
* The contents of this file are subject to the terms of the
|
||||
* Common Development and Distribution License (the "License").
|
||||
* You may not use this file except in compliance with the License.
|
||||
*
|
||||
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
||||
* or http://www.opensolaris.org/os/licensing.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
*
|
||||
* When distributing Covered Code, include this CDDL HEADER in each
|
||||
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
||||
* If applicable, add the following below this CDDL HEADER, with the
|
||||
* fields enclosed by brackets "[]" replaced with your own identifying
|
||||
* information: Portions Copyright [yyyy] [name of copyright owner]
|
||||
*
|
||||
* CDDL HEADER END
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
|
||||
* Use is subject to license terms.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Tests that specifying an overflow value containing extraneous characters
|
||||
* (only digits are allowed) will fail.
|
||||
*/
|
||||
|
||||
BEGIN
|
||||
{
|
||||
exit(0);
|
||||
}
|
||||
|
||||
cpc:::PAPI_tot_ins-all-10000bonehead
|
||||
{
|
||||
@[probename] = count();
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
/*
|
||||
* CDDL HEADER START
|
||||
*
|
||||
* The contents of this file are subject to the terms of the
|
||||
* Common Development and Distribution License (the "License").
|
||||
* You may not use this file except in compliance with the License.
|
||||
*
|
||||
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
||||
* or http://www.opensolaris.org/os/licensing.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
*
|
||||
* When distributing Covered Code, include this CDDL HEADER in each
|
||||
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
||||
* If applicable, add the following below this CDDL HEADER, with the
|
||||
* fields enclosed by brackets "[]" replaced with your own identifying
|
||||
* information: Portions Copyright [yyyy] [name of copyright owner]
|
||||
*
|
||||
* CDDL HEADER END
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
|
||||
* Use is subject to license terms.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Tests that attempting to enable a probe containing a non existent event
|
||||
* will fail.
|
||||
*/
|
||||
|
||||
BEGIN
|
||||
{
|
||||
exit(0);
|
||||
}
|
||||
|
||||
cpc:::PAPI_cpc_bad-all-10000
|
||||
{
|
||||
@[probename] = count();
|
||||
}
|
@ -0,0 +1,78 @@
|
||||
#!/bin/ksh
|
||||
#
|
||||
# CDDL HEADER START
|
||||
#
|
||||
# The contents of this file are subject to the terms of the
|
||||
# Common Development and Distribution License (the "License").
|
||||
# You may not use this file except in compliance with the License.
|
||||
#
|
||||
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
||||
# or http://www.opensolaris.org/os/licensing.
|
||||
# See the License for the specific language governing permissions
|
||||
# and limitations under the License.
|
||||
#
|
||||
# When distributing Covered Code, include this CDDL HEADER in each
|
||||
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
||||
# If applicable, add the following below this CDDL HEADER, with the
|
||||
# fields enclosed by brackets "[]" replaced with your own identifying
|
||||
# information: Portions Copyright [yyyy] [name of copyright owner]
|
||||
#
|
||||
# CDDL HEADER END
|
||||
#
|
||||
|
||||
#
|
||||
# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
|
||||
# Use is subject to license terms.
|
||||
#
|
||||
|
||||
|
||||
#
|
||||
# This tests that cpustat(1) should fail to start if the cpc provider
|
||||
# is already calling the shots.
|
||||
#
|
||||
# This script will fail if:
|
||||
# 1) The system under test does not define the 'PAPI_tot_ins'
|
||||
# generic event.
|
||||
|
||||
script()
|
||||
{
|
||||
$dtrace -o $dtraceout -s /dev/stdin <<EOF
|
||||
#pragma D option bufsize=128k
|
||||
|
||||
cpc:::PAPI_tot_ins-all-10000
|
||||
{
|
||||
@[probename] = count();
|
||||
}
|
||||
EOF
|
||||
}
|
||||
|
||||
if [ $# != 1 ]; then
|
||||
echo expected one argument: '<'dtrace-path'>'
|
||||
exit 2
|
||||
fi
|
||||
|
||||
dtrace=$1
|
||||
dtraceout=/tmp/dtrace.out.$$
|
||||
script 2>/dev/null &
|
||||
timeout=15
|
||||
|
||||
#
|
||||
# Sleep while the above script fires into life. To guard against dtrace dying
|
||||
# and us sleeping forever we allow 15 secs for this to happen. This should be
|
||||
# enough for even the slowest systems.
|
||||
#
|
||||
while [ ! -f $dtraceout ]; do
|
||||
sleep 1
|
||||
timeout=$(($timeout-1))
|
||||
if [ $timeout -eq 0 ]; then
|
||||
echo "dtrace failed to start. Exiting."
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
cpustat -c PAPI_tot_ins 1 5
|
||||
status=$?
|
||||
|
||||
rm $dtraceout
|
||||
|
||||
exit $status
|
@ -0,0 +1,70 @@
|
||||
#!/bin/ksh -p
|
||||
#
|
||||
# CDDL HEADER START
|
||||
#
|
||||
# The contents of this file are subject to the terms of the
|
||||
# Common Development and Distribution License (the "License").
|
||||
# You may not use this file except in compliance with the License.
|
||||
#
|
||||
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
||||
# or http://www.opensolaris.org/os/licensing.
|
||||
# See the License for the specific language governing permissions
|
||||
# and limitations under the License.
|
||||
#
|
||||
# When distributing Covered Code, include this CDDL HEADER in each
|
||||
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
||||
# If applicable, add the following below this CDDL HEADER, with the
|
||||
# fields enclosed by brackets "[]" replaced with your own identifying
|
||||
# information: Portions Copyright [yyyy] [name of copyright owner]
|
||||
#
|
||||
# CDDL HEADER END
|
||||
#
|
||||
|
||||
#
|
||||
# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
|
||||
# Use is subject to license terms.
|
||||
#
|
||||
|
||||
|
||||
#
|
||||
# This tests that enablings from the cpc provider will fail if cpustat(1) is
|
||||
# already master of the universe.
|
||||
#
|
||||
# This script will fail if:
|
||||
# 1) The system under test does not define the 'PAPI_tot_ins'
|
||||
# generic event.
|
||||
|
||||
script()
|
||||
{
|
||||
$dtrace -s /dev/stdin <<EOF
|
||||
#pragma D option bufsize=128k
|
||||
|
||||
BEGIN
|
||||
{
|
||||
exit(0);
|
||||
}
|
||||
|
||||
cpc:::PAPI_tot_ins-all-10000
|
||||
{
|
||||
@[probename] = count();
|
||||
}
|
||||
EOF
|
||||
}
|
||||
|
||||
if [ $# != 1 ]; then
|
||||
echo expected one argument: '<'dtrace-path'>'
|
||||
exit 2
|
||||
fi
|
||||
|
||||
dtrace=$1
|
||||
dtraceout=/tmp/dtrace.out.$$
|
||||
|
||||
cpustat -c PAPI_tot_ins 1 20 &
|
||||
pid=$!
|
||||
sleep 5
|
||||
script 2>/dev/null
|
||||
|
||||
status=$?
|
||||
|
||||
kill $pid
|
||||
exit $status
|
@ -0,0 +1,77 @@
|
||||
#!/bin/ksh
|
||||
#
|
||||
# CDDL HEADER START
|
||||
#
|
||||
# The contents of this file are subject to the terms of the
|
||||
# Common Development and Distribution License (the "License").
|
||||
# You may not use this file except in compliance with the License.
|
||||
#
|
||||
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
||||
# or http://www.opensolaris.org/os/licensing.
|
||||
# See the License for the specific language governing permissions
|
||||
# and limitations under the License.
|
||||
#
|
||||
# When distributing Covered Code, include this CDDL HEADER in each
|
||||
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
||||
# If applicable, add the following below this CDDL HEADER, with the
|
||||
# fields enclosed by brackets "[]" replaced with your own identifying
|
||||
# information: Portions Copyright [yyyy] [name of copyright owner]
|
||||
#
|
||||
# CDDL HEADER END
|
||||
#
|
||||
|
||||
#
|
||||
# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
|
||||
# Use is subject to license terms.
|
||||
|
||||
#
|
||||
# This script ensures that cputrack(1M) will fail to start when the cpc
|
||||
# provider has active enablings.
|
||||
#
|
||||
# The script will fail if:
|
||||
# 1) The system under test does not define the 'PAPI_tot_ins' event.
|
||||
#
|
||||
|
||||
script()
|
||||
{
|
||||
$dtrace -o $dtraceout -s /dev/stdin <<EOF
|
||||
#pragma D option bufsize=128k
|
||||
|
||||
cpc:::PAPI_tot_ins-all-10000
|
||||
{
|
||||
@[probename] = count();
|
||||
}
|
||||
EOF
|
||||
}
|
||||
|
||||
|
||||
if [ $# != 1 ]; then
|
||||
echo expected one argument: '<'dtrace-path'>'
|
||||
exit 2
|
||||
fi
|
||||
|
||||
dtrace=$1
|
||||
dtraceout=/tmp/dtrace.out.$$
|
||||
script 2>/dev/null &
|
||||
timeout=15
|
||||
|
||||
#
|
||||
# Sleep while the above script fires into life. To guard against dtrace dying
|
||||
# and us sleeping forever we allow 15 secs for this to happen. This should be
|
||||
# enough for even the slowest systems.
|
||||
#
|
||||
while [ ! -f $dtraceout ]; do
|
||||
sleep 1
|
||||
timeout=$(($timeout-1))
|
||||
if [ $timeout -eq 0 ]; then
|
||||
echo "dtrace failed to start. Exiting."
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
cputrack -c PAPI_tot_ins sleep 10
|
||||
status=$?
|
||||
|
||||
rm $dtraceout
|
||||
|
||||
exit $status
|
@ -0,0 +1,70 @@
|
||||
#!/bin/ksh
|
||||
#
|
||||
# CDDL HEADER START
|
||||
#
|
||||
# The contents of this file are subject to the terms of the
|
||||
# Common Development and Distribution License (the "License").
|
||||
# You may not use this file except in compliance with the License.
|
||||
#
|
||||
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
||||
# or http://www.opensolaris.org/os/licensing.
|
||||
# See the License for the specific language governing permissions
|
||||
# and limitations under the License.
|
||||
#
|
||||
# When distributing Covered Code, include this CDDL HEADER in each
|
||||
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
||||
# If applicable, add the following below this CDDL HEADER, with the
|
||||
# fields enclosed by brackets "[]" replaced with your own identifying
|
||||
# information: Portions Copyright [yyyy] [name of copyright owner]
|
||||
#
|
||||
# CDDL HEADER END
|
||||
#
|
||||
|
||||
#
|
||||
# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
|
||||
# Use is subject to license terms.
|
||||
|
||||
#
|
||||
# This script ensures that cputrack(1) will terminate when the cpc provider
|
||||
# kicks into life.
|
||||
#
|
||||
# The script will fail if:
|
||||
# 1) The system under test does not define the 'PAPI_tot_ins' event.
|
||||
#
|
||||
|
||||
script()
|
||||
{
|
||||
$dtrace -s /dev/stdin <<EOF
|
||||
#pragma D option bufsize=128k
|
||||
|
||||
cpc:::PAPI_tot_ins-all-10000
|
||||
{
|
||||
@[probename] = count();
|
||||
}
|
||||
|
||||
tick-1s
|
||||
/n++ > 10/
|
||||
{
|
||||
exit(0);
|
||||
}
|
||||
EOF
|
||||
}
|
||||
|
||||
if [ $# != 1 ]; then
|
||||
echo expected one argument: '<'dtrace-path'>'
|
||||
exit 2
|
||||
fi
|
||||
|
||||
dtrace=$1
|
||||
|
||||
cputrack -c PAPI_tot_ins sleep 20 &
|
||||
cputrack_pid=$!
|
||||
sleep 5
|
||||
script 2>/dev/null &
|
||||
|
||||
wait $cputrack_pid
|
||||
status=$?
|
||||
|
||||
rm $dtraceout
|
||||
|
||||
exit $status
|
@ -0,0 +1,55 @@
|
||||
/*
|
||||
* CDDL HEADER START
|
||||
*
|
||||
* The contents of this file are subject to the terms of the
|
||||
* Common Development and Distribution License (the "License").
|
||||
* You may not use this file except in compliance with the License.
|
||||
*
|
||||
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
||||
* or http://www.opensolaris.org/os/licensing.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
*
|
||||
* When distributing Covered Code, include this CDDL HEADER in each
|
||||
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
||||
* If applicable, add the following below this CDDL HEADER, with the
|
||||
* fields enclosed by brackets "[]" replaced with your own identifying
|
||||
* information: Portions Copyright [yyyy] [name of copyright owner]
|
||||
*
|
||||
* CDDL HEADER END
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
|
||||
* Use is subject to license terms.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Test to check that attempting to enable too many probes will fail.
|
||||
*
|
||||
* This test will fail if:
|
||||
* 1) We ever execute on a platform which is capable of programming 10
|
||||
* 'PAPI_tot_ins' events simultaneously (which no current platforms are
|
||||
* capable of doing).
|
||||
* 2) The system under test does not define the 'PAPI_tot_ins' event.
|
||||
*/
|
||||
|
||||
#pragma D option quiet
|
||||
|
||||
BEGIN
|
||||
{
|
||||
exit(0);
|
||||
}
|
||||
|
||||
cpc:::PAPI_tot_ins-all-10000,
|
||||
cpc:::PAPI_tot_ins-all-10001,
|
||||
cpc:::PAPI_tot_ins-all-10002,
|
||||
cpc:::PAPI_tot_ins-all-10003,
|
||||
cpc:::PAPI_tot_ins-all-10004,
|
||||
cpc:::PAPI_tot_ins-all-10005,
|
||||
cpc:::PAPI_tot_ins-all-10006,
|
||||
cpc:::PAPI_tot_ins-all-10007,
|
||||
cpc:::PAPI_tot_ins-all-10008,
|
||||
cpc:::PAPI_tot_ins-all-10009
|
||||
{
|
||||
}
|
@ -0,0 +1,107 @@
|
||||
#!/bin/ksh
|
||||
#
|
||||
# CDDL HEADER START
|
||||
#
|
||||
# The contents of this file are subject to the terms of the
|
||||
# Common Development and Distribution License (the "License").
|
||||
# You may not use this file except in compliance with the License.
|
||||
#
|
||||
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
||||
# or http://www.opensolaris.org/os/licensing.
|
||||
# See the License for the specific language governing permissions
|
||||
# and limitations under the License.
|
||||
#
|
||||
# When distributing Covered Code, include this CDDL HEADER in each
|
||||
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
||||
# If applicable, add the following below this CDDL HEADER, with the
|
||||
# fields enclosed by brackets "[]" replaced with your own identifying
|
||||
# information: Portions Copyright [yyyy] [name of copyright owner]
|
||||
#
|
||||
# CDDL HEADER END
|
||||
#
|
||||
|
||||
#
|
||||
# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
|
||||
# Use is subject to license terms.
|
||||
#
|
||||
|
||||
#
|
||||
# This script verifies that we can fire a probe on each CPU that is in
|
||||
# an online state.
|
||||
#
|
||||
# The script will fail if:
|
||||
# 1) The system under test does not define the 'PAPI_tot_ins' event.
|
||||
#
|
||||
|
||||
if [ $# != 1 ]; then
|
||||
echo expected one argument: '<'dtrace-path'>'
|
||||
exit 2
|
||||
fi
|
||||
|
||||
dtrace=$1
|
||||
numproc=`psrinfo | tail -1 | cut -f1`
|
||||
cpu=0
|
||||
dtraceout=/var/tmp/dtrace.out.$$
|
||||
scriptout=/var/tmp/script.out.$$
|
||||
|
||||
spin()
|
||||
{
|
||||
while [ 1 ]; do
|
||||
:
|
||||
done
|
||||
}
|
||||
|
||||
script()
|
||||
{
|
||||
$dtrace -o $dtraceout -s /dev/stdin <<EOF
|
||||
#pragma D option bufsize=128k
|
||||
#pragma D option quiet
|
||||
|
||||
cpc:::PAPI_tot_ins-user-10000
|
||||
/cpus[cpu] != 1/
|
||||
{
|
||||
cpus[cpu] = 1;
|
||||
@a[cpu] = count();
|
||||
}
|
||||
|
||||
tick-1s
|
||||
/n++ > 10/
|
||||
{
|
||||
printa(@a);
|
||||
exit(0);
|
||||
}
|
||||
EOF
|
||||
}
|
||||
|
||||
echo "" > $scriptout
|
||||
while [ $cpu -le $numproc ]
|
||||
do
|
||||
if [ "`psrinfo -s $cpu 2> /dev/null`" -eq 1 ]; then
|
||||
printf "%9d %16d\n" $cpu 1 >> $scriptout
|
||||
spin &
|
||||
allpids[$cpu]=$!
|
||||
pbind -b $cpu $!
|
||||
fi
|
||||
cpu=$(($cpu+1))
|
||||
done
|
||||
echo "" >> $scriptout
|
||||
|
||||
script
|
||||
|
||||
diff $dtraceout $scriptout >/dev/null 2>&1
|
||||
status=$?
|
||||
|
||||
# kill off the spinner processes
|
||||
cpu=0
|
||||
while [ $cpu -le $numproc ]
|
||||
do
|
||||
if [ "`psrinfo -s $cpu 2> /dev/null`" -eq 1 ]; then
|
||||
kill ${allpids[$cpu]}
|
||||
fi
|
||||
cpu=$(($cpu+1))
|
||||
done
|
||||
|
||||
rm $dtraceout
|
||||
rm $scriptout
|
||||
|
||||
exit $status
|
@ -0,0 +1,48 @@
|
||||
/*
|
||||
* CDDL HEADER START
|
||||
*
|
||||
* The contents of this file are subject to the terms of the
|
||||
* Common Development and Distribution License (the "License").
|
||||
* You may not use this file except in compliance with the License.
|
||||
*
|
||||
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
||||
* or http://www.opensolaris.org/os/licensing.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
*
|
||||
* When distributing Covered Code, include this CDDL HEADER in each
|
||||
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
||||
* If applicable, add the following below this CDDL HEADER, with the
|
||||
* fields enclosed by brackets "[]" replaced with your own identifying
|
||||
* information: Portions Copyright [yyyy] [name of copyright owner]
|
||||
*
|
||||
* CDDL HEADER END
|
||||
*/
|
||||
/*
|
||||
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
|
||||
* Use is subject to license terms.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Test that we can successfully enable a probe using a generic event.
|
||||
* Currently, all platforms implement 'PAPI_tot_ins' so we'll use that.
|
||||
* Note that this test will fail if the system under test does not
|
||||
* implement that event.
|
||||
*
|
||||
* This test will fail if:
|
||||
* 1) The system under test does not define the 'PAPI_tot_ins' event.
|
||||
*/
|
||||
|
||||
#pragma D option quiet
|
||||
#pragma D option bufsize=128k
|
||||
|
||||
cpc:::PAPI_tot_ins-all-10000
|
||||
{
|
||||
@[probename] = count();
|
||||
}
|
||||
|
||||
tick-1s
|
||||
/n++ > 10/
|
||||
{
|
||||
exit(0);
|
||||
}
|
@ -0,0 +1,81 @@
|
||||
#!/bin/ksh
|
||||
#
|
||||
# CDDL HEADER START
|
||||
#
|
||||
# The contents of this file are subject to the terms of the
|
||||
# Common Development and Distribution License (the "License").
|
||||
# You may not use this file except in compliance with the License.
|
||||
#
|
||||
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
||||
# or http://www.opensolaris.org/os/licensing.
|
||||
# See the License for the specific language governing permissions
|
||||
# and limitations under the License.
|
||||
#
|
||||
# When distributing Covered Code, include this CDDL HEADER in each
|
||||
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
||||
# If applicable, add the following below this CDDL HEADER, with the
|
||||
# fields enclosed by brackets "[]" replaced with your own identifying
|
||||
# information: Portions Copyright [yyyy] [name of copyright owner]
|
||||
#
|
||||
# CDDL HEADER END
|
||||
#
|
||||
|
||||
#
|
||||
# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
|
||||
# Use is subject to license terms.
|
||||
#
|
||||
|
||||
#
|
||||
# This script ensures that we can enable a probe which specifies a platform
|
||||
# specific event.
|
||||
#
|
||||
|
||||
if [ $# != 1 ]; then
|
||||
print -u2 "expected one argument: <dtrace-path>"
|
||||
exit 2
|
||||
fi
|
||||
|
||||
dtrace=$1
|
||||
|
||||
get_event()
|
||||
{
|
||||
perl /dev/stdin /dev/stdout << EOF
|
||||
open CPUSTAT, '/usr/sbin/cpustat -h |'
|
||||
or die "Couldn't run cpustat: \$!\n";
|
||||
while (<CPUSTAT>) {
|
||||
if (/(\s+)event\[*[0-9]-*[0-9]*\]*:/ && !/PAPI/) {
|
||||
@a = split(/ /, \$_);
|
||||
\$event = \$a[\$#a-1];
|
||||
}
|
||||
}
|
||||
|
||||
close CPUSTAT;
|
||||
print "\$event\n";
|
||||
EOF
|
||||
}
|
||||
|
||||
script()
|
||||
{
|
||||
$dtrace -s /dev/stdin << EOD
|
||||
#pragma D option quiet
|
||||
#pragma D option bufsize=128k
|
||||
|
||||
cpc:::$1-all-10000
|
||||
{
|
||||
@[probename] = count();
|
||||
}
|
||||
|
||||
tick-1s
|
||||
/n++ > 5/
|
||||
{
|
||||
exit(0);
|
||||
}
|
||||
EOD
|
||||
}
|
||||
|
||||
event=$(get_event)
|
||||
script $event
|
||||
|
||||
status=$?
|
||||
|
||||
exit $status
|
104
cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/get.ipv4remote.pl
Executable file
104
cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/get.ipv4remote.pl
Executable file
@ -0,0 +1,104 @@
|
||||
#!/usr/bin/perl -w
|
||||
#
|
||||
# CDDL HEADER START
|
||||
#
|
||||
# The contents of this file are subject to the terms of the
|
||||
# Common Development and Distribution License (the "License").
|
||||
# You may not use this file except in compliance with the License.
|
||||
#
|
||||
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
||||
# or http://www.opensolaris.org/os/licensing.
|
||||
# See the License for the specific language governing permissions
|
||||
# and limitations under the License.
|
||||
#
|
||||
# When distributing Covered Code, include this CDDL HEADER in each
|
||||
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
||||
# If applicable, add the following below this CDDL HEADER, with the
|
||||
# fields enclosed by brackets "[]" replaced with your own identifying
|
||||
# information: Portions Copyright [yyyy] [name of copyright owner]
|
||||
#
|
||||
# CDDL HEADER END
|
||||
#
|
||||
|
||||
#
|
||||
# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
|
||||
# Use is subject to license terms.
|
||||
#
|
||||
#pragma ident "%Z%%M% %I% %E% SMI"
|
||||
|
||||
#
|
||||
# get.ipv4remote.pl [tcpport]
|
||||
#
|
||||
# Find an IPv4 reachable remote host using both ifconfig(1M) and ping(1M).
|
||||
# If a tcpport is specified, return a host that is also listening on this
|
||||
# TCP port. Print the local address and the remote address, or an
|
||||
# error message if no suitable remote host was found. Exit status is 0 if
|
||||
# a host was found.
|
||||
#
|
||||
|
||||
use strict;
|
||||
use IO::Socket;
|
||||
|
||||
my $MAXHOSTS = 32; # max hosts to port scan
|
||||
my $TIMEOUT = 3; # connection timeout
|
||||
my $tcpport = @ARGV == 1 ? $ARGV[0] : 0;
|
||||
|
||||
#
|
||||
# Determine local IP address
|
||||
#
|
||||
my $local = "";
|
||||
my $remote = "";
|
||||
my %Broadcast;
|
||||
my $up;
|
||||
open IFCONFIG, '/usr/sbin/ifconfig -a |' or die "Couldn't run ifconfig: $!\n";
|
||||
while (<IFCONFIG>) {
|
||||
next if /^lo/;
|
||||
|
||||
# "UP" is always printed first (see print_flags() in ifconfig.c):
|
||||
$up = 1 if /^[a-z].*<UP,/;
|
||||
$up = 0 if /^[a-z].*<,/;
|
||||
|
||||
# assume output is "inet X ... broadcast Z":
|
||||
if (/inet (\S+) .* broadcast (\S+)/) {
|
||||
my ($addr, $bcast) = ($1, $2);
|
||||
$Broadcast{$addr} = $bcast;
|
||||
$local = $addr if $up and $local eq "";
|
||||
$up = 0;
|
||||
}
|
||||
}
|
||||
close IFCONFIG;
|
||||
die "Could not determine local IP address" if $local eq "";
|
||||
|
||||
#
|
||||
# Find the first remote host that responds to an icmp echo,
|
||||
# which isn't a local address.
|
||||
#
|
||||
open PING, "/usr/sbin/ping -ns $Broadcast{$local} 56 $MAXHOSTS |" or
|
||||
die "Couldn't run ping: $!\n";
|
||||
while (<PING>) {
|
||||
if (/bytes from (.*): / and not defined $Broadcast{$1}) {
|
||||
my $addr = $1;
|
||||
|
||||
if ($tcpport != 0) {
|
||||
#
|
||||
# Test TCP
|
||||
#
|
||||
my $socket = IO::Socket::INET->new(
|
||||
Proto => "tcp",
|
||||
PeerAddr => $addr,
|
||||
PeerPort => $tcpport,
|
||||
Timeout => $TIMEOUT,
|
||||
);
|
||||
next unless $socket;
|
||||
close $socket;
|
||||
}
|
||||
|
||||
$remote = $addr;
|
||||
last;
|
||||
}
|
||||
}
|
||||
close PING;
|
||||
die "Can't find a remote host for testing: No suitable response from " .
|
||||
"$Broadcast{$local}\n" if $remote eq "";
|
||||
|
||||
print "$local $remote\n";
|
88
cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/get.ipv6remote.pl
Executable file
88
cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/get.ipv6remote.pl
Executable file
@ -0,0 +1,88 @@
|
||||
#!/usr/bin/perl -w
|
||||
#
|
||||
# CDDL HEADER START
|
||||
#
|
||||
# The contents of this file are subject to the terms of the
|
||||
# Common Development and Distribution License (the "License").
|
||||
# You may not use this file except in compliance with the License.
|
||||
#
|
||||
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
||||
# or http://www.opensolaris.org/os/licensing.
|
||||
# See the License for the specific language governing permissions
|
||||
# and limitations under the License.
|
||||
#
|
||||
# When distributing Covered Code, include this CDDL HEADER in each
|
||||
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
||||
# If applicable, add the following below this CDDL HEADER, with the
|
||||
# fields enclosed by brackets "[]" replaced with your own identifying
|
||||
# information: Portions Copyright [yyyy] [name of copyright owner]
|
||||
#
|
||||
# CDDL HEADER END
|
||||
#
|
||||
|
||||
#
|
||||
# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
|
||||
# Use is subject to license terms.
|
||||
#
|
||||
#pragma ident "%Z%%M% %I% %E% SMI"
|
||||
|
||||
#
|
||||
# get.ipv6remote.pl
|
||||
#
|
||||
# Find an IPv6 reachable remote host using both ifconfig(1M) and ping(1M).
|
||||
# Print the local address and the remote address, or print nothing if either
|
||||
# no IPv6 interfaces or remote hosts were found. (Remote IPv6 testing is
|
||||
# considered optional, and so not finding another IPv6 host is not an error
|
||||
# state we need to log.) Exit status is 0 if a host was found.
|
||||
#
|
||||
|
||||
use strict;
|
||||
use IO::Socket;
|
||||
|
||||
my $MAXHOSTS = 32; # max hosts to scan
|
||||
my $TIMEOUT = 3; # connection timeout
|
||||
my $MULTICAST = "FF02::1"; # IPv6 multicast address
|
||||
|
||||
#
|
||||
# Determine local IP address
|
||||
#
|
||||
my $local = "";
|
||||
my $remote = "";
|
||||
my %Local;
|
||||
my $up;
|
||||
open IFCONFIG, '/usr/sbin/ifconfig -a inet6 |'
|
||||
or die "Couldn't run ifconfig: $!\n";
|
||||
while (<IFCONFIG>) {
|
||||
next if /^lo/;
|
||||
|
||||
# "UP" is always printed first (see print_flags() in ifconfig.c):
|
||||
$up = 1 if /^[a-z].*<UP,/;
|
||||
$up = 0 if /^[a-z].*<,/;
|
||||
|
||||
# assume output is "inet6 ...":
|
||||
if (m:inet6 (\S+)/:) {
|
||||
my $addr = $1;
|
||||
$Local{$addr} = 1;
|
||||
$local = $addr if $up and $local eq "";
|
||||
$up = 0;
|
||||
}
|
||||
}
|
||||
close IFCONFIG;
|
||||
exit 1 if $local eq "";
|
||||
|
||||
#
|
||||
# Find the first remote host that responds to an icmp echo,
|
||||
# which isn't a local address.
|
||||
#
|
||||
open PING, "/usr/sbin/ping -ns -A inet6 $MULTICAST 56 $MAXHOSTS |" or
|
||||
die "Couldn't run ping: $!\n";
|
||||
while (<PING>) {
|
||||
if (/bytes from (.*): / and not defined $Local{$1}) {
|
||||
$remote = $1;
|
||||
last;
|
||||
}
|
||||
}
|
||||
close PING;
|
||||
exit 2 if $remote eq "";
|
||||
|
||||
print "$local $remote\n";
|
70
cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.ipv4localicmp.ksh
Executable file
70
cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.ipv4localicmp.ksh
Executable file
@ -0,0 +1,70 @@
|
||||
#!/usr/bin/ksh
|
||||
#
|
||||
# CDDL HEADER START
|
||||
#
|
||||
# The contents of this file are subject to the terms of the
|
||||
# Common Development and Distribution License (the "License").
|
||||
# You may not use this file except in compliance with the License.
|
||||
#
|
||||
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
||||
# or http://www.opensolaris.org/os/licensing.
|
||||
# See the License for the specific language governing permissions
|
||||
# and limitations under the License.
|
||||
#
|
||||
# When distributing Covered Code, include this CDDL HEADER in each
|
||||
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
||||
# If applicable, add the following below this CDDL HEADER, with the
|
||||
# fields enclosed by brackets "[]" replaced with your own identifying
|
||||
# information: Portions Copyright [yyyy] [name of copyright owner]
|
||||
#
|
||||
# CDDL HEADER END
|
||||
#
|
||||
|
||||
#
|
||||
# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
|
||||
# Use is subject to license terms.
|
||||
#
|
||||
#pragma ident "%Z%%M% %I% %E% SMI"
|
||||
|
||||
#
|
||||
# Test ip:::{send,receive} of IPv4 ICMP to a local address.
|
||||
#
|
||||
# This may fail due to:
|
||||
#
|
||||
# 1. A change to the ip stack breaking expected probe behavior,
|
||||
# which is the reason we are testing.
|
||||
# 2. The lo0 interface missing or not up.
|
||||
# 3. Unrelated ICMP on lo0 traced by accident.
|
||||
#
|
||||
|
||||
if (( $# != 1 )); then
|
||||
print -u2 "expected one argument: <dtrace-path>"
|
||||
exit 2
|
||||
fi
|
||||
|
||||
dtrace=$1
|
||||
local=127.0.0.1
|
||||
|
||||
$dtrace -c "/usr/sbin/ping $local 3" -qs /dev/stdin <<EOF | sort -n
|
||||
ip:::send
|
||||
/args[2]->ip_saddr == "$local" && args[2]->ip_daddr == "$local" &&
|
||||
args[4]->ipv4_protocol == IPPROTO_ICMP/
|
||||
{
|
||||
printf("1 ip:::send (");
|
||||
printf("args[2]: %d %d, ", args[2]->ip_ver, args[2]->ip_plength);
|
||||
printf("args[4]: %d %d %d %d %d)\n",
|
||||
args[4]->ipv4_ver, args[4]->ipv4_length, args[4]->ipv4_flags,
|
||||
args[4]->ipv4_offset, args[4]->ipv4_ttl);
|
||||
}
|
||||
|
||||
ip:::receive
|
||||
/args[2]->ip_saddr == "$local" && args[2]->ip_daddr == "$local" &&
|
||||
args[4]->ipv4_protocol == IPPROTO_ICMP/
|
||||
{
|
||||
printf("2 ip:::receive (");
|
||||
printf("args[2]: %d %d, ", args[2]->ip_ver, args[2]->ip_plength);
|
||||
printf("args[4]: %d %d %d %d %d)\n",
|
||||
args[4]->ipv4_ver, args[4]->ipv4_length, args[4]->ipv4_flags,
|
||||
args[4]->ipv4_offset, args[4]->ipv4_ttl);
|
||||
}
|
||||
EOF
|
@ -0,0 +1,6 @@
|
||||
|
||||
1 ip:::send (args[2]: 4 64, args[4]: 4 84 0 0 255)
|
||||
1 ip:::send (args[2]: 4 64, args[4]: 4 84 0 0 255)
|
||||
2 ip:::receive (args[2]: 4 64, args[4]: 4 84 0 0 255)
|
||||
2 ip:::receive (args[2]: 4 64, args[4]: 4 84 0 0 255)
|
||||
127.0.0.1 is alive
|
125
cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.ipv4localtcp.ksh
Executable file
125
cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.ipv4localtcp.ksh
Executable file
@ -0,0 +1,125 @@
|
||||
#!/usr/bin/ksh
|
||||
#
|
||||
# CDDL HEADER START
|
||||
#
|
||||
# The contents of this file are subject to the terms of the
|
||||
# Common Development and Distribution License (the "License").
|
||||
# You may not use this file except in compliance with the License.
|
||||
#
|
||||
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
||||
# or http://www.opensolaris.org/os/licensing.
|
||||
# See the License for the specific language governing permissions
|
||||
# and limitations under the License.
|
||||
#
|
||||
# When distributing Covered Code, include this CDDL HEADER in each
|
||||
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
||||
# If applicable, add the following below this CDDL HEADER, with the
|
||||
# fields enclosed by brackets "[]" replaced with your own identifying
|
||||
# information: Portions Copyright [yyyy] [name of copyright owner]
|
||||
#
|
||||
# CDDL HEADER END
|
||||
#
|
||||
|
||||
#
|
||||
# Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
#
|
||||
|
||||
#
|
||||
# Test {ip,tcp}:::{send,receive} of IPv4 TCP to local host.
|
||||
#
|
||||
# This may fail due to:
|
||||
#
|
||||
# 1. A change to the ip stack breaking expected probe behavior,
|
||||
# which is the reason we are testing.
|
||||
# 2. The lo0 interface missing or not up.
|
||||
# 3. The local ssh service is not online.
|
||||
# 4. An unlikely race causes the unlocked global send/receive
|
||||
# variables to be corrupted.
|
||||
#
|
||||
# This test performs a TCP connection and checks that at least the
|
||||
# following packet counts were traced:
|
||||
#
|
||||
# 3 x ip:::send (2 during the TCP handshake, then a FIN)
|
||||
# 3 x tcp:::send (2 during the TCP handshake, then a FIN)
|
||||
# 2 x ip:::receive (1 during the TCP handshake, then the FIN ACK)
|
||||
# 2 x tcp:::receive (1 during the TCP handshake, then the FIN ACK)
|
||||
|
||||
# The actual count tested is 5 each way, since we are tracing both
|
||||
# source and destination events.
|
||||
#
|
||||
# For this test to work, we are assuming that the TCP handshake and
|
||||
# TCP close will enter the IP code path and not use tcp fusion.
|
||||
#
|
||||
|
||||
if (( $# != 1 )); then
|
||||
print -u2 "expected one argument: <dtrace-path>"
|
||||
exit 2
|
||||
fi
|
||||
|
||||
dtrace=$1
|
||||
local=127.0.0.1
|
||||
tcpport=22
|
||||
DIR=/var/tmp/dtest.$$
|
||||
|
||||
mkdir $DIR
|
||||
cd $DIR
|
||||
|
||||
cat > test.pl <<-EOPERL
|
||||
use IO::Socket;
|
||||
my \$s = IO::Socket::INET->new(
|
||||
Proto => "tcp",
|
||||
PeerAddr => "$local",
|
||||
PeerPort => $tcpport,
|
||||
Timeout => 3);
|
||||
die "Could not connect to host $local port $tcpport" unless \$s;
|
||||
close \$s;
|
||||
EOPERL
|
||||
|
||||
$dtrace -c '/usr/bin/perl test.pl' -qs /dev/stdin <<EODTRACE
|
||||
BEGIN
|
||||
{
|
||||
ipsend = tcpsend = ipreceive = tcpreceive = 0;
|
||||
}
|
||||
|
||||
ip:::send
|
||||
/args[2]->ip_saddr == "$local" && args[2]->ip_daddr == "$local" &&
|
||||
args[4]->ipv4_protocol == IPPROTO_TCP/
|
||||
{
|
||||
ipsend++;
|
||||
}
|
||||
|
||||
tcp:::send
|
||||
/args[2]->ip_saddr == "$local" && args[2]->ip_daddr == "$local"/
|
||||
{
|
||||
tcpsend++;
|
||||
}
|
||||
|
||||
ip:::receive
|
||||
/args[2]->ip_saddr == "$local" && args[2]->ip_daddr == "$local" &&
|
||||
args[4]->ipv4_protocol == IPPROTO_TCP/
|
||||
{
|
||||
ipreceive++;
|
||||
}
|
||||
|
||||
tcp:::receive
|
||||
/args[2]->ip_saddr == "$local" && args[2]->ip_daddr == "$local"/
|
||||
{
|
||||
tcpreceive++;
|
||||
}
|
||||
|
||||
END
|
||||
{
|
||||
printf("Minimum TCP events seen\n\n");
|
||||
printf("ip:::send - %s\n", ipsend >= 5 ? "yes" : "no");
|
||||
printf("ip:::receive - %s\n", ipreceive >= 5 ? "yes" : "no");
|
||||
printf("tcp:::send - %s\n", tcpsend >= 5 ? "yes" : "no");
|
||||
printf("tcp:::receive - %s\n", tcpreceive >= 5 ? "yes" : "no");
|
||||
}
|
||||
EODTRACE
|
||||
|
||||
status=$?
|
||||
|
||||
cd /
|
||||
/usr/bin/rm -rf $DIR
|
||||
|
||||
exit $status
|
@ -0,0 +1,7 @@
|
||||
Minimum TCP events seen
|
||||
|
||||
ip:::send - yes
|
||||
ip:::receive - yes
|
||||
tcp:::send - yes
|
||||
tcp:::receive - yes
|
||||
|
93
cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.ipv4localudp.ksh
Executable file
93
cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.ipv4localudp.ksh
Executable file
@ -0,0 +1,93 @@
|
||||
#!/usr/bin/ksh
|
||||
#
|
||||
# CDDL HEADER START
|
||||
#
|
||||
# The contents of this file are subject to the terms of the
|
||||
# Common Development and Distribution License (the "License").
|
||||
# You may not use this file except in compliance with the License.
|
||||
#
|
||||
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
||||
# or http://www.opensolaris.org/os/licensing.
|
||||
# See the License for the specific language governing permissions
|
||||
# and limitations under the License.
|
||||
#
|
||||
# When distributing Covered Code, include this CDDL HEADER in each
|
||||
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
||||
# If applicable, add the following below this CDDL HEADER, with the
|
||||
# fields enclosed by brackets "[]" replaced with your own identifying
|
||||
# information: Portions Copyright [yyyy] [name of copyright owner]
|
||||
#
|
||||
# CDDL HEADER END
|
||||
#
|
||||
|
||||
#
|
||||
# Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
#
|
||||
|
||||
#
|
||||
# Test ip:::{send,receive} of IPv4 UDP to a local address.
|
||||
#
|
||||
# This may fail due to:
|
||||
#
|
||||
# 1. A change to the ip stack breaking expected probe behavior,
|
||||
# which is the reason we are testing.
|
||||
# 2. No physical network interface is plumbed and up.
|
||||
# 3. No other hosts on this subnet are reachable and listening on rpcbind.
|
||||
# 4. An unlikely race causes the unlocked global send/receive
|
||||
# variables to be corrupted.
|
||||
#
|
||||
# This test sends a UDP message using ping and checks that at least the
|
||||
# following counts were traced:
|
||||
#
|
||||
# 1 x ip:::send (UDP sent to ping's base UDP port)
|
||||
# 1 x udp:::send (UDP sent to ping's base UDP port)
|
||||
# 1 x ip:::receive (UDP received)
|
||||
#
|
||||
# No udp:::receive event is expected as the response ping -U elicits is
|
||||
# an ICMP PORT_UNREACHABLE response rather than a UDP packet, and locally
|
||||
# the echo request UDP packet only reaches IP, so the udp:::receive probe
|
||||
# is not triggered by it.
|
||||
#
|
||||
|
||||
if (( $# != 1 )); then
|
||||
print -u2 "expected one argument: <dtrace-path>"
|
||||
exit 2
|
||||
fi
|
||||
|
||||
dtrace=$1
|
||||
local=127.0.0.1
|
||||
|
||||
$dtrace -c "/usr/sbin/ping -U $local" -qs /dev/stdin <<EOF | grep -v 'is alive'
|
||||
BEGIN
|
||||
{
|
||||
ipsend = udpsend = ipreceive = 0;
|
||||
}
|
||||
|
||||
ip:::send
|
||||
/args[2]->ip_saddr == "$local" && args[2]->ip_daddr == "$local" &&
|
||||
args[4]->ipv4_protocol == IPPROTO_UDP/
|
||||
{
|
||||
ipsend++;
|
||||
}
|
||||
|
||||
udp:::send
|
||||
/args[2]->ip_saddr == "$local" && args[2]->ip_daddr == "$local"/
|
||||
{
|
||||
udpsend++;
|
||||
}
|
||||
|
||||
ip:::receive
|
||||
/args[2]->ip_saddr == "$local" && args[2]->ip_daddr == "$local" &&
|
||||
args[4]->ipv4_protocol == IPPROTO_UDP/
|
||||
{
|
||||
ipreceive++;
|
||||
}
|
||||
|
||||
END
|
||||
{
|
||||
printf("Minimum UDP events seen\n\n");
|
||||
printf("ip:::send - %s\n", ipsend >= 1 ? "yes" : "no");
|
||||
printf("ip:::receive - %s\n", ipreceive >= 1 ? "yes" : "no");
|
||||
printf("udp:::send - %s\n", udpsend >= 1 ? "yes" : "no");
|
||||
}
|
||||
EOF
|
@ -0,0 +1,6 @@
|
||||
Minimum UDP events seen
|
||||
|
||||
ip:::send - yes
|
||||
ip:::receive - yes
|
||||
udp:::send - yes
|
||||
|
@ -0,0 +1,81 @@
|
||||
#!/usr/bin/ksh
|
||||
#
|
||||
# CDDL HEADER START
|
||||
#
|
||||
# The contents of this file are subject to the terms of the
|
||||
# Common Development and Distribution License (the "License").
|
||||
# You may not use this file except in compliance with the License.
|
||||
#
|
||||
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
||||
# or http://www.opensolaris.org/os/licensing.
|
||||
# See the License for the specific language governing permissions
|
||||
# and limitations under the License.
|
||||
#
|
||||
# When distributing Covered Code, include this CDDL HEADER in each
|
||||
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
||||
# If applicable, add the following below this CDDL HEADER, with the
|
||||
# fields enclosed by brackets "[]" replaced with your own identifying
|
||||
# information: Portions Copyright [yyyy] [name of copyright owner]
|
||||
#
|
||||
# CDDL HEADER END
|
||||
#
|
||||
|
||||
#
|
||||
# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
|
||||
# Use is subject to license terms.
|
||||
#
|
||||
#pragma ident "%Z%%M% %I% %E% SMI"
|
||||
|
||||
#
|
||||
# Test ip:::{send,receive} of IPv4 ICMP to a remote host.
|
||||
#
|
||||
# This may fail due to:
|
||||
#
|
||||
# 1. A change to the ip stack breaking expected probe behavior,
|
||||
# which is the reason we are testing.
|
||||
# 2. No physical network interface is plumbed and up.
|
||||
# 3. No other hosts on this subnet are reachable.
|
||||
# 4. An unrelated ICMP between these hosts was traced by accident.
|
||||
#
|
||||
|
||||
if (( $# != 1 )); then
|
||||
print -u2 "expected one argument: <dtrace-path>"
|
||||
exit 2
|
||||
fi
|
||||
|
||||
dtrace=$1
|
||||
getaddr=./get.ipv4remote.pl
|
||||
|
||||
if [[ ! -x $getaddr ]]; then
|
||||
print -u2 "could not find or execute sub program: $getaddr"
|
||||
exit 3
|
||||
fi
|
||||
$getaddr | read source dest
|
||||
if (( $? != 0 )); then
|
||||
exit 4
|
||||
fi
|
||||
|
||||
$dtrace -c "/usr/sbin/ping $dest 3" -qs /dev/stdin <<EOF | \
|
||||
grep -v 'is alive' | sort -n
|
||||
ip:::send
|
||||
/args[2]->ip_saddr == "$source" && args[2]->ip_daddr == "$dest" &&
|
||||
args[4]->ipv4_protocol == IPPROTO_ICMP/
|
||||
{
|
||||
printf("1 ip:::send (");
|
||||
printf("args[2]: %d %d, ", args[2]->ip_ver, args[2]->ip_plength);
|
||||
printf("args[4]: %d %d %d %d %d)\n",
|
||||
args[4]->ipv4_ver, args[4]->ipv4_length, args[4]->ipv4_flags,
|
||||
args[4]->ipv4_offset, args[4]->ipv4_ttl);
|
||||
}
|
||||
|
||||
ip:::receive
|
||||
/args[2]->ip_saddr == "$dest" && args[2]->ip_daddr == "$source" &&
|
||||
args[4]->ipv4_protocol == IPPROTO_ICMP/
|
||||
{
|
||||
printf("2 ip:::receive (");
|
||||
printf("args[2]: %d %d, ", args[2]->ip_ver, args[2]->ip_plength);
|
||||
printf("args[4]: %d %d %d %d %d)\n",
|
||||
args[4]->ipv4_ver, args[4]->ipv4_length, args[4]->ipv4_flags,
|
||||
args[4]->ipv4_offset, args[4]->ipv4_ttl);
|
||||
}
|
||||
EOF
|
@ -0,0 +1,3 @@
|
||||
|
||||
1 ip:::send (args[2]: 4 64, args[4]: 4 84 0 0 255)
|
||||
2 ip:::receive (args[2]: 4 64, args[4]: 4 84 4 0 255)
|
128
cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.ipv4remotetcp.ksh
Executable file
128
cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.ipv4remotetcp.ksh
Executable file
@ -0,0 +1,128 @@
|
||||
#!/usr/bin/ksh
|
||||
#
|
||||
# CDDL HEADER START
|
||||
#
|
||||
# The contents of this file are subject to the terms of the
|
||||
# Common Development and Distribution License (the "License").
|
||||
# You may not use this file except in compliance with the License.
|
||||
#
|
||||
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
||||
# or http://www.opensolaris.org/os/licensing.
|
||||
# See the License for the specific language governing permissions
|
||||
# and limitations under the License.
|
||||
#
|
||||
# When distributing Covered Code, include this CDDL HEADER in each
|
||||
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
||||
# If applicable, add the following below this CDDL HEADER, with the
|
||||
# fields enclosed by brackets "[]" replaced with your own identifying
|
||||
# information: Portions Copyright [yyyy] [name of copyright owner]
|
||||
#
|
||||
# CDDL HEADER END
|
||||
#
|
||||
|
||||
#
|
||||
# Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
#
|
||||
|
||||
#
|
||||
# Test {tcp,ip}:::{send,receive} of IPv4 TCP to a remote host.
|
||||
#
|
||||
# This may fail due to:
|
||||
#
|
||||
# 1. A change to the ip stack breaking expected probe behavior,
|
||||
# which is the reason we are testing.
|
||||
# 2. No physical network interface is plumbed and up.
|
||||
# 3. No other hosts on this subnet are reachable and listening on ssh.
|
||||
# 4. An unlikely race causes the unlocked global send/receive
|
||||
# variables to be corrupted.
|
||||
#
|
||||
# This test performs a TCP connection and checks that at least the
|
||||
# following packet counts were traced:
|
||||
#
|
||||
# 3 x ip:::send (2 during the TCP handshake, then a FIN)
|
||||
# 3 x tcp:::send (2 during the TCP handshake, then a FIN)
|
||||
# 2 x ip:::receive (1 during the TCP handshake, then the FIN ACK)
|
||||
# 2 x tcp:::receive (1 during the TCP handshake, then the FIN ACK)
|
||||
#
|
||||
|
||||
if (( $# != 1 )); then
|
||||
print -u2 "expected one argument: <dtrace-path>"
|
||||
exit 2
|
||||
fi
|
||||
|
||||
dtrace=$1
|
||||
getaddr=./get.ipv4remote.pl
|
||||
tcpport=22
|
||||
DIR=/var/tmp/dtest.$$
|
||||
|
||||
if [[ ! -x $getaddr ]]; then
|
||||
print -u2 "could not find or execute sub program: $getaddr"
|
||||
exit 3
|
||||
fi
|
||||
$getaddr $tcpport | read source dest
|
||||
if (( $? != 0 )); then
|
||||
exit 4
|
||||
fi
|
||||
|
||||
mkdir $DIR
|
||||
cd $DIR
|
||||
|
||||
cat > test.pl <<-EOPERL
|
||||
use IO::Socket;
|
||||
my \$s = IO::Socket::INET->new(
|
||||
Proto => "tcp",
|
||||
PeerAddr => "$dest",
|
||||
PeerPort => $tcpport,
|
||||
Timeout => 3);
|
||||
die "Could not connect to host $dest port $tcpport" unless \$s;
|
||||
close \$s;
|
||||
EOPERL
|
||||
|
||||
$dtrace -c '/usr/bin/perl test.pl' -qs /dev/stdin <<EODTRACE
|
||||
BEGIN
|
||||
{
|
||||
ipsend = tcpsend = ipreceive = tcpreceive = 0;
|
||||
}
|
||||
|
||||
ip:::send
|
||||
/args[2]->ip_saddr == "$source" && args[2]->ip_daddr == "$dest" &&
|
||||
args[4]->ipv4_protocol == IPPROTO_TCP/
|
||||
{
|
||||
ipsend++;
|
||||
}
|
||||
|
||||
tcp:::send
|
||||
/args[2]->ip_saddr == "$source" && args[2]->ip_daddr == "$dest"/
|
||||
{
|
||||
tcpsend++;
|
||||
}
|
||||
|
||||
ip:::receive
|
||||
/args[2]->ip_saddr == "$dest" && args[2]->ip_daddr == "$source" &&
|
||||
args[4]->ipv4_protocol == IPPROTO_TCP/
|
||||
{
|
||||
ipreceive++;
|
||||
}
|
||||
|
||||
tcp:::receive
|
||||
/args[2]->ip_saddr == "$dest" && args[2]->ip_daddr == "$source"/
|
||||
{
|
||||
tcpreceive++;
|
||||
}
|
||||
|
||||
END
|
||||
{
|
||||
printf("Minimum TCP events seen\n\n");
|
||||
printf("ip:::send - %s\n", ipsend >= 3 ? "yes" : "no");
|
||||
printf("ip:::receive - %s\n", ipreceive >= 2 ? "yes" : "no");
|
||||
printf("tcp:::send - %s\n", tcpsend >= 3 ? "yes" : "no");
|
||||
printf("tcp:::receive - %s\n", tcpreceive >= 2 ? "yes" : "no");
|
||||
}
|
||||
EODTRACE
|
||||
|
||||
status=$?
|
||||
|
||||
cd /
|
||||
/usr/bin/rm -rf $DIR
|
||||
|
||||
exit $?
|
@ -0,0 +1,7 @@
|
||||
Minimum TCP events seen
|
||||
|
||||
ip:::send - yes
|
||||
ip:::receive - yes
|
||||
tcp:::send - yes
|
||||
tcp:::receive - yes
|
||||
|
88
cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.ipv4remoteudp.ksh
Executable file
88
cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.ipv4remoteudp.ksh
Executable file
@ -0,0 +1,88 @@
|
||||
#!/usr/bin/ksh
|
||||
#
|
||||
# CDDL HEADER START
|
||||
#
|
||||
# The contents of this file are subject to the terms of the
|
||||
# Common Development and Distribution License (the "License").
|
||||
# You may not use this file except in compliance with the License.
|
||||
#
|
||||
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
||||
# or http://www.opensolaris.org/os/licensing.
|
||||
# See the License for the specific language governing permissions
|
||||
# and limitations under the License.
|
||||
#
|
||||
# When distributing Covered Code, include this CDDL HEADER in each
|
||||
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
||||
# If applicable, add the following below this CDDL HEADER, with the
|
||||
# fields enclosed by brackets "[]" replaced with your own identifying
|
||||
# information: Portions Copyright [yyyy] [name of copyright owner]
|
||||
#
|
||||
# CDDL HEADER END
|
||||
#
|
||||
|
||||
#
|
||||
# Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
#
|
||||
|
||||
#
|
||||
# Test {udp,ip}:::{send,receive} of IPv4 UDP to a remote host.
|
||||
#
|
||||
# This may fail due to:
|
||||
#
|
||||
# 1. A change to the ip stack breaking expected probe behavior,
|
||||
# which is the reason we are testing.
|
||||
# 2. No physical network interface is plumbed and up.
|
||||
# 3. No other hosts on this subnet are reachable and listening on rpcbind.
|
||||
# 4. An unlikely race causes the unlocked global send/receive
|
||||
# variables to be corrupted.
|
||||
#
|
||||
# This test sends a UDP message using ping and checks that at least the
|
||||
# following counts were traced:
|
||||
#
|
||||
# 1 x ip:::send (UDP sent to ping's base UDP port)
|
||||
# 1 x udp:::send (UDP sent to ping's base UDP port)
|
||||
#
|
||||
|
||||
if (( $# != 1 )); then
|
||||
print -u2 "expected one argument: <dtrace-path>"
|
||||
exit 2
|
||||
fi
|
||||
|
||||
dtrace=$1
|
||||
getaddr=./get.ipv4remote.pl
|
||||
|
||||
if [[ ! -x $getaddr ]]; then
|
||||
print -u2 "could not find or execute sub program: $getaddr"
|
||||
exit 3
|
||||
fi
|
||||
$getaddr | read source dest
|
||||
if (( $? != 0 )); then
|
||||
exit 4
|
||||
fi
|
||||
|
||||
$dtrace -c "/usr/sbin/ping -U $dest" -qs /dev/stdin <<EOF | grep -v 'is alive'
|
||||
BEGIN
|
||||
{
|
||||
ipsend = udpsend = 0;
|
||||
}
|
||||
|
||||
ip:::send
|
||||
/args[2]->ip_saddr == "$source" && args[2]->ip_daddr == "$dest" &&
|
||||
args[4]->ipv4_protocol == IPPROTO_UDP/
|
||||
{
|
||||
ipsend++;
|
||||
}
|
||||
|
||||
udp:::send
|
||||
/args[2]->ip_saddr == "$source" && args[2]->ip_daddr == "$dest"/
|
||||
{
|
||||
udpsend++;
|
||||
}
|
||||
|
||||
END
|
||||
{
|
||||
printf("Minimum UDP events seen\n\n");
|
||||
printf("ip:::send - %s\n", ipsend >= 1 ? "yes" : "no");
|
||||
printf("udp:::send - %s\n", udpsend >= 1 ? "yes" : "no");
|
||||
}
|
||||
EOF
|
@ -0,0 +1,5 @@
|
||||
Minimum UDP events seen
|
||||
|
||||
ip:::send - yes
|
||||
udp:::send - yes
|
||||
|
82
cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.ipv6localicmp.ksh
Executable file
82
cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.ipv6localicmp.ksh
Executable file
@ -0,0 +1,82 @@
|
||||
#!/usr/bin/ksh
|
||||
#
|
||||
# CDDL HEADER START
|
||||
#
|
||||
# The contents of this file are subject to the terms of the
|
||||
# Common Development and Distribution License (the "License").
|
||||
# You may not use this file except in compliance with the License.
|
||||
#
|
||||
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
||||
# or http://www.opensolaris.org/os/licensing.
|
||||
# See the License for the specific language governing permissions
|
||||
# and limitations under the License.
|
||||
#
|
||||
# When distributing Covered Code, include this CDDL HEADER in each
|
||||
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
||||
# If applicable, add the following below this CDDL HEADER, with the
|
||||
# fields enclosed by brackets "[]" replaced with your own identifying
|
||||
# information: Portions Copyright [yyyy] [name of copyright owner]
|
||||
#
|
||||
# CDDL HEADER END
|
||||
#
|
||||
|
||||
#
|
||||
# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
|
||||
# Use is subject to license terms.
|
||||
#
|
||||
#pragma ident "%Z%%M% %I% %E% SMI"
|
||||
|
||||
#
|
||||
# Test ip:::{send,receive} of IPv6 ICMP to a local address. This creates a
|
||||
# temporary lo0/inet6 interface if one doesn't already exist.
|
||||
#
|
||||
# This may fail due to:
|
||||
#
|
||||
# 1. A change to the ip stack breaking expected probe behavior,
|
||||
# which is the reason we are testing.
|
||||
# 2. Unrelated ICMPv6 on lo0 traced by accident.
|
||||
#
|
||||
|
||||
if (( $# != 1 )); then
|
||||
print -u2 "expected one argument: <dtrace-path>"
|
||||
exit 2
|
||||
fi
|
||||
|
||||
dtrace=$1
|
||||
local=::1
|
||||
|
||||
if ! ifconfig lo0 inet6 > /dev/null 2>&1; then
|
||||
if ! ifconfig lo0 inet6 plumb up; then
|
||||
print -u2 "could not plumb lo0 inet6 for testing"
|
||||
exit 3
|
||||
fi
|
||||
removeinet6=1
|
||||
else
|
||||
removeinet6=0
|
||||
fi
|
||||
|
||||
$dtrace -c "/usr/sbin/ping -A inet6 $local 3" -qs /dev/stdin <<EOF | sort -n
|
||||
ip:::send
|
||||
/args[2]->ip_saddr == "$local" && args[2]->ip_daddr == "$local" &&
|
||||
args[5]->ipv6_nexthdr == IPPROTO_ICMPV6/
|
||||
{
|
||||
printf("1 ip:::send (");
|
||||
printf("args[2]: %d %d, ", args[2]->ip_ver, args[2]->ip_plength);
|
||||
printf("args[5]: %d %d %d)\n",
|
||||
args[5]->ipv6_ver, args[5]->ipv6_tclass, args[5]->ipv6_plen);
|
||||
}
|
||||
|
||||
ip:::receive
|
||||
/args[2]->ip_saddr == "$local" && args[2]->ip_daddr == "$local" &&
|
||||
args[5]->ipv6_nexthdr == IPPROTO_ICMPV6/
|
||||
{
|
||||
printf("2 ip:::receive (");
|
||||
printf("args[2]: %d %d, ", args[2]->ip_ver, args[2]->ip_plength);
|
||||
printf("args[5]: %d %d %d)\n",
|
||||
args[5]->ipv6_ver, args[5]->ipv6_tclass, args[5]->ipv6_plen);
|
||||
}
|
||||
EOF
|
||||
|
||||
if (( removeinet6 )); then
|
||||
ifconfig lo0 inet6 unplumb
|
||||
fi
|
@ -0,0 +1,6 @@
|
||||
|
||||
::1 is alive
|
||||
1 ip:::send (args[2]: 6 64, args[5]: 6 0 64)
|
||||
1 ip:::send (args[2]: 6 64, args[5]: 6 0 64)
|
||||
2 ip:::receive (args[2]: 6 64, args[5]: 6 0 64)
|
||||
2 ip:::receive (args[2]: 6 64, args[5]: 6 0 64)
|
@ -0,0 +1,88 @@
|
||||
#!/usr/bin/ksh
|
||||
#
|
||||
# CDDL HEADER START
|
||||
#
|
||||
# The contents of this file are subject to the terms of the
|
||||
# Common Development and Distribution License (the "License").
|
||||
# You may not use this file except in compliance with the License.
|
||||
#
|
||||
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
||||
# or http://www.opensolaris.org/os/licensing.
|
||||
# See the License for the specific language governing permissions
|
||||
# and limitations under the License.
|
||||
#
|
||||
# When distributing Covered Code, include this CDDL HEADER in each
|
||||
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
||||
# If applicable, add the following below this CDDL HEADER, with the
|
||||
# fields enclosed by brackets "[]" replaced with your own identifying
|
||||
# information: Portions Copyright [yyyy] [name of copyright owner]
|
||||
#
|
||||
# CDDL HEADER END
|
||||
#
|
||||
|
||||
#
|
||||
# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
|
||||
# Use is subject to license terms.
|
||||
#
|
||||
#pragma ident "%Z%%M% %I% %E% SMI"
|
||||
|
||||
#
|
||||
# Test ip:::{send,receive} of IPv6 ICMP to a remote host. This test is
|
||||
# skipped if there are no physical interfaces configured with IPv6, or no
|
||||
# other IPv6 hosts are reachable.
|
||||
#
|
||||
# This may fail due to:
|
||||
#
|
||||
# 1. A change to the ip stack breaking expected probe behavior,
|
||||
# which is the reason we are testing.
|
||||
# 2. An unrelated ICMPv6 between these hosts was traced by accident.
|
||||
#
|
||||
|
||||
if (( $# != 1 )); then
|
||||
print -u2 "expected one argument: <dtrace-path>"
|
||||
exit 2
|
||||
fi
|
||||
|
||||
dtrace=$1
|
||||
getaddr=./get.ipv6remote.pl
|
||||
|
||||
if [[ ! -x $getaddr ]]; then
|
||||
print -u2 "could not find or execute sub program: $getaddr"
|
||||
exit 3
|
||||
fi
|
||||
$getaddr | read source dest
|
||||
if (( $? != 0 )); then
|
||||
print -nu2 "Could not find a local IPv6 interface and a remote IPv6 "
|
||||
print -u2 "host. Aborting test.\n"
|
||||
print -nu2 "For this test to continue, a \"ping -ns -A inet6 FF02::1\" "
|
||||
print -u2 "must respond with a\nremote IPv6 host."
|
||||
exit 3
|
||||
fi
|
||||
|
||||
#
|
||||
# Shake loose any ICMPv6 Neighbor advertisement messages before tracing.
|
||||
#
|
||||
/usr/sbin/ping $dest 3 > /dev/null 2>&1
|
||||
|
||||
$dtrace -c "/usr/sbin/ping $dest 3" -qs /dev/stdin <<EOF | \
|
||||
grep -v 'is alive' | sort -n
|
||||
ip:::send
|
||||
/args[2]->ip_saddr == "$source" && args[2]->ip_daddr == "$dest" &&
|
||||
args[5]->ipv6_nexthdr == IPPROTO_ICMPV6/
|
||||
{
|
||||
printf("1 ip:::send (");
|
||||
printf("args[2]: %d %d, ", args[2]->ip_ver, args[2]->ip_plength);
|
||||
printf("args[5]: %d %d %d)\n",
|
||||
args[5]->ipv6_ver, args[5]->ipv6_tclass, args[5]->ipv6_plen);
|
||||
}
|
||||
|
||||
ip:::receive
|
||||
/args[2]->ip_saddr == "$dest" && args[2]->ip_daddr == "$source" &&
|
||||
args[5]->ipv6_nexthdr == IPPROTO_ICMPV6/
|
||||
{
|
||||
printf("2 ip:::receive (");
|
||||
printf("args[2]: %d %d, ", args[2]->ip_ver, args[2]->ip_plength);
|
||||
printf("args[5]: %d %d %d)\n",
|
||||
args[5]->ipv6_ver, args[5]->ipv6_tclass, args[5]->ipv6_plen);
|
||||
}
|
||||
EOF
|
@ -0,0 +1,3 @@
|
||||
|
||||
1 ip:::send (args[2]: 6 64, args[5]: 6 0 64)
|
||||
2 ip:::receive (args[2]: 6 64, args[5]: 6 0 64)
|
@ -0,0 +1,182 @@
|
||||
#!/usr/bin/ksh
|
||||
#
|
||||
# CDDL HEADER START
|
||||
#
|
||||
# The contents of this file are subject to the terms of the
|
||||
# Common Development and Distribution License (the "License").
|
||||
# You may not use this file except in compliance with the License.
|
||||
#
|
||||
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
||||
# or http://www.opensolaris.org/os/licensing.
|
||||
# See the License for the specific language governing permissions
|
||||
# and limitations under the License.
|
||||
#
|
||||
# When distributing Covered Code, include this CDDL HEADER in each
|
||||
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
||||
# If applicable, add the following below this CDDL HEADER, with the
|
||||
# fields enclosed by brackets "[]" replaced with your own identifying
|
||||
# information: Portions Copyright [yyyy] [name of copyright owner]
|
||||
#
|
||||
# CDDL HEADER END
|
||||
#
|
||||
|
||||
#
|
||||
# Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
#
|
||||
|
||||
#
|
||||
# Test tcp:::state-change and tcp:::{send,receive} by connecting to
|
||||
# the local ssh service and sending a test message. This should result
|
||||
# in a "Protocol mismatch" response and a close of the connection.
|
||||
# A number of state transition events along with tcp fusion send and
|
||||
# receive events for the message should result.
|
||||
#
|
||||
# This may fail due to:
|
||||
#
|
||||
# 1. A change to the ip stack breaking expected probe behavior,
|
||||
# which is the reason we are testing.
|
||||
# 2. The lo0 interface missing or not up.
|
||||
# 3. The local ssh service is not online.
|
||||
# 4. An unlikely race causes the unlocked global send/receive
|
||||
# variables to be corrupted.
|
||||
#
|
||||
# This test performs a TCP connection to the ssh service (port 22) and
|
||||
# checks that at least the following packet counts were traced:
|
||||
#
|
||||
# 3 x ip:::send (2 during the TCP handshake, then a FIN)
|
||||
# 4 x tcp:::send (2 during the TCP handshake, 1 message then a FIN)
|
||||
# 2 x ip:::receive (1 during the TCP handshake, then the FIN ACK)
|
||||
# 3 x tcp:::receive (1 during the TCP handshake, 1 message then the FIN ACK)
|
||||
#
|
||||
# The actual ip count tested is 5 each way, since we are tracing both
|
||||
# source and destination events. The actual tcp count tested is 7
|
||||
# each way, since the TCP fusion send/receive events will not reach IP.
|
||||
#
|
||||
# For this test to work, we are assuming that the TCP handshake and
|
||||
# TCP close will enter the IP code path and not use tcp fusion.
|
||||
#
|
||||
|
||||
if (( $# != 1 )); then
|
||||
print -u2 "expected one argument: <dtrace-path>"
|
||||
exit 2
|
||||
fi
|
||||
|
||||
dtrace=$1
|
||||
local=127.0.0.1
|
||||
tcpport=22
|
||||
DIR=/var/tmp/dtest.$$
|
||||
|
||||
mkdir $DIR
|
||||
cd $DIR
|
||||
|
||||
cat > test.pl <<-EOPERL
|
||||
use IO::Socket;
|
||||
my \$s = IO::Socket::INET->new(
|
||||
Proto => "tcp",
|
||||
PeerAddr => "$local",
|
||||
PeerPort => $tcpport,
|
||||
Timeout => 3);
|
||||
die "Could not connect to host $local port $tcpport" unless \$s;
|
||||
print \$s "testing state machine transitions";
|
||||
close \$s;
|
||||
EOPERL
|
||||
|
||||
$dtrace -c '/usr/bin/perl test.pl' -qs /dev/stdin <<EODTRACE
|
||||
BEGIN
|
||||
{
|
||||
ipsend = tcpsend = ipreceive = tcpreceive = 0;
|
||||
connreq = connest = connaccept = 0;
|
||||
}
|
||||
|
||||
ip:::send
|
||||
/args[2]->ip_saddr == "$local" && args[2]->ip_daddr == "$local" &&
|
||||
args[4]->ipv4_protocol == IPPROTO_TCP/
|
||||
{
|
||||
ipsend++;
|
||||
}
|
||||
|
||||
tcp:::send
|
||||
/args[2]->ip_saddr == "$local" && args[2]->ip_daddr == "$local" &&
|
||||
(args[4]->tcp_sport == $tcpport || args[4]->tcp_dport == $tcpport)/
|
||||
{
|
||||
tcpsend++;
|
||||
}
|
||||
|
||||
ip:::receive
|
||||
/args[2]->ip_saddr == "$local" && args[2]->ip_daddr == "$local" &&
|
||||
args[4]->ipv4_protocol == IPPROTO_TCP/
|
||||
{
|
||||
ipreceive++;
|
||||
}
|
||||
|
||||
tcp:::receive
|
||||
/args[2]->ip_saddr == "$local" && args[2]->ip_daddr == "$local" &&
|
||||
(args[4]->tcp_sport == $tcpport || args[4]->tcp_dport == $tcpport)/
|
||||
{
|
||||
tcpreceive++;
|
||||
}
|
||||
|
||||
tcp:::state-change
|
||||
{
|
||||
state_event[args[3]->tcps_state]++;
|
||||
}
|
||||
|
||||
tcp:::connect-request
|
||||
/args[2]->ip_saddr == "$local" && args[2]->ip_daddr == "$local" &&
|
||||
args[4]->tcp_dport == $tcpport/
|
||||
{
|
||||
connreq++;
|
||||
}
|
||||
|
||||
tcp:::connect-established
|
||||
/args[2]->ip_saddr == "$local" && args[2]->ip_daddr == "$local" &&
|
||||
args[4]->tcp_sport == $tcpport/
|
||||
{
|
||||
connest++;
|
||||
}
|
||||
|
||||
tcp:::accept-established
|
||||
/args[2]->ip_saddr == "$local" && args[2]->ip_daddr == "$local" &&
|
||||
args[4]->tcp_dport == $tcpport/
|
||||
{
|
||||
connaccept++;
|
||||
}
|
||||
|
||||
END
|
||||
{
|
||||
printf("Minimum TCP events seen\n\n");
|
||||
printf("ip:::send - %s\n", ipsend >= 5 ? "yes" : "no");
|
||||
printf("ip:::receive - %s\n", ipreceive >= 5 ? "yes" : "no");
|
||||
printf("tcp:::send - %s\n", tcpsend >= 7 ? "yes" : "no");
|
||||
printf("tcp:::receive - %s\n", tcpreceive >= 7 ? "yes" : "no");
|
||||
printf("tcp:::state-change to syn-sent - %s\n",
|
||||
state_event[TCP_STATE_SYN_SENT] >=1 ? "yes" : "no");
|
||||
printf("tcp:::state-change to syn-received - %s\n",
|
||||
state_event[TCP_STATE_SYN_RECEIVED] >=1 ? "yes" : "no");
|
||||
printf("tcp:::state-change to established - %s\n",
|
||||
state_event[TCP_STATE_ESTABLISHED] >= 2 ? "yes" : "no");
|
||||
printf("tcp:::state-change to fin-wait-1 - %s\n",
|
||||
state_event[TCP_STATE_FIN_WAIT_1] >= 1 ? "yes" : "no");
|
||||
printf("tcp:::state-change to close-wait - %s\n",
|
||||
state_event[TCP_STATE_CLOSE_WAIT] >= 1 ? "yes" : "no");
|
||||
printf("tcp:::state-change to fin-wait-2 - %s\n",
|
||||
state_event[TCP_STATE_FIN_WAIT_2] >= 1 ? "yes" : "no");
|
||||
printf("tcp:::state-change to last-ack - %s\n",
|
||||
state_event[TCP_STATE_LAST_ACK] >= 1 ? "yes" : "no");
|
||||
printf("tcp:::state-change to time-wait - %s\n",
|
||||
state_event[TCP_STATE_TIME_WAIT] >= 1 ? "yes" : "no");
|
||||
printf("tcp:::connect-request - %s\n",
|
||||
connreq >=1 ? "yes" : "no");
|
||||
printf("tcp:::connect-established - %s\n",
|
||||
connest >=1 ? "yes" : "no");
|
||||
printf("tcp:::accept-established - %s\n",
|
||||
connaccept >=1 ? "yes" : "no");
|
||||
}
|
||||
EODTRACE
|
||||
|
||||
status=$?
|
||||
|
||||
cd /
|
||||
/usr/bin/rm -rf $DIR
|
||||
|
||||
exit $status
|
@ -0,0 +1,18 @@
|
||||
Minimum TCP events seen
|
||||
|
||||
ip:::send - yes
|
||||
ip:::receive - yes
|
||||
tcp:::send - yes
|
||||
tcp:::receive - yes
|
||||
tcp:::state-change to syn-sent - yes
|
||||
tcp:::state-change to syn-received - yes
|
||||
tcp:::state-change to established - yes
|
||||
tcp:::state-change to fin-wait-1 - yes
|
||||
tcp:::state-change to close-wait - yes
|
||||
tcp:::state-change to fin-wait-2 - yes
|
||||
tcp:::state-change to last-ack - yes
|
||||
tcp:::state-change to time-wait - yes
|
||||
tcp:::connect-request - yes
|
||||
tcp:::connect-established - yes
|
||||
tcp:::accept-established - yes
|
||||
|
@ -0,0 +1,172 @@
|
||||
#!/usr/bin/ksh
|
||||
#
|
||||
# CDDL HEADER START
|
||||
#
|
||||
# The contents of this file are subject to the terms of the
|
||||
# Common Development and Distribution License (the "License").
|
||||
# You may not use this file except in compliance with the License.
|
||||
#
|
||||
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
||||
# or http://www.opensolaris.org/os/licensing.
|
||||
# See the License for the specific language governing permissions
|
||||
# and limitations under the License.
|
||||
#
|
||||
# When distributing Covered Code, include this CDDL HEADER in each
|
||||
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
||||
# If applicable, add the following below this CDDL HEADER, with the
|
||||
# fields enclosed by brackets "[]" replaced with your own identifying
|
||||
# information: Portions Copyright [yyyy] [name of copyright owner]
|
||||
#
|
||||
# CDDL HEADER END
|
||||
#
|
||||
|
||||
#
|
||||
# Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
#
|
||||
|
||||
#
|
||||
# Test tcp:::state-change and tcp:::{send,receive} by connecting to
|
||||
# the remote ssh service and sending a test message. This should result
|
||||
# in a "Protocol mismatch" response and a close of the connection.
|
||||
# A number of state transition events along with tcp send and receive
|
||||
# events for the message should result.
|
||||
#
|
||||
# This may fail due to:
|
||||
#
|
||||
# 1. A change to the ip stack breaking expected probe behavior,
|
||||
# which is the reason we are testing.
|
||||
# 2. The lo0 interface missing or not up.
|
||||
# 3. The remote ssh service is not online.
|
||||
# 4. An unlikely race causes the unlocked global send/receive
|
||||
# variables to be corrupted.
|
||||
#
|
||||
# This test performs a TCP connection to the ssh service (port 22) and
|
||||
# checks that at least the following packet counts were traced:
|
||||
#
|
||||
# 4 x ip:::send (2 during the TCP handshake, the message, then a FIN)
|
||||
# 4 x tcp:::send (2 during the TCP handshake, the messages, then a FIN)
|
||||
# 3 x ip:::receive (1 during the TCP handshake, the response, then the FIN ACK)
|
||||
# 3 x tcp:::receive (1 during the TCP handshake, the response, then the FIN ACK)
|
||||
#
|
||||
# For this test to work, we are assuming that the TCP handshake and
|
||||
# TCP close will enter the IP code path and not use tcp fusion.
|
||||
#
|
||||
|
||||
if (( $# != 1 )); then
|
||||
print -u2 "expected one argument: <dtrace-path>"
|
||||
exit 2
|
||||
fi
|
||||
|
||||
dtrace=$1
|
||||
getaddr=./get.ipv4remote.pl
|
||||
tcpport=22
|
||||
DIR=/var/tmp/dtest.$$
|
||||
|
||||
if [[ ! -x $getaddr ]]; then
|
||||
print -u2 "could not find or execute sub program: $getaddr"
|
||||
exit 3
|
||||
fi
|
||||
$getaddr $tcpport | read source dest
|
||||
if (( $? != 0 )); then
|
||||
exit 4
|
||||
fi
|
||||
|
||||
mkdir $DIR
|
||||
cd $DIR
|
||||
|
||||
cat > test.pl <<-EOPERL
|
||||
use IO::Socket;
|
||||
my \$s = IO::Socket::INET->new(
|
||||
Proto => "tcp",
|
||||
PeerAddr => "$dest",
|
||||
PeerPort => $tcpport,
|
||||
Timeout => 3);
|
||||
die "Could not connect to host $dest port $tcpport" unless \$s;
|
||||
print \$s "testing state machine transitions";
|
||||
close \$s;
|
||||
EOPERL
|
||||
|
||||
$dtrace -c '/usr/bin/perl test.pl' -qs /dev/stdin <<EODTRACE
|
||||
BEGIN
|
||||
{
|
||||
ipsend = tcpsend = ipreceive = tcpreceive = 0;
|
||||
connreq = connest = 0;
|
||||
}
|
||||
|
||||
ip:::send
|
||||
/args[2]->ip_saddr == "$source" && args[2]->ip_daddr == "$dest" &&
|
||||
args[4]->ipv4_protocol == IPPROTO_TCP/
|
||||
{
|
||||
ipsend++;
|
||||
}
|
||||
|
||||
tcp:::send
|
||||
/args[2]->ip_saddr == "$source" && args[2]->ip_daddr == "$dest" &&
|
||||
args[4]->tcp_dport == $tcpport/
|
||||
{
|
||||
tcpsend++;
|
||||
}
|
||||
|
||||
ip:::receive
|
||||
/args[2]->ip_saddr == "$dest" && args[2]->ip_daddr == "$source" &&
|
||||
args[4]->ipv4_protocol == IPPROTO_TCP/
|
||||
{
|
||||
ipreceive++;
|
||||
}
|
||||
|
||||
tcp:::receive
|
||||
/args[2]->ip_saddr == "$dest" && args[2]->ip_daddr == "$source" &&
|
||||
args[4]->tcp_sport == $tcpport/
|
||||
{
|
||||
tcpreceive++;
|
||||
}
|
||||
|
||||
tcp:::state-change
|
||||
{
|
||||
state_event[args[3]->tcps_state]++;
|
||||
}
|
||||
|
||||
tcp:::connect-request
|
||||
/args[2]->ip_saddr == "$source" && args[2]->ip_daddr == "$dest" &&
|
||||
args[4]->tcp_dport == $tcpport/
|
||||
{
|
||||
connreq++;
|
||||
}
|
||||
|
||||
tcp:::connect-established
|
||||
/args[2]->ip_saddr == "$dest" && args[2]->ip_daddr == "$source" &&
|
||||
args[4]->tcp_sport == $tcpport/
|
||||
{
|
||||
connest++;
|
||||
}
|
||||
|
||||
END
|
||||
{
|
||||
printf("Minimum TCP events seen\n\n");
|
||||
printf("ip:::send - %s\n", ipsend >= 4 ? "yes" : "no");
|
||||
printf("ip:::receive - %s\n", ipreceive >= 3 ? "yes" : "no");
|
||||
printf("tcp:::send - %s\n", tcpsend >= 4 ? "yes" : "no");
|
||||
printf("tcp:::receive - %s\n", tcpreceive >= 3 ? "yes" : "no");
|
||||
printf("tcp:::state-change to syn-sent - %s\n",
|
||||
state_event[TCP_STATE_SYN_SENT] >=1 ? "yes" : "no");
|
||||
printf("tcp:::state-change to established - %s\n",
|
||||
state_event[TCP_STATE_ESTABLISHED] >= 1 ? "yes" : "no");
|
||||
printf("tcp:::state-change to fin-wait-1 - %s\n",
|
||||
state_event[TCP_STATE_FIN_WAIT_1] >= 1 ? "yes" : "no");
|
||||
printf("tcp:::state-change to fin-wait-2 - %s\n",
|
||||
state_event[TCP_STATE_FIN_WAIT_2] >= 1 ? "yes" : "no");
|
||||
printf("tcp:::state-change to time-wait - %s\n",
|
||||
state_event[TCP_STATE_TIME_WAIT] >= 1 ? "yes" : "no");
|
||||
printf("tcp:::connect-request - %s\n",
|
||||
connreq >=1 ? "yes" : "no");
|
||||
printf("tcp:::connect-established - %s\n",
|
||||
connest >=1 ? "yes" : "no");
|
||||
}
|
||||
EODTRACE
|
||||
|
||||
status=$?
|
||||
|
||||
cd /
|
||||
/usr/bin/rm -rf $DIR
|
||||
|
||||
exit $status
|
@ -0,0 +1,15 @@
|
||||
Minimum TCP events seen
|
||||
|
||||
ip:::send - yes
|
||||
ip:::receive - yes
|
||||
tcp:::send - yes
|
||||
tcp:::receive - yes
|
||||
tcp:::state-change to syn-sent - yes
|
||||
tcp:::state-change to established - yes
|
||||
tcp:::state-change to fin-wait-1 - yes
|
||||
tcp:::state-change to close-wait - yes
|
||||
tcp:::state-change to fin-wait-2 - yes
|
||||
tcp:::state-change to time-wait - yes
|
||||
tcp:::connect-request - yes
|
||||
tcp:::connect-established - yes
|
||||
|
@ -20,10 +20,8 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
|
||||
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
|
||||
* Use is subject to license terms.
|
||||
*
|
||||
* ident "%Z%%M% %I% %E% SMI"
|
||||
*/
|
||||
|
||||
import org.opensolaris.os.dtrace.*;
|
||||
@ -70,7 +68,7 @@ public class TestFunctionLookup {
|
||||
long addr = (Long)address;
|
||||
f = consumer.lookupKernelFunction(addr);
|
||||
}
|
||||
if (f.equals("genunix`setrun")) {
|
||||
if (f.equals("genunix`cv_wakeup")) {
|
||||
System.out.println(f);
|
||||
done = true;
|
||||
}
|
||||
|
@ -0,0 +1,252 @@
|
||||
/*
|
||||
* CDDL HEADER START
|
||||
*
|
||||
* The contents of this file are subject to the terms of the
|
||||
* Common Development and Distribution License (the "License").
|
||||
* You may not use this file except in compliance with the License.
|
||||
*
|
||||
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
||||
* or http://www.opensolaris.org/os/licensing.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
*
|
||||
* When distributing Covered Code, include this CDDL HEADER in each
|
||||
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
||||
* If applicable, add the following below this CDDL HEADER, with the
|
||||
* fields enclosed by brackets "[]" replaced with your own identifying
|
||||
* information: Portions Copyright [yyyy] [name of copyright owner]
|
||||
*
|
||||
* CDDL HEADER END
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
|
||||
* Use is subject to license terms.
|
||||
*/
|
||||
|
||||
import org.opensolaris.os.dtrace.*;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* Assert getAggregate() can explicitly specify the anonymous aggregation.
|
||||
*/
|
||||
public class TestGetAggregate {
|
||||
static final String programString =
|
||||
"profile:::tick-50ms" +
|
||||
"{" +
|
||||
" @ = count();" +
|
||||
" @a = count();" +
|
||||
"}";
|
||||
|
||||
static final String ANONYMOUS_AGGREGATION = "";
|
||||
static final int TICK = 50;
|
||||
static final int EXPECTED_TICKS = 3;
|
||||
static final int INTERVALS = 4;
|
||||
|
||||
static void
|
||||
testIncluded(Consumer consumer, String ... aggregationNames)
|
||||
throws DTraceException, InterruptedException
|
||||
{
|
||||
Aggregate aggregate;
|
||||
Set <String> included = new HashSet <String> ();
|
||||
int n = 1;
|
||||
|
||||
for (String name : aggregationNames) {
|
||||
included.add(name);
|
||||
}
|
||||
|
||||
// Wait up to a full second to obtain aggregate data. Without a
|
||||
// time limit, we'll loop forever if no aggregation was
|
||||
// successfully included.
|
||||
do {
|
||||
Thread.sleep(TICK);
|
||||
aggregate = consumer.getAggregate(included, null);
|
||||
} while (aggregate.asMap().isEmpty() && n++ < (1000 / TICK));
|
||||
|
||||
for (String name : included) {
|
||||
if (aggregate.getAggregation(name) == null) {
|
||||
throw new IllegalStateException("@" + name +
|
||||
" was explicitly included but did not appear " +
|
||||
"in the aggregate");
|
||||
}
|
||||
}
|
||||
for (Aggregation a : aggregate.getAggregations()) {
|
||||
if (!included.contains(a.getName())) {
|
||||
throw new IllegalStateException("@" + a.getName() +
|
||||
" was not explicitly included but appeared " +
|
||||
"in the aggregate anyway");
|
||||
}
|
||||
}
|
||||
|
||||
if (!consumer.isRunning()) {
|
||||
throw new IllegalStateException("consumer exited");
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
testCleared(Consumer consumer, String ... aggregationNames)
|
||||
throws DTraceException, InterruptedException
|
||||
{
|
||||
Aggregate aggregate;
|
||||
AggregationRecord rec;
|
||||
long value;
|
||||
Long firstValue;
|
||||
int n = 1;
|
||||
Map <String, Long> firstValues = new HashMap <String, Long> ();
|
||||
Set <String> cleared = new HashSet <String> ();
|
||||
|
||||
for (String name : aggregationNames) {
|
||||
cleared.add(name);
|
||||
}
|
||||
|
||||
do {
|
||||
Thread.sleep(TICK);
|
||||
aggregate = consumer.getAggregate(null, cleared);
|
||||
} while (aggregate.asMap().isEmpty() && n++ < (1000 / TICK));
|
||||
n = 1;
|
||||
|
||||
do {
|
||||
Thread.sleep(TICK * EXPECTED_TICKS);
|
||||
aggregate = consumer.getAggregate(null, cleared);
|
||||
|
||||
for (Aggregation a : aggregate.getAggregations()) {
|
||||
if (!firstValues.containsKey(a.getName())) {
|
||||
rec = a.getRecord(Tuple.EMPTY);
|
||||
value = rec.getValue().getValue().longValue();
|
||||
firstValues.put(a.getName(), value);
|
||||
}
|
||||
}
|
||||
} while (consumer.isRunning() && n++ < INTERVALS);
|
||||
|
||||
for (Aggregation a : aggregate.getAggregations()) {
|
||||
rec = a.getRecord(Tuple.EMPTY);
|
||||
value = rec.getValue().getValue().longValue();
|
||||
firstValue = firstValues.get(a.getName());
|
||||
|
||||
if (cleared.contains(a.getName())) {
|
||||
// last value should be about the same as first value
|
||||
if (value > (firstValue * 2)) {
|
||||
throw new IllegalStateException(
|
||||
"@" + a.getName() + " should have " +
|
||||
"been cleared but instead grew from " +
|
||||
firstValue + " to " + value);
|
||||
}
|
||||
} else {
|
||||
// last value should be about (INTERVALS * firstValue)
|
||||
if (value < (firstValue * 2)) {
|
||||
throw new IllegalStateException(
|
||||
"@" + a.getName() + " should have " +
|
||||
"accumulated a running total but " +
|
||||
"instead went from " +
|
||||
firstValue + " to " + value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!consumer.isRunning()) {
|
||||
throw new IllegalStateException("consumer exited");
|
||||
}
|
||||
}
|
||||
|
||||
static Integer includedStatus;
|
||||
static Integer clearedStatus;
|
||||
|
||||
static void
|
||||
startIncludedTest()
|
||||
{
|
||||
final Consumer consumer = new LocalConsumer();
|
||||
consumer.addConsumerListener(new ConsumerAdapter() {
|
||||
public void consumerStarted(ConsumerEvent e) {
|
||||
new Thread(new Runnable() {
|
||||
public void run() {
|
||||
try {
|
||||
testIncluded(consumer, ANONYMOUS_AGGREGATION);
|
||||
includedStatus = 0;
|
||||
} catch (Exception e) {
|
||||
includedStatus = 1;
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
consumer.abort();
|
||||
}
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
});
|
||||
|
||||
try {
|
||||
consumer.open();
|
||||
consumer.setOption(Option.aggrate, Option.millis(TICK));
|
||||
consumer.compile(programString);
|
||||
consumer.enable();
|
||||
consumer.go();
|
||||
} catch (Exception e) {
|
||||
includedStatus = 1;
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
startClearedTest()
|
||||
{
|
||||
final Consumer consumer = new LocalConsumer();
|
||||
consumer.addConsumerListener(new ConsumerAdapter() {
|
||||
public void consumerStarted(ConsumerEvent e) {
|
||||
new Thread(new Runnable() {
|
||||
public void run() {
|
||||
try {
|
||||
testCleared(consumer, ANONYMOUS_AGGREGATION);
|
||||
clearedStatus = 0;
|
||||
} catch (Exception e) {
|
||||
clearedStatus = 1;
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
consumer.abort();
|
||||
}
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
});
|
||||
|
||||
try {
|
||||
consumer.open();
|
||||
consumer.setOption(Option.aggrate, Option.millis(TICK));
|
||||
consumer.compile(programString);
|
||||
consumer.enable();
|
||||
consumer.go();
|
||||
} catch (Exception e) {
|
||||
clearedStatus = 1;
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public static void
|
||||
main(String[] args)
|
||||
{
|
||||
startIncludedTest();
|
||||
|
||||
do {
|
||||
try {
|
||||
Thread.sleep(TICK);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
} while (includedStatus == null);
|
||||
|
||||
startClearedTest();
|
||||
|
||||
do {
|
||||
try {
|
||||
Thread.sleep(TICK);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
} while (clearedStatus == null);
|
||||
|
||||
if (includedStatus != 0 || clearedStatus != 0) {
|
||||
System.out.println("Failure");
|
||||
System.exit(1);
|
||||
}
|
||||
|
||||
System.out.println("Success");
|
||||
}
|
||||
}
|
@ -1,3 +1,3 @@
|
||||
genunix`setrun
|
||||
genunix`cv_wakeup
|
||||
3
|
||||
tst.FunctionLookup.exe`f1
|
||||
|
@ -0,0 +1,36 @@
|
||||
#!/bin/ksh -p
|
||||
#
|
||||
# CDDL HEADER START
|
||||
#
|
||||
# The contents of this file are subject to the terms of the
|
||||
# Common Development and Distribution License (the "License").
|
||||
# You may not use this file except in compliance with the License.
|
||||
#
|
||||
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
||||
# or http://www.opensolaris.org/os/licensing.
|
||||
# See the License for the specific language governing permissions
|
||||
# and limitations under the License.
|
||||
#
|
||||
# When distributing Covered Code, include this CDDL HEADER in each
|
||||
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
||||
# If applicable, add the following below this CDDL HEADER, with the
|
||||
# fields enclosed by brackets "[]" replaced with your own identifying
|
||||
# information: Portions Copyright [yyyy] [name of copyright owner]
|
||||
#
|
||||
# CDDL HEADER END
|
||||
#
|
||||
|
||||
#
|
||||
# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
|
||||
# Use is subject to license terms.
|
||||
#
|
||||
|
||||
############################################################################
|
||||
# ASSERTION:
|
||||
# getAggregate() can explicitly specify the anonymous aggregation
|
||||
#
|
||||
# SECTION: Java API
|
||||
#
|
||||
############################################################################
|
||||
|
||||
java -cp test.jar TestGetAggregate
|
@ -0,0 +1,41 @@
|
||||
#
|
||||
# CDDL HEADER START
|
||||
#
|
||||
# The contents of this file are subject to the terms of the
|
||||
# Common Development and Distribution License (the "License").
|
||||
# You may not use this file except in compliance with the License.
|
||||
#
|
||||
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
||||
# or http://www.opensolaris.org/os/licensing.
|
||||
# See the License for the specific language governing permissions
|
||||
# and limitations under the License.
|
||||
#
|
||||
# When distributing Covered Code, include this CDDL HEADER in each
|
||||
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
||||
# If applicable, add the following below this CDDL HEADER, with the
|
||||
# fields enclosed by brackets "[]" replaced with your own identifying
|
||||
# information: Portions Copyright [yyyy] [name of copyright owner]
|
||||
#
|
||||
# CDDL HEADER END
|
||||
#
|
||||
|
||||
#
|
||||
# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
|
||||
# Use is subject to license terms.
|
||||
#
|
||||
|
||||
if [ $# != 1 ]; then
|
||||
echo expected one argument: '<'dtrace-path'>'
|
||||
exit 2
|
||||
fi
|
||||
|
||||
dtrace=$1
|
||||
|
||||
$dtrace -ln 'syscall::*$1:entry' read | awk '{print $(NF-1),$NF}' | sort
|
||||
$dtrace -ln 'syscall::$1*:entry' read | awk '{print $(NF-1),$NF}' | sort
|
||||
$dtrace -ln 'syscall::re$1*:entry' ad | awk '{print $(NF-1),$NF}' | sort
|
||||
$dtrace -ln 'syscall::$1l*:entry' read | awk '{print $(NF-1),$NF}' | sort
|
||||
$dtrace -ln 'syscall::p$1[0-9][0-9]:entry' read | awk '{print $(NF-1),$NF}' | \
|
||||
sort
|
||||
|
||||
exit $status
|
@ -0,0 +1,15 @@
|
||||
FUNCTION NAME
|
||||
pread entry
|
||||
read entry
|
||||
FUNCTION NAME
|
||||
read entry
|
||||
readlink entry
|
||||
readv entry
|
||||
FUNCTION NAME
|
||||
read entry
|
||||
readlink entry
|
||||
readv entry
|
||||
FUNCTION NAME
|
||||
readlink entry
|
||||
FUNCTION NAME
|
||||
pread64 entry
|
@ -0,0 +1,29 @@
|
||||
#!/bin/ksh
|
||||
#
|
||||
# CDDL HEADER START
|
||||
#
|
||||
# The contents of this file are subject to the terms of the
|
||||
# Common Development and Distribution License (the "License").
|
||||
# You may not use this file except in compliance with the License.
|
||||
#
|
||||
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
||||
# or http://www.opensolaris.org/os/licensing.
|
||||
# See the License for the specific language governing permissions
|
||||
# and limitations under the License.
|
||||
#
|
||||
# When distributing Covered Code, include this CDDL HEADER in each
|
||||
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
||||
# If applicable, add the following below this CDDL HEADER, with the
|
||||
# fields enclosed by brackets "[]" replaced with your own identifying
|
||||
# information: Portions Copyright [yyyy] [name of copyright owner]
|
||||
#
|
||||
# CDDL HEADER END
|
||||
#
|
||||
|
||||
#
|
||||
# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
|
||||
# Use is subject to license terms.
|
||||
#
|
||||
#ident "%Z%%M% %I% %E% SMI"
|
||||
|
||||
sleep 1000000
|
@ -0,0 +1,29 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# CDDL HEADER START
|
||||
#
|
||||
# The contents of this file are subject to the terms of the
|
||||
# Common Development and Distribution License (the "License").
|
||||
# You may not use this file except in compliance with the License.
|
||||
#
|
||||
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
||||
# or http://www.opensolaris.org/os/licensing.
|
||||
# See the License for the specific language governing permissions
|
||||
# and limitations under the License.
|
||||
#
|
||||
# When distributing Covered Code, include this CDDL HEADER in each
|
||||
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
||||
# If applicable, add the following below this CDDL HEADER, with the
|
||||
# fields enclosed by brackets "[]" replaced with your own identifying
|
||||
# information: Portions Copyright [yyyy] [name of copyright owner]
|
||||
#
|
||||
# CDDL HEADER END
|
||||
#
|
||||
|
||||
#
|
||||
# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
|
||||
# Use is subject to license terms.
|
||||
#
|
||||
#ident "%Z%%M% %I% %E% SMI"
|
||||
|
||||
sleep 1000000
|
@ -0,0 +1,29 @@
|
||||
#!/bin/ksh
|
||||
#
|
||||
# CDDL HEADER START
|
||||
#
|
||||
# The contents of this file are subject to the terms of the
|
||||
# Common Development and Distribution License (the "License").
|
||||
# You may not use this file except in compliance with the License.
|
||||
#
|
||||
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
||||
# or http://www.opensolaris.org/os/licensing.
|
||||
# See the License for the specific language governing permissions
|
||||
# and limitations under the License.
|
||||
#
|
||||
# When distributing Covered Code, include this CDDL HEADER in each
|
||||
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
||||
# If applicable, add the following below this CDDL HEADER, with the
|
||||
# fields enclosed by brackets "[]" replaced with your own identifying
|
||||
# information: Portions Copyright [yyyy] [name of copyright owner]
|
||||
#
|
||||
# CDDL HEADER END
|
||||
#
|
||||
|
||||
#
|
||||
# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
|
||||
# Use is subject to license terms.
|
||||
#
|
||||
#ident "%Z%%M% %I% %E% SMI"
|
||||
|
||||
sleep 1000000
|
@ -0,0 +1,29 @@
|
||||
#!/bin/ksh
|
||||
#
|
||||
# CDDL HEADER START
|
||||
#
|
||||
# The contents of this file are subject to the terms of the
|
||||
# Common Development and Distribution License (the "License").
|
||||
# You may not use this file except in compliance with the License.
|
||||
#
|
||||
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
||||
# or http://www.opensolaris.org/os/licensing.
|
||||
# See the License for the specific language governing permissions
|
||||
# and limitations under the License.
|
||||
#
|
||||
# When distributing Covered Code, include this CDDL HEADER in each
|
||||
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
||||
# If applicable, add the following below this CDDL HEADER, with the
|
||||
# fields enclosed by brackets "[]" replaced with your own identifying
|
||||
# information: Portions Copyright [yyyy] [name of copyright owner]
|
||||
#
|
||||
# CDDL HEADER END
|
||||
#
|
||||
|
||||
#
|
||||
# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
|
||||
# Use is subject to license terms.
|
||||
#
|
||||
#ident "%Z%%M% %I% %E% SMI"
|
||||
|
||||
sleep 1000000
|
@ -0,0 +1,29 @@
|
||||
#!/bin/ksh
|
||||
#
|
||||
# CDDL HEADER START
|
||||
#
|
||||
# The contents of this file are subject to the terms of the
|
||||
# Common Development and Distribution License (the "License").
|
||||
# You may not use this file except in compliance with the License.
|
||||
#
|
||||
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
||||
# or http://www.opensolaris.org/os/licensing.
|
||||
# See the License for the specific language governing permissions
|
||||
# and limitations under the License.
|
||||
#
|
||||
# When distributing Covered Code, include this CDDL HEADER in each
|
||||
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
||||
# If applicable, add the following below this CDDL HEADER, with the
|
||||
# fields enclosed by brackets "[]" replaced with your own identifying
|
||||
# information: Portions Copyright [yyyy] [name of copyright owner]
|
||||
#
|
||||
# CDDL HEADER END
|
||||
#
|
||||
|
||||
#
|
||||
# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
|
||||
# Use is subject to license terms.
|
||||
#
|
||||
#ident "%Z%%M% %I% %E% SMI"
|
||||
|
||||
sleep 1000000
|
@ -0,0 +1,29 @@
|
||||
#!/bin/ksh
|
||||
#
|
||||
# CDDL HEADER START
|
||||
#
|
||||
# The contents of this file are subject to the terms of the
|
||||
# Common Development and Distribution License (the "License").
|
||||
# You may not use this file except in compliance with the License.
|
||||
#
|
||||
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
||||
# or http://www.opensolaris.org/os/licensing.
|
||||
# See the License for the specific language governing permissions
|
||||
# and limitations under the License.
|
||||
#
|
||||
# When distributing Covered Code, include this CDDL HEADER in each
|
||||
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
||||
# If applicable, add the following below this CDDL HEADER, with the
|
||||
# fields enclosed by brackets "[]" replaced with your own identifying
|
||||
# information: Portions Copyright [yyyy] [name of copyright owner]
|
||||
#
|
||||
# CDDL HEADER END
|
||||
#
|
||||
|
||||
#
|
||||
# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
|
||||
# Use is subject to license terms.
|
||||
#
|
||||
#ident "%Z%%M% %I% %E% SMI"
|
||||
|
||||
sleep 1000000
|
@ -0,0 +1,29 @@
|
||||
#!/bin/ksh
|
||||
#
|
||||
# CDDL HEADER START
|
||||
#
|
||||
# The contents of this file are subject to the terms of the
|
||||
# Common Development and Distribution License (the "License").
|
||||
# You may not use this file except in compliance with the License.
|
||||
#
|
||||
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
||||
# or http://www.opensolaris.org/os/licensing.
|
||||
# See the License for the specific language governing permissions
|
||||
# and limitations under the License.
|
||||
#
|
||||
# When distributing Covered Code, include this CDDL HEADER in each
|
||||
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
||||
# If applicable, add the following below this CDDL HEADER, with the
|
||||
# fields enclosed by brackets "[]" replaced with your own identifying
|
||||
# information: Portions Copyright [yyyy] [name of copyright owner]
|
||||
#
|
||||
# CDDL HEADER END
|
||||
#
|
||||
|
||||
#
|
||||
# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
|
||||
# Use is subject to license terms.
|
||||
#
|
||||
#ident "%Z%%M% %I% %E% SMI"
|
||||
|
||||
sleep 1000000
|
@ -0,0 +1,29 @@
|
||||
#!/bin/ksh
|
||||
#
|
||||
# CDDL HEADER START
|
||||
#
|
||||
# The contents of this file are subject to the terms of the
|
||||
# Common Development and Distribution License (the "License").
|
||||
# You may not use this file except in compliance with the License.
|
||||
#
|
||||
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
||||
# or http://www.opensolaris.org/os/licensing.
|
||||
# See the License for the specific language governing permissions
|
||||
# and limitations under the License.
|
||||
#
|
||||
# When distributing Covered Code, include this CDDL HEADER in each
|
||||
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
||||
# If applicable, add the following below this CDDL HEADER, with the
|
||||
# fields enclosed by brackets "[]" replaced with your own identifying
|
||||
# information: Portions Copyright [yyyy] [name of copyright owner]
|
||||
#
|
||||
# CDDL HEADER END
|
||||
#
|
||||
|
||||
#
|
||||
# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
|
||||
# Use is subject to license terms.
|
||||
#
|
||||
#ident "%Z%%M% %I% %E% SMI"
|
||||
|
||||
sleep 1000000
|
@ -0,0 +1,29 @@
|
||||
#!/usr/bin/ksh
|
||||
#
|
||||
# CDDL HEADER START
|
||||
#
|
||||
# The contents of this file are subject to the terms of the
|
||||
# Common Development and Distribution License (the "License").
|
||||
# You may not use this file except in compliance with the License.
|
||||
#
|
||||
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
||||
# or http://www.opensolaris.org/os/licensing.
|
||||
# See the License for the specific language governing permissions
|
||||
# and limitations under the License.
|
||||
#
|
||||
# When distributing Covered Code, include this CDDL HEADER in each
|
||||
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
||||
# If applicable, add the following below this CDDL HEADER, with the
|
||||
# fields enclosed by brackets "[]" replaced with your own identifying
|
||||
# information: Portions Copyright [yyyy] [name of copyright owner]
|
||||
#
|
||||
# CDDL HEADER END
|
||||
#
|
||||
|
||||
#
|
||||
# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
|
||||
# Use is subject to license terms.
|
||||
#
|
||||
#ident "%Z%%M% %I% %E% SMI"
|
||||
|
||||
while true; do env > /dev/null; done
|
@ -0,0 +1,29 @@
|
||||
#!/usr/bin/ksh
|
||||
#
|
||||
# CDDL HEADER START
|
||||
#
|
||||
# The contents of this file are subject to the terms of the
|
||||
# Common Development and Distribution License (the "License").
|
||||
# You may not use this file except in compliance with the License.
|
||||
#
|
||||
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
||||
# or http://www.opensolaris.org/os/licensing.
|
||||
# See the License for the specific language governing permissions
|
||||
# and limitations under the License.
|
||||
#
|
||||
# When distributing Covered Code, include this CDDL HEADER in each
|
||||
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
||||
# If applicable, add the following below this CDDL HEADER, with the
|
||||
# fields enclosed by brackets "[]" replaced with your own identifying
|
||||
# information: Portions Copyright [yyyy] [name of copyright owner]
|
||||
#
|
||||
# CDDL HEADER END
|
||||
#
|
||||
|
||||
#
|
||||
# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
|
||||
# Use is subject to license terms.
|
||||
#
|
||||
#ident "%Z%%M% %I% %E% SMI"
|
||||
|
||||
exec find / > /dev/null 2>&1
|
@ -0,0 +1,41 @@
|
||||
#!/bin/ksh -p
|
||||
#
|
||||
# CDDL HEADER START
|
||||
#
|
||||
# The contents of this file are subject to the terms of the
|
||||
# Common Development and Distribution License (the "License").
|
||||
# You may not use this file except in compliance with the License.
|
||||
#
|
||||
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
||||
# or http://www.opensolaris.org/os/licensing.
|
||||
# See the License for the specific language governing permissions
|
||||
# and limitations under the License.
|
||||
#
|
||||
# When distributing Covered Code, include this CDDL HEADER in each
|
||||
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
||||
# If applicable, add the following below this CDDL HEADER, with the
|
||||
# fields enclosed by brackets "[]" replaced with your own identifying
|
||||
# information: Portions Copyright [yyyy] [name of copyright owner]
|
||||
#
|
||||
# CDDL HEADER END
|
||||
#
|
||||
|
||||
#
|
||||
# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
|
||||
# Use is subject to license terms.
|
||||
#
|
||||
|
||||
if [ $# != 1 ]; then
|
||||
echo expected one argument: '<'dtrace-path'>'
|
||||
exit 2
|
||||
fi
|
||||
|
||||
dtrace=$1
|
||||
|
||||
#
|
||||
# Make sure we kill a process if the dtrace(1M) command fails.
|
||||
#
|
||||
|
||||
rc=`$dtrace -c date -n jarod 2>/dev/null | /usr/bin/wc -l`
|
||||
|
||||
exit $rc
|
@ -21,11 +21,9 @@
|
||||
#
|
||||
|
||||
#
|
||||
# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
|
||||
# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
|
||||
# Use is subject to license terms.
|
||||
#
|
||||
# ident "%Z%%M% %I% %E% SMI"
|
||||
#
|
||||
|
||||
if [ $# != 1 ]; then
|
||||
echo expected one argument: '<'dtrace-path'>'
|
||||
@ -40,7 +38,7 @@ dtrace=$1
|
||||
# (and therefore 'libc' and 'libc.so') as it's definitely there.
|
||||
#
|
||||
|
||||
for lib in libc libc.so libc.so.1; do
|
||||
for lib in libc libc.so libc.so.1 'lib[c]*'; do
|
||||
sleep 60 &
|
||||
pid=$!
|
||||
dtrace -n "pid$pid:$lib::entry" -n 'tick-2s{exit(0);}'
|
||||
|
@ -0,0 +1,29 @@
|
||||
#!/usr/bin/ksh
|
||||
#
|
||||
# CDDL HEADER START
|
||||
#
|
||||
# The contents of this file are subject to the terms of the
|
||||
# Common Development and Distribution License (the "License").
|
||||
# You may not use this file except in compliance with the License.
|
||||
#
|
||||
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
||||
# or http://www.opensolaris.org/os/licensing.
|
||||
# See the License for the specific language governing permissions
|
||||
# and limitations under the License.
|
||||
#
|
||||
# When distributing Covered Code, include this CDDL HEADER in each
|
||||
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
||||
# If applicable, add the following below this CDDL HEADER, with the
|
||||
# fields enclosed by brackets "[]" replaced with your own identifying
|
||||
# information: Portions Copyright [yyyy] [name of copyright owner]
|
||||
#
|
||||
# CDDL HEADER END
|
||||
#
|
||||
|
||||
#
|
||||
# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
|
||||
# Use is subject to license terms.
|
||||
#
|
||||
#ident "%Z%%M% %I% %E% SMI"
|
||||
|
||||
sleep 100000000
|
@ -0,0 +1,29 @@
|
||||
#!/usr/bin/ksh
|
||||
#
|
||||
# CDDL HEADER START
|
||||
#
|
||||
# The contents of this file are subject to the terms of the
|
||||
# Common Development and Distribution License (the "License").
|
||||
# You may not use this file except in compliance with the License.
|
||||
#
|
||||
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
||||
# or http://www.opensolaris.org/os/licensing.
|
||||
# See the License for the specific language governing permissions
|
||||
# and limitations under the License.
|
||||
#
|
||||
# When distributing Covered Code, include this CDDL HEADER in each
|
||||
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
||||
# If applicable, add the following below this CDDL HEADER, with the
|
||||
# fields enclosed by brackets "[]" replaced with your own identifying
|
||||
# information: Portions Copyright [yyyy] [name of copyright owner]
|
||||
#
|
||||
# CDDL HEADER END
|
||||
#
|
||||
|
||||
#
|
||||
# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
|
||||
# Use is subject to license terms.
|
||||
#
|
||||
#ident "%Z%%M% %I% %E% SMI"
|
||||
|
||||
sleep 100000000
|
@ -20,15 +20,13 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
|
||||
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
|
||||
* Use is subject to license terms.
|
||||
*/
|
||||
|
||||
#pragma ident "%Z%%M% %I% %E% SMI"
|
||||
|
||||
/*
|
||||
* ASSERTION:
|
||||
* Test the basic formatting of all the supported kinds of aggregations.
|
||||
* Test the basic formatting of all the supported kinds of aggregations.
|
||||
*
|
||||
* SECTION: Output Formatting/printa()
|
||||
*
|
||||
@ -45,6 +43,7 @@ BEGIN
|
||||
@e = min(1);
|
||||
@f = sum(1);
|
||||
@g = quantize(1);
|
||||
@h = stddev(1);
|
||||
|
||||
printa("@a = %@u\n", @a);
|
||||
printa("@b = %@u\n", @b);
|
||||
@ -53,6 +52,7 @@ BEGIN
|
||||
printa("@e = %@u\n", @e);
|
||||
printa("@f = %@u\n", @f);
|
||||
printa("@g = %@d\n", @g);
|
||||
printa("@h = %@d\n", @h);
|
||||
|
||||
exit(0);
|
||||
}
|
||||
|
@ -15,4 +15,5 @@
|
||||
1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1
|
||||
2 | 0
|
||||
|
||||
@h = 0
|
||||
|
||||
|
@ -0,0 +1,83 @@
|
||||
#
|
||||
# CDDL HEADER START
|
||||
#
|
||||
# The contents of this file are subject to the terms of the
|
||||
# Common Development and Distribution License (the "License").
|
||||
# You may not use this file except in compliance with the License.
|
||||
#
|
||||
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
||||
# or http://www.opensolaris.org/os/licensing.
|
||||
# See the License for the specific language governing permissions
|
||||
# and limitations under the License.
|
||||
#
|
||||
# When distributing Covered Code, include this CDDL HEADER in each
|
||||
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
||||
# If applicable, add the following below this CDDL HEADER, with the
|
||||
# fields enclosed by brackets "[]" replaced with your own identifying
|
||||
# information: Portions Copyright [yyyy] [name of copyright owner]
|
||||
#
|
||||
# CDDL HEADER END
|
||||
#
|
||||
|
||||
#
|
||||
# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
|
||||
# Use is subject to license terms.
|
||||
#
|
||||
|
||||
if [ $# != 1 ]; then
|
||||
echo expected one argument: '<'dtrace-path'>'
|
||||
exit 2
|
||||
fi
|
||||
|
||||
dtrace=$1
|
||||
DIR=/var/tmp/dtest.$$
|
||||
|
||||
mkdir $DIR
|
||||
cd $DIR
|
||||
|
||||
cat > test.c <<EOF
|
||||
void
|
||||
thequickbrownfoxjumpsoverthelazydogthequickbrownfoxjumpsoverthelazydogthequickbrownfoxjumpsoverthelazydogthequickbrownfoxjumpsoverthelazydogthequickbrownfoxjumpsoverthelazydogthequickbrownfoxjumpsoverthelazydogthequickbrownfoxjumpsoverthelazydogthequickbrownfoxjumpsoverthelazydogthequickbrownfoxjumpsoverthelazydog(void)
|
||||
{
|
||||
while (1)
|
||||
;
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
thequickbrownfoxjumpsoverthelazydogthequickbrownfoxjumpsoverthelazydogthequickbrownfoxjumpsoverthelazydogthequickbrownfoxjumpsoverthelazydogthequickbrownfoxjumpsoverthelazydogthequickbrownfoxjumpsoverthelazydogthequickbrownfoxjumpsoverthelazydogthequickbrownfoxjumpsoverthelazydogthequickbrownfoxjumpsoverthelazydog();
|
||||
}
|
||||
EOF
|
||||
|
||||
cc -o test test.c
|
||||
if [ $? -ne 0 ]; then
|
||||
print -u2 "failed to compile test.c"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
script()
|
||||
{
|
||||
$dtrace -c ./test -qs /dev/stdin <<EOF
|
||||
profile:::profile-1001hz
|
||||
/pid == \$target/
|
||||
{
|
||||
@[arg1] = count();
|
||||
}
|
||||
|
||||
tick-1s
|
||||
/n++ > 10/
|
||||
{
|
||||
printa("%A %@d\n", @);
|
||||
exit(0);
|
||||
}
|
||||
EOF
|
||||
}
|
||||
|
||||
script
|
||||
status=$?
|
||||
|
||||
cd /
|
||||
/usr/bin/rm -rf $DIR
|
||||
|
||||
exit $status
|
@ -20,12 +20,10 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
|
||||
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
|
||||
* Use is subject to license terms.
|
||||
*/
|
||||
|
||||
#pragma ident "%Z%%M% %I% %E% SMI"
|
||||
|
||||
/*
|
||||
* ASSERTION:
|
||||
* Test printf() with a simple string argument.
|
||||
@ -38,6 +36,6 @@
|
||||
|
||||
BEGIN
|
||||
{
|
||||
printf("rootfs = %s", `rootfs.bo_fstype);
|
||||
printf("sysname = %s", `utsname.sysname);
|
||||
exit(0);
|
||||
}
|
||||
|
@ -1 +1 @@
|
||||
rootfs = ufs
|
||||
sysname = SunOS
|
||||
|
@ -0,0 +1,45 @@
|
||||
/*
|
||||
* CDDL HEADER START
|
||||
*
|
||||
* The contents of this file are subject to the terms of the
|
||||
* Common Development and Distribution License (the "License").
|
||||
* You may not use this file except in compliance with the License.
|
||||
*
|
||||
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
||||
* or http://www.opensolaris.org/os/licensing.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
*
|
||||
* When distributing Covered Code, include this CDDL HEADER in each
|
||||
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
||||
* If applicable, add the following below this CDDL HEADER, with the
|
||||
* fields enclosed by brackets "[]" replaced with your own identifying
|
||||
* information: Portions Copyright [yyyy] [name of copyright owner]
|
||||
*
|
||||
* CDDL HEADER END
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
|
||||
* Use is subject to license terms.
|
||||
*/
|
||||
|
||||
#pragma ident "%Z%%M% %I% %E% SMI"
|
||||
|
||||
#include <unistd.h>
|
||||
#include <sys/uadmin.h>
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
while (1) {
|
||||
if (uadmin(A_SDTTEST, 0, 0) < 0) {
|
||||
perror("uadmin");
|
||||
return (1);
|
||||
}
|
||||
|
||||
sleep(1);
|
||||
}
|
||||
|
||||
return (0);
|
||||
}
|
@ -0,0 +1,67 @@
|
||||
/*
|
||||
* CDDL HEADER START
|
||||
*
|
||||
* The contents of this file are subject to the terms of the
|
||||
* Common Development and Distribution License (the "License").
|
||||
* You may not use this file except in compliance with the License.
|
||||
*
|
||||
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
||||
* or http://www.opensolaris.org/os/licensing.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
*
|
||||
* When distributing Covered Code, include this CDDL HEADER in each
|
||||
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
||||
* If applicable, add the following below this CDDL HEADER, with the
|
||||
* fields enclosed by brackets "[]" replaced with your own identifying
|
||||
* information: Portions Copyright [yyyy] [name of copyright owner]
|
||||
*
|
||||
* CDDL HEADER END
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
|
||||
* Use is subject to license terms.
|
||||
*/
|
||||
|
||||
#pragma ident "%Z%%M% %I% %E% SMI"
|
||||
|
||||
/*
|
||||
* ASSERTION: Verify that argN (1..7) variables are properly remapped.
|
||||
*/
|
||||
|
||||
BEGIN
|
||||
{
|
||||
/* Timeout after 5 seconds */
|
||||
timeout = timestamp + 5000000000;
|
||||
ignore = $1;
|
||||
}
|
||||
|
||||
ERROR
|
||||
{
|
||||
printf("sdt:::test failed.\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
sdt:::test
|
||||
/arg0 != 1 || arg1 != 2 || arg2 != 3 || arg3 != 4 || arg4 != 5 || arg5 != 6 ||
|
||||
arg6 != 7/
|
||||
{
|
||||
printf("sdt arg mismatch\n\n");
|
||||
printf("args are : %d, %d, %d, %d, %d, %d, %d\n", arg0, arg1, arg2,
|
||||
arg3, arg4, arg5, arg6);
|
||||
printf("should be : 1, 2, 3, 4, 5, 6, 7\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
sdt:::test
|
||||
{
|
||||
exit(0);
|
||||
}
|
||||
|
||||
profile:::tick-1
|
||||
/timestamp > timeout/
|
||||
{
|
||||
trace("test timed out");
|
||||
exit(1);
|
||||
}
|
@ -0,0 +1,65 @@
|
||||
/*
|
||||
* CDDL HEADER START
|
||||
*
|
||||
* The contents of this file are subject to the terms of the
|
||||
* Common Development and Distribution License (the "License").
|
||||
* You may not use this file except in compliance with the License.
|
||||
*
|
||||
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
||||
* or http://www.opensolaris.org/os/licensing.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
*
|
||||
* When distributing Covered Code, include this CDDL HEADER in each
|
||||
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
||||
* If applicable, add the following below this CDDL HEADER, with the
|
||||
* fields enclosed by brackets "[]" replaced with your own identifying
|
||||
* information: Portions Copyright [yyyy] [name of copyright owner]
|
||||
*
|
||||
* CDDL HEADER END
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
|
||||
* Use is subject to license terms.
|
||||
*/
|
||||
|
||||
/*
|
||||
* ASSERTION:
|
||||
* Aggregating actions may never be speculative.
|
||||
*
|
||||
* SECTION: Speculative Tracing/Using a Speculation
|
||||
*
|
||||
*/
|
||||
#pragma D option quiet
|
||||
|
||||
BEGIN
|
||||
{
|
||||
i = 0;
|
||||
}
|
||||
|
||||
profile:::tick-1sec
|
||||
/i < 1/
|
||||
{
|
||||
var = speculation();
|
||||
speculate(var);
|
||||
printf("Speculation ID: %d", var);
|
||||
@sdev["speculate"] = stddev(i);
|
||||
i++;
|
||||
}
|
||||
|
||||
profile:::tick-1sec
|
||||
/1 == i/
|
||||
{
|
||||
exit(0);
|
||||
}
|
||||
|
||||
ERROR
|
||||
{
|
||||
exit(0);
|
||||
}
|
||||
|
||||
END
|
||||
{
|
||||
exit(0);
|
||||
}
|
@ -19,12 +19,10 @@
|
||||
* CDDL HEADER END
|
||||
*/
|
||||
/*
|
||||
* Copyright 2007 Sun Microsystems, Inc. All rights reserved.
|
||||
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
|
||||
* Use is subject to license terms.
|
||||
*/
|
||||
|
||||
#pragma ident "%Z%%M% %I% %E% SMI"
|
||||
|
||||
#include <libsysevent.h>
|
||||
#include <stdio.h>
|
||||
|
||||
@ -42,7 +40,7 @@ main(int argc, char **argv)
|
||||
for (;;) {
|
||||
if (sysevent_evc_publish(ch, "class_dtest", "subclass_dtest",
|
||||
"vendor_dtest", "publisher_dtest", NULL, EVCH_SLEEP) != 0) {
|
||||
sysevent_evc_unbind(ch);
|
||||
(void) sysevent_evc_unbind(ch);
|
||||
(void) fprintf(stderr, "failed to publisth sysevent\n");
|
||||
return (1);
|
||||
}
|
||||
|
@ -0,0 +1,107 @@
|
||||
#!/usr/bin/ksh
|
||||
#
|
||||
# CDDL HEADER START
|
||||
#
|
||||
# The contents of this file are subject to the terms of the
|
||||
# Common Development and Distribution License (the "License").
|
||||
# You may not use this file except in compliance with the License.
|
||||
#
|
||||
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
||||
# or http://www.opensolaris.org/os/licensing.
|
||||
# See the License for the specific language governing permissions
|
||||
# and limitations under the License.
|
||||
#
|
||||
# When distributing Covered Code, include this CDDL HEADER in each
|
||||
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
||||
# If applicable, add the following below this CDDL HEADER, with the
|
||||
# fields enclosed by brackets "[]" replaced with your own identifying
|
||||
# information: Portions Copyright [yyyy] [name of copyright owner]
|
||||
#
|
||||
# CDDL HEADER END
|
||||
#
|
||||
|
||||
#
|
||||
# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
|
||||
# Use is subject to license terms.
|
||||
#
|
||||
|
||||
#
|
||||
# This test verifies that a program that corrupts its own environment
|
||||
# without inducing a crash does not crash solely due to drti.o's use of
|
||||
# getenv(3C).
|
||||
#
|
||||
|
||||
PATH=/usr/bin:/usr/sbin:$PATH
|
||||
|
||||
if (( $# != 1 )); then
|
||||
print -u2 'expected one argument: <dtrace-path>'
|
||||
exit 2
|
||||
fi
|
||||
|
||||
#
|
||||
# jdtrace does not implement the -h option that is required to generate
|
||||
# C header files.
|
||||
#
|
||||
if [[ "$1" == */jdtrace ]]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
dtrace="$1"
|
||||
startdir="$PWD"
|
||||
dir=$(mktemp -td drtiXXXXXX)
|
||||
if (( $? != 0 )); then
|
||||
print -u2 'Could not create safe temporary directory'
|
||||
exit 2
|
||||
fi
|
||||
|
||||
cd "$dir"
|
||||
|
||||
cat > Makefile <<EOF
|
||||
all: main
|
||||
|
||||
main: main.o prov.o
|
||||
\$(CC) -o main main.o prov.o
|
||||
|
||||
main.o: main.c prov.h
|
||||
\$(CC) -c main.c
|
||||
|
||||
prov.h: prov.d
|
||||
$dtrace -h -s prov.d
|
||||
|
||||
prov.o: prov.d main.o
|
||||
$dtrace -G -32 -s prov.d main.o
|
||||
EOF
|
||||
|
||||
cat > prov.d <<EOF
|
||||
provider tester {
|
||||
probe entry();
|
||||
};
|
||||
EOF
|
||||
|
||||
cat > main.c <<EOF
|
||||
#include <stdlib.h>
|
||||
#include <sys/sdt.h>
|
||||
#include "prov.h"
|
||||
|
||||
int
|
||||
main(int argc, char **argv, char **envp)
|
||||
{
|
||||
envp[0] = (char*)0xff;
|
||||
TESTER_ENTRY();
|
||||
return 0;
|
||||
}
|
||||
EOF
|
||||
|
||||
make > /dev/null
|
||||
status=$?
|
||||
if (( $status != 0 )) ; then
|
||||
print -u2 "failed to build"
|
||||
else
|
||||
./main
|
||||
status=$?
|
||||
fi
|
||||
|
||||
cd "$startdir"
|
||||
rm -rf "$dir"
|
||||
|
||||
exit $status
|
@ -0,0 +1,113 @@
|
||||
#
|
||||
# CDDL HEADER START
|
||||
#
|
||||
# The contents of this file are subject to the terms of the
|
||||
# Common Development and Distribution License (the "License").
|
||||
# You may not use this file except in compliance with the License.
|
||||
#
|
||||
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
||||
# or http://www.opensolaris.org/os/licensing.
|
||||
# See the License for the specific language governing permissions
|
||||
# and limitations under the License.
|
||||
#
|
||||
# When distributing Covered Code, include this CDDL HEADER in each
|
||||
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
||||
# If applicable, add the following below this CDDL HEADER, with the
|
||||
# fields enclosed by brackets "[]" replaced with your own identifying
|
||||
# information: Portions Copyright [yyyy] [name of copyright owner]
|
||||
#
|
||||
# CDDL HEADER END
|
||||
#
|
||||
|
||||
#
|
||||
# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
|
||||
# Use is subject to license terms.
|
||||
#
|
||||
#ident "%Z%%M% %I% %E% SMI"
|
||||
|
||||
#
|
||||
# This test is primarily intended to verify a fix for SPARC, but there's no
|
||||
# harm in running it on other platforms. Here, we verify that is-enabled
|
||||
# probes don't interfere with return values from previously invoked functions.
|
||||
#
|
||||
|
||||
if [ $# != 1 ]; then
|
||||
echo expected one argument: '<'dtrace-path'>'
|
||||
exit 2
|
||||
fi
|
||||
|
||||
dtrace=$1
|
||||
DIR=/var/tmp/dtest.$$
|
||||
|
||||
mkdir $DIR
|
||||
cd $DIR
|
||||
|
||||
cat > prov.d <<EOF
|
||||
provider test_prov {
|
||||
probe go();
|
||||
};
|
||||
EOF
|
||||
|
||||
$dtrace -h -s prov.d
|
||||
if [ $? -ne 0 ]; then
|
||||
print -u2 "failed to generate header file"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cat > test.c <<EOF
|
||||
#include <stdio.h>
|
||||
#include "prov.h"
|
||||
|
||||
int
|
||||
foo(void)
|
||||
{
|
||||
return (24);
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
int a = foo();
|
||||
if (TEST_PROV_GO_ENABLED()) {
|
||||
TEST_PROV_GO();
|
||||
}
|
||||
(void) printf("%d %d %d\n", a, a, a);
|
||||
|
||||
return (0);
|
||||
}
|
||||
EOF
|
||||
|
||||
cc -c -xO2 test.c
|
||||
if [ $? -ne 0 ]; then
|
||||
print -u2 "failed to compile test.c"
|
||||
exit 1
|
||||
fi
|
||||
$dtrace -G -32 -s prov.d test.o
|
||||
if [ $? -ne 0 ]; then
|
||||
print -u2 "failed to create DOF"
|
||||
exit 1
|
||||
fi
|
||||
cc -o test test.o prov.o
|
||||
if [ $? -ne 0 ]; then
|
||||
print -u2 "failed to link final executable"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
script()
|
||||
{
|
||||
./test
|
||||
|
||||
$dtrace -c ./test -qs /dev/stdin <<EOF
|
||||
test_prov\$target:::
|
||||
{
|
||||
}
|
||||
EOF
|
||||
}
|
||||
|
||||
script
|
||||
status=$?
|
||||
|
||||
cd /
|
||||
/usr/bin/rm -rf $DIR
|
||||
|
||||
exit $status
|
@ -0,0 +1,3 @@
|
||||
24 24 24
|
||||
24 24 24
|
||||
|
@ -20,12 +20,10 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
|
||||
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
|
||||
* Use is subject to license terms.
|
||||
*/
|
||||
|
||||
#pragma ident "%Z%%M% %I% %E% SMI"
|
||||
|
||||
/*
|
||||
* ASSERTION:
|
||||
* On IA/32, there is a single 32-bit address space that is partitioned
|
||||
@ -43,11 +41,12 @@
|
||||
|
||||
BEGIN
|
||||
{
|
||||
lbolt = copyin((uintptr_t)&`lbolt, sizeof (int));
|
||||
dtrace_zero = copyin((uintptr_t)&`dtrace_zero, sizeof (int));
|
||||
exit(1);
|
||||
}
|
||||
|
||||
ERROR
|
||||
{
|
||||
exit(arg4 == DTRACEFLT_BADADDR && arg5 == (uint64_t)&`lbolt ? 0 : 1);
|
||||
exit(arg4 == DTRACEFLT_BADADDR &&
|
||||
arg5 == (uint64_t)&`dtrace_zero ? 0 : 1);
|
||||
}
|
||||
|
77
cddl/contrib/opensolaris/cmd/dtrace/test/tst/i86xpv/xdt/tst.basic.ksh
Executable file
77
cddl/contrib/opensolaris/cmd/dtrace/test/tst/i86xpv/xdt/tst.basic.ksh
Executable file
@ -0,0 +1,77 @@
|
||||
#
|
||||
# CDDL HEADER START
|
||||
#
|
||||
# The contents of this file are subject to the terms of the
|
||||
# Common Development and Distribution License (the "License").
|
||||
# You may not use this file except in compliance with the License.
|
||||
#
|
||||
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
||||
# or http://www.opensolaris.org/os/licensing.
|
||||
# See the License for the specific language governing permissions
|
||||
# and limitations under the License.
|
||||
#
|
||||
# When distributing Covered Code, include this CDDL HEADER in each
|
||||
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
||||
# If applicable, add the following below this CDDL HEADER, with the
|
||||
# fields enclosed by brackets "[]" replaced with your own identifying
|
||||
# information: Portions Copyright [yyyy] [name of copyright owner]
|
||||
#
|
||||
# CDDL HEADER END
|
||||
#
|
||||
|
||||
#
|
||||
# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
|
||||
# Use is subject to license terms.
|
||||
#
|
||||
|
||||
#
|
||||
# ASSERTION: Make sure that we can map in and read the Xen trace buffers.
|
||||
#
|
||||
|
||||
if [ $# != 1 ]; then
|
||||
echo expected one argument: '<'dtrace-path'>'
|
||||
exit 2
|
||||
fi
|
||||
|
||||
#
|
||||
# Do not fail the test in a domU
|
||||
#
|
||||
if [ ! -c /dev/xen/privcmd ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
dtrace=$1
|
||||
|
||||
script()
|
||||
{
|
||||
$dtrace -qs /dev/stdin <<EOF
|
||||
xdt:sched::on-cpu
|
||||
/arg0 == 0/
|
||||
{
|
||||
self->on++;
|
||||
}
|
||||
|
||||
xdt:sched::off-cpu
|
||||
/arg0 == 0 && self->on/
|
||||
{
|
||||
self->off++;
|
||||
}
|
||||
|
||||
xdt:sched::off-cpu
|
||||
/self->on > 50 && self->off > 50/
|
||||
{
|
||||
exit(0);
|
||||
}
|
||||
|
||||
profile:::tick-1sec
|
||||
/n++ > 10/
|
||||
{
|
||||
exit(1);
|
||||
}
|
||||
EOF
|
||||
}
|
||||
|
||||
script
|
||||
status=$?
|
||||
|
||||
exit $status
|
64
cddl/contrib/opensolaris/cmd/dtrace/test/tst/i86xpv/xdt/tst.hvmenable.ksh
Executable file
64
cddl/contrib/opensolaris/cmd/dtrace/test/tst/i86xpv/xdt/tst.hvmenable.ksh
Executable file
@ -0,0 +1,64 @@
|
||||
#
|
||||
# CDDL HEADER START
|
||||
#
|
||||
# The contents of this file are subject to the terms of the
|
||||
# Common Development and Distribution License (the "License").
|
||||
# You may not use this file except in compliance with the License.
|
||||
#
|
||||
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
||||
# or http://www.opensolaris.org/os/licensing.
|
||||
# See the License for the specific language governing permissions
|
||||
# and limitations under the License.
|
||||
#
|
||||
# When distributing Covered Code, include this CDDL HEADER in each
|
||||
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
||||
# If applicable, add the following below this CDDL HEADER, with the
|
||||
# fields enclosed by brackets "[]" replaced with your own identifying
|
||||
# information: Portions Copyright [yyyy] [name of copyright owner]
|
||||
#
|
||||
# CDDL HEADER END
|
||||
#
|
||||
|
||||
#
|
||||
# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
|
||||
# Use is subject to license terms.
|
||||
#
|
||||
# ident "%Z%%M% %I% %E% SMI"
|
||||
#
|
||||
|
||||
#
|
||||
# ASSERTION: HVM probes should enable successfully.
|
||||
#
|
||||
|
||||
if [ $# != 1 ]; then
|
||||
echo expected one argument: '<'dtrace-path'>'
|
||||
exit 2
|
||||
fi
|
||||
|
||||
#
|
||||
# Do not fail the test in a domU
|
||||
#
|
||||
if [ ! -c /dev/xen/privcmd ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
dtrace=$1
|
||||
|
||||
script()
|
||||
{
|
||||
$dtrace -qs /dev/stdin <<EOF
|
||||
dtrace:::BEGIN
|
||||
{
|
||||
exit(0);
|
||||
}
|
||||
|
||||
xdt:hvm::vmentry,
|
||||
xdt:hvm::vmexit
|
||||
{}
|
||||
EOF
|
||||
}
|
||||
|
||||
script
|
||||
status=$?
|
||||
|
||||
exit $status
|
65
cddl/contrib/opensolaris/cmd/dtrace/test/tst/i86xpv/xdt/tst.memenable.ksh
Executable file
65
cddl/contrib/opensolaris/cmd/dtrace/test/tst/i86xpv/xdt/tst.memenable.ksh
Executable file
@ -0,0 +1,65 @@
|
||||
#
|
||||
# CDDL HEADER START
|
||||
#
|
||||
# The contents of this file are subject to the terms of the
|
||||
# Common Development and Distribution License (the "License").
|
||||
# You may not use this file except in compliance with the License.
|
||||
#
|
||||
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
||||
# or http://www.opensolaris.org/os/licensing.
|
||||
# See the License for the specific language governing permissions
|
||||
# and limitations under the License.
|
||||
#
|
||||
# When distributing Covered Code, include this CDDL HEADER in each
|
||||
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
||||
# If applicable, add the following below this CDDL HEADER, with the
|
||||
# fields enclosed by brackets "[]" replaced with your own identifying
|
||||
# information: Portions Copyright [yyyy] [name of copyright owner]
|
||||
#
|
||||
# CDDL HEADER END
|
||||
#
|
||||
|
||||
#
|
||||
# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
|
||||
# Use is subject to license terms.
|
||||
#
|
||||
# ident "%Z%%M% %I% %E% SMI"
|
||||
#
|
||||
|
||||
#
|
||||
# ASSERTION: Mem probes should enable successfully.
|
||||
#
|
||||
|
||||
if [ $# != 1 ]; then
|
||||
echo expected one argument: '<'dtrace-path'>'
|
||||
exit 2
|
||||
fi
|
||||
|
||||
#
|
||||
# Do not fail the test in a domU
|
||||
#
|
||||
if [ ! -c /dev/xen/privcmd ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
dtrace=$1
|
||||
|
||||
script()
|
||||
{
|
||||
$dtrace -qs /dev/stdin <<EOF
|
||||
dtrace:::BEGIN
|
||||
{
|
||||
exit(0);
|
||||
}
|
||||
|
||||
xdt:mem::page-grant-map,
|
||||
xdt:mem::page-grant-unmap,
|
||||
xdt:mem::page-grant-transfer
|
||||
{}
|
||||
EOF
|
||||
}
|
||||
|
||||
script
|
||||
status=$?
|
||||
|
||||
exit $status
|
121
cddl/contrib/opensolaris/cmd/dtrace/test/tst/i86xpv/xdt/tst.schedargs.ksh
Executable file
121
cddl/contrib/opensolaris/cmd/dtrace/test/tst/i86xpv/xdt/tst.schedargs.ksh
Executable file
@ -0,0 +1,121 @@
|
||||
#
|
||||
# CDDL HEADER START
|
||||
#
|
||||
# The contents of this file are subject to the terms of the
|
||||
# Common Development and Distribution License (the "License").
|
||||
# You may not use this file except in compliance with the License.
|
||||
#
|
||||
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
||||
# or http://www.opensolaris.org/os/licensing.
|
||||
# See the License for the specific language governing permissions
|
||||
# and limitations under the License.
|
||||
#
|
||||
# When distributing Covered Code, include this CDDL HEADER in each
|
||||
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
||||
# If applicable, add the following below this CDDL HEADER, with the
|
||||
# fields enclosed by brackets "[]" replaced with your own identifying
|
||||
# information: Portions Copyright [yyyy] [name of copyright owner]
|
||||
#
|
||||
# CDDL HEADER END
|
||||
#
|
||||
|
||||
#
|
||||
# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
|
||||
# Use is subject to license terms.
|
||||
#
|
||||
|
||||
#
|
||||
# ASSERTION: Sched probe arguments should be valid.
|
||||
#
|
||||
|
||||
if [ $# != 1 ]; then
|
||||
echo expected one argument: '<'dtrace-path'>'
|
||||
exit 2
|
||||
fi
|
||||
|
||||
#
|
||||
# do not fail test in a domU
|
||||
#
|
||||
if [ ! -c /dev/xen/privcmd ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
dtrace=$1
|
||||
outf=/tmp/sched.args.$$
|
||||
|
||||
script()
|
||||
{
|
||||
$dtrace -c '/usr/bin/sleep 10' -o $outf -qs /dev/stdin <<EOF
|
||||
xdt:sched::off-cpu,
|
||||
xdt:sched::on-cpu,
|
||||
xdt:sched::block,
|
||||
xdt:sched::sleep,
|
||||
xdt:sched::wake,
|
||||
xdt:sched::yield
|
||||
{
|
||||
/* print domid vcpu pcpu probename */
|
||||
printf("%d %d %d %s\n", arg0, arg1, \`xdt_curpcpu, probename);
|
||||
}
|
||||
EOF
|
||||
}
|
||||
|
||||
validate()
|
||||
{
|
||||
/usr/bin/nawk '
|
||||
BEGIN {
|
||||
while (("/usr/sbin/xm vcpu-list" | getline)) {
|
||||
if ($1 != "Name") {
|
||||
domid = $2
|
||||
vcpu = $3
|
||||
|
||||
vcpumap[domid, vcpu] = 1
|
||||
|
||||
split($7, affinity, ",")
|
||||
for (i in affinity) {
|
||||
if (split(affinity[i], p, "-") > 1) {
|
||||
for (pcpu = p[1]; pcpu <= p[2];\
|
||||
pcpu++) {
|
||||
cpumap[domid, vcpu,
|
||||
pcpu] = 1
|
||||
}
|
||||
} else {
|
||||
cpumap[domid, vcpu,
|
||||
affinity[i]] = 1
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/^$/ { next }
|
||||
|
||||
/wake/ {
|
||||
if (vcpumap[$1, $2]) {
|
||||
next
|
||||
} else {
|
||||
print "error: " $0
|
||||
exit 1
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
if (cpumap[$1, $2, "any"] || cpumap[$1, $2, $3]) {
|
||||
next
|
||||
} else {
|
||||
print "error: " $0
|
||||
exit 1
|
||||
}
|
||||
}
|
||||
' $outf
|
||||
}
|
||||
|
||||
script
|
||||
status=$?
|
||||
|
||||
if [ $status == 0 ]; then
|
||||
validate
|
||||
status=$?
|
||||
fi
|
||||
|
||||
rm $outf
|
||||
exit $status
|
74
cddl/contrib/opensolaris/cmd/dtrace/test/tst/i86xpv/xdt/tst.schedenable.ksh
Executable file
74
cddl/contrib/opensolaris/cmd/dtrace/test/tst/i86xpv/xdt/tst.schedenable.ksh
Executable file
@ -0,0 +1,74 @@
|
||||
#
|
||||
# CDDL HEADER START
|
||||
#
|
||||
# The contents of this file are subject to the terms of the
|
||||
# Common Development and Distribution License (the "License").
|
||||
# You may not use this file except in compliance with the License.
|
||||
#
|
||||
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
||||
# or http://www.opensolaris.org/os/licensing.
|
||||
# See the License for the specific language governing permissions
|
||||
# and limitations under the License.
|
||||
#
|
||||
# When distributing Covered Code, include this CDDL HEADER in each
|
||||
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
||||
# If applicable, add the following below this CDDL HEADER, with the
|
||||
# fields enclosed by brackets "[]" replaced with your own identifying
|
||||
# information: Portions Copyright [yyyy] [name of copyright owner]
|
||||
#
|
||||
# CDDL HEADER END
|
||||
#
|
||||
|
||||
#
|
||||
# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
|
||||
# Use is subject to license terms.
|
||||
#
|
||||
# ident "%Z%%M% %I% %E% SMI"
|
||||
#
|
||||
|
||||
#
|
||||
# ASSERTION: Sched probes should enable successfully.
|
||||
#
|
||||
|
||||
if [ $# != 1 ]; then
|
||||
echo expected one argument: '<'dtrace-path'>'
|
||||
exit 2
|
||||
fi
|
||||
|
||||
#
|
||||
# do not fail test in a domU
|
||||
#
|
||||
if [ ! -c /dev/xen/privcmd ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
dtrace=$1
|
||||
|
||||
script()
|
||||
{
|
||||
$dtrace -qs /dev/stdin <<EOF
|
||||
dtrace:::BEGIN
|
||||
{
|
||||
exit(0);
|
||||
}
|
||||
|
||||
xdt:sched::off-cpu,
|
||||
xdt:sched::on-cpu,
|
||||
xdt:sched::idle-off-cpu,
|
||||
xdt:sched::idle-on-cpu,
|
||||
xdt:sched::block,
|
||||
xdt:sched::sleep,
|
||||
xdt:sched::wake,
|
||||
xdt:sched::yield,
|
||||
xdt:sched::shutdown-poweroff,
|
||||
xdt:sched::shutdown-reboot,
|
||||
xdt:sched::shutdown-suspend,
|
||||
xdt:sched::shutdown-crash
|
||||
{}
|
||||
EOF
|
||||
}
|
||||
|
||||
script
|
||||
status=$?
|
||||
|
||||
exit $status
|
@ -0,0 +1,29 @@
|
||||
#!/bin/ksh
|
||||
#
|
||||
# CDDL HEADER START
|
||||
#
|
||||
# The contents of this file are subject to the terms of the
|
||||
# Common Development and Distribution License (the "License").
|
||||
# You may not use this file except in compliance with the License.
|
||||
#
|
||||
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
||||
# or http://www.opensolaris.org/os/licensing.
|
||||
# See the License for the specific language governing permissions
|
||||
# and limitations under the License.
|
||||
#
|
||||
# When distributing Covered Code, include this CDDL HEADER in each
|
||||
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
||||
# If applicable, add the following below this CDDL HEADER, with the
|
||||
# fields enclosed by brackets "[]" replaced with your own identifying
|
||||
# information: Portions Copyright [yyyy] [name of copyright owner]
|
||||
#
|
||||
# CDDL HEADER END
|
||||
#
|
||||
|
||||
#
|
||||
# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
|
||||
# Use is subject to license terms.
|
||||
#
|
||||
#ident "%Z%%M% %I% %E% SMI"
|
||||
|
||||
sleep 1000000
|
@ -19,13 +19,10 @@
|
||||
* CDDL HEADER END
|
||||
*/
|
||||
/*
|
||||
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
|
||||
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
|
||||
* Use is subject to license terms.
|
||||
*/
|
||||
|
||||
#pragma ident "%Z%%M% %I% %E% SMI"
|
||||
|
||||
|
||||
/*
|
||||
* AVL - generic AVL tree implementation for kernel use
|
||||
*
|
||||
@ -243,7 +240,7 @@ avl_nearest(avl_tree_t *tree, avl_index_t where, int direction)
|
||||
* "void *" of the found tree node
|
||||
*/
|
||||
void *
|
||||
avl_find(avl_tree_t *tree, void *value, avl_index_t *where)
|
||||
avl_find(avl_tree_t *tree, const void *value, avl_index_t *where)
|
||||
{
|
||||
avl_node_t *node;
|
||||
avl_node_t *prev = NULL;
|
||||
@ -808,6 +805,64 @@ avl_remove(avl_tree_t *tree, void *data)
|
||||
} while (parent != NULL);
|
||||
}
|
||||
|
||||
#define AVL_REINSERT(tree, obj) \
|
||||
avl_remove((tree), (obj)); \
|
||||
avl_add((tree), (obj))
|
||||
|
||||
boolean_t
|
||||
avl_update_lt(avl_tree_t *t, void *obj)
|
||||
{
|
||||
void *neighbor;
|
||||
|
||||
ASSERT(((neighbor = AVL_NEXT(t, obj)) == NULL) ||
|
||||
(t->avl_compar(obj, neighbor) <= 0));
|
||||
|
||||
neighbor = AVL_PREV(t, obj);
|
||||
if ((neighbor != NULL) && (t->avl_compar(obj, neighbor) < 0)) {
|
||||
AVL_REINSERT(t, obj);
|
||||
return (B_TRUE);
|
||||
}
|
||||
|
||||
return (B_FALSE);
|
||||
}
|
||||
|
||||
boolean_t
|
||||
avl_update_gt(avl_tree_t *t, void *obj)
|
||||
{
|
||||
void *neighbor;
|
||||
|
||||
ASSERT(((neighbor = AVL_PREV(t, obj)) == NULL) ||
|
||||
(t->avl_compar(obj, neighbor) >= 0));
|
||||
|
||||
neighbor = AVL_NEXT(t, obj);
|
||||
if ((neighbor != NULL) && (t->avl_compar(obj, neighbor) > 0)) {
|
||||
AVL_REINSERT(t, obj);
|
||||
return (B_TRUE);
|
||||
}
|
||||
|
||||
return (B_FALSE);
|
||||
}
|
||||
|
||||
boolean_t
|
||||
avl_update(avl_tree_t *t, void *obj)
|
||||
{
|
||||
void *neighbor;
|
||||
|
||||
neighbor = AVL_PREV(t, obj);
|
||||
if ((neighbor != NULL) && (t->avl_compar(obj, neighbor) < 0)) {
|
||||
AVL_REINSERT(t, obj);
|
||||
return (B_TRUE);
|
||||
}
|
||||
|
||||
neighbor = AVL_NEXT(t, obj);
|
||||
if ((neighbor != NULL) && (t->avl_compar(obj, neighbor) > 0)) {
|
||||
AVL_REINSERT(t, obj);
|
||||
return (B_TRUE);
|
||||
}
|
||||
|
||||
return (B_FALSE);
|
||||
}
|
||||
|
||||
/*
|
||||
* initialize a new AVL tree
|
||||
*/
|
||||
@ -853,6 +908,12 @@ avl_numnodes(avl_tree_t *tree)
|
||||
return (tree->avl_numnodes);
|
||||
}
|
||||
|
||||
boolean_t
|
||||
avl_is_empty(avl_tree_t *tree)
|
||||
{
|
||||
ASSERT(tree);
|
||||
return (tree->avl_numnodes == 0);
|
||||
}
|
||||
|
||||
#define CHILDBIT (1L)
|
||||
|
||||
|
@ -2,9 +2,8 @@
|
||||
* CDDL HEADER START
|
||||
*
|
||||
* The contents of this file are subject to the terms of the
|
||||
* Common Development and Distribution License, Version 1.0 only
|
||||
* (the "License"). You may not use this file except in compliance
|
||||
* with the License.
|
||||
* Common Development and Distribution License (the "License").
|
||||
* You may not use this file except in compliance with the License.
|
||||
*
|
||||
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
||||
* or http://www.opensolaris.org/os/licensing.
|
||||
@ -20,12 +19,10 @@
|
||||
* CDDL HEADER END
|
||||
*/
|
||||
/*
|
||||
* Copyright 2005 Sun Microsystems, Inc. All rights reserved.
|
||||
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
|
||||
* Use is subject to license terms.
|
||||
*/
|
||||
|
||||
#pragma ident "%Z%%M% %I% %E% SMI"
|
||||
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <dlfcn.h>
|
||||
@ -61,13 +58,14 @@ static const char *olddevname = "/devices/pseudo/dtrace@0:helper";
|
||||
static const char *modname; /* Name of this load object */
|
||||
static int gen; /* DOF helper generation */
|
||||
extern dof_hdr_t __SUNW_dof; /* DOF defined in the .SUNW_dof section */
|
||||
static boolean_t dof_init_debug = B_FALSE; /* From DTRACE_DOF_INIT_DEBUG */
|
||||
|
||||
static void
|
||||
dprintf(int debug, const char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
if (debug && getenv("DTRACE_DOF_INIT_DEBUG") == NULL)
|
||||
if (debug && !dof_init_debug)
|
||||
return;
|
||||
|
||||
va_start(ap, fmt);
|
||||
@ -114,6 +112,9 @@ dtrace_dof_init(void)
|
||||
if (getenv("DTRACE_DOF_INIT_DISABLE") != NULL)
|
||||
return;
|
||||
|
||||
if (getenv("DTRACE_DOF_INIT_DEBUG") != NULL)
|
||||
dof_init_debug = B_TRUE;
|
||||
|
||||
if (dlinfo(RTLD_SELF, RTLD_DI_LINKMAP, &lmp) == -1 || lmp == NULL) {
|
||||
dprintf(1, "couldn't discover module name or address\n");
|
||||
return;
|
||||
|
@ -20,12 +20,9 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
|
||||
* Use is subject to license terms.
|
||||
* Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
*/
|
||||
|
||||
#pragma ident "%Z%%M% %I% %E% SMI"
|
||||
|
||||
/*
|
||||
* DTrace D Language Compiler
|
||||
*
|
||||
@ -2165,11 +2162,11 @@ dt_compile(dtrace_hdl_t *dtp, int context, dtrace_probespec_t pspec, void *arg,
|
||||
if (dt_list_next(&dtp->dt_lib_path) != NULL && dt_load_libs(dtp) != 0)
|
||||
return (NULL); /* errno is set for us */
|
||||
|
||||
(void) ctf_discard(dtp->dt_cdefs->dm_ctfp);
|
||||
(void) ctf_discard(dtp->dt_ddefs->dm_ctfp);
|
||||
if (dtp->dt_globals->dh_nelems != 0)
|
||||
(void) dt_idhash_iter(dtp->dt_globals, dt_idreset, NULL);
|
||||
|
||||
(void) dt_idhash_iter(dtp->dt_globals, dt_idreset, NULL);
|
||||
(void) dt_idhash_iter(dtp->dt_tls, dt_idreset, NULL);
|
||||
if (dtp->dt_tls->dh_nelems != 0)
|
||||
(void) dt_idhash_iter(dtp->dt_tls, dt_idreset, NULL);
|
||||
|
||||
if (fp && (cflags & DTRACE_C_CPP) && (fp = dt_preproc(dtp, fp)) == NULL)
|
||||
return (NULL); /* errno is set for us */
|
||||
|
@ -19,12 +19,10 @@
|
||||
* CDDL HEADER END
|
||||
*/
|
||||
/*
|
||||
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
|
||||
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
|
||||
* Use is subject to license terms.
|
||||
*/
|
||||
|
||||
#pragma ident "%Z%%M% %I% %E% SMI"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <strings.h>
|
||||
#include <errno.h>
|
||||
@ -1085,7 +1083,7 @@ dt_print_usym(dtrace_hdl_t *dtp, FILE *fp, caddr_t addr, dtrace_actkind_t act)
|
||||
do {
|
||||
n = len;
|
||||
s = alloca(n);
|
||||
} while ((len = dtrace_uaddr2str(dtp, pid, pc, s, n)) >= n);
|
||||
} while ((len = dtrace_uaddr2str(dtp, pid, pc, s, n)) > n);
|
||||
|
||||
return (dt_printf(dtp, fp, format, s));
|
||||
}
|
||||
|
@ -20,12 +20,9 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
|
||||
* Use is subject to license terms.
|
||||
* Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
*/
|
||||
|
||||
#pragma ident "%Z%%M% %I% %E% SMI"
|
||||
|
||||
#include <sys/types.h>
|
||||
#if defined(sun)
|
||||
#include <sys/sysmacros.h>
|
||||
@ -838,7 +835,6 @@ dtrace_dof_create(dtrace_hdl_t *dtp, dtrace_prog_t *pgp, uint_t flags)
|
||||
*/
|
||||
h.dofh_secnum = ddo->ddo_nsecs;
|
||||
ssize = sizeof (h) + dt_buf_len(&ddo->ddo_secs);
|
||||
assert(ssize == sizeof (h) + sizeof (dof_sec_t) * ddo->ddo_nsecs);
|
||||
|
||||
h.dofh_loadsz = ssize +
|
||||
dt_buf_len(&ddo->ddo_ldata) +
|
||||
@ -864,6 +860,7 @@ dtrace_dof_create(dtrace_hdl_t *dtp, dtrace_prog_t *pgp, uint_t flags)
|
||||
|
||||
sp = dt_buf_ptr(&ddo->ddo_secs);
|
||||
assert(sp[ddo->ddo_strsec].dofs_type == DOF_SECT_STRTAB);
|
||||
assert(ssize == sizeof (h) + sizeof (dof_sec_t) * ddo->ddo_nsecs);
|
||||
|
||||
sp[ddo->ddo_strsec].dofs_offset = ssize + dt_buf_len(&ddo->ddo_ldata);
|
||||
sp[ddo->ddo_strsec].dofs_size = dt_buf_len(&ddo->ddo_strs);
|
||||
|
@ -19,12 +19,10 @@
|
||||
* CDDL HEADER END
|
||||
*/
|
||||
/*
|
||||
* Copyright 2007 Sun Microsystems, Inc. All rights reserved.
|
||||
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
|
||||
* Use is subject to license terms.
|
||||
*/
|
||||
|
||||
#pragma ident "%Z%%M% %I% %E% SMI"
|
||||
|
||||
#include <string.h>
|
||||
#include <strings.h>
|
||||
#include <dt_impl.h>
|
||||
@ -106,7 +104,8 @@ static const struct {
|
||||
{ EDT_BADSETOPT, "Invalid setopt() library action" },
|
||||
{ EDT_BADSTACKPC, "Invalid stack program counter size" },
|
||||
{ EDT_BADAGGVAR, "Invalid aggregation variable identifier" },
|
||||
{ EDT_OVERSION, "Client requested deprecated version of library" }
|
||||
{ EDT_OVERSION, "Client requested deprecated version of library" },
|
||||
{ EDT_ENABLING_ERR, "Failed to enable probe" }
|
||||
};
|
||||
|
||||
static const int _dt_nerr = sizeof (_dt_errlist) / sizeof (_dt_errlist[0]);
|
||||
|
@ -20,15 +20,13 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
|
||||
* Copyright 2010 Sun Microsystems, Inc. All rights reserved.
|
||||
* Use is subject to license terms.
|
||||
*/
|
||||
|
||||
#ifndef _DT_IMPL_H
|
||||
#define _DT_IMPL_H
|
||||
|
||||
#pragma ident "%Z%%M% %I% %E% SMI"
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/objfs.h>
|
||||
#if !defined(sun)
|
||||
@ -42,6 +40,9 @@
|
||||
#include <libctf.h>
|
||||
#include <dtrace.h>
|
||||
#include <gelf.h>
|
||||
#if defined(sun)
|
||||
#include <synch.h>
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@ -519,7 +520,8 @@ enum {
|
||||
EDT_BADSETOPT, /* invalid setopt library action */
|
||||
EDT_BADSTACKPC, /* invalid stack program counter size */
|
||||
EDT_BADAGGVAR, /* invalid aggregation variable identifier */
|
||||
EDT_OVERSION /* client is requesting deprecated version */
|
||||
EDT_OVERSION, /* client is requesting deprecated version */
|
||||
EDT_ENABLING_ERR /* failed to enable probe */
|
||||
};
|
||||
|
||||
/*
|
||||
@ -599,17 +601,8 @@ extern int dt_buffered_flush(dtrace_hdl_t *, dtrace_probedata_t *,
|
||||
extern void dt_buffered_disable(dtrace_hdl_t *);
|
||||
extern void dt_buffered_destroy(dtrace_hdl_t *);
|
||||
|
||||
extern int dt_rw_read_held(pthread_rwlock_t *);
|
||||
extern int dt_rw_write_held(pthread_rwlock_t *);
|
||||
extern int dt_mutex_held(pthread_mutex_t *);
|
||||
|
||||
extern uint64_t dt_stddev(uint64_t *, uint64_t);
|
||||
|
||||
#define DT_RW_READ_HELD(x) dt_rw_read_held(x)
|
||||
#define DT_RW_WRITE_HELD(x) dt_rw_write_held(x)
|
||||
#define DT_RW_LOCK_HELD(x) (DT_RW_READ_HELD(x) || DT_RW_WRITE_HELD(x))
|
||||
#define DT_MUTEX_HELD(x) dt_mutex_held(x)
|
||||
|
||||
extern int dt_options_load(dtrace_hdl_t *);
|
||||
|
||||
extern void dt_dprintf(const char *, ...);
|
||||
|
@ -18,12 +18,11 @@
|
||||
* information: Portions Copyright [yyyy] [name of copyright owner]
|
||||
*
|
||||
* CDDL HEADER END
|
||||
*
|
||||
* Copyright 2007 Sun Microsystems, Inc. All rights reserved.
|
||||
* Use is subject to license terms.
|
||||
*/
|
||||
|
||||
#pragma ident "%Z%%M% %I% %E% SMI"
|
||||
/*
|
||||
* Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
@ -839,7 +838,7 @@ input(void)
|
||||
else if (yypcb->pcb_fileptr != NULL)
|
||||
c = fgetc(yypcb->pcb_fileptr);
|
||||
else if (yypcb->pcb_strptr < yypcb->pcb_string + yypcb->pcb_strlen)
|
||||
c = *yypcb->pcb_strptr++;
|
||||
c = *(unsigned char *)(yypcb->pcb_strptr++);
|
||||
else
|
||||
c = EOF;
|
||||
|
||||
|
@ -18,12 +18,10 @@
|
||||
*
|
||||
* CDDL HEADER END
|
||||
*/
|
||||
/*
|
||||
* Copyright 2007 Sun Microsystems, Inc. All rights reserved.
|
||||
* Use is subject to license terms.
|
||||
*/
|
||||
|
||||
#pragma ident "%Z%%M% %I% %E% SMI"
|
||||
/*
|
||||
* Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
#if defined(sun)
|
||||
@ -77,6 +75,10 @@ dt_module_symhash_insert(dt_module_t *dmp, const char *name, uint_t id)
|
||||
static uint_t
|
||||
dt_module_syminit32(dt_module_t *dmp)
|
||||
{
|
||||
#if STT_NUM != (STT_TLS + 1)
|
||||
#error "STT_NUM has grown. update dt_module_syminit32()"
|
||||
#endif
|
||||
|
||||
Elf32_Sym *sym = dmp->dm_symtab.cts_data;
|
||||
const char *base = dmp->dm_strtab.cts_data;
|
||||
size_t ss_size = dmp->dm_strtab.cts_size;
|
||||
@ -123,6 +125,10 @@ dt_module_syminit32(dt_module_t *dmp)
|
||||
static uint_t
|
||||
dt_module_syminit64(dt_module_t *dmp)
|
||||
{
|
||||
#if STT_NUM != (STT_TLS + 1)
|
||||
#error "STT_NUM has grown. update dt_module_syminit64()"
|
||||
#endif
|
||||
|
||||
Elf64_Sym *sym = dmp->dm_symtab.cts_data;
|
||||
const char *base = dmp->dm_strtab.cts_data;
|
||||
size_t ss_size = dmp->dm_strtab.cts_size;
|
||||
@ -512,7 +518,7 @@ dt_module_load_sect(dtrace_hdl_t *dtp, dt_module_t *dmp, ctf_sect_t *ctsp)
|
||||
Elf_Data *dp;
|
||||
Elf_Scn *sp;
|
||||
|
||||
if (elf_getshstrndx(dmp->dm_elf, &shstrs) == 0)
|
||||
if (elf_getshdrstrndx(dmp->dm_elf, &shstrs) == -1)
|
||||
return (dt_set_errno(dtp, EDT_NOTLOADED));
|
||||
|
||||
for (sp = NULL; (sp = elf_nextscn(dmp->dm_elf, sp)) != NULL; ) {
|
||||
@ -778,10 +784,25 @@ dt_module_unload(dtrace_hdl_t *dtp, dt_module_t *dmp)
|
||||
void
|
||||
dt_module_destroy(dtrace_hdl_t *dtp, dt_module_t *dmp)
|
||||
{
|
||||
uint_t h = dt_strtab_hash(dmp->dm_name, NULL) % dtp->dt_modbuckets;
|
||||
dt_module_t **dmpp = &dtp->dt_mods[h];
|
||||
|
||||
dt_list_delete(&dtp->dt_modlist, dmp);
|
||||
assert(dtp->dt_nmods != 0);
|
||||
dtp->dt_nmods--;
|
||||
|
||||
/*
|
||||
* Now remove this module from its hash chain. We expect to always
|
||||
* find the module on its hash chain, so in this loop we assert that
|
||||
* we don't run off the end of the list.
|
||||
*/
|
||||
while (*dmpp != dmp) {
|
||||
dmpp = &((*dmpp)->dm_next);
|
||||
assert(*dmpp != NULL);
|
||||
}
|
||||
|
||||
*dmpp = dmp->dm_next;
|
||||
|
||||
dt_module_unload(dtp, dmp);
|
||||
free(dmp);
|
||||
}
|
||||
@ -903,7 +924,7 @@ dt_module_update(dtrace_hdl_t *dtp, struct kld_file_stat *k_stat)
|
||||
(void) close(fd);
|
||||
|
||||
if (dmp->dm_elf == NULL || err == -1 ||
|
||||
elf_getshstrndx(dmp->dm_elf, &shstrs) == 0) {
|
||||
elf_getshdrstrndx(dmp->dm_elf, &shstrs) == -1) {
|
||||
dt_dprintf("failed to load %s: %s\n",
|
||||
fname, elf_errmsg(elf_errno()));
|
||||
dt_module_destroy(dtp, dmp);
|
||||
|
@ -20,12 +20,9 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
|
||||
* Use is subject to license terms.
|
||||
* Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
*/
|
||||
|
||||
#pragma ident "%Z%%M% %I% %E% SMI"
|
||||
|
||||
#include <sys/types.h>
|
||||
#if defined(sun)
|
||||
#include <sys/modctl.h>
|
||||
@ -116,8 +113,9 @@
|
||||
#define DT_VERS_1_6 DT_VERSION_NUMBER(1, 6, 0)
|
||||
#define DT_VERS_1_6_1 DT_VERSION_NUMBER(1, 6, 1)
|
||||
#define DT_VERS_1_6_2 DT_VERSION_NUMBER(1, 6, 2)
|
||||
#define DT_VERS_LATEST DT_VERS_1_6_2
|
||||
#define DT_VERS_STRING "Sun D 1.6.2"
|
||||
#define DT_VERS_1_6_3 DT_VERSION_NUMBER(1, 6, 3)
|
||||
#define DT_VERS_LATEST DT_VERS_1_6_3
|
||||
#define DT_VERS_STRING "Sun D 1.6.3"
|
||||
|
||||
const dt_version_t _dtrace_versions[] = {
|
||||
DT_VERS_1_0, /* D API 1.0.0 (PSARC 2001/466) Solaris 10 FCS */
|
||||
@ -132,6 +130,7 @@ const dt_version_t _dtrace_versions[] = {
|
||||
DT_VERS_1_6, /* D API 1.6 */
|
||||
DT_VERS_1_6_1, /* D API 1.6.1 */
|
||||
DT_VERS_1_6_2, /* D API 1.6.2 */
|
||||
DT_VERS_1_6_3, /* D API 1.6.3 */
|
||||
0
|
||||
};
|
||||
|
||||
|
@ -20,12 +20,10 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
|
||||
* Copyright 2010 Sun Microsystems, Inc. All rights reserved.
|
||||
* Use is subject to license terms.
|
||||
*/
|
||||
|
||||
#pragma ident "%Z%%M% %I% %E% SMI"
|
||||
|
||||
#include <assert.h>
|
||||
#include <strings.h>
|
||||
#include <stdlib.h>
|
||||
@ -443,7 +441,12 @@ dt_pid_mod_filt(void *arg, const prmap_t *pmp, const char *obj)
|
||||
else
|
||||
pp->dpp_obj++;
|
||||
|
||||
dt_pid_objname(name, sizeof (name), pp->dpp_lmid, obj);
|
||||
if (gmatch(pp->dpp_obj, pp->dpp_mod))
|
||||
return (dt_pid_per_mod(pp, pmp, obj));
|
||||
|
||||
(void) Plmid(pp->dpp_pr, pmp->pr_vaddr, &pp->dpp_lmid);
|
||||
|
||||
dt_pid_objname(name, sizeof (name), pp->dpp_lmid, pp->dpp_obj);
|
||||
|
||||
if (gmatch(name, pp->dpp_mod))
|
||||
return (dt_pid_per_mod(pp, pmp, obj));
|
||||
@ -673,7 +676,7 @@ dt_pid_create_usdt_probes(dtrace_probedesc_t *pdp, dtrace_hdl_t *dtp,
|
||||
struct ps_prochandle *P = dpr->dpr_proc;
|
||||
int ret = 0;
|
||||
|
||||
assert(DT_MUTEX_HELD(&dpr->dpr_lock));
|
||||
assert(MUTEX_HELD(&dpr->dpr_lock));
|
||||
|
||||
#ifdef DOODAD
|
||||
(void) Pupdate_maps(P);
|
||||
|
@ -20,12 +20,9 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
|
||||
* Use is subject to license terms.
|
||||
* Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
*/
|
||||
|
||||
#pragma ident "%Z%%M% %I% %E% SMI"
|
||||
|
||||
#if defined(sun)
|
||||
#include <sys/sysmacros.h>
|
||||
#else
|
||||
@ -41,6 +38,11 @@
|
||||
#include <ctype.h>
|
||||
#include <errno.h>
|
||||
#include <limits.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netdb.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <arpa/nameser.h>
|
||||
|
||||
#include <dt_printf.h>
|
||||
#include <dt_string.h>
|
||||
@ -339,7 +341,7 @@ pfprint_addr(dtrace_hdl_t *dtp, FILE *fp, const char *format,
|
||||
do {
|
||||
n = len;
|
||||
s = alloca(n);
|
||||
} while ((len = dtrace_addr2str(dtp, val, s, n)) >= n);
|
||||
} while ((len = dtrace_addr2str(dtp, val, s, n)) > n);
|
||||
|
||||
return (dt_printf(dtp, fp, format, s));
|
||||
}
|
||||
@ -392,7 +394,7 @@ pfprint_uaddr(dtrace_hdl_t *dtp, FILE *fp, const char *format,
|
||||
do {
|
||||
n = len;
|
||||
s = alloca(n);
|
||||
} while ((len = dtrace_uaddr2str(dtp, pid, val, s, n)) >= n);
|
||||
} while ((len = dtrace_uaddr2str(dtp, pid, val, s, n)) > n);
|
||||
|
||||
return (dt_printf(dtp, fp, format, s));
|
||||
}
|
||||
@ -505,6 +507,58 @@ pfprint_time822(dtrace_hdl_t *dtp, FILE *fp, const char *format,
|
||||
return (dt_printf(dtp, fp, format, buf));
|
||||
}
|
||||
|
||||
/*ARGSUSED*/
|
||||
static int
|
||||
pfprint_port(dtrace_hdl_t *dtp, FILE *fp, const char *format,
|
||||
const dt_pfargd_t *pfd, const void *addr, size_t size, uint64_t normal)
|
||||
{
|
||||
uint16_t port = htons(*((uint16_t *)addr));
|
||||
char buf[256];
|
||||
struct servent *sv, res;
|
||||
|
||||
#if defined(sun)
|
||||
if ((sv = getservbyport_r(port, NULL, &res, buf, sizeof (buf))) != NULL)
|
||||
#else
|
||||
if (getservbyport_r(port, NULL, &res, buf, sizeof (buf), &sv) > 0)
|
||||
#endif
|
||||
return (dt_printf(dtp, fp, format, sv->s_name));
|
||||
|
||||
(void) snprintf(buf, sizeof (buf), "%d", *((uint16_t *)addr));
|
||||
return (dt_printf(dtp, fp, format, buf));
|
||||
}
|
||||
|
||||
/*ARGSUSED*/
|
||||
static int
|
||||
pfprint_inetaddr(dtrace_hdl_t *dtp, FILE *fp, const char *format,
|
||||
const dt_pfargd_t *pfd, const void *addr, size_t size, uint64_t normal)
|
||||
{
|
||||
char *s = alloca(size + 1);
|
||||
struct hostent *host, res;
|
||||
char inetaddr[NS_IN6ADDRSZ];
|
||||
char buf[1024];
|
||||
int e;
|
||||
|
||||
bcopy(addr, s, size);
|
||||
s[size] = '\0';
|
||||
|
||||
if (strchr(s, ':') == NULL && inet_pton(AF_INET, s, inetaddr) != -1) {
|
||||
#if defined(sun)
|
||||
if ((host = gethostbyaddr_r(inetaddr, NS_INADDRSZ,
|
||||
AF_INET, &res, buf, sizeof (buf), &e)) != NULL)
|
||||
#else
|
||||
if (gethostbyaddr_r(inetaddr, NS_INADDRSZ,
|
||||
AF_INET, &res, buf, sizeof (buf), &host, &e) > 0)
|
||||
#endif
|
||||
return (dt_printf(dtp, fp, format, host->h_name));
|
||||
} else if (inet_pton(AF_INET6, s, inetaddr) != -1) {
|
||||
if ((host = getipnodebyaddr(inetaddr, NS_IN6ADDRSZ,
|
||||
AF_INET6, &e)) != NULL)
|
||||
return (dt_printf(dtp, fp, format, host->h_name));
|
||||
}
|
||||
|
||||
return (dt_printf(dtp, fp, format, s));
|
||||
}
|
||||
|
||||
/*ARGSUSED*/
|
||||
static int
|
||||
pfprint_cstr(dtrace_hdl_t *dtp, FILE *fp, const char *format,
|
||||
@ -610,6 +664,7 @@ static const dt_pfconv_t _dtrace_conversions[] = {
|
||||
{ "hx", "x", "short", pfcheck_xshort, pfprint_uint },
|
||||
{ "hX", "X", "short", pfcheck_xshort, pfprint_uint },
|
||||
{ "i", "i", pfproto_xint, pfcheck_dint, pfprint_dint },
|
||||
{ "I", "s", pfproto_cstr, pfcheck_str, pfprint_inetaddr },
|
||||
{ "k", "s", "stack", pfcheck_stack, pfprint_stack },
|
||||
{ "lc", "lc", "int", pfcheck_type, pfprint_sint }, /* a.k.a. wint_t */
|
||||
{ "ld", "d", "long", pfcheck_type, pfprint_sint },
|
||||
@ -632,6 +687,7 @@ static const dt_pfconv_t _dtrace_conversions[] = {
|
||||
{ "LG", "G", "long double", pfcheck_type, pfprint_fp },
|
||||
{ "o", "o", pfproto_xint, pfcheck_xint, pfprint_uint },
|
||||
{ "p", "x", pfproto_addr, pfcheck_addr, pfprint_uint },
|
||||
{ "P", "s", "uint16_t", pfcheck_type, pfprint_port },
|
||||
{ "s", "s", "char [] or string (or use stringof)", pfcheck_str, pfprint_cstr },
|
||||
{ "S", "s", pfproto_cstr, pfcheck_str, pfprint_estr },
|
||||
{ "T", "s", "int64_t", pfcheck_time, pfprint_time822 },
|
||||
@ -1236,6 +1292,20 @@ pfprint_average(dtrace_hdl_t *dtp, FILE *fp, const char *format,
|
||||
data[0] ? data[1] / normal / data[0] : 0));
|
||||
}
|
||||
|
||||
/*ARGSUSED*/
|
||||
static int
|
||||
pfprint_stddev(dtrace_hdl_t *dtp, FILE *fp, const char *format,
|
||||
const dt_pfargd_t *pfd, const void *addr, size_t size, uint64_t normal)
|
||||
{
|
||||
const uint64_t *data = addr;
|
||||
|
||||
if (size != sizeof (uint64_t) * 4)
|
||||
return (dt_set_errno(dtp, EDT_DMISMATCH));
|
||||
|
||||
return (dt_printf(dtp, fp, format,
|
||||
dt_stddev((uint64_t *)data, normal)));
|
||||
}
|
||||
|
||||
/*ARGSUSED*/
|
||||
static int
|
||||
pfprint_quantize(dtrace_hdl_t *dtp, FILE *fp, const char *format,
|
||||
@ -1428,6 +1498,9 @@ dt_printf_format(dtrace_hdl_t *dtp, FILE *fp, const dt_pfargv_t *pfv,
|
||||
case DTRACEAGG_AVG:
|
||||
func = pfprint_average;
|
||||
break;
|
||||
case DTRACEAGG_STDDEV:
|
||||
func = pfprint_stddev;
|
||||
break;
|
||||
case DTRACEAGG_QUANTIZE:
|
||||
func = pfprint_quantize;
|
||||
break;
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user