diff options
author | Andreas Kling <kling@serenityos.org> | 2021-03-01 13:49:16 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-03-01 13:54:32 +0100 |
commit | ac71775de5a71945e004f46b184dde4f628d112b (patch) | |
tree | bac755ef16ba74bd63d3a359e6aad9e32d2734ae /Kernel/Syscalls/fork.cpp | |
parent | 9af1e1a3bf43140dee327eb4f553c56ba95ad9d9 (diff) | |
download | serenity-ac71775de5a71945e004f46b184dde4f628d112b.zip |
Kernel: Make all syscall functions return KResultOr<T>
This makes it a lot easier to return errors since we no longer have to
worry about negating EFOO errors and can just return them flat.
Diffstat (limited to 'Kernel/Syscalls/fork.cpp')
-rw-r--r-- | Kernel/Syscalls/fork.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/Kernel/Syscalls/fork.cpp b/Kernel/Syscalls/fork.cpp index 44171c2776..4b462bb672 100644 --- a/Kernel/Syscalls/fork.cpp +++ b/Kernel/Syscalls/fork.cpp @@ -32,13 +32,13 @@ namespace Kernel { -pid_t Process::sys$fork(RegisterState& regs) +KResultOr<pid_t> Process::sys$fork(RegisterState& regs) { REQUIRE_PROMISE(proc); RefPtr<Thread> child_first_thread; auto child = adopt(*new Process(child_first_thread, m_name, m_uid, m_gid, m_pid, m_is_kernel_process, m_cwd, m_executable, m_tty, this)); if (!child_first_thread) - return -ENOMEM; + return ENOMEM; child->m_root_directory = m_root_directory; child->m_root_directory_relative_to_global_root = m_root_directory_relative_to_global_root; child->m_promises = m_promises; @@ -85,7 +85,7 @@ pid_t Process::sys$fork(RegisterState& regs) if (!region_clone) { dbgln("fork: Cannot clone region, insufficient memory"); // TODO: tear down new process? - return -ENOMEM; + return ENOMEM; } auto& child_region = child->space().add_region(region_clone.release_nonnull()); |