summaryrefslogtreecommitdiff
path: root/file_io
diff options
context:
space:
mode:
authorWilliam A. Rowe Jr <wrowe@apache.org>2006-04-09 01:33:17 +0000
committerWilliam A. Rowe Jr <wrowe@apache.org>2006-04-09 01:33:17 +0000
commit0c812ad27d43a71cb67c70e998eb940c59cdb309 (patch)
treee2a5d228fb77b3a408f7a4eeff755144da777911 /file_io
parentef9fe339cb3783bbab1a5e432b32ffcc28d971ed (diff)
downloadapr-0c812ad27d43a71cb67c70e998eb940c59cdb309.tar.gz
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. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@392653 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'file_io')
-rw-r--r--file_io/win32/pipe.c48
1 files changed, 48 insertions, 0 deletions
diff --git a/file_io/win32/pipe.c b/file_io/win32/pipe.c
index 5f00940af..afa3341fd 100644
--- a/file_io/win32/pipe.c
+++ b/file_io/win32/pipe.c
@@ -180,3 +180,51 @@ apr_status_t apr_create_nt_pipe(apr_file_t **in, apr_file_t **out,
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);
+}