summaryrefslogtreecommitdiff
path: root/Kernel/Process.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Kernel/Process.cpp')
-rw-r--r--Kernel/Process.cpp18
1 files changed, 17 insertions, 1 deletions
diff --git a/Kernel/Process.cpp b/Kernel/Process.cpp
index 395c469f68..f89b5bc870 100644
--- a/Kernel/Process.cpp
+++ b/Kernel/Process.cpp
@@ -12,6 +12,7 @@
#include <Kernel/FileSystem/FileDescription.h>
#include <Kernel/FileSystem/SharedMemory.h>
#include <Kernel/FileSystem/VirtualFileSystem.h>
+#include <Kernel/IO.h>
#include <Kernel/KSyms.h>
#include <Kernel/Multiboot.h>
#include <Kernel/Net/Socket.h>
@@ -19,8 +20,8 @@
#include <Kernel/ProcessTracer.h>
#include <Kernel/RTC.h>
#include <Kernel/Scheduler.h>
-#include <Kernel/StdLib.h>
#include <Kernel/SharedBuffer.h>
+#include <Kernel/StdLib.h>
#include <Kernel/Syscall.h>
#include <Kernel/TTY/MasterPTY.h>
#include <Kernel/kmalloc.h>
@@ -2635,6 +2636,21 @@ int Process::sys$systrace(pid_t pid)
return fd;
}
+int Process::sys$reboot()
+{
+ if (!is_superuser())
+ return -EPERM;
+
+ dbgprintf("acquiring FS locks...\n");
+ FS::lock_all();
+ dbgprintf("syncing mounted filesystems...\n");
+ FS::sync();
+ dbgprintf("attempting reboot via KB Controller...\n");
+ IO::out8(0x64, 0xFE);
+
+ return ESUCCESS;
+}
+
ProcessTracer& Process::ensure_tracer()
{
if (!m_tracer)