Kernel: Use Userspace<T> for the bind syscall, and implementation

This commit is contained in:
Brian Gianforcaro 2020-08-09 15:13:43 -07:00 committed by Andreas Kling
parent 2bac7190c8
commit 02660b5d60
Notes: sideshowbarker 2024-07-19 04:05:11 +09:00
7 changed files with 7 additions and 7 deletions

View file

@ -98,7 +98,7 @@ void IPv4Socket::get_peer_address(sockaddr* address, socklen_t* address_size)
*address_size = sizeof(sockaddr_in);
}
KResult IPv4Socket::bind(const sockaddr* user_address, socklen_t address_size)
KResult IPv4Socket::bind(Userspace<const sockaddr*> user_address, socklen_t address_size)
{
ASSERT(setup_state() == SetupState::Unstarted);
if (address_size != sizeof(sockaddr_in))

View file

@ -49,7 +49,7 @@ public:
static Lockable<HashTable<IPv4Socket*>>& all_sockets();
virtual KResult close() override;
virtual KResult bind(const sockaddr*, socklen_t) override;
virtual KResult bind(Userspace<const sockaddr*>, socklen_t) override;
virtual KResult connect(FileDescription&, const sockaddr*, socklen_t, ShouldBlock = ShouldBlock::Yes) override;
virtual KResult listen(size_t) override;
virtual void get_local_address(sockaddr*, socklen_t*) override;

View file

@ -91,7 +91,7 @@ void LocalSocket::get_peer_address(sockaddr* address, socklen_t* address_size)
get_local_address(address, address_size);
}
KResult LocalSocket::bind(const sockaddr* user_address, socklen_t address_size)
KResult LocalSocket::bind(Userspace<const sockaddr*> user_address, socklen_t address_size)
{
ASSERT(setup_state() == SetupState::Unstarted);
if (address_size != sizeof(sockaddr_un))

View file

@ -51,7 +51,7 @@ public:
String absolute_path(const FileDescription& description) const override;
// ^Socket
virtual KResult bind(const sockaddr*, socklen_t) override;
virtual KResult bind(Userspace<const sockaddr*>, socklen_t) override;
virtual KResult connect(FileDescription&, const sockaddr*, socklen_t, ShouldBlock = ShouldBlock::Yes) override;
virtual KResult listen(size_t) override;
virtual void get_local_address(sockaddr*, socklen_t*) override;

View file

@ -98,7 +98,7 @@ public:
KResult shutdown(int how);
virtual KResult bind(const sockaddr*, socklen_t) = 0;
virtual KResult bind(Userspace<const sockaddr*>, socklen_t) = 0;
virtual KResult connect(FileDescription&, const sockaddr*, socklen_t, ShouldBlock) = 0;
virtual KResult listen(size_t) = 0;
virtual void get_local_address(sockaddr*, socklen_t*) = 0;

View file

@ -291,7 +291,7 @@ public:
int sys$chown(Userspace<const Syscall::SC_chown_params*>);
int sys$fchown(int fd, uid_t, gid_t);
int sys$socket(int domain, int type, int protocol);
int sys$bind(int sockfd, const sockaddr* addr, socklen_t);
int sys$bind(int sockfd, Userspace<const sockaddr*> addr, socklen_t);
int sys$listen(int sockfd, int backlog);
int sys$accept(int sockfd, sockaddr*, socklen_t*);
int sys$connect(int sockfd, const sockaddr*, socklen_t);

View file

@ -63,7 +63,7 @@ int Process::sys$socket(int domain, int type, int protocol)
return fd;
}
int Process::sys$bind(int sockfd, const sockaddr* address, socklen_t address_length)
int Process::sys$bind(int sockfd, Userspace<const sockaddr*> address, socklen_t address_length)
{
if (!validate_read(address, address_length))
return -EFAULT;