1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 01:27:42 +00:00

Kernel: Remove unused root directory computation in Process creation

sys$fork() already takes care of children inheriting the parent's root
directory, so there was no need to do the same thing when creating a
new user process.
This commit is contained in:
Andreas Kling 2021-02-09 16:22:38 +01:00
parent 1f277f0bd9
commit 085f80aeac

View file

@ -156,21 +156,16 @@ RefPtr<Process> Process::create_user_process(RefPtr<Thread>& first_thread, const
arguments.append(parts.last()); arguments.append(parts.last());
} }
RefPtr<Custody> cwd; RefPtr<Custody> cwd;
RefPtr<Custody> root;
{ {
ScopedSpinLock lock(g_processes_lock); ScopedSpinLock lock(g_processes_lock);
if (auto parent = Process::from_pid(parent_pid)) { if (auto parent = Process::from_pid(parent_pid)) {
cwd = parent->m_cwd; cwd = parent->m_cwd;
root = parent->m_root_directory;
} }
} }
if (!cwd) if (!cwd)
cwd = VFS::the().root_custody(); cwd = VFS::the().root_custody();
if (!root)
root = VFS::the().root_custody();
auto process = adopt(*new Process(first_thread, parts.take_last(), uid, gid, parent_pid, false, move(cwd), nullptr, tty)); auto process = adopt(*new Process(first_thread, parts.take_last(), uid, gid, parent_pid, false, move(cwd), nullptr, tty));
if (!first_thread) if (!first_thread)
return {}; return {};