From 56aee8ee4f9076a7f8f8b6703a9802aa963c691c Mon Sep 17 00:00:00 2001 From: Robbie Harwood Date: Mon, 15 Mar 2021 13:44:38 -0400 Subject: [PATCH] Remove tevent support since tevent is broken See-also: https://bugzilla.samba.org/show_bug.cgi?id=12987 Resolves: #16 Signed-off-by: Robbie Harwood --- Makefile.am | 4 - configure.ac | 39 --------- libverto-tevent.pc.in | 11 --- src/Makefile.am | 16 +--- src/libverto-tevent.symbols | 4 - src/verto-tevent.c | 164 ------------------------------------ src/verto-tevent.h | 48 ----------- tests/Makefile.am | 3 - tests/test.h | 3 - 9 files changed, 1 insertion(+), 291 deletions(-) delete mode 100644 libverto-tevent.pc.in delete mode 100644 src/libverto-tevent.symbols delete mode 100644 src/verto-tevent.c delete mode 100644 src/verto-tevent.h diff --git a/Makefile.am b/Makefile.am index b9831d6..752ab8f 100644 --- a/Makefile.am +++ b/Makefile.am @@ -13,9 +13,5 @@ if MODULE_LIBEVENT pkgconfig_DATA += libverto-libevent.pc endif -if MODULE_TEVENT -pkgconfig_DATA += libverto-tevent.pc -endif - ACLOCAL_AMFLAGS=-I m4 SUBDIRS=src tests diff --git a/configure.ac b/configure.ac index 7792e94..bcdc954 100644 --- a/configure.ac +++ b/configure.ac @@ -80,37 +80,20 @@ AC_ARG_WITH([libevent], *) WITH_LIBEVENT=auto;; esac], [WITH_LIBEVENT=auto]) -AC_ARG_WITH([tevent], - [AS_HELP_STRING([--with-tevent], - [build the tevent library @<:@default: automatic@:>@])], - [case $withval in - no) WITH_TEVENT=no;; - yes) WITH_TEVENT=yes;; - *) WITH_TEVENT=auto;; - esac], [WITH_TEVENT=auto]) - # Ensure that if a builtin is chosen only one is built BUILTIN_MODULE= if test x$WITH_GLIB == xbuiltin; then BUILTIN_MODULE=glib WITH_LIBEV=no WITH_LIBEVENT=no - WITH_TEVENT=no elif test x$WITH_LIBEV == xbuiltin; then BUILTIN_MODULE=libev WITH_LIBGLIB=no WITH_LIBEVENT=no - WITH_TEVENT=no elif test x$WITH_LIBEVENT == xbuiltin; then BUILTIN_MODULE=libevent WITH_LIBGLIB=no WITH_LIBEV=no - WITH_TEVENT=no -elif test x$WITH_TEVENT == xbuiltin; then - BUILTIN_MODULE=tevent - WITH_GLIB=no - WITH_LIBEV=no - WITH_LIBEVENT=no fi AC_SUBST([BUILTIN_MODULE], $BUILTIN_MODULE) if test x$BUILTIN_MODULE != x; then @@ -122,31 +105,21 @@ if test x$WITH_GLIB == xdefault; then AC_DEFINE([DEFUALT_MODULE], [glib]) test x$WITH_LIBEV == xdefault && WITH_LIBEV=yes test x$WITH_LIBEVENT == xdefault && WITH_LIBEVENT=yes - test x$WITH_TEVENT == xdefault && WITH_TEVENT=yes fi if test x$WITH_LIBEV == xdefault; then AC_DEFINE([DEFUALT_MODULE], [libev]) test x$WITH_LIBGLIB == xdefault && WITH_GLIB=yes test x$WITH_LIBEVENT == xdefault && WITH_LIBEVENT=yes - test x$WITH_TEVENT == xdefault && WITH_TEVENT=yes fi if test x$WITH_LIBEVENT == xdefault; then AC_DEFINE([DEFUALT_MODULE], [libevent]) test x$WITH_GLIB == xdefault && WITH_GLIB=yes test x$WITH_LIBEV == xdefault && WITH_LIBEV=yes - test x$WITH_TEVENT == xdefault && WITH_TEVENT=yes -fi -if test x$WITH_TEVENT == xdefault; then - AC_DEFINE([DEFUALT_MODULE], [tevent]) - test x$WITH_GLIB == xdefault && WITH_GLIB=yes - test x$WITH_LIBEV == xdefault && WITH_LIBEV=yes - test x$WITH_LIBEVENT == xdefault && WITH_LIBEVENT=yes fi BUILD_GLIB=no BUILD_LIBEV=no BUILD_LIBEVENT=no -BUILD_TEVENT=no if test x$WITH_GLIB != xno; then PKG_CHECK_MODULES([glib], [glib-2.0], [BUILD_GLIB=$WITH_GLIB], @@ -178,22 +151,12 @@ if test x$WITH_LIBEVENT != xno; then fi fi -if test x$WITH_TEVENT != xno; then - PKG_CHECK_MODULES([tevent], [tevent], [BUILD_TEVENT=$WITH_TEVENT], - [test x$WITH_TEVENT != xauto && AC_MSG_ERROR("tevent not found")]) - if test x$BUILD_TEVENT == xauto; then - BUILD_TEVENT=yes - fi -fi - AM_CONDITIONAL([MODULE_GLIB], [test x$BUILTIN_MODULE == x && test x$BUILD_GLIB != xno]) AM_CONDITIONAL([MODULE_LIBEV], [test x$BUILTIN_MODULE == x && test x$BUILD_LIBEV != xno]) AM_CONDITIONAL([MODULE_LIBEVENT], [test x$BUILTIN_MODULE == x && test x$BUILD_LIBEVENT != xno]) -AM_CONDITIONAL([MODULE_TEVENT], [test x$BUILTIN_MODULE == x && test x$BUILD_TEVENT != xno]) AM_CONDITIONAL([BUILTIN_GLIB], [test x$BUILTIN_MODULE == xglib]) AM_CONDITIONAL([BUILTIN_LIBEV], [test x$BUILTIN_MODULE == xlibev]) AM_CONDITIONAL([BUILTIN_LIBEVENT], [test x$BUILTIN_MODULE == xlibevent]) -AM_CONDITIONAL([BUILTIN_TEVENT], [test x$BUILTIN_MODULE == xtevent]) AC_MSG_NOTICE() AC_MSG_NOTICE([BUILD CONFIGURATION]) @@ -201,7 +164,6 @@ AC_MSG_NOTICE(AS_HELP_STRING([pthread], [$BUILD_PTHREAD])) AC_MSG_NOTICE(AS_HELP_STRING([glib], [$BUILD_GLIB])) AC_MSG_NOTICE(AS_HELP_STRING([libev], [$BUILD_LIBEV])) AC_MSG_NOTICE(AS_HELP_STRING([libevent], [$BUILD_LIBEVENT])) -AC_MSG_NOTICE(AS_HELP_STRING([tevent], [$BUILD_TEVENT])) AC_MSG_NOTICE() AC_CONFIG_FILES(Makefile @@ -210,6 +172,5 @@ AC_CONFIG_FILES(Makefile libverto-glib.pc libverto-libev.pc libverto-libevent.pc - libverto-tevent.pc libverto.pc) AC_OUTPUT diff --git a/libverto-tevent.pc.in b/libverto-tevent.pc.in deleted file mode 100644 index 0568363..0000000 --- a/libverto-tevent.pc.in +++ /dev/null @@ -1,11 +0,0 @@ -prefix=@prefix@ -exec_prefix=@exec_prefix@ -libdir=@libdir@ -includedir=@includedir@ - -Name: libverto-tevent -Description: Event loop abstraction interface (tevent module) -Version: @VERSION@ -Libs: -L${libdir} -lverto-tevent -Cflags: -I${includedir} -Requires.private: libverto diff --git a/src/Makefile.am b/src/Makefile.am index 472b3ea..ad62c43 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,7 +1,7 @@ AM_CFLAGS = -Wall -Wdeclaration-after-statement AM_LDFLAGS = -version-info 1:0:0 EXTRA_DIST = libverto.symbols libverto-glib.symbols libverto-libev.symbols \ - libverto-libevent.symbols libverto-tevent.symbols + libverto-libevent.symbols include_HEADERS = verto.h verto-module.h noinst_HEADERS = module.h @@ -24,10 +24,6 @@ if BUILTIN_LIBEVENT libverto_la_SOURCES += verto-libevent.c endif -if BUILTIN_TEVENT -libverto_la_SOURCES += verto-tevent.c -endif - if MODULE_GLIB lib_LTLIBRARIES += libverto-glib.la include_HEADERS += verto-glib.h @@ -57,13 +53,3 @@ libverto_libevent_la_CFLAGS = $(AM_CFLAGS) $(libevent_CFLAGS) libverto_libevent_la_LDFLAGS = $(AM_LDFLAGS) $(libevent_LIBS) \ -export-symbols $(srcdir)/libverto-libevent.symbols endif - -if MODULE_TEVENT -lib_LTLIBRARIES += libverto-tevent.la -include_HEADERS += verto-tevent.h -libverto_tevent_la_SOURCES = verto-tevent.c -libverto_tevent_la_LIBADD = libverto.la -libverto_tevent_la_CFLAGS = $(AM_CFLAGS) $(tevent_CFLAGS) -libverto_tevent_la_LDFLAGS = $(AM_LDFLAGS) $(tevent_LIBS) \ - -export-symbols $(srcdir)/libverto-tevent.symbols -endif diff --git a/src/libverto-tevent.symbols b/src/libverto-tevent.symbols deleted file mode 100644 index 063d668..0000000 --- a/src/libverto-tevent.symbols +++ /dev/null @@ -1,4 +0,0 @@ -verto_convert_tevent -verto_default_tevent -verto_module_table_tevent -verto_new_tevent diff --git a/src/verto-tevent.c b/src/verto-tevent.c deleted file mode 100644 index c50c12c..0000000 --- a/src/verto-tevent.c +++ /dev/null @@ -1,164 +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. - */ - -#include -#include -#include - -#include - -#define VERTO_MODULE_TYPES -typedef struct tevent_context verto_mod_ctx; -typedef void verto_mod_ev; -#include - -#ifndef TEVENT_FD_ERROR -#define TEVENT_FD_ERROR 0 -#endif /* TEVENT_FD_ERROR */ - -static verto_mod_ctx * -tevent_ctx_new(void) -{ - return tevent_context_init(NULL); -} - -static void -tevent_ctx_free(verto_mod_ctx *ctx) -{ - talloc_free(ctx); -} - -static void -tevent_ctx_run_once(verto_mod_ctx *ctx) -{ - tevent_loop_once(ctx); -} - -static void -tevent_ctx_reinitialize(verto_mod_ctx *ctx) -{ - tevent_re_initialise(ctx); -} - -static void -tevent_fd_cb(struct tevent_context *c, struct tevent_fd *e, - uint16_t fl, void *data) -{ - verto_ev_flag state = VERTO_EV_FLAG_NONE; - - if (fl & TEVENT_FD_READ) - state |= VERTO_EV_FLAG_IO_READ; - if (fl & TEVENT_FD_WRITE) - state |= VERTO_EV_FLAG_IO_WRITE; - if (fl & TEVENT_FD_ERROR) - state |= VERTO_EV_FLAG_IO_ERROR; - - verto_set_fd_state(data, state); - verto_fire(data); -} - -static void -tevent_timer_cb(struct tevent_context *c, struct tevent_timer *e, - struct timeval ct, void *data) -{ - verto_fire(data); -} - -static void -tevent_signal_cb(struct tevent_context *c, struct tevent_signal *e, - int signum, int count, void *siginfo, void *data) -{ - verto_fire(data); -} - -static void -tevent_ctx_set_flags(verto_mod_ctx *ctx, const verto_ev *ev, - verto_mod_ev *evpriv) -{ - if (verto_get_type(ev) == VERTO_EV_TYPE_IO) { - uint16_t teventflags = TEVENT_FD_ERROR; - if (verto_get_flags(ev) & VERTO_EV_FLAG_IO_READ) - teventflags |= TEVENT_FD_READ; - if (verto_get_flags(ev) & VERTO_EV_FLAG_IO_WRITE) - teventflags |= TEVENT_FD_WRITE; - tevent_fd_set_flags(evpriv, teventflags); - } -} - -static verto_mod_ev * -tevent_ctx_add(verto_mod_ctx *ctx, const verto_ev *ev, verto_ev_flag *flags) - -{ - time_t interval; - struct timeval tv; - struct tevent_fd *tfde; - - *flags |= VERTO_EV_FLAG_PERSIST; - switch (verto_get_type(ev)) { - case VERTO_EV_TYPE_IO: - tfde = tevent_add_fd(ctx, ctx, verto_get_fd(ev), TEVENT_FD_ERROR, - tevent_fd_cb, (void *) ev); - if (tfde) { - tevent_ctx_set_flags(ctx, ev, tfde); - if (verto_get_flags(ev) & VERTO_EV_FLAG_IO_CLOSE_FD) { - *flags |= VERTO_EV_FLAG_IO_CLOSE_FD; - tevent_fd_set_auto_close(tfde); - } - } - return tfde; - case VERTO_EV_TYPE_TIMEOUT: - *flags &= ~VERTO_EV_FLAG_PERSIST; /* Timeout events don't persist */ - interval = verto_get_interval(ev); - tv = tevent_timeval_current_ofs(interval / 1000, interval % 1000 * 1000); - return tevent_add_timer(ctx, ctx, tv, - tevent_timer_cb, (void *) ev); - case VERTO_EV_TYPE_SIGNAL: - return tevent_add_signal(ctx, ctx, verto_get_signal(ev), - 0, tevent_signal_cb, (void *) ev); - case VERTO_EV_TYPE_IDLE: - case VERTO_EV_TYPE_CHILD: - default: - return NULL; /* Not supported */ - } -} - -static void -tevent_ctx_del(verto_mod_ctx *priv, const verto_ev *ev, verto_mod_ev *evpriv) -{ - talloc_free(evpriv); -} - -#define tevent_ctx_break NULL -#define tevent_ctx_run NULL -#define tevent_ctx_default NULL -VERTO_MODULE(tevent, tevent_context_init, - VERTO_EV_TYPE_IO | - VERTO_EV_TYPE_TIMEOUT | - VERTO_EV_TYPE_SIGNAL); - -verto_ctx * -verto_convert_tevent(struct tevent_context *context) -{ - return verto_convert(tevent, 0, context); -} diff --git a/src/verto-tevent.h b/src/verto-tevent.h deleted file mode 100644 index 36a3041..0000000 --- a/src/verto-tevent.h +++ /dev/null @@ -1,48 +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_TEVENT_H_ -#define VERTO_TEVENT_H_ - -#include -#include - -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - -verto_ctx * -verto_new_tevent(void); - -verto_ctx * -verto_default_tevent(void); - -verto_ctx * -verto_convert_tevent(struct tevent_context *context); - -#ifdef __cplusplus -} /* extern "C" */ -#endif /* __cplusplus */ -#endif /* VERTO_TEVENT_H_ */ diff --git a/tests/Makefile.am b/tests/Makefile.am index 3015686..a0c3f31 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -12,9 +12,6 @@ endif if MODULE_LIBEVENT AM_CFLAGS += -DHAVE_LIBEVENT=1 endif -if MODULE_TEVENT -AM_CFLAGS += -DHAVE_TEVENT=1 -endif check_PROGRAMS = timeout idle child signal read write EXTRA_DIST = test.h diff --git a/tests/test.h b/tests/test.h index 2c043b4..9d08e3e 100644 --- a/tests/test.h +++ b/tests/test.h @@ -48,9 +48,6 @@ static char *MODULES[] = { #endif #ifdef HAVE_LIBEVENT "libevent", -#endif -#ifdef HAVE_TEVENT - "tevent", #endif NULL, NULL,