mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-01-23 09:46:04 -05:00
Kernel: Use Userspace<T> for the bind syscall, and implementation
This commit is contained in:
parent
2bac7190c8
commit
02660b5d60
Notes:
sideshowbarker
2024-07-19 04:05:11 +09:00
Author: https://github.com/bgianfo Commit: https://github.com/SerenityOS/serenity/commit/02660b5d60a Pull-request: https://github.com/SerenityOS/serenity/pull/3062 Reviewed-by: https://github.com/awesomekling
7 changed files with 7 additions and 7 deletions
|
@ -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))
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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))
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Add table
Reference in a new issue