mirror of
https://chromium.googlesource.com/crosvm/crosvm
synced 2025-01-28 19:29:20 +00:00
sys_util: register_signal_handler should use SA_RESTART
On Linux, signal handlers installed with signal() will restart interrupted system calls. When we moved to using sigaction() we forgot to specify SA_RESTART and so we started experiencing returns from read write system calls with EINTR, which throws off some of the code. Instead of sprinkling "handle_eintr" everywhere, let's restore the old behavior. TEST=cargo test --features plugin; cargo test -p sys_util BUG=chromium:800626 Change-Id: I24c23069ad4c9e7be8c484ee4c57f67451a2944d Signed-off-by: Dmitry Torokhov <dtor@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/944848 Reviewed-by: Zach Reizner <zachr@chromium.org>
This commit is contained in:
parent
43724a239b
commit
aa83c17359
1 changed files with 2 additions and 1 deletions
|
@ -2,7 +2,7 @@
|
|||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
use libc::{c_int, sigaction, timespec,
|
||||
use libc::{c_int, sigaction, SA_RESTART, timespec,
|
||||
sigset_t, siginfo_t,
|
||||
sigaddset, sigemptyset, sigismember, sigpending, sigtimedwait,
|
||||
pthread_t, pthread_kill, pthread_sigmask,
|
||||
|
@ -75,6 +75,7 @@ pub unsafe fn register_signal_handler(
|
|||
}
|
||||
|
||||
let mut sigact: sigaction = mem::zeroed();
|
||||
sigact.sa_flags = SA_RESTART;
|
||||
sigact.sa_sigaction = handler as *const () as usize;
|
||||
|
||||
let ret = sigaction(num, &sigact, null_mut());
|
||||
|
|
Loading…
Reference in a new issue