1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 20:57:35 +00:00

Kernel/Userland: Add a halt syscall, and a shutdown binary to invoke it

This commit is contained in:
Robin Burchell 2019-06-16 11:49:39 +02:00 committed by Andreas Kling
parent 9e0f7acfe5
commit 952382b413
5 changed files with 38 additions and 1 deletions

17
Userland/shutdown.cpp Normal file
View file

@ -0,0 +1,17 @@
#include <Kernel/Syscall.h>
#include <LibCore/CArgsParser.h>
int main(int argc, char** argv)
{
CArgsParser args_parser("shutdown");
args_parser.add_arg("n", "shut down now");
CArgsParserResult args = args_parser.parse(argc, (const char**)argv);
if (args.is_present("n")) {
syscall(SC_halt);
return 0;
} else {
args_parser.print_usage();
return 0;
}
}