mirror of
https://github.com/RGBCube/serenity
synced 2025-05-25 21:15:06 +00:00
Kernel: Don't forget to copy & destroy root_directory_for_procfs
Also, rename it to root_directory_relative_to_global_root.
This commit is contained in:
parent
8ca6e63119
commit
33c0dc08a7
3 changed files with 10 additions and 8 deletions
|
@ -577,7 +577,7 @@ Optional<KBuffer> procfs$pid_root(InodeIdentifier identifier)
|
||||||
auto handle = ProcessInspectionHandle::from_pid(to_pid(identifier));
|
auto handle = ProcessInspectionHandle::from_pid(to_pid(identifier));
|
||||||
if (!handle)
|
if (!handle)
|
||||||
return {};
|
return {};
|
||||||
return handle->process().root_directory_for_procfs().absolute_path().to_byte_buffer();
|
return handle->process().root_directory_relative_to_global_root().absolute_path().to_byte_buffer();
|
||||||
}
|
}
|
||||||
|
|
||||||
Optional<KBuffer> procfs$self(InodeIdentifier)
|
Optional<KBuffer> procfs$self(InodeIdentifier)
|
||||||
|
|
|
@ -578,6 +578,7 @@ pid_t Process::sys$fork(RegisterDump& regs)
|
||||||
Thread* child_first_thread = nullptr;
|
Thread* child_first_thread = nullptr;
|
||||||
auto* child = new Process(child_first_thread, m_name, m_uid, m_gid, m_pid, m_ring, m_cwd, m_executable, m_tty, this);
|
auto* child = new Process(child_first_thread, m_name, m_uid, m_gid, m_pid, m_ring, m_cwd, m_executable, m_tty, this);
|
||||||
child->m_root_directory = m_root_directory;
|
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;
|
child->m_promises = m_promises;
|
||||||
child->m_execpromises = m_execpromises;
|
child->m_execpromises = m_execpromises;
|
||||||
|
|
||||||
|
@ -2769,6 +2770,7 @@ void Process::finalize()
|
||||||
m_executable = nullptr;
|
m_executable = nullptr;
|
||||||
m_cwd = nullptr;
|
m_cwd = nullptr;
|
||||||
m_root_directory = nullptr;
|
m_root_directory = nullptr;
|
||||||
|
m_root_directory_relative_to_global_root = nullptr;
|
||||||
m_elf_loader = nullptr;
|
m_elf_loader = nullptr;
|
||||||
|
|
||||||
disown_all_shared_buffers();
|
disown_all_shared_buffers();
|
||||||
|
@ -4325,7 +4327,7 @@ int Process::sys$set_process_boost(pid_t pid, int amount)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Process::sys$chroot(const char* user_path, size_t path_length)
|
int Process::sys$chroot(const char* user_path, size_t path_length, int mount_flags)
|
||||||
{
|
{
|
||||||
if (!is_superuser())
|
if (!is_superuser())
|
||||||
return -EPERM;
|
return -EPERM;
|
||||||
|
@ -4350,11 +4352,11 @@ Custody& Process::root_directory()
|
||||||
return *m_root_directory;
|
return *m_root_directory;
|
||||||
}
|
}
|
||||||
|
|
||||||
Custody& Process::root_directory_for_procfs()
|
Custody& Process::root_directory_relative_to_global_root()
|
||||||
{
|
{
|
||||||
if (!m_root_directory_for_procfs)
|
if (!m_root_directory_relative_to_global_root)
|
||||||
m_root_directory_for_procfs = root_directory();
|
m_root_directory_relative_to_global_root = root_directory();
|
||||||
return *m_root_directory_for_procfs;
|
return *m_root_directory_relative_to_global_root;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Process::set_root_directory(const Custody& root)
|
void Process::set_root_directory(const Custody& root)
|
||||||
|
|
|
@ -339,7 +339,7 @@ public:
|
||||||
u32 priority_boost() const { return m_priority_boost; }
|
u32 priority_boost() const { return m_priority_boost; }
|
||||||
|
|
||||||
Custody& root_directory();
|
Custody& root_directory();
|
||||||
Custody& root_directory_for_procfs();
|
Custody& root_directory_relative_to_global_root();
|
||||||
void set_root_directory(const Custody&);
|
void set_root_directory(const Custody&);
|
||||||
|
|
||||||
bool has_promises() const { return m_promises; }
|
bool has_promises() const { return m_promises; }
|
||||||
|
@ -407,7 +407,7 @@ private:
|
||||||
RefPtr<Custody> m_executable;
|
RefPtr<Custody> m_executable;
|
||||||
RefPtr<Custody> m_cwd;
|
RefPtr<Custody> m_cwd;
|
||||||
RefPtr<Custody> m_root_directory;
|
RefPtr<Custody> m_root_directory;
|
||||||
RefPtr<Custody> m_root_directory_for_procfs;
|
RefPtr<Custody> m_root_directory_relative_to_global_root;
|
||||||
|
|
||||||
RefPtr<TTY> m_tty;
|
RefPtr<TTY> m_tty;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue