MCPcopy Create free account
hub / github.com/cloud-hypervisor/cloud-hypervisor / trigger_pty_flush

Method trigger_pty_flush

vmm/src/serial_manager.rs:231–251  ·  view source on GitHub ↗

This function should be called when the other end of the PTY is connected. It verifies if this is the first time it's been invoked after the connection happened, and if that's the case it flushes all output from the serial to the PTY. Otherwise, it's a no-op.

(
        #[cfg(any(target_arch = "x86_64", target_arch = "riscv64"))] serial: &Arc<Mutex<Serial>>,
        #[cfg(target_arch = "aarch64")] serial: &Arc<Mutex<Pl011>>,
        pty_write_out: Option<&A

Source from the content-addressed store, hash-verified

229 // after the connection happened, and if that's the case it flushes
230 // all output from the serial to the PTY. Otherwise, it's a no-op.
231 fn trigger_pty_flush(
232 #[cfg(any(target_arch = "x86_64", target_arch = "riscv64"))] serial: &Arc<Mutex<Serial>>,
233 #[cfg(target_arch = "aarch64")] serial: &Arc<Mutex<Pl011>>,
234 pty_write_out: Option<&Arc<AtomicBool>>,
235 ) -> Result<()> {
236 if let Some(pty_write_out) = &pty_write_out {
237 if pty_write_out.load(Ordering::Acquire) {
238 return Ok(());
239 }
240
241 pty_write_out.store(true, Ordering::Release);
242
243 serial
244 .lock()
245 .unwrap()
246 .flush_output()
247 .map_err(Error::FlushOutput)?;
248 }
249
250 Ok(())
251 }
252
253 pub fn start_thread(&mut self, exit_evt: EventFd) -> Result<()> {
254 // Don't allow this to be run if the handle exists

Callers

nothing calls this directly

Calls 1

flush_outputMethod · 0.45

Tested by

no test coverage detected