From 2ff8abf0022824e6ae93019ee1b3391e651a8ee7 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Wed, 7 Feb 2007 03:16:10 +0000 Subject: [PATCH] r21212: detect if the kernel does not support integrated epoll/aio when the event context is created. This allows the LOCAL-EVENT test to pass on systems with have libaio but not the necessary kernel patches --- source/lib/events/events_aio.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/source/lib/events/events_aio.c b/source/lib/events/events_aio.c index 90d4bdcc1f0..ddadedf6e3b 100644 --- a/source/lib/events/events_aio.c +++ b/source/lib/events/events_aio.c @@ -324,15 +324,25 @@ static int aio_event_context_init(struct event_context *ev) aio_ev->epoll_iocb = talloc(aio_ev, struct iocb); if (io_queue_init(MAX_AIO_QUEUE_DEPTH, &aio_ev->ioctx) != 0) { + talloc_free(aio_ev); return -1; } aio_ev->epoll_fd = epoll_create(MAX_AIO_QUEUE_DEPTH); - if (aio_ev->epoll_fd == -1) return -1; + if (aio_ev->epoll_fd == -1) { + talloc_free(aio_ev); + return -1; + } talloc_set_destructor(aio_ev, aio_ctx_destructor); ev->additional_data = aio_ev; + + if (setup_epoll_wait(aio_ev) < 0) { + talloc_free(aio_ev); + return -1; + } + return 0; }