This is an automated email from the ASF dual-hosted git repository.

alexey pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/kudu.git


The following commit(s) were added to refs/heads/master by this push:
     new ce6a24229 [socket] No need for static check of SO_REUSEPORT macro
ce6a24229 is described below

commit ce6a24229910a3c1981eaef63713f6ad5ec1c38c
Author: Ashwani Raina <ara...@cloudera.com>
AuthorDate: Mon May 26 12:29:57 2025 +0530

    [socket] No need for static check of SO_REUSEPORT macro
    
    SO_REUSEPORT socket option support was added quite a while back.
    
    For Linux, support was added to kernel version 3.9.
      - RHEL: Available since RHEL 6.5, which uses version 2.6.32 of the
        Linux kernel.
      - CentOS: Support present in release version 7 with default Linux
        kernel version 3.10.0.
      - Ubuntu: Support present in release version 18.04 with default
        Linux kernel version 4.15.
    
    For macOS, support is present in v11 (Big Sur), verified on Xcode
    version 11.4.
    
    Change-Id: I477d47251a45a57e4179d8affd2273cb25768383
    Reviewed-on: http://gerrit.cloudera.org:8080/22945
    Reviewed-by: Alexey Serbin <ale...@apache.org>
    Tested-by: Alexey Serbin <ale...@apache.org>
---
 src/kudu/util/net/socket.cc | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/src/kudu/util/net/socket.cc b/src/kudu/util/net/socket.cc
index e3cc8ca9e..78cda06eb 100644
--- a/src/kudu/util/net/socket.cc
+++ b/src/kudu/util/net/socket.cc
@@ -442,14 +442,10 @@ Status Socket::SetReuseAddr(bool flag) {
 }
 
 Status Socket::SetReusePort(bool flag) {
-  #ifdef SO_REUSEPORT
-    int int_flag = flag ? 1 : 0;
-    RETURN_NOT_OK_PREPEND(SetSockOpt(SOL_SOCKET, SO_REUSEPORT, int_flag),
-                          "failed to set SO_REUSEPORT");
-    return Status::OK();
-  #else
-    return Status::NotSupported("failed to set SO_REUSEPORT: protocol not 
available");
-  #endif
+  int int_flag = flag ? 1 : 0;
+  RETURN_NOT_OK_PREPEND(SetSockOpt(SOL_SOCKET, SO_REUSEPORT, int_flag),
+                        "failed to set SO_REUSEPORT");
+  return Status::OK();
 }
 
 Status Socket::BindAndListen(const Sockaddr& sockaddr,

Reply via email to