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