You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by wr...@apache.org on 2006/04/09 03:33:57 UTC

svn commit: r392654 - /apr/apr/branches/1.2.x/file_io/win32/pipe.c

Author: wrowe
Date: Sat Apr  8 18:33:55 2006
New Revision: 392654

URL: http://svn.apache.org/viewcvs?rev=392654&view=rev
Log:
  Implement apr_os_pipe_put and apr_os_pipe_put_ex on Win32, and
  provide a stub for apr_file_namedpipe_create, which can't be
  implemented as originally specced. 

Backport: 392653

Modified:
    apr/apr/branches/1.2.x/file_io/win32/pipe.c

Modified: apr/apr/branches/1.2.x/file_io/win32/pipe.c
URL: http://svn.apache.org/viewcvs/apr/apr/branches/1.2.x/file_io/win32/pipe.c?rev=392654&r1=392653&r2=392654&view=diff
==============================================================================
--- apr/apr/branches/1.2.x/file_io/win32/pipe.c (original)
+++ apr/apr/branches/1.2.x/file_io/win32/pipe.c Sat Apr  8 18:33:55 2006
@@ -180,3 +180,51 @@
     return APR_SUCCESS;
 #endif /* _WIN32_WCE */
 }
+
+
+APR_DECLARE(apr_status_t) apr_file_namedpipe_create(const char *filename,
+                                                    apr_fileperms_t perm,
+                                                    apr_pool_t *pool)
+{
+    /* Not yet implemented, interface not suitable.
+     * Win32 requires the named pipe to be *opened* at the time it's
+     * created, and to do so, blocking or non blocking must be elected.
+     */
+    return APR_ENOTIMPL;
+}
+
+
+/* XXX: Problem; we need to choose between blocking and nonblocking based
+ * on how *thefile was opened, and we don't have that information :-/
+ * Hack; assume a blocking socket, since the most common use for the fn
+ * would be to handle stdio-style or blocking pipes.  Win32 doesn't have
+ * select() blocking for pipes anyways :(
+ */
+APR_DECLARE(apr_status_t) apr_os_pipe_put_ex(apr_file_t **file,
+                                             apr_os_file_t *thefile,
+                                             int register_cleanup,
+                                             apr_pool_t *pool)
+{
+    (*file) = apr_pcalloc(pool, sizeof(apr_file_t));
+    (*file)->pool = pool;
+    (*file)->pipe = 1;
+    (*file)->timeout = -1;
+    (*file)->ungetchar = -1;
+    (*file)->filehand = *thefile;
+    (void) apr_pollset_create(&(*file)->pollset, 1, p, 0);
+
+    if (register_cleanup) {
+        apr_pool_cleanup_register(pool, *file, apr_file_cleanup,
+                                  apr_pool_cleanup_null);
+    }
+
+    return APR_SUCCESS;
+}
+
+
+APR_DECLARE(apr_status_t) apr_os_pipe_put(apr_file_t **file,
+                                          apr_os_file_t *thefile,
+                                          apr_pool_t *pool)
+{
+    return apr_os_pipe_put_ex(file, thefile, 0, pool);
+}