From 3e830e44d3eb23325fbda6f2053e58926ee2136e Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Wed, 16 Jan 2013 12:00:00 +0100 Subject: winbind: Use standard tevent_context_init This makes winbind use epoll instead of poll Reviewed by: Jeremy Allison --- source3/winbindd/winbindd.c | 38 +++++++++++++++++++++++++++++++++----- 1 file changed, 33 insertions(+), 5 deletions(-) (limited to 'source3/winbindd/winbindd.c') diff --git a/source3/winbindd/winbindd.c b/source3/winbindd/winbindd.c index 698c96cd53..ebaa080bc0 100644 --- a/source3/winbindd/winbindd.c +++ b/source3/winbindd/winbindd.c @@ -49,14 +49,42 @@ static bool interactive = False; extern bool override_logfile; +struct tevent_context *winbind_event_context(void) +{ + static struct tevent_context *ev = NULL; + + if (ev != NULL) { + return ev; + } + + /* + * Note we MUST use the NULL context here, not the autofree context, + * to avoid side effects in forked children exiting. + */ + ev = tevent_context_init(NULL); + if (ev == NULL) { + smb_panic("Could not init winbindd's messaging context.\n"); + } + return ev; +} + struct messaging_context *winbind_messaging_context(void) { - struct messaging_context *msg_ctx = server_messaging_context(); - if (likely(msg_ctx != NULL)) { - return msg_ctx; + static struct messaging_context *msg = NULL; + + if (msg != NULL) { + return msg; + } + + /* + * Note we MUST use the NULL context here, not the autofree context, + * to avoid side effects in forked children exiting. + */ + msg = messaging_init(NULL, winbind_event_context()); + if (msg == NULL) { + smb_panic("Could not init winbindd's messaging context.\n"); } - smb_panic("Could not init winbindd's messaging context.\n"); - return NULL; + return msg; } /* Reload configuration */ -- cgit