summaryrefslogtreecommitdiff
path: root/Kernel/CommandLine.cpp
diff options
context:
space:
mode:
authorLiav A <liavalb@gmail.com>2021-05-14 00:22:02 +0300
committerAndreas Kling <kling@serenityos.org>2021-05-16 19:58:33 +0200
commitab52108982a40dd1db23962d820e90ce32604e66 (patch)
tree6e334b1759c31389001ff7f6d0887cbe6cf2ed07 /Kernel/CommandLine.cpp
parent99eab4667a7afcf7a6106e4b6472840fb2a21151 (diff)
downloadserenity-ab52108982a40dd1db23962d820e90ce32604e66.zip
Kernel: Allow the user to specify the virtual console when booting
Diffstat (limited to 'Kernel/CommandLine.cpp')
-rw-r--r--Kernel/CommandLine.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/Kernel/CommandLine.cpp b/Kernel/CommandLine.cpp
index 6740fad3c0..37765fbe23 100644
--- a/Kernel/CommandLine.cpp
+++ b/Kernel/CommandLine.cpp
@@ -201,4 +201,13 @@ Vector<String> CommandLine::userspace_init_args() const
return init_args;
}
+UNMAP_AFTER_INIT size_t CommandLine::switch_to_tty() const
+{
+ const auto default_tty = lookup("switch_to_tty").value_or("1");
+ auto switch_tty_number = default_tty.to_uint();
+ if (switch_tty_number.has_value() && switch_tty_number.value() >= 1) {
+ return switch_tty_number.value() - 1;
+ }
+ PANIC("Invalid default tty value: {}", default_tty);
+}
}