Kernel: Make VirtualFileSystem::File non copyable

This commit is contained in:
2024-09-14 19:44:51 +03:00
parent 6060b39548
commit 3a352078de
5 changed files with 30 additions and 7 deletions

View File

@@ -123,7 +123,7 @@ namespace Kernel
memcpy(address, &connection.target.address, *address_len);
}
return TRY(Process::current().open_inode(return_inode, O_RDWR | flags));
return TRY(Process::current().open_inode(VirtualFileSystem::File(return_inode, "<tcp socket>"_sv), O_RDWR | flags));
}
BAN::ErrorOr<void> TCPSocket::connect_impl(const sockaddr* address, socklen_t address_len)

View File

@@ -104,7 +104,7 @@ namespace Kernel
strncpy(sockaddr_un.sun_path, pending->m_bound_path.data(), copy_len);
}
return TRY(Process::current().open_inode(return_inode, O_RDWR | flags));
return TRY(Process::current().open_inode(VirtualFileSystem::File(return_inode, "<unix socket>"_sv), O_RDWR | flags));
}
BAN::ErrorOr<void> UnixDomainSocket::connect_impl(const sockaddr* address, socklen_t address_len)

View File

@@ -875,11 +875,11 @@ namespace Kernel
return false;
}
BAN::ErrorOr<long> Process::open_inode(BAN::RefPtr<Inode> inode, int flags)
BAN::ErrorOr<long> Process::open_inode(VirtualFileSystem::File&& file, int flags)
{
ASSERT(inode);
ASSERT(file.inode);
LockGuard _(m_process_lock);
return TRY(m_open_file_descriptors.open(VirtualFileSystem::File { .inode = inode, .canonical_path = {} }, flags));
return TRY(m_open_file_descriptors.open(BAN::move(file), flags));
}
BAN::ErrorOr<long> Process::open_file(BAN::StringView path, int flags, mode_t mode)