12633Sahl# 22633Sahl# CDDL HEADER START 32633Sahl# 42633Sahl# The contents of this file are subject to the terms of the 52633Sahl# Common Development and Distribution License (the "License"). 62633Sahl# You may not use this file except in compliance with the License. 72633Sahl# 82633Sahl# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 92633Sahl# or http://www.opensolaris.org/os/licensing. 102633Sahl# See the License for the specific language governing permissions 112633Sahl# and limitations under the License. 122633Sahl# 132633Sahl# When distributing Covered Code, include this CDDL HEADER in each 142633Sahl# file and include the License file at usr/src/OPENSOLARIS.LICENSE. 152633Sahl# If applicable, add the following below this CDDL HEADER, with the 162633Sahl# fields enclosed by brackets "[]" replaced with your own identifying 172633Sahl# information: Portions Copyright [yyyy] [name of copyright owner] 182633Sahl# 192633Sahl# CDDL HEADER END 202633Sahl# 212633Sahl 222633Sahl# 23*4926Sjhaslam# Copyright 2007 Sun Microsystems, Inc. All rights reserved. 242633Sahl# Use is subject to license terms. 252633Sahl# 26*4926Sjhaslam# ident "%Z%%M% %I% %E% SMI" 272633Sahl 282633Sahl# 292633Sahl# This script tests that the proc:::exit probe fires with the correct argument 302633Sahl# when the process is killed. 312633Sahl# 322633Sahl# If this fails, the script will run indefinitely; it relies on the harness 332633Sahl# to time it out. 342633Sahl# 352633Sahlscript() 362633Sahl{ 372633Sahl $dtrace -s /dev/stdin <<EOF 382633Sahl proc:::exit 392633Sahl /curpsinfo->pr_ppid == $child && 402633Sahl curpsinfo->pr_psargs == "$longsleep" && args[0] == CLD_KILLED/ 412633Sahl { 422633Sahl exit(0); 432633Sahl } 442633SahlEOF 452633Sahl} 462633Sahl 472633Sahlsleeper() 482633Sahl{ 492633Sahl while true; do 502633Sahl $longsleep & 512633Sahl /usr/bin/sleep 1 522633Sahl kill -9 $! 532633Sahl done 542633Sahl} 552633Sahl 562804Stomeeif [ $# != 1 ]; then 572804Stomee echo expected one argument: '<'dtrace-path'>' 582804Stomee exit 2 592804Stomeefi 602804Stomee 612804Stomeedtrace=$1 622633Sahllongsleep="/usr/bin/sleep 10000" 632633Sahl 642633Sahlsleeper & 652633Sahlchild=$! 662633Sahl 672633Sahlscript 682633Sahlstatus=$? 692633Sahl 702633Sahlpstop $child 712633Sahlpkill -P $child 722633Sahlkill $child 732633Sahlprun $child 742633Sahl 752633Sahlexit $status 76