mirror of
https://github.com/edera-dev/krata.git
synced 2025-08-04 05:31:32 +00:00
Add support for reading hypervisor console (#344)
* feature(xencall): add hypervisor SYSCTL_readconsole definitions * feature(hypervisor-dmesg): xencall: add read_console_ring_raw hypercall wrapper * feature(hypervisor-dmesg): protobuf: add ReadHypervisorConsoleRing RPC * feature(hypervisor-dmesg): runtime: add read_hypervisor_console wrapper * feature(hypervisor-dmesg): daemon: add ReadHypervisorConsoleRing rpc implementation * feature(hypervisor-dmesg): ctl: add host hypervisor-messages command to get hypervisor messages * feature(hypervisor-dmesg): cli: rename hypervisor-messages command to hv-console * feature(hypervisor-dmesg): proto: change ReadHypervisorConsoleRing to ReadHypervisorConsole * feature(hypervisor-dmesg): fix up kratactl protobuf calls
This commit is contained in:
18
crates/xen/xencall/examples/console_read.rs
Normal file
18
crates/xen/xencall/examples/console_read.rs
Normal file
@ -0,0 +1,18 @@
|
||||
use xencall::error::Result;
|
||||
use xencall::XenCall;
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() -> Result<()> {
|
||||
env_logger::init();
|
||||
|
||||
let call = XenCall::open(0)?;
|
||||
let index = 0 as u32;
|
||||
let (buf, newindex) = call.read_console_ring_raw(false, index).await?;
|
||||
|
||||
match std::str::from_utf8(&buf[..newindex as usize]) {
|
||||
Ok(v) => print!("{}", v),
|
||||
_ => panic!("unable to decode Xen console messages"),
|
||||
};
|
||||
|
||||
Ok(())
|
||||
}
|
Reference in New Issue
Block a user