1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 08:18:11 +00:00

Kernel: Robustify and rename Inode bound socket API

Rename the bound socket accessor from socket() to bound_socket().
Also return RefPtr<LocalSocket> instead of a raw pointer, to make it
harder for callers to mess up.
This commit is contained in:
Andreas Kling 2022-02-07 12:57:57 +01:00
parent 4bfed6a5ed
commit cda56f8049
4 changed files with 16 additions and 10 deletions

View file

@ -7,6 +7,7 @@
#include <Kernel/Debug.h>
#include <Kernel/FileSystem/Custody.h>
#include <Kernel/FileSystem/VirtualFileSystem.h>
#include <Kernel/Net/LocalSocket.h>
#include <Kernel/Process.h>
namespace Kernel {
@ -56,7 +57,7 @@ ErrorOr<FlatPtr> Process::sys$open(Userspace<const Syscall::SC_open_params*> use
auto description = TRY(VirtualFileSystem::the().open(path->view(), options, mode & ~umask(), *base));
if (description->inode() && description->inode()->socket())
if (description->inode() && description->inode()->bound_socket())
return ENXIO;
return m_fds.with_exclusive([&](auto& fds) -> ErrorOr<FlatPtr> {