1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 02:57:44 +00:00

Add support for socket send/receive timeouts.

Only the receive timeout is hooked up yet. You can change the timeout by
calling setsockopt(..., SOL_SOCKET, SO_RCVTIMEO, ...).

Use this mechanism to make /bin/ping report timeouts.
This commit is contained in:
Andreas Kling 2019-03-13 13:13:23 +01:00
parent 7bcd386338
commit 562663df7c
12 changed files with 212 additions and 12 deletions

View file

@ -90,6 +90,8 @@
__ENUMERATE_SYSCALL(seal_shared_buffer) \
__ENUMERATE_SYSCALL(sendto) \
__ENUMERATE_SYSCALL(recvfrom) \
__ENUMERATE_SYSCALL(getsockopt) \
__ENUMERATE_SYSCALL(setsockopt) \
namespace Syscall {
@ -148,6 +150,22 @@ struct SC_recvfrom_params {
size_t addr_length; // socklen_t
};
struct SC_getsockopt_params {
int sockfd;
int level;
int option;
void* value;
void* value_size; // socklen_t*
};
struct SC_setsockopt_params {
int sockfd;
int level;
int option;
const void* value;
size_t value_size; // socklen_t
};
void initialize();
int sync();