summaryrefslogtreecommitdiff
path: root/dso/unix
diff options
context:
space:
mode:
authordreid <dreid@13f79535-47bb-0310-9956-ffa450edef68>2000-04-02 14:24:34 +0000
committerdreid <dreid@13f79535-47bb-0310-9956-ffa450edef68>2000-04-02 14:24:34 +0000
commitfb620380b28d0a6562324452e6ab5d0408304848 (patch)
tree0369ccd1fb1d6d559b9caded07e6f3650cd28909 /dso/unix
parentc223a4bd5049e3b8d988133577e412a171a49028 (diff)
downloadlibapr-fb620380b28d0a6562324452e6ab5d0408304848.tar.gz
Next part of putting the "old" dso code into APR. Again, this seems
to be in line with the groups current thinking. This has so far been built on FreeBSD 3.3 and will need more testing. Only a first pass but at least we have code to hack now! git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@59760 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'dso/unix')
-rw-r--r--dso/unix/Makefile.in1
-rw-r--r--dso/unix/dso.c63
-rw-r--r--dso/unix/dso.h27
3 files changed, 70 insertions, 21 deletions
diff --git a/dso/unix/Makefile.in b/dso/unix/Makefile.in
index b60dd9541..ffc2c0f2e 100644
--- a/dso/unix/Makefile.in
+++ b/dso/unix/Makefile.in
@@ -3,6 +3,7 @@
#INCLUDES=$(INCLUDES1) $(INCLUDES0) $(EXTRA_INCLUDES)
#LDFLAGS=$(LDFLAGS1) $(EXTRA_LDFLAGS)
+RM=@RM@
CC=@CC@
RANLIB=@RANLIB@
CFLAGS=@CFLAGS@ @OPTIM@
diff --git a/dso/unix/dso.c b/dso/unix/dso.c
index 60a4d43a1..284bdedd1 100644
--- a/dso/unix/dso.c
+++ b/dso/unix/dso.c
@@ -59,9 +59,6 @@
* Initialize the underlying DSO library.
*/
ap_status_t ap_dso_init(void){
- if(lt_dlinit())
- return APR_EINIT;
-
return APR_SUCCESS;
}
@@ -76,13 +73,22 @@ ap_status_t ap_dso_init(void){
ap_status_t ap_dso_load(struct dso_handle_t **res_handle, const char *path,
ap_context_t *ctx)
{
- lt_dlhandle dlhandle;
+#if defined(HPUX) || defined(HPUX10) || defined(HPUX11)
+ shl_t os_handle = shl_load(path, BIND_IMMEDIATE|BIND_VERBOSE|BIND_NOSTART, 0L);
+#elif defined(OSF1) || defined(SEQUENT) ||\
+ (defined(__FreeBSD_version) && (__FreeBSD_version >= 220000))
+ void *os_handle = dlopen((char *)path, RTLD_NOW | RTLD_GLOBAL);
+#else
+ void *os_handle = dlopen(path, RTLD_NOW | RTLD_GLOBAL);
+#endif
- if((dlhandle = lt_dlopen(path)) == NULL)
+ if(os_handle == NULL)
return APR_EDSOOPEN;
+fprintf(stderr,"handle is %Lx\n",os_handle);
+
*res_handle = ap_pcalloc(ctx, sizeof(*res_handle));
- (*res_handle)->handle = dlhandle;
+ (*res_handle)->handle = (void*)os_handle;
(*res_handle)->cont = ctx;
return APR_SUCCESS;
}
@@ -94,8 +100,12 @@ ap_status_t ap_dso_load(struct dso_handle_t **res_handle, const char *path,
*/
ap_status_t ap_dso_unload(struct dso_handle_t *handle)
{
- if(lt_dlclose(handle->handle))
+#if defined(HPUX) || defined(HPUX10) || defined(HPUX11)
+ shl_unload((shl_t)handle);
+#else
+ if (dlclose(handle) != 0)
return APR_EINIT;
+#endif
return APR_SUCCESS;
}
@@ -112,19 +122,36 @@ ap_status_t ap_dso_sym(ap_dso_handle_sym_t *ressym,
struct dso_handle_t *handle,
const char *symname)
{
- lt_ptr_t sym;
+#if defined(HPUX) || defined(HPUX10) || defined(HPUX11)
+ void *symaddr = NULL;
+ int status;
+
+ errno = 0;
+ status = shl_findsym((shl_t *)&handle->handle, symname, TYPE_PROCEDURE, &symaddr);
+ if (status == -1 && errno == 0) /* try TYPE_DATA instead */
+ status = shl_findsym((shl_t *)&handle->handle, symname, TYPE_DATA, &symaddr);
+ if (status = -1)
+ return APR_EINIT;
+ ressym = symaddr;
- if (ressym == NULL) {
- return APR_ENOFUNCPOINTER;
- }
- if (handle == NULL) {
- return APR_ENODSOHANDLE;
- }
- if((sym = lt_dlsym(handle->handle, symname)) == NULL) {
- return APR_EFUNCNOTFOUND;
- }
+#elif defined(DLSYM_NEEDS_UNDERSCORE)
+ char *symbol = (char*)malloc(sizeof(char)*(strlen(symname)+2));
+ void *retval;
+ sprintf(symbol, "_%s", symname);
+ retval = dlsym(handle->handle, symbol);
+ free(symbol);
- *ressym = sym;
+#elif defined(SEQUENT)
+ void *retval = dlsym(handle->handle, (char *)symname);
+#else
+ void *retval = dlsym(handle->handle, symname);
+#endif
+
+ if (retval == NULL)
+ return APR_EINIT;
+
+ ressym = retval;
+
return APR_SUCCESS;
}
diff --git a/dso/unix/dso.h b/dso/unix/dso.h
index 1a27dffb1..ca12945d4 100644
--- a/dso/unix/dso.h
+++ b/dso/unix/dso.h
@@ -59,11 +59,32 @@
#include "apr_general.h"
#include "apr_pools.h"
#include "apr_dso.h"
-#include "ltdl.h"
+
+#ifdef HAVE_DLFCN_H
+#include <dlfcn.h>
+#endif
+
+#ifdef HAVE_DL_H
+#include <dl.h>
+#endif
+
+#ifndef RTLD_NOW
+#define RTLD_NOW 1
+#endif
+
+#ifndef RTLD_GLOBAL
+#define RTLD_GLOBAL 0
+#endif
+
+#if (defined(__FreeBSD__) ||\
+ defined(__OpenBSD__) ||\
+ defined(__NetBSD__) ) && !defined(__ELF__)
+#define DLSYM_NEEDS_UNDERSCORE
+#endif
struct dso_handle_t {
- ap_context_t *cont;
- lt_dlhandle handle; /* libtool handle */
+ ap_context_t *cont;
+ void *handle;
};
#endif