Explorar o código

Kernel: Rename Process::create() => try_create()

Andreas Kling %!s(int64=3) %!d(string=hai) anos
pai
achega
5e2e17c38c
Modificáronse 3 ficheiros con 5 adicións e 5 borrados
  1. 3 3
      Kernel/Process.cpp
  2. 1 1
      Kernel/Process.h
  3. 1 1
      Kernel/Syscalls/fork.cpp

+ 3 - 3
Kernel/Process.cpp

@@ -156,7 +156,7 @@ RefPtr<Process> Process::create_user_process(RefPtr<Thread>& first_thread, const
     if (!cwd)
         cwd = VirtualFileSystem::the().root_custody();
 
-    auto process = Process::create(first_thread, parts.take_last(), uid, gid, parent_pid, false, move(cwd), nullptr, tty);
+    auto process = Process::try_create(first_thread, parts.take_last(), uid, gid, parent_pid, false, move(cwd), nullptr, tty);
     if (!first_thread)
         return {};
     if (!process->m_fds.try_resize(process->m_fds.max_open())) {
@@ -197,7 +197,7 @@ RefPtr<Process> Process::create_user_process(RefPtr<Thread>& first_thread, const
 
 RefPtr<Process> Process::create_kernel_process(RefPtr<Thread>& first_thread, String&& name, void (*entry)(void*), void* entry_data, u32 affinity, RegisterProcess do_register)
 {
-    auto process = Process::create(first_thread, move(name), UserID(0), GroupID(0), ProcessID(0), true);
+    auto process = Process::try_create(first_thread, move(name), UserID(0), GroupID(0), ProcessID(0), true);
     if (!first_thread || !process)
         return {};
     first_thread->regs().set_ip((FlatPtr)entry);
@@ -230,7 +230,7 @@ void Process::unprotect_data()
     });
 }
 
-RefPtr<Process> Process::create(RefPtr<Thread>& first_thread, const String& name, UserID uid, GroupID gid, ProcessID ppid, bool is_kernel_process, RefPtr<Custody> cwd, RefPtr<Custody> executable, TTY* tty, Process* fork_parent)
+RefPtr<Process> Process::try_create(RefPtr<Thread>& first_thread, const String& name, UserID uid, GroupID gid, ProcessID ppid, bool is_kernel_process, RefPtr<Custody> cwd, RefPtr<Custody> executable, TTY* tty, Process* fork_parent)
 {
     auto space = Memory::AddressSpace::try_create(fork_parent ? &fork_parent->address_space() : nullptr);
     if (!space)

+ 1 - 1
Kernel/Process.h

@@ -519,7 +519,7 @@ private:
     bool remove_thread(Thread&);
 
     Process(const String& name, UserID, GroupID, ProcessID ppid, bool is_kernel_process, RefPtr<Custody> cwd, RefPtr<Custody> executable, TTY* tty);
-    static RefPtr<Process> create(RefPtr<Thread>& first_thread, const String& name, UserID, GroupID, ProcessID ppid, bool is_kernel_process, RefPtr<Custody> cwd = nullptr, RefPtr<Custody> executable = nullptr, TTY* = nullptr, Process* fork_parent = nullptr);
+    static RefPtr<Process> try_create(RefPtr<Thread>& first_thread, String const& name, UserID, GroupID, ProcessID ppid, bool is_kernel_process, RefPtr<Custody> cwd = nullptr, RefPtr<Custody> executable = nullptr, TTY* = nullptr, Process* fork_parent = nullptr);
     KResult attach_resources(NonnullOwnPtr<Memory::AddressSpace>&&, RefPtr<Thread>& first_thread, Process* fork_parent);
     static ProcessID allocate_pid();
 

+ 1 - 1
Kernel/Syscalls/fork.cpp

@@ -18,7 +18,7 @@ KResultOr<FlatPtr> Process::sys$fork(RegisterState& regs)
     VERIFY_PROCESS_BIG_LOCK_ACQUIRED(this);
     REQUIRE_PROMISE(proc);
     RefPtr<Thread> child_first_thread;
-    auto child = Process::create(child_first_thread, m_name, uid(), gid(), pid(), m_is_kernel_process, m_cwd, m_executable, m_tty, this);
+    auto child = Process::try_create(child_first_thread, m_name, uid(), gid(), pid(), m_is_kernel_process, m_cwd, m_executable, m_tty, this);
     if (!child || !child_first_thread)
         return ENOMEM;
     child->m_veil_state = m_veil_state;