1file=out.$$
2dtrace=/usr/sbin/dtrace
3
4cmd=`pwd`/tst.dlopen.exe
5
6rm -f $file
7
8$dtrace -o $file -c $cmd -s /dev/stdin <<EOF
9	#pragma D option destructive
10	#pragma D option zdefs
11	
12	pid\$target:a.out:waiting:entry
13	{
14		this->value = (int *)alloca(sizeof (int));
15		*this->value = 1;
16		copyout(this->value, arg0, sizeof (int));
17	}
18
19	pid\$target::pcre_config:entry
20	{
21		exit(0);
22	}
23
24	BEGIN
25	{
26		/*
27		 * Let's just do this for 5 seconds.
28		 */
29		timeout = timestamp + 50000000000;
30	}
31
32	profile:::tick-4
33	/timestamp > timeout/
34	{
35		trace("test timed out");
36		exit(1);
37	}
38EOF
39
40status=$?
41if [ "$status" -ne 0 ]; then
42	echo $tst: dtrace failed
43	exit $status
44fi
45
46if [ "$status" -eq 0 ]; then
47	rm -f $file
48fi
49
50exit $status
51