summaryrefslogtreecommitdiff
path: root/lib/tevent
diff options
context:
space:
mode:
Diffstat (limited to 'lib/tevent')
-rw-r--r--lib/tevent/pytevent.c4
-rw-r--r--lib/tevent/testsuite.c10
-rw-r--r--lib/tevent/tevent.c32
-rw-r--r--lib/tevent/tevent.h11
-rw-r--r--lib/tevent/tevent_aio.c48
-rw-r--r--lib/tevent/tevent_debug.c6
-rw-r--r--lib/tevent/tevent_epoll.c42
-rw-r--r--lib/tevent/tevent_internal.h2
-rw-r--r--lib/tevent/tevent_liboop.c40
-rw-r--r--lib/tevent/tevent_select.c32
-rw-r--r--lib/tevent/tevent_signal.c6
-rw-r--r--lib/tevent/tevent_standard.c46
-rw-r--r--lib/tevent/tevent_timed.c18
13 files changed, 147 insertions, 150 deletions
diff --git a/lib/tevent/pytevent.c b/lib/tevent/pytevent.c
index 54f6799845..a969373738 100644
--- a/lib/tevent/pytevent.c
+++ b/lib/tevent/pytevent.c
@@ -23,7 +23,7 @@
typedef struct {
PyObject_HEAD
- struct event_context *ev_ctx;
+ struct tevent_context *ev_ctx;
} PyEventContextObject;
PyAPI_DATA(PyTypeObject) PyEventContext;
@@ -65,7 +65,7 @@ static PyObject *py_event_ctx_new(PyTypeObject *type, PyObject *args, PyObject *
{
const char *kwnames[] = { "name", NULL };
char *name = NULL;
- struct event_context *ev_ctx;
+ struct tevent_context *ev_ctx;
PyEventContextObject *ret;
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|s", (char **)kwnames, &name))
return NULL;
diff --git a/lib/tevent/testsuite.c b/lib/tevent/testsuite.c
index 7f2729ceff..ec57c5ad2e 100644
--- a/lib/tevent/testsuite.c
+++ b/lib/tevent/testsuite.c
@@ -26,7 +26,7 @@
static int fde_count;
-static void fde_handler(struct event_context *ev_ctx, struct fd_event *f,
+static void fde_handler(struct tevent_context *ev_ctx, struct tevent_fd *f,
uint16_t flags, void *private)
{
int *fd = (int *)private;
@@ -40,14 +40,14 @@ static void fde_handler(struct event_context *ev_ctx, struct fd_event *f,
fde_count++;
}
-static void finished_handler(struct event_context *ev_ctx, struct timed_event *te,
+static void finished_handler(struct tevent_context *ev_ctx, struct tevent_timer *te,
struct timeval tval, void *private)
{
int *finished = (int *)private;
(*finished) = 1;
}
-static void count_handler(struct event_context *ev_ctx, struct signal_event *te,
+static void count_handler(struct tevent_context *ev_ctx, struct signal_event *te,
int signum, int count, void *info, void *private)
{
int *countp = (int *)private;
@@ -57,11 +57,11 @@ static void count_handler(struct event_context *ev_ctx, struct signal_event *te,
static bool test_event_context(struct torture_context *test,
const void *test_data)
{
- struct event_context *ev_ctx;
+ struct tevent_context *ev_ctx;
int fd[2] = { -1, -1 };
const char *backend = (const char *)test_data;
int alarm_count=0, info_count=0;
- struct fd_event *fde;
+ struct tevent_fd *fde;
struct signal_event *se1, *se2, *se3;
int finished=0;
struct timeval t;
diff --git a/lib/tevent/tevent.c b/lib/tevent/tevent.c
index 2ea5ad33e0..e45a690c33 100644
--- a/lib/tevent/tevent.c
+++ b/lib/tevent/tevent.c
@@ -42,7 +42,7 @@
To setup a set of events you first need to create a event_context
structure using the function event_context_init(); This returns a
- 'struct event_context' that you use in all subsequent calls.
+ 'struct tevent_context' that you use in all subsequent calls.
After that you can add/remove events that you are interested in
using event_add_*() and talloc_free()
@@ -145,13 +145,13 @@ const char **event_backend_list(TALLOC_CTX *mem_ctx)
NOTE: use event_context_init() inside of samba!
*/
-static struct event_context *event_context_init_ops(TALLOC_CTX *mem_ctx,
+static struct tevent_context *event_context_init_ops(TALLOC_CTX *mem_ctx,
const struct event_ops *ops)
{
- struct event_context *ev;
+ struct tevent_context *ev;
int ret;
- ev = talloc_zero(mem_ctx, struct event_context);
+ ev = talloc_zero(mem_ctx, struct tevent_context);
if (!ev) return NULL;
ev->ops = ops;
@@ -170,7 +170,7 @@ static struct event_context *event_context_init_ops(TALLOC_CTX *mem_ctx,
call, and all subsequent calls pass this event_context as the first
element. Event handlers also receive this as their first argument.
*/
-struct event_context *event_context_init_byname(TALLOC_CTX *mem_ctx, const char *name)
+struct tevent_context *event_context_init_byname(TALLOC_CTX *mem_ctx, const char *name)
{
struct event_ops_list *e;
@@ -197,7 +197,7 @@ struct event_context *event_context_init_byname(TALLOC_CTX *mem_ctx, const char
call, and all subsequent calls pass this event_context as the first
element. Event handlers also receive this as their first argument.
*/
-struct event_context *event_context_init(TALLOC_CTX *mem_ctx)
+struct tevent_context *event_context_init(TALLOC_CTX *mem_ctx)
{
return event_context_init_byname(mem_ctx, NULL);
}
@@ -209,7 +209,7 @@ struct event_context *event_context_init(TALLOC_CTX *mem_ctx)
if flags contains EVENT_FD_AUTOCLOSE then the fd will be closed when
the returned fd_event context is freed
*/
-struct fd_event *event_add_fd(struct event_context *ev, TALLOC_CTX *mem_ctx,
+struct tevent_fd *event_add_fd(struct tevent_context *ev, TALLOC_CTX *mem_ctx,
int fd, uint16_t flags, event_fd_handler_t handler,
void *private_data)
{
@@ -219,7 +219,7 @@ struct fd_event *event_add_fd(struct event_context *ev, TALLOC_CTX *mem_ctx,
/*
add a disk aio event
*/
-struct aio_event *event_add_aio(struct event_context *ev,
+struct aio_event *event_add_aio(struct tevent_context *ev,
TALLOC_CTX *mem_ctx,
struct iocb *iocb,
event_aio_handler_t handler,
@@ -232,7 +232,7 @@ struct aio_event *event_add_aio(struct event_context *ev,
/*
return the fd event flags
*/
-uint16_t event_get_fd_flags(struct fd_event *fde)
+uint16_t event_get_fd_flags(struct tevent_fd *fde)
{
if (!fde) return 0;
return fde->event_ctx->ops->get_fd_flags(fde);
@@ -241,7 +241,7 @@ uint16_t event_get_fd_flags(struct fd_event *fde)
/*
set the fd event flags
*/
-void event_set_fd_flags(struct fd_event *fde, uint16_t flags)
+void event_set_fd_flags(struct tevent_fd *fde, uint16_t flags)
{
if (!fde) return;
fde->event_ctx->ops->set_fd_flags(fde, flags);
@@ -251,7 +251,7 @@ void event_set_fd_flags(struct fd_event *fde, uint16_t flags)
add a timed event
return NULL on failure
*/
-struct timed_event *event_add_timed(struct event_context *ev, TALLOC_CTX *mem_ctx,
+struct tevent_timer *event_add_timed(struct tevent_context *ev, TALLOC_CTX *mem_ctx,
struct timeval next_event,
event_timed_handler_t handler,
void *private_data)
@@ -266,7 +266,7 @@ struct timed_event *event_add_timed(struct event_context *ev, TALLOC_CTX *mem_ct
return NULL on failure
*/
-struct signal_event *event_add_signal(struct event_context *ev, TALLOC_CTX *mem_ctx,
+struct signal_event *event_add_signal(struct tevent_context *ev, TALLOC_CTX *mem_ctx,
int signum,
int sa_flags,
event_signal_handler_t handler,
@@ -278,7 +278,7 @@ struct signal_event *event_add_signal(struct event_context *ev, TALLOC_CTX *mem_
/*
do a single event loop using the events defined in ev
*/
-int event_loop_once(struct event_context *ev)
+int event_loop_once(struct tevent_context *ev)
{
return ev->ops->loop_once(ev);
}
@@ -286,7 +286,7 @@ int event_loop_once(struct event_context *ev)
/*
return on failure or (with 0) if all fd events are removed
*/
-int event_loop_wait(struct event_context *ev)
+int event_loop_wait(struct tevent_context *ev)
{
return ev->ops->loop_wait(ev);
}
@@ -300,9 +300,9 @@ int event_loop_wait(struct event_context *ev)
where you would prefer to use the existing event context if possible
(which is most situations)
*/
-struct event_context *event_context_find(TALLOC_CTX *mem_ctx)
+struct tevent_context *event_context_find(TALLOC_CTX *mem_ctx)
{
- struct event_context *ev = talloc_find_parent_bytype(mem_ctx, struct event_context);
+ struct tevent_context *ev = talloc_find_parent_bytype(mem_ctx, struct tevent_context);
if (ev == NULL) {
ev = event_context_init(mem_ctx);
}
diff --git a/lib/tevent/tevent.h b/lib/tevent/tevent.h
index 002edd1836..f626de9d12 100644
--- a/lib/tevent/tevent.h
+++ b/lib/tevent/tevent.h
@@ -25,16 +25,13 @@
#include <stdint.h>
#include <talloc.h>
-struct event_context;
+struct tevent_context;
struct tevent_ops;
-struct fd_event;
+struct tevent_fd;
struct tevent_timer;
struct tevent_aio;
struct tevent_signal;
-#define tevent_context event_context
-#define tevent_fd fd_event
-
/* event handler types */
typedef void (*tevent_fd_handler_t)(struct tevent_context *,
struct tevent_fd *,
@@ -107,9 +104,9 @@ void tevent_fd_set_flags(struct tevent_fd *fde, uint16_t flags);
#ifdef TEVENT_COMPAT_DEFINES
-/*TODO:#define event_context tevent_context*/
+#define event_context tevent_context
#define event_ops tevent_ops
-/*TODO:#define fd_event tevent_fd*/
+#define fd_event tevent_fd
#define timed_event tevent_timer
#define aio_event tevent_aio
#define signal_event tevent_signal
diff --git a/lib/tevent/tevent_aio.c b/lib/tevent/tevent_aio.c
index b3cd126a34..746e96060b 100644
--- a/lib/tevent/tevent_aio.c
+++ b/lib/tevent/tevent_aio.c
@@ -45,10 +45,10 @@
struct aio_event_context {
/* a pointer back to the generic event_context */
- struct event_context *ev;
+ struct tevent_context *ev;
/* list of filedescriptor events */
- struct fd_event *fd_events;
+ struct tevent_fd *fd_events;
/* number of registered fd event handlers */
int num_fd_events;
@@ -67,7 +67,7 @@ struct aio_event_context {
};
struct aio_event {
- struct event_context *event_ctx;
+ struct tevent_context *event_ctx;
struct iocb iocb;
void *private_data;
event_aio_handler_t handler;
@@ -95,7 +95,7 @@ static int aio_ctx_destructor(struct aio_event_context *aio_ev)
return 0;
}
-static void epoll_add_event(struct aio_event_context *aio_ev, struct fd_event *fde);
+static void epoll_add_event(struct aio_event_context *aio_ev, struct tevent_fd *fde);
/*
reopen the epoll handle when our pid changes
@@ -104,7 +104,7 @@ static void epoll_add_event(struct aio_event_context *aio_ev, struct fd_event *f
*/
static void epoll_check_reopen(struct aio_event_context *aio_ev)
{
- struct fd_event *fde;
+ struct tevent_fd *fde;
if (aio_ev->pid == getpid()) {
return;
@@ -129,7 +129,7 @@ static void epoll_check_reopen(struct aio_event_context *aio_ev)
/*
add the epoll event to the given fd_event
*/
-static void epoll_add_event(struct aio_event_context *aio_ev, struct fd_event *fde)
+static void epoll_add_event(struct aio_event_context *aio_ev, struct tevent_fd *fde)
{
struct epoll_event event;
if (aio_ev->epoll_fd == -1) return;
@@ -154,7 +154,7 @@ static void epoll_add_event(struct aio_event_context *aio_ev, struct fd_event *f
/*
delete the epoll event for given fd_event
*/
-static void epoll_del_event(struct aio_event_context *aio_ev, struct fd_event *fde)
+static void epoll_del_event(struct aio_event_context *aio_ev, struct tevent_fd *fde)
{
struct epoll_event event;
@@ -178,7 +178,7 @@ static void epoll_del_event(struct aio_event_context *aio_ev, struct fd_event *f
/*
change the epoll event to the given fd_event
*/
-static void epoll_mod_event(struct aio_event_context *aio_ev, struct fd_event *fde)
+static void epoll_mod_event(struct aio_event_context *aio_ev, struct tevent_fd *fde)
{
struct epoll_event event;
if (aio_ev->epoll_fd == -1) return;
@@ -196,7 +196,7 @@ static void epoll_mod_event(struct aio_event_context *aio_ev, struct fd_event *f
}
}
-static void epoll_change_event(struct aio_event_context *aio_ev, struct fd_event *fde)
+static void epoll_change_event(struct aio_event_context *aio_ev, struct tevent_fd *fde)
{
bool got_error = (fde->additional_flags & EPOLL_ADDITIONAL_FD_FLAG_GOT_ERROR);
bool want_read = (fde->flags & EVENT_FD_READ);
@@ -308,7 +308,7 @@ static int aio_event_loop(struct aio_event_context *aio_ev, struct timeval *tval
}
case IOCB_CMD_EPOLL_WAIT: {
struct epoll_event *ep = (struct epoll_event *)finished->u.c.buf;
- struct fd_event *fde;
+ struct tevent_fd *fde;
uint16_t flags = 0;
int j;
@@ -316,7 +316,7 @@ static int aio_event_loop(struct aio_event_context *aio_ev, struct timeval *tval
for (j=0; j<event->res; j++, ep++) {
fde = talloc_get_type(ep->data.ptr,
- struct fd_event);
+ struct tevent_fd);
if (fde == NULL) {
return -1;
}
@@ -348,7 +348,7 @@ static int aio_event_loop(struct aio_event_context *aio_ev, struct timeval *tval
/*
create a aio_event_context structure.
*/
-static int aio_event_context_init(struct event_context *ev)
+static int aio_event_context_init(struct tevent_context *ev)
{
struct aio_event_context *aio_ev;
@@ -385,9 +385,9 @@ static int aio_event_context_init(struct event_context *ev)
/*
destroy an fd_event
*/
-static int aio_event_fd_destructor(struct fd_event *fde)
+static int aio_event_fd_destructor(struct tevent_fd *fde)
{
- struct event_context *ev = fde->event_ctx;
+ struct tevent_context *ev = fde->event_ctx;
struct aio_event_context *aio_ev = talloc_get_type(ev->additional_data,
struct aio_event_context);
@@ -410,18 +410,18 @@ static int aio_event_fd_destructor(struct fd_event *fde)
add a fd based event
return NULL on failure (memory allocation error)
*/
-static struct fd_event *aio_event_add_fd(struct event_context *ev, TALLOC_CTX *mem_ctx,
+static struct tevent_fd *aio_event_add_fd(struct tevent_context *ev, TALLOC_CTX *mem_ctx,
int fd, uint16_t flags,
event_fd_handler_t handler,
void *private_data)
{
struct aio_event_context *aio_ev = talloc_get_type(ev->additional_data,
struct aio_event_context);
- struct fd_event *fde;
+ struct tevent_fd *fde;
epoll_check_reopen(aio_ev);
- fde = talloc(mem_ctx?mem_ctx:ev, struct fd_event);
+ fde = talloc(mem_ctx?mem_ctx:ev, struct tevent_fd);
if (!fde) return NULL;
fde->event_ctx = ev;
@@ -445,7 +445,7 @@ static struct fd_event *aio_event_add_fd(struct event_context *ev, TALLOC_CTX *m
/*
return the fd event flags
*/
-static uint16_t aio_event_get_fd_flags(struct fd_event *fde)
+static uint16_t aio_event_get_fd_flags(struct tevent_fd *fde)
{
return fde->flags;
}
@@ -453,9 +453,9 @@ static uint16_t aio_event_get_fd_flags(struct fd_event *fde)
/*
set the fd event flags
*/
-static void aio_event_set_fd_flags(struct fd_event *fde, uint16_t flags)
+static void aio_event_set_fd_flags(struct tevent_fd *fde, uint16_t flags)
{
- struct event_context *ev;
+ struct tevent_context *ev;
struct aio_event_context *aio_ev;
if (fde->flags == flags) return;
@@ -473,7 +473,7 @@ static void aio_event_set_fd_flags(struct fd_event *fde, uint16_t flags)
/*
do a single event loop using the events defined in ev
*/
-static int aio_event_loop_once(struct event_context *ev)
+static int aio_event_loop_once(struct tevent_context *ev)
{
struct aio_event_context *aio_ev = talloc_get_type(ev->additional_data,
struct aio_event_context);
@@ -492,7 +492,7 @@ static int aio_event_loop_once(struct event_context *ev)
/*
return on failure or (with 0) if all fd events are removed
*/
-static int aio_event_loop_wait(struct event_context *ev)
+static int aio_event_loop_wait(struct tevent_context *ev)
{
struct aio_event_context *aio_ev = talloc_get_type(ev->additional_data,
struct aio_event_context);
@@ -510,7 +510,7 @@ static int aio_event_loop_wait(struct event_context *ev)
*/
static int aio_destructor(struct aio_event *ae)
{
- struct event_context *ev = ae->event_ctx;
+ struct tevent_context *ev = ae->event_ctx;
struct aio_event_context *aio_ev = talloc_get_type(ev->additional_data,
struct aio_event_context);
struct io_event result;
@@ -520,7 +520,7 @@ static int aio_destructor(struct aio_event *ae)
}
/* submit an aio disk IO event */
-static struct aio_event *aio_event_add_aio(struct event_context *ev,
+static struct aio_event *aio_event_add_aio(struct tevent_context *ev,
TALLOC_CTX *mem_ctx,
struct iocb *iocb,
event_aio_handler_t handler,
diff --git a/lib/tevent/tevent_debug.c b/lib/tevent/tevent_debug.c
index a23ff09755..4fa58534b4 100644
--- a/lib/tevent/tevent_debug.c
+++ b/lib/tevent/tevent_debug.c
@@ -30,7 +30,7 @@
/*
this allows the user to choose their own debug function
*/
-int ev_set_debug(struct event_context *ev,
+int ev_set_debug(struct tevent_context *ev,
void (*debug)(void *context, enum ev_debug_level level,
const char *fmt, va_list ap),
void *context)
@@ -57,7 +57,7 @@ void ev_debug_stderr(void *context, enum ev_debug_level level,
convenience function to setup debug messages on stderr
messages of level EV_DEBUG_WARNING and higher are printed
*/
-int ev_set_debug_stderr(struct event_context *ev)
+int ev_set_debug_stderr(struct tevent_context *ev)
{
return ev_set_debug(ev, ev_debug_stderr, ev);
}
@@ -70,7 +70,7 @@ int ev_set_debug_stderr(struct event_context *ev)
* Applications using the library must decide where to
* redirect debugging messages
*/
-void ev_debug(struct event_context *ev, enum ev_debug_level level, const char *fmt, ...)
+void ev_debug(struct tevent_context *ev, enum ev_debug_level level, const char *fmt, ...)
{
va_list ap;
if (ev->debug_ops.debug == NULL) {
diff --git a/lib/tevent/tevent_epoll.c b/lib/tevent/tevent_epoll.c
index cff6e46e2c..1ce666462c 100644
--- a/lib/tevent/tevent_epoll.c
+++ b/lib/tevent/tevent_epoll.c
@@ -30,10 +30,10 @@
struct epoll_event_context {
/* a pointer back to the generic event_context */
- struct event_context *ev;
+ struct tevent_context *ev;
/* list of filedescriptor events */
- struct fd_event *fd_events;
+ struct tevent_fd *fd_events;
/* number of registered fd event handlers */
int num_fd_events;
@@ -98,7 +98,7 @@ static int epoll_init_ctx(struct epoll_event_context *epoll_ev)
return 0;
}
-static void epoll_add_event(struct epoll_event_context *epoll_ev, struct fd_event *fde);
+static void epoll_add_event(struct epoll_event_context *epoll_ev, struct tevent_fd *fde);
/*
reopen the epoll handle when our pid changes
@@ -107,7 +107,7 @@ static void epoll_add_event(struct epoll_event_context *epoll_ev, struct fd_even
*/
static void epoll_check_reopen(struct epoll_event_context *epoll_ev)
{
- struct fd_event *fde;
+ struct tevent_fd *fde;
if (epoll_ev->pid == getpid()) {
return;
@@ -133,7 +133,7 @@ static void epoll_check_reopen(struct epoll_event_context *epoll_ev)
/*
add the epoll event to the given fd_event
*/
-static void epoll_add_event(struct epoll_event_context *epoll_ev, struct fd_event *fde)
+static void epoll_add_event(struct epoll_event_context *epoll_ev, struct tevent_fd *fde)
{
struct epoll_event event;
@@ -161,7 +161,7 @@ static void epoll_add_event(struct epoll_event_context *epoll_ev, struct fd_even
/*
delete the epoll event for given fd_event
*/
-static void epoll_del_event(struct epoll_event_context *epoll_ev, struct fd_event *fde)
+static void epoll_del_event(struct epoll_event_context *epoll_ev, struct tevent_fd *fde)
{
struct epoll_event event;
@@ -186,7 +186,7 @@ static void epoll_del_event(struct epoll_event_context *epoll_ev, struct fd_even
/*
change the epoll event to the given fd_event
*/
-static void epoll_mod_event(struct epoll_event_context *epoll_ev, struct fd_event *fde)
+static void epoll_mod_event(struct epoll_event_context *epoll_ev, struct tevent_fd *fde)
{
struct epoll_event event;
if (epoll_ev->epoll_fd == -1) return;
@@ -206,7 +206,7 @@ static void epoll_mod_event(struct epoll_event_context *epoll_ev, struct fd_even
}
}
-static void epoll_change_event(struct epoll_event_context *epoll_ev, struct fd_event *fde)
+static void epoll_change_event(struct epoll_event_context *epoll_ev, struct tevent_fd *fde)
{
bool got_error = (fde->additional_flags & EPOLL_ADDITIONAL_FD_FLAG_GOT_ERROR);
bool want_read = (fde->flags & EVENT_FD_READ);
@@ -282,8 +282,8 @@ static int epoll_event_loop(struct epoll_event_context *epoll_ev, struct timeval
}
for (i=0;i<ret;i++) {
- struct fd_event *fde = talloc_get_type(events[i].data.ptr,
- struct fd_event);
+ struct tevent_fd *fde = talloc_get_type(events[i].data.ptr,
+ struct tevent_fd);
uint16_t flags = 0;
if (fde == NULL) {
@@ -320,7 +320,7 @@ static int epoll_event_loop(struct epoll_event_context *epoll_ev, struct timeval
/*
create a epoll_event_context structure.
*/
-static int epoll_event_context_init(struct event_context *ev)
+static int epoll_event_context_init(struct tevent_context *ev)
{
int ret;
struct epoll_event_context *epoll_ev;
@@ -343,9 +343,9 @@ static int epoll_event_context_init(struct event_context *ev)
/*
destroy an fd_event
*/
-static int epoll_event_fd_destructor(struct fd_event *fde)
+static int epoll_event_fd_destructor(struct tevent_fd *fde)
{
- struct event_context *ev = fde->event_ctx;
+ struct tevent_context *ev = fde->event_ctx;
struct epoll_event_context *epoll_ev = talloc_get_type(ev->additional_data,
struct epoll_event_context);
@@ -370,18 +370,18 @@ static int epoll_event_fd_destructor(struct fd_event *fde)
add a fd based event
return NULL on failure (memory allocation error)
*/
-static struct fd_event *epoll_event_add_fd(struct event_context *ev, TALLOC_CTX *mem_ctx,
+static struct tevent_fd *epoll_event_add_fd(struct tevent_context *ev, TALLOC_CTX *mem_ctx,
int fd, uint16_t flags,
event_fd_handler_t handler,
void *private_data)
{
struct epoll_event_context *epoll_ev = talloc_get_type(ev->additional_data,
struct epoll_event_context);
- struct fd_event *fde;
+ struct tevent_fd *fde;
epoll_check_reopen(epoll_ev);
- fde = talloc(mem_ctx?mem_ctx:ev, struct fd_event);
+ fde = talloc(mem_ctx?mem_ctx:ev, struct tevent_fd);
if (!fde) return NULL;
fde->event_ctx = ev;
@@ -405,7 +405,7 @@ static struct fd_event *epoll_event_add_fd(struct event_context *ev, TALLOC_CTX
/*
return the fd event flags
*/
-static uint16_t epoll_event_get_fd_flags(struct fd_event *fde)
+static uint16_t epoll_event_get_fd_flags(struct tevent_fd *fde)
{
return fde->flags;
}
@@ -413,9 +413,9 @@ static uint16_t epoll_event_get_fd_flags(struct fd_event *fde)
/*
set the fd event flags
*/
-static void epoll_event_set_fd_flags(struct fd_event *fde, uint16_t flags)
+static void epoll_event_set_fd_flags(struct tevent_fd *fde, uint16_t flags)
{
- struct event_context *ev;
+ struct tevent_context *ev;
struct epoll_event_context *epoll_ev;
if (fde->flags == flags) return;
@@ -433,7 +433,7 @@ static void epoll_event_set_fd_flags(struct fd_event *fde, uint16_t flags)
/*
do a single event loop using the events defined in ev
*/
-static int epoll_event_loop_once(struct event_context *ev)
+static int epoll_event_loop_once(struct tevent_context *ev)
{
struct epoll_event_context *epoll_ev = talloc_get_type(ev->additional_data,
struct epoll_event_context);
@@ -452,7 +452,7 @@ static int epoll_event_loop_once(struct event_context *ev)
/*
return on failure or (with 0) if all fd events are removed
*/
-static int epoll_event_loop_wait(struct event_context *ev)
+static int epoll_event_loop_wait(struct tevent_context *ev)
{
struct epoll_event_context *epoll_ev = talloc_get_type(ev->additional_data,
struct epoll_event_context);
diff --git a/lib/tevent/tevent_internal.h b/lib/tevent/tevent_internal.h
index 42c860756d..2d6909da36 100644
--- a/lib/tevent/tevent_internal.h
+++ b/lib/tevent/tevent_internal.h
@@ -106,7 +106,7 @@ int ev_set_debug(struct tevent_context *ev,
const char *fmt, va_list ap) PRINTF_ATTRIBUTE(3,0),
void *context);
int ev_set_debug_stderr(struct tevent_context *ev);
-void ev_debug(struct event_context *ev, enum ev_debug_level level, const char *fmt, ...);
+void ev_debug(struct tevent_context *ev, enum ev_debug_level level, const char *fmt, ...);
/* aio event is private to the aio backend */
struct tevent_aio;
diff --git a/lib/tevent/tevent_liboop.c b/lib/tevent/tevent_liboop.c
index 520bc5a996..5f658d7c1f 100644
--- a/lib/tevent/tevent_liboop.c
+++ b/lib/tevent/tevent_liboop.c
@@ -33,7 +33,7 @@
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
*/
-static int oop_event_context_destructor(struct event_context *ev)
+static int oop_event_context_destructor(struct tevent_context *ev)
{
oop_source_sys *oop_sys = ev->additional_data;
@@ -45,7 +45,7 @@ static int oop_event_context_destructor(struct event_context *ev)
/*
create a oop_event_context structure.
*/
-static int oop_event_context_init(struct event_context *ev, void *private_data)
+static int oop_event_context_init(struct tevent_context *ev, void *private_data)
{
oop_source_sys *oop_sys = private_data;
@@ -65,7 +65,7 @@ static int oop_event_context_init(struct event_context *ev, void *private_data)
static void *oop_event_fd_handler(oop_source *oop, int fd, oop_event oop_type, void *ptr)
{
- struct fd_event *fde = ptr;
+ struct tevent_fd *fde = ptr;
if (fd != fde->fd) return OOP_ERROR;
@@ -88,9 +88,9 @@ static void *oop_event_fd_handler(oop_source *oop, int fd, oop_event oop_type, v
/*
destroy an fd_event
*/
-static int oop_event_fd_destructor(struct fd_event *fde)
+static int oop_event_fd_destructor(struct tevent_fd *fde)
{
- struct event_context *ev = fde->event_ctx;
+ struct tevent_context *ev = fde->event_ctx;
oop_source_sys *oop_sys = ev->additional_data;
oop_source *oop = oop_sys_source(oop_sys);
@@ -111,16 +111,16 @@ static int oop_event_fd_destructor(struct fd_event *fde)
add a fd based event
return NULL on failure (memory allocation error)
*/
-static struct fd_event *oop_event_add_fd(struct event_context *ev, TALLOC_CTX *mem_ctx,
+static struct tevent_fd *oop_event_add_fd(struct tevent_context *ev, TALLOC_CTX *mem_ctx,
int fd, uint16_t flags,
event_fd_handler_t handler,
void *private_data)
{
- struct fd_event *fde;
+ struct tevent_fd *fde;
oop_source_sys *oop_sys = ev->additional_data;
oop_source *oop = oop_sys_source(oop_sys);
- fde = talloc(mem_ctx?mem_ctx:ev, struct fd_event);
+ fde = talloc(mem_ctx?mem_ctx:ev, struct tevent_fd);
if (!fde) return NULL;
fde->event_ctx = ev;
@@ -144,7 +144,7 @@ static struct fd_event *oop_event_add_fd(struct event_context *ev, TALLOC_CTX *m
/*
return the fd event flags
*/
-static uint16_t oop_event_get_fd_flags(struct fd_event *fde)
+static uint16_t oop_event_get_fd_flags(struct tevent_fd *fde)
{
return fde->flags;
}
@@ -152,7 +152,7 @@ static uint16_t oop_event_get_fd_flags(struct fd_event *fde)
/*
set the fd event flags
*/
-static void oop_event_set_fd_flags(struct fd_event *fde, uint16_t flags)
+static void oop_event_set_fd_flags(struct tevent_fd *fde, uint16_t flags)
{
oop_source_sys *oop_sys;
oop_source *oop;
@@ -175,16 +175,16 @@ static void oop_event_set_fd_flags(struct fd_event *fde, uint16_t flags)
fde->flags = flags;
}
-static int oop_event_timed_destructor(struct timed_event *te);
+static int oop_event_timed_destructor(struct tevent_timer *te);
-static int oop_event_timed_deny_destructor(struct timed_event *te)
+static int oop_event_timed_deny_destructor(struct tevent_timer *te)
{
return -1;
}
static void *oop_event_timed_handler(oop_source *oop, struct timeval t, void *ptr)
{
- struct timed_event *te = ptr;
+ struct tevent_timer *te = ptr;
/* deny the handler to free the event */
talloc_set_destructor(te, oop_event_timed_deny_destructor);
@@ -199,9 +199,9 @@ static void *oop_event_timed_handler(oop_source *oop, struct timeval t, void *pt
/*
destroy a timed event
*/
-static int oop_event_timed_destructor(struct timed_event *te)
+static int oop_event_timed_destructor(struct tevent_timer *te)
{
- struct event_context *ev = te->event_ctx;
+ struct tevent_context *ev = te->event_ctx;
oop_source_sys *oop_sys = ev->additional_data;
oop_source *oop = oop_sys_source(oop_sys);
@@ -214,16 +214,16 @@ static int oop_event_timed_destructor(struct timed_event *te)
add a timed event
return NULL on failure (memory allocation error)
*/
-static struct timed_event *oop_event_add_timed(struct event_context *ev, TALLOC_CTX *mem_ctx,
+static struct tevent_timer *oop_event_add_timed(struct tevent_context *ev, TALLOC_CTX *mem_ctx,
struct timeval next_event,
event_timed_handler_t handler,
void *private_data)
{
oop_source_sys *oop_sys = ev->additional_data;
oop_source *oop = oop_sys_source(oop_sys);
- struct timed_event *te;
+ struct tevent_timer *te;
- te = talloc(mem_ctx?mem_ctx:ev, struct timed_event);
+ te = talloc(mem_ctx?mem_ctx:ev, struct tevent_timer);
if (te == NULL) return NULL;
te->event_ctx = ev;
@@ -242,7 +242,7 @@ static struct timed_event *oop_event_add_timed(struct event_context *ev, TALLOC_
/*
do a single event loop using the events defined in ev
*/
-static int oop_event_loop_once(struct event_context *ev)
+static int oop_event_loop_once(struct tevent_context *ev)
{
void *oop_ret;
oop_source_sys *oop_sys = ev->additional_data;
@@ -258,7 +258,7 @@ static int oop_event_loop_once(struct event_context *ev)
/*
return on failure or (with 0) if all fd events are removed
*/
-static int oop_event_loop_wait(struct event_context *ev)
+static int oop_event_loop_wait(struct tevent_context *ev)
{
void *oop_ret;
oop_source_sys *oop_sys = ev->additional_data;
diff --git a/lib/tevent/tevent_select.c b/lib/tevent/tevent_select.c
index efb3ff564c..3e72ce4943 100644
--- a/lib/tevent/tevent_select.c
+++ b/lib/tevent/tevent_select.c
@@ -32,13 +32,13 @@
struct select_event_context {
/* a pointer back to the generic event_context */
- struct event_context *ev;
+ struct tevent_context *ev;
/* list of filedescriptor events */
- struct fd_event *fd_events;
+ struct tevent_fd *fd_events;
/* list of timed events */
- struct timed_event *timed_events;
+ struct tevent_timer *timed_events;
/* the maximum file descriptor number in fd_events */
int maxfd;
@@ -54,7 +54,7 @@ struct select_event_context {
/*
create a select_event_context structure.
*/
-static int select_event_context_init(struct event_context *ev)
+static int select_event_context_init(struct tevent_context *ev)
{
struct select_event_context *select_ev;
@@ -71,7 +71,7 @@ static int select_event_context_init(struct event_context *ev)
*/
static void calc_maxfd(struct select_event_context *select_ev)
{
- struct fd_event *fde;
+ struct tevent_fd *fde;
select_ev->maxfd = 0;
for (fde = select_ev->fd_events; fde; fde = fde->next) {
@@ -90,9 +90,9 @@ static void calc_maxfd(struct select_event_context *select_ev)
/*
destroy an fd_event
*/
-static int select_event_fd_destructor(struct fd_event *fde)
+static int select_event_fd_destructor(struct tevent_fd *fde)
{
- struct event_context *ev = fde->event_ctx;
+ struct tevent_context *ev = fde->event_ctx;
struct select_event_context *select_ev = talloc_get_type(ev->additional_data,
struct select_event_context);
@@ -115,16 +115,16 @@ static int select_event_fd_destructor(struct fd_event *fde)
add a fd based event
return NULL on failure (memory allocation error)
*/
-static struct fd_event *select_event_add_fd(struct event_context *ev, TALLOC_CTX *mem_ctx,
+static struct tevent_fd *select_event_add_fd(struct tevent_context *ev, TALLOC_CTX *mem_ctx,
int fd, uint16_t flags,
event_fd_handler_t handler,
void *private_data)
{
struct select_event_context *select_ev = talloc_get_type(ev->additional_data,
struct select_event_context);
- struct fd_event *fde;
+ struct tevent_fd *fde;
- fde = talloc(mem_ctx?mem_ctx:ev, struct fd_event);
+ fde = talloc(mem_ctx?mem_ctx:ev, struct tevent_fd);
if (!fde) return NULL;
fde->event_ctx = ev;
@@ -148,7 +148,7 @@ static struct fd_event *select_event_add_fd(struct event_context *ev, TALLOC_CTX
/*
return the fd event flags
*/
-static uint16_t select_event_get_fd_flags(struct fd_event *fde)
+static uint16_t select_event_get_fd_flags(struct tevent_fd *fde)
{
return fde->flags;
}
@@ -156,9 +156,9 @@ static uint16_t select_event_get_fd_flags(struct fd_event *fde)
/*
set the fd event flags
*/
-static void select_event_set_fd_flags(struct fd_event *fde, uint16_t flags)
+static void select_event_set_fd_flags(struct tevent_fd *fde, uint16_t flags)
{
- struct event_context *ev;
+ struct tevent_context *ev;
struct select_event_context *select_ev;
if (fde->flags == flags) return;
@@ -175,7 +175,7 @@ static void select_event_set_fd_flags(struct fd_event *fde, uint16_t flags)
static int select_event_loop_select(struct select_event_context *select_ev, struct timeval *tvalp)
{
fd_set r_fds, w_fds;
- struct fd_event *fde;
+ struct tevent_fd *fde;
int selrtn;
uint32_t destruction_count = ++select_ev->destruction_count;
@@ -252,7 +252,7 @@ static int select_event_loop_select(struct select_event_context *select_ev, stru
/*
do a single event loop using the events defined in ev
*/
-static int select_event_loop_once(struct event_context *ev)
+static int select_event_loop_once(struct tevent_context *ev)
{
struct select_event_context *select_ev = talloc_get_type(ev->additional_data,
struct select_event_context);
@@ -269,7 +269,7 @@ static int select_event_loop_once(struct event_context *ev)
/*
return on failure or (with 0) if all fd events are removed
*/
-static int select_event_loop_wait(struct event_context *ev)
+static int select_event_loop_wait(struct tevent_context *ev)
{
struct select_event_context *select_ev = talloc_get_type(ev->additional_data,
struct select_event_context);
diff --git a/lib/tevent/tevent_signal.c b/lib/tevent/tevent_signal.c
index 36907af6be..bb50480dd7 100644
--- a/lib/tevent/tevent_signal.c
+++ b/lib/tevent/tevent_signal.c
@@ -129,7 +129,7 @@ static int signal_event_destructor(struct signal_event *se)
/*
this is part of the pipe hack needed to avoid the signal race condition
*/
-static void signal_pipe_handler(struct event_context *ev, struct fd_event *fde,
+static void signal_pipe_handler(struct tevent_context *ev, struct tevent_fd *fde,
uint16_t flags, void *private)
{
char c[16];
@@ -141,7 +141,7 @@ static void signal_pipe_handler(struct event_context *ev, struct fd_event *fde,
add a signal event
return NULL on failure (memory allocation error)
*/
-struct signal_event *common_event_add_signal(struct event_context *ev,
+struct signal_event *common_event_add_signal(struct tevent_context *ev,
TALLOC_CTX *mem_ctx,
int signum,
int sa_flags,
@@ -233,7 +233,7 @@ struct signal_event *common_event_add_signal(struct event_context *ev,
check if a signal is pending
return != 0 if a signal was pending
*/
-int common_event_check_signal(struct event_context *ev)
+int common_event_check_signal(struct tevent_context *ev)
{
int i;
diff --git a/lib/tevent/tevent_standard.c b/lib/tevent/tevent_standard.c
index ba474dbd26..1c99408b8d 100644
--- a/lib/tevent/tevent_standard.c
+++ b/lib/tevent/tevent_standard.c
@@ -37,10 +37,10 @@
struct std_event_context {
/* a pointer back to the generic event_context */
- struct event_context *ev;
+ struct tevent_context *ev;
/* list of filedescriptor events */
- struct fd_event *fd_events;
+ struct tevent_fd *fd_events;
/* the maximum file descriptor number in fd_events */
int maxfd;
@@ -112,7 +112,7 @@ static void epoll_init_ctx(struct std_event_context *std_ev)
talloc_set_destructor(std_ev, epoll_ctx_destructor);
}
-static void epoll_add_event(struct std_event_context *std_ev, struct fd_event *fde);
+static void epoll_add_event(struct std_event_context *std_ev, struct tevent_fd *fde);
/*
reopen the epoll handle when our pid changes
@@ -121,7 +121,7 @@ static void epoll_add_event(struct std_event_context *std_ev, struct fd_event *f
*/
static void epoll_check_reopen(struct std_event_context *std_ev)
{
- struct fd_event *fde;
+ struct tevent_fd *fde;
if (std_ev->pid == getpid()) {
return;
@@ -147,7 +147,7 @@ static void epoll_check_reopen(struct std_event_context *std_ev)
/*
add the epoll event to the given fd_event
*/
-static void epoll_add_event(struct std_event_context *std_ev, struct fd_event *fde)
+static void epoll_add_event(struct std_event_context *std_ev, struct tevent_fd *fde)
{
struct epoll_event event;
if (std_ev->epoll_fd == -1) return;
@@ -174,7 +174,7 @@ static void epoll_add_event(struct std_event_context *std_ev, struct fd_event *f
/*
delete the epoll event for given fd_event
*/
-static void epoll_del_event(struct std_event_context *std_ev, struct fd_event *fde)
+static void epoll_del_event(struct std_event_context *std_ev, struct tevent_fd *fde)
{
struct epoll_event event;
if (std_ev->epoll_fd == -1) return;
@@ -194,7 +194,7 @@ static void epoll_del_event(struct std_event_context *std_ev, struct fd_event *f
/*
change the epoll event to the given fd_event
*/
-static void epoll_mod_event(struct std_event_context *std_ev, struct fd_event *fde)
+static void epoll_mod_event(struct std_event_context *std_ev, struct tevent_fd *fde)
{
struct epoll_event event;
if (std_ev->epoll_fd == -1) return;
@@ -214,7 +214,7 @@ static void epoll_mod_event(struct std_event_context *std_ev, struct fd_event *f
}
}
-static void epoll_change_event(struct std_event_context *std_ev, struct fd_event *fde)
+static void epoll_change_event(struct std_event_context *std_ev, struct tevent_fd *fde)
{
bool got_error = (fde->additional_flags & EPOLL_ADDITIONAL_FD_FLAG_GOT_ERROR);
bool want_read = (fde->flags & EVENT_FD_READ);
@@ -290,8 +290,8 @@ static int epoll_event_loop(struct std_event_context *std_ev, struct timeval *tv
}
for (i=0;i<ret;i++) {
- struct fd_event *fde = talloc_get_type(events[i].data.ptr,
- struct fd_event);
+ struct tevent_fd *fde = talloc_get_type(events[i].data.ptr,
+ struct tevent_fd);
uint16_t flags = 0;
if (fde == NULL) {
@@ -336,7 +336,7 @@ static int epoll_event_loop(struct std_event_context *std_ev, struct timeval *tv
/*
create a std_event_context structure.
*/
-static int std_event_context_init(struct event_context *ev)
+static int std_event_context_init(struct tevent_context *ev)
{
struct std_event_context *std_ev;
@@ -356,7 +356,7 @@ static int std_event_context_init(struct event_context *ev)
*/
static void calc_maxfd(struct std_event_context *std_ev)
{
- struct fd_event *fde;
+ struct tevent_fd *fde;
std_ev->maxfd = 0;
for (fde = std_ev->fd_events; fde; fde = fde->next) {
@@ -375,9 +375,9 @@ static void calc_maxfd(struct std_event_context *std_ev)
/*
destroy an fd_event
*/
-static int std_event_fd_destructor(struct fd_event *fde)
+static int std_event_fd_destructor(struct tevent_fd *fde)
{
- struct event_context *ev = fde->event_ctx;
+ struct tevent_context *ev = fde->event_ctx;
struct std_event_context *std_ev = talloc_get_type(ev->additional_data,
struct std_event_context);
@@ -404,18 +404,18 @@ static int std_event_fd_destructor(struct fd_event *fde)
add a fd based event
return NULL on failure (memory allocation error)
*/
-static struct fd_event *std_event_add_fd(struct event_context *ev, TALLOC_CTX *mem_ctx,
+static struct tevent_fd *std_event_add_fd(struct tevent_context *ev, TALLOC_CTX *mem_ctx,
int fd, uint16_t flags,
event_fd_handler_t handler,
void *private_data)
{
struct std_event_context *std_ev = talloc_get_type(ev->additional_data,
struct std_event_context);
- struct fd_event *fde;
+ struct tevent_fd *fde;
epoll_check_reopen(std_ev);
- fde = talloc(mem_ctx?mem_ctx:ev, struct fd_event);
+ fde = talloc(mem_ctx?mem_ctx:ev, struct tevent_fd);
if (!fde) return NULL;
fde->event_ctx = ev;
@@ -442,7 +442,7 @@ static struct fd_event *std_event_add_fd(struct event_context *ev, TALLOC_CTX *m
/*
return the fd event flags
*/
-static uint16_t std_event_get_fd_flags(struct fd_event *fde)
+static uint16_t std_event_get_fd_flags(struct tevent_fd *fde)
{
return fde->flags;
}
@@ -450,9 +450,9 @@ static uint16_t std_event_get_fd_flags(struct fd_event *fde)
/*
set the fd event flags
*/
-static void std_event_set_fd_flags(struct fd_event *fde, uint16_t flags)
+static void std_event_set_fd_flags(struct tevent_fd *fde, uint16_t flags)
{
- struct event_context *ev;
+ struct tevent_context *ev;
struct std_event_context *std_ev;
if (fde->flags == flags) return;
@@ -473,7 +473,7 @@ static void std_event_set_fd_flags(struct fd_event *fde, uint16_t flags)
static int std_event_loop_select(struct std_event_context *std_ev, struct timeval *tvalp)
{
fd_set r_fds, w_fds;
- struct fd_event *fde;
+ struct tevent_fd *fde;
int selrtn;
uint32_t destruction_count = ++std_ev->destruction_count;
@@ -550,7 +550,7 @@ static int std_event_loop_select(struct std_event_context *std_ev, struct timeva
/*
do a single event loop using the events defined in ev
*/
-static int std_event_loop_once(struct event_context *ev)
+static int std_event_loop_once(struct tevent_context *ev)
{
struct std_event_context *std_ev = talloc_get_type(ev->additional_data,
struct std_event_context);
@@ -573,7 +573,7 @@ static int std_event_loop_once(struct event_context *ev)
/*
return on failure or (with 0) if all fd events are removed
*/
-static int std_event_loop_wait(struct event_context *ev)
+static int std_event_loop_wait(struct tevent_context *ev)
{
struct std_event_context *std_ev = talloc_get_type(ev->additional_data,
struct std_event_context);
diff --git a/lib/tevent/tevent_timed.c b/lib/tevent/tevent_timed.c
index a9b80948a1..ce3fc8eb00 100644
--- a/lib/tevent/tevent_timed.c
+++ b/lib/tevent/tevent_timed.c
@@ -109,15 +109,15 @@ bool ev_timeval_is_zero(const struct timeval *tv)
/*
destroy a timed event
*/
-static int common_event_timed_destructor(struct timed_event *te)
+static int common_event_timed_destructor(struct tevent_timer *te)
{
- struct event_context *ev = talloc_get_type(te->event_ctx,
- struct event_context);
+ struct tevent_context *ev = talloc_get_type(te->event_ctx,
+ struct tevent_context);
DLIST_REMOVE(ev->timer_events, te);
return 0;
}
-static int common_event_timed_deny_destructor(struct timed_event *te)
+static int common_event_timed_deny_destructor(struct tevent_timer *te)
{
return -1;
}
@@ -126,14 +126,14 @@ static int common_event_timed_deny_destructor(struct timed_event *te)
add a timed event
return NULL on failure (memory allocation error)
*/
-struct timed_event *common_event_add_timed(struct event_context *ev, TALLOC_CTX *mem_ctx,
+struct tevent_timer *common_event_add_timed(struct tevent_context *ev, TALLOC_CTX *mem_ctx,
struct timeval next_event,
event_timed_handler_t handler,
void *private_data)
{
- struct timed_event *te, *last_te, *cur_te;
+ struct tevent_timer *te, *last_te, *cur_te;
- te = talloc(mem_ctx?mem_ctx:ev, struct timed_event);
+ te = talloc(mem_ctx?mem_ctx:ev, struct tevent_timer);
if (te == NULL) return NULL;
te->event_ctx = ev;
@@ -166,10 +166,10 @@ struct timed_event *common_event_add_timed(struct event_context *ev, TALLOC_CTX
return the delay untill the next timed event,
or zero if a timed event was triggered
*/
-struct timeval common_event_loop_timer_delay(struct event_context *ev)
+struct timeval common_event_loop_timer_delay(struct tevent_context *ev)
{
struct timeval current_time = ev_timeval_zero();
- struct timed_event *te = ev->timer_events;
+ struct tevent_timer *te = ev->timer_events;
if (!te) {
/* have a default tick time of 30 seconds. This guarantees