From 4ebebf6d842e919db5c7499ee3b7cc738980cf25 Mon Sep 17 00:00:00 2001 From: dzwdz Date: Mon, 11 Apr 2022 23:00:21 +0200 Subject: kernel: shutdown when init quits thanks to this it's easier to power off - instead of waiting for all processses to quit (which now involves writing `quit` both on serial and ps/2), one of those can just somehow kill init. currently this is just done by exiting from any shell - init will return from await and exit too --- src/kernel/proc.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/kernel/proc.c') diff --git a/src/kernel/proc.c b/src/kernel/proc.c index cf5bb1e..74660fa 100644 --- a/src/kernel/proc.c +++ b/src/kernel/proc.c @@ -137,6 +137,11 @@ void process_kill(struct process *proc, int ret) { proc->state = PS_DEAD; proc->death_msg = ret; process_try2collect(proc); + if (proc == process_first) { + tty_const("init killed, quitting..."); + mem_debugprint(); + cpu_shutdown(); + } } int process_try2collect(struct process *dead) { -- cgit v1.2.3