diff options
author | Greg Hudson <ghudson@mit.edu> | 2011-09-06 23:23:39 +0000 |
---|---|---|
committer | Greg Hudson <ghudson@mit.edu> | 2011-09-06 23:23:39 +0000 |
commit | d6e6d23d5fdc21a1ce613c3fc7f378de7b05d47c (patch) | |
tree | 4642dbe56bf913d0c4b730cb2b4562ccc1ed0174 /src/util/k5ev | |
parent | e68eef8d34b9527c3a24c9f0d6c0ae9b0be0e76f (diff) | |
download | krb5-d6e6d23d5fdc21a1ce613c3fc7f378de7b05d47c.tar.gz krb5-d6e6d23d5fdc21a1ce613c3fc7f378de7b05d47c.tar.xz krb5-d6e6d23d5fdc21a1ce613c3fc7f378de7b05d47c.zip |
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.
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@25166 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src/util/k5ev')
-rw-r--r-- | src/util/k5ev/Makefile.in | 11 | ||||
-rw-r--r-- | src/util/k5ev/README | 4 | ||||
-rw-r--r-- | src/util/k5ev/libverto-k5ev.exports | 2 | ||||
-rw-r--r-- | src/util/k5ev/verto-k5ev.c | 36 | ||||
-rw-r--r-- | src/util/k5ev/verto-k5ev.h | 33 |
5 files changed, 67 insertions, 19 deletions
diff --git a/src/util/k5ev/Makefile.in b/src/util/k5ev/Makefile.in index 857a85b082..27e77f4fbe 100644 --- a/src/util/k5ev/Makefile.in +++ b/src/util/k5ev/Makefile.in @@ -23,11 +23,20 @@ SHLIB_EXPLIBS= $(LIBS) -lverto -lm # libm needed for ceil() currently. 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) $@ diff --git a/src/util/k5ev/README b/src/util/k5ev/README index 1165f37f70..10b49976bd 100644 --- a/src/util/k5ev/README +++ b/src/util/k5ev/README @@ -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, diff --git a/src/util/k5ev/libverto-k5ev.exports b/src/util/k5ev/libverto-k5ev.exports index ee1b8d00eb..fe128fd470 100644 --- a/src/util/k5ev/libverto-k5ev.exports +++ b/src/util/k5ev/libverto-k5ev.exports @@ -1 +1,3 @@ +verto_default_k5ev verto_module_table +verto_new_k5ev diff --git a/src/util/k5ev/verto-k5ev.c b/src/util/k5ev/verto-k5ev.c index e4f669a75f..d244484c58 100644 --- a/src/util/k5ev/verto-k5ev.c +++ b/src/util/k5ev/verto-k5ev.c @@ -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 @@ libev_callback(EV_P_ ev_watcher *w, int revents) 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 @@ libev_ctx_add(void *ctx, const verto_ev *ev, verto_ev_flag *flags) } 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 @@ libev_ctx_del(void *ctx, const verto_ev *ev, void *evpriv) 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); } diff --git a/src/util/k5ev/verto-k5ev.h b/src/util/k5ev/verto-k5ev.h new file mode 100644 index 0000000000..0b1ad192c3 --- /dev/null +++ b/src/util/k5ev/verto-k5ev.h @@ -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_ */ |