tst.exec.ksh revision 2633:71bab08d24b2
10SN/A# 2157SN/A# CDDL HEADER START 30SN/A# 40SN/A# The contents of this file are subject to the terms of the 50SN/A# Common Development and Distribution License (the "License"). 60SN/A# You may not use this file except in compliance with the License. 7157SN/A# 80SN/A# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9157SN/A# or http://www.opensolaris.org/os/licensing. 100SN/A# See the License for the specific language governing permissions 110SN/A# and limitations under the License. 120SN/A# 130SN/A# When distributing Covered Code, include this CDDL HEADER in each 140SN/A# file and include the License file at usr/src/OPENSOLARIS.LICENSE. 150SN/A# If applicable, add the following below this CDDL HEADER, with the 160SN/A# fields enclosed by brackets "[]" replaced with your own identifying 170SN/A# information: Portions Copyright [yyyy] [name of copyright owner] 180SN/A# 190SN/A# CDDL HEADER END 200SN/A# 21157SN/A 22157SN/A# 23157SN/A# Copyright 2006 Sun Microsystems, Inc. All rights reserved. 240SN/A# Use is subject to license terms. 250SN/A# 260SN/A#pragma ident "%Z%%M% %I% %E% SMI" 270SN/A 280SN/A# 290SN/A# This script tests that the proc:::exec probe fires, followed by the 300SN/A# proc:::exec-success probe (in a successful exec(2)). 310SN/A# 320SN/A# If this fails, the script will run indefinitely; it relies on the harness 330SN/A# to time it out. 340SN/A# 350SN/Ascript() 360SN/A{ 370SN/A $dtrace -s /dev/stdin <<EOF 380SN/A proc:::exec 390SN/A /curpsinfo->pr_ppid == $child && args[0] == "/usr/bin/sleep"/ 400SN/A { 410SN/A self->exec = 1; 420SN/A } 430SN/A 440SN/A proc:::exec-success 450SN/A /self->exec/ 460SN/A { 470SN/A exit(0); 480SN/A } 490SN/AEOF 500SN/A} 510SN/A 520SN/Asleeper() 530SN/A{ 540SN/A while true; do 550SN/A /usr/bin/sleep 1 560SN/A done 570SN/A} 580SN/A 590SN/Adtrace=/usr/sbin/dtrace 600SN/A 610SN/Asleeper & 620SN/Achild=$! 630SN/A 640SN/Ascript 650SN/Astatus=$? 660SN/A 670SN/Akill $child 680SN/Aexit $status 690SN/A