diff options
author | Robin Burchell <robin+git@viroteck.net> | 2019-06-16 11:49:39 +0200 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2019-06-16 12:25:30 +0200 |
commit | 952382b413484f3d81e7387e8ec0916bd5f48dc1 (patch) | |
tree | 67e405b94cc23ec366c7839d9ac50c9e10ee3739 /Userland/shutdown.cpp | |
parent | 9e0f7acfe5d7529cf65d86cfd229780aca8c3694 (diff) | |
download | serenity-952382b413484f3d81e7387e8ec0916bd5f48dc1.zip |
Kernel/Userland: Add a halt syscall, and a shutdown binary to invoke it
Diffstat (limited to 'Userland/shutdown.cpp')
-rw-r--r-- | Userland/shutdown.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/Userland/shutdown.cpp b/Userland/shutdown.cpp new file mode 100644 index 0000000000..7884f12c15 --- /dev/null +++ b/Userland/shutdown.cpp @@ -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; + } +} |