summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGreg Hudson <ghudson@mit.edu>2012-07-08 18:04:56 -0400
committerGreg Hudson <ghudson@mit.edu>2012-09-04 01:31:46 -0400
commitc91cda209a1e2467bbb5fbb5a3116757d38ef374 (patch)
tree96f17a8541bc5e637f4fc0cb90d354bcf2fb3fda
parent6b60871d961eff2fa4c476867ae9d8cbcffb8953 (diff)
downloadkrb5-c91cda209a1e2467bbb5fbb5a3116757d38ef374.tar.gz
krb5-c91cda209a1e2467bbb5fbb5a3116757d38ef374.tar.xz
krb5-c91cda209a1e2467bbb5fbb5a3116757d38ef374.zip
Avoid libdl dependencies in bundled libverto
The upstream libverto depends on dynamic loading and in particular on dladdr(), which is not universal. To avoid this dependency, stub out support for module loading (by replacing module.c) and instead integrate the k5ev module directly into the bundled verto library. This change removes the need to link, include, and invoke libverto differently depending on whether we're using the bundled library; we can always just link with -lverto and call verto_default(). bigredbutton: whitespace ticket: 7351 (new)
-rw-r--r--src/config/pre.in5
-rw-r--r--src/configure.in7
-rw-r--r--src/lib/apputils/deps2
-rw-r--r--src/lib/apputils/net-server.c9
-rw-r--r--src/util/Makefile.in2
-rw-r--r--src/util/depfix.pl1
-rw-r--r--src/util/k5ev/Makefile.in52
-rw-r--r--src/util/k5ev/README31
-rw-r--r--src/util/k5ev/deps7
-rw-r--r--src/util/k5ev/libverto-k5ev.exports3
-rw-r--r--src/util/k5ev/verto-k5ev.h33
-rw-r--r--src/util/verto/Makefile.in22
-rw-r--r--src/util/verto/README40
-rw-r--r--src/util/verto/Symbols.ev (renamed from src/util/k5ev/Symbols.ev)0
-rw-r--r--src/util/verto/deps4
-rw-r--r--src/util/verto/ev.c (renamed from src/util/k5ev/ev.c)0
-rw-r--r--src/util/verto/ev.h (renamed from src/util/k5ev/ev.h)0
-rw-r--r--src/util/verto/ev_poll.c (renamed from src/util/k5ev/ev_poll.c)0
-rw-r--r--src/util/verto/ev_select.c (renamed from src/util/k5ev/ev_select.c)0
-rw-r--r--src/util/verto/ev_vars.h (renamed from src/util/k5ev/ev_vars.h)0
-rw-r--r--src/util/verto/ev_win32.c (renamed from src/util/k5ev/ev_win32.c)0
-rw-r--r--src/util/verto/ev_wrap.h (renamed from src/util/k5ev/ev_wrap.h)0
-rw-r--r--src/util/verto/module.c179
-rw-r--r--src/util/verto/verto-k5ev.c (renamed from src/util/k5ev/verto-k5ev.c)11
-rw-r--r--src/util/verto/verto-libev.c (renamed from src/util/k5ev/verto-libev.c)0
25 files changed, 68 insertions, 340 deletions
diff --git a/src/config/pre.in b/src/config/pre.in
index e5a087c02c..1ba26d8502 100644
--- a/src/config/pre.in
+++ b/src/config/pre.in
@@ -369,9 +369,6 @@ VERTO_VERSION = @VERTO_VERSION@
VERTO_DEPS = $(VERTO_DEPS-@VERTO_VERSION@)
VERTO_DEPS-sys =
VERTO_DEPS-k5 = $(BUILDTOP)/include/verto.h
-VERTO_K5EV_DEPS = $(VERTO_K5EV_DEPS-@VERTO_VERSION@)
-VERTO_K5EV_DEPS-sys =
-VERTO_K5EV_DEPS-k5 = $(BUILDTOP)/include/verto-k5ev.h
# LIBS gets substituted in... e.g. -lnsl -lsocket
@@ -389,7 +386,7 @@ KDB5_LIB = -lkdb5 $(KDB5_PLUGIN_LIBS)
VERTO_DEPLIB = $(VERTO_DEPLIB-@VERTO_VERSION@)
VERTO_DEPLIB-sys = # empty
-VERTO_DEPLIB-k5 = $(TOPLIBD)/libverto-k5ev$(DEPLIBEXT) $(TOPLIBD)/libverto$(DEPLIBEXT)
+VERTO_DEPLIB-k5 = $(TOPLIBD)/libverto$(DEPLIBEXT)
VERTO_CFLAGS = @VERTO_CFLAGS@
VERTO_LIBS = @VERTO_LIBS@
diff --git a/src/configure.in b/src/configure.in
index 9e9c94ff99..7154f686bd 100644
--- a/src/configure.in
+++ b/src/configure.in
@@ -1219,7 +1219,7 @@ AC_ARG_WITH([system-verto],
[AC_HELP_STRING([--with-system-verto], [always use system verto library])],
[], [with_system_verto=default])
VERTO_CFLAGS=
-VERTO_LIBS="-lverto-k5ev -lverto"
+VERTO_LIBS="-lverto"
VERTO_VERSION=k5
if test "x$with_system_verto" != xno; then
if verto_cflags=`pkg-config --cflags libverto 2>&1`; then
@@ -1227,7 +1227,7 @@ if test "x$with_system_verto" != xno; then
VERTO_LIBS=`pkg-config --libs libverto`
VERTO_VERSION=sys
else
- AC_CHECK_LIB([verto], [verto_run], [VERTO_VERSION=sys; VERTO_LIBS=-lverto],
+ AC_CHECK_LIB([verto], [verto_run], [VERTO_VERSION=sys],
[if test "x$with_system_verto" = xyes; then
AC_MSG_ERROR([cannot detect system libverto])
fi])
@@ -1237,7 +1237,6 @@ if test "x$VERTO_VERSION" = xsys; then
AC_MSG_NOTICE([Using system libverto])
else
AC_MSG_RESULT([Using built-in libverto])
- AC_DEFINE([INTERNAL_VERTO],[1],[Define if using bundled libverto])
fi
AC_SUBST([VERTO_CFLAGS])
AC_SUBST([VERTO_LIBS])
@@ -1295,7 +1294,7 @@ AC_CONFIG_FILES(krb5-config, [chmod +x krb5-config])
V5_AC_OUTPUT_MAKEFILE(.
util util/support util/profile util/profile/testmod util/send-pr
- util/verto util/k5ev
+ util/verto
lib lib/kdb
diff --git a/src/lib/apputils/deps b/src/lib/apputils/deps
index 586e1ef767..a41563e78f 100644
--- a/src/lib/apputils/deps
+++ b/src/lib/apputils/deps
@@ -16,7 +16,7 @@ net-server.so net-server.po $(OUTPRE)net-server.$(OBJEXT): \
$(BUILDTOP)/include/autoconf.h $(BUILDTOP)/include/gssapi/gssapi.h \
$(BUILDTOP)/include/gssrpc/types.h $(BUILDTOP)/include/krb5/krb5.h \
$(BUILDTOP)/include/osconf.h $(BUILDTOP)/include/profile.h \
- $(COM_ERR_DEPS) $(VERTO_DEPS) $(VERTO_K5EV_DEPS) $(top_srcdir)/include/adm_proto.h \
+ $(COM_ERR_DEPS) $(VERTO_DEPS) $(top_srcdir)/include/adm_proto.h \
$(top_srcdir)/include/fake-addrinfo.h $(top_srcdir)/include/foreachaddr.h \
$(top_srcdir)/include/gssrpc/auth.h $(top_srcdir)/include/gssrpc/auth_gss.h \
$(top_srcdir)/include/gssrpc/auth_unix.h $(top_srcdir)/include/gssrpc/clnt.h \
diff --git a/src/lib/apputils/net-server.c b/src/lib/apputils/net-server.c
index 0fd08eceea..1f8a8f97ae 100644
--- a/src/lib/apputils/net-server.c
+++ b/src/lib/apputils/net-server.c
@@ -58,10 +58,6 @@
#include "fake-addrinfo.h"
#include "net-server.h"
-#ifdef INTERNAL_VERTO
-#include "verto-k5ev.h"
-#endif
-
#include <signal.h>
/* XXX */
@@ -269,12 +265,7 @@ loop_init(verto_ev_type types)
types |= VERTO_EV_TYPE_IO;
types |= VERTO_EV_TYPE_SIGNAL;
types |= VERTO_EV_TYPE_TIMEOUT;
-
-#ifdef INTERNAL_VERTO
- return verto_default_k5ev();
-#else
return verto_default(NULL, types);
-#endif
}
static void
diff --git a/src/util/Makefile.in b/src/util/Makefile.in
index f45bc70825..f2f6b75d1e 100644
--- a/src/util/Makefile.in
+++ b/src/util/Makefile.in
@@ -15,7 +15,7 @@ MAYBE_ET_sys =
MAYBE_ET_intlsys =
MAYBE_SS_sys =
MAYBE_VERTO_sys =
-MAYBE_VERTO_k5 = verto k5ev
+MAYBE_VERTO_k5 = verto
all-recurse:
diff --git a/src/util/depfix.pl b/src/util/depfix.pl
index 4fc37890bf..f648da8948 100644
--- a/src/util/depfix.pl
+++ b/src/util/depfix.pl
@@ -141,7 +141,6 @@ sub do_subs_2 {
s;\$\(BUILDTOP\)/include/com_err.h ;\$(COM_ERR_DEPS) ;g;
s;\$\(BUILDTOP\)/include/ss/ss.h \$\(BUILDTOP\)/include/ss/ss_err.h ;\$(SS_DEPS) ;g;
s;\$\(BUILDTOP\)/include/db-config.h \$\(BUILDTOP\)/include/db.h ;\$(DB_DEPS) ;g;
- s;\$\(BUILDTOP\)/include/verto-k5ev.h ;\$(VERTO_K5EV_DEPS) ;g;
s;\$\(BUILDTOP\)/include/verto.h ;\$(VERTO_DEPS) ;g;
if ($thisdir eq "util/gss-kernel-lib") {
# Here com_err.h is used from the current directory.
diff --git a/src/util/k5ev/Makefile.in b/src/util/k5ev/Makefile.in
deleted file mode 100644
index b80a60dfb4..0000000000
--- a/src/util/k5ev/Makefile.in
+++ /dev/null
@@ -1,52 +0,0 @@
-mydir=util$(S)k5ev
-BUILDTOP=$(REL)..$(S)..
-RELDIR=../util/k5ev
-DEFS=
-
-SED = sed
-
-LIBBASE=verto-k5ev
-LIBMAJOR=0
-LIBMINOR=0
-
-LOCALINCLUDES=-I. -I$(srcdir)/../verto
-
-# Turn off extra warnings since we're not going to clean up libev's code.
-WARN_CFLAGS=
-
-STLIBOBJS=verto-k5ev.o
-LIBOBJS=$(OUTPRE)verto-k5ev.$(OBJEXT)
-SRCS=verto-k5ev.c
-
-STOBJLISTS=OBJS.ST
-SHLIB_EXPLIBS= $(LIBS) -lverto -lm # libm needed for ceil() currently.
-SHLIB_DIRS=-L$(TOPLIBD)
-SHLIB_RDIRS=$(KRB5_LIBDIR)
-
-VERTO_K5EV_HDR=$(BUILDTOP)$(S)include$(S)verto-k5ev.h
-
-all-unix:: all-liblinks includes
-
-install-unix:: install-libs
-
-clean-unix:: clean-liblinks clean-libs clean-libobjs
- $(RM) $(VERTO_K5EV_HDR)
-
-includes:: $(VERTO_K5EV_HDR)
-depend:: $(VERTO_K5EV_HDR)
-
-$(VERTO_K5EV_HDR): $(srcdir)/verto-k5ev.h
- $(RM) $@
- $(CP) $(srcdir)/verto-k5ev.h $@
-
-rename.h: $(srcdir)/Symbols.ev
- $(RM) $@
- $(SED) -e 's/.*/#define & k5&/' < $(srcdir)/Symbols.ev > $@
-
-clean::
- $(RM) rename.h
-
-depend:: rename.h
-
-@lib_frag@
-@libobj_frag@
diff --git a/src/util/k5ev/README b/src/util/k5ev/README
deleted file mode 100644
index 7a14f13274..0000000000
--- a/src/util/k5ev/README
+++ /dev/null
@@ -1,31 +0,0 @@
-This directory builds a private libverto module using an embedded
-libev with renamed symbols (so we don't leak libev symbols into the
-namespace on platforms where we can't control the export list).
-
-libev has built-in support for this kind of embedding, so we don't
-have to modify the libev sources. Following libev's documentation,
-the following files have been copied from the ev sources:
-
- ev.h
- ev_vars.h
- ev_wrap.h
- ev.c
- ev_select.c
- ev_poll.c
- ev_win32.c
- Symbols.ev
-
-(Symbols.ev wasn't included in the 4.04 tar file due to an oversight,
-so it is taken from the appropriate tag in libev's source repository.)
-
-To rename the exported symbols, we create rename.h from Symbols.ev.
-We also use Symbols.ev to construct the library export list.
-(Renaming libev's symbols would be unnecessary if libev's embedding
-had support for making its API symbols static, but it currently does
-not.) The source file verto-k5ev.c wraps ev.c with appropriate
-embedding defines, and then defines the libverto module functions
-using the slightly modified contents of libverto's verto-ev.c.
-
-The libev upstream project page is at:
-
- http://software.schmorp.de/pkg/libev.html
diff --git a/src/util/k5ev/deps b/src/util/k5ev/deps
deleted file mode 100644
index 5fd8552493..0000000000
--- a/src/util/k5ev/deps
+++ /dev/null
@@ -1,7 +0,0 @@
-#
-# Generated makefile dependencies follow.
-#
-verto-k5ev.so verto-k5ev.po $(OUTPRE)verto-k5ev.$(OBJEXT): \
- $(BUILDTOP)/include/autoconf.h $(VERTO_DEPS) $(srcdir)/../verto/verto-module.h \
- ev.c ev.h ev_poll.c ev_select.c ev_vars.h ev_wrap.h \
- rename.h verto-k5ev.c verto-k5ev.h
diff --git a/src/util/k5ev/libverto-k5ev.exports b/src/util/k5ev/libverto-k5ev.exports
deleted file mode 100644
index 7907fbef70..0000000000
--- a/src/util/k5ev/libverto-k5ev.exports
+++ /dev/null
@@ -1,3 +0,0 @@
-verto_default_k5ev
-verto_module_table_k5ev
-verto_new_k5ev
diff --git a/src/util/k5ev/verto-k5ev.h b/src/util/k5ev/verto-k5ev.h
deleted file mode 100644
index 0b1ad192c3..0000000000
--- a/src/util/k5ev/verto-k5ev.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Copyright 2011 Red Hat, Inc.
- *
- * Permission is hereby granted, free of charge, to any person
- * obtaining a copy of this software and associated documentation files
- * (the "Software"), to deal in the Software without restriction,
- * including without limitation the rights to use, copy, modify, merge,
- * publish, distribute, sublicense, and/or sell copies of the Software,
- * and to permit persons to whom the Software is furnished to do so,
- * subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-#ifndef VERTO_K5EV_H_
-#define VERTO_K5EV_H_
-
-#include <verto.h>
-
-verto_ctx *verto_new_k5ev(void);
-verto_ctx *verto_default_k5ev(void);
-
-#endif /* VERTO_K5EV_H_ */
diff --git a/src/util/verto/Makefile.in b/src/util/verto/Makefile.in
index f7206c83d4..ff1bd1af71 100644
--- a/src/util/verto/Makefile.in
+++ b/src/util/verto/Makefile.in
@@ -6,32 +6,38 @@ LIBBASE=verto
LIBMAJOR=0
LIBMINOR=0
-LOCALINCLUDES=-I$(srcdir)
-DEFINES=-DDEFAULT_LIBRARY=\"k5ev\"
+LOCALINCLUDES=-I$(srcdir) -I.
+DEFINES=-DDEFAULT_LIBRARY=\"k5ev\" -DBUILTIN_MODULE=k5ev
# Turn off extra warnings since we're not going to clean up libverto's code.
WARN_CFLAGS=
-STLIBOBJS=verto.o module.o
-LIBOBJS=$(OUTPRE)verto.$(OBJEXT) $(OUTPRE)module.$(OBJEXT)
-SRCS=verto.c module.c
+STLIBOBJS=verto.o module.o verto-k5ev.o
+LIBOBJS=$(OUTPRE)verto.$(OBJEXT) \
+ $(OUTPRE)module.$(OBJEXT) \
+ $(OUTPRE)verto-k5ev.$(OBJEXT)
+SRCS=verto.c module.c verto-k5ev.c
STOBJLISTS=OBJS.ST
-SHLIB_EXPLIBS= $(DL_LIB) $(LIBS)
+SHLIB_EXPLIBS= $(LIBS) -lm # libm needed for ceil() currently.
SHLIB_DIRS=
SHLIB_RDIRS=$(KRB5_LIBDIR)
VERTO_HDR=$(BUILDTOP)$(S)include$(S)verto.h
+rename.h: $(srcdir)/Symbols.ev
+ $(RM) $@
+ $(SED) -e 's/.*/#define & k5&/' < $(srcdir)/Symbols.ev > $@
+
all-unix:: all-liblinks includes
install-unix:: install-libs
clean-unix:: clean-liblinks clean-libs clean-libobjs
- $(RM) $(VERTO_HDR)
+ $(RM) $(VERTO_HDR) rename.h
includes:: $(VERTO_HDR)
-depend:: $(VERTO_HDR)
+depend:: $(VERTO_HDR) rename.h
$(VERTO_HDR): $(srcdir)/verto.h
$(RM) $@
diff --git a/src/util/verto/README b/src/util/verto/README
index 8e47610565..6de645f6fb 100644
--- a/src/util/verto/README
+++ b/src/util/verto/README
@@ -1,6 +1,40 @@
-This directory builds a verto library with only a private back-end
-module, for use when the system has no installed verto library.
+This directory builds a verto library with only a private built-in
+module, for use when the system has no installed verto library. The
+bundled verto cannot dynamically load modules. From the upstream
+libverto, we take only verto.c and verto-libev.c, and we only build
+the former; the latter is stored here for comparison purposes. We use
+a stub implementation of module.c to disable dynamic loading support.
-The libverto upstream project page is at:
+This private module uses an embedded libev with renamed symbols (so we
+don't leak libev symbols into the namespace on platforms where we
+can't control the export list). libev has built-in support for this
+kind of embedding, so we don't have to modify the libev sources.
+Following libev's documentation, the following files have been copied
+from the ev sources:
+
+ ev.h
+ ev_vars.h
+ ev_wrap.h
+ ev.c
+ ev_select.c
+ ev_poll.c
+ ev_win32.c
+ Symbols.ev
+
+(Symbols.ev wasn't included in the 4.04 tar file due to an oversight,
+so it is taken from the appropriate tag in libev's source repository.)
+
+To rename the exported symbols, we create rename.h from Symbols.ev.
+We also use Symbols.ev to construct the library export list.
+(Renaming libev's symbols would be unnecessary if libev's embedding
+had support for making its API symbols static, but it currently does
+not.) The source file verto-k5ev.c wraps ev.c with appropriate
+embedding defines, and then defines the libverto module functions
+using the slightly modified contents of libverto's verto-libev.c. The
+resulting module table is embedded into verto.c using the
+BUILTIN_MODULE define.
+
+The libverto and libev upstream project pages are at:
https://fedorahosted.org/libverto/
+ http://software.schmorp.de/pkg/libev.html
diff --git a/src/util/k5ev/Symbols.ev b/src/util/verto/Symbols.ev
index 7a29a75cba..7a29a75cba 100644
--- a/src/util/k5ev/Symbols.ev
+++ b/src/util/verto/Symbols.ev
diff --git a/src/util/verto/deps b/src/util/verto/deps
index dad2f3aa63..3424d30382 100644
--- a/src/util/verto/deps
+++ b/src/util/verto/deps
@@ -4,3 +4,7 @@
verto.so verto.po $(OUTPRE)verto.$(OBJEXT): $(VERTO_DEPS) \
module.h verto-module.h verto.c
module.so module.po $(OUTPRE)module.$(OBJEXT): module.c
+verto-k5ev.so verto-k5ev.po $(OUTPRE)verto-k5ev.$(OBJEXT): \
+ $(BUILDTOP)/include/autoconf.h $(VERTO_DEPS) ev.c ev.h \
+ ev_poll.c ev_select.c ev_vars.h ev_wrap.h rename.h \
+ verto-k5ev.c verto-module.h
diff --git a/src/util/k5ev/ev.c b/src/util/verto/ev.c
index 4187b18af7..4187b18af7 100644
--- a/src/util/k5ev/ev.c
+++ b/src/util/verto/ev.c
diff --git a/src/util/k5ev/ev.h b/src/util/verto/ev.h
index 27c1778f1f..27c1778f1f 100644
--- a/src/util/k5ev/ev.h
+++ b/src/util/verto/ev.h
diff --git a/src/util/k5ev/ev_poll.c b/src/util/verto/ev_poll.c
index e53ae0de93..e53ae0de93 100644
--- a/src/util/k5ev/ev_poll.c
+++ b/src/util/verto/ev_poll.c
diff --git a/src/util/k5ev/ev_select.c b/src/util/verto/ev_select.c
index 0ea9467e40..0ea9467e40 100644
--- a/src/util/k5ev/ev_select.c
+++ b/src/util/verto/ev_select.c
diff --git a/src/util/k5ev/ev_vars.h b/src/util/verto/ev_vars.h
index 5ee3ed1b2a..5ee3ed1b2a 100644
--- a/src/util/k5ev/ev_vars.h
+++ b/src/util/verto/ev_vars.h
diff --git a/src/util/k5ev/ev_win32.c b/src/util/verto/ev_win32.c
index 338886efe4..338886efe4 100644
--- a/src/util/k5ev/ev_win32.c
+++ b/src/util/verto/ev_win32.c
diff --git a/src/util/k5ev/ev_wrap.h b/src/util/verto/ev_wrap.h
index 2c195c5db4..2c195c5db4 100644
--- a/src/util/k5ev/ev_wrap.h
+++ b/src/util/verto/ev_wrap.h
diff --git a/src/util/verto/module.c b/src/util/verto/module.c
index d5977cbbc9..68dc7093de 100644
--- a/src/util/verto/module.c
+++ b/src/util/verto/module.c
@@ -22,138 +22,25 @@
* SOFTWARE.
*/
-#ifdef WIN32
-#include <windows.h>
-#define dlltype HMODULE
-static char *
-dllerror(void) {
- char *amsg;
- LPTSTR msg;
+/* Stub implementation of module loading for MIT krb5 bundled libverto. */
- FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER
- | FORMAT_MESSAGE_FROM_SYSTEM
- | FORMAT_MESSAGE_IGNORE_INSERTS,
- NULL, GetLastError(),
- MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
- (LPTSTR) &msg, 0, NULL);
- amsg = strdup((const char*) msg);
- LocalFree(msg);
- return amsg;
-}
-#elif defined(aix)
-#include "sys/ldr.h"
-
-struct Dl_info {
- const char* dli_fname;
-};
-
-static int
-dladdr(void* s, Dl_info* i)
-{
- static const size_t bufSize = 4096;
- G__FastAllocString buf(bufSize);
- char* pldi = buf;
- int r;
-
- r = loadquery(L_GETINFO, pldi, bufSize);
- if (r == -1) {
- i->dli_fname = NULL;
- return 0;
- }
-
- for (ld_info* ldi = (ld_info*) buf;
- ldi->ldinfo_next;
- ldi += ldi->ldinfo_next) {
- char* textBegin = (char*) ldi->ldinfo_textorg;
- if (textBegin < s) {
- char* textEnd = textBegin + ldi->ldinfo_textsize;
- if (textEnd > s) {
- i->dli_fname = ldi->ldinfo_filename;
- return 1;
- }
- }
- }
-
- // First is main(), skip.
- ld_info* ldi = (ld_info*) pldi;
- while (ldi->ldinfo_next) {
- pldi += ldi->ldinfo_next;
- ldi = (ld_info*) pldi;
-
- }
-
- i->dli_fname = NULL;
- return 0;
-}
-#else
-#define _GNU_SOURCE
-#include <stdlib.h>
#include <string.h>
-#include <dlfcn.h>
-#define dlltype void *
-#define dllerror() strdup(dlerror())
-#endif
int
module_symbol_is_present(const char *modname, const char *symbname)
{
-#ifdef WIN32
- return (GetProcAddress(GetModuleHandle(modname), symbname) != NULL ||
- GetProcAddress(GetModuleHandle(NULL), symbname) != NULL);
-#else /* WIN32 */
- void* mod = dlopen(NULL, RTLD_LAZY | RTLD_LOCAL);
- if (mod) {
- void* sym = dlsym(mod, symbname);
- dlclose(mod);
- return sym != NULL;
- }
-#endif /* WIN32 */
return 0;
}
int
module_get_filename_for_symbol(void *addr, char **filename)
{
-#ifdef WIN32
- MEMORY_BASIC_INFORMATION info;
- HMODULE mod;
- char tmp[MAX_PATH];
-
- if (!VirtualQuery(addr, &info, sizeof(info)))
- return 0;
- mod = (HMODULE) info.AllocationBase;
-
- if (!GetModuleFileNameA(mod, tmp, MAX_PATH))
- return 0;
-#else
- const char *tmp;
- Dl_info dlinfo;
-
- if (!dladdr(addr, &dlinfo))
- return 0;
- tmp = dlinfo.dli_fname;
-#endif
-
- if (filename) {
- *filename = strdup(tmp);
- if (!*filename)
- return 0;
- }
-
- return 1;
+ return 0;
}
void
module_close(void *dll)
{
- if (!dll)
- return;
-
-#ifdef WIN32
- FreeLibrary((dlltype) dll);
-#else /* WIN32 */
- dlclose((dlltype) dll);
-#endif /* WIN32 */
}
char *
@@ -161,69 +48,9 @@ module_load(const char *filename, const char *symbname,
int (*shouldload)(void *symb, void *misc, char **err), void *misc,
void **dll, void **symb)
{
- dlltype intdll = NULL;
- void * intsym = NULL;
- char * interr = NULL;
-
if (dll)
*dll = NULL;
if (symb)
*symb = NULL;
-
- /* Open the module library */
-#ifdef WIN32
- /* NOTE: DONT_RESOLVE_DLL_REFERENCES is evil. Don't use this in your own
- * code. However, our design pattern avoids all the issues surrounding a
- * more general use of this evil flag. */
- intdll = LoadLibraryEx(filename, NULL, DONT_RESOLVE_DLL_REFERENCES);
-#else /* WIN32 */
- intdll = dlopen(filename, RTLD_LAZY | RTLD_LOCAL);
-#endif /* WIN32 */
- if (!intdll)
- return dllerror();
-
- /* Get the module symbol */
-#ifdef WIN32
- intsym = (void *) GetProcAddress(intdll, symbname);
-#else /* WIN32 */
- intsym = dlsym(intdll, symbname);
-#endif /* WIN32 */
- if (!intsym) {
- module_close(intdll);
- return dllerror();
- }
-
- /* Figure out whether or not to load this module */
- if (!shouldload(intsym, misc, &interr)) {
- module_close(intdll);
- return interr;
- }
-
- /* Re-open the module */
- module_close(intdll);
-#ifdef WIN32
- intdll = LoadLibrary(filename);
-#else /* WIN32 */
- intdll = dlopen(filename, RTLD_NOW | RTLD_LOCAL);
-#endif /* WIN32 */
- if (!intdll) {
- return dllerror();
- }
-
- /* Get the symbol again */
-#ifdef WIN32
- intsym = (void *) GetProcAddress(intdll, symbname);
-#else /* WIN32 */
- intsym = dlsym(intdll, symbname);
-#endif /* WIN32 */
- if (!intsym) {
- module_close(intdll);
- return dllerror();
- }
-
- if (dll)
- *dll = intdll;
- if (symb)
- *symb = intsym;
- return NULL;
+ return strdup("module loading disabled");
}
diff --git a/src/util/k5ev/verto-k5ev.c b/src/util/verto/verto-k5ev.c
index 35c94d66ed..f75e8aad6c 100644
--- a/src/util/k5ev/verto-k5ev.c
+++ b/src/util/verto/verto-k5ev.c
@@ -32,7 +32,7 @@
#include <string.h>
#include <errno.h>
-#include "verto-k5ev.h"
+#include <verto.h>
#include <verto-module.h>
#include "rename.h"
#include "autoconf.h"
@@ -201,15 +201,12 @@ k5ev_ctx_del(verto_mod_ctx *ctx, const verto_ev *ev, verto_mod_ev *evpriv)
free(evpriv);
}
+verto_ctx *verto_new_k5ev(void);
+verto_ctx *verto_default_k5ev(void);
+
VERTO_MODULE(k5ev, NULL,
VERTO_EV_TYPE_IO |
VERTO_EV_TYPE_TIMEOUT |
VERTO_EV_TYPE_IDLE |
VERTO_EV_TYPE_SIGNAL |
VERTO_EV_TYPE_CHILD);
-
-verto_ctx *
-verto_convert_k5ev(struct ev_loop* loop)
-{
- return verto_convert(k5ev, 0, loop);
-}
diff --git a/src/util/k5ev/verto-libev.c b/src/util/verto/verto-libev.c
index 9c7c32449c..9c7c32449c 100644
--- a/src/util/k5ev/verto-libev.c
+++ b/src/util/verto/verto-libev.c