mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 04:58:13 +00:00
Kernel: Begin fleshing out bind() syscall.
This commit is contained in:
parent
2f35e54f80
commit
77177dbb76
7 changed files with 57 additions and 5 deletions
|
@ -2262,9 +2262,20 @@ int Process::sys$socket(int domain, int type, int protocol)
|
|||
return fd;
|
||||
}
|
||||
|
||||
int Process::sys$bind(int sockfd, const sockaddr* addr, socklen_t)
|
||||
int Process::sys$bind(int sockfd, const sockaddr* address, socklen_t address_length)
|
||||
{
|
||||
return -ENOTIMPL;
|
||||
if (!validate_read(address, address_length))
|
||||
return -EFAULT;
|
||||
auto* descriptor = file_descriptor(sockfd);
|
||||
if (!descriptor)
|
||||
return -EBADF;
|
||||
if (!descriptor->is_socket())
|
||||
return -ENOTSOCK;
|
||||
auto& socket = *descriptor->socket();
|
||||
int error;
|
||||
if (!socket.bind(address, address_length, error))
|
||||
return error;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int Process::sys$listen(int sockfd, int backlog)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue