5 # The contents of this file are subject to the terms of the
6 # Common Development and Distribution License (the "License").
7 # You may not use this file except in compliance with the License.
9 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 # or http://www.opensolaris.org/os/licensing.
11 # See the License for the specific language governing permissions
12 # and limitations under the License.
14 # When distributing Covered Code, include this CDDL HEADER in each
15 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 # If applicable, add the following below this CDDL HEADER, with the
17 # fields enclosed by brackets "[]" replaced with your own identifying
18 # information: Portions Copyright [yyyy] [name of copyright owner]
24 # Copyright 2006 Sun Microsystems, Inc. All rights reserved.
25 # Use is subject to license terms.
29 echo expected one argument
: '<'dtrace-path
'>'
40 all: main livelib.so deadlib.so
43 gcc -m32 -o main main.o
49 livelib.so: livelib.o prov.o
50 gcc -m32 -shared -o livelib.so livelib.o prov.o -lc
52 livelib.o: livelib.c prov.h
53 gcc -m32 -fPIC -c livelib.c
55 prov.o: livelib.o prov.d
56 $dtrace -G -s prov.d livelib.o
63 gcc -m32 -shared -o deadlib.so deadlib.o -lc
66 gcc -m32 -fPIC -c deadlib.c
69 rm -f main.o livelib.o prov.o prov.h deadlib.o
72 rm -f main livelib.so deadlib.so
105 main(int argc, char **argv)
110 if ((live = dlopen("./livelib.so", RTLD_LAZY | RTLD_LOCAL)) == NULL) {
111 printf("dlopen of livelib.so failed: %s\n", dlerror());
115 (void) dlclose(live);
117 if ((dead = dlopen("./deadlib.so", RTLD_LAZY | RTLD_LOCAL)) == NULL) {
118 printf("dlopen of deadlib.so failed: %s\n", dlerror());
122 if ((live = dlopen("./livelib.so", RTLD_LAZY | RTLD_LOCAL)) == NULL) {
123 printf("dlopen of livelib.so failed: %s\n", dlerror());
127 if ((go = dlsym(live, "go")) == NULL) {
128 printf("failed to lookup 'go' in livelib.so\n");
132 ((void (*)(void))go)();
139 if [ $?
-ne 0 ]; then
140 print
-u2 "failed to build"
145 $dtrace -w -c .
/main
-Zqs /dev
/stdin
<<EOF
148 printf("%s:%s:%s\n", probemod, probefunc, probename);