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

@@ -161,3 +161,21 @@ fn notification_id(
_ => panic!("not a notification"),
}
}
#[test]
fn every_watcher_hears_and_there_is_room_for_a_few() {
let (mut k, init, proc_cap, first) = watching();
let second = k.create_notification_cap(init).unwrap();
k.watch_death(init, proc_cap, second).unwrap();
// The same notification again takes no new place.
k.watch_death(init, proc_cap, second).unwrap();
for _ in 2..domain::timer::MAX_WATCHERS {
let n = k.create_notification_cap(init).unwrap();
k.watch_death(init, proc_cap, n).unwrap();
}
let extra = k.create_notification_cap(init).unwrap();
assert!(k.watch_death(init, proc_cap, extra).is_err());
k.handle_syscall(Syscall::Kill { process: proc_cap });
assert_eq!(k.poll(init, first).unwrap(), 1);
assert_eq!(k.poll(init, second).unwrap(), 1);
}