svn rev #25127: trunk/src/ config/ util/ util/k5ev/ util/verto/

ghudson@MIT.EDU ghudson at MIT.EDU
Fri Sep 2 13:07:45 EDT 2011


http://src.mit.edu/fisheye/changelog/krb5/?cs=25127
Commit By: ghudson
Log Message:
Create k5ev verto module from libev sources.

Add configure and build support for libverto and the libverto-k5ev
module.  Fix the version script rules to work for libraries with
hyphens in their names.


Changed Files:
U   trunk/src/config/lib.in
U   trunk/src/config/pre.in
U   trunk/src/configure.in
U   trunk/src/util/Makefile.in
A   trunk/src/util/k5ev/Makefile.in
A   trunk/src/util/k5ev/README
A   trunk/src/util/k5ev/deps
A   trunk/src/util/k5ev/k5ev.c
A   trunk/src/util/k5ev/libverto-k5ev.exports
A   trunk/src/util/k5ev/verto-k5ev.c
A   trunk/src/util/verto/Makefile.in
A   trunk/src/util/verto/deps
A   trunk/src/util/verto/libverto.exports
Modified: trunk/src/config/lib.in
===================================================================
--- trunk/src/config/lib.in	2011-09-02 17:07:40 UTC (rev 25126)
+++ trunk/src/config/lib.in	2011-09-02 17:07:45 UTC (rev 25127)
@@ -54,7 +54,8 @@
 	$(LN_S) lib$(LIBBASE)$(SHLIBVEXT) $@
 
 binutils.versions: $(SHLIB_EXPORT_FILE) Makefile
-	echo >  binutils.versions "$(LIBBASE)_$(LIBMAJOR)_MIT {"
+	base=`echo "$(LIBBASE)" | sed -e 's/-/_/'`; \
+	echo >  binutils.versions "$${base}_$(LIBMAJOR)_MIT {"
 	sed  >> binutils.versions < $(SHLIB_EXPORT_FILE) "s/$$/;/"
 	echo >> binutils.versions "};"
 	echo >> binutils.versions "HIDDEN { local: __*; _rest*; _save*; *; };"
@@ -89,8 +90,9 @@
 	  else :; fi; \
 	done; echo "$$a" >> hpux10.tmp
 	echo "+e errno" >> hpux10.tmp
-	echo "+e _GLOBAL__FD_lib$(LIBBASE)_$(LIBMAJOR)_$(LIBMINOR)" >> hpux10.tmp
-	echo "+e _GLOBAL__FI_lib$(LIBBASE)_$(LIBMAJOR)_$(LIBMINOR)" >> hpux10.tmp
+	base=`echo "$(LIBBASE)" | sed -e 's/-/_/'`; \
+	echo "+e _GLOBAL__FD_lib$${base}_$(LIBMAJOR)_$(LIBMINOR)" >> hpux10.tmp; \
+	echo "+e _GLOBAL__FI_lib$${base}_$(LIBMAJOR)_$(LIBMINOR)" >> hpux10.tmp
 	mv -f hpux10.tmp hpux10.exports
 
 lib$(LIBBASE)$(PFLIBEXT): $(PFOBJLISTS)

Modified: trunk/src/config/pre.in
===================================================================
--- trunk/src/config/pre.in	2011-09-02 17:07:40 UTC (rev 25126)
+++ trunk/src/config/pre.in	2011-09-02 17:07:45 UTC (rev 25127)
@@ -378,6 +378,12 @@
 SS_LIB-k5	= $(TOPLIBD)/libss.a $(RL_LIBS)
 KDB5_LIB	= -lkdb5 $(KDB5_PLUGIN_LIBS)
 
+VERTO_DEPLIB	= $(VERTO_DEPLIB- at VERTO_VERSION@)
+VERTO_DEPLIB-sys = # empty
+VERTO_DEPLIB-k5	= $(TOPLIBD)/libverto$(DEPLIBEXT)
+VERTO_CFLAGS	= @VERTO_CFLAGS@
+VERTO_LIBS	= @VERTO_LIBS@
+
 DL_LIB		= @DL_LIB@
 
 LDAP_LIBS	= @LDAP_LIBS@

Modified: trunk/src/configure.in
===================================================================
--- trunk/src/configure.in	2011-09-02 17:07:40 UTC (rev 25126)
+++ trunk/src/configure.in	2011-09-02 17:07:45 UTC (rev 25127)
@@ -1142,10 +1142,38 @@
 AC_SUBST([RL_CFLAGS])
 AC_SUBST([RL_LIBS])
 
+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
+VERTO_VERSION=k5
+if test "x$with_system_verto" != xno; then
+  if verto_cflags=`pkg-config --cflags libverto 2>&1`; then
+    VERTO_CFLAGS=$verto_cflags
+    VERTO_LIBS=`pkg-config --libs libverto`
+    VERTO_VERSION=sys
+  else
+    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])
+  fi
+fi
+if test "x$VERTO_VERSION" = xsys; then
+  AC_MSG_NOTICE([Using system libverto])
+else
+  AC_MSG_RESULT([Using built-in libverto])
+fi
+AC_SUBST([VERTO_CFLAGS])
+AC_SUBST([VERTO_LIBS])
+AC_SUBST([VERTO_VERSION])
+
 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
 
 	lib lib/kdb
 

Modified: trunk/src/util/Makefile.in
===================================================================
--- trunk/src/util/Makefile.in	2011-09-02 17:07:40 UTC (rev 25126)
+++ trunk/src/util/Makefile.in	2011-09-02 17:07:45 UTC (rev 25127)
@@ -4,7 +4,7 @@
 # configure scripts, so hide this.
 ##WIN32##!if 0
 SUBDIRS=support $(MAYBE_ET_ at COM_ERR_VERSION@) $(MAYBE_SS_ at SS_VERSION@) \
-	profile send-pr gss-kernel-lib
+	profile send-pr gss-kernel-lib $(MAYBE_VERTO_ at VERTO_VERSION@)
 ##WIN32##!endif
 WINSUBDIRS=windows support et profile
 BUILDTOP=$(REL)..
@@ -14,6 +14,8 @@
 MAYBE_ET_sys =
 MAYBE_ET_intlsys =
 MAYBE_SS_sys =
+MAYBE_VERTO_sys =
+MAYBE_VERTO_k5 = verto k5ev
 
 all-recurse:
 

Added: trunk/src/util/k5ev/Makefile.in
===================================================================
--- trunk/src/util/k5ev/Makefile.in	                        (rev 0)
+++ trunk/src/util/k5ev/Makefile.in	2011-09-02 17:07:45 UTC (rev 25127)
@@ -0,0 +1,42 @@
+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)
+
+all-unix:: all-liblinks
+
+install-unix:: install-libs
+
+clean-unix:: clean-liblinks clean-libs clean-libobjs
+
+rename.h: $(srcdir)/Symbols.ev
+	$(RM) $@
+	$(SED) -e 's/.*/#define & k5&/' < $(srcdir)/Symbols.ev > $@
+
+clean::
+	$(RM) rename.h
+
+depend:: rename.h
+
+ at lib_frag@
+ at libobj_frag@

Added: trunk/src/util/k5ev/README
===================================================================
--- trunk/src/util/k5ev/README	                        (rev 0)
+++ trunk/src/util/k5ev/README	2011-09-02 17:07:45 UTC (rev 25127)
@@ -0,0 +1,29 @@
+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.
+
+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.

Added: trunk/src/util/k5ev/deps
===================================================================
--- trunk/src/util/k5ev/deps	                        (rev 0)
+++ trunk/src/util/k5ev/deps	2011-09-02 17:07:45 UTC (rev 25127)
@@ -0,0 +1,7 @@
+# 
+# Generated makefile dependencies follow.
+#
+verto-k5ev.so verto-k5ev.po $(OUTPRE)verto-k5ev.$(OBJEXT): \
+  $(BUILDTOP)/include/autoconf.h $(BUILDTOP)/include/verto.h \
+  $(srcdir)/../verto/verto-module.h ev.c ev.h ev_poll.c \
+  ev_vars.h ev_wrap.h rename.h verto-k5ev.c

Added: trunk/src/util/k5ev/k5ev.c
===================================================================
--- trunk/src/util/k5ev/k5ev.c	                        (rev 0)
+++ trunk/src/util/k5ev/k5ev.c	2011-09-02 17:07:45 UTC (rev 25127)
@@ -0,0 +1,36 @@
+/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */
+/* util/k5ev/k5ev.c - Wrapper to create libk5ev from libev sources */
+/*
+ * Copyright (C) 2011 by the Massachusetts Institute of Technology.
+ * All rights reserved.
+ *
+ * Export of this software from the United States of America may
+ *   require a specific license from the United States Government.
+ *   It is the responsibility of any person or organization contemplating
+ *   export to obtain such a license before exporting.
+ *
+ * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
+ * distribute this software and its documentation for any purpose and
+ * without fee is hereby granted, provided that the above copyright
+ * notice appear in all copies and that both that copyright notice and
+ * this permission notice appear in supporting documentation, and that
+ * the name of M.I.T. not be used in advertising or publicity pertaining
+ * to distribution of the software without specific, written prior
+ * permission.  Furthermore if you modify this software you must label
+ * your software as modified software and not distribute it in such a
+ * fashion that it might be confused with the original M.I.T. software.
+ * M.I.T. makes no representations about the suitability of
+ * this software for any purpose.  It is provided "as is" without express
+ * or implied warranty.
+ */
+
+#include "rename.h"
+#include "autoconf.h"
+#define EV_STANDALONE 1
+#define EV_FEATURES 0x5f        /* Everything but back ends */
+#ifdef HAVE_POLL_H
+#define EV_USE_POLL 1
+#else
+#define EV_USE_SELECT 1
+#endif
+#include "ev.c"

Added: trunk/src/util/k5ev/libverto-k5ev.exports
===================================================================
--- trunk/src/util/k5ev/libverto-k5ev.exports	                        (rev 0)
+++ trunk/src/util/k5ev/libverto-k5ev.exports	2011-09-02 17:07:45 UTC (rev 25127)
@@ -0,0 +1 @@
+verto_module_table

Added: trunk/src/util/k5ev/verto-k5ev.c
===================================================================
--- trunk/src/util/k5ev/verto-k5ev.c	                        (rev 0)
+++ trunk/src/util/k5ev/verto-k5ev.c	2011-09-02 17:07:45 UTC (rev 25127)
@@ -0,0 +1,163 @@
+/*
+ * 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.
+ */
+
+/* An edited version of verto's verto-libev.c, using an embedded libev with
+ * renamed symbols. */
+
+#include <stdlib.h>
+#include <string.h>
+#include <errno.h>
+
+#include <verto.h>
+#include <verto-module.h>
+#include "rename.h"
+#include "autoconf.h"
+#define EV_STANDALONE 1
+#define EV_FEATURES 0x5f        /* Everything but back ends */
+#ifdef HAVE_POLL_H
+#define EV_USE_POLL 1
+#else
+#define EV_USE_SELECT 1
+#endif
+#include "ev.c"
+
+static void
+libev_ctx_free(void *ctx)
+{
+    if (ctx != EV_DEFAULT)
+        ev_loop_destroy(ctx);
+}
+
+static void
+libev_ctx_run(void *ctx)
+{
+    ev_run(ctx, 0);
+}
+
+static void
+libev_ctx_run_once(void *ctx)
+{
+    ev_run(ctx, EVRUN_ONCE);
+}
+
+static void
+libev_ctx_break(void *ctx)
+{
+    ev_break(ctx, EVBREAK_ONE);
+}
+
+static void
+libev_callback(EV_P_ ev_watcher *w, int revents)
+{
+    if (verto_get_type(w->data) == VERTO_EV_TYPE_CHILD)
+        verto_set_proc_status(w->data, ((ev_child*) w)->rstatus);
+
+    verto_fire(w->data);
+}
+
+#define setuptype(type, priv, ...) \
+    type ## w = malloc(sizeof(ev_ ## type)); \
+    if (!type ## w) \
+        return NULL; \
+    ev_ ## type ## _init(type ## w, (EV_CB(type, (*))) __VA_ARGS__); \
+    type ## w->data = (void *) priv; \
+    ev_ ## type ## _start(ctx, type ## w); \
+    return type ## w
+
+static void *
+libev_ctx_add(void *ctx, const verto_ev *ev, verto_ev_flag *flags)
+{
+    ev_io *iow = NULL;
+    ev_timer *timerw = NULL;
+    ev_idle *idlew = NULL;
+    ev_signal *signalw = NULL;
+    ev_child *childw = NULL;
+    ev_tstamp interval;
+    int events = EV_NONE;
+
+    *flags |= VERTO_EV_FLAG_PERSIST;
+    switch (verto_get_type(ev)) {
+        case VERTO_EV_TYPE_IO:
+            if (verto_get_flags(ev) & VERTO_EV_FLAG_IO_READ)
+                events |= EV_READ;
+            if (verto_get_flags(ev) & VERTO_EV_FLAG_IO_WRITE)
+                events |= EV_WRITE;
+            setuptype(io, ev, libev_callback, verto_get_fd(ev), events);
+        case VERTO_EV_TYPE_TIMEOUT:
+            interval = ((ev_tstamp) verto_get_interval(ev)) / 1000.0;
+            setuptype(timer, ev, libev_callback, interval, interval);
+        case VERTO_EV_TYPE_IDLE:
+            setuptype(idle, ev, libev_callback);
+        case VERTO_EV_TYPE_SIGNAL:
+            setuptype(signal, ev, libev_callback, verto_get_signal(ev));
+        case VERTO_EV_TYPE_CHILD:
+            *flags &= ~VERTO_EV_FLAG_PERSIST; /* Child events don't persist */
+            setuptype(child, ev, libev_callback, verto_get_proc(ev), 0);
+        default:
+            return NULL; /* Not supported */
+    }
+}
+
+static void
+libev_ctx_del(void *ctx, const verto_ev *ev, void *evpriv)
+{
+    switch (verto_get_type(ev)) {
+        case VERTO_EV_TYPE_IO:
+            ev_io_stop(ctx, evpriv);
+        case VERTO_EV_TYPE_TIMEOUT:
+            ev_timer_stop(ctx, evpriv);
+        case VERTO_EV_TYPE_IDLE:
+            ev_idle_stop(ctx, evpriv);
+        case VERTO_EV_TYPE_SIGNAL:
+            ev_signal_stop(ctx, evpriv);
+        case VERTO_EV_TYPE_CHILD:
+            ev_child_stop(ctx, evpriv);
+        default:
+            break;
+    }
+
+    free(evpriv);
+}
+
+static verto_ctx *verto_new_libev(void);
+static verto_ctx *verto_default_libev(void);
+
+VERTO_MODULE(libev, ev_loop_new,
+             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()
+{
+    return verto_convert(libev, ev_loop_new(EVFLAG_AUTO));
+}
+
+static verto_ctx *
+verto_default_libev()
+{
+    return verto_convert(libev, ev_default_loop(EVFLAG_AUTO));
+}

Added: trunk/src/util/verto/Makefile.in
===================================================================
--- trunk/src/util/verto/Makefile.in	                        (rev 0)
+++ trunk/src/util/verto/Makefile.in	2011-09-02 17:07:45 UTC (rev 25127)
@@ -0,0 +1,45 @@
+mydir=util$(S)verto
+BUILDTOP=$(REL)..$(S)..
+RELDIR=../util/verto
+
+LIBBASE=verto
+LIBMAJOR=0
+LIBMINOR=0
+
+LOCALINCLUDES=-I$(srcdir)
+DEFINES=-DDEFAULT_LIBRARY=\"k5ev\"
+
+# Turn off extra warnings since we're not going to clean up libverto's code.
+WARN_CFLAGS=
+
+STLIBOBJS=verto.o
+LIBOBJS=$(OUTPRE)verto.$(OBJEXT)
+SRCS=verto.c
+
+STOBJLISTS=OBJS.ST
+SHLIB_EXPLIBS= $(DL_LIB)
+SHLIB_DIRS=
+SHLIB_RDIRS=$(KRB5_LIBDIR)
+
+VERTO_HDR=$(BUILDTOP)$(S)include$(S)verto.h
+
+all-unix:: all-liblinks includes
+
+install-unix:: install-libs
+
+clean-unix:: clean-liblinks clean-libs clean-libobjs
+	$(RM) $(VERTO_HDR)
+
+includes:: $(VERTO_HDR)
+
+$(VERTO_HDR): $(srcdir)/verto.h
+	$(RM) $@
+	$(CP) $(srcdir)/verto.h $@
+
+install::
+	$(INSTALL_DATA) $(srcdir)/verto.h $(DESTDIR)$(KRB5_INCDIR)/verto.h
+	$(INSTALL_DATA) $(srcdir)/verto-module.h \
+		$(DESTDIR)$(KRB5_INCDIR)/verto-module.h
+
+ at lib_frag@
+ at libobj_frag@

Added: trunk/src/util/verto/deps
===================================================================
--- trunk/src/util/verto/deps	                        (rev 0)
+++ trunk/src/util/verto/deps	2011-09-02 17:07:45 UTC (rev 25127)
@@ -0,0 +1,5 @@
+# 
+# Generated makefile dependencies follow.
+#
+verto.so verto.po $(OUTPRE)verto.$(OBJEXT): $(BUILDTOP)/include/verto.h \
+  verto-module.h verto.c

Added: trunk/src/util/verto/libverto.exports
===================================================================
--- trunk/src/util/verto/libverto.exports	                        (rev 0)
+++ trunk/src/util/verto/libverto.exports	2011-09-02 17:07:45 UTC (rev 25127)
@@ -0,0 +1,26 @@
+verto_add_child
+verto_add_idle
+verto_add_io
+verto_add_signal
+verto_add_timeout
+verto_break
+verto_convert_funcs
+verto_default
+verto_del
+verto_fire
+verto_free
+verto_get_fd
+verto_get_flags
+verto_get_interval
+verto_get_private
+verto_get_proc
+verto_get_proc_status
+verto_get_signal
+verto_get_supported_types
+verto_get_type
+verto_new
+verto_run
+verto_run_once
+verto_set_default
+verto_set_private
+verto_set_proc_status




More information about the cvs-krb5 mailing list