apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bri...@apache.org
Subject svn commit: r219843 - in /apr/apr/branches/1.1.x: CHANGES STATUS file_io/unix/filedup.c file_io/unix/open.c file_io/unix/pipe.c support/unix/waitio.c
Date Wed, 20 Jul 2005 05:50:32 GMT
Author: brianp
Date: Tue Jul 19 22:50:31 2005
New Revision: 219843

URL: http://svn.apache.org/viewcvs?rev=219843&view=rev
Log:
lazy initialization of the pollset within apr_file_t (backport from 1.2)

Modified:
    apr/apr/branches/1.1.x/CHANGES
    apr/apr/branches/1.1.x/STATUS
    apr/apr/branches/1.1.x/file_io/unix/filedup.c
    apr/apr/branches/1.1.x/file_io/unix/open.c
    apr/apr/branches/1.1.x/file_io/unix/pipe.c
    apr/apr/branches/1.1.x/support/unix/waitio.c

Modified: apr/apr/branches/1.1.x/CHANGES
URL: http://svn.apache.org/viewcvs/apr/apr/branches/1.1.x/CHANGES?rev=219843&r1=219842&r2=219843&view=diff
==============================================================================
--- apr/apr/branches/1.1.x/CHANGES (original)
+++ apr/apr/branches/1.1.x/CHANGES Tue Jul 19 22:50:31 2005
@@ -1,5 +1,11 @@
 Changes for APR 1.1.1
 
+  *) Switch to lazy initialization of the pollset that's used within
+     apr_file_t on platforms where apr_wait_for_io_or_timeout() doesn't
+     use poll(2).  (This fixes a performance problem observed in httpd-2.x
+     on OS X due to the use of poll now being disabled by default on that
+     platform.)  [Brian Pane]
+
   *) Support APR_SO_SNDBUF and APR_SO_RCVBUF on Windows.  PR 32177.
      [Sim <sgobbi datamanagement.it>, Jeff Trawick]
 

Modified: apr/apr/branches/1.1.x/STATUS
URL: http://svn.apache.org/viewcvs/apr/apr/branches/1.1.x/STATUS?rev=219843&r1=219842&r2=219843&view=diff
==============================================================================
--- apr/apr/branches/1.1.x/STATUS (original)
+++ apr/apr/branches/1.1.x/STATUS Tue Jul 19 22:50:31 2005
@@ -30,16 +30,6 @@
 
 CURRENT VOTES:
 
-  *) Backport r209931 from 1.2 development trunk:
-     "Switch to lazy initialization of the pollset that's used within
-     apr_file_t on platforms where apr_wait_for_io_or_timeout() doesn't
-     use poll(2).  (This fixes a performance problem observed in httpd-2.x
-     on OS X due to the use of poll now being disabled by default on that
-     platform.)"
-        +1: brianp
-         0: 
-        -1: 
-
 CURRENT test/testall -v EXCEPTIONS:
 
     Please add any platform anomilies to the following exception list.

Modified: apr/apr/branches/1.1.x/file_io/unix/filedup.c
URL: http://svn.apache.org/viewcvs/apr/apr/branches/1.1.x/file_io/unix/filedup.c?rev=219843&r1=219842&r2=219843&view=diff
==============================================================================
--- apr/apr/branches/1.1.x/file_io/unix/filedup.c (original)
+++ apr/apr/branches/1.1.x/file_io/unix/filedup.c Tue Jul 19 22:50:31 2005
@@ -93,9 +93,10 @@
                               apr_unix_file_cleanup, 
                               apr_unix_file_cleanup);
 #ifndef WAITIO_USES_POLL
-    /* Create a pollset with room for one descriptor. */
-    /* ### check return codes */
-    (void) apr_pollset_create(&(*new_file)->pollset, 1, p, 0);
+    /* Start out with no pollset.  apr_wait_for_io_or_timeout() will
+     * initialize the pollset if needed.
+     */
+    (*new_file)->pollset = NULL;
 #endif
     return APR_SUCCESS;
 }
@@ -150,9 +151,7 @@
     apr_pool_cleanup_kill(old_file->pool, (void *)old_file,
                           apr_unix_file_cleanup);
 #ifndef WAITIO_USES_POLL
-    /* Create a pollset with room for one descriptor. */
-    /* ### check return codes */
-    (void) apr_pollset_create(&(*new_file)->pollset, 1, p, 0);
+    (*new_file)->pollset = NULL;
 #endif
     return APR_SUCCESS;
 }

Modified: apr/apr/branches/1.1.x/file_io/unix/open.c
URL: http://svn.apache.org/viewcvs/apr/apr/branches/1.1.x/file_io/unix/open.c?rev=219843&r1=219842&r2=219843&view=diff
==============================================================================
--- apr/apr/branches/1.1.x/file_io/unix/open.c (original)
+++ apr/apr/branches/1.1.x/file_io/unix/open.c Tue Jul 19 22:50:31 2005
@@ -49,6 +49,17 @@
         /* Are there any error conditions other than EINTR or EBADF? */
         rv = errno;
     }
+#ifndef WAITIO_USES_POLL
+    if (file->pollset != NULL) {
+        apr_status_t pollset_rv = apr_pollset_destroy(file->pollset);
+        /* If the file close failed, return its error value,
+         * not apr_pollset_destroy()'s.
+         */
+        if (rv == APR_SUCCESS) {
+            rv = pollset_rv;
+        }
+    }
+#endif /* !WAITIO_USES_POLL */
     return rv != APR_SUCCESS ? rv : flush_rv;
 }
 
@@ -159,9 +170,10 @@
     (*new)->dataRead = 0;
     (*new)->direction = 0;
 #ifndef WAITIO_USES_POLL
-    /* Create a pollset with room for one descriptor. */
-    /* ### check return codes */
-    (void) apr_pollset_create(&(*new)->pollset, 1, pool, 0);
+    /* Start out with no pollset.  apr_wait_for_io_or_timeout() will
+     * initialize the pollset if needed.
+     */
+    (*new)->pollset = NULL;
 #endif
     if (!(flag & APR_FILE_NOCLEANUP)) {
         apr_pool_cleanup_register((*new)->pool, (void *)(*new), 
@@ -220,9 +232,10 @@
     (*file)->buffered = (flags & APR_BUFFERED) > 0;
 
 #ifndef WAITIO_USES_POLL
-    /* Create a pollset with room for one descriptor. */
-    /* ### check return codes */
-    (void) apr_pollset_create(&(*file)->pollset, 1, pool, 0);
+    /* Start out with no pollset.  apr_wait_for_io_or_timeout() will
+     * initialize the pollset if needed.
+     */
+    (*file)->pollset = NULL;
 #endif
 
     if ((*file)->buffered) {

Modified: apr/apr/branches/1.1.x/file_io/unix/pipe.c
URL: http://svn.apache.org/viewcvs/apr/apr/branches/1.1.x/file_io/unix/pipe.c?rev=219843&r1=219842&r2=219843&view=diff
==============================================================================
--- apr/apr/branches/1.1.x/file_io/unix/pipe.c (original)
+++ apr/apr/branches/1.1.x/file_io/unix/pipe.c Tue Jul 19 22:50:31 2005
@@ -161,9 +161,10 @@
                                   apr_pool_cleanup_null);
     }
 #ifndef WAITIO_USES_POLL
-    /* Create a pollset with room for one descriptor. */
-    /* ### check return codes */
-    (void) apr_pollset_create(&(*file)->pollset, 1, pool, 0);
+    /* Start out with no pollset.  apr_wait_for_io_or_timeout() will
+     * initialize the pollset if needed.
+     */
+    (*file)->pollset = NULL;
 #endif
     return APR_SUCCESS;
 }
@@ -197,7 +198,7 @@
     (*in)->thlock = NULL;
 #endif
 #ifndef WAITIO_USES_POLL
-    (void) apr_pollset_create(&(*in)->pollset, 1, pool, 0);
+    (*in)->pollset = NULL;
 #endif
     (*out) = (apr_file_t *)apr_pcalloc(pool, sizeof(apr_file_t));
     (*out)->pool = pool;
@@ -212,7 +213,7 @@
     (*out)->thlock = NULL;
 #endif
 #ifndef WAITIO_USES_POLL
-    (void) apr_pollset_create(&(*out)->pollset, 1, pool, 0);
+    (*out)->pollset = NULL;
 #endif
     apr_pool_cleanup_register((*in)->pool, (void *)(*in), apr_unix_file_cleanup,
                          apr_pool_cleanup_null);

Modified: apr/apr/branches/1.1.x/support/unix/waitio.c
URL: http://svn.apache.org/viewcvs/apr/apr/branches/1.1.x/support/unix/waitio.c?rev=219843&r1=219842&r2=219843&view=diff
==============================================================================
--- apr/apr/branches/1.1.x/support/unix/waitio.c (original)
+++ apr/apr/branches/1.1.x/support/unix/waitio.c Tue Jul 19 22:50:31 2005
@@ -61,7 +61,7 @@
     }
 }
 
-#else
+#else /* !WAITIO_USES_POLL */
 
 apr_status_t apr_wait_for_io_or_timeout(apr_file_t *f, apr_socket_t *s,
                                         int for_read)
@@ -78,6 +78,13 @@
         pfd.desc.f = f;
 
         pollset = f->pollset;
+        if (pollset == NULL) {
+            status = apr_pollset_create(&(f->pollset), 1, f->pool, 0);
+            if (status != APR_SUCCESS) {
+                return status;
+            }
+            pollset = f->pollset;
+        }
         timeout = f->timeout;
     }
     else {



Mime
View raw message