diff options
| author | Donald Sharp <sharpd@nvidia.com> | 2024-12-03 18:38:59 -0500 |
|---|---|---|
| committer | Mergify <37929162+mergify[bot]@users.noreply.github.com> | 2024-12-04 12:47:34 +0000 |
| commit | 7aa65cfefcebc512e95e30f68e4aac7e9b36d46c (patch) | |
| tree | 4d221af040171b4957af7b1c88241a198e63b7b4 /lib | |
| parent | 0b26493ea638b31ff52c8fc2e493dca5087658db (diff) | |
lib: Allow setsockopt functions to return size set
When finding a send/receive buffer size that is usable
let's report how big we were able to set it.
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
(cherry picked from commit d5615fd6f84e643f194be8c3e91343b35585eb9c)
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/sockopt.c | 8 | ||||
| -rw-r--r-- | lib/sockopt.h | 4 |
2 files changed, 8 insertions, 4 deletions
diff --git a/lib/sockopt.c b/lib/sockopt.c index 74bc034ccd..003ddb72dc 100644 --- a/lib/sockopt.c +++ b/lib/sockopt.c @@ -19,7 +19,7 @@ #define HAVE_BSD_STRUCT_IP_MREQ_HACK #endif -void setsockopt_so_recvbuf(int sock, int size) +int setsockopt_so_recvbuf(int sock, int size) { int orig_req = size; @@ -34,9 +34,11 @@ void setsockopt_so_recvbuf(int sock, int size) flog_err(EC_LIB_SOCKET, "%s: fd %d: SO_RCVBUF set to %d (requested %d)", __func__, sock, size, orig_req); + + return size; } -void setsockopt_so_sendbuf(const int sock, int size) +int setsockopt_so_sendbuf(const int sock, int size) { int orig_req = size; @@ -51,6 +53,8 @@ void setsockopt_so_sendbuf(const int sock, int size) flog_err(EC_LIB_SOCKET, "%s: fd %d: SO_SNDBUF set to %d (requested %d)", __func__, sock, size, orig_req); + + return size; } int getsockopt_so_sendbuf(const int sock) diff --git a/lib/sockopt.h b/lib/sockopt.h index e6fb78d5e4..cbf988cbe7 100644 --- a/lib/sockopt.h +++ b/lib/sockopt.h @@ -12,8 +12,8 @@ extern "C" { #endif -extern void setsockopt_so_recvbuf(int sock, int size); -extern void setsockopt_so_sendbuf(const int sock, int size); +extern int setsockopt_so_recvbuf(int sock, int size); +extern int setsockopt_so_sendbuf(const int sock, int size); extern int getsockopt_so_sendbuf(const int sock); extern int getsockopt_so_recvbuf(const int sock); |
