1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 11:28:12 +00:00

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.
This commit is contained in:
Andreas Kling 2021-03-01 13:49:16 +01:00
parent 9af1e1a3bf
commit ac71775de5
70 changed files with 747 additions and 742 deletions

View file

@ -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());