https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=7d525c171f79243de864d7a736d1cf85209b62db

commit 7d525c171f79243de864d7a736d1cf85209b62db
Author: Corinna Vinschen <cori...@vinschen.de>
Date:   Wed Mar 7 21:56:42 2018 +0100

    Cygwin: AF_UNIX: implement getsockopt SO_RCVBUF/SO_SNDBUF
    
    Signed-off-by: Corinna Vinschen <cori...@vinschen.de>

Diff:
---
 winsup/cygwin/fhandler_socket_unix.cc | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/winsup/cygwin/fhandler_socket_unix.cc 
b/winsup/cygwin/fhandler_socket_unix.cc
index afd57fc..388fbdf 100644
--- a/winsup/cygwin/fhandler_socket_unix.cc
+++ b/winsup/cygwin/fhandler_socket_unix.cc
@@ -1780,6 +1780,16 @@ fhandler_socket_unix::getsockopt (int level, int 
optname, const void *optval,
            break;
          }
 
+       case SO_RCVBUF:
+       case SO_SNDBUF:
+         if (*optlen < (socklen_t) sizeof (int))
+           {
+             set_errno (EINVAL);
+             return -1;
+           }
+         *(int *) optval = (optname == SO_RCVBUF) ? rmem () : wmem ();
+         break;
+
        case SO_RCVTIMEO:
        case SO_SNDTIMEO:
          {

Reply via email to