1c2580b9jhaslam#!/bin/ksh -p
2c2580b9jhaslam#
3c2580b9jhaslam# CDDL HEADER START
4c2580b9jhaslam#
5c2580b9jhaslam# The contents of this file are subject to the terms of the
6c2580b9jhaslam# Common Development and Distribution License (the "License").
7c2580b9jhaslam# You may not use this file except in compliance with the License.
8c2580b9jhaslam#
9c2580b9jhaslam# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10c2580b9jhaslam# or http://www.opensolaris.org/os/licensing.
11c2580b9jhaslam# See the License for the specific language governing permissions
12c2580b9jhaslam# and limitations under the License.
13c2580b9jhaslam#
14c2580b9jhaslam# When distributing Covered Code, include this CDDL HEADER in each
15c2580b9jhaslam# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16c2580b9jhaslam# If applicable, add the following below this CDDL HEADER, with the
17c2580b9jhaslam# fields enclosed by brackets "[]" replaced with your own identifying
18c2580b9jhaslam# information: Portions Copyright [yyyy] [name of copyright owner]
19c2580b9jhaslam#
20c2580b9jhaslam# CDDL HEADER END
21c2580b9jhaslam#
22c2580b9jhaslam
23c2580b9jhaslam#
241959771Jonathan Haslam# Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
25c2580b9jhaslam# Use is subject to license terms.
26c2580b9jhaslam#
27c2580b9jhaslam
28c2580b9jhaslamif [ $# != 1 ]; then
29c2580b9jhaslam	echo expected one argument: '<'dtrace-path'>'
30c2580b9jhaslam	exit 2
31c2580b9jhaslamfi
32c2580b9jhaslam
33c2580b9jhaslamdtrace=$1
34c2580b9jhaslam
35c2580b9jhaslam#
36c2580b9jhaslam# Let's see if we can successfully specify a module using partial
37c2580b9jhaslam# matches as well as the full module name. We'll use 'libc.so.1'
38c2580b9jhaslam# (and therefore 'libc' and 'libc.so') as it's definitely there.
39c2580b9jhaslam#
40c2580b9jhaslam
411959771Jonathan Haslamfor lib in libc libc.so libc.so.1 'lib[c]*'; do
42c2580b9jhaslam	sleep 60 &
43c2580b9jhaslam	pid=$!
44c2580b9jhaslam	dtrace -n "pid$pid:$lib::entry" -n 'tick-2s{exit(0);}'
45c2580b9jhaslam	status=$?
46c2580b9jhaslam
47c2580b9jhaslam	kill $pid
48c2580b9jhaslam
49c2580b9jhaslam	if [ $status -gt 0 ]; then
50c2580b9jhaslam		exit $status
51c2580b9jhaslam	fi
52c2580b9jhaslamdone
53c2580b9jhaslam
54c2580b9jhaslamexit $status
55