138061Smsmith/* 238061Smsmith * CDDL HEADER START 338061Smsmith * 438061Smsmith * The contents of this file are subject to the terms of the 538061Smsmith * Common Development and Distribution License (the "License"). 638061Smsmith * You may not use this file except in compliance with the License. 738061Smsmith * 838061Smsmith * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 938061Smsmith * or http://www.opensolaris.org/os/licensing. 1038061Smsmith * See the License for the specific language governing permissions 1138061Smsmith * and limitations under the License. 1238061Smsmith * 1338061Smsmith * When distributing Covered Code, include this CDDL HEADER in each 1438061Smsmith * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 1538061Smsmith * If applicable, add the following below this CDDL HEADER, with the 1638061Smsmith * fields enclosed by brackets "[]" replaced with your own identifying 1738061Smsmith * information: Portions Copyright [yyyy] [name of copyright owner] 1838061Smsmith * 1938061Smsmith * CDDL HEADER END 2038061Smsmith */ 2138061Smsmith 2238061Smsmith/* 2338061Smsmith * Copyright 2006 Sun Microsystems, Inc. All rights reserved. 2438061Smsmith * Use is subject to license terms. 2538061Smsmith */ 2638061Smsmith 2738061Smsmith#pragma ident "%Z%%M% %I% %E% SMI" 2838061Smsmith 2938061Smsmith/* 3038061Smsmith * ASSERTION: 3138061Smsmith * Positive test for stop 3238061Smsmith * 3338061Smsmith * SECTION: Actions and Subroutines/stop() 3438061Smsmith */ 3538061Smsmith 3638061Smsmith#pragma D option destructive 3738061Smsmith 3838061SmsmithBEGIN 3938061Smsmith{ 4038061Smsmith /* 4138061Smsmith * Wait no more than a second for the process to call getpid(). 4238061Smsmith */ 4338061Smsmith timeout = timestamp + 1000000000; 4438061Smsmith stopped = 0; 4538061Smsmith} 4638061Smsmith 4738061Smsmithsyscall::getpid:entry 4838061Smsmith/pid == $1 && stopped == 1/ 4938061Smsmith{ 5038061Smsmith trace("looks like it's still going"); 5138061Smsmith exit(1); 5238061Smsmith} 5338061Smsmith 5438061Smsmithsyscall::getpid:return 5538061Smsmith/pid == $1 && stopped == 0/ 5638061Smsmith{ 5738061Smsmith stop(); 5838061Smsmith trace("stopped"); 5938061Smsmith stopped = 1; 6038061Smsmith /* 6138061Smsmith * Wait for a quarter second before declaring victory. 6238061Smsmith */ 6338061Smsmith timeout = timestamp + 1000000000 / 4; 6438061Smsmith} 6538061Smsmith 6638061Smsmithprofile:::tick-8 6738061Smsmith/timestamp > timeout && stopped == 1/ 6838061Smsmith{ 6938061Smsmith trace("looks like it really stopped"); 7038061Smsmith exit(0); 7138061Smsmith} 7238061Smsmith 7338061Smsmithprofile:::tick-8 7438061Smsmith/timestamp > timeout/ 7538061Smsmith{ 7638061Smsmith trace("timed out"); 7738061Smsmith exit(1); 7838061Smsmith} 7938061Smsmith