tevent: Plumb in the panic fallback code into the epoll_panic() runtime call.
authorJeremy Allison <jra@samba.org>
Mon, 11 Feb 2013 18:48:02 +0000 (10:48 -0800)
committerJeremy Allison <jra@samba.org>
Thu, 14 Feb 2013 18:19:38 +0000 (10:19 -0800)
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
lib/tevent/tevent_epoll.c

index 8a48d1d33d1872a937d51b6081db6b22c3914337..0ef1ffe9099dd343d35e829d59cb7bdd9faf5759 100644 (file)
@@ -71,9 +71,26 @@ _PRIVATE_ bool tevent_epoll_set_panic_fallback(struct tevent_context *ev,
 static void epoll_panic(struct epoll_event_context *epoll_ev,
                        const char *reason, bool replay)
 {
-       tevent_debug(epoll_ev->ev, TEVENT_DEBUG_FATAL,
-                "%s (%s) - calling abort()\n", reason, strerror(errno));
-       abort();
+       struct tevent_context *ev = epoll_ev->ev;
+
+       if (epoll_ev->panic_fallback == NULL) {
+               tevent_debug(ev, TEVENT_DEBUG_FATAL,
+                       "%s (%s) replay[%u] - calling abort()\n",
+                       reason, strerror(errno), (unsigned)replay);
+               abort();
+       }
+
+       tevent_debug(ev, TEVENT_DEBUG_WARNING,
+                    "%s (%s) replay[%u] - calling panic_fallback\n",
+                    reason, strerror(errno), (unsigned)replay);
+
+       if (!epoll_ev->panic_fallback(ev, replay)) {
+               /* Fallback failed. */
+               tevent_debug(ev, TEVENT_DEBUG_FATAL,
+                       "%s (%s) replay[%u] - calling abort()\n",
+                       reason, strerror(errno), (unsigned)replay);
+               abort();
+       }
 }
 
 /*