1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 04:27:43 +00:00

FileSystem: Port most of the code over to using custodies.

The current working directory is now stored as a custody. Likewise for a
process executable file. This unbreaks /proc/PID/fd which has not been
working since we made the filesystem bigger.

This still needs a bunch of work, for instance when renaming or removing
a file somewhere, we have to update the relevant custody links.
This commit is contained in:
Andreas Kling 2019-05-30 18:58:59 +02:00
parent 4cb87b1753
commit 393851418b
11 changed files with 280 additions and 220 deletions

View file

@ -55,7 +55,7 @@ KResult LocalSocket::bind(const sockaddr* address, socklen_t address_size)
kprintf("%s(%u) LocalSocket{%p} bind(%s)\n", current->process().name().characters(), current->pid(), this, safe_address);
#endif
auto result = VFS::the().open(safe_address, O_CREAT | O_EXCL, S_IFSOCK | 0666, current->process().cwd_inode());
auto result = VFS::the().open(safe_address, O_CREAT | O_EXCL, S_IFSOCK | 0666, current->process().cwd_custody());
if (result.is_error()) {
if (result.error() == -EEXIST)
return KResult(-EADDRINUSE);
@ -87,7 +87,7 @@ KResult LocalSocket::connect(FileDescriptor& descriptor, const sockaddr* address
kprintf("%s(%u) LocalSocket{%p} connect(%s)\n", current->process().name().characters(), current->pid(), this, safe_address);
#endif
auto descriptor_or_error = VFS::the().open(safe_address, 0, 0, current->process().cwd_inode());
auto descriptor_or_error = VFS::the().open(safe_address, 0, 0, current->process().cwd_custody());
if (descriptor_or_error.is_error())
return KResult(-ECONNREFUSED);
m_file = move(descriptor_or_error.value());