mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
vmm: Remove concept of "input_enabled"
This concept ends up being broken with multiple types on input connected e.g. console on TTY and serial on PTY. Already the code for checking for injecting into the serial device checks that the serial is configured. Signed-off-by: Rob Bradford <robert.bradford@intel.com>
This commit is contained in:
@@ -1801,50 +1801,42 @@ impl Vm {
|
||||
}
|
||||
|
||||
fn setup_interactive(&mut self) -> Result<()> {
|
||||
if self
|
||||
.device_manager
|
||||
.lock()
|
||||
.unwrap()
|
||||
.console()
|
||||
.input_enabled()
|
||||
{
|
||||
let console = self.device_manager.lock().unwrap().console().clone();
|
||||
let signals = Signals::new(&HANDLED_SIGNALS);
|
||||
match signals {
|
||||
Ok(signals) => {
|
||||
self.signals = Some(signals.handle());
|
||||
let exit_evt = self.exit_evt.try_clone().map_err(Error::EventFdClone)?;
|
||||
let on_tty = self.on_tty;
|
||||
let signal_handler_seccomp_filter =
|
||||
get_seccomp_filter(&self.seccomp_action, Thread::SignalHandler)
|
||||
.map_err(Error::CreateSeccompFilter)?;
|
||||
self.threads.push(
|
||||
thread::Builder::new()
|
||||
.name("signal_handler".to_string())
|
||||
.spawn(move || {
|
||||
if !signal_handler_seccomp_filter.is_empty() {
|
||||
if let Err(e) = apply_filter(&signal_handler_seccomp_filter)
|
||||
.map_err(Error::ApplySeccompFilter)
|
||||
{
|
||||
error!("Error applying seccomp filter: {:?}", e);
|
||||
return;
|
||||
}
|
||||
let console = self.device_manager.lock().unwrap().console().clone();
|
||||
let signals = Signals::new(&HANDLED_SIGNALS);
|
||||
match signals {
|
||||
Ok(signals) => {
|
||||
self.signals = Some(signals.handle());
|
||||
let exit_evt = self.exit_evt.try_clone().map_err(Error::EventFdClone)?;
|
||||
let on_tty = self.on_tty;
|
||||
let signal_handler_seccomp_filter =
|
||||
get_seccomp_filter(&self.seccomp_action, Thread::SignalHandler)
|
||||
.map_err(Error::CreateSeccompFilter)?;
|
||||
self.threads.push(
|
||||
thread::Builder::new()
|
||||
.name("signal_handler".to_string())
|
||||
.spawn(move || {
|
||||
if !signal_handler_seccomp_filter.is_empty() {
|
||||
if let Err(e) = apply_filter(&signal_handler_seccomp_filter)
|
||||
.map_err(Error::ApplySeccompFilter)
|
||||
{
|
||||
error!("Error applying seccomp filter: {:?}", e);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Vm::os_signal_handler(signals, console, on_tty, exit_evt);
|
||||
})
|
||||
.map_err(Error::SignalHandlerSpawn)?,
|
||||
);
|
||||
}
|
||||
Err(e) => error!("Signal not found {}", e),
|
||||
Vm::os_signal_handler(signals, console, on_tty, exit_evt);
|
||||
})
|
||||
.map_err(Error::SignalHandlerSpawn)?,
|
||||
);
|
||||
}
|
||||
Err(e) => error!("Signal not found {}", e),
|
||||
}
|
||||
|
||||
if self.on_tty {
|
||||
io::stdin()
|
||||
.lock()
|
||||
.set_raw_mode()
|
||||
.map_err(Error::SetTerminalRaw)?;
|
||||
}
|
||||
if self.on_tty {
|
||||
io::stdin()
|
||||
.lock()
|
||||
.set_raw_mode()
|
||||
.map_err(Error::SetTerminalRaw)?;
|
||||
}
|
||||
|
||||
Ok(())
|
||||
@@ -1935,11 +1927,9 @@ impl Vm {
|
||||
let mut out = [0u8; 64];
|
||||
let count = pty.main.read(&mut out).map_err(Error::PtyConsole)?;
|
||||
let console = dm.console();
|
||||
if console.input_enabled() {
|
||||
console
|
||||
.queue_input_bytes_serial(&out[..count])
|
||||
.map_err(Error::Console)?;
|
||||
}
|
||||
console
|
||||
.queue_input_bytes_serial(&out[..count])
|
||||
.map_err(Error::Console)?;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user