xref: /freebsd-src/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.probemod.ksh (revision 1670a1c2a47d10ecccd001970b859caf93cd3b6e)
12be1a816SJohn Birrell#!/bin/ksh -p
22be1a816SJohn Birrell#
32be1a816SJohn Birrell# CDDL HEADER START
42be1a816SJohn Birrell#
52be1a816SJohn Birrell# The contents of this file are subject to the terms of the
62be1a816SJohn Birrell# Common Development and Distribution License (the "License").
72be1a816SJohn Birrell# You may not use this file except in compliance with the License.
82be1a816SJohn Birrell#
92be1a816SJohn Birrell# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
102be1a816SJohn Birrell# or http://www.opensolaris.org/os/licensing.
112be1a816SJohn Birrell# See the License for the specific language governing permissions
122be1a816SJohn Birrell# and limitations under the License.
132be1a816SJohn Birrell#
142be1a816SJohn Birrell# When distributing Covered Code, include this CDDL HEADER in each
152be1a816SJohn Birrell# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
162be1a816SJohn Birrell# If applicable, add the following below this CDDL HEADER, with the
172be1a816SJohn Birrell# fields enclosed by brackets "[]" replaced with your own identifying
182be1a816SJohn Birrell# information: Portions Copyright [yyyy] [name of copyright owner]
192be1a816SJohn Birrell#
202be1a816SJohn Birrell# CDDL HEADER END
212be1a816SJohn Birrell#
222be1a816SJohn Birrell
232be1a816SJohn Birrell#
24*1670a1c2SRui Paulo# Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
252be1a816SJohn Birrell# Use is subject to license terms.
262be1a816SJohn Birrell#
272be1a816SJohn Birrell
282be1a816SJohn Birrellif [ $# != 1 ]; then
292be1a816SJohn Birrell	echo expected one argument: '<'dtrace-path'>'
302be1a816SJohn Birrell	exit 2
312be1a816SJohn Birrellfi
322be1a816SJohn Birrell
332be1a816SJohn Birrelldtrace=$1
342be1a816SJohn Birrell
352be1a816SJohn Birrell#
362be1a816SJohn Birrell# Let's see if we can successfully specify a module using partial
372be1a816SJohn Birrell# matches as well as the full module name. We'll use 'libc.so.1'
382be1a816SJohn Birrell# (and therefore 'libc' and 'libc.so') as it's definitely there.
392be1a816SJohn Birrell#
402be1a816SJohn Birrell
41*1670a1c2SRui Paulofor lib in libc libc.so libc.so.1 'lib[c]*'; do
422be1a816SJohn Birrell	sleep 60 &
432be1a816SJohn Birrell	pid=$!
442be1a816SJohn Birrell	dtrace -n "pid$pid:$lib::entry" -n 'tick-2s{exit(0);}'
452be1a816SJohn Birrell	status=$?
462be1a816SJohn Birrell
472be1a816SJohn Birrell	kill $pid
482be1a816SJohn Birrell
492be1a816SJohn Birrell	if [ $status -gt 0 ]; then
502be1a816SJohn Birrell		exit $status
512be1a816SJohn Birrell	fi
522be1a816SJohn Birrelldone
532be1a816SJohn Birrell
542be1a816SJohn Birrellexit $status
55