apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wr...@apache.org
Subject svn commit: r892386 - in /apr/apr/trunk: file_io/win32/pipe.c include/arch/win32/apr_arch_file_io.h poll/unix/pollset.c
Date Fri, 18 Dec 2009 22:20:10 GMT
Author: wrowe
Date: Fri Dec 18 22:20:10 2009
New Revision: 892386

URL: http://svn.apache.org/viewvc?rev=892386&view=rev
Log:
refactor for what is meant to strictly be internal functionality for 1 platform, move declarations
out of .c sources

Modified:
    apr/apr/trunk/file_io/win32/pipe.c
    apr/apr/trunk/include/arch/win32/apr_arch_file_io.h
    apr/apr/trunk/poll/unix/pollset.c

Modified: apr/apr/trunk/file_io/win32/pipe.c
URL: http://svn.apache.org/viewvc/apr/apr/trunk/file_io/win32/pipe.c?rev=892386&r1=892385&r2=892386&view=diff
==============================================================================
--- apr/apr/trunk/file_io/win32/pipe.c (original)
+++ apr/apr/trunk/file_io/win32/pipe.c Fri Dec 18 22:20:10 2009
@@ -242,7 +242,7 @@
     apr_status_t rv = APR_SUCCESS;
     int ll = sizeof(la);
     int lc = sizeof(ca);
-    int bm = 1;
+    unsigned long bm = 1;
     int uid[2];
     int iid[2];
 
@@ -370,9 +370,9 @@
     return APR_SUCCESS;
 }
 
-apr_status_t apr_file_socket_pipe_create(apr_file_t **in,
-                                         apr_file_t **out,
-                                         apr_pool_t *p)
+apr_status_t file_socket_pipe_create(apr_file_t **in,
+                                     apr_file_t **out,
+                                     apr_pool_t *p)
 {
     apr_status_t rv;
     SOCKET rd;
@@ -417,7 +417,7 @@
     return rv;
 }
 
-apr_status_t apr_file_socket_pipe_close(apr_file_t *file)
+apr_status_t file_socket_pipe_close(apr_file_t *file)
 {
     apr_status_t stat;
     if (!file->pipe)

Modified: apr/apr/trunk/include/arch/win32/apr_arch_file_io.h
URL: http://svn.apache.org/viewvc/apr/apr/trunk/include/arch/win32/apr_arch_file_io.h?rev=892386&r1=892385&r2=892386&view=diff
==============================================================================
--- apr/apr/trunk/include/arch/win32/apr_arch_file_io.h (original)
+++ apr/apr/trunk/include/arch/win32/apr_arch_file_io.h Fri Dec 18 22:20:10 2009
@@ -253,4 +253,10 @@
 
 apr_status_t file_cleanup(void *);
 
+apr_status_t file_socket_pipe_create(apr_file_t **in,
+                                     apr_file_t **out,
+                                     apr_pool_t *p);
+
+apr_status_t file_socket_pipe_close(apr_file_t *file);
+
 #endif  /* ! FILE_IO_H */

Modified: apr/apr/trunk/poll/unix/pollset.c
URL: http://svn.apache.org/viewvc/apr/apr/trunk/poll/unix/pollset.c?rev=892386&r1=892385&r2=892386&view=diff
==============================================================================
--- apr/apr/trunk/poll/unix/pollset.c (original)
+++ apr/apr/trunk/poll/unix/pollset.c Fri Dec 18 22:20:10 2009
@@ -31,15 +31,8 @@
 static apr_pollset_method_e pollset_default_method = POLLSET_DEFAULT_METHOD;
 
 #if !APR_FILES_AS_SOCKETS
-#if defined (WIN32)
 
-extern apr_status_t
-apr_file_socket_pipe_create(apr_file_t **in,
-                            apr_file_t **out,
-                            apr_pool_t *p);
-
-extern apr_status_t
-apr_file_socket_pipe_close(apr_file_t *file);
+#ifdef WIN32
 
 /* Create a dummy wakeup socket pipe for interrupting the poller
  */
@@ -48,9 +41,9 @@
     apr_status_t rv;
     apr_pollfd_t fd;
 
-    if ((rv = apr_file_socket_pipe_create(&pollset->wakeup_pipe[0],
-                                          &pollset->wakeup_pipe[1],
-                                          pollset->pool)) != APR_SUCCESS)
+    if ((rv = file_socket_pipe_create(&pollset->wakeup_pipe[0],
+                                      &pollset->wakeup_pipe[1],
+                                      pollset->pool)) != APR_SUCCESS)
         return rv;
     fd.reqevents = APR_POLLIN;
     fd.desc_type = APR_POLL_FILE;
@@ -60,18 +53,33 @@
     return apr_pollset_add(pollset, &fd);
 }
 
-#else  /* !WIN32 */
+static apr_status_t close_wakeup_pipe(apr_pollset_t *pollset)
+{
+    /* Close both sides of the wakeup pipe */
+    if (pollset->wakeup_pipe[0]) {
+        file_socket_pipe_close(pollset->wakeup_pipe[0]);
+        pollset->wakeup_pipe[0] = NULL;
+    }
+    if (pollset->wakeup_pipe[1]) {
+        file_socket_pipe_close(pollset->wakeup_pipe[1]);
+        pollset->wakeup_pipe[1] = NULL;
+    }
+}
+
+#else /* !WIN32 */
+
 static apr_status_t create_wakeup_pipe(apr_pollset_t *pollset)
 {
     return APR_ENOTIMPL;
 }
 
-static apr_status_t apr_file_socket_pipe_close(apr_file_t *file)
+static apr_status_t close_wakeup_pipe(apr_pollset_t *pollset)
 {
     return APR_ENOTIMPL;
 }
 
-#endif /* WIN32 */
+#endif /* !WIN32 */
+
 #else  /* APR_FILES_AS_SOCKETS */
 
 /* Create a dummy wakeup pipe for interrupting the poller
@@ -114,7 +122,21 @@
      */
     return apr_pollset_add(pollset, &fd);
 }
-#endif /* !APR_FILES_AS_SOCKETS */
+
+static apr_status_t close_wakeup_pipe(apr_pollset_t *pollset)
+{
+    /* Close both sides of the wakeup pipe */
+    if (pollset->wakeup_pipe[0]) {
+        apr_file_close(pollset->wakeup_pipe[0]);
+        pollset->wakeup_pipe[0] = NULL;
+    }
+    if (pollset->wakeup_pipe[1]) {
+        apr_file_close(pollset->wakeup_pipe[1]);
+        pollset->wakeup_pipe[1] = NULL;
+    }
+}
+
+#endif /* APR_FILES_AS_SOCKETS */
 
 /* Read and discard what's ever in the wakeup pipe.
  */
@@ -141,23 +163,7 @@
         (*pollset->provider->cleanup)(pollset);
     }
     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;
-        }
+        close_wakeup_pipe(pollset);
     }
 
     return APR_SUCCESS;



Mime
View raw message