pub struct ConsoleBuilder { /* private fields */ }Expand description
Implementations§
Source§impl ConsoleBuilder
impl ConsoleBuilder
Sourcepub fn port(self, name: &str, input_fd: RawFd, output_fd: RawFd) -> Self
pub fn port(self, name: &str, input_fd: RawFd, output_fd: RawFd) -> Self
Add a bidirectional I/O port to the console device.
Creates a named port accessible in the guest via /sys/class/virtio-ports/<name>.
The host reads from input_fd and writes to output_fd. Pass the same FD for both
when using a bidirectional socket.
Sourcepub fn port_tty(self, name: &str, tty_fd: RawFd) -> Self
pub fn port_tty(self, name: &str, tty_fd: RawFd) -> Self
Add a TTY port to the console device.
Creates a named port accessible in the guest via /sys/class/virtio-ports/<name>.
The tty_fd must be a valid terminal file descriptor. Terminal raw mode is configured
automatically.
Sourcepub fn disable_implicit(self) -> Self
pub fn disable_implicit(self) -> Self
Disable the implicit console device.
By default libkrun creates an implicit console that reads from STDIN_FILENO.
Call this to suppress that console when using only explicit ports.
Sourcepub fn custom(self, name: &str, backend: Box<dyn ConsolePortBackend>) -> Self
pub fn custom(self, name: &str, backend: Box<dyn ConsolePortBackend>) -> Self
Add a custom console port backend.
The backend provides bidirectional byte I/O without file descriptors
on the data path, matching the pattern of
NetBuilder::custom() and
FsBuilder::custom().
§Example
VmBuilder::new()
.console(|c| c.custom("agent", Box::new(my_backend)))