Skip to content

Commit 56c528a

Browse files
committed
refactor: call set_stdout_nonblocking() inside setup_serial_device()
We always called it right before setup_serial_device(), so just move the call inside. This will also be helpful once setup_serial_device() can setup the serial device to print to a file, where we dont need to mess with stdout in the first place. Signed-off-by: Patrick Roy <[email protected]>
1 parent 8f7f545 commit 56c528a

File tree

1 file changed

+2
-4
lines changed
  • src/vmm/src/device_manager

1 file changed

+2
-4
lines changed

src/vmm/src/device_manager/mod.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,8 @@ impl DeviceManager {
126126
fn setup_serial_device(
127127
event_manager: &mut EventManager,
128128
) -> Result<Arc<Mutex<SerialDevice>>, std::io::Error> {
129+
Self::set_stdout_nonblocking();
130+
129131
let serial = Arc::new(Mutex::new(SerialDevice::new(
130132
Some(std::io::stdin()),
131133
SerialOut::Stdout(std::io::stdout()),
@@ -140,8 +142,6 @@ impl DeviceManager {
140142
vcpus_exit_evt: &EventFd,
141143
vm: &Vm,
142144
) -> Result<PortIODeviceManager, DeviceManagerCreateError> {
143-
Self::set_stdout_nonblocking();
144-
145145
// Create serial device
146146
let serial = Self::setup_serial_device(event_manager)?;
147147
let reset_evt = vcpus_exit_evt
@@ -253,8 +253,6 @@ impl DeviceManager {
253253
.contains("console=");
254254

255255
if cmdline_contains_console {
256-
// Make stdout non-blocking.
257-
Self::set_stdout_nonblocking();
258256
let serial = Self::setup_serial_device(event_manager)?;
259257
self.mmio_devices.register_mmio_serial(vm, serial, None)?;
260258
self.mmio_devices.add_mmio_serial_to_cmdline(cmdline)?;

0 commit comments

Comments
 (0)