summaryrefslogtreecommitdiff
path: root/lib/tevent/tevent_epoll.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2013-02-11 10:43:39 -0800
committerJeremy Allison <jra@samba.org>2013-02-14 10:19:38 -0800
commit04ba47e491d84f58562b57f937be632e75c204aa (patch)
tree65720160f4c9fa6d85fed526bd5566a100c71743 /lib/tevent/tevent_epoll.c
parente4ef2ecf023c63ee28e40a1b60ecc6091a126001 (diff)
downloadsamba-04ba47e491d84f58562b57f937be632e75c204aa.tar.gz
samba-04ba47e491d84f58562b57f937be632e75c204aa.tar.bz2
samba-04ba47e491d84f58562b57f937be632e75c204aa.zip
tevent: Add an internal function tevent_epoll_set_panic_fallback().
Can be set externally, allows us to fallback if epoll fails at runtime. Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
Diffstat (limited to 'lib/tevent/tevent_epoll.c')
-rw-r--r--lib/tevent/tevent_epoll.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/lib/tevent/tevent_epoll.c b/lib/tevent/tevent_epoll.c
index c7936d3c94..8a48d1d33d 100644
--- a/lib/tevent/tevent_epoll.c
+++ b/lib/tevent/tevent_epoll.c
@@ -39,9 +39,33 @@ struct epoll_event_context {
int epoll_fd;
pid_t pid;
+
+ bool (*panic_fallback)(struct tevent_context *ev, bool replay);
};
/*
+ called to set the panic fallback function.
+*/
+_PRIVATE_ bool tevent_epoll_set_panic_fallback(struct tevent_context *ev,
+ bool (*panic_fallback)(struct tevent_context *ev,
+ bool replay))
+{
+ struct epoll_event_context *epoll_ev;
+
+ if (ev->additional_data == NULL) {
+ return false;
+ }
+
+ epoll_ev = talloc_get_type(ev->additional_data,
+ struct epoll_event_context);
+ if (epoll_ev == NULL) {
+ return false;
+ }
+ epoll_ev->panic_fallback = panic_fallback;
+ return true;
+}
+
+/*
called when a epoll call fails
*/
static void epoll_panic(struct epoll_event_context *epoll_ev,