summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/tevent/tevent_epoll.c24
-rw-r--r--lib/tevent/tevent_internal.h3
2 files changed, 27 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,
diff --git a/lib/tevent/tevent_internal.h b/lib/tevent/tevent_internal.h
index f09cf576b2..4e9cd69213 100644
--- a/lib/tevent/tevent_internal.h
+++ b/lib/tevent/tevent_internal.h
@@ -318,6 +318,9 @@ bool tevent_poll_init(void);
bool tevent_poll_mt_init(void);
#ifdef HAVE_EPOLL
bool tevent_epoll_init(void);
+bool tevent_epoll_set_panic_fallback(struct tevent_context *ev,
+ bool (*panic_fallback)(struct tevent_context *ev,
+ bool replay));
#endif
void tevent_trace_point_callback(struct tevent_context *ev,