apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Doug MacEachern <do...@covalent.net>
Subject apr_dso_handle_close ?
Date Tue, 10 Apr 2001 00:13:58 GMT
mod_perl needs to close the handle for each Perl extension .so loaded by
Perl modules.   in 1.x we could call:
ap_os_dso_unload(handle);

where handle is the same value returned by dlopen() or similar.
Perl's abstraction is not an option since you need to call a Perl function
to use it, and we cannot close these handles until the interpreter is
destroyed.

something like the following for each $os/dso.c would do the trick.
i will implement the patch if there are no objections, otherwise it will
really suck to duplicate this functionality that is currently private in
apr.

Index: srclib/apr/dso/unix/dso.c
===================================================================
RCS file: /home/cvs/apr/dso/unix/dso.c,v
retrieving revision 1.33
diff -u -r1.33 dso.c
--- srclib/apr/dso/unix/dso.c	2001/02/16 21:04:17	1.33
+++ srclib/apr/dso/unix/dso.c	2001/04/10 00:08:52
@@ -64,19 +64,30 @@
 #include <string.h> /* for strerror() on HP-UX */
 #endif
 
+APR_DECLARE(apr_status_t) apr_dso_handle_close(void *handle)
+{
+#if defined(HPUX) || defined(HPUX10) || defined(HPUX11)
+    shl_unload((shl_t)dso->handle);
+#else
+    if (dlclose(handle) != 0) {
+        return APR_EINIT;
+    }
+#endif
+    return APR_SUCCESS;
+}
+
 static apr_status_t dso_cleanup(void *thedso)
 {
+    apr_status_t status;
     apr_dso_handle_t *dso = thedso;
 
     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
+    if ((status = apr_dso_handle_close(dso->handle)) != APR_SUCCESS) {
+        return status;
+    }
+
     dso->handle = NULL;
 
     return APR_SUCCESS;


Mime
View raw message