VERTO_DEPLIB = $(VERTO_DEPLIB-@VERTO_VERSION@)
VERTO_DEPLIB-sys = # empty
-VERTO_DEPLIB-k5 = $(TOPLIBD)/libverto$(DEPLIBEXT)
+VERTO_DEPLIB-k5 = $(TOPLIBD)/libverto-k5ev$(DEPLIBEXT) $(TOPLIBD)/libverto$(DEPLIBEXT)
VERTO_CFLAGS = @VERTO_CFLAGS@
VERTO_LIBS = @VERTO_LIBS@
[AC_HELP_STRING([--with-system-verto], [always use system verto library])],
[], [with_system_verto=default])
VERTO_CFLAGS=
-VERTO_LIBS=-lverto
+VERTO_LIBS="-lverto-k5ev -lverto"
VERTO_VERSION=k5
if test "x$with_system_verto" != xno; then
if verto_cflags=`pkg-config --cflags libverto 2>&1`; 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])
#include "fake-addrinfo.h"
#include "net-server.h"
+#ifdef INTERNAL_VERTO
+#include "verto-k5ev.h"
+#endif
#include <signal.h>
types |= VERTO_EV_TYPE_IO;
types |= VERTO_EV_TYPE_SIGNAL;
types |= VERTO_EV_TYPE_TIMEOUT;
+#ifdef INTERNAL_VERTO
+ ctx = verto_default_k5ev();
+#else
ctx = verto_default(NULL, types);
+#endif
if (!verto_add_signal(ctx, VERTO_EV_FLAG_PERSIST, do_break, SIGINT) ||
!verto_add_signal(ctx, VERTO_EV_FLAG_PERSIST, do_break, SIGTERM) ||
!verto_add_signal(ctx, VERTO_EV_FLAG_PERSIST, do_break, SIGQUIT) ||
SHLIB_DIRS=-L$(TOPLIBD)
SHLIB_RDIRS=$(KRB5_LIBDIR)
-all-unix:: all-liblinks
+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)
+
+$(VERTO_K5EV_HDR): $(srcdir)/verto-k5ev.h
+ $(RM) $@
+ $(CP) $(srcdir)/verto-k5ev.h $@
rename.h: $(srcdir)/Symbols.ev
$(RM) $@
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). The
-module is not intended to be used directly by applications, so it has
-no header file.
+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,
+verto_default_k5ev
verto_module_table
+verto_new_k5ev
#include <string.h>
#include <errno.h>
-#include <verto.h>
+#include "verto-k5ev.h"
#include <verto-module.h>
#include "rename.h"
#include "autoconf.h"
#include "ev.c"
static void
-libev_ctx_free(void *ctx)
+k5ev_ctx_free(void *ctx)
{
if (ctx != EV_DEFAULT)
ev_loop_destroy(ctx);
}
static void
-libev_ctx_run(void *ctx)
+k5ev_ctx_run(void *ctx)
{
ev_run(ctx, 0);
}
static void
-libev_ctx_run_once(void *ctx)
+k5ev_ctx_run_once(void *ctx)
{
ev_run(ctx, EVRUN_ONCE);
}
static void
-libev_ctx_break(void *ctx)
+k5ev_ctx_break(void *ctx)
{
ev_break(ctx, EVBREAK_ONE);
}
return type ## w
static void *
-libev_ctx_add(void *ctx, const verto_ev *ev, verto_ev_flag *flags)
+k5ev_ctx_add(void *ctx, const verto_ev *ev, verto_ev_flag *flags)
{
ev_io *iow = NULL;
ev_timer *timerw = NULL;
}
static void
-libev_ctx_del(void *ctx, const verto_ev *ev, void *evpriv)
+k5ev_ctx_del(void *ctx, const verto_ev *ev, void *evpriv)
{
switch (verto_get_type(ev)) {
case VERTO_EV_TYPE_IO:
free(evpriv);
}
-static verto_ctx *verto_new_libev(void);
-static verto_ctx *verto_default_libev(void);
+static verto_ctx *verto_convert_k5ev(struct ev_loop* loop);
-VERTO_MODULE(libev, ev_loop_new,
+VERTO_MODULE(k5ev, NULL,
VERTO_EV_TYPE_IO |
VERTO_EV_TYPE_TIMEOUT |
VERTO_EV_TYPE_IDLE |
VERTO_EV_TYPE_SIGNAL |
VERTO_EV_TYPE_CHILD);
-static verto_ctx *
-verto_new_libev()
+verto_ctx *
+verto_new_k5ev()
+{
+ return verto_convert_k5ev(ev_loop_new(EVFLAG_AUTO));
+}
+
+verto_ctx *
+verto_default_k5ev()
{
- return verto_convert(libev, ev_loop_new(EVFLAG_AUTO));
+ return verto_convert_k5ev(ev_default_loop(EVFLAG_AUTO));
}
+/* Don't export this since our underlying libev is hidden. */
static verto_ctx *
-verto_default_libev()
+verto_convert_k5ev(struct ev_loop* loop)
{
- return verto_convert(libev, ev_default_loop(EVFLAG_AUTO));
+ return verto_convert(k5ev, loop);
}
--- /dev/null
+/*
+ * 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_ */