1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-06-01 08:28:11 +00:00

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
parent a3f39fe789
commit 2b0b7cc5a4
8 changed files with 60 additions and 2 deletions

View file

@ -49,6 +49,10 @@ __BEGIN_DECLS
#define SOCK_NONBLOCK 04000
#define SOCK_CLOEXEC 02000000
#define SHUT_RD 1
#define SHUT_WR 2
#define SHUT_RDWR 3
#define IPPROTO_IP 0
#define IPPROTO_ICMP 1
#define IPPROTO_TCP 6
@ -81,6 +85,7 @@ int bind(int sockfd, const struct sockaddr* addr, socklen_t);
int listen(int sockfd, int backlog);
int accept(int sockfd, struct sockaddr*, socklen_t*);
int connect(int sockfd, const struct sockaddr*, socklen_t);
int shutdown(int sockfd, int how);
ssize_t send(int sockfd, const void*, size_t, int flags);
ssize_t sendto(int sockfd, const void*, size_t, int flags, const struct sockaddr*, socklen_t);
ssize_t recv(int sockfd, void*, size_t, int flags);