@@ -1667,6 +1668,45 @@ fn file_to_i64<P: AsRef<Path>>(path: P) -> io::Result<i64> { .ok_or_else(|| io::Error::new(io::ErrorKind::InvalidData, "empty file")) }
+/// Returns a boolean indicating whether the VM should be exited. +fn do_vm_request( + request: VmRequest, + device_socket: Option<&UnixSeqpacket>, + control_socket: &VmControlResponseSocket, + run_mode_arc: &Arc<VcpuRunMode>, + vcpu_handles: &mut Vec<JoinHandle<()>>, + io_bus: &mut Bus, +) -> MsgResult<bool> { + let mut run_mode_opt = None; + let response = request.execute(&mut run_mode_opt, device_socket); + control_socket.send(&response)?; + if let Some(run_mode) = run_mode_opt { + info!("control socket changed run mode to {}", run_mode); + match run_mode { + VmRunMode::Exiting => Ok(true), + VmRunMode::Running => { + if let VmRunMode::Suspending = *run_mode_arc.mtx.lock() { + io_bus.notify_resume(); + } + run_mode_arc.set_and_notify(VmRunMode::Running); + for handle in vcpu_handles { + let _ = handle.kill(SIGRTMIN() + 0);
I know this is essentially just moved (and probably isn't even something you wrote), but do you know why this is `+ 0`? Does this somehow coerce to the desired type or something? Maybe I'm overlooking something obvious here.
I have no idea! Had a look through the history but couldn't see anything obvious. I remvoed a random + 0 I found, and nothing looked like it went wrong. As an aside, it looks like your MUA has stripped repeated whitespace in the quote above. Makes the code rather difficult to read. :P You might want to look into that.
Either way, the above is just a nit. Good work on tracking this particular issue down!
Reviewed-by: Cole Helbling <cole.e.helbling@outlook.com>
Thanks for the review! Again, much appreciated even though I pushed already, and I'll try to add it retrospectively as a git note. It may interest you to know that this patch actually had a bug in it, which I didn't notice either until I managed to crash crosvm because of it. Here's the fix: https://spectrum-os.org/git/crosvm/commit/?id=ca5bdd2ac3e473e9b082c44c2870f4...