tst.ret1.d revision 178476
1266989Smarkj/*
2266989Smarkj * CDDL HEADER START
3266989Smarkj *
4266989Smarkj * The contents of this file are subject to the terms of the
5266989Smarkj * Common Development and Distribution License (the "License").
6266989Smarkj * You may not use this file except in compliance with the License.
7266989Smarkj *
8266989Smarkj * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9266989Smarkj * or http://www.opensolaris.org/os/licensing.
10266989Smarkj * See the License for the specific language governing permissions
11266989Smarkj * and limitations under the License.
12266989Smarkj *
13266989Smarkj * When distributing Covered Code, include this CDDL HEADER in each
14266989Smarkj * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15266989Smarkj * If applicable, add the following below this CDDL HEADER, with the
16266989Smarkj * fields enclosed by brackets "[]" replaced with your own identifying
17266989Smarkj * information: Portions Copyright [yyyy] [name of copyright owner]
18266989Smarkj *
19266989Smarkj * CDDL HEADER END
20266989Smarkj */
21266989Smarkj
22266989Smarkj/*
23266989Smarkj * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
24266989Smarkj * Use is subject to license terms.
25266989Smarkj */
26266989Smarkj
27266989Smarkj#pragma ident	"%Z%%M%	%I%	%E% SMI"
28266989Smarkj
29266989Smarkj/*
30266989Smarkj * ASSERTION: test that we get the right return value from non-leaf returns
31271693Smarkj *
32266989Smarkj * SECTION: pid provider
33266989Smarkj */
34266989Smarkj
35266989Smarkj#pragma D option destructive
36266989Smarkj
37266989SmarkjBEGIN
38266989Smarkj{
39266989Smarkj	/*
40266989Smarkj	 * Wait no more than a second for the first call to getpid(2).
41266989Smarkj	 */
42266989Smarkj	timeout = timestamp + 1000000000;
43266989Smarkj}
44266989Smarkj
45266989Smarkjsyscall::getpid:return
46266989Smarkj/pid == $1/
47266989Smarkj{
48266989Smarkj	i = 0;
49266989Smarkj	raise(SIGUSR1);
50266989Smarkj	/*
51266989Smarkj	 * Wait half a second after raising the signal.
52266989Smarkj	 */
53266989Smarkj	timeout = timestamp + 500000000;
54266989Smarkj}
55266989Smarkj
56266989Smarkjpid$1:a.out:go:return
57266989Smarkj/arg1 == 101/
58266989Smarkj{
59266989Smarkj	exit(0);
60266989Smarkj}
61266989Smarkj
62266989Smarkjpid$1:a.out:go:return
63266989Smarkj{
64266989Smarkj	printf("wrong return value: %d", arg1);
65266989Smarkj	exit(1);
66266989Smarkj}
67266989Smarkj
68266989Smarkjprofile:::tick-4
69266989Smarkj/timestamp > timeout/
70{
71	trace("test timed out");
72	exit(1);
73}
74