feat(init): spawn service over IPC with per-client allowance refunded on child death; up to 4 death watchers; spawntest on test image

This commit is contained in:
2026-10-27 16:21:08 +01:00
parent 817a38993b
commit 8587661684
23 changed files with 564 additions and 28 deletions

View File

@@ -40,22 +40,27 @@ impl<P: Platform> Kernel<P> {
_ => return Err(KernelError::WrongObject),
};
let target = self.target(pid, notification)?;
let slot = self
let watchers = self
.death_watchers
.get_mut(watched.raw() as usize)
.ok_or(KernelError::InvalidProcess(watched))?;
let slot = watchers
.iter_mut()
.find(|w| w.is_none_or(|w| w == target))
.ok_or(KernelError::NoFreeSlot)?;
*slot = Some(target);
Ok(())
}
/// A process is dying: tell its watcher, forget its own timer.
/// A process is dying: tell its watchers, forget its own timer.
pub(crate) fn report_death(&mut self, pid: ProcessId) {
self.timers.clear(pid);
if let Some(target) = self
let watchers = self
.death_watchers
.get_mut(pid.raw() as usize)
.and_then(Option::take)
{
.map(core::mem::take)
.unwrap_or_default();
for target in watchers.into_iter().flatten() {
self.fire(target);
}
}