2024-03-27 02:54:39 +00:00
|
|
|
use std::{os::raw::c_int, time::Duration};
|
|
|
|
|
|
|
|
use anyhow::Result;
|
|
|
|
use tokio::time::sleep;
|
|
|
|
use xenstore::{XsdClient, XsdInterface};
|
|
|
|
|
2024-02-23 03:25:06 +00:00
|
|
|
pub mod background;
|
|
|
|
pub mod childwait;
|
2024-04-22 13:13:43 -07:00
|
|
|
pub mod exec;
|
2024-01-22 02:15:53 -08:00
|
|
|
pub mod init;
|
2024-04-12 00:34:46 -07:00
|
|
|
pub mod metrics;
|
2024-03-27 02:54:39 +00:00
|
|
|
|
|
|
|
pub async fn death(code: c_int) -> Result<()> {
|
|
|
|
let store = XsdClient::open().await?;
|
|
|
|
store
|
|
|
|
.write_string("krata/guest/exit-code", &code.to_string())
|
|
|
|
.await?;
|
|
|
|
drop(store);
|
|
|
|
loop {
|
|
|
|
sleep(Duration::from_secs(1)).await;
|
|
|
|
}
|
|
|
|
}
|