summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2013-02-14 10:58:55 +0100
committerJeremy Allison <jra@samba.org>2013-02-14 10:19:38 -0800
commite4ef2ecf023c63ee28e40a1b60ecc6091a126001 (patch)
tree7a71dd484b88e8a79176a519807615a412f19a4b
parent129da06d2d9c9d1cedc5e4de492744b29adc1684 (diff)
downloadsamba-e4ef2ecf023c63ee28e40a1b60ecc6091a126001.tar.gz
samba-e4ef2ecf023c63ee28e40a1b60ecc6091a126001.tar.bz2
samba-e4ef2ecf023c63ee28e40a1b60ecc6091a126001.zip
tevent: pass 'bool replay' to epoll_panic()
A fallback panic handler will need to know if there was an error while waiting for events (replay=true) or if the error happened on modify (replay=false). Signed-off-by: Stefan Metzmacher <metze@samba.org>
-rw-r--r--lib/tevent/tevent_epoll.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/tevent/tevent_epoll.c b/lib/tevent/tevent_epoll.c
index 8e7bc4d26b..c7936d3c94 100644
--- a/lib/tevent/tevent_epoll.c
+++ b/lib/tevent/tevent_epoll.c
@@ -44,7 +44,8 @@ struct epoll_event_context {
/*
called when a epoll call fails
*/
-static void epoll_panic(struct epoll_event_context *epoll_ev, const char *reason)
+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));
@@ -151,7 +152,7 @@ static void epoll_add_event(struct epoll_event_context *epoll_ev, struct tevent_
event.events = epoll_map_flags(fde->flags);
event.data.ptr = fde;
if (epoll_ctl(epoll_ev->epoll_fd, EPOLL_CTL_ADD, fde->fd, &event) != 0) {
- epoll_panic(epoll_ev, "EPOLL_CTL_ADD failed");
+ epoll_panic(epoll_ev, "EPOLL_CTL_ADD failed", false);
return;
}
fde->additional_flags |= EPOLL_ADDITIONAL_FD_FLAG_HAS_EVENT;
@@ -201,7 +202,7 @@ static void epoll_mod_event(struct epoll_event_context *epoll_ev, struct tevent_
event.events = epoll_map_flags(fde->flags);
event.data.ptr = fde;
if (epoll_ctl(epoll_ev->epoll_fd, EPOLL_CTL_MOD, fde->fd, &event) != 0) {
- epoll_panic(epoll_ev, "EPOLL_CTL_MOD failed");
+ epoll_panic(epoll_ev, "EPOLL_CTL_MOD failed", false);
return;
}
@@ -277,7 +278,7 @@ static int epoll_event_loop(struct epoll_event_context *epoll_ev, struct timeval
}
if (ret == -1 && errno != EINTR) {
- epoll_panic(epoll_ev, "epoll_wait() failed");
+ epoll_panic(epoll_ev, "epoll_wait() failed", true);
return -1;
}
@@ -293,7 +294,7 @@ static int epoll_event_loop(struct epoll_event_context *epoll_ev, struct timeval
uint16_t flags = 0;
if (fde == NULL) {
- epoll_panic(epoll_ev, "epoll_wait() gave bad data");
+ epoll_panic(epoll_ev, "epoll_wait() gave bad data", true);
return -1;
}
if (events[i].events & (EPOLLHUP|EPOLLERR)) {