summaryrefslogtreecommitdiff
path: root/dso
diff options
context:
space:
mode:
authorrbb <rbb@13f79535-47bb-0310-9956-ffa450edef68>2001-01-19 03:13:02 +0000
committerrbb <rbb@13f79535-47bb-0310-9956-ffa450edef68>2001-01-19 03:13:02 +0000
commit902134ea04eb2cd97ee7ab340895744d9353ce3e (patch)
tree5c979cc1ddbb3d1178e7d5dc58c04655a6a6f995 /dso
parent46ca5469febcf0dfa08726d2700ce965fb1b25ee (diff)
downloadlibapr-902134ea04eb2cd97ee7ab340895744d9353ce3e.tar.gz
All platforms now register a cleanup when a DSO is loaded. This just
makes a practice uniform across all platforms. In the past, this was done differently on different platforms. git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@61076 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'dso')
-rw-r--r--dso/aix/dso.c9
-rw-r--r--dso/beos/dso.c9
-rw-r--r--dso/unix/dso.c9
-rw-r--r--dso/win32/dso.c9
4 files changed, 36 insertions, 0 deletions
diff --git a/dso/aix/dso.c b/dso/aix/dso.c
index cd63af0b1..98425c6c1 100644
--- a/dso/aix/dso.c
+++ b/dso/aix/dso.c
@@ -132,6 +132,12 @@ struct dl_info {
* add the basic "wrappers" here.
*/
+static apr_status_t dso_cleanup(void *thedso)
+{
+ apr_dso_handle_t *dso = thedso;
+ return apr_dso_unload(dso);
+}
+
APR_DECLARE(apr_status_t) apr_dso_load(apr_dso_handle_t **res_handle,
const char *path, apr_pool_t *ctx)
{
@@ -143,6 +149,9 @@ APR_DECLARE(apr_status_t) apr_dso_load(apr_dso_handle_t **res_handle,
*res_handle = apr_pcalloc(ctx, sizeof(*res_handle));
(*res_handle)->handle = (void*)os_handle;
(*res_handle)->cont = ctx;
+
+ apr_register_cleanup(ctx, *res_handle, dso_cleanup, apr_null_cleanup);
+
return APR_SUCCESS;
}
diff --git a/dso/beos/dso.c b/dso/beos/dso.c
index bb01d858c..4306db765 100644
--- a/dso/beos/dso.c
+++ b/dso/beos/dso.c
@@ -56,6 +56,12 @@
#if APR_HAS_DSO
+static apr_status_t dso_cleanup(void *thedso)
+{
+ apr_dso_handle_t *dso = thedso;
+ return apr_dso_unload(dso);
+}
+
APR_DECLARE(apr_status_t) apr_dso_load(apr_dso_handle_t **res_handle, const char *path,
apr_pool_t *ctx)
{
@@ -67,6 +73,9 @@ APR_DECLARE(apr_status_t) apr_dso_load(apr_dso_handle_t **res_handle, const char
*res_handle = apr_pcalloc(ctx, sizeof(*res_handle));
(*res_handle)->handle = newid;
(*res_handle)->cont = ctx;
+
+ apr_register_cleanup(ctx, *res_handle, dso_cleanup, apr_null_cleanup);
+
return APR_SUCCESS;
}
diff --git a/dso/unix/dso.c b/dso/unix/dso.c
index 154a11fb0..ada9c314f 100644
--- a/dso/unix/dso.c
+++ b/dso/unix/dso.c
@@ -61,6 +61,12 @@
#include <stddef.h>
#endif
+static apr_status_t dso_cleanup(void *thedso)
+{
+ apr_dso_handle_t *dso = thedso;
+ return apr_dso_unload(dso);
+}
+
APR_DECLARE(apr_status_t) apr_dso_load(apr_dso_handle_t **res_handle,
const char *path, apr_pool_t *ctx)
{
@@ -88,6 +94,9 @@ APR_DECLARE(apr_status_t) apr_dso_load(apr_dso_handle_t **res_handle,
(*res_handle)->handle = (void*)os_handle;
(*res_handle)->cont = ctx;
(*res_handle)->errormsg = NULL;
+
+ apr_register_cleanup(ctx, *res_handle, dso_cleanup, apr_null_cleanup);
+
return APR_SUCCESS;
}
diff --git a/dso/win32/dso.c b/dso/win32/dso.c
index 3899fa223..a2ba47ddb 100644
--- a/dso/win32/dso.c
+++ b/dso/win32/dso.c
@@ -59,6 +59,12 @@
#if APR_HAS_DSO
+static apr_status_t dso_cleanup(void *thedso)
+{
+ apr_dso_handle_t *dso = thedso;
+ return apr_dso_unload(dso);
+}
+
APR_DECLARE(apr_status_t) apr_dso_load(struct apr_dso_handle_t **res_handle,
const char *path, apr_pool_t *ctx)
{
@@ -111,6 +117,9 @@ APR_DECLARE(apr_status_t) apr_dso_load(struct apr_dso_handle_t **res_handle,
(*res_handle)->handle = (void*)os_handle;
(*res_handle)->cont = ctx;
(*res_handle)->load_error = APR_SUCCESS;
+
+ apr_register_cleanup(ctx, *res_handle, dso_cleanup, apr_null_cleanup);
+
return APR_SUCCESS;
}