summary refs log tree commit diff
path: root/src/plugin/mod.rs
diff options
context:
space:
mode:
authorDmitry Torokhov <dtor@chromium.org>2018-02-16 16:25:54 -0800
committerchrome-bot <chrome-bot@chromium.org>2018-02-26 22:07:08 -0800
commitcd4053364d26029e4de560407803df842e96b7c0 (patch)
tree72cc5f83ff631232ab31ccdfe16cdb8c836cbb19 /src/plugin/mod.rs
parent328bfd29592461ded96d42556c3141100348ea1c (diff)
downloadcrosvm-cd4053364d26029e4de560407803df842e96b7c0.tar
crosvm-cd4053364d26029e4de560407803df842e96b7c0.tar.gz
crosvm-cd4053364d26029e4de560407803df842e96b7c0.tar.bz2
crosvm-cd4053364d26029e4de560407803df842e96b7c0.tar.lz
crosvm-cd4053364d26029e4de560407803df842e96b7c0.tar.xz
crosvm-cd4053364d26029e4de560407803df842e96b7c0.tar.zst
crosvm-cd4053364d26029e4de560407803df842e96b7c0.zip
sys_util: factor out signal manipulation from signalfd into signal
Move creating sigsets and blocking/unblocking signals form signalfd
module to signal module so they are usable by other parties as well.

BUG=chromium:800626
TEST=cargo test --features=plugin

Change-Id: I281ce784ed6cb341cc1e7cf2784f6fb1e8cc894d
Signed-off-by: Dmitry Torokhov <dtor@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/930461
Reviewed-by: Zach Reizner <zachr@chromium.org>
Diffstat (limited to 'src/plugin/mod.rs')
-rw-r--r--src/plugin/mod.rs7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/plugin/mod.rs b/src/plugin/mod.rs
index c5e8766..44cba39 100644
--- a/src/plugin/mod.rs
+++ b/src/plugin/mod.rs
@@ -25,7 +25,8 @@ use protobuf::ProtobufError;
 use io_jail::{self, Minijail};
 use kvm::{Kvm, Vm, Vcpu, VcpuExit, IoeventAddress, NoDatamatch};
 use sys_util::{EventFd, MmapError, Killable, SignalFd, SignalFdError, Poller, Pollable,
-               GuestMemory, Result as SysResult, Error as SysError, register_signal_handler,
+               GuestMemory, Result as SysResult, Error as SysError,
+               register_signal_handler, SIGRTMIN,
                geteuid, getegid};
 
 use Config;
@@ -306,7 +307,7 @@ pub fn run_vcpus(kvm: &Kvm,
             unsafe {
                 extern "C" fn handle_signal() {}
                 // Our signal handler does nothing and is trivially async signal safe.
-                register_signal_handler(0, handle_signal)
+                register_signal_handler(SIGRTMIN() + 0, handle_signal)
                     .expect("failed to register vcpu signal handler");
             }
 
@@ -560,7 +561,7 @@ pub fn run_config(cfg: Config) -> Result<()> {
     // blocked connections.
     plugin.signal_kill().map_err(Error::PluginKill)?;
     for handle in vcpu_handles {
-        match handle.kill(0) {
+        match handle.kill(SIGRTMIN() + 0) {
             Ok(_) => {
                 if let Err(e) = handle.join() {
                     error!("failed to join vcpu thread: {:?}", e);