summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortrawick <trawick@13f79535-47bb-0310-9956-ffa450edef68>2013-10-12 18:04:28 +0000
committertrawick <trawick@13f79535-47bb-0310-9956-ffa450edef68>2013-10-12 18:04:28 +0000
commit204963b4d62565aaac32496f3f9d83cba3a32d51 (patch)
tree306a126bf4d4677645fec37a182660a74035a5eb
parentd88246950cccffec8cfa4f1015a7853f6e8e24d7 (diff)
downloadlibapr-204963b4d62565aaac32496f3f9d83cba3a32d51.tar.gz
Merge r748080:
On windows files != sockets, so do not create unneeded pollset for every opened file. Submitted by: mturk git-svn-id: http://svn.apache.org/repos/asf/apr/apr/branches/1.5.x@1531565 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--CHANGES3
-rw-r--r--file_io/win32/filedup.c6
-rw-r--r--file_io/win32/open.c6
-rw-r--r--file_io/win32/pipe.c9
-rw-r--r--include/arch/win32/apr_arch_file_io.h3
5 files changed, 19 insertions, 8 deletions
diff --git a/CHANGES b/CHANGES
index 2853fb60e..05fc84328 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,9 @@
-*- coding: utf-8 -*-
Changes for APR 1.5.0
+ *) Files and pipes on Windows: Don't create an unused pollset when
+ files and pipes are opened. [Mladen Turk]
+
*) apr_socket_timeout_set() on Windows: If the socket was in a non-
blocking state before, disable that setting so that timeouts work.
[Jeff Trawick]
diff --git a/file_io/win32/filedup.c b/file_io/win32/filedup.c
index 553228e3f..058e0e6cb 100644
--- a/file_io/win32/filedup.c
+++ b/file_io/win32/filedup.c
@@ -57,10 +57,11 @@ APR_DECLARE(apr_status_t) apr_file_dup(apr_file_t **new_file,
apr_pool_cleanup_register((*new_file)->pool, (void *)(*new_file), file_cleanup,
apr_pool_cleanup_null);
+#if APR_FILES_AS_SOCKETS
/* Create a pollset with room for one descriptor. */
/* ### check return codes */
(void) apr_pollset_create(&(*new_file)->pollset, 1, p, 0);
-
+#endif
return APR_SUCCESS;
#endif /* !defined(_WIN32_WCE) */
}
@@ -216,9 +217,10 @@ APR_DECLARE(apr_status_t) apr_file_setaside(apr_file_t **new_file,
apr_pool_cleanup_kill(old_file->pool, (void *)old_file,
file_cleanup);
+#if APR_FILES_AS_SOCKETS
/* Create a pollset with room for one descriptor. */
/* ### check return codes */
(void) apr_pollset_create(&(*new_file)->pollset, 1, p, 0);
-
+#endif
return APR_SUCCESS;
}
diff --git a/file_io/win32/open.c b/file_io/win32/open.c
index f5f32f34b..d2921a7a8 100644
--- a/file_io/win32/open.c
+++ b/file_io/win32/open.c
@@ -475,10 +475,11 @@ APR_DECLARE(apr_status_t) apr_file_open(apr_file_t **new, const char *fname,
/* This feature is not supported on this platform. */
(*new)->flags &= ~APR_FOPEN_SPARSE;
+#if APR_FILES_AS_SOCKETS
/* Create a pollset with room for one descriptor. */
/* ### check return codes */
(void) apr_pollset_create(&(*new)->pollset, 1, pool, 0);
-
+#endif
if (!(flag & APR_FOPEN_NOCLEANUP)) {
apr_pool_cleanup_register((*new)->pool, (void *)(*new), file_cleanup,
apr_pool_cleanup_null);
@@ -654,10 +655,11 @@ APR_DECLARE(apr_status_t) apr_os_file_put(apr_file_t **file,
}
}
+#if APR_FILES_AS_SOCKETS
/* Create a pollset with room for one descriptor. */
/* ### check return codes */
(void) apr_pollset_create(&(*file)->pollset, 1, pool, 0);
-
+#endif
/* Should we be testing if thefile is a handle to
* a PIPE and set up the mechanics appropriately?
*
diff --git a/file_io/win32/pipe.c b/file_io/win32/pipe.c
index 9344c7ae1..79138e7f5 100644
--- a/file_io/win32/pipe.c
+++ b/file_io/win32/pipe.c
@@ -107,8 +107,9 @@ APR_DECLARE(apr_status_t) apr_file_pipe_create_ex(apr_file_t **in,
(*in)->dataRead = 0;
(*in)->direction = 0;
(*in)->pOverlapped = NULL;
+#if APR_FILES_AS_SOCKETS
(void) apr_pollset_create(&(*in)->pollset, 1, p, 0);
-
+#endif
(*out) = (apr_file_t *)apr_pcalloc(p, sizeof(apr_file_t));
(*out)->pool = p;
(*out)->fname = NULL;
@@ -121,8 +122,9 @@ APR_DECLARE(apr_status_t) apr_file_pipe_create_ex(apr_file_t **in,
(*out)->dataRead = 0;
(*out)->direction = 0;
(*out)->pOverlapped = NULL;
+#if APR_FILES_AS_SOCKETS
(void) apr_pollset_create(&(*out)->pollset, 1, p, 0);
-
+#endif
if (apr_os_level >= APR_WIN_NT) {
/* Create the read end of the pipe */
dwOpenMode = PIPE_ACCESS_INBOUND;
@@ -210,8 +212,9 @@ APR_DECLARE(apr_status_t) apr_os_pipe_put_ex(apr_file_t **file,
(*file)->timeout = -1;
(*file)->ungetchar = -1;
(*file)->filehand = *thefile;
+#if APR_FILES_AS_SOCKETS
(void) apr_pollset_create(&(*file)->pollset, 1, pool, 0);
-
+#endif
if (register_cleanup) {
apr_pool_cleanup_register(pool, *file, file_cleanup,
apr_pool_cleanup_null);
diff --git a/include/arch/win32/apr_arch_file_io.h b/include/arch/win32/apr_arch_file_io.h
index 38efa2774..1e2e22572 100644
--- a/include/arch/win32/apr_arch_file_io.h
+++ b/include/arch/win32/apr_arch_file_io.h
@@ -184,9 +184,10 @@ struct apr_file_t {
apr_off_t filePtr; // position in file of handle
apr_thread_mutex_t *mutex; // mutex semaphore, must be owned to access the above fields
+#if APR_FILES_AS_SOCKETS
/* if there is a timeout set, then this pollset is used */
apr_pollset_t *pollset;
-
+#endif
/* Pipe specific info */
};