Utility: kill
Utility: kill - stop a service
Status: Built. As-built reference.
Shape: shell built-in (see 0_conventions.md §2).
Part of the shell's service-control trio with
spawn(10_spawn.md) andrestart(12_restart.md).
1. Purpose
kill terminates a running service: mark it Dead, bump its endpoint generation
(invalidating outstanding caps), drain its queues, and reclaim its frames (§14.4,
§14.5). It is for misbehaving services and as the first half of restart - not a
graceful-shutdown mechanism.
2. Invocation
| Command | Meaning |
|---|---|
kill <name> | Stop the running service named <name>. |
kill <a>,<b>,... | Stop each named service (comma list, no spaces, at most 16 names; a refused or absent one does not stop the rest). supervisor goes after the others and shell last. |
kill all-services | Stop every service the supervisor keeps running (its MANAGED set), then the supervisor, then this shell - a recycle of everything that is restarted, only the kernel surviving. What the supervisor starts for one job (ask, recorder, copier, observe) is not in that set. The set is the supervisor's own MANAGED list, asked at the moment of the command (supcmd::MANAGED, the list ask reads), so a service added to the system is in it without anyone editing the shell. If the supervisor does not answer, nothing is killed and the shell says so. If it names more services than the command holds (32 besides the supervisor and the shell), nothing is killed either: kill all-services: the supervisor runs N services and this command holds M - nothing was done (backlog/84 S4). |
kill (no name) | Prints usage: kill <svc> | <svc>,<svc>,... | all-services ('help kill' for detail). |
3. Behaviour & guards
-
service_controlcapability required.kill(syscall 8) validates theSERVICE_CONTROLresource before doing anything; without it the call returnsCapNotHeld. This closes the §3.1/§14.4 ambient-authority hole - before it, any service could kill any other. Held only by the supervisor and the services it delegates it to: the shell,chaos,controland the test probes. Seedocs/service-control-cap.md. -
Results are one line each:
killed: <name>,not running: <name>(anErr), orkill failed: <name>(anErr). Theobservevariants are refused with a pointer to theobservecommand. -
There is NO TCB guard, and that is deliberate. Nothing here is refused on trusted-root grounds, because the non-restartable set is
{kernel}alone (§6.2, §6.3 - Path C / Phase 6).fsandblock-driverare freely killable and the chaos suite kills them by the thousand; killing thesupervisoris answered by the KERNEL respawning it, which the shell says out loud.initandregistrydo not exist to protect -initwas removed in Phase 5 and theregistryservice retired in Phase 4. -
shellis the one special case, and it is not a refusal either. Killing the shell from the shell self-kills and the supervisor respawns a fresh prompt (the in-flight command is lost - a re-init, not a resume).xhciandehciare not guarded; the shell's own source notes they USED to be.Corrected 2026-09-26. This section promised a kernel TCB guard refusing
init / supervisor / registry / block-driver / fsand a shell guard refusingxhci / ehci / shell. Neither exists.CORE_SERVICESholds one name -"supervisor"- and the guard readsis_core_service(name) && name != "supervisor", so the branch can never fire. A document that invents a safety net is worse than one that admits there is none, because it invites the experiment.
4. Capabilities
SERVICE_CONTROL(WRITE, resource 6) - the gating authority.- Console output for the result / error line.
5. Non-goals
- No graceful shutdown.
killis immediate; the target gets no cleanup codepath. Clean shutdown, if ever needed, is a separate mechanism.
6. Conformance
Conforms: own kill help / kill version (with a real example, per 0_conventions.md); listed by the shell's top-level
help under Services as kill <svc>[,svc,...] | all-services. See 0_conventions.md §3.