apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wr...@apache.org
Subject svn commit: r392653 - /apr/apr/trunk/file_io/win32/pipe.c
Date Sun, 09 Apr 2006 01:33:20 GMT
Author: wrowe
Date: Sat Apr  8 18:33:17 2006
New Revision: 392653

URL: http://svn.apache.org/viewcvs?rev=392653&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.


Modified:
    apr/apr/trunk/file_io/win32/pipe.c

Modified: apr/apr/trunk/file_io/win32/pipe.c
URL: http://svn.apache.org/viewcvs/apr/apr/trunk/file_io/win32/pipe.c?rev=392653&r1=392652&r2=392653&view=diff
==============================================================================
--- apr/apr/trunk/file_io/win32/pipe.c (original)
+++ apr/apr/trunk/file_io/win32/pipe.c Sat Apr  8 18:33:17 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);
+}



Mime
View raw message