You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by mt...@apache.org on 2009/02/12 14:26:12 UTC
svn commit: r743730 - in /apr/apr/branches/1.4.x: CHANGES
file_io/win32/pipe.c poll/unix/select.c
Author: mturk
Date: Thu Feb 12 13:26:11 2009
New Revision: 743730
URL: http://svn.apache.org/viewvc?rev=743730&view=rev
Log:
Fix core on win32 when using wakeable pollset
Modified:
apr/apr/branches/1.4.x/CHANGES
apr/apr/branches/1.4.x/file_io/win32/pipe.c
apr/apr/branches/1.4.x/poll/unix/select.c
Modified: apr/apr/branches/1.4.x/CHANGES
URL: http://svn.apache.org/viewvc/apr/apr/branches/1.4.x/CHANGES?rev=743730&r1=743729&r2=743730&view=diff
==============================================================================
--- apr/apr/branches/1.4.x/CHANGES [utf-8] (original)
+++ apr/apr/branches/1.4.x/CHANGES [utf-8] Thu Feb 12 13:26:11 2009
@@ -1,6 +1,10 @@
-*- coding: utf-8 -*-
Changes for APR 1.4.0
+ *) apr_pollset_wakeup() on Windows: Fix core caused by closing the
+ file_socket_pipe with standard file_close.
+ [Arsen Chaloyan, Mladen Turk]
+
*) apr_socket_sendfile() on Solaris: Fix handling of files truncated
after the sender determines the length. (This fixes a busy loop in
httpd when a file being served is truncated.) [Jeff Trawick]
Modified: apr/apr/branches/1.4.x/file_io/win32/pipe.c
URL: http://svn.apache.org/viewvc/apr/apr/branches/1.4.x/file_io/win32/pipe.c?rev=743730&r1=743729&r2=743730&view=diff
==============================================================================
--- apr/apr/branches/1.4.x/file_io/win32/pipe.c (original)
+++ apr/apr/branches/1.4.x/file_io/win32/pipe.c Thu Feb 12 13:26:11 2009
@@ -349,22 +349,9 @@
return APR_SUCCESS;
}
-#if 0
-/* XXX Do we need this as public API or APR private ?
- * It's main usage is for interrupting pollset because
- * of !APR_FILES_AS_SOCKETS.
- * Duplicating sockets in child requires WSADuplicateSocket
- * and passing WSAPROTOCOL_INFO data to the child, so we
- * would need some sort of IPC instead DuplicateHandle used
- * for files and pipes.
- */
-APR_DECLARE(apr_status_t)
-#else
-apr_status_t
-#endif
-apr_file_socket_pipe_create(apr_file_t **in,
- apr_file_t **out,
- apr_pool_t *p)
+apr_status_t apr_file_socket_pipe_create(apr_file_t **in,
+ apr_file_t **out,
+ apr_pool_t *p)
{
apr_status_t rv;
SOCKET rd;
@@ -408,3 +395,20 @@
return rv;
}
+
+apr_status_t apr_file_socket_pipe_close(apr_file_t *file)
+{
+ apr_status_t stat;
+ if (!file->pipe)
+ return apr_file_close(file);
+ if ((stat = socket_pipe_cleanup(file)) == APR_SUCCESS) {
+ apr_pool_cleanup_kill(file->pool, file, socket_pipe_cleanup);
+
+ if (file->mutex) {
+ apr_thread_mutex_destroy(file->mutex);
+ }
+
+ return APR_SUCCESS;
+ }
+ return stat;
+}
Modified: apr/apr/branches/1.4.x/poll/unix/select.c
URL: http://svn.apache.org/viewvc/apr/apr/branches/1.4.x/poll/unix/select.c?rev=743730&r1=743729&r2=743730&view=diff
==============================================================================
--- apr/apr/branches/1.4.x/poll/unix/select.c (original)
+++ apr/apr/branches/1.4.x/poll/unix/select.c Thu Feb 12 13:26:11 2009
@@ -195,6 +195,9 @@
apr_file_t **out,
apr_pool_t *p);
+extern apr_status_t
+apr_file_socket_pipe_close(apr_file_t *file);
+
/* Create a dummy wakeup socket pipe for interrupting the poller
*/
static apr_status_t create_wakeup_pipe(apr_pollset_t *pollset)
@@ -218,6 +221,12 @@
{
return APR_ENOTIMPL;
}
+
+static apr_status_t apr_file_socket_pipe_close(apr_file_t *file)
+{
+ return APR_ENOTIMPL;
+}
+
#endif /* WIN32 */
#else /* APR_FILES_AS_SOCKETS */
@@ -265,11 +274,19 @@
if (pollset->flags & APR_POLLSET_WAKEABLE) {
/* Close both sides of the wakeup pipe */
if (pollset->wakeup_pipe[0]) {
+#if APR_FILES_AS_SOCKETS
apr_file_close(pollset->wakeup_pipe[0]);
+#else
+ apr_file_socket_pipe_close(pollset->wakeup_pipe[0]);
+#endif
pollset->wakeup_pipe[0] = NULL;
}
if (pollset->wakeup_pipe[1]) {
+#if APR_FILES_AS_SOCKETS
apr_file_close(pollset->wakeup_pipe[1]);
+#else
+ apr_file_socket_pipe_close(pollset->wakeup_pipe[1]);
+#endif
pollset->wakeup_pipe[1] = NULL;
}
}
Re: svn commit: r743730 - in /apr/apr/branches/1.4.x: CHANGES file_io/win32/pipe.c
poll/unix/select.c
Posted by Mladen Turk <mt...@apache.org>.
Ruediger Pluem wrote:
>
>
>> Modified: apr/apr/branches/1.4.x/poll/unix/select.c
>> URL: http://svn.apache.org/viewvc/apr/apr/branches/1.4.x/poll/unix/select.c?rev=743730&r1=743729&r2=743730&view=diff
>> ==============================================================================
>> --- apr/apr/branches/1.4.x/poll/unix/select.c (original)
>> +++ apr/apr/branches/1.4.x/poll/unix/select.c Thu Feb 12 13:26:11 2009
>
> This whole change is NOT in trunk. So how does it get in 1.4.x?
>
It is now.
>> @@ -195,6 +195,9 @@
>> apr_file_t **out,
>> apr_pool_t *p);
>>
>> +extern apr_status_t
>> +apr_file_socket_pipe_close(apr_file_t *file);
>
> Why this when you define it later as static?
>
It's under different #ifdef, so one is extern from
file_io/win32/pipe.c for WIN32 and other is local
for !APR_FILES_AS_SOCKETS.
Regards
--
^(TM)
Re: svn commit: r743730 - in /apr/apr/branches/1.4.x: CHANGES file_io/win32/pipe.c
poll/unix/select.c
Posted by Ruediger Pluem <rp...@apache.org>.
On 02/12/2009 02:26 PM, mturk@apache.org wrote:
> Author: mturk
> Date: Thu Feb 12 13:26:11 2009
> New Revision: 743730
>
> URL: http://svn.apache.org/viewvc?rev=743730&view=rev
> Log:
> Fix core on win32 when using wakeable pollset
>
> Modified:
> apr/apr/branches/1.4.x/CHANGES
> apr/apr/branches/1.4.x/file_io/win32/pipe.c
> apr/apr/branches/1.4.x/poll/unix/select.c
>
> Modified: apr/apr/branches/1.4.x/poll/unix/select.c
> URL: http://svn.apache.org/viewvc/apr/apr/branches/1.4.x/poll/unix/select.c?rev=743730&r1=743729&r2=743730&view=diff
> ==============================================================================
> --- apr/apr/branches/1.4.x/poll/unix/select.c (original)
> +++ apr/apr/branches/1.4.x/poll/unix/select.c Thu Feb 12 13:26:11 2009
This whole change is NOT in trunk. So how does it get in 1.4.x?
> @@ -195,6 +195,9 @@
> apr_file_t **out,
> apr_pool_t *p);
>
> +extern apr_status_t
> +apr_file_socket_pipe_close(apr_file_t *file);
Why this when you define it later as static?
> +
> /* Create a dummy wakeup socket pipe for interrupting the poller
> */
> static apr_status_t create_wakeup_pipe(apr_pollset_t *pollset)
> @@ -218,6 +221,12 @@
> {
> return APR_ENOTIMPL;
> }
> +
> +static apr_status_t apr_file_socket_pipe_close(apr_file_t *file)
> +{
> + return APR_ENOTIMPL;
> +}
> +
> #endif /* WIN32 */
> #else /* APR_FILES_AS_SOCKETS */
>
> @@ -265,11 +274,19 @@
> if (pollset->flags & APR_POLLSET_WAKEABLE) {
> /* Close both sides of the wakeup pipe */
> if (pollset->wakeup_pipe[0]) {
> +#if APR_FILES_AS_SOCKETS
> apr_file_close(pollset->wakeup_pipe[0]);
> +#else
> + apr_file_socket_pipe_close(pollset->wakeup_pipe[0]);
> +#endif
> pollset->wakeup_pipe[0] = NULL;
> }
> if (pollset->wakeup_pipe[1]) {
> +#if APR_FILES_AS_SOCKETS
> apr_file_close(pollset->wakeup_pipe[1]);
> +#else
> + apr_file_socket_pipe_close(pollset->wakeup_pipe[1]);
> +#endif
> pollset->wakeup_pipe[1] = NULL;
> }
> }
>
>
>
Regards
RĂ¼diger