Skip to content

Commit b134e70

Browse files
Enrique SaurezCopilot
andcommitted
integration: adapt CLI liveness to qualified process opening proofs
Compose the existing CLI liveness contract with SL2.10b Opened results. Preserve held-running versus proved-exited distinction and propagate lookup failures. Update only its existing own-process test helper. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: eb3cc7e0-f51e-45ed-b911-c7b214740e05
1 parent 9785ad4 commit b134e70

2 files changed

Lines changed: 17 additions & 10 deletions

File tree

‎nvx-rs/src/host/cli/store/liveness.rs‎

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use super::StateFile;
66
use super::locked::LockedState;
77
use super::record::LaunchJournal;
88
use crate::host::platform;
9-
use crate::host::process::{BootId, Process, ProcessRef};
9+
use crate::host::process::{BootId, Opened, Process, ProcessRef};
1010
use crate::{Error, Result};
1111

1212
impl LockedState {
@@ -51,11 +51,16 @@ fn find(pid: u32) -> io::Result<Option<Process>> {
5151
let Some(start_time) = platform::process_start_time(pid)? else {
5252
return Ok(None);
5353
};
54-
Process::open(&ProcessRef {
55-
pid,
56-
start_time,
57-
boot: BootId::current()?,
58-
})
54+
Ok(
55+
match Process::open(&ProcessRef {
56+
pid,
57+
start_time,
58+
boot: BootId::current()?,
59+
})? {
60+
Opened::Running(process) => Some(process),
61+
Opened::Exited(_) => None,
62+
},
63+
)
5964
}
6065

6166
/// Adapted from the old store's owner check: the second endpoint lookup happens only after

‎nvx-rs/src/host/cli/store/tests/liveness.rs‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,22 @@ use super::launch::prepared;
77
use super::*;
88
use crate::host::cli::store::liveness::hold_endpoint_server;
99
use crate::host::config::ConsoleAttachment;
10-
use crate::host::process::{BootId, Process, ProcessRef};
10+
use crate::host::process::{BootId, Opened, Process, ProcessRef};
1111
use crate::host::spawn::{self, VmmCommand};
1212

1313
const HELPER: &str = "host::cli::store::tests::liveness::log_holder_helper";
1414

1515
fn own_process() -> Process {
1616
let pid = std::process::id();
17-
Process::open(&ProcessRef {
17+
let Opened::Running(process) = Process::open(&ProcessRef {
1818
pid,
1919
start_time: platform::process_start_time(pid).unwrap().unwrap(),
2020
boot: BootId::current().unwrap(),
2121
})
22-
.unwrap()
23-
.unwrap()
22+
.unwrap() else {
23+
panic!("this process runs");
24+
};
25+
process
2426
}
2527

2628
struct Running(Option<spawn::Launched>);

0 commit comments

Comments
 (0)