summaryrefslogtreecommitdiff
path: root/usr/src/lib/libdll/common
diff options
context:
space:
mode:
Diffstat (limited to 'usr/src/lib/libdll/common')
-rw-r--r--usr/src/lib/libdll/common/RELEASE1
-rw-r--r--usr/src/lib/libdll/common/dlfcn.c4
-rw-r--r--usr/src/lib/libdll/common/dllfind.c2
-rw-r--r--usr/src/lib/libdll/common/dlllook.c2
-rw-r--r--usr/src/lib/libdll/common/dllnext.c8
-rw-r--r--usr/src/lib/libdll/common/dllopen.c93
-rw-r--r--usr/src/lib/libdll/common/dllplug.c8
-rw-r--r--usr/src/lib/libdll/common/dllscan.c2
-rw-r--r--usr/src/lib/libdll/common/features/dll7
9 files changed, 113 insertions, 14 deletions
diff --git a/usr/src/lib/libdll/common/RELEASE b/usr/src/lib/libdll/common/RELEASE
index d4a437cf3d..7aeac9e025 100644
--- a/usr/src/lib/libdll/common/RELEASE
+++ b/usr/src/lib/libdll/common/RELEASE
@@ -1,3 +1,4 @@
+09-04-15 dllopen.c: add, use dllopen() internally to wrap dlopen()
08-05-12 dllscan.c: LIBSUFFIX==.dylib => default plugin version match 0.0
06-10-11 dllscan.c: check sfstruse() return values -- doh
06-01-25 dllplug.c: add errorf() library message for dlopen() error
diff --git a/usr/src/lib/libdll/common/dlfcn.c b/usr/src/lib/libdll/common/dlfcn.c
index 5b61ff2c58..08fd774181 100644
--- a/usr/src/lib/libdll/common/dlfcn.c
+++ b/usr/src/lib/libdll/common/dlfcn.c
@@ -1,7 +1,7 @@
/***********************************************************************
* *
* This software is part of the ast package *
-* Copyright (c) 1997-2008 AT&T Intellectual Property *
+* Copyright (c) 1997-2009 AT&T Intellectual Property *
* and is licensed under the *
* Common Public License, Version 1.0 *
* by AT&T Intellectual Property *
@@ -26,7 +26,7 @@
* AT&T Research
*/
-static const char id[] = "\n@(#)$Id: dll library (AT&T Research) 2005-02-14 $\0\n";
+static const char id[] = "\n@(#)$Id: dll library (AT&T Research) 2009-04-15 $\0\n";
#include <ast.h>
#include <dlldefs.h>
diff --git a/usr/src/lib/libdll/common/dllfind.c b/usr/src/lib/libdll/common/dllfind.c
index 48317c3fa8..88b2fd1015 100644
--- a/usr/src/lib/libdll/common/dllfind.c
+++ b/usr/src/lib/libdll/common/dllfind.c
@@ -1,7 +1,7 @@
/***********************************************************************
* *
* This software is part of the ast package *
-* Copyright (c) 1997-2008 AT&T Intellectual Property *
+* Copyright (c) 1997-2009 AT&T Intellectual Property *
* and is licensed under the *
* Common Public License, Version 1.0 *
* by AT&T Intellectual Property *
diff --git a/usr/src/lib/libdll/common/dlllook.c b/usr/src/lib/libdll/common/dlllook.c
index 6ea224e61d..a9d7c97dce 100644
--- a/usr/src/lib/libdll/common/dlllook.c
+++ b/usr/src/lib/libdll/common/dlllook.c
@@ -1,7 +1,7 @@
/***********************************************************************
* *
* This software is part of the ast package *
-* Copyright (c) 1997-2008 AT&T Intellectual Property *
+* Copyright (c) 1997-2009 AT&T Intellectual Property *
* and is licensed under the *
* Common Public License, Version 1.0 *
* by AT&T Intellectual Property *
diff --git a/usr/src/lib/libdll/common/dllnext.c b/usr/src/lib/libdll/common/dllnext.c
index 33f80f1255..012a01b0e1 100644
--- a/usr/src/lib/libdll/common/dllnext.c
+++ b/usr/src/lib/libdll/common/dllnext.c
@@ -1,7 +1,7 @@
/***********************************************************************
* *
* This software is part of the ast package *
-* Copyright (c) 1997-2008 AT&T Intellectual Property *
+* Copyright (c) 1997-2009 AT&T Intellectual Property *
* and is licensed under the *
* Common Public License, Version 1.0 *
* by AT&T Intellectual Property *
@@ -80,7 +80,7 @@ _dll_next(int flags, _DLL_RLD_SYM_TYPE* here)
{
do
{
- if (strcmp(vp, "MAIN") && (lp = dlopen(vp, flags)))
+ if (strcmp(vp, "MAIN") && (lp = dllopen(vp, flags)))
{
if (xr = (Write_f)dlsym(lp, "write"))
wr = xr;
@@ -92,7 +92,7 @@ _dll_next(int flags, _DLL_RLD_SYM_TYPE* here)
{
do
{
- if (lp = dlopen(strcmp(vp, "MAIN") ? vp : (char*)0, flags))
+ if (lp = dllopen(strcmp(vp, "MAIN") ? vp : (char*)0, flags))
{
if (found)
{
@@ -207,7 +207,7 @@ dllnext(int flags)
}
#endif
ver = path + strlen(path);
- while (!(dll = dlopen(path, flags)))
+ while (!(dll = dllopen(path, flags)))
{
do
{
diff --git a/usr/src/lib/libdll/common/dllopen.c b/usr/src/lib/libdll/common/dllopen.c
new file mode 100644
index 0000000000..19c057d792
--- /dev/null
+++ b/usr/src/lib/libdll/common/dllopen.c
@@ -0,0 +1,93 @@
+/***********************************************************************
+* *
+* This software is part of the ast package *
+* Copyright (c) 1997-2009 AT&T Intellectual Property *
+* and is licensed under the *
+* Common Public License, Version 1.0 *
+* by AT&T Intellectual Property *
+* *
+* A copy of the License is available at *
+* http://www.opensource.org/licenses/cpl1.0.txt *
+* (with md5 checksum 059e8cd6165cb4c31e351f2b69388fd9) *
+* *
+* Information and Software Systems Research *
+* AT&T Research *
+* Florham Park NJ *
+* *
+* Glenn Fowler <gsf@research.att.com> *
+* *
+***********************************************************************/
+#pragma prototyped
+/*
+ * Glenn Fowler
+ * at&t research
+ */
+
+#include <ast.h>
+#include <dlldefs.h>
+#include <error.h>
+
+#if 0
+
+/*
+ * dlopen() wrapper that properly initializes LIBPATH
+ * with the path of the dll to be opened
+ *
+ * 2009-04-15 -- if ld.so re-checked the env this would work ...
+ */
+
+void*
+dllopen(const char* name, int mode)
+{
+ void* dll;
+ Dllinfo_t* info;
+ char* olibpath;
+ char* path;
+ char* oenv;
+ char* nenv[2];
+ char* dir;
+ char* base;
+ int len;
+
+ if (!environ)
+ {
+ nenv[0] = nenv[1] = 0;
+ environ = nenv;
+ }
+ info = dllinfo();
+ oenv = environ[0];
+ olibpath = getenv(info->env);
+ if (base = strrchr(name, '/'))
+ {
+ dir = (char*)name;
+ len = ++base - dir;
+ }
+ else
+ {
+ dir = "./";
+ len = 2;
+ base = (char*)name;
+ }
+ path = sfprints("%-.*s%s%c%s=%-.*s%s%s", len, dir, base, 0, info->env, len, dir, olibpath ? ":" : "", olibpath ? olibpath : "");
+ environ[0] = path + strlen(path) + 1;
+ dll = dlopen(path, mode);
+ if (environ == nenv)
+ environ = 0;
+ else
+ environ[0] = oenv;
+ return dll;
+}
+
+#else
+
+/*
+ * dlopen() wrapper -- waiting for prestidigitaions
+ */
+
+void*
+dllopen(const char* name, int mode)
+{
+ return dlopen(name, mode);
+}
+
+#endif
diff --git a/usr/src/lib/libdll/common/dllplug.c b/usr/src/lib/libdll/common/dllplug.c
index 72ae471352..e0c9dc61cf 100644
--- a/usr/src/lib/libdll/common/dllplug.c
+++ b/usr/src/lib/libdll/common/dllplug.c
@@ -1,7 +1,7 @@
/***********************************************************************
* *
* This software is part of the ast package *
-* Copyright (c) 1997-2008 AT&T Intellectual Property *
+* Copyright (c) 1997-2009 AT&T Intellectual Property *
* and is licensed under the *
* Common Public License, Version 1.0 *
* by AT&T Intellectual Property *
@@ -50,7 +50,7 @@ dllplug(const char* lib, const char* name, const char* ver, int flags, char* pat
while (dle = dllsread(dls))
{
hit = 1;
- if (dll = dlopen(dle->path, flags|RTLD_GLOBAL|RTLD_PARENT))
+ if (dll = dllopen(dle->path, flags|RTLD_GLOBAL|RTLD_PARENT))
{
if (path && size)
strncopy(path, dle->path, size);
@@ -67,9 +67,7 @@ dllplug(const char* lib, const char* name, const char* ver, int flags, char* pat
break;
lib = 0;
}
- if (!(dll = dlopen(name, flags)) && !strchr(name, '/') && strchr(name, '.'))
- dll = dlopen(sfprints("./%s", name), flags);
- if (dll && path && size)
+ if ((dll = dllopen(name, flags)) && dll && path && size)
strncopy(path, name, size);
return dll;
}
diff --git a/usr/src/lib/libdll/common/dllscan.c b/usr/src/lib/libdll/common/dllscan.c
index 3863390b2a..85389152cb 100644
--- a/usr/src/lib/libdll/common/dllscan.c
+++ b/usr/src/lib/libdll/common/dllscan.c
@@ -1,7 +1,7 @@
/***********************************************************************
* *
* This software is part of the ast package *
-* Copyright (c) 1997-2008 AT&T Intellectual Property *
+* Copyright (c) 1997-2009 AT&T Intellectual Property *
* and is licensed under the *
* Common Public License, Version 1.0 *
* by AT&T Intellectual Property *
diff --git a/usr/src/lib/libdll/common/features/dll b/usr/src/lib/libdll/common/features/dll
index c1a4900e3a..70e790be7d 100644
--- a/usr/src/lib/libdll/common/features/dll
+++ b/usr/src/lib/libdll/common/features/dll
@@ -75,6 +75,9 @@ tst run{
echo "#define _DLL_NEXT_PATH \"$lib\""
}end
tst - output{
+ #if defined(__MVS__) && !defined(__SUSV3)
+ #define __SUSV3 1
+ #endif
#if _hdr_dlfcn && _lib_dlopen
#include <dlfcn.h>
#endif
@@ -90,6 +93,9 @@ tst - output{
static char* local[] = { "__elf_header", "_call_add_gp_range", "_etext" };
#endif
printf("\n");
+ printf("#if defined(__MVS__) && !defined(__SUSV3)\n");
+ printf("#define __SUSV3 1\n");
+ printf("#endif\n");
#if _hdr_dlfcn && _lib_dlopen
printf("#include <dlfcn.h>\n");
#endif
@@ -206,6 +212,7 @@ tst - output{
printf("extern Dllinfo_t* dllinfo(void);\n");
printf("extern void* dllplug(const char*, const char*, const char*, int, char*, size_t);\n");
printf("extern void* dllfind(const char*, const char*, int, char*, size_t);\n");
+ printf("extern void* dllopen(const char*, int);\n");
printf("extern void* dllnext(int);\n");
printf("extern void* dlllook(void*, const char*);\n");
#if _hdr_rld_interface