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

Kernel: Merge Process::fork() into sys$fork()

There was no good reason for this to be a separate function.
This commit is contained in:
Andreas Kling 2019-12-19 19:07:41 +01:00
parent cb6734c5e7
commit 8ea4217c01
2 changed files with 4 additions and 12 deletions

View file

@ -405,9 +405,9 @@ int Process::sys$gethostname(char* buffer, ssize_t size)
return 0;
}
Process* Process::fork(RegisterDump& regs)
pid_t Process::sys$fork(RegisterDump& regs)
{
auto* child = new Process(String(m_name), m_uid, m_gid, m_pid, m_ring, m_cwd, m_executable, m_tty, this);
auto* child = new Process(m_name, m_uid, m_gid, m_pid, m_ring, m_cwd, m_executable, m_tty, this);
#ifdef FORK_DEBUG
dbgprintf("fork: child=%p\n", child);
@ -459,13 +459,6 @@ Process* Process::fork(RegisterDump& regs)
child->main_thread().set_state(Thread::State::Skip1SchedulerPass);
return child;
}
pid_t Process::sys$fork(RegisterDump& regs)
{
auto* child = fork(regs);
ASSERT(child);
return child->pid();
}
@ -846,7 +839,7 @@ Process* Process::create_kernel_process(String&& name, void (*e)())
return process;
}
Process::Process(String&& name, uid_t uid, gid_t gid, pid_t ppid, RingLevel ring, RefPtr<Custody> cwd, RefPtr<Custody> executable, TTY* tty, Process* fork_parent)
Process::Process(const String& name, uid_t uid, gid_t gid, pid_t ppid, RingLevel ring, RefPtr<Custody> cwd, RefPtr<Custody> executable, TTY* tty, Process* fork_parent)
: m_name(move(name))
, m_pid(next_pid++) // FIXME: RACE: This variable looks racy!
, m_uid(uid)