summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@nvidia.com>2024-12-03 18:38:59 -0500
committerDonald Sharp <sharpd@nvidia.com>2024-12-03 18:38:59 -0500
commitd5615fd6f84e643f194be8c3e91343b35585eb9c (patch)
tree03e3a16afe1fc8e383ffaf3493a016fc13948de7
parent267dc19825eb1e5281fd6f6990bf0ee7c4664604 (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>
-rw-r--r--lib/sockopt.c8
-rw-r--r--lib/sockopt.h4
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);