diff options
author | Dmitry Torokhov <dtor@chromium.org> | 2018-02-27 16:55:17 -0800 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2018-03-01 16:13:07 -0800 |
commit | cb47da4910c846bae990ba04cf4d2dd94d0301ff (patch) | |
tree | 620faf0bb68270e95df397aea0ddab0a1b8102b8 /sys_util/src/poll.rs | |
parent | 3cbbbe68840e738aae957b1b4c0aa2f54178d576 (diff) | |
download | crosvm-cb47da4910c846bae990ba04cf4d2dd94d0301ff.tar crosvm-cb47da4910c846bae990ba04cf4d2dd94d0301ff.tar.gz crosvm-cb47da4910c846bae990ba04cf4d2dd94d0301ff.tar.bz2 crosvm-cb47da4910c846bae990ba04cf4d2dd94d0301ff.tar.lz crosvm-cb47da4910c846bae990ba04cf4d2dd94d0301ff.tar.xz crosvm-cb47da4910c846bae990ba04cf4d2dd94d0301ff.tar.zst crosvm-cb47da4910c846bae990ba04cf4d2dd94d0301ff.zip |
sys_util: fix handling EINTR of C system functions
System functions have 2 ways of signalling errors, either via returning -1 as result, and setting errno, or directly returning error code, and we can not distinguish automatically between the 2 options when using InterruptibleResult trait for i32 values. Let's remove this trait for i32 and create 2 explicit macros: handle_eintr_rc and handle_eintr_errno. TEST=cargo test --features plugin; cargo test -p sys_util BUG=None Change-Id: I1dc8e3c023e7bf7875ac3536703eb71fa3206b7b Signed-off-by: Dmitry Torokhov <dtor@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/940612 Reviewed-by: Zach Reizner <zachr@chromium.org>
Diffstat (limited to 'sys_util/src/poll.rs')
-rw-r--r-- | sys_util/src/poll.rs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/sys_util/src/poll.rs b/sys_util/src/poll.rs index 2e28514..d6c3d4a 100644 --- a/sys_util/src/poll.rs +++ b/sys_util/src/poll.rs @@ -115,11 +115,11 @@ impl Poller { // Safe because poll is given the correct length of properly initialized pollfds, and we // check the return result. let ret = unsafe { - handle_eintr!(ppoll(self.pollfds.as_mut_ptr(), - self.pollfds.len() as nfds_t, - &mut timeout_spec, - null(), - 0)) + handle_eintr_errno!(ppoll(self.pollfds.as_mut_ptr(), + self.pollfds.len() as nfds_t, + &mut timeout_spec, + null(), + 0)) }; *timeout = Duration::new(timeout_spec.tv_sec as u64, timeout_spec.tv_nsec as u32); |