mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 22:57:44 +00:00
Kernel+Userspace: Implement the accept4() system call
Unlike accept() the new accept4() system call lets the caller specify flags for the newly accepted socket file descriptor, such as SOCK_CLOEXEC and SOCK_NONBLOCK.
This commit is contained in:
parent
529f605ac8
commit
89956cb0d6
7 changed files with 49 additions and 18 deletions
|
@ -34,7 +34,13 @@ int listen(int sockfd, int backlog)
|
|||
|
||||
int accept(int sockfd, sockaddr* addr, socklen_t* addrlen)
|
||||
{
|
||||
int rc = syscall(SC_accept, sockfd, addr, addrlen);
|
||||
return accept4(sockfd, addr, addrlen, 0);
|
||||
}
|
||||
|
||||
int accept4(int sockfd, sockaddr* addr, socklen_t* addrlen, int flags)
|
||||
{
|
||||
Syscall::SC_accept4_params params { sockfd, addr, addrlen, flags };
|
||||
int rc = syscall(SC_accept4, ¶ms);
|
||||
__RETURN_WITH_ERRNO(rc, rc, -1);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue