From f0fcc332f5b9de7334780a2e522efaa7494ee343 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Wed, 7 Feb 2007 03:16:10 +0000 Subject: 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 (This used to be commit 2ff8abf0022824e6ae93019ee1b3391e651a8ee7) --- source4/lib/events/events_aio.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'source4/lib/events') diff --git a/source4/lib/events/events_aio.c b/source4/lib/events/events_aio.c index 90d4bdcc1f..ddadedf6e3 100644 --- a/source4/lib/events/events_aio.c +++ b/source4/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; } -- cgit