sys_util: handle EINTR return from epoll_wait

The PollContext::wait returns Error on EINTR, which often happens during
suspend/resume cycles. Because this Error is transient, this should be
handled internally with a retry until a fatal error is encountered.

BUG=chromium:834558
TEST=run crosvm, suspend, resume, observe crosvm still running

Change-Id: I75469e261ddf28f025a3b3b93612538ccf1230b9
Reviewed-on: https://chromium-review.googlesource.com/1018527
Commit-Ready: Zach Reizner <zachr@chromium.org>
Tested-by: Zach Reizner <zachr@chromium.org>
Reviewed-by: Dylan Reid <dgreid@chromium.org>
This commit is contained in:
Zach Reizner 2018-04-18 18:18:00 -07:00 committed by chrome-bot
parent 7a7268faf0
commit d14c41a81f

View file

@ -418,10 +418,10 @@ impl<T: PollToken> PollContext<T> {
// Safe because we give an epoll context and a properly sized epoll_events array
// pointer, which we trust the kernel to fill in properly.
unsafe {
epoll_wait(self.epoll_ctx.as_raw_fd(),
&mut epoll_events[0],
max_events,
timeout_millis)
handle_eintr_errno!(epoll_wait(self.epoll_ctx.as_raw_fd(),
&mut epoll_events[0],
max_events,
timeout_millis))
}
};
if ret < 0 {