summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/tevent/config.mk2
-rw-r--r--lib/tevent/libtevent.m43
-rw-r--r--lib/tevent/tevent_aio.c11
-rw-r--r--lib/tevent/tevent_epoll.c11
-rw-r--r--lib/tevent/tevent_fd.c36
-rw-r--r--lib/tevent/tevent_internal.h3
-rw-r--r--lib/tevent/tevent_select.c29
-rw-r--r--lib/tevent/tevent_standard.c11
8 files changed, 47 insertions, 59 deletions
diff --git a/lib/tevent/config.mk b/lib/tevent/config.mk
index e4fb9a8088f..90548b636a0 100644
--- a/lib/tevent/config.mk
+++ b/lib/tevent/config.mk
@@ -41,6 +41,6 @@ CFLAGS = -I../lib/tevent
# End SUBSYSTEM LIBTEVENT
################################################
-LIBTEVENT_OBJ_FILES = $(addprefix $(libteventsrcdir)/, tevent.o tevent_timed.o tevent_signal.o tevent_debug.o tevent_util.o)
+LIBTEVENT_OBJ_FILES = $(addprefix $(libteventsrcdir)/, tevent.o tevent_fd.o tevent_timed.o tevent_signal.o tevent_debug.o tevent_util.o)
PUBLIC_HEADERS += $(addprefix $(libteventsrcdir)/, tevent.h tevent_internal.h)
diff --git a/lib/tevent/libtevent.m4 b/lib/tevent/libtevent.m4
index 24cdd8c27fd..19892823ae1 100644
--- a/lib/tevent/libtevent.m4
+++ b/lib/tevent/libtevent.m4
@@ -15,7 +15,8 @@ if test x"$teventdir" = "x"; then
fi
fi
-TEVENT_OBJ="tevent.o tevent_select.o tevent_signal.o tevent_timed.o tevent_standard.o tevent_debug.o tevent_util.o"
+TEVENT_OBJ="tevent.o tevent_fd.o tevent_timed.o tevent_signal.o tevent_debug.o tevent_util.o"
+TEVENT_OBJ="$TEVENT_OBJ tevent_standard.o tevent_select.o"
AC_LIBREPLACE_NETWORK_CHECKS
SMB_ENABLE(TEVENT_EPOLL, NO)
diff --git a/lib/tevent/tevent_aio.c b/lib/tevent/tevent_aio.c
index ba798cc7991..bfe3f070dbd 100644
--- a/lib/tevent/tevent_aio.c
+++ b/lib/tevent/tevent_aio.c
@@ -447,15 +447,6 @@ static struct tevent_fd *aio_event_add_fd(struct tevent_context *ev, TALLOC_CTX
return fde;
}
-
-/*
- return the fd event flags
-*/
-static uint16_t aio_event_get_fd_flags(struct tevent_fd *fde)
-{
- return fde->flags;
-}
-
/*
set the fd event flags
*/
@@ -560,7 +551,7 @@ static const struct tevent_ops aio_event_ops = {
.context_init = aio_event_context_init,
.add_fd = aio_event_add_fd,
.add_aio = aio_event_add_aio,
- .get_fd_flags = aio_event_get_fd_flags,
+ .get_fd_flags = tevent_common_fd_get_flags,
.set_fd_flags = aio_event_set_fd_flags,
.add_timer = tevent_common_add_timer,
.add_signal = tevent_common_add_signal,
diff --git a/lib/tevent/tevent_epoll.c b/lib/tevent/tevent_epoll.c
index 380d9461c9f..8fb662e1685 100644
--- a/lib/tevent/tevent_epoll.c
+++ b/lib/tevent/tevent_epoll.c
@@ -405,15 +405,6 @@ static struct tevent_fd *epoll_event_add_fd(struct tevent_context *ev, TALLOC_CT
return fde;
}
-
-/*
- return the fd event flags
-*/
-static uint16_t epoll_event_get_fd_flags(struct tevent_fd *fde)
-{
- return fde->flags;
-}
-
/*
set the fd event flags
*/
@@ -472,7 +463,7 @@ static int epoll_event_loop_wait(struct tevent_context *ev)
static const struct tevent_ops epoll_event_ops = {
.context_init = epoll_event_context_init,
.add_fd = epoll_event_add_fd,
- .get_fd_flags = epoll_event_get_fd_flags,
+ .get_fd_flags = tevent_common_fd_get_flags,
.set_fd_flags = epoll_event_set_fd_flags,
.add_timer = tevent_common_add_timer,
.add_signal = tevent_common_add_signal,
diff --git a/lib/tevent/tevent_fd.c b/lib/tevent/tevent_fd.c
new file mode 100644
index 00000000000..eb9cdab531a
--- /dev/null
+++ b/lib/tevent/tevent_fd.c
@@ -0,0 +1,36 @@
+/*
+ Unix SMB/CIFS implementation.
+
+ common events code for fd events
+
+ Copyright (C) Stefan Metzmacher 2009
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include "replace.h"
+#include "tevent.h"
+#include "tevent_internal.h"
+#include "tevent_util.h"
+
+uint16_t tevent_common_fd_get_flags(struct tevent_fd *fde)
+{
+ return fde->flags;
+}
+
+void tevent_common_fd_set_flags(struct tevent_fd *fde, uint16_t flags)
+{
+ if (fde->flags == flags) return;
+ fde->flags = flags;
+}
diff --git a/lib/tevent/tevent_internal.h b/lib/tevent/tevent_internal.h
index 46ba1b1655f..6099387362a 100644
--- a/lib/tevent/tevent_internal.h
+++ b/lib/tevent/tevent_internal.h
@@ -146,6 +146,9 @@ struct tevent_context {
bool tevent_register_backend(const char *name, const struct tevent_ops *ops);
+uint16_t tevent_common_fd_get_flags(struct tevent_fd *fde);
+void tevent_common_fd_set_flags(struct tevent_fd *fde, uint16_t flags);
+
bool ev_timeval_is_zero(const struct timeval *tv);
struct tevent_timer *tevent_common_add_timer(struct tevent_context *ev,
TALLOC_CTX *mem_ctx,
diff --git a/lib/tevent/tevent_select.c b/lib/tevent/tevent_select.c
index e21b3c44b94..f6790ab0f45 100644
--- a/lib/tevent/tevent_select.c
+++ b/lib/tevent/tevent_select.c
@@ -148,31 +148,6 @@ static struct tevent_fd *select_event_add_fd(struct tevent_context *ev, TALLOC_C
return fde;
}
-
-/*
- return the fd event flags
-*/
-static uint16_t select_event_get_fd_flags(struct tevent_fd *fde)
-{
- return fde->flags;
-}
-
-/*
- set the fd event flags
-*/
-static void select_event_set_fd_flags(struct tevent_fd *fde, uint16_t flags)
-{
- struct tevent_context *ev;
- struct select_event_context *select_ev;
-
- if (fde->flags == flags) return;
-
- ev = fde->event_ctx;
- select_ev = talloc_get_type(ev->additional_data, struct select_event_context);
-
- fde->flags = flags;
-}
-
/*
event loop handling using select()
*/
@@ -291,8 +266,8 @@ static int select_event_loop_wait(struct tevent_context *ev)
static const struct tevent_ops select_event_ops = {
.context_init = select_event_context_init,
.add_fd = select_event_add_fd,
- .get_fd_flags = select_event_get_fd_flags,
- .set_fd_flags = select_event_set_fd_flags,
+ .get_fd_flags = tevent_common_fd_get_flags,
+ .set_fd_flags = tevent_common_fd_set_flags,
.add_timer = tevent_common_add_timer,
.add_signal = tevent_common_add_signal,
.loop_once = select_event_loop_once,
diff --git a/lib/tevent/tevent_standard.c b/lib/tevent/tevent_standard.c
index 5769eac5892..3a674152b1a 100644
--- a/lib/tevent/tevent_standard.c
+++ b/lib/tevent/tevent_standard.c
@@ -440,15 +440,6 @@ static struct tevent_fd *std_event_add_fd(struct tevent_context *ev, TALLOC_CTX
return fde;
}
-
-/*
- return the fd event flags
-*/
-static uint16_t std_event_get_fd_flags(struct tevent_fd *fde)
-{
- return fde->flags;
-}
-
/*
set the fd event flags
*/
@@ -593,7 +584,7 @@ static int std_event_loop_wait(struct tevent_context *ev)
static const struct tevent_ops std_event_ops = {
.context_init = std_event_context_init,
.add_fd = std_event_add_fd,
- .get_fd_flags = std_event_get_fd_flags,
+ .get_fd_flags = tevent_common_fd_get_flags,
.set_fd_flags = std_event_set_fd_flags,
.add_timer = tevent_common_add_timer,
.add_signal = tevent_common_add_signal,