Kernel: Add /proc/<n>/cwd
Also update /proc/<n>/* permissions to match what linux does :D
This commit is contained in:
parent
812e70c626
commit
fff5139d80
|
|
@ -233,7 +233,8 @@ namespace Kernel
|
|||
size_t proc_meminfo(off_t offset, BAN::ByteSpan) const;
|
||||
size_t proc_cmdline(off_t offset, BAN::ByteSpan) const;
|
||||
size_t proc_environ(off_t offset, BAN::ByteSpan) const;
|
||||
BAN::ErrorOr<BAN::String> proc_executable() const;
|
||||
BAN::ErrorOr<BAN::String> proc_cwd() const;
|
||||
BAN::ErrorOr<BAN::String> proc_exe() const;
|
||||
|
||||
BAN::StringView executable() const { return m_executable; }
|
||||
|
||||
|
|
|
|||
|
|
@ -15,9 +15,10 @@ namespace Kernel
|
|||
TRY(inode->link_inode(*inode, "."_sv));
|
||||
TRY(inode->link_inode(static_cast<TmpInode&>(*fs.root_inode()), ".."_sv));
|
||||
TRY(inode->link_inode(*MUST(ProcROProcessInode::create_new(process, &Process::proc_meminfo, fs, 0400)), "meminfo"_sv));
|
||||
TRY(inode->link_inode(*MUST(ProcROProcessInode::create_new(process, &Process::proc_cmdline, fs, 0400)), "cmdline"_sv));
|
||||
TRY(inode->link_inode(*MUST(ProcROProcessInode::create_new(process, &Process::proc_cmdline, fs, 0444)), "cmdline"_sv));
|
||||
TRY(inode->link_inode(*MUST(ProcROProcessInode::create_new(process, &Process::proc_environ, fs, 0400)), "environ"_sv));
|
||||
TRY(inode->link_inode(*MUST(ProcSymlinkProcessInode::create_new(process, &Process::proc_executable, fs, 0400)), "exe"_sv));
|
||||
TRY(inode->link_inode(*MUST(ProcSymlinkProcessInode::create_new(process, &Process::proc_cwd, fs, 0777)), "cwd"_sv));
|
||||
TRY(inode->link_inode(*MUST(ProcSymlinkProcessInode::create_new(process, &Process::proc_exe, fs, 0777)), "exe"_sv));
|
||||
|
||||
return inode;
|
||||
}
|
||||
|
|
@ -33,6 +34,7 @@ namespace Kernel
|
|||
(void)TmpDirectoryInode::unlink_impl("meminfo"_sv);
|
||||
(void)TmpDirectoryInode::unlink_impl("cmdline"_sv);
|
||||
(void)TmpDirectoryInode::unlink_impl("environ"_sv);
|
||||
(void)TmpDirectoryInode::unlink_impl("cwd"_sv);
|
||||
(void)TmpDirectoryInode::unlink_impl("exe"_sv);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -508,7 +508,15 @@ namespace Kernel
|
|||
return read_from_vec_of_str(m_environ, offset, buffer);
|
||||
}
|
||||
|
||||
BAN::ErrorOr<BAN::String> Process::proc_executable() const
|
||||
BAN::ErrorOr<BAN::String> Process::proc_cwd() const
|
||||
{
|
||||
LockGuard _(m_process_lock);
|
||||
BAN::String result;
|
||||
TRY(result.append(m_working_directory.canonical_path));
|
||||
return result;
|
||||
}
|
||||
|
||||
BAN::ErrorOr<BAN::String> Process::proc_exe() const
|
||||
{
|
||||
LockGuard _(m_process_lock);
|
||||
BAN::String result;
|
||||
|
|
|
|||
Loading…
Reference in New Issue