roken: introduce rk_socket_set_keepalive

Change-Id: I3086a10cd3d23bef00336f5db7db3a35ca02d568
This commit is contained in:
Jeffrey Altman
2020-07-20 09:17:55 -04:00
committed by Jeffrey Altman
parent ee7e345af1
commit 51912c0215
3 changed files with 15 additions and 0 deletions

View File

@@ -456,6 +456,10 @@ socket_set_reuseaddr (rk_socket_t, int);
ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL
socket_set_ipv6only (rk_socket_t, int);
#define socket_set_keepalive rk_socket_set_keepalive
ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL
socket_set_keepalive (rk_socket_t, int);
#define socket_to_fd rk_socket_to_fd
ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL
socket_to_fd(rk_socket_t, int);

View File

@@ -305,6 +305,16 @@ socket_set_ipv6only (rk_socket_t sock, int val)
#endif
}
/*
* Set the that the `sock' keepalive setting.
*/
ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL
socket_set_keepalive(rk_socket_t sock, int val)
{
setsockopt(sock, SOL_SOCKET, SO_KEEPALIVE, (void *)&val, sizeof(val));
}
/**
* Create a file descriptor from a socket
*

View File

@@ -123,6 +123,7 @@ HEIMDAL_ROKEN_2.0 {
rk_socket_set_any;
rk_socket_set_debug;
rk_socket_set_ipv6only;
rk_socket_set_keepalive;
rk_socket_set_nonblocking;
rk_socket_set_port;
rk_socket_set_portrange;