You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by bj...@apache.org on 2010/04/04 16:37:24 UTC
svn commit: r930694 - /apr/apr/trunk/file_io/os2/readwrite.c
Author: bjh
Date: Sun Apr 4 14:37:24 2010
New Revision: 930694
URL: http://svn.apache.org/viewvc?rev=930694&view=rev
Log:
OS/2: Change implementation of apr_file_writev() to just call apr_file_write()
in a loop. OS/2 doesn't have a system call equivalent to writev() so the C
library was just emulating it, providing no performance benefit.
This also fixes a problem with the old implementation failing to handle buffered
files correctly which resulted in a testfile failure.
Modified:
apr/apr/trunk/file_io/os2/readwrite.c
Modified: apr/apr/trunk/file_io/os2/readwrite.c
URL: http://svn.apache.org/viewvc/apr/apr/trunk/file_io/os2/readwrite.c?rev=930694&r1=930693&r2=930694&view=diff
==============================================================================
--- apr/apr/trunk/file_io/os2/readwrite.c (original)
+++ apr/apr/trunk/file_io/os2/readwrite.c Sun Apr 4 14:37:24 2010
@@ -219,29 +219,21 @@ APR_DECLARE(apr_status_t) apr_file_write
-#ifdef HAVE_WRITEV
-
APR_DECLARE(apr_status_t) apr_file_writev(apr_file_t *thefile, const struct iovec *vec, apr_size_t nvec, apr_size_t *nbytes)
{
- int bytes;
+ int c;
+ apr_status_t rv = APR_SUCCESS;
+ apr_size_t written = 0;
+
+ for (c = 0; c < nvec && rv == APR_SUCCESS; c++) {
+ apr_size_t nbytes = vec[c].iov_len;
+ rv = apr_file_write(thefile, vec[c].iov_base, &nbytes);
+ written += nbytes;
+ }
- if (thefile->buffered) {
- apr_status_t rv = apr_file_flush(thefile);
- if (rv != APR_SUCCESS) {
- return rv;
- }
- }
-
- if ((bytes = writev(thefile->filedes, vec, nvec)) < 0) {
- *nbytes = 0;
- return errno;
- }
- else {
- *nbytes = bytes;
- return APR_SUCCESS;
- }
+ *nbytes = written;
+ return rv;
}
-#endif