apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gst...@apache.org
Subject cvs commit: apr/dso/win32 dso.c
Date Fri, 19 Jan 2001 09:56:32 GMT
gstein      01/01/19 01:56:32

  Modified:    include/arch/os390 dso.h
               dso/aix  dso.c
               dso/beos dso.c
               dso/os2  dso.c
               dso/os390 dso.c
               dso/unix dso.c
               dso/win32 dso.c
  Log:
  watch out for a double-unload. one manually from apr_dso_unload(), followed
  by one through the pool cleanup.
  1) protect the unload by setting/checking the handle to NULL
  2) unload "runs" the cleanup to also remove it from the pool cleanup
  
  Revision  Changes    Path
  1.2       +1 -0      apr/include/arch/os390/dso.h
  
  Index: dso.h
  ===================================================================
  RCS file: /home/cvs/apr/include/arch/os390/dso.h,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -u -r1.1 -r1.2
  --- dso.h	2000/08/17 14:20:13	1.1
  +++ dso.h	2001/01/19 09:56:30	1.2
  @@ -69,6 +69,7 @@
       dllhandle  *handle;     /* Handle to the DSO loaded            */
       int failing_errno;      /* Don't save the buffer returned by
                                  strerror(); it gets reused          */
  +    apr_pool_t *pool;
   };
   
   #endif
  
  
  
  1.11      +7 -5      apr/dso/aix/dso.c
  
  Index: dso.c
  ===================================================================
  RCS file: /home/cvs/apr/dso/aix/dso.c,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -u -r1.10 -r1.11
  --- dso.c	2001/01/19 03:13:01	1.10
  +++ dso.c	2001/01/19 09:56:31	1.11
  @@ -135,7 +135,12 @@
   static apr_status_t dso_cleanup(void *thedso)
   {
       apr_dso_handle_t *dso = thedso;
  -    return apr_dso_unload(dso);
  +
  +    if (dso->handle != NULL && dlclose(dso->handle) != 0)
  +        return APR_EINIT;
  +    dso->handle = NULL;
  +
  +    return APR_SUCCESS;
   }
   
   APR_DECLARE(apr_status_t) apr_dso_load(apr_dso_handle_t **res_handle, 
  @@ -157,10 +162,7 @@
   
   APR_DECLARE(apr_status_t) apr_dso_unload(apr_dso_handle_t *handle)
   {
  -    if (dlclose(handle->handle) != 0)
  -        return APR_EINIT;
  -
  -    return APR_SUCCESS;
  +    return apr_run_cleanup(handle->cont, handle, dso_cleanup);
   }
   
   APR_DECLARE(apr_status_t) apr_dso_sym(apr_dso_handle_sym_t *ressym, 
  
  
  
  1.14      +7 -5      apr/dso/beos/dso.c
  
  Index: dso.c
  ===================================================================
  RCS file: /home/cvs/apr/dso/beos/dso.c,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -u -r1.13 -r1.14
  --- dso.c	2001/01/19 03:13:01	1.13
  +++ dso.c	2001/01/19 09:56:31	1.14
  @@ -59,7 +59,12 @@
   static apr_status_t dso_cleanup(void *thedso)
   {
       apr_dso_handle_t *dso = thedso;
  -    return apr_dso_unload(dso);
  +
  +    if (dso->handle != NULL && unload_add_on(dso->handle) < B_NO_ERROR)
  +      return APR_EINIT;
  +    dso->handle = NULL;
  +
  +    return APR_SUCCESS;
   }
   
   APR_DECLARE(apr_status_t) apr_dso_load(apr_dso_handle_t **res_handle, const char *path,
  @@ -81,10 +86,7 @@
   
   APR_DECLARE(apr_status_t) apr_dso_unload(apr_dso_handle_t *handle)
   {
  -    if(unload_add_on(handle->handle) < B_NO_ERROR)
  -      return APR_EINIT;
  -
  -    return APR_SUCCESS;
  +    return apr_run_cleanup(handle->cont, handle, dso_cleanup);
   }
   
   APR_DECLARE(apr_status_t) apr_dso_sym(apr_dso_handle_sym_t *ressym, apr_dso_handle_t *handle,
  
  
  
  1.18      +12 -12    apr/dso/os2/dso.c
  
  Index: dso.c
  ===================================================================
  RCS file: /home/cvs/apr/dso/os2/dso.c,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -u -r1.17 -r1.18
  --- dso.c	2001/01/12 04:50:30	1.17
  +++ dso.c	2001/01/19 09:56:31	1.18
  @@ -64,7 +64,17 @@
   static apr_status_t dso_cleanup(void *thedso)
   {
       apr_dso_handle_t *dso = thedso;
  -    return apr_dso_unload(dso);
  +    int rc;
  +
  +    if (dso->handle == 0)
  +        return APR_SUCCESS;
  +       
  +    rc = DosFreeModule(dso->handle);
  +
  +    if (rc == 0)
  +        dso->handle = 0;
  +
  +    return APR_OS2_STATUS(rc);
   }
   
   
  @@ -94,17 +104,7 @@
   
   APR_DECLARE(apr_status_t) apr_dso_unload(apr_dso_handle_t *handle)
   {
  -    int rc;
  -
  -    if (handle->handle == 0)
  -        return APR_SUCCESS;
  -       
  -    rc = DosFreeModule(handle->handle);
  -
  -    if (rc == 0)
  -        handle->handle = 0;
  -
  -    return APR_OS2_STATUS(rc);
  +    return apr_run_cleanup(handle->cont, handle, dso_cleanup);
   }
   
   
  
  
  
  1.5       +14 -14    apr/dso/os390/dso.c
  
  Index: dso.c
  ===================================================================
  RCS file: /home/cvs/apr/dso/os390/dso.c,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -u -r1.4 -r1.5
  --- dso.c	2001/01/12 04:50:31	1.4
  +++ dso.c	2001/01/19 09:56:31	1.5
  @@ -62,7 +62,19 @@
   static apr_status_t dso_cleanup(void *thedso)
   {
       apr_dso_handle_t *dso = thedso;
  -    return apr_dso_unload(dso);
  +    int rc;
  +
  +    if (dso->handle == 0)
  +        return APR_SUCCESS;
  +       
  +    rc = dllfree(dso->handle);
  +
  +    if (rc == 0) {
  +        dso->handle = 0;
  +        return APR_SUCCESS;
  +    }
  +    dso->failing_errno = errno;
  +    return errno;
   }
   
   APR_DECLARE(apr_status_t) apr_dso_load(apr_dso_handle_t **res_handle, 
  @@ -85,19 +97,7 @@
   
   APR_DECLARE(apr_status_t) apr_dso_unload(apr_dso_handle_t *handle)
   {
  -    int rc;
  -
  -    if (handle->handle == 0)
  -        return APR_SUCCESS;
  -       
  -    rc = dllfree(handle->handle);
  -
  -    if (rc == 0) {
  -        handle->handle = 0;
  -        return APR_SUCCESS;
  -    }
  -    handle->failing_errno = errno;
  -    return errno;
  +    return apr_run_cleanup(handle->pool, handle, dso_cleanup);
   }
   
   APR_DECLARE(apr_status_t) apr_dso_sym(apr_dso_handle_sym_t *ressym, 
  
  
  
  1.30      +14 -10    apr/dso/unix/dso.c
  
  Index: dso.c
  ===================================================================
  RCS file: /home/cvs/apr/dso/unix/dso.c,v
  retrieving revision 1.29
  retrieving revision 1.30
  diff -u -u -r1.29 -r1.30
  --- dso.c	2001/01/19 03:13:01	1.29
  +++ dso.c	2001/01/19 09:56:31	1.30
  @@ -64,7 +64,19 @@
   static apr_status_t dso_cleanup(void *thedso)
   {
       apr_dso_handle_t *dso = thedso;
  -    return apr_dso_unload(dso);
  +
  +    if (dso->handle == NULL)
  +        return APR_SUCCESS;
  +
  +#if defined(HPUX) || defined(HPUX10) || defined(HPUX11)
  +    shl_unload((shl_t)dso->handle);
  +#else
  +    if (dlclose(dso->handle) != 0)
  +        return APR_EINIT;
  +#endif
  +    dso->handle = NULL;
  +
  +    return APR_SUCCESS;
   }
   
   APR_DECLARE(apr_status_t) apr_dso_load(apr_dso_handle_t **res_handle, 
  @@ -102,15 +114,7 @@
       
   APR_DECLARE(apr_status_t) apr_dso_unload(apr_dso_handle_t *handle)
   {
  -#if defined(HPUX) || defined(HPUX10) || defined(HPUX11)
  -    shl_unload((shl_t)handle->handle);
  -#else
  -    if (dlclose(handle->handle) != 0)
  -        return APR_EINIT;
  -#endif
  -    handle->handle = NULL;
  -
  -    return APR_SUCCESS;
  +    return apr_run_cleanup(handle->cont, handle, dso_cleanup);
   }
   
   APR_DECLARE(apr_status_t) apr_dso_sym(apr_dso_handle_sym_t *ressym, 
  
  
  
  1.17      +8 -5      apr/dso/win32/dso.c
  
  Index: dso.c
  ===================================================================
  RCS file: /home/cvs/apr/dso/win32/dso.c,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -u -r1.16 -r1.17
  --- dso.c	2001/01/19 03:13:02	1.16
  +++ dso.c	2001/01/19 09:56:32	1.17
  @@ -62,7 +62,13 @@
   static apr_status_t dso_cleanup(void *thedso)
   {
       apr_dso_handle_t *dso = thedso;
  -    return apr_dso_unload(dso);
  +
  +    if (dso->handle != NULL && !FreeLibrary(dso->handle)) {
  +        return apr_get_os_error();
  +    }
  +    dso->handle = NULL;
  +
  +    return APR_SUCCESS;
   }
   
   APR_DECLARE(apr_status_t) apr_dso_load(struct apr_dso_handle_t **res_handle, 
  @@ -125,10 +131,7 @@
       
   APR_DECLARE(apr_status_t) apr_dso_unload(struct apr_dso_handle_t *handle)
   {
  -    if (!FreeLibrary(handle->handle)) {
  -        return apr_get_os_error();
  -    }
  -    return APR_SUCCESS;
  +    return apr_run_cleanup(handle->cont, handle, dso_cleanup);
   }
   
   APR_DECLARE(apr_status_t) apr_dso_sym(apr_dso_handle_sym_t *ressym, 
  
  
  

Mime
View raw message