14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync#
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync# CDDL HEADER START
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync#
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync# The contents of this file are subject to the terms of the
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync# Common Development and Distribution License (the "License").
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync# You may not use this file except in compliance with the License.
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync#
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync# or http://www.opensolaris.org/os/licensing.
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync# See the License for the specific language governing permissions
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync# and limitations under the License.
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync#
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync# When distributing Covered Code, include this CDDL HEADER in each
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync# If applicable, add the following below this CDDL HEADER, with the
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync# fields enclosed by brackets "[]" replaced with your own identifying
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync# information: Portions Copyright [yyyy] [name of copyright owner]
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync#
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync# CDDL HEADER END
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync#
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync#
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync# Use is subject to license terms.
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync#
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync#ident "%Z%%M% %I% %E% SMI"
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsyncif [ $# != 1 ]; then
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync echo expected one argument: '<'dtrace-path'>'
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync exit 2
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsyncfi
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsyncfile=out.$$
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsyncdtrace=$1
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsyncrm -f $file
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync$dtrace -o $file -c date -s /dev/stdin <<EOF
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync #pragma D option quiet
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync #pragma D option bufsize=1M
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync #pragma D option bufpolicy=fill
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync pid\$target:::entry,
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync pid\$target:::return,
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync pid\$target:a.out::,
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync syscall:::return,
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync profile:::profile-997
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync /pid == \$target/
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync {
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync printf("START %s:%s:%s:%s\n",
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync probeprov, probemod, probefunc, probename);
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync trace(ustackdepth);
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync ustack(100);
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync trace("END\n");
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync }
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync tick-1sec
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync /n++ == 10/
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync {
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync trace("test timed out...");
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync exit(1);
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync }
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsyncEOF
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsyncstatus=$?
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsyncif [ "$status" -ne 0 ]; then
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync echo $tst: dtrace failed
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync exit $status
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsyncfi
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsyncperl /dev/stdin $file <<EOF
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync while (<>) {
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync chomp;
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync last if /^\$/;
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync die "expected START at \$.\n" unless /^START/;
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync \$_ = <>;
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync chomp;
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync die "expected depth (\$_) at \$.\n" unless /^(\d+)\$/;
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync \$depth = \$1;
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync for (\$i = 0; \$i < \$depth; \$i++) {
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync \$_ = <>;
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync chomp;
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync die "unexpected END at \$.\n" if /^END/;
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync }
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync \$_ = <>;
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync chomp;
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync die "expected END at \$.\n" unless /^END\$/;
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync }
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsyncEOF
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsyncstatus=$?
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsynccount=`wc -l $file | cut -f1 -do`
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsyncif [ "$count" -lt 1000 ]; then
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync echo $tst: output was too short
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync status=1
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsyncfi
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsyncif [ "$status" -eq 0 ]; then
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync rm -f $file
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsyncfi
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsyncexit $status