13276Sjhaslam#!/bin/ksh -p 23276Sjhaslam# 33276Sjhaslam# CDDL HEADER START 43276Sjhaslam# 53276Sjhaslam# The contents of this file are subject to the terms of the 63276Sjhaslam# Common Development and Distribution License (the "License"). 73276Sjhaslam# You may not use this file except in compliance with the License. 83276Sjhaslam# 93276Sjhaslam# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 103276Sjhaslam# or http://www.opensolaris.org/os/licensing. 113276Sjhaslam# See the License for the specific language governing permissions 123276Sjhaslam# and limitations under the License. 133276Sjhaslam# 143276Sjhaslam# When distributing Covered Code, include this CDDL HEADER in each 153276Sjhaslam# file and include the License file at usr/src/OPENSOLARIS.LICENSE. 163276Sjhaslam# If applicable, add the following below this CDDL HEADER, with the 173276Sjhaslam# fields enclosed by brackets "[]" replaced with your own identifying 183276Sjhaslam# information: Portions Copyright [yyyy] [name of copyright owner] 193276Sjhaslam# 203276Sjhaslam# CDDL HEADER END 213276Sjhaslam# 223276Sjhaslam 233276Sjhaslam# 24*7991SJonathan.Haslam@Sun.COM# Copyright 2008 Sun Microsystems, Inc. All rights reserved. 253276Sjhaslam# Use is subject to license terms. 263276Sjhaslam# 273276Sjhaslam 283276Sjhaslamif [ $# != 1 ]; then 293276Sjhaslam echo expected one argument: '<'dtrace-path'>' 303276Sjhaslam exit 2 313276Sjhaslamfi 323276Sjhaslam 333276Sjhaslamdtrace=$1 343276Sjhaslam 353276Sjhaslam# 363276Sjhaslam# Let's see if we can successfully specify a module using partial 373276Sjhaslam# matches as well as the full module name. We'll use 'libc.so.1' 383276Sjhaslam# (and therefore 'libc' and 'libc.so') as it's definitely there. 393276Sjhaslam# 403276Sjhaslam 41*7991SJonathan.Haslam@Sun.COMfor lib in libc libc.so libc.so.1 'lib[c]*'; do 423276Sjhaslam sleep 60 & 433276Sjhaslam pid=$! 443276Sjhaslam dtrace -n "pid$pid:$lib::entry" -n 'tick-2s{exit(0);}' 453276Sjhaslam status=$? 463276Sjhaslam 473276Sjhaslam kill $pid 483276Sjhaslam 493276Sjhaslam if [ $status -gt 0 ]; then 503276Sjhaslam exit $status 513276Sjhaslam fi 523276Sjhaslamdone 533276Sjhaslam 543276Sjhaslamexit $status 55