mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 10:28:10 +00:00
Kernel: Process::cwd_inode() should return a reference.
There's always a current working directory inode.
This commit is contained in:
parent
ce3b548077
commit
f0a869ea50
4 changed files with 23 additions and 36 deletions
|
@ -339,10 +339,7 @@ ByteBuffer procfs$pid_cwd(InodeIdentifier identifier)
|
|||
auto handle = ProcessInspectionHandle::from_pid(to_pid(identifier));
|
||||
if (!handle)
|
||||
return { };
|
||||
auto& process = handle->process();
|
||||
auto inode = process.cwd_inode();
|
||||
ASSERT(inode);
|
||||
return VFS::the().absolute_path(*inode).to_byte_buffer();
|
||||
return VFS::the().absolute_path(handle->process().cwd_inode()).to_byte_buffer();
|
||||
}
|
||||
|
||||
ByteBuffer procfs$self(InodeIdentifier)
|
||||
|
@ -902,12 +899,8 @@ bool ProcFSInode::traverse_as_directory(Function<bool(const FS::DirectoryEntry&)
|
|||
auto& process = handle->process();
|
||||
for (auto& entry : fs().m_entries) {
|
||||
if (entry.proc_file_type > __FI_PID_Start && entry.proc_file_type < __FI_PID_End) {
|
||||
if (entry.proc_file_type == FI_PID_exe || entry.proc_file_type == FI_PID_cwd) {
|
||||
if (entry.proc_file_type == FI_PID_exe && !process.executable_inode())
|
||||
continue;
|
||||
if (entry.proc_file_type == FI_PID_cwd && !process.cwd_inode())
|
||||
continue;
|
||||
}
|
||||
if (entry.proc_file_type == FI_PID_exe && !process.executable_inode())
|
||||
continue;
|
||||
// FIXME: strlen() here is sad.
|
||||
callback({ entry.name, strlen(entry.name), to_identifier(fsid(), PDI_PID, pid, (ProcFileType)entry.proc_file_type), 0 });
|
||||
}
|
||||
|
@ -987,12 +980,8 @@ InodeIdentifier ProcFSInode::lookup(const String& name)
|
|||
auto& process = handle->process();
|
||||
for (auto& entry : fs().m_entries) {
|
||||
if (entry.proc_file_type > __FI_PID_Start && entry.proc_file_type < __FI_PID_End) {
|
||||
if (entry.proc_file_type == FI_PID_exe || entry.proc_file_type == FI_PID_cwd) {
|
||||
if (entry.proc_file_type == FI_PID_exe && !process.executable_inode())
|
||||
continue;
|
||||
if (entry.proc_file_type == FI_PID_cwd && !process.cwd_inode())
|
||||
continue;
|
||||
}
|
||||
if (entry.proc_file_type == FI_PID_exe && !process.executable_inode())
|
||||
continue;
|
||||
if (entry.name == nullptr)
|
||||
continue;
|
||||
if (!strcmp(entry.name, name.characters())) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue