X-Recipient: archive-cygwin AT delorie DOT com X-Spam-Check-By: sourceware.org Date: Mon, 17 Dec 2007 19:47:13 +0100 From: Corinna Vinschen To: cygwin AT cygwin DOT com Subject: Re: VM and non-blocking writes Message-ID: <20071217184713.GN18860@calimero.vinschen.de> Reply-To: cygwin AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com References: <47616D31 DOT 7090002 AT 4raccoons DOT com> <20071213175934 DOT GB25863 AT calimero DOT vinschen DOT de> <476185AF DOT 5000906 AT 4raccoons DOT com> <20071214111508 DOT GD25863 AT calimero DOT vinschen DOT de> <20071214143230 DOT GK25863 AT calimero DOT vinschen DOT de> <20071216134221 DOT GD18860 AT calimero DOT vinschen DOT de> <20071216140719 DOT GF18860 AT calimero DOT vinschen DOT de> <20071217182432 DOT GM18860 AT calimero DOT vinschen DOT de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20071217182432.GM18860@calimero.vinschen.de> User-Agent: Mutt/1.5.16 (2007-06-09) Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com On Dec 17 19:24, Corinna Vinschen wrote: > On Dec 17 12:28, Lev Bishop wrote: > > If we keep having to work > > around more issues like this, perhaps we'd be better off bypassing the > > afd layer entirely, by setting SO_SNDBUF to 0, using overlapped IO, > > and managing buffers ourselves. I'm sure this would bring it's own set > > of complications, [...] > > Sorry, I'm unfamiliar with the native NT socket interface :} Is there > somewhere a (good) tutorial for the native NT socket stuff? Even > without using the native API, we could also just set the Winsock > SO_RCVBUF/SO_SNDBUF settings to 0 and intercept the setsockopt/getsockopt > calls to maintain our own buffers, right? On re-reading, my reply seems a bit off-track. You're suggesting to use SO_SNDBUF==0 with overlapped I/O. I'm asking to keep the standard nonblocking semantics when maintaining our own per-socket buffer. At one point the socket stuff was implemented using overlapped I/O, but I had serious trouble with that. What happened was that the overlapped code waited for the socket operation to complete in a WaitForMultipleEvents call. When a signal arrived, I canceled the I/O operation using CancelIO. The problem was that the send operation is not atomic, and there is no way to find out how much bytes from the current send buffer have been actually sent. So it was not possible to return the correct number of sent bytes to the application. Instead the code always returned with EINTR. This in turn could result in data corruption or lost connections. If there is some way to accomplish that, for instance in the native API, then we could revert to overlapped I/O. If not, well... Corinna -- Corinna Vinschen Please, send mails regarding Cygwin to Cygwin Project Co-Leader cygwin AT cygwin DOT com Red Hat -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/