summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2009-01-02 11:39:04 -0800
committerJeremy Allison <jra@samba.org>2009-01-02 11:39:04 -0800
commit11576353f645d7d7f44a74d27545b946c6175658 (patch)
treea756a430d3fea82ac8a24144613d5d7e04d163f1
parent2234173220c51c2e37818149ddf41421672904c0 (diff)
parent268f3e93a4dd66ce43dc53278eff01f801ba5083 (diff)
downloadsamba-11576353f645d7d7f44a74d27545b946c6175658.tar.gz
samba-11576353f645d7d7f44a74d27545b946c6175658.tar.bz2
samba-11576353f645d7d7f44a74d27545b946c6175658.zip
Merge branch 'master' of ssh://jra@git.samba.org/data/git/samba
-rw-r--r--lib/tevent/libtevent.m42
-rw-r--r--lib/tevent/pytevent.c39
-rw-r--r--lib/tevent/tests.py8
-rw-r--r--lib/tevent/tevent.c169
-rw-r--r--lib/tevent/tevent.h97
-rw-r--r--lib/tevent/tevent.pc.in2
-rw-r--r--lib/tevent/tevent_aio.c80
-rw-r--r--lib/tevent/tevent_debug.c32
-rw-r--r--lib/tevent/tevent_epoll.c66
-rw-r--r--lib/tevent/tevent_internal.h99
-rw-r--r--lib/tevent/tevent_select.c43
-rw-r--r--lib/tevent/tevent_signal.c44
-rw-r--r--lib/tevent/tevent_standard.c82
-rw-r--r--lib/tevent/tevent_timed.c27
-rw-r--r--librpc/gen_ndr/named_pipe_auth.h1
-rw-r--r--packaging/RHEL/samba.spec.tmpl10
-rw-r--r--pidl/lib/Parse/Pidl/Samba4/Header.pm6
-rwxr-xr-xsource3/autogen.sh4
-rw-r--r--source3/include/smb.h2
-rw-r--r--source3/lib/ldb/include/ldb.h2
-rw-r--r--source3/lib/ldb/tools/ldbadd.c13
-rw-r--r--source3/lib/ldb/tools/ldbmodify.c12
-rw-r--r--source3/libsmb/smb_share_modes.c43
-rw-r--r--source3/modules/onefs_open.c6
-rw-r--r--source3/winbindd/idmap.c11
-rw-r--r--source4/headermap.txt3
-rw-r--r--source4/lib/events/config.mk2
-rw-r--r--source4/lib/events/events.h2
-rw-r--r--source4/lib/events/events_internal.h5
-rw-r--r--source4/lib/events/tevent_s4.c38
-rw-r--r--source4/lib/registry/pyregistry.c2
-rwxr-xr-xsource4/selftest/tests.sh2
-rw-r--r--source4/smbd/server.c2
-rw-r--r--source4/winbind/wb_init_domain.c3
-rw-r--r--source4/winbind/wb_samba3_cmd.c4
35 files changed, 538 insertions, 425 deletions
diff --git a/lib/tevent/libtevent.m4 b/lib/tevent/libtevent.m4
index 30105d9bef..24cdd8c27f 100644
--- a/lib/tevent/libtevent.m4
+++ b/lib/tevent/libtevent.m4
@@ -26,8 +26,6 @@ if test x"$ac_cv_header_sys_epoll_h" = x"yes" -a x"$ac_cv_func_epoll_create" = x
TEVENT_OBJ="$TEVENT_OBJ tevent_epoll.o"
SMB_ENABLE(TEVENT_EPOLL,YES)
AC_DEFINE(HAVE_EPOLL, 1, [Whether epoll available])
- #TODO: remove HAVE_EVENTS_EPOLL and use HAVE_EPOLL
- AC_DEFINE(HAVE_EVENTS_EPOLL, 1, [Whether epoll available])
# check for native Linux AIO interface
AC_CHECK_HEADERS(libaio.h)
diff --git a/lib/tevent/pytevent.c b/lib/tevent/pytevent.c
index a969373738..3d71d78397 100644
--- a/lib/tevent/pytevent.c
+++ b/lib/tevent/pytevent.c
@@ -24,9 +24,9 @@
typedef struct {
PyObject_HEAD
struct tevent_context *ev_ctx;
-} PyEventContextObject;
+} PyTEventContextObject;
-PyAPI_DATA(PyTypeObject) PyEventContext;
+PyAPI_DATA(PyTypeObject) PyTEventContext;
static PyObject *py_set_default_backend(PyObject *self, PyObject *args)
{
@@ -34,13 +34,13 @@ static PyObject *py_set_default_backend(PyObject *self, PyObject *args)
if (!PyArg_ParseTuple(args, "s", &name))
return NULL;
- event_set_default_backend(name);
+ tevent_set_default_backend(name);
return Py_None;
}
static PyObject *py_backend_list(PyObject *self)
{
- const char **backends = event_backend_list(NULL);
+ const char **backends = tevent_backend_list(NULL);
PyObject *ret;
int i, len;
@@ -66,28 +66,28 @@ static PyObject *py_event_ctx_new(PyTypeObject *type, PyObject *args, PyObject *
const char *kwnames[] = { "name", NULL };
char *name = NULL;
struct tevent_context *ev_ctx;
- PyEventContextObject *ret;
+ PyTEventContextObject *ret;
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|s", (char **)kwnames, &name))
return NULL;
if (name == NULL)
- ev_ctx = event_context_init(NULL);
+ ev_ctx = tevent_context_init(NULL);
else
- ev_ctx = event_context_init_byname(NULL, name);
+ ev_ctx = tevent_context_init_byname(NULL, name);
- ret = (PyEventContextObject *)type->tp_alloc(type, 0);
+ ret = (PyTEventContextObject *)type->tp_alloc(type, 0);
ret->ev_ctx = ev_ctx;
return (PyObject *)ret;
}
-static PyObject *py_event_ctx_loop_once(PyEventContextObject *self)
+static PyObject *py_event_ctx_loop_once(PyTEventContextObject *self)
{
- return PyInt_FromLong(event_loop_once(self->ev_ctx));
+ return PyInt_FromLong(tevent_loop_once(self->ev_ctx));
}
-static PyObject *py_event_ctx_loop_wait(PyEventContextObject *self)
+static PyObject *py_event_ctx_loop_wait(PyTEventContextObject *self)
{
- return PyInt_FromLong(event_loop_wait(self->ev_ctx));
+ return PyInt_FromLong(tevent_loop_wait(self->ev_ctx));
}
static PyMethodDef py_event_ctx_methods[] = {
@@ -98,16 +98,17 @@ static PyMethodDef py_event_ctx_methods[] = {
{ NULL }
};
-static void py_event_ctx_dealloc(PyEventContextObject * self)
+static void py_event_ctx_dealloc(PyTEventContextObject * self)
{
talloc_free(self->ev_ctx);
self->ob_type->tp_free(self);
}
-PyTypeObject PyEventContext = {
- .tp_name = "EventContext",
+
+PyTypeObject PyTEventContext = {
+ .tp_name = "TEventContext",
.tp_methods = py_event_ctx_methods,
- .tp_basicsize = sizeof(PyEventContextObject),
+ .tp_basicsize = sizeof(PyTEventContextObject),
.tp_dealloc = (destructor)py_event_ctx_dealloc,
.tp_flags = Py_TPFLAGS_DEFAULT,
.tp_new = py_event_ctx_new,
@@ -117,14 +118,14 @@ void inittevent(void)
{
PyObject *m;
- if (PyType_Ready(&PyEventContext) < 0)
+ if (PyType_Ready(&PyTEventContext) < 0)
return;
m = Py_InitModule3("tevent", tevent_methods, "Event management.");
if (m == NULL)
return;
- Py_INCREF(&PyEventContext);
- PyModule_AddObject(m, "EventContext", (PyObject *)&PyEventContext);
+ Py_INCREF(&PyTEventContext);
+ PyModule_AddObject(m, "TEventContext", (PyObject *)&PyTEventContext);
}
diff --git a/lib/tevent/tests.py b/lib/tevent/tests.py
index 0ec736b359..bf594a14f6 100644
--- a/lib/tevent/tests.py
+++ b/lib/tevent/tests.py
@@ -17,15 +17,15 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
-import tevent as events
+import tevent
import unittest
# Just test the bindings are there and that calling them doesn't crash
# anything.
-class EventTestCase(unittest.TestCase):
+class TEventTestCase(unittest.TestCase):
def test_create(self):
- self.assertTrue(events.EventContext() is not None)
+ self.assertTrue(tevent.TEventContext() is not None)
def test_loop_wait(self):
- self.assertEquals(0, events.EventContext().loop_wait())
+ self.assertEquals(0, tevent.TEventContext().loop_wait())
diff --git a/lib/tevent/tevent.c b/lib/tevent/tevent.c
index e45a690c33..9319177646 100644
--- a/lib/tevent/tevent.c
+++ b/lib/tevent/tevent.c
@@ -41,14 +41,14 @@
handler to get another event.
To setup a set of events you first need to create a event_context
- structure using the function event_context_init(); This returns a
+ structure using the function tevent_context_init(); This returns a
'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()
+ using tevent_add_*() and talloc_free()
- Finally, you call event_loop_wait_once() to block waiting for one of the
- events to occor or event_loop_wait() which will loop
+ Finally, you call tevent_loop_wait_once() to block waiting for one of the
+ events to occor or tevent_loop_wait() which will loop
forever.
*/
@@ -57,36 +57,36 @@
#include "tevent_internal.h"
#include "tevent_util.h"
-struct event_ops_list {
- struct event_ops_list *next, *prev;
+struct tevent_ops_list {
+ struct tevent_ops_list *next, *prev;
const char *name;
- const struct event_ops *ops;
+ const struct tevent_ops *ops;
};
/* list of registered event backends */
-static struct event_ops_list *event_backends = NULL;
-static char *event_default_backend = NULL;
+static struct tevent_ops_list *tevent_backends = NULL;
+static char *tevent_default_backend = NULL;
/*
register an events backend
*/
-bool event_register_backend(const char *name, const struct event_ops *ops)
+bool tevent_register_backend(const char *name, const struct tevent_ops *ops)
{
- struct event_ops_list *e;
+ struct tevent_ops_list *e;
- for (e = event_backends; e != NULL; e = e->next) {
+ for (e = tevent_backends; e != NULL; e = e->next) {
if (0 == strcmp(e->name, name)) {
/* already registered, skip it */
return true;
}
}
- e = talloc(talloc_autofree_context(), struct event_ops_list);
+ e = talloc(talloc_autofree_context(), struct tevent_ops_list);
if (e == NULL) return false;
e->name = name;
e->ops = ops;
- DLIST_ADD(event_backends, e);
+ DLIST_ADD(tevent_backends, e);
return true;
}
@@ -94,38 +94,39 @@ bool event_register_backend(const char *name, const struct event_ops *ops)
/*
set the default event backend
*/
-void event_set_default_backend(const char *backend)
+void tevent_set_default_backend(const char *backend)
{
- if (event_default_backend) free(event_default_backend);
- event_default_backend = strdup(backend);
+ talloc_free(tevent_default_backend);
+ tevent_default_backend = talloc_strdup(talloc_autofree_context(),
+ backend);
}
/*
initialise backends if not already done
*/
-static void event_backend_init(void)
+static void tevent_backend_init(void)
{
- events_select_init();
- events_standard_init();
-#if HAVE_EVENTS_EPOLL
- events_epoll_init();
+ tevent_select_init();
+ tevent_standard_init();
+#ifdef HAVE_EPOLL
+ tevent_epoll_init();
#endif
-#if HAVE_LINUX_AIO
- events_aio_init();
+#ifdef HAVE_LINUX_AIO
+ tevent_aio_init();
#endif
}
/*
list available backends
*/
-const char **event_backend_list(TALLOC_CTX *mem_ctx)
+const char **tevent_backend_list(TALLOC_CTX *mem_ctx)
{
const char **list = NULL;
- struct event_ops_list *e;
+ struct tevent_ops_list *e;
- event_backend_init();
+ tevent_backend_init();
- for (e=event_backends;e;e=e->next) {
+ for (e=tevent_backends;e;e=e->next) {
list = ev_str_list_add(list, e->name);
}
@@ -143,10 +144,10 @@ const char **event_backend_list(TALLOC_CTX *mem_ctx)
This function is for allowing third-party-applications to hook in gluecode
to their own event loop code, so that they can make async usage of our client libs
- NOTE: use event_context_init() inside of samba!
+ NOTE: use tevent_context_init() inside of samba!
*/
-static struct tevent_context *event_context_init_ops(TALLOC_CTX *mem_ctx,
- const struct event_ops *ops)
+static struct tevent_context *tevent_context_init_ops(TALLOC_CTX *mem_ctx,
+ const struct tevent_ops *ops)
{
struct tevent_context *ev;
int ret;
@@ -170,22 +171,23 @@ static struct tevent_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 tevent_context *event_context_init_byname(TALLOC_CTX *mem_ctx, const char *name)
+struct tevent_context *tevent_context_init_byname(TALLOC_CTX *mem_ctx,
+ const char *name)
{
- struct event_ops_list *e;
+ struct tevent_ops_list *e;
- event_backend_init();
+ tevent_backend_init();
if (name == NULL) {
- name = event_default_backend;
+ name = tevent_default_backend;
}
if (name == NULL) {
name = "standard";
}
- for (e=event_backends;e;e=e->next) {
+ for (e=tevent_backends;e;e=e->next) {
if (strcmp(name, e->name) == 0) {
- return event_context_init_ops(mem_ctx, e->ops);
+ return tevent_context_init_ops(mem_ctx, e->ops);
}
}
return NULL;
@@ -197,42 +199,51 @@ struct tevent_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 tevent_context *event_context_init(TALLOC_CTX *mem_ctx)
+struct tevent_context *tevent_context_init(TALLOC_CTX *mem_ctx)
{
- return event_context_init_byname(mem_ctx, NULL);
+ return tevent_context_init_byname(mem_ctx, NULL);
}
/*
add a fd based event
return NULL on failure (memory allocation error)
- if flags contains EVENT_FD_AUTOCLOSE then the fd will be closed when
+ if flags contains TEVENT_FD_AUTOCLOSE then the fd will be closed when
the returned fd_event context is freed
*/
-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)
+struct tevent_fd *_tevent_add_fd(struct tevent_context *ev,
+ TALLOC_CTX *mem_ctx,
+ int fd,
+ uint16_t flags,
+ tevent_fd_handler_t handler,
+ void *private_data,
+ const char *handler_name,
+ const char *location)
{
- return ev->ops->add_fd(ev, mem_ctx, fd, flags, handler, private_data);
+ return ev->ops->add_fd(ev, mem_ctx, fd, flags, handler, private_data,
+ handler_name, location);
}
/*
add a disk aio event
*/
-struct aio_event *event_add_aio(struct tevent_context *ev,
- TALLOC_CTX *mem_ctx,
- struct iocb *iocb,
- event_aio_handler_t handler,
- void *private_data)
+struct tevent_aio *_tevent_add_aio(struct tevent_context *ev,
+ TALLOC_CTX *mem_ctx,
+ struct iocb *iocb,
+ tevent_aio_handler_t handler,
+ void *private_data,
+ const char *handler_name,
+ const char *location)
{
if (ev->ops->add_aio == NULL) return NULL;
- return ev->ops->add_aio(ev, mem_ctx, iocb, handler, private_data);
+ return ev->ops->add_aio(ev, mem_ctx, iocb, handler, private_data,
+ handler_name, location);
}
/*
return the fd event flags
*/
-uint16_t event_get_fd_flags(struct tevent_fd *fde)
+uint16_t tevent_fd_get_flags(struct tevent_fd *fde)
{
if (!fde) return 0;
return fde->event_ctx->ops->get_fd_flags(fde);
@@ -241,22 +252,26 @@ uint16_t event_get_fd_flags(struct tevent_fd *fde)
/*
set the fd event flags
*/
-void event_set_fd_flags(struct tevent_fd *fde, uint16_t flags)
+void tevent_fd_set_flags(struct tevent_fd *fde, uint16_t flags)
{
if (!fde) return;
fde->event_ctx->ops->set_fd_flags(fde, flags);
}
/*
- add a timed event
+ add a timer event
return NULL on failure
*/
-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)
+struct tevent_timer *_tevent_add_timer(struct tevent_context *ev,
+ TALLOC_CTX *mem_ctx,
+ struct timeval next_event,
+ tevent_timer_handler_t handler,
+ void *private_data,
+ const char *handler_name,
+ const char *location)
{
- return ev->ops->add_timer(ev, mem_ctx, next_event, handler, private_data);
+ return ev->ops->add_timer(ev, mem_ctx, next_event, handler, private_data,
+ handler_name, location);
}
/*
@@ -266,19 +281,23 @@ struct tevent_timer *event_add_timed(struct tevent_context *ev, TALLOC_CTX *mem_
return NULL on failure
*/
-struct signal_event *event_add_signal(struct tevent_context *ev, TALLOC_CTX *mem_ctx,
- int signum,
- int sa_flags,
- event_signal_handler_t handler,
- void *private_data)
+struct tevent_signal *_tevent_add_signal(struct tevent_context *ev,
+ TALLOC_CTX *mem_ctx,
+ int signum,
+ int sa_flags,
+ tevent_signal_handler_t handler,
+ void *private_data,
+ const char *handler_name,
+ const char *location)
{
- return ev->ops->add_signal(ev, mem_ctx, signum, sa_flags, handler, private_data);
+ return ev->ops->add_signal(ev, mem_ctx, signum, sa_flags, handler, private_data,
+ handler_name, location);
}
/*
do a single event loop using the events defined in ev
*/
-int event_loop_once(struct tevent_context *ev)
+int tevent_loop_once(struct tevent_context *ev)
{
return ev->ops->loop_once(ev);
}
@@ -286,25 +305,7 @@ int event_loop_once(struct tevent_context *ev)
/*
return on failure or (with 0) if all fd events are removed
*/
-int event_loop_wait(struct tevent_context *ev)
+int tevent_loop_wait(struct tevent_context *ev)
{
return ev->ops->loop_wait(ev);
}
-
-/*
- find an event context that is a parent of the given memory context,
- or create a new event context as a child of the given context if
- none is found
-
- This should be used in preference to event_context_init() in places
- where you would prefer to use the existing event context if possible
- (which is most situations)
-*/
-struct tevent_context *event_context_find(TALLOC_CTX *mem_ctx)
-{
- struct tevent_context *ev = talloc_find_parent_bytype(mem_ctx, struct tevent_context);
- if (ev == NULL) {
- ev = event_context_init(mem_ctx);
- }
- return ev;
-}
diff --git a/lib/tevent/tevent.h b/lib/tevent/tevent.h
index f626de9d12..01e79df208 100644
--- a/lib/tevent/tevent.h
+++ b/lib/tevent/tevent.h
@@ -51,30 +51,52 @@ struct tevent_context *tevent_context_init_byname(TALLOC_CTX *mem_ctx, const cha
const char **tevent_backend_list(TALLOC_CTX *mem_ctx);
void tevent_set_default_backend(const char *backend);
-struct tevent_fd *tevent_add_fd(struct tevent_context *ev,
- TALLOC_CTX *mem_ctx,
- int fd, uint16_t flags,
- tevent_fd_handler_t handler,
- void *private_data);
-
-struct tevent_timer *tevent_add_timer(struct tevent_context *ev,
- TALLOC_CTX *mem_ctx,
- struct timeval next_event,
- tevent_timer_handler_t handler,
- void *private_data);
-
-struct tevent_signal *tevent_add_signal(struct tevent_context *ev,
- TALLOC_CTX *mem_ctx,
- int signum, int sa_flags,
- tevent_signal_handler_t handler,
- void *private_data);
+struct tevent_fd *_tevent_add_fd(struct tevent_context *ev,
+ TALLOC_CTX *mem_ctx,
+ int fd,
+ uint16_t flags,
+ tevent_fd_handler_t handler,
+ void *private_data,
+ const char *handler_name,
+ const char *location);
+#define tevent_add_fd(ev, mem_ctx, fd, flags, handler, private_data) \
+ _tevent_add_fd(ev, mem_ctx, fd, flags, handler, private_data, \
+ #handler, __location__)
+
+struct tevent_timer *_tevent_add_timer(struct tevent_context *ev,
+ TALLOC_CTX *mem_ctx,
+ struct timeval next_event,
+ tevent_timer_handler_t handler,
+ void *private_data,
+ const char *handler_name,
+ const char *location);
+#define tevent_add_timer(ev, mem_ctx, next_event, handler, private_data) \
+ _tevent_add_timer(ev, mem_ctx, next_event, handler, private_data, \
+ #handler, __location__);
+
+struct tevent_signal *_tevent_add_signal(struct tevent_context *ev,
+ TALLOC_CTX *mem_ctx,
+ int signum,
+ int sa_flags,
+ tevent_signal_handler_t handler,
+ void *private_data,
+ const char *handler_name,
+ const char *location);
+#define tevent_add_signal(ev, mem_ctx, signum, sa_flags, handler, private_data) \
+ _tevent_add_signal(ev, mem_ctx, signum, sa_flags, handler, private_data, \
+ #handler, __location__)
struct iocb;
-struct tevent_aio *tevent_add_aio(struct tevent_context *ev,
- TALLOC_CTX *mem_ctx,
- struct iocb *iocb,
- tevent_aio_handler_t handler,
- void *private_data);
+struct tevent_aio *_tevent_add_aio(struct tevent_context *ev,
+ TALLOC_CTX *mem_ctx,
+ struct iocb *iocb,
+ tevent_aio_handler_t handler,
+ void *private_data,
+ const char *handler_name,
+ const char *location);
+#define tevent_add_aio(ev, mem_ctx, iocb, handler, private_data) \
+ _tevent_add_aio(ev, mem_ctx, iocb, handler, private_data, \
+ #handler, __location__);
int tevent_loop_once(struct tevent_context *ev);
int tevent_loop_wait(struct tevent_context *ev);
@@ -97,10 +119,21 @@ void tevent_fd_set_flags(struct tevent_fd *fde, uint16_t flags);
#define TEVENT_FD_NOT_READABLE(fde) \
tevent_fd_set_flags(fde, tevent_fd_get_flags(fde) & ~TEVENT_FD_READ)
-/* for now always define the compat symbols */
-#ifndef TEVENT_COMPAT_DEFINES
-#define TEVENT_COMPAT_DEFINES 1
-#endif
+/* DEBUG */
+enum tevent_debug_level {
+ TEVENT_DEBUG_FATAL,
+ TEVENT_DEBUG_ERROR,
+ TEVENT_DEBUG_WARNING,
+ TEVENT_DEBUG_TRACE
+};
+
+int tevent_set_debug(struct tevent_context *ev,
+ void (*debug)(void *context,
+ enum tevent_debug_level level,
+ const char *fmt,
+ va_list ap) PRINTF_ATTRIBUTE(3,0),
+ void *context);
+int tevent_set_debug_stderr(struct tevent_context *ev);
#ifdef TEVENT_COMPAT_DEFINES
@@ -168,6 +201,18 @@ void tevent_fd_set_flags(struct tevent_fd *fde, uint16_t flags);
#define EVENT_FD_NOT_READABLE(fde) \
TEVENT_FD_NOT_READABLE(fde)
+#define ev_debug_level tevent_debug_level
+
+#define EV_DEBUG_FATAL TEVENT_DEBUG_FATAL
+#define EV_DEBUG_ERROR TEVENT_DEBUG_ERROR
+#define EV_DEBUG_WARNING TEVENT_DEBUG_WARNING
+#define EV_DEBUG_TRACE TEVENT_DEBUG_TRACE
+
+#define ev_set_debug(ev, debug, context) \
+ tevent_set_debug(ev, debug, context)
+
+#define ev_set_debug_stderr(_ev) tevent_set_debug_stderr(ev)
+
#endif /* TEVENT_COMPAT_DEFINES */
#endif /* __TEVENT_H__ */
diff --git a/lib/tevent/tevent.pc.in b/lib/tevent/tevent.pc.in
index afd9fcc279..93d0cf5d8b 100644
--- a/lib/tevent/tevent.pc.in
+++ b/lib/tevent/tevent.pc.in
@@ -3,7 +3,7 @@ exec_prefix=@exec_prefix@
libdir=@libdir@
includedir=@includedir@
-Name: events
+Name: tevent
Description: An event system library
Version: @PACKAGE_VERSION@
Libs: -L${libdir} -ltevent
diff --git a/lib/tevent/tevent_aio.c b/lib/tevent/tevent_aio.c
index 746e96060b..ba798cc799 100644
--- a/lib/tevent/tevent_aio.c
+++ b/lib/tevent/tevent_aio.c
@@ -30,12 +30,13 @@
this is _very_ experimental code
*/
-#include "system/filesys.h"
#include "replace.h"
+#include "system/filesys.h"
+#include "system/network.h"
+#include "system/select.h"
#include "tevent.h"
#include "tevent_internal.h"
#include "tevent_util.h"
-#include <sys/epoll.h>
#include <libaio.h>
#define MAX_AIO_QUEUE_DEPTH 100
@@ -66,11 +67,11 @@ struct aio_event_context {
pid_t pid;
};
-struct aio_event {
+struct tevent_aio {
struct tevent_context *event_ctx;
struct iocb iocb;
void *private_data;
- event_aio_handler_t handler;
+ tevent_aio_handler_t handler;
};
/*
@@ -79,8 +80,8 @@ struct aio_event {
static uint32_t epoll_map_flags(uint16_t flags)
{
uint32_t ret = 0;
- if (flags & EVENT_FD_READ) ret |= (EPOLLIN | EPOLLERR | EPOLLHUP);
- if (flags & EVENT_FD_WRITE) ret |= (EPOLLOUT | EPOLLERR | EPOLLHUP);
+ if (flags & TEVENT_FD_READ) ret |= (EPOLLIN | EPOLLERR | EPOLLHUP);
+ if (flags & TEVENT_FD_WRITE) ret |= (EPOLLOUT | EPOLLERR | EPOLLHUP);
return ret;
}
@@ -113,7 +114,8 @@ static void epoll_check_reopen(struct aio_event_context *aio_ev)
close(aio_ev->epoll_fd);
aio_ev->epoll_fd = epoll_create(MAX_AIO_QUEUE_DEPTH);
if (aio_ev->epoll_fd == -1) {
- ev_debug(aio_ev->ev, EV_DEBUG_FATAL, "Failed to recreate epoll handle after fork\n");
+ tevent_debug(aio_ev->ev, TEVENT_DEBUG_FATAL,
+ "Failed to recreate epoll handle after fork\n");
return;
}
aio_ev->pid = getpid();
@@ -146,7 +148,7 @@ static void epoll_add_event(struct aio_event_context *aio_ev, struct tevent_fd *
fde->additional_flags |= EPOLL_ADDITIONAL_FD_FLAG_HAS_EVENT;
/* only if we want to read we want to tell the event handler about errors */
- if (fde->flags & EVENT_FD_READ) {
+ if (fde->flags & TEVENT_FD_READ) {
fde->additional_flags |= EPOLL_ADDITIONAL_FD_FLAG_REPORT_ERROR;
}
}
@@ -191,7 +193,7 @@ static void epoll_mod_event(struct aio_event_context *aio_ev, struct tevent_fd *
epoll_ctl(aio_ev->epoll_fd, EPOLL_CTL_MOD, fde->fd, &event);
/* only if we want to read we want to tell the event handler about errors */
- if (fde->flags & EVENT_FD_READ) {
+ if (fde->flags & TEVENT_FD_READ) {
fde->additional_flags |= EPOLL_ADDITIONAL_FD_FLAG_REPORT_ERROR;
}
}
@@ -199,8 +201,8 @@ static void epoll_mod_event(struct aio_event_context *aio_ev, struct tevent_fd *
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);
- bool want_write= (fde->flags & EVENT_FD_WRITE);
+ bool want_read = (fde->flags & TEVENT_FD_READ);
+ bool want_write= (fde->flags & TEVENT_FD_WRITE);
if (aio_ev->epoll_fd == -1) return;
@@ -260,7 +262,7 @@ static int aio_event_loop(struct aio_event_context *aio_ev, struct timeval *tval
if (aio_ev->epoll_fd == -1) return -1;
if (aio_ev->ev->num_signal_handlers &&
- common_event_check_signal(aio_ev->ev)) {
+ tevent_common_check_signal(aio_ev->ev)) {
return 0;
}
@@ -278,14 +280,14 @@ static int aio_event_loop(struct aio_event_context *aio_ev, struct timeval *tval
if (ret == -EINTR) {
if (aio_ev->ev->num_signal_handlers) {
- common_event_check_signal(aio_ev->ev);
+ tevent_common_check_signal(aio_ev->ev);
}
return 0;
}
if (ret == 0 && tvalp) {
/* we don't care about a possible delay here */
- common_event_loop_timer_delay(aio_ev->ev);
+ tevent_common_loop_timer_delay(aio_ev->ev);
return 0;
}
@@ -296,8 +298,8 @@ static int aio_event_loop(struct aio_event_context *aio_ev, struct timeval *tval
switch (finished->aio_lio_opcode) {
case IO_CMD_PWRITE:
case IO_CMD_PREAD: {
- struct aio_event *ae = talloc_get_type(finished->data,
- struct aio_event);
+ struct tevent_aio *ae = talloc_get_type(finished->data,
+ struct tevent_aio);
if (ae) {
talloc_set_destructor(ae, NULL);
ae->handler(ae->event_ctx, ae,
@@ -326,10 +328,10 @@ static int aio_event_loop(struct aio_event_context *aio_ev, struct timeval *tval
epoll_del_event(aio_ev, fde);
continue;
}
- flags |= EVENT_FD_READ;
+ flags |= TEVENT_FD_READ;
}
- if (ep->events & EPOLLIN) flags |= EVENT_FD_READ;
- if (ep->events & EPOLLOUT) flags |= EVENT_FD_WRITE;
+ if (ep->events & EPOLLIN) flags |= TEVENT_FD_READ;
+ if (ep->events & EPOLLOUT) flags |= TEVENT_FD_WRITE;
if (flags) {
fde->handler(aio_ev->ev, fde, flags, fde->private_data);
}
@@ -398,7 +400,7 @@ static int aio_event_fd_destructor(struct tevent_fd *fde)
epoll_del_event(aio_ev, fde);
- if (fde->flags & EVENT_FD_AUTOCLOSE) {
+ if (fde->flags & TEVENT_FD_AUTOCLOSE) {
close(fde->fd);
fde->fd = -1;
}
@@ -411,9 +413,11 @@ static int aio_event_fd_destructor(struct tevent_fd *fde)
return NULL on failure (memory allocation error)
*/
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)
+ int fd, uint16_t flags,
+ tevent_fd_handler_t handler,
+ void *private_data,
+ const char *handler_name,
+ const char *location)
{
struct aio_event_context *aio_ev = talloc_get_type(ev->additional_data,
struct aio_event_context);
@@ -429,6 +433,8 @@ static struct tevent_fd *aio_event_add_fd(struct tevent_context *ev, TALLOC_CTX
fde->flags = flags;
fde->handler = handler;
fde->private_data = private_data;
+ fde->handler_name = handler_name;
+ fde->location = location;
fde->additional_flags = 0;
fde->additional_data = NULL;
@@ -479,7 +485,7 @@ static int aio_event_loop_once(struct tevent_context *ev)
struct aio_event_context);
struct timeval tval;
- tval = common_event_loop_timer_delay(ev);
+ tval = tevent_common_loop_timer_delay(ev);
if (ev_timeval_is_zero(&tval)) {
return 0;
}
@@ -508,7 +514,7 @@ static int aio_event_loop_wait(struct tevent_context *ev)
/*
called when a disk IO event needs to be cancelled
*/
-static int aio_destructor(struct aio_event *ae)
+static int aio_destructor(struct tevent_aio *ae)
{
struct tevent_context *ev = ae->event_ctx;
struct aio_event_context *aio_ev = talloc_get_type(ev->additional_data,
@@ -520,16 +526,18 @@ static int aio_destructor(struct aio_event *ae)
}
/* submit an aio disk IO event */
-static struct aio_event *aio_event_add_aio(struct tevent_context *ev,
- TALLOC_CTX *mem_ctx,
- struct iocb *iocb,
- event_aio_handler_t handler,
- void *private_data)
+static struct tevent_aio *aio_event_add_aio(struct tevent_context *ev,
+ TALLOC_CTX *mem_ctx,
+ struct iocb *iocb,
+ tevent_aio_handler_t handler,
+ void *private_data,
+ const char *handler_name,
+ const char *location)
{
struct aio_event_context *aio_ev = talloc_get_type(ev->additional_data,
struct aio_event_context);
struct iocb *iocbp;
- struct aio_event *ae = talloc(mem_ctx?mem_ctx:ev, struct aio_event);
+ struct tevent_aio *ae = talloc(mem_ctx?mem_ctx:ev, struct tevent_aio);
if (ae == NULL) return NULL;
ae->event_ctx = ev;
@@ -548,20 +556,20 @@ static struct aio_event *aio_event_add_aio(struct tevent_context *ev,
return ae;
}
-static const struct event_ops aio_event_ops = {
+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,
.set_fd_flags = aio_event_set_fd_flags,
- .add_timer = common_event_add_timed,
- .add_signal = common_event_add_signal,
+ .add_timer = tevent_common_add_timer,
+ .add_signal = tevent_common_add_signal,
.loop_once = aio_event_loop_once,
.loop_wait = aio_event_loop_wait,
};
-bool events_aio_init(void)
+bool tevent_aio_init(void)
{
- return event_register_backend("aio", &aio_event_ops);
+ return tevent_register_backend("aio", &aio_event_ops);
}
diff --git a/lib/tevent/tevent_debug.c b/lib/tevent/tevent_debug.c
index 4fa58534b4..841446bf6c 100644
--- a/lib/tevent/tevent_debug.c
+++ b/lib/tevent/tevent_debug.c
@@ -30,10 +30,12 @@
/*
this allows the user to choose their own debug function
*/
-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)
+int tevent_set_debug(struct tevent_context *ev,
+ void (*debug)(void *context,
+ enum tevent_debug_level level,
+ const char *fmt,
+ va_list ap) PRINTF_ATTRIBUTE(3,0),
+ void *context)
{
ev->debug_ops.debug = debug;
ev->debug_ops.context = context;
@@ -43,23 +45,26 @@ int ev_set_debug(struct tevent_context *ev,
/*
debug function for ev_set_debug_stderr
*/
-void ev_debug_stderr(void *context, enum ev_debug_level level,
- const char *fmt, va_list ap) PRINTF_ATTRIBUTE(3,0);
-void ev_debug_stderr(void *context, enum ev_debug_level level,
- const char *fmt, va_list ap)
+static void tevent_debug_stderr(void *private_data,
+ enum tevent_debug_level level,
+ const char *fmt,
+ va_list ap) PRINTF_ATTRIBUTE(3,0);
+static void tevent_debug_stderr(void *private_data,
+ enum tevent_debug_level level,
+ const char *fmt, va_list ap)
{
- if (level <= EV_DEBUG_WARNING) {
+ if (level <= TEVENT_DEBUG_WARNING) {
vfprintf(stderr, fmt, ap);
}
}
/*
convenience function to setup debug messages on stderr
- messages of level EV_DEBUG_WARNING and higher are printed
+ messages of level TEVENT_DEBUG_WARNING and higher are printed
*/
-int ev_set_debug_stderr(struct tevent_context *ev)
+int tevent_set_debug_stderr(struct tevent_context *ev)
{
- return ev_set_debug(ev, ev_debug_stderr, ev);
+ return tevent_set_debug(ev, tevent_debug_stderr, ev);
}
/*
@@ -70,7 +75,8 @@ int ev_set_debug_stderr(struct tevent_context *ev)
* Applications using the library must decide where to
* redirect debugging messages
*/
-void ev_debug(struct tevent_context *ev, enum ev_debug_level level, const char *fmt, ...)
+void tevent_debug(struct tevent_context *ev, enum tevent_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 1ce666462c..380d9461c9 100644
--- a/lib/tevent/tevent_epoll.c
+++ b/lib/tevent/tevent_epoll.c
@@ -23,10 +23,10 @@
#include "replace.h"
#include "system/filesys.h"
#include "system/network.h"
+#include "system/select.h"
#include "tevent.h"
#include "tevent_internal.h"
#include "tevent_util.h"
-#include <sys/epoll.h>
struct epoll_event_context {
/* a pointer back to the generic event_context */
@@ -58,19 +58,19 @@ struct epoll_event_context {
*/
static void epoll_panic(struct epoll_event_context *epoll_ev, const char *reason)
{
- ev_debug(epoll_ev->ev, EV_DEBUG_FATAL,
+ tevent_debug(epoll_ev->ev, TEVENT_DEBUG_FATAL,
"%s (%s) - calling abort()\n", reason, strerror(errno));
abort();
}
/*
- map from EVENT_FD_* to EPOLLIN/EPOLLOUT
+ map from TEVENT_FD_* to EPOLLIN/EPOLLOUT
*/
static uint32_t epoll_map_flags(uint16_t flags)
{
uint32_t ret = 0;
- if (flags & EVENT_FD_READ) ret |= (EPOLLIN | EPOLLERR | EPOLLHUP);
- if (flags & EVENT_FD_WRITE) ret |= (EPOLLOUT | EPOLLERR | EPOLLHUP);
+ if (flags & TEVENT_FD_READ) ret |= (EPOLLIN | EPOLLERR | EPOLLHUP);
+ if (flags & TEVENT_FD_WRITE) ret |= (EPOLLOUT | EPOLLERR | EPOLLHUP);
return ret;
}
@@ -116,8 +116,8 @@ static void epoll_check_reopen(struct epoll_event_context *epoll_ev)
close(epoll_ev->epoll_fd);
epoll_ev->epoll_fd = epoll_create(64);
if (epoll_ev->epoll_fd == -1) {
- ev_debug(epoll_ev->ev, EV_DEBUG_FATAL,
- "Failed to recreate epoll handle after fork\n");
+ tevent_debug(epoll_ev->ev, TEVENT_DEBUG_FATAL,
+ "Failed to recreate epoll handle after fork\n");
return;
}
epoll_ev->pid = getpid();
@@ -153,7 +153,7 @@ static void epoll_add_event(struct epoll_event_context *epoll_ev, struct tevent_
fde->additional_flags |= EPOLL_ADDITIONAL_FD_FLAG_HAS_EVENT;
/* only if we want to read we want to tell the event handler about errors */
- if (fde->flags & EVENT_FD_READ) {
+ if (fde->flags & TEVENT_FD_READ) {
fde->additional_flags |= EPOLL_ADDITIONAL_FD_FLAG_REPORT_ERROR;
}
}
@@ -176,9 +176,9 @@ static void epoll_del_event(struct epoll_event_context *epoll_ev, struct tevent_
event.events = epoll_map_flags(fde->flags);
event.data.ptr = fde;
if (epoll_ctl(epoll_ev->epoll_fd, EPOLL_CTL_DEL, fde->fd, &event) != 0) {
- ev_debug(epoll_ev->ev, EV_DEBUG_FATAL,
- "epoll_del_event failed! probable early close bug (%s)\n",
- strerror(errno));
+ tevent_debug(epoll_ev->ev, TEVENT_DEBUG_FATAL,
+ "epoll_del_event failed! probable early close bug (%s)\n",
+ strerror(errno));
}
fde->additional_flags &= ~EPOLL_ADDITIONAL_FD_FLAG_HAS_EVENT;
}
@@ -201,7 +201,7 @@ static void epoll_mod_event(struct epoll_event_context *epoll_ev, struct tevent_
}
/* only if we want to read we want to tell the event handler about errors */
- if (fde->flags & EVENT_FD_READ) {
+ if (fde->flags & TEVENT_FD_READ) {
fde->additional_flags |= EPOLL_ADDITIONAL_FD_FLAG_REPORT_ERROR;
}
}
@@ -209,8 +209,8 @@ static void epoll_mod_event(struct epoll_event_context *epoll_ev, struct tevent_
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);
- bool want_write= (fde->flags & EVENT_FD_WRITE);
+ bool want_read = (fde->flags & TEVENT_FD_READ);
+ bool want_write= (fde->flags & TEVENT_FD_WRITE);
if (epoll_ev->epoll_fd == -1) return;
@@ -258,14 +258,14 @@ static int epoll_event_loop(struct epoll_event_context *epoll_ev, struct timeval
}
if (epoll_ev->ev->num_signal_handlers &&
- common_event_check_signal(epoll_ev->ev)) {
+ tevent_common_check_signal(epoll_ev->ev)) {
return 0;
}
ret = epoll_wait(epoll_ev->epoll_fd, events, MAXEVENTS, timeout);
if (ret == -1 && errno == EINTR && epoll_ev->ev->num_signal_handlers) {
- if (common_event_check_signal(epoll_ev->ev)) {
+ if (tevent_common_check_signal(epoll_ev->ev)) {
return 0;
}
}
@@ -277,7 +277,7 @@ static int epoll_event_loop(struct epoll_event_context *epoll_ev, struct timeval
if (ret == 0 && tvalp) {
/* we don't care about a possible delay here */
- common_event_loop_timer_delay(epoll_ev->ev);
+ tevent_common_loop_timer_delay(epoll_ev->ev);
return 0;
}
@@ -293,7 +293,7 @@ static int epoll_event_loop(struct epoll_event_context *epoll_ev, struct timeval
if (events[i].events & (EPOLLHUP|EPOLLERR)) {
fde->additional_flags |= EPOLL_ADDITIONAL_FD_FLAG_GOT_ERROR;
/*
- * if we only wait for EVENT_FD_WRITE, we should not tell the
+ * if we only wait for TEVENT_FD_WRITE, we should not tell the
* event handler about it, and remove the epoll_event,
* as we only report errors when waiting for read events,
* to match the select() behavior
@@ -302,10 +302,10 @@ static int epoll_event_loop(struct epoll_event_context *epoll_ev, struct timeval
epoll_del_event(epoll_ev, fde);
continue;
}
- flags |= EVENT_FD_READ;
+ flags |= TEVENT_FD_READ;
}
- if (events[i].events & EPOLLIN) flags |= EVENT_FD_READ;
- if (events[i].events & EPOLLOUT) flags |= EVENT_FD_WRITE;
+ if (events[i].events & EPOLLIN) flags |= TEVENT_FD_READ;
+ if (events[i].events & EPOLLOUT) flags |= TEVENT_FD_WRITE;
if (flags) {
fde->handler(epoll_ev->ev, fde, flags, fde->private_data);
if (destruction_count != epoll_ev->destruction_count) {
@@ -358,7 +358,7 @@ static int epoll_event_fd_destructor(struct tevent_fd *fde)
epoll_del_event(epoll_ev, fde);
- if (fde->flags & EVENT_FD_AUTOCLOSE) {
+ if (fde->flags & TEVENT_FD_AUTOCLOSE) {
close(fde->fd);
fde->fd = -1;
}
@@ -371,9 +371,11 @@ static int epoll_event_fd_destructor(struct tevent_fd *fde)
return NULL on failure (memory allocation error)
*/
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)
+ int fd, uint16_t flags,
+ tevent_fd_handler_t handler,
+ void *private_data,
+ const char *handler_name,
+ const char *location)
{
struct epoll_event_context *epoll_ev = talloc_get_type(ev->additional_data,
struct epoll_event_context);
@@ -389,6 +391,8 @@ static struct tevent_fd *epoll_event_add_fd(struct tevent_context *ev, TALLOC_CT
fde->flags = flags;
fde->handler = handler;
fde->private_data = private_data;
+ fde->handler_name = handler_name;
+ fde->location = location;
fde->additional_flags = 0;
fde->additional_data = NULL;
@@ -439,7 +443,7 @@ static int epoll_event_loop_once(struct tevent_context *ev)
struct epoll_event_context);
struct timeval tval;
- tval = common_event_loop_timer_delay(ev);
+ tval = tevent_common_loop_timer_delay(ev);
if (ev_timeval_is_zero(&tval)) {
return 0;
}
@@ -465,18 +469,18 @@ static int epoll_event_loop_wait(struct tevent_context *ev)
return 0;
}
-static const struct event_ops epoll_event_ops = {
+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,
.set_fd_flags = epoll_event_set_fd_flags,
- .add_timer = common_event_add_timed,
- .add_signal = common_event_add_signal,
+ .add_timer = tevent_common_add_timer,
+ .add_signal = tevent_common_add_signal,
.loop_once = epoll_event_loop_once,
.loop_wait = epoll_event_loop_wait,
};
-bool events_epoll_init(void)
+bool tevent_epoll_init(void)
{
- return event_register_backend("epoll", &epoll_event_ops);
+ return tevent_register_backend("epoll", &epoll_event_ops);
}
diff --git a/lib/tevent/tevent_internal.h b/lib/tevent/tevent_internal.h
index 2d6909da36..46ba1b1655 100644
--- a/lib/tevent/tevent_internal.h
+++ b/lib/tevent/tevent_internal.h
@@ -30,7 +30,9 @@ struct tevent_ops {
TALLOC_CTX *mem_ctx,
int fd, uint16_t flags,
tevent_fd_handler_t handler,
- void *private_data);
+ void *private_data,
+ const char *handler_name,
+ const char *location);
uint16_t (*get_fd_flags)(struct tevent_fd *fde);
void (*set_fd_flags)(struct tevent_fd *fde, uint16_t flags);
@@ -39,19 +41,25 @@ struct tevent_ops {
TALLOC_CTX *mem_ctx,
struct timeval next_event,
tevent_timer_handler_t handler,
- void *private_data);
+ void *private_data,
+ const char *handler_name,
+ const char *location);
/* disk aio event functions */
struct tevent_aio *(*add_aio)(struct tevent_context *ev,
TALLOC_CTX *mem_ctx,
struct iocb *iocb,
tevent_aio_handler_t handler,
- void *private_data);
+ void *private_data,
+ const char *handler_name,
+ const char *location);
/* signal functions */
struct tevent_signal *(*add_signal)(struct tevent_context *ev,
TALLOC_CTX *mem_ctx,
int signum, int sa_flags,
tevent_signal_handler_t handler,
- void *private_data);
+ void *private_data,
+ const char *handler_name,
+ const char *location);
/* loop functions */
int (*loop_once)(struct tevent_context *ev);
@@ -66,6 +74,9 @@ struct tevent_fd {
tevent_fd_handler_t handler;
/* this is private for the specific handler */
void *private_data;
+ /* this is for debugging only! */
+ const char *handler_name;
+ const char *location;
/* this is private for the events_ops implementation */
uint16_t additional_flags;
void *additional_data;
@@ -78,6 +89,9 @@ struct tevent_timer {
tevent_timer_handler_t handler;
/* this is private for the specific handler */
void *private_data;
+ /* this is for debugging only! */
+ const char *handler_name;
+ const char *location;
/* this is private for the events_ops implementation */
void *additional_data;
};
@@ -85,28 +99,26 @@ struct tevent_timer {
struct tevent_signal {
struct tevent_signal *prev, *next;
struct tevent_context *event_ctx;
- tevent_signal_handler_t handler;
- void *private_data;
int signum;
int sa_flags;
+ tevent_signal_handler_t handler;
+ /* this is private for the specific handler */
+ void *private_data;
+ /* this is for debugging only! */
+ const char *handler_name;
+ const char *location;
+ /* this is private for the events_ops implementation */
+ void *additional_data;
};
-/* DEBUG */
-enum ev_debug_level {EV_DEBUG_FATAL, EV_DEBUG_ERROR,
- EV_DEBUG_WARNING, EV_DEBUG_TRACE};
-
-struct ev_debug_ops {
- void (*debug)(void *context, enum ev_debug_level level,
+struct tevent_debug_ops {
+ void (*debug)(void *context, enum tevent_debug_level level,
const char *fmt, va_list ap) PRINTF_ATTRIBUTE(3,0);
void *context;
};
-int ev_set_debug(struct tevent_context *ev,
- void (*debug)(void *context, enum ev_debug_level level,
- 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 tevent_context *ev, enum ev_debug_level level, const char *fmt, ...);
+void tevent_debug(struct tevent_context *ev, enum tevent_debug_level level,
+ const char *fmt, ...) PRINTF_ATTRIBUTE(3,4);
/* aio event is private to the aio backend */
struct tevent_aio;
@@ -128,34 +140,37 @@ struct tevent_context {
struct tevent_fd *pipe_fde;
/* debugging operations */
- struct ev_debug_ops debug_ops;
+ struct tevent_debug_ops debug_ops;
};
-bool event_register_backend(const char *name, const struct tevent_ops *ops);
+bool tevent_register_backend(const char *name, const struct tevent_ops *ops);
bool ev_timeval_is_zero(const struct timeval *tv);
-struct tevent_timer *common_event_add_timed(struct tevent_context *,
- TALLOC_CTX *,
- struct timeval,
- tevent_timer_handler_t,
- void *);
-struct timeval common_event_loop_timer_delay(struct tevent_context *);
-
-struct tevent_signal *common_event_add_signal(struct tevent_context *ev,
- TALLOC_CTX *mem_ctx,
- int signum,
- int sa_flags,
- tevent_signal_handler_t handler,
- void *private_data);
-int common_event_check_signal(struct tevent_context *ev);
-
-
-bool events_standard_init(void);
-bool events_select_init(void);
-#if HAVE_EVENTS_EPOLL
-bool events_epoll_init(void);
+struct tevent_timer *tevent_common_add_timer(struct tevent_context *ev,
+ TALLOC_CTX *mem_ctx,
+ struct timeval next_event,
+ tevent_timer_handler_t handler,
+ void *private_data,
+ const char *handler_name,
+ const char *location);
+struct timeval tevent_common_loop_timer_delay(struct tevent_context *);
+
+struct tevent_signal *tevent_common_add_signal(struct tevent_context *ev,
+ TALLOC_CTX *mem_ctx,
+ int signum,
+ int sa_flags,
+ tevent_signal_handler_t handler,
+ void *private_data,
+ const char *handler_name,
+ const char *location);
+int tevent_common_check_signal(struct tevent_context *ev);
+
+bool tevent_standard_init(void);
+bool tevent_select_init(void);
+#ifdef HAVE_EPOLL
+bool tevent_epoll_init(void);
#endif
-#if HAVE_LINUX_AIO
-bool events_aio_init(void);
+#ifdef HAVE_LINUX_AIO
+bool tevent_aio_init(void);
#endif
diff --git a/lib/tevent/tevent_select.c b/lib/tevent/tevent_select.c
index 3e72ce4943..e21b3c44b9 100644
--- a/lib/tevent/tevent_select.c
+++ b/lib/tevent/tevent_select.c
@@ -103,7 +103,7 @@ static int select_event_fd_destructor(struct tevent_fd *fde)
DLIST_REMOVE(select_ev->fd_events, fde);
select_ev->destruction_count++;
- if (fde->flags & EVENT_FD_AUTOCLOSE) {
+ if (fde->flags & TEVENT_FD_AUTOCLOSE) {
close(fde->fd);
fde->fd = -1;
}
@@ -116,9 +116,11 @@ static int select_event_fd_destructor(struct tevent_fd *fde)
return NULL on failure (memory allocation error)
*/
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)
+ int fd, uint16_t flags,
+ tevent_fd_handler_t handler,
+ void *private_data,
+ const char *handler_name,
+ const char *location)
{
struct select_event_context *select_ev = talloc_get_type(ev->additional_data,
struct select_event_context);
@@ -132,6 +134,8 @@ static struct tevent_fd *select_event_add_fd(struct tevent_context *ev, TALLOC_C
fde->flags = flags;
fde->handler = handler;
fde->private_data = private_data;
+ fde->handler_name = handler_name;
+ fde->location = location;
fde->additional_flags = 0;
fde->additional_data = NULL;
@@ -189,16 +193,16 @@ static int select_event_loop_select(struct select_event_context *select_ev, stru
/* setup any fd events */
for (fde = select_ev->fd_events; fde; fde = fde->next) {
- if (fde->flags & EVENT_FD_READ) {
+ if (fde->flags & TEVENT_FD_READ) {
FD_SET(fde->fd, &r_fds);
}
- if (fde->flags & EVENT_FD_WRITE) {
+ if (fde->flags & TEVENT_FD_WRITE) {
FD_SET(fde->fd, &w_fds);
}
}
if (select_ev->ev->num_signal_handlers &&
- common_event_check_signal(select_ev->ev)) {
+ tevent_common_check_signal(select_ev->ev)) {
return 0;
}
@@ -206,7 +210,7 @@ static int select_event_loop_select(struct select_event_context *select_ev, stru
if (selrtn == -1 && errno == EINTR &&
select_ev->ev->num_signal_handlers) {
- common_event_check_signal(select_ev->ev);
+ tevent_common_check_signal(select_ev->ev);
return 0;
}
@@ -216,15 +220,15 @@ static int select_event_loop_select(struct select_event_context *select_ev, stru
made readable and that should have removed
the event, so this must be a bug. This is a
fatal error. */
- ev_debug(select_ev->ev, EV_DEBUG_FATAL,
- "ERROR: EBADF on select_event_loop_once\n");
+ tevent_debug(select_ev->ev, TEVENT_DEBUG_FATAL,
+ "ERROR: EBADF on select_event_loop_once\n");
select_ev->exit_code = EBADF;
return -1;
}
if (selrtn == 0 && tvalp) {
/* we don't care about a possible delay here */
- common_event_loop_timer_delay(select_ev->ev);
+ tevent_common_loop_timer_delay(select_ev->ev);
return 0;
}
@@ -235,8 +239,8 @@ static int select_event_loop_select(struct select_event_context *select_ev, stru
for (fde = select_ev->fd_events; fde; fde = fde->next) {
uint16_t flags = 0;
- if (FD_ISSET(fde->fd, &r_fds)) flags |= EVENT_FD_READ;
- if (FD_ISSET(fde->fd, &w_fds)) flags |= EVENT_FD_WRITE;
+ if (FD_ISSET(fde->fd, &r_fds)) flags |= TEVENT_FD_READ;
+ if (FD_ISSET(fde->fd, &w_fds)) flags |= TEVENT_FD_WRITE;
if (flags) {
fde->handler(select_ev->ev, fde, flags, fde->private_data);
if (destruction_count != select_ev->destruction_count) {
@@ -258,7 +262,7 @@ static int select_event_loop_once(struct tevent_context *ev)
struct select_event_context);
struct timeval tval;
- tval = common_event_loop_timer_delay(ev);
+ tval = tevent_common_loop_timer_delay(ev);
if (ev_timeval_is_zero(&tval)) {
return 0;
}
@@ -284,19 +288,18 @@ static int select_event_loop_wait(struct tevent_context *ev)
return select_ev->exit_code;
}
-static const struct event_ops select_event_ops = {
+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,
- .add_timer = common_event_add_timed,
- .add_signal = common_event_add_signal,
+ .add_timer = tevent_common_add_timer,
+ .add_signal = tevent_common_add_signal,
.loop_once = select_event_loop_once,
.loop_wait = select_event_loop_wait,
};
-bool events_select_init(void)
+bool tevent_select_init(void)
{
- return event_register_backend("select", &select_event_ops);
+ return tevent_register_backend("select", &select_event_ops);
}
-
diff --git a/lib/tevent/tevent_signal.c b/lib/tevent/tevent_signal.c
index bb50480dd7..031845927b 100644
--- a/lib/tevent/tevent_signal.c
+++ b/lib/tevent/tevent_signal.c
@@ -19,10 +19,9 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include <signal.h>
#include "replace.h"
#include "system/filesys.h"
-#include "system/select.h"
+#include "system/wait.h"
#include "tevent.h"
#include "tevent_internal.h"
#include "tevent_util.h"
@@ -46,7 +45,7 @@ struct sigcounter {
the poor design of signals means that this table must be static global
*/
static struct sig_state {
- struct signal_event *sig_handlers[NUM_SIGNALS+1];
+ struct tevent_signal *sig_handlers[NUM_SIGNALS+1];
struct sigaction *oldact[NUM_SIGNALS+1];
struct sigcounter signal_count[NUM_SIGNALS+1];
struct sigcounter got_signal;
@@ -108,7 +107,7 @@ static void signal_handler_info(int signum, siginfo_t *info, void *uctx)
/*
destroy a signal event
*/
-static int signal_event_destructor(struct signal_event *se)
+static int tevent_signal_destructor(struct tevent_signal *se)
{
se->event_ctx->num_signal_handlers--;
DLIST_REMOVE(sig_state->sig_handlers[se->signum], se);
@@ -141,14 +140,16 @@ static void signal_pipe_handler(struct tevent_context *ev, struct tevent_fd *fde
add a signal event
return NULL on failure (memory allocation error)
*/
-struct signal_event *common_event_add_signal(struct tevent_context *ev,
- TALLOC_CTX *mem_ctx,
- int signum,
- int sa_flags,
- event_signal_handler_t handler,
- void *private_data)
+struct tevent_signal *tevent_common_add_signal(struct tevent_context *ev,
+ TALLOC_CTX *mem_ctx,
+ int signum,
+ int sa_flags,
+ tevent_signal_handler_t handler,
+ void *private_data,
+ const char *handler_name,
+ const char *location)
{
- struct signal_event *se;
+ struct tevent_signal *se;
if (signum >= NUM_SIGNALS) {
return NULL;
@@ -163,15 +164,18 @@ struct signal_event *common_event_add_signal(struct tevent_context *ev,
}
}
- se = talloc(mem_ctx?mem_ctx:ev, struct signal_event);
+ se = talloc(mem_ctx?mem_ctx:ev, struct tevent_signal);
if (se == NULL) return NULL;
se->event_ctx = ev;
- se->handler = handler;
- se->private_data = private_data;
se->signum = signum;
se->sa_flags = sa_flags;
-
+ se->handler = handler;
+ se->private_data = private_data;
+ se->handler_name = handler_name;
+ se->location = location;
+ se->additional_data = NULL;
+
/* Ensure, no matter the destruction order, that we always have a handle on the global sig_state */
if (!talloc_reference(se, sig_state)) {
return NULL;
@@ -209,7 +213,7 @@ struct signal_event *common_event_add_signal(struct tevent_context *ev,
DLIST_ADD(sig_state->sig_handlers[signum], se);
- talloc_set_destructor(se, signal_event_destructor);
+ talloc_set_destructor(se, tevent_signal_destructor);
/* we need to setup the pipe hack handler if not already
setup */
@@ -220,8 +224,8 @@ struct signal_event *common_event_add_signal(struct tevent_context *ev,
ev_set_blocking(sig_state->pipe_hack[0], false);
ev_set_blocking(sig_state->pipe_hack[1], false);
}
- ev->pipe_fde = event_add_fd(ev, ev, sig_state->pipe_hack[0],
- EVENT_FD_READ, signal_pipe_handler, NULL);
+ ev->pipe_fde = tevent_add_fd(ev, ev, sig_state->pipe_hack[0],
+ TEVENT_FD_READ, signal_pipe_handler, NULL);
}
ev->num_signal_handlers++;
@@ -233,7 +237,7 @@ struct signal_event *common_event_add_signal(struct tevent_context *ev,
check if a signal is pending
return != 0 if a signal was pending
*/
-int common_event_check_signal(struct tevent_context *ev)
+int tevent_common_check_signal(struct tevent_context *ev)
{
int i;
@@ -242,7 +246,7 @@ int common_event_check_signal(struct tevent_context *ev)
}
for (i=0;i<NUM_SIGNALS+1;i++) {
- struct signal_event *se, *next;
+ struct tevent_signal *se, *next;
struct sigcounter counter = sig_state->signal_count[i];
uint32_t count = sig_count(counter);
diff --git a/lib/tevent/tevent_standard.c b/lib/tevent/tevent_standard.c
index 1c99408b8d..5769eac589 100644
--- a/lib/tevent/tevent_standard.c
+++ b/lib/tevent/tevent_standard.c
@@ -30,7 +30,7 @@
#include "replace.h"
#include "system/filesys.h"
#include "system/network.h"
-#include "system/select.h" /* needed for HAVE_EVENTS_EPOLL */
+#include "system/select.h"
#include "tevent.h"
#include "tevent_util.h"
#include "tevent_internal.h"
@@ -64,29 +64,29 @@ struct std_event_context {
};
/* use epoll if it is available */
-#if HAVE_EVENTS_EPOLL
+#if HAVE_EPOLL
/*
called when a epoll call fails, and we should fallback
to using select
*/
static void epoll_fallback_to_select(struct std_event_context *std_ev, const char *reason)
{
- ev_debug(std_ev->ev, EV_DEBUG_FATAL,
- "%s (%s) - falling back to select()\n",
- reason, strerror(errno));
+ tevent_debug(std_ev->ev, TEVENT_DEBUG_FATAL,
+ "%s (%s) - falling back to select()\n",
+ reason, strerror(errno));
close(std_ev->epoll_fd);
std_ev->epoll_fd = -1;
talloc_set_destructor(std_ev, NULL);
}
/*
- map from EVENT_FD_* to EPOLLIN/EPOLLOUT
+ map from TEVENT_FD_* to EPOLLIN/EPOLLOUT
*/
static uint32_t epoll_map_flags(uint16_t flags)
{
uint32_t ret = 0;
- if (flags & EVENT_FD_READ) ret |= (EPOLLIN | EPOLLERR | EPOLLHUP);
- if (flags & EVENT_FD_WRITE) ret |= (EPOLLOUT | EPOLLERR | EPOLLHUP);
+ if (flags & TEVENT_FD_READ) ret |= (EPOLLIN | EPOLLERR | EPOLLHUP);
+ if (flags & TEVENT_FD_WRITE) ret |= (EPOLLOUT | EPOLLERR | EPOLLHUP);
return ret;
}
@@ -130,8 +130,8 @@ static void epoll_check_reopen(struct std_event_context *std_ev)
close(std_ev->epoll_fd);
std_ev->epoll_fd = epoll_create(64);
if (std_ev->epoll_fd == -1) {
- ev_debug(std_ev->ev, EV_DEBUG_FATAL,
- "Failed to recreate epoll handle after fork\n");
+ tevent_debug(std_ev->ev, TEVENT_DEBUG_FATAL,
+ "Failed to recreate epoll handle after fork\n");
return;
}
std_ev->pid = getpid();
@@ -166,7 +166,7 @@ static void epoll_add_event(struct std_event_context *std_ev, struct tevent_fd *
fde->additional_flags |= EPOLL_ADDITIONAL_FD_FLAG_HAS_EVENT;
/* only if we want to read we want to tell the event handler about errors */
- if (fde->flags & EVENT_FD_READ) {
+ if (fde->flags & TEVENT_FD_READ) {
fde->additional_flags |= EPOLL_ADDITIONAL_FD_FLAG_REPORT_ERROR;
}
}
@@ -209,7 +209,7 @@ static void epoll_mod_event(struct std_event_context *std_ev, struct tevent_fd *
}
/* only if we want to read we want to tell the event handler about errors */
- if (fde->flags & EVENT_FD_READ) {
+ if (fde->flags & TEVENT_FD_READ) {
fde->additional_flags |= EPOLL_ADDITIONAL_FD_FLAG_REPORT_ERROR;
}
}
@@ -217,8 +217,8 @@ static void epoll_mod_event(struct std_event_context *std_ev, struct tevent_fd *
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);
- bool want_write= (fde->flags & EVENT_FD_WRITE);
+ bool want_read = (fde->flags & TEVENT_FD_READ);
+ bool want_write= (fde->flags & TEVENT_FD_WRITE);
if (std_ev->epoll_fd == -1) return;
@@ -266,14 +266,14 @@ static int epoll_event_loop(struct std_event_context *std_ev, struct timeval *tv
}
if (std_ev->ev->num_signal_handlers &&
- common_event_check_signal(std_ev->ev)) {
+ tevent_common_check_signal(std_ev->ev)) {
return 0;
}
ret = epoll_wait(std_ev->epoll_fd, events, MAXEVENTS, timeout);
if (ret == -1 && errno == EINTR && std_ev->ev->num_signal_handlers) {
- if (common_event_check_signal(std_ev->ev)) {
+ if (tevent_common_check_signal(std_ev->ev)) {
return 0;
}
}
@@ -285,7 +285,7 @@ static int epoll_event_loop(struct std_event_context *std_ev, struct timeval *tv
if (ret == 0 && tvalp) {
/* we don't care about a possible delay here */
- common_event_loop_timer_delay(std_ev->ev);
+ tevent_common_loop_timer_delay(std_ev->ev);
return 0;
}
@@ -301,7 +301,7 @@ static int epoll_event_loop(struct std_event_context *std_ev, struct timeval *tv
if (events[i].events & (EPOLLHUP|EPOLLERR)) {
fde->additional_flags |= EPOLL_ADDITIONAL_FD_FLAG_GOT_ERROR;
/*
- * if we only wait for EVENT_FD_WRITE, we should not tell the
+ * if we only wait for TEVENT_FD_WRITE, we should not tell the
* event handler about it, and remove the epoll_event,
* as we only report errors when waiting for read events,
* to match the select() behavior
@@ -310,10 +310,10 @@ static int epoll_event_loop(struct std_event_context *std_ev, struct timeval *tv
epoll_del_event(std_ev, fde);
continue;
}
- flags |= EVENT_FD_READ;
+ flags |= TEVENT_FD_READ;
}
- if (events[i].events & EPOLLIN) flags |= EVENT_FD_READ;
- if (events[i].events & EPOLLOUT) flags |= EVENT_FD_WRITE;
+ if (events[i].events & EPOLLIN) flags |= TEVENT_FD_READ;
+ if (events[i].events & EPOLLOUT) flags |= TEVENT_FD_WRITE;
if (flags) {
fde->handler(std_ev->ev, fde, flags, fde->private_data);
if (destruction_count != std_ev->destruction_count) {
@@ -392,7 +392,7 @@ static int std_event_fd_destructor(struct tevent_fd *fde)
epoll_del_event(std_ev, fde);
- if (fde->flags & EVENT_FD_AUTOCLOSE) {
+ if (fde->flags & TEVENT_FD_AUTOCLOSE) {
close(fde->fd);
fde->fd = -1;
}
@@ -405,9 +405,11 @@ static int std_event_fd_destructor(struct tevent_fd *fde)
return NULL on failure (memory allocation error)
*/
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)
+ int fd, uint16_t flags,
+ tevent_fd_handler_t handler,
+ void *private_data,
+ const char *handler_name,
+ const char *location)
{
struct std_event_context *std_ev = talloc_get_type(ev->additional_data,
struct std_event_context);
@@ -487,16 +489,16 @@ static int std_event_loop_select(struct std_event_context *std_ev, struct timeva
/* setup any fd events */
for (fde = std_ev->fd_events; fde; fde = fde->next) {
- if (fde->flags & EVENT_FD_READ) {
+ if (fde->flags & TEVENT_FD_READ) {
FD_SET(fde->fd, &r_fds);
}
- if (fde->flags & EVENT_FD_WRITE) {
+ if (fde->flags & TEVENT_FD_WRITE) {
FD_SET(fde->fd, &w_fds);
}
}
if (std_ev->ev->num_signal_handlers &&
- common_event_check_signal(std_ev->ev)) {
+ tevent_common_check_signal(std_ev->ev)) {
return 0;
}
@@ -504,7 +506,7 @@ static int std_event_loop_select(struct std_event_context *std_ev, struct timeva
if (selrtn == -1 && errno == EINTR &&
std_ev->ev->num_signal_handlers) {
- common_event_check_signal(std_ev->ev);
+ tevent_common_check_signal(std_ev->ev);
return 0;
}
@@ -514,15 +516,15 @@ static int std_event_loop_select(struct std_event_context *std_ev, struct timeva
made readable and that should have removed
the event, so this must be a bug. This is a
fatal error. */
- ev_debug(std_ev->ev, EV_DEBUG_FATAL,
- "ERROR: EBADF on std_event_loop_once\n");
+ tevent_debug(std_ev->ev, TEVENT_DEBUG_FATAL,
+ "ERROR: EBADF on std_event_loop_once\n");
std_ev->exit_code = EBADF;
return -1;
}
if (selrtn == 0 && tvalp) {
/* we don't care about a possible delay here */
- common_event_loop_timer_delay(std_ev->ev);
+ tevent_common_loop_timer_delay(std_ev->ev);
return 0;
}
@@ -533,8 +535,8 @@ static int std_event_loop_select(struct std_event_context *std_ev, struct timeva
for (fde = std_ev->fd_events; fde; fde = fde->next) {
uint16_t flags = 0;
- if (FD_ISSET(fde->fd, &r_fds)) flags |= EVENT_FD_READ;
- if (FD_ISSET(fde->fd, &w_fds)) flags |= EVENT_FD_WRITE;
+ if (FD_ISSET(fde->fd, &r_fds)) flags |= TEVENT_FD_READ;
+ if (FD_ISSET(fde->fd, &w_fds)) flags |= TEVENT_FD_WRITE;
if (flags) {
fde->handler(std_ev->ev, fde, flags, fde->private_data);
if (destruction_count != std_ev->destruction_count) {
@@ -556,7 +558,7 @@ static int std_event_loop_once(struct tevent_context *ev)
struct std_event_context);
struct timeval tval;
- tval = common_event_loop_timer_delay(ev);
+ tval = tevent_common_loop_timer_delay(ev);
if (ev_timeval_is_zero(&tval)) {
return 0;
}
@@ -588,20 +590,20 @@ static int std_event_loop_wait(struct tevent_context *ev)
return std_ev->exit_code;
}
-static const struct event_ops std_event_ops = {
+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,
.set_fd_flags = std_event_set_fd_flags,
- .add_timer = common_event_add_timed,
- .add_signal = common_event_add_signal,
+ .add_timer = tevent_common_add_timer,
+ .add_signal = tevent_common_add_signal,
.loop_once = std_event_loop_once,
.loop_wait = std_event_loop_wait,
};
-bool events_standard_init(void)
+bool tevent_standard_init(void)
{
- return event_register_backend("standard", &std_event_ops);
+ return tevent_register_backend("standard", &std_event_ops);
}
diff --git a/lib/tevent/tevent_timed.c b/lib/tevent/tevent_timed.c
index ce3fc8eb00..dadd360416 100644
--- a/lib/tevent/tevent_timed.c
+++ b/lib/tevent/tevent_timed.c
@@ -20,11 +20,8 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include <sys/time.h>
-#include <time.h>
#include "replace.h"
-#include "system/filesys.h"
-#include "system/select.h"
+#include "system/time.h"
#include "tevent.h"
#include "tevent_internal.h"
#include "tevent_util.h"
@@ -109,7 +106,7 @@ bool ev_timeval_is_zero(const struct timeval *tv)
/*
destroy a timed event
*/
-static int common_event_timed_destructor(struct tevent_timer *te)
+static int tevent_common_timed_destructor(struct tevent_timer *te)
{
struct tevent_context *ev = talloc_get_type(te->event_ctx,
struct tevent_context);
@@ -117,7 +114,7 @@ static int common_event_timed_destructor(struct tevent_timer *te)
return 0;
}
-static int common_event_timed_deny_destructor(struct tevent_timer *te)
+static int tevent_common_timed_deny_destructor(struct tevent_timer *te)
{
return -1;
}
@@ -126,10 +123,12 @@ static int common_event_timed_deny_destructor(struct tevent_timer *te)
add a timed event
return NULL on failure (memory allocation error)
*/
-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 tevent_timer *tevent_common_add_timer(struct tevent_context *ev, TALLOC_CTX *mem_ctx,
+ struct timeval next_event,
+ tevent_timer_handler_t handler,
+ void *private_data,
+ const char *handler_name,
+ const char *location)
{
struct tevent_timer *te, *last_te, *cur_te;
@@ -140,6 +139,8 @@ struct tevent_timer *common_event_add_timed(struct tevent_context *ev, TALLOC_CT
te->next_event = next_event;
te->handler = handler;
te->private_data = private_data;
+ te->handler_name = handler_name;
+ te->location = location;
te->additional_data = NULL;
/* keep the list ordered */
@@ -155,7 +156,7 @@ struct tevent_timer *common_event_add_timed(struct tevent_context *ev, TALLOC_CT
DLIST_ADD_AFTER(ev->timer_events, te, last_te);
- talloc_set_destructor(te, common_event_timed_destructor);
+ talloc_set_destructor(te, tevent_common_timed_destructor);
return te;
}
@@ -166,7 +167,7 @@ struct tevent_timer *common_event_add_timed(struct tevent_context *ev, TALLOC_CT
return the delay untill the next timed event,
or zero if a timed event was triggered
*/
-struct timeval common_event_loop_timer_delay(struct tevent_context *ev)
+struct timeval tevent_common_loop_timer_delay(struct tevent_context *ev)
{
struct timeval current_time = ev_timeval_zero();
struct tevent_timer *te = ev->timer_events;
@@ -203,7 +204,7 @@ struct timeval common_event_loop_timer_delay(struct tevent_context *ev)
*/
/* deny the handler to free the event */
- talloc_set_destructor(te, common_event_timed_deny_destructor);
+ talloc_set_destructor(te, tevent_common_timed_deny_destructor);
/* We need to remove the timer from the list before calling the
* handler because in a semi-async inner event loop called from the
diff --git a/librpc/gen_ndr/named_pipe_auth.h b/librpc/gen_ndr/named_pipe_auth.h
index 5f4ba9afb1..8f2446e564 100644
--- a/librpc/gen_ndr/named_pipe_auth.h
+++ b/librpc/gen_ndr/named_pipe_auth.h
@@ -19,6 +19,7 @@ struct named_pipe_auth_req {
}/* [gensize,public] */;
union named_pipe_auth_rep_info {
+ int _dummy_element;
}/* [switch_type(uint32)] */;
struct named_pipe_auth_rep {
diff --git a/packaging/RHEL/samba.spec.tmpl b/packaging/RHEL/samba.spec.tmpl
index 92030fcd6b..f674e8386c 100644
--- a/packaging/RHEL/samba.spec.tmpl
+++ b/packaging/RHEL/samba.spec.tmpl
@@ -178,12 +178,6 @@ fi
make CFLAGS="$RPM_OPT_FLAGS -D_GNU_SOURCE" %{?_smp_mflags} \
all modules pam_smbpass
-## build the cifs fs mount helper
-cd client
-gcc -o mount.cifs $RPM_OPT_FLAGS -D_GNU_SOURCE -Wall -D_GNU_SOURCE -D_LARGEFILE64_SOURCE mount.cifs.c
-gcc -o umount.cifs $RPM_OPT_FLAGS -D_GNU_SOURCE -Wall -D_GNU_SOURCE -D_LARGEFILE64_SOURCE umount.cifs.c
-cd ..
-
# Remove some permission bits to avoid to many dependencies
cd ..
find examples docs -type f | xargs -r chmod -x
@@ -238,8 +232,8 @@ install -m644 setup/samba.pamd $RPM_BUILD_ROOT%{_sysconfdir}/pam.d/samba
install -m755 setup/smbprint $RPM_BUILD_ROOT%{_bindir}
install -m644 setup/smbusers $RPM_BUILD_ROOT%{_sysconfdir}/samba/smbusers
install -m644 setup/smb.conf $RPM_BUILD_ROOT%{_sysconfdir}/samba/smb.conf
-install -m755 source/client/mount.cifs $RPM_BUILD_ROOT/sbin/mount.cifs
-install -m755 source/client/umount.cifs $RPM_BUILD_ROOT/sbin/umount.cifs
+install -m755 source/bin/mount.cifs $RPM_BUILD_ROOT/sbin/mount.cifs
+install -m755 source/bin/umount.cifs $RPM_BUILD_ROOT/sbin/umount.cifs
install -m755 source/script/mksmbpasswd.sh $RPM_BUILD_ROOT%{_bindir}
/bin/rm $RPM_BUILD_ROOT%{_sbindir}/*mount.cifs
diff --git a/pidl/lib/Parse/Pidl/Samba4/Header.pm b/pidl/lib/Parse/Pidl/Samba4/Header.pm
index 94e1efbfe4..0411466c82 100644
--- a/pidl/lib/Parse/Pidl/Samba4/Header.pm
+++ b/pidl/lib/Parse/Pidl/Samba4/Header.pm
@@ -183,14 +183,20 @@ sub HeaderUnion($$;$)
return if (not defined($union->{ELEMENTS}));
pidl " {\n";
$tab_depth++;
+ my $needed = 0;
foreach my $e (@{$union->{ELEMENTS}}) {
if ($e->{TYPE} ne "EMPTY") {
if (! defined $done{$e->{NAME}}) {
HeaderElement($e);
}
$done{$e->{NAME}} = 1;
+ $needed++;
}
}
+ if (!$needed) {
+ # sigh - some compilers don't like empty structures
+ pidl tabs()."int _dummy_element;\n";
+ }
$tab_depth--;
pidl "}";
diff --git a/source3/autogen.sh b/source3/autogen.sh
index 61316a8f70..1a33eb22cc 100755
--- a/source3/autogen.sh
+++ b/source3/autogen.sh
@@ -4,11 +4,11 @@
while true; do
case $1 in
- (--version-file)
+ --version-file)
VERSION_FILE=$2
shift 2
;;
- (*)
+ *)
break
;;
esac
diff --git a/source3/include/smb.h b/source3/include/smb.h
index a8a2d98154..3253773903 100644
--- a/source3/include/smb.h
+++ b/source3/include/smb.h
@@ -27,7 +27,7 @@
#define _SMB_H
/* logged when starting the various Samba daemons */
-#define COPYRIGHT_STARTUP_MESSAGE "Copyright Andrew Tridgell and the Samba Team 1992-2008"
+#define COPYRIGHT_STARTUP_MESSAGE "Copyright Andrew Tridgell and the Samba Team 1992-2009"
#if defined(LARGE_SMB_OFF_T)
diff --git a/source3/lib/ldb/include/ldb.h b/source3/lib/ldb/include/ldb.h
index 0a745742d9..3891c1c6a3 100644
--- a/source3/lib/ldb/include/ldb.h
+++ b/source3/lib/ldb/include/ldb.h
@@ -991,7 +991,7 @@ int ldb_search(struct ldb_context *ldb,
const struct ldb_dn *base,
enum ldb_scope scope,
const char *expression,
- const char * const *attrs, struct ldb_result **res);
+ const char * const *attrs, struct ldb_result **_res);
/*
* a useful search function where you can easily define the expression and
diff --git a/source3/lib/ldb/tools/ldbadd.c b/source3/lib/ldb/tools/ldbadd.c
index 4dde2a1ef5..155395e065 100644
--- a/source3/lib/ldb/tools/ldbadd.c
+++ b/source3/lib/ldb/tools/ldbadd.c
@@ -35,8 +35,6 @@
#include "ldb/include/includes.h"
#include "ldb/tools/cmdline.h"
-static int failures;
-
static void usage(void)
{
printf("Usage: ldbadd <options> <ldif...>\n");
@@ -53,7 +51,8 @@ static void usage(void)
/*
add records from an opened file
*/
-static int process_file(struct ldb_context *ldb, FILE *f, int *count)
+static int process_file(struct ldb_context *ldb, FILE *f, int *count,
+ int *failures)
{
struct ldb_ldif *ldif;
int ret = LDB_SUCCESS;
@@ -71,7 +70,7 @@ static int process_file(struct ldb_context *ldb, FILE *f, int *count)
if (ret != LDB_SUCCESS) {
fprintf(stderr, "ERR: \"%s\" on DN %s\n",
ldb_errstring(ldb), ldb_dn_linearize(ldb, ldif->msg->dn));
- failures++;
+ (*failures)++;
} else {
(*count)++;
}
@@ -86,7 +85,7 @@ static int process_file(struct ldb_context *ldb, FILE *f, int *count)
int main(int argc, const char **argv)
{
struct ldb_context *ldb;
- int i, ret=0, count=0;
+ int i, ret=0, count=0, failures=0;
struct ldb_cmdline *options;
ldb_global_init();
@@ -96,7 +95,7 @@ int main(int argc, const char **argv)
options = ldb_cmdline_process(ldb, argc, argv, usage);
if (options->argc == 0) {
- ret = process_file(ldb, stdin, &count);
+ ret = process_file(ldb, stdin, &count, &failures);
} else {
for (i=0;i<options->argc;i++) {
const char *fname = options->argv[i];
@@ -106,7 +105,7 @@ int main(int argc, const char **argv)
perror(fname);
exit(1);
}
- ret = process_file(ldb, f, &count);
+ ret = process_file(ldb, f, &count, &failures);
fclose(f);
}
}
diff --git a/source3/lib/ldb/tools/ldbmodify.c b/source3/lib/ldb/tools/ldbmodify.c
index 368b4cf996..f12387a8f6 100644
--- a/source3/lib/ldb/tools/ldbmodify.c
+++ b/source3/lib/ldb/tools/ldbmodify.c
@@ -35,8 +35,6 @@
#include "ldb/include/includes.h"
#include "ldb/tools/cmdline.h"
-static int failures;
-
static void usage(void)
{
printf("Usage: ldbmodify <options> <ldif...>\n");
@@ -52,7 +50,8 @@ static void usage(void)
/*
process modifies for one file
*/
-static int process_file(struct ldb_context *ldb, FILE *f, int *count)
+static int process_file(struct ldb_context *ldb, FILE *f, int *count,
+ int *failures)
{
struct ldb_ldif *ldif;
int ret = LDB_SUCCESS;
@@ -73,7 +72,7 @@ static int process_file(struct ldb_context *ldb, FILE *f, int *count)
if (ret != LDB_SUCCESS) {
fprintf(stderr, "ERR: \"%s\" on DN %s\n",
ldb_errstring(ldb), ldb_dn_linearize(ldb, ldif->msg->dn));
- failures++;
+ (*failures)++;
} else {
(*count)++;
}
@@ -87,6 +86,7 @@ int main(int argc, const char **argv)
{
struct ldb_context *ldb;
int count=0;
+ int failures=0;
int i, ret=LDB_SUCCESS;
struct ldb_cmdline *options;
@@ -97,7 +97,7 @@ int main(int argc, const char **argv)
options = ldb_cmdline_process(ldb, argc, argv, usage);
if (options->argc == 0) {
- ret = process_file(ldb, stdin, &count);
+ ret = process_file(ldb, stdin, &count, &failures);
} else {
for (i=0;i<options->argc;i++) {
const char *fname = options->argv[i];
@@ -107,7 +107,7 @@ int main(int argc, const char **argv)
perror(fname);
exit(1);
}
- ret = process_file(ldb, f, &count);
+ ret = process_file(ldb, f, &count, &failures);
}
}
diff --git a/source3/libsmb/smb_share_modes.c b/source3/libsmb/smb_share_modes.c
index 16b3b10925..af3f7b0dd5 100644
--- a/source3/libsmb/smb_share_modes.c
+++ b/source3/libsmb/smb_share_modes.c
@@ -1,7 +1,7 @@
/*
Samba share mode database library external interface library.
Used by non-Samba products needing access to the Samba share mode db.
-
+
Copyright (C) Jeremy Allison 2005 - 2006
sharemodes_procid functions (C) Copyright (C) Volker Lendecke 2005
@@ -9,17 +9,17 @@
** NOTE! The following LGPL license applies to this module only.
** This does NOT imply that all of Samba is released
** under the LGPL
-
+
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 3 of the License, or (at your option) any later version.
-
+
This library 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
Lesser General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, see <http://www.gnu.org/licenses/>.
*/
@@ -92,16 +92,16 @@ int smb_share_mode_db_close(struct smbdb_ctx *db_ctx)
return ret;
}
-static TDB_DATA get_locking_key(uint64_t dev, uint64_t ino)
+static TDB_DATA get_locking_key(struct locking_key *lk, uint64_t dev,
+ uint64_t ino)
{
- static struct locking_key lk;
TDB_DATA ld;
- memset(&lk, '\0', sizeof(struct locking_key));
- lk.dev = (SMB_DEV_T)dev;
- lk.inode = (SMB_INO_T)ino;
- ld.dptr = (uint8 *)&lk;
- ld.dsize = sizeof(lk);
+ memset(lk, '\0', sizeof(*lk));
+ lk->dev = (SMB_DEV_T)dev;
+ lk->inode = (SMB_INO_T)ino;
+ ld.dptr = (uint8 *)lk;
+ ld.dsize = sizeof(*lk);
return ld;
}
@@ -113,14 +113,17 @@ int smb_lock_share_mode_entry(struct smbdb_ctx *db_ctx,
uint64_t dev,
uint64_t ino)
{
- return tdb_chainlock(db_ctx->smb_tdb, get_locking_key(dev, ino));
+ struct locking_key lk;
+ return tdb_chainlock(db_ctx->smb_tdb, get_locking_key(&lk, dev, ino));
}
-
+
int smb_unlock_share_mode_entry(struct smbdb_ctx *db_ctx,
uint64_t dev,
uint64_t ino)
{
- return tdb_chainunlock(db_ctx->smb_tdb, get_locking_key(dev, ino));
+ struct locking_key lk;
+ return tdb_chainunlock(db_ctx->smb_tdb,
+ get_locking_key(&lk, dev, ino));
}
/*
@@ -172,6 +175,7 @@ int smb_get_share_mode_entries(struct smbdb_ctx *db_ctx,
struct smb_share_mode_entry **pp_list,
unsigned char *p_delete_on_close)
{
+ struct locking_key lk;
TDB_DATA db_data;
struct smb_share_mode_entry *list = NULL;
int num_share_modes = 0;
@@ -183,7 +187,7 @@ int smb_get_share_mode_entries(struct smbdb_ctx *db_ctx,
*pp_list = NULL;
*p_delete_on_close = 0;
- db_data = tdb_fetch(db_ctx->smb_tdb, get_locking_key(dev, ino));
+ db_data = tdb_fetch(db_ctx->smb_tdb, get_locking_key(&lk, dev, ino));
if (!db_data.dptr) {
return 0;
}
@@ -258,7 +262,8 @@ int smb_create_share_mode_entry_ex(struct smbdb_ctx *db_ctx,
const char *filename) /* Must be relative utf8 path. */
{
TDB_DATA db_data;
- TDB_DATA locking_key = get_locking_key(dev, ino);
+ struct locking_key lk;
+ TDB_DATA locking_key = get_locking_key(&lk, dev, ino);
int orig_num_share_modes = 0;
struct locking_data *ld = NULL; /* internal samba db state. */
struct share_mode_entry *shares = NULL;
@@ -371,7 +376,8 @@ int smb_delete_share_mode_entry(struct smbdb_ctx *db_ctx,
const struct smb_share_mode_entry *del_entry)
{
TDB_DATA db_data;
- TDB_DATA locking_key = get_locking_key(dev, ino);
+ struct locking_key lk;
+ TDB_DATA locking_key = get_locking_key(&lk, dev, ino);
int orig_num_share_modes = 0;
struct locking_data *ld = NULL; /* internal samba db state. */
struct share_mode_entry *shares = NULL;
@@ -473,7 +479,8 @@ int smb_change_share_mode_entry(struct smbdb_ctx *db_ctx,
const struct smb_share_mode_entry *new_entry)
{
TDB_DATA db_data;
- TDB_DATA locking_key = get_locking_key(dev, ino);
+ struct locking_key lk;
+ TDB_DATA locking_key = get_locking_key(&lk, dev, ino);
int num_share_modes = 0;
struct locking_data *ld = NULL; /* internal samba db state. */
struct share_mode_entry *shares = NULL;
diff --git a/source3/modules/onefs_open.c b/source3/modules/onefs_open.c
index a4a317d905..a86d39948d 100644
--- a/source3/modules/onefs_open.c
+++ b/source3/modules/onefs_open.c
@@ -1,8 +1,8 @@
/*
* Unix SMB/CIFS implementation.
*
- * This file began with some code from source3/smbd/open.c and modified it to
- * work with ifs_createfile.
+ * This file began with some code from source3/smbd/open.c and has been
+ * modified it work with ifs_createfile.
*
* ifs_createfile is a CIFS-specific syscall for opening/files and
* directories. It adds support for:
@@ -459,7 +459,7 @@ NTSTATUS onefs_open_file_ntcreate(connection_struct *conn,
DEBUG(10, ("onefs_open_file_ntcreate: printer open fname=%s\n",
fname));
- return print_fsp_open(req, conn, fname, req->vuid, fsp);
+ return print_fsp_open(req, conn, fname, req->vuid, fsp, psbuf);
}
if (!parent_dirname(talloc_tos(), fname, &parent_dir, &newname)) {
diff --git a/source3/winbindd/idmap.c b/source3/winbindd/idmap.c
index 6be55ef03c..ca07f230ab 100644
--- a/source3/winbindd/idmap.c
+++ b/source3/winbindd/idmap.c
@@ -735,6 +735,17 @@ NTSTATUS idmap_backends_unixid_to_sid(const char *domname, struct id_map *id)
maps[0] = id;
maps[1] = NULL;
+ /*
+ * Always give passdb a chance first
+ */
+
+ dom = idmap_init_passdb_domain(NULL);
+ if ((dom != NULL)
+ && NT_STATUS_IS_OK(dom->methods->unixids_to_sids(dom, maps))
+ && id->status == ID_MAPPED) {
+ return NT_STATUS_OK;
+ }
+
dom = idmap_find_domain(domname);
if (dom == NULL) {
return NT_STATUS_NONE_MAPPED;
diff --git a/source4/headermap.txt b/source4/headermap.txt
index d5e70a7304..c27ec2f2de 100644
--- a/source4/headermap.txt
+++ b/source4/headermap.txt
@@ -49,11 +49,8 @@ param/share.h: share.h
../lib/util/util_tdb.h: util_tdb.h
../lib/util/util_ldb.h: util_ldb.h
../lib/util/wrap_xattr.h: wrap_xattr.h
-lib/events/events.h: events/events.h
-lib/events/events_internal.h: events/events_internal.h
libcli/ldap/ldap_ndr.h: ldap_ndr.h
lib/events/events.h: events.h
-lib/events/events_internal.h: events_internal.h
../lib/tevent/tevent.h: tevent.h
../lib/tevent/tevent_internal.h: tevent_internal.h
auth/session.h: samba/session.h
diff --git a/source4/lib/events/config.mk b/source4/lib/events/config.mk
index a1b2cd218a..c07a21bc75 100644
--- a/source4/lib/events/config.mk
+++ b/source4/lib/events/config.mk
@@ -4,4 +4,4 @@ CFLAGS = -Ilib/events
LIBEVENTS_OBJ_FILES = $(addprefix $(libeventssrcdir)/, tevent_s4.o)
-PUBLIC_HEADERS += $(addprefix $(libeventssrcdir)/, events.h events_internal.h)
+PUBLIC_HEADERS += $(addprefix $(libeventssrcdir)/, events.h)
diff --git a/source4/lib/events/events.h b/source4/lib/events/events.h
index 698ff2919b..1b2dbde32b 100644
--- a/source4/lib/events/events.h
+++ b/source4/lib/events/events.h
@@ -3,5 +3,5 @@
#define TEVENT_COMPAT_DEFINES 1
#include <../lib/tevent/tevent.h>
struct tevent_context *s4_event_context_init(TALLOC_CTX *mem_ctx);
-struct tevent_context *event_context_find(TALLOC_CTX *mem_ctx);
+struct tevent_context *event_context_find(TALLOC_CTX *mem_ctx) _DEPRECATED_;
#endif /* __LIB_EVENTS_H__ */
diff --git a/source4/lib/events/events_internal.h b/source4/lib/events/events_internal.h
deleted file mode 100644
index 055bfe1a92..0000000000
--- a/source4/lib/events/events_internal.h
+++ /dev/null
@@ -1,5 +0,0 @@
-#ifndef __LIB_EVENTS_INTERNAL_H__
-#define __LIB_EVENTS_INTERNAL_H__
-#define TEVENT_COMPAT_DEFINES 1
-#include <../lib/tevent/tevent_internal.h>
-#endif /* __LIB_EVENTS_INTERNAL_H__ */
diff --git a/source4/lib/events/tevent_s4.c b/source4/lib/events/tevent_s4.c
index b3de7e667a..34a34a8e0b 100644
--- a/source4/lib/events/tevent_s4.c
+++ b/source4/lib/events/tevent_s4.c
@@ -17,38 +17,37 @@
*/
#include "includes.h"
-#include <events.h>
-#include <events_internal.h>
+#include "lib/events/events.h"
/*
this is used to catch debug messages from events
*/
-static void ev_wrap_debug(void *context, enum ev_debug_level level,
+static void ev_wrap_debug(void *context, enum tevent_debug_level level,
const char *fmt, va_list ap) PRINTF_ATTRIBUTE(3,0);
-static void ev_wrap_debug(void *context, enum ev_debug_level level,
+static void ev_wrap_debug(void *context, enum tevent_debug_level level,
const char *fmt, va_list ap)
{
int samba_level = -1;
char *s = NULL;
switch (level) {
- case EV_DEBUG_FATAL:
+ case TEVENT_DEBUG_FATAL:
samba_level = 0;
break;
- case EV_DEBUG_ERROR:
+ case TEVENT_DEBUG_ERROR:
samba_level = 1;
break;
- case EV_DEBUG_WARNING:
+ case TEVENT_DEBUG_WARNING:
samba_level = 2;
break;
- case EV_DEBUG_TRACE:
+ case TEVENT_DEBUG_TRACE:
samba_level = 5;
break;
};
vasprintf(&s, fmt, ap);
if (!s) return;
- DEBUG(samba_level, ("events: %s\n", s));
+ DEBUG(samba_level, ("tevent: %s\n", s));
free(s);
}
@@ -63,10 +62,27 @@ struct tevent_context *s4_event_context_init(TALLOC_CTX *mem_ctx)
{
struct tevent_context *ev;
- ev = event_context_init_byname(mem_ctx, NULL);
+ ev = tevent_context_init_byname(mem_ctx, NULL);
if (ev) {
- ev_set_debug(ev, ev_wrap_debug, NULL);
+ tevent_set_debug(ev, ev_wrap_debug, NULL);
}
return ev;
}
+/*
+ find an event context that is a parent of the given memory context,
+ or create a new event context as a child of the given context if
+ none is found
+
+ This should be used in preference to event_context_init() in places
+ where you would prefer to use the existing event context if possible
+ (which is most situations)
+*/
+struct tevent_context *event_context_find(TALLOC_CTX *mem_ctx)
+{
+ struct tevent_context *ev = talloc_find_parent_bytype(mem_ctx, struct tevent_context);
+ if (ev == NULL) {
+ ev = tevent_context_init(mem_ctx);
+ }
+ return ev;
+}
diff --git a/source4/lib/registry/pyregistry.c b/source4/lib/registry/pyregistry.c
index 2d2f2fb685..357305c4de 100644
--- a/source4/lib/registry/pyregistry.c
+++ b/source4/lib/registry/pyregistry.c
@@ -357,7 +357,7 @@ static PyObject *py_open_ldb_file(PyObject *self, PyObject *args, PyObject *kwar
session_info = NULL; /* FIXME */
result = reg_open_ldb_file(NULL, location, session_info, credentials,
- event_context_init(NULL), lp_ctx, &key);
+ tevent_context_init(NULL), lp_ctx, &key);
PyErr_WERROR_IS_ERR_RAISE(result);
return py_talloc_import(&PyHiveKey, key);
diff --git a/source4/selftest/tests.sh b/source4/selftest/tests.sh
index 0a5bdf62cd..56cbacbdaf 100755
--- a/source4/selftest/tests.sh
+++ b/source4/selftest/tests.sh
@@ -401,7 +401,7 @@ plantest "samr.python" dc $SUBUNITRUN samba.tests.dcerpc.sam
plantest "dcerpc.bare.python" dc $SUBUNITRUN samba.tests.dcerpc.bare
plantest "unixinfo.python" dc $SUBUNITRUN samba.tests.dcerpc.unix
plantest "samdb.python" none $SUBUNITRUN samba.tests.samdb
-plantest "events.python" none PYTHONPATH="$PYTHONPATH:../lib/tevent" $SUBUNITRUN tests
+plantest "tevent.python" none PYTHONPATH="$PYTHONPATH:../lib/tevent" $SUBUNITRUN tests
plantest "messaging.python" none PYTHONPATH="$PYTHONPATH:lib/messaging/tests" $SUBUNITRUN bindings
plantest "samba3sam.python" none PYTHONPATH="$PYTHONPATH:dsdb/samdb/ldb_modules/tests" $SUBUNITRUN samba3sam
plantest "subunit.python" none $SUBUNITRUN subunit
diff --git a/source4/smbd/server.c b/source4/smbd/server.c
index c1683a48dc..1eb3e42501 100644
--- a/source4/smbd/server.c
+++ b/source4/smbd/server.c
@@ -266,7 +266,7 @@ static int binary_smbd_main(const char *binary_name, int argc, const char *argv[
umask(0);
DEBUG(0,("%s version %s started.\n", binary_name, SAMBA_VERSION_STRING));
- DEBUGADD(0,("Copyright Andrew Tridgell and the Samba Team 1992-2008\n"));
+ DEBUGADD(0,("Copyright Andrew Tridgell and the Samba Team 1992-2009\n"));
if (sizeof(uint16_t) < 2 || sizeof(uint32_t) < 4 || sizeof(uint64_t) < 8) {
DEBUG(0,("ERROR: Samba is not configured correctly for the word size on your machine\n"));
diff --git a/source4/winbind/wb_init_domain.c b/source4/winbind/wb_init_domain.c
index 637cf10bb7..5953474c52 100644
--- a/source4/winbind/wb_init_domain.c
+++ b/source4/winbind/wb_init_domain.c
@@ -402,8 +402,7 @@ static void init_domain_recv_samr(struct composite_context *ctx)
talloc_steal(state->domain->libnet_ctx->samr.pipe, state->domain->samr_binding);
state->domain->libnet_ctx->samr.access_mask = SEC_FLAG_MAXIMUM_ALLOWED;
state->domain->libnet_ctx->samr.name = state->domain->info->name;
- state->domain->libnet_ctx->samr.sid = dom_sid_dup(state->ctx,
- state->domain->info->sid);
+ state->domain->libnet_ctx->samr.sid = state->domain->info->sid;
composite_done(state->ctx);
}
diff --git a/source4/winbind/wb_samba3_cmd.c b/source4/winbind/wb_samba3_cmd.c
index 6cad76b08b..ea3050503d 100644
--- a/source4/winbind/wb_samba3_cmd.c
+++ b/source4/winbind/wb_samba3_cmd.c
@@ -115,8 +115,8 @@ NTSTATUS wbsrv_samba3_priv_pipe_dir(struct wbsrv_samba3_call *s3call)
{
const char *path = s3call->wbconn->listen_socket->service->priv_socket_path;
s3call->response.result = WINBINDD_OK;
- WBSRV_SAMBA3_SET_STRING(s3call->response.extra_data.data, path);
-
+ s3call->response.extra_data.data = path;
+
s3call->response.length += strlen(path) + 1;
return NT_STATUS_OK;
}