summaryrefslogtreecommitdiff
path: root/Kernel/Syscalls/shutdown.cpp
diff options
context:
space:
mode:
authorLiav A <liavalb@gmail.com>2021-05-17 01:57:34 +0300
committerLinus Groh <mail@linusgroh.de>2021-05-17 00:30:40 +0100
commite6f333ae001023224ee887b4c00ef39348b6a436 (patch)
tree84680df460e9fcbf42e06109520282d10bd45e4a /Kernel/Syscalls/shutdown.cpp
parent02b73cb93d559202d91f8306cb578a65e263466a (diff)
downloadserenity-e6f333ae001023224ee887b4c00ef39348b6a436.zip
Kernel: Print failed attempt to shutdown the machine
Because we don't parse ACPI AML yet, If we are not able to shut down the machine with "hacky" emulation methods - halt and print this state to the users so they know they can shutdown the machine by themselves.
Diffstat (limited to 'Kernel/Syscalls/shutdown.cpp')
-rw-r--r--Kernel/Syscalls/shutdown.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/Kernel/Syscalls/shutdown.cpp b/Kernel/Syscalls/shutdown.cpp
index 8a666b5249..22338483a6 100644
--- a/Kernel/Syscalls/shutdown.cpp
+++ b/Kernel/Syscalls/shutdown.cpp
@@ -8,6 +8,7 @@
#include <Kernel/FileSystem/FileSystem.h>
#include <Kernel/IO.h>
#include <Kernel/Process.h>
+#include <Kernel/TTY/ConsoleManagement.h>
namespace Kernel {
@@ -37,6 +38,7 @@ KResultOr<int> Process::sys$halt()
return EPERM;
REQUIRE_NO_PROMISES;
+ ConsoleManagement::the().switch_to_debug();
dbgln("acquiring FS locks...");
FS::lock_all();
@@ -50,8 +52,8 @@ KResultOr<int> Process::sys$halt()
// VirtualBox shutdown failed. Try Bochs/Old QEMU shutdown.
IO::out16(0xb004, 0x2000);
dbgln("shutdown attempts failed, applications will stop responding.");
-
- return 0;
+ dmesgln("Shutdown can't be completed. It's safe to turn off the computer!");
+ Processor::halt();
}
}