xref: /onnv-gate/usr/src/cmd/dtrace/test/tst/common/pid/tst.addprobes.ksh (revision 5478:d21b1fd9aff6)
1*5478Sjhaslam#!/bin/ksh -p
2*5478Sjhaslam#
3*5478Sjhaslam# CDDL HEADER START
4*5478Sjhaslam#
5*5478Sjhaslam# The contents of this file are subject to the terms of the
6*5478Sjhaslam# Common Development and Distribution License (the "License").
7*5478Sjhaslam# You may not use this file except in compliance with the License.
8*5478Sjhaslam#
9*5478Sjhaslam# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10*5478Sjhaslam# or http://www.opensolaris.org/os/licensing.
11*5478Sjhaslam# See the License for the specific language governing permissions
12*5478Sjhaslam# and limitations under the License.
13*5478Sjhaslam#
14*5478Sjhaslam# When distributing Covered Code, include this CDDL HEADER in each
15*5478Sjhaslam# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16*5478Sjhaslam# If applicable, add the following below this CDDL HEADER, with the
17*5478Sjhaslam# fields enclosed by brackets "[]" replaced with your own identifying
18*5478Sjhaslam# information: Portions Copyright [yyyy] [name of copyright owner]
19*5478Sjhaslam#
20*5478Sjhaslam# CDDL HEADER END
21*5478Sjhaslam#
22*5478Sjhaslam
23*5478Sjhaslam#
24*5478Sjhaslam# Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
25*5478Sjhaslam# Use is subject to license terms.
26*5478Sjhaslam#
27*5478Sjhaslam# ident	"%Z%%M%	%I%	%E% SMI"
28*5478Sjhaslam#
29*5478Sjhaslam
30*5478Sjhaslam#
31*5478Sjhaslam# This test verifies that it's possible to add new pid probes to an existing
32*5478Sjhaslam# pid provider.
33*5478Sjhaslam#
34*5478Sjhaslam
35*5478Sjhaslamif [ $# != 1 ]; then
36*5478Sjhaslam	echo expected one argument: '<'dtrace-path'>'
37*5478Sjhaslam	exit 2
38*5478Sjhaslamfi
39*5478Sjhaslam
40*5478Sjhaslamdtrace=$1
41*5478Sjhaslam
42*5478Sjhaslamsleep 60 &
43*5478Sjhaslampid=$!
44*5478Sjhaslam
45*5478Sjhaslam$dtrace -n pid$pid:libc::entry -n 'tick-1s{exit(0);}'
46*5478Sjhaslamstatus=$?
47*5478Sjhaslam
48*5478Sjhaslamif [ $status -gt 0 ]; then
49*5478Sjhaslam	exit $status;
50*5478Sjhaslamfi
51*5478Sjhaslam
52*5478Sjhaslam$dtrace -n pid$pid:libc::return -n 'tick-1s{exit(0);}'
53*5478Sjhaslamstatus=$?
54*5478Sjhaslam
55*5478Sjhaslamif [ $status -gt 0 ]; then
56*5478Sjhaslam	exit $status;
57*5478Sjhaslamfi
58*5478Sjhaslam
59*5478Sjhaslamkill $pid
60*5478Sjhaslam
61*5478Sjhaslamexit $status
62