tst.ret1.d revision 178476
1193323Sed/*
2193323Sed * CDDL HEADER START
3193323Sed *
4193323Sed * The contents of this file are subject to the terms of the
5193323Sed * Common Development and Distribution License (the "License").
6193323Sed * You may not use this file except in compliance with the License.
7193323Sed *
8193323Sed * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9193323Sed * or http://www.opensolaris.org/os/licensing.
10193323Sed * See the License for the specific language governing permissions
11193323Sed * and limitations under the License.
12193323Sed *
13193323Sed * When distributing Covered Code, include this CDDL HEADER in each
14193323Sed * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15193323Sed * If applicable, add the following below this CDDL HEADER, with the
16193323Sed * fields enclosed by brackets "[]" replaced with your own identifying
17193323Sed * information: Portions Copyright [yyyy] [name of copyright owner]
18193323Sed *
19193323Sed * CDDL HEADER END
20193323Sed */
21193323Sed
22193323Sed/*
23193323Sed * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
24193323Sed * Use is subject to license terms.
25193323Sed */
26193323Sed
27193323Sed#pragma ident	"%Z%%M%	%I%	%E% SMI"
28193323Sed
29193323Sed/*
30193323Sed * ASSERTION: test that we get the right return value from non-leaf returns
31193323Sed *
32193323Sed * SECTION: pid provider
33193323Sed */
34193323Sed
35193323Sed#pragma D option destructive
36218893Sdim
37198090SrdivackyBEGIN
38193323Sed{
39193323Sed	/*
40193323Sed	 * Wait no more than a second for the first call to getpid(2).
41193323Sed	 */
42193323Sed	timeout = timestamp + 1000000000;
43218893Sdim}
44193323Sed
45193323Sedsyscall::getpid:return
46193323Sed/pid == $1/
47193323Sed{
48193323Sed	i = 0;
49193323Sed	raise(SIGUSR1);
50202375Srdivacky	/*
51202375Srdivacky	 * Wait half a second after raising the signal.
52193323Sed	 */
53193323Sed	timeout = timestamp + 500000000;
54193323Sed}
55195340Sed
56195340Sedpid$1:a.out:go:return
57198090Srdivacky/arg1 == 101/
58195340Sed{
59195340Sed	exit(0);
60193323Sed}
61193323Sed
62193323Sedpid$1:a.out:go:return
63193323Sed{
64193323Sed	printf("wrong return value: %d", arg1);
65193323Sed	exit(1);
66193323Sed}
67193323Sed
68193323Sedprofile:::tick-4
69193323Sed/timestamp > timeout/
70193323Sed{
71193323Sed	trace("test timed out");
72193323Sed	exit(1);
73193323Sed}
74193323Sed