mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 04:57:44 +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:
parent
cb6734c5e7
commit
8ea4217c01
2 changed files with 4 additions and 12 deletions
|
@ -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)
|
||||
|
|
|
@ -280,7 +280,6 @@ public:
|
|||
size_t amount_purgeable_volatile() const;
|
||||
size_t amount_purgeable_nonvolatile() const;
|
||||
|
||||
Process* fork(RegisterDump&);
|
||||
int exec(String path, Vector<String> arguments, Vector<String> environment);
|
||||
|
||||
bool is_superuser() const { return m_euid == 0; }
|
||||
|
@ -311,7 +310,7 @@ private:
|
|||
friend class Scheduler;
|
||||
friend class Region;
|
||||
|
||||
Process(String&& name, uid_t, gid_t, pid_t ppid, RingLevel, RefPtr<Custody> cwd = nullptr, RefPtr<Custody> executable = nullptr, TTY* = nullptr, Process* fork_parent = nullptr);
|
||||
Process(const String& name, uid_t, gid_t, pid_t ppid, RingLevel, RefPtr<Custody> cwd = nullptr, RefPtr<Custody> executable = nullptr, TTY* = nullptr, Process* fork_parent = nullptr);
|
||||
|
||||
Range allocate_range(VirtualAddress, size_t);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue