From pquerna@apache.org Sat Dec 11 03:53:10 2004 Return-Path: Mailing-List: contact commits-help@apr.apache.org; run by ezmlm Delivered-To: mailing list commits@apr.apache.org Received: (qmail 54493 invoked by uid 99); 11 Dec 2004 03:53:10 -0000 X-ASF-Spam-Status: No, hits=-10.0 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from minotaur.apache.org (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.28) with SMTP; Fri, 10 Dec 2004 19:53:09 -0800 Received: (qmail 56356 invoked by uid 65534); 11 Dec 2004 03:53:08 -0000 Date: 11 Dec 2004 03:53:08 -0000 Message-ID: <20041211035308.56353.qmail@minotaur.apache.org> From: pquerna@apache.org To: commits@apr.apache.org Subject: svn commit: r111571 - /apr/apr/trunk/CHANGES /apr/apr/trunk/file_io/unix/readwrite.c MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Virus-Checked: Checked Author: pquerna Date: Fri Dec 10 19:53:06 2004 New Revision: 111571 URL: http://svn.apache.org/viewcvs?view=rev&rev=111571 Log: * file_io/unix/readwrite.c: Revert to the original code for apr_file writev() in the !HAVE_WRITEV case, and a large comment explaining why we cannot use a better method without breaking writev()'s semantics. Modified: apr/apr/trunk/CHANGES apr/apr/trunk/file_io/unix/readwrite.c Modified: apr/apr/trunk/CHANGES Url: http://svn.apache.org/viewcvs/apr/apr/trunk/CHANGES?view=diff&rev=111571&p1=apr/apr/trunk/CHANGES&r1=111570&p2=apr/apr/trunk/CHANGES&r2=111571 ============================================================================== --- apr/apr/trunk/CHANGES (original) +++ apr/apr/trunk/CHANGES Fri Dec 10 19:53:06 2004 @@ -10,10 +10,6 @@ *) Add apr_file_writev_full to ensure an entire iovec is writen to a file. [Paul Querna] - *) apr_file_writev will now at least try to write all iovecs on platforms - that do not support writev. - [Paul Querna] - *) Remove the runtime test for Sendfile versions on FreeBSD. PR 25718. [Mike Silbersack , Paul Querna] Modified: apr/apr/trunk/file_io/unix/readwrite.c Url: http://svn.apache.org/viewcvs/apr/apr/trunk/file_io/unix/readwrite.c?view=diff&rev=111571&p1=apr/apr/trunk/file_io/unix/readwrite.c&r1=111570&p2=apr/apr/trunk/file_io/unix/readwrite.c&r2=111571 ============================================================================== --- apr/apr/trunk/file_io/unix/readwrite.c (original) +++ apr/apr/trunk/file_io/unix/readwrite.c Fri Dec 10 19:53:06 2004 @@ -241,21 +241,22 @@ return APR_SUCCESS; } #else - int i; - int tbytes; - apr_status_t rv = APR_SUCCESS; + /** + * The problem with trying to output the entire iovec is that we cannot + * maintain the behavoir that a real writev would have. If we iterate + * over the iovec one at a time, we loose the atomic properties of + * writev(). The other option is to combine the entire iovec into one + * buffer that we could then send in one call to write(). This is not + * reasonable since we do not know how much data an iocev could contain. + * + * The only reasonable option, that maintains the semantics of a real + * writev(), is to only write the first iovec. Callers of file_writev() + * must deal with partial writes as they normally would. If you want to + * ensure an entire iovec is written, use apr_file_writev_full(). + */ - *nbytes = 0; - - for (i = 0; i < nvec; i++) { - tbytes = vec[i].iov_len; - rv = apr_file_write(thefile, vec[i].iov_base, &tbytes); - *nbytes += tbytes; - if (rv != APR_SUCCESS || tbytes < vec[i].iov_len) { - break; - } - } - return rv; + *nbytes = vec[0].iov_len; + return apr_file_write(thefile, vec[0].iov_base, nbytes); #endif }