summaryrefslogtreecommitdiff
path: root/Kernel/init.cpp
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2021-09-04 22:36:06 +0200
committerAndreas Kling <kling@serenityos.org>2021-09-04 23:11:04 +0200
commit3b995c6d01239cf2099b764917082284fea30c31 (patch)
tree9424990293525c0e5dda6d6178cdf6315729fe2d /Kernel/init.cpp
parentba1a6ca971fcdd8ff145af995d2cbb963ec3f3c3 (diff)
downloadserenity-3b995c6d01239cf2099b764917082284fea30c31.zip
Kernel: Tidy up Process::try_create_user_process()
This function is currently only ever used to create the init process (SystemServer). It had a few idiosyncratic things about it that this patch cleans up: - Errors were returned in an int& out-param. - It had a path for non-0 process PIDs which was never taken.
Diffstat (limited to 'Kernel/init.cpp')
-rw-r--r--Kernel/init.cpp11
1 files changed, 5 insertions, 6 deletions
diff --git a/Kernel/init.cpp b/Kernel/init.cpp
index 1da79c63c9..ebb84c030b 100644
--- a/Kernel/init.cpp
+++ b/Kernel/init.cpp
@@ -336,18 +336,17 @@ void init_stage2(void*)
// NOTE: Everything in the .ksyms section becomes inaccessible after this point.
MM.unmap_ksyms_after_init();
- int error;
-
// FIXME: It would be nicer to set the mode from userspace.
// FIXME: It would be smarter to not hardcode that the first tty is the only graphical one
ConsoleManagement::the().first_tty()->set_graphical(GraphicsManagement::the().framebuffer_devices_exist());
RefPtr<Thread> thread;
auto userspace_init = kernel_command_line().userspace_init();
auto init_args = kernel_command_line().userspace_init_args();
- Process::create_user_process(thread, userspace_init, UserID(0), GroupID(0), ProcessID(0), error, move(init_args), {}, tty0);
- if (error != 0) {
- PANIC("init_stage2: Error spawning SystemServer: {}", error);
- }
+
+ auto init_or_error = Process::try_create_user_process(thread, userspace_init, UserID(0), GroupID(0), move(init_args), {}, tty0);
+ if (init_or_error.is_error())
+ PANIC("init_stage2: Error spawning init process: {}", init_or_error.error());
+
thread->set_priority(THREAD_PRIORITY_HIGH);
if (boot_profiling) {