delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin-developers/2001/10/30/00:38:29

Mailing-List: contact cygwin-developers-help AT sourceware DOT cygnus DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-developers-subscribe AT sources DOT redhat DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin-developers/>
List-Post: <mailto:cygwin-developers AT sources DOT redhat DOT com>
List-Help: <mailto:cygwin-developers-help AT sources DOT redhat DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-developers-owner AT sources DOT redhat DOT com
Delivered-To: mailing list cygwin-developers AT sources DOT redhat DOT com
Date: Tue, 30 Oct 2001 00:39:01 -0500
From: Christopher Faylor <cgf AT redhat DOT com>
To: cygwin-developers AT cygwin DOT com
Subject: Spurious EWOULDBLOCKs on NT4.0
Message-ID: <20011030003901.A8989@redhat.com>
Mail-Followup-To: cygwin-developers AT cygwin DOT com
Mime-Version: 1.0
User-Agent: Mutt/1.3.21i

I thought that I would try to duplicate the ftpd/rsync problems on
my laptop under NT4.0.  However, I'm now noticing that I'm getting
occasional EWOULDBLOCK/EAGAIN errors from ssh.  I repeatedly get
them when copying a 1K+ file, on close.  Not every time, though.

The actual winsock error is WSAEWOULDBLOCK.

I think that this is due to the relatively "recent" addition of the
setsockopt(...LINGER...) in fhandler_socket::close.  This is borne out
by the fact that I can't duplicate the problem in 1.3.2.

The code below seems to "fix" this problem but I'm not sure it is
correct.  According to SUSv2, close is supposed to be a quick operation
unless SO_LINGER is used...

Hmm.  In fact, it must be wrong since this could make close block
indefinitely.

Another way of doing this is to ignore WSAEWOULDBLOCK errors in
fhandler_socket::close.  Maybe that's more correct.

Anyone know what's happening here?  Corinna?

cgf

Index: fhandler_socket.cc
===================================================================
RCS file: /cvs/uberbaum/winsup/cygwin/fhandler_socket.cc,v
retrieving revision 1.32
diff -u -p -r1.32 fhandler_socket.cc
--- fhandler_socket.cc	2001/10/29 05:28:24	1.32
+++ fhandler_socket.cc	2001/10/30 05:30:36
@@ -287,11 +287,9 @@ fhandler_socket::close ()
   setsockopt (get_socket (), SOL_SOCKET, SO_LINGER,
 	      (const char *)&linger, sizeof linger);
 
-  if (closesocket (get_socket ()))
-    {
-      set_winsock_errno ();
-      res = -1;
-    }
+  while (closesocket (get_socket ())
+         && WSAGetLastError () == WSAEWOULDBLOCK)
+    continue;
 
   close_secret_event ();
 

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019