summaryrefslogtreecommitdiff
path: root/modules.c
diff options
context:
space:
mode:
authorrob rob@31f1291d-b8d6-0310-a050-a5561fc1590b <rob rob@31f1291d-b8d6-0310-a050-a5561fc1590b@5417fbe8-f217-4b02-8779-1006273d7864>2004-06-16 16:04:02 +0000
committerrob rob@31f1291d-b8d6-0310-a050-a5561fc1590b <rob rob@31f1291d-b8d6-0310-a050-a5561fc1590b@5417fbe8-f217-4b02-8779-1006273d7864>2004-06-16 16:04:02 +0000
commit631b4f1cb77512182d1a4b9901d34063cacb9f2a (patch)
treeb61ac18b5aa34444f288b69c835bcefd68af43c5 /modules.c
parent76fee36660207f4eaea9c05fa12913ce860cb65c (diff)
BUILD : 1.7.3 (196) BUGS : 106 NOTES : Fixed module support for OpenBSD systems
git-svn-id: svn://svn.anope.org/anope/trunk@196 31f1291d-b8d6-0310-a050-a5561fc1590b git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@138 5417fbe8-f217-4b02-8779-1006273d7864
Diffstat (limited to 'modules.c')
-rw-r--r--modules.c27
1 files changed, 18 insertions, 9 deletions
diff --git a/modules.c b/modules.c
index 0598a1a22..99b40bc49 100644
--- a/modules.c
+++ b/modules.c
@@ -14,18 +14,27 @@
#include "modules.h"
#include "language.h"
-/*
- * Disable the modules on OpenBSD (for now)
- * there is work in progress for this.
- */
#ifdef __OpenBSD__
-#ifdef USE_MODULES
-#undef USE_MODULES
-#endif /* USE_MODULES */
+#define DL_PREFIX "_" /* so OpenBSD can lookup the symbols */
+#else
+#define DL_PREFIX ""
#endif /* __OpenBSD__ */
#ifdef USE_MODULES
#include <dlfcn.h>
+/* Define these for systems without them */
+#ifndef RTLD_NOW
+#define RTLD_NOW 0
+#endif
+#ifndef RTLD_LAZY
+#define RTLD_LAZY RTLD_NOW
+#endif
+#ifndef RTLD_GLOBAL
+#define RTLD_GLOBAL 0
+#endif
+#ifndef RTLD_LOCAL
+#define RTLD_LOCAL 0
+#endif
#endif
/**
@@ -348,7 +357,7 @@ int loadModule(Module * m, User * u)
return MOD_ERR_NOLOAD;
}
- func = dlsym(m->handle, "AnopeInit");
+ func = dlsym(m->handle, DL_PREFIX "AnopeInit");
if ((err = dlerror()) != NULL) {
dlclose(m->handle); /* If no AnopeInit - it isnt an Anope Module, close it */
return MOD_ERR_NOLOAD;
@@ -400,7 +409,7 @@ int unloadModule(Module * m, User * u)
return MOD_ERR_UNKNOWN;
}
- func = dlsym(m->handle, "AnopeFini");
+ func = dlsym(m->handle, DL_PREFIX "AnopeFini");
if (func) {
func(); /* exec AnopeFini */
}