Net: Add a basic sys$shutdown() implementation

Calling shutdown prevents further reads and/or writes on a socket.
We should do a few more things based on the type of socket, but this
initial implementation just puts the basic mechanism in place.

Work towards #428.
This commit is contained in:
Andreas Kling 2020-02-08 00:52:33 +01:00
commit 2b0b7cc5a4
Notes: sideshowbarker 2024-07-19 09:32:27 +09:00
8 changed files with 60 additions and 2 deletions

View file

@ -62,6 +62,12 @@ int connect(int sockfd, const sockaddr* addr, socklen_t addrlen)
__RETURN_WITH_ERRNO(rc, rc, -1);
}
int shutdown(int sockfd, int how)
{
int rc = syscall(SC_shutdown, sockfd, how);
__RETURN_WITH_ERRNO(rc, rc, -1);
}
ssize_t sendto(int sockfd, const void* data, size_t data_length, int flags, const struct sockaddr* addr, socklen_t addr_length)
{
Syscall::SC_sendto_params params { sockfd, { data, data_length }, flags, addr, addr_length };