svn rev #25166: trunk/src/ config/ lib/apputils/ util/k5ev/

ghudson@MIT.EDU ghudson at MIT.EDU
Tue Sep 6 19:23:39 EDT 2011


http://src.mit.edu/fisheye/changelog/krb5/?cs=25166
Commit By: ghudson
Log Message:
Change how bundled libverto is linked.

Give libverto-k5ev a header file.  When using the internal verto
library, link against -lverto-k5ev and use verto_default_k5ev()
instead of verto_default(), bypassing the module loading logic and
making static builds possible.


Changed Files:
U   trunk/src/config/pre.in
U   trunk/src/configure.in
U   trunk/src/lib/apputils/net-server.c
U   trunk/src/util/k5ev/Makefile.in
U   trunk/src/util/k5ev/README
U   trunk/src/util/k5ev/libverto-k5ev.exports
U   trunk/src/util/k5ev/verto-k5ev.c
A   trunk/src/util/k5ev/verto-k5ev.h
Modified: trunk/src/config/pre.in
===================================================================
--- trunk/src/config/pre.in	2011-09-06 16:03:37 UTC (rev 25165)
+++ trunk/src/config/pre.in	2011-09-06 23:23:39 UTC (rev 25166)
@@ -380,7 +380,7 @@
 
 VERTO_DEPLIB	= $(VERTO_DEPLIB- at 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@
 

Modified: trunk/src/configure.in
===================================================================
--- trunk/src/configure.in	2011-09-06 16:03:37 UTC (rev 25165)
+++ trunk/src/configure.in	2011-09-06 23:23:39 UTC (rev 25166)
@@ -1162,7 +1162,7 @@
   [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
@@ -1180,6 +1180,7 @@
   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])

Modified: trunk/src/lib/apputils/net-server.c
===================================================================
--- trunk/src/lib/apputils/net-server.c	2011-09-06 16:03:37 UTC (rev 25165)
+++ trunk/src/lib/apputils/net-server.c	2011-09-06 23:23:39 UTC (rev 25166)
@@ -58,6 +58,9 @@
 
 #include "fake-addrinfo.h"
 #include "net-server.h"
+#ifdef INTERNAL_VERTO
+#include "verto-k5ev.h"
+#endif
 
 #include <signal.h>
 
@@ -306,7 +309,11 @@
     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) ||

Modified: trunk/src/util/k5ev/Makefile.in
===================================================================
--- trunk/src/util/k5ev/Makefile.in	2011-09-06 16:03:37 UTC (rev 25165)
+++ trunk/src/util/k5ev/Makefile.in	2011-09-06 23:23:39 UTC (rev 25166)
@@ -23,12 +23,21 @@
 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) $@
 	$(SED) -e 's/.*/#define & k5&/' < $(srcdir)/Symbols.ev > $@

Modified: trunk/src/util/k5ev/README
===================================================================
--- trunk/src/util/k5ev/README	2011-09-06 16:03:37 UTC (rev 25165)
+++ trunk/src/util/k5ev/README	2011-09-06 23:23:39 UTC (rev 25166)
@@ -1,8 +1,6 @@
 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,

Modified: trunk/src/util/k5ev/libverto-k5ev.exports
===================================================================
--- trunk/src/util/k5ev/libverto-k5ev.exports	2011-09-06 16:03:37 UTC (rev 25165)
+++ trunk/src/util/k5ev/libverto-k5ev.exports	2011-09-06 23:23:39 UTC (rev 25166)
@@ -1 +1,3 @@
+verto_default_k5ev
 verto_module_table
+verto_new_k5ev

Modified: trunk/src/util/k5ev/verto-k5ev.c
===================================================================
--- trunk/src/util/k5ev/verto-k5ev.c	2011-09-06 16:03:37 UTC (rev 25165)
+++ trunk/src/util/k5ev/verto-k5ev.c	2011-09-06 23:23:39 UTC (rev 25166)
@@ -29,7 +29,7 @@
 #include <string.h>
 #include <errno.h>
 
-#include <verto.h>
+#include "verto-k5ev.h"
 #include <verto-module.h>
 #include "rename.h"
 #include "autoconf.h"
@@ -45,26 +45,26 @@
 #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);
 }
@@ -88,7 +88,7 @@
     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;
@@ -122,7 +122,7 @@
 }
 
 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:
@@ -142,24 +142,30 @@
     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(libev, ev_loop_new(EVFLAG_AUTO));
+    return verto_convert_k5ev(ev_loop_new(EVFLAG_AUTO));
 }
 
+verto_ctx *
+verto_default_k5ev()
+{
+    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);
 }

Added: trunk/src/util/k5ev/verto-k5ev.h
===================================================================
--- trunk/src/util/k5ev/verto-k5ev.h	                        (rev 0)
+++ trunk/src/util/k5ev/verto-k5ev.h	2011-09-06 23:23:39 UTC (rev 25166)
@@ -0,0 +1,33 @@
+/*
+ * 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_ */




More information about the cvs-krb5 mailing list