httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dr...@locus.apache.org
Subject cvs commit: apache-2.0/src/lib/apr/dso/unix Makefile.in dso.c dso.h
Date Sun, 02 Apr 2000 14:24:36 GMT
dreid       00/04/02 07:24:35

  Modified:    src/lib/apr/dso/unix Makefile.in dso.c dso.h
  Log:
  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!
  
  Revision  Changes    Path
  1.3       +1 -0      apache-2.0/src/lib/apr/dso/unix/Makefile.in
  
  Index: Makefile.in
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/dso/unix/Makefile.in,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- Makefile.in	2000/03/31 13:07:43	1.2
  +++ Makefile.in	2000/04/02 14:24:33	1.3
  @@ -3,6 +3,7 @@
   #INCLUDES=$(INCLUDES1) $(INCLUDES0) $(EXTRA_INCLUDES)
   #LDFLAGS=$(LDFLAGS1) $(EXTRA_LDFLAGS)
   
  +RM=@RM@
   CC=@CC@
   RANLIB=@RANLIB@
   CFLAGS=@CFLAGS@ @OPTIM@
  
  
  
  1.5       +46 -19    apache-2.0/src/lib/apr/dso/unix/dso.c
  
  Index: dso.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/dso/unix/dso.c,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- dso.c	2000/03/31 08:35:46	1.4
  +++ dso.c	2000/04/02 14:24:34	1.5
  @@ -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_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_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 @@
                          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;
  -    }
   
  -    *ressym = sym;
  +#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);
  +
  +#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;
   }
  
  
  
  1.4       +24 -3     apache-2.0/src/lib/apr/dso/unix/dso.h
  
  Index: dso.h
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/dso/unix/dso.h,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- dso.h	2000/03/31 08:35:46	1.3
  +++ dso.h	2000/04/02 14:24:34	1.4
  @@ -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
  
  
  

Mime
View raw message