mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2025-01-18 18:45:19 +00:00
vmm: do not start signal thread to resize console if no need
Now cloud hypervisor will start signal thread to catch SIGWINCH signal, cloud hypervisor then will resize the guest console via vconsole. This patch skip starting signal thread when there is no need to resize guest console, such as console is not configured. Signed-off-by: Yong He <alexyonghe@tencent.com>
This commit is contained in:
parent
5132e3b907
commit
76d6d28f3e
@ -530,6 +530,14 @@ pub struct Console {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl Console {
|
impl Console {
|
||||||
|
pub fn need_resize(&self) -> bool {
|
||||||
|
if let Some(_resizer) = self.console_resizer.as_ref() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
false
|
||||||
|
}
|
||||||
|
|
||||||
pub fn update_console_size(&self) {
|
pub fn update_console_size(&self) {
|
||||||
if let Some(resizer) = self.console_resizer.as_ref() {
|
if let Some(resizer) = self.console_resizer.as_ref() {
|
||||||
resizer.update_console_size()
|
resizer.update_console_size()
|
||||||
|
@ -1943,6 +1943,11 @@ impl Vm {
|
|||||||
fn setup_signal_handler(&mut self) -> Result<()> {
|
fn setup_signal_handler(&mut self) -> Result<()> {
|
||||||
let console = self.device_manager.lock().unwrap().console().clone();
|
let console = self.device_manager.lock().unwrap().console().clone();
|
||||||
let signals = Signals::new(Vm::HANDLED_SIGNALS);
|
let signals = Signals::new(Vm::HANDLED_SIGNALS);
|
||||||
|
|
||||||
|
if !console.need_resize() {
|
||||||
|
return Ok(());
|
||||||
|
}
|
||||||
|
|
||||||
match signals {
|
match signals {
|
||||||
Ok(signals) => {
|
Ok(signals) => {
|
||||||
self.signals = Some(signals.handle());
|
self.signals = Some(signals.handle());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user