wsanchez 01/04/18 10:47:12
Modified: build apr_hints.m4
dso/unix dso.c
include/arch/unix dso.h
Log:
include/arch/unix/dso.h
Revision Changes Path
1.5 +1 -1 apr/build/apr_hints.m4
Index: apr_hints.m4
===================================================================
RCS file: /home/cvs/apr/build/apr_hints.m4,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- apr_hints.m4 2001/04/03 00:02:02 1.4
+++ apr_hints.m4 2001/04/18 17:47:09 1.5
@@ -174,7 +174,7 @@
dnl APR_ADDTO(CPPFLAGS, [-DDARWIN -DMAC_OS_X_SERVER])
dnl ;;
*-apple-darwin*)
- APR_ADDTO(CPPFLAGS, [-DDARWIN])
+ APR_ADDTO(CPPFLAGS, [-DDARWIN -DSIGPROCMASK_SETS_THREAD_MASK])
;;
*-dec-osf*)
APR_ADDTO(CPPFLAGS, [-DOSF1])
1.34 +48 -2 apr/dso/unix/dso.c
Index: dso.c
===================================================================
RCS file: /home/cvs/apr/dso/unix/dso.c,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -r1.33 -r1.34
--- dso.c 2001/02/16 21:04:17 1.33
+++ dso.c 2001/04/18 17:47:10 1.34
@@ -73,6 +73,8 @@
#if defined(HPUX) || defined(HPUX10) || defined(HPUX11)
shl_unload((shl_t)dso->handle);
+#elif defined(DARWIN)
+ NSUnLinkModule(dso->handle, FALSE);
#else
if (dlclose(dso->handle) != 0)
return APR_EINIT;
@@ -87,9 +89,28 @@
{
#if defined(HPUX) || defined(HPUX10) || defined(HPUX11)
shl_t os_handle = shl_load(path,
BIND_IMMEDIATE|BIND_VERBOSE|BIND_NOSTART, 0L);
+
+#elif defined(DARWIN)
+ NSObjectFileImage image;
+ NSModule os_handle;
+ char* err_msg = NULL;
+ if (NSCreateObjectFileImageFromFile(path, &image) !=
NSObjectFileImageSuccess) {
+ err_msg = "cannot create object file image";
+ }
+ else {
+#ifdef NSLINKMODULE_OPTION_PRIVATE
+ os_handle = NSLinkModule(image, path,
+ NSLINKMODULE_OPTION_PRIVATE |
+ NSLINKMODULE_OPTION_RETURN_ON_ERROR);
+#else
+ os_handle = NSLinkModule(image, path, TRUE);
+#endif
+ }
+
#elif defined(OSF1) || defined(SEQUENT) || defined(SNI) ||\
(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
@@ -100,6 +121,9 @@
#if defined(HPUX) || defined(HPUX10) || defined(HPUX11)
(*res_handle)->errormsg = strerror(errno);
return errno;
+#elif defined(DARWIN)
+ (*res_handle)->errormsg = (err_msg) ? err_msg : "link failed";
+ return APR_EDSOOPEN;
#else
(*res_handle)->errormsg = dlerror();
return APR_EDSOOPEN;
@@ -136,7 +160,29 @@
return APR_EINIT;
*ressym = symaddr;
return APR_SUCCESS;
-#else /* not HP-UX; use dlsym()/dlerror() */
+
+#elif defined(DARWIN)
+ void *retval = NULL;
+ NSSymbol symbol;
+ char *symname2 = (char*)malloc(sizeof(char)*(strlen(symname)+2));
+ sprintf(symname2, "_%s", symname);
+#ifdef NSLINKMODULE_OPTION_PRIVATE
+ symbol = NSLookupSymbolInModule((NSModule)handle->handle, symname2);
+#else
+ symbol = NSLookupAndBindSymbol(symname2);
+#endif
+ free(symname2);
+ if (symbol == NULL) {
+ handle->errormsg = "undefined symbol";
+ return APR_EINIT;
+ }
+ retval = NSAddressOfSymbol(symbol);
+ if (retval == NULL) {
+ handle->errormsg = "cannot resolve symbol";
+ return APR_EINIT;
+ }
+
+#else /* use dlsym()/dlerror() */
#if defined(DLSYM_NEEDS_UNDERSCORE)
void *retval;
@@ -159,7 +205,7 @@
*ressym = retval;
return APR_SUCCESS;
-#endif /* not HP-UX; use dlsym()/dlerror() */
+#endif /* use dlsym()/dlerror() */
}
APR_DECLARE(const char *) apr_dso_error(apr_dso_handle_t *dso, char *buffer,
apr_size_t buflen)
1.13 +4 -0 apr/include/arch/unix/dso.h
Index: dso.h
===================================================================
RCS file: /home/cvs/apr/include/arch/unix/dso.h,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- dso.h 2001/02/16 04:15:51 1.12
+++ dso.h 2001/04/18 17:47:11 1.13
@@ -63,6 +63,10 @@
#if APR_HAS_DSO
+#ifdef HAVE_MACH_O_DYLD_H
+#include <mach-o/dyld.h>
+#endif
+
#ifdef HAVE_DLFCN_H
#include <dlfcn.h>
#endif