summaryrefslogtreecommitdiff
path: root/file_io/win32/pipe.c
diff options
context:
space:
mode:
authorGraham Leggett <minfrin@apache.org>2016-03-13 15:09:03 +0000
committerGraham Leggett <minfrin@apache.org>2016-03-13 15:09:03 +0000
commit5a653c27e54468210061f5f5dab8f11aa3428f94 (patch)
treeee7cb0be2d12fb99e332ad7f4a1cc4ba67f7bb0e /file_io/win32/pipe.c
parent4316b99199f505ac8eb15fcebb39e54518efe521 (diff)
downloadapr-5a653c27e54468210061f5f5dab8f11aa3428f94.tar.gz
apr_file_io: Add apr_file_pipe_create_pools() allowing a pair of
pipes to be created, each in a different pool. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1734816 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'file_io/win32/pipe.c')
-rw-r--r--file_io/win32/pipe.c25
1 files changed, 18 insertions, 7 deletions
diff --git a/file_io/win32/pipe.c b/file_io/win32/pipe.c
index bb6e0c15d..491a1a5f5 100644
--- a/file_io/win32/pipe.c
+++ b/file_io/win32/pipe.c
@@ -68,7 +68,7 @@ APR_DECLARE(apr_status_t) apr_file_pipe_create(apr_file_t **in,
apr_pool_t *p)
{
/* Unix creates full blocking pipes. */
- return apr_file_pipe_create_ex(in, out, APR_FULL_BLOCK, p);
+ return apr_file_pipe_create_pools(in, out, APR_FULL_BLOCK, p, p);
}
APR_DECLARE(apr_status_t) apr_file_pipe_create_ex(apr_file_t **in,
@@ -76,6 +76,15 @@ APR_DECLARE(apr_status_t) apr_file_pipe_create_ex(apr_file_t **in,
apr_int32_t blocking,
apr_pool_t *p)
{
+ return apr_file_pipe_create_pools(in, out, APR_FULL_BLOCK, p, p);
+}
+
+APR_DECLARE(apr_status_t) apr_file_pipe_create_pools(apr_file_t **in,
+ apr_file_t **out,
+ apr_int32_t blocking,
+ apr_pool_t *pool_in,
+ apr_pool_t *pool_out)
+{
#ifdef _WIN32_WCE
return APR_ENOTIMPL;
#else
@@ -96,8 +105,8 @@ APR_DECLARE(apr_status_t) apr_file_pipe_create_ex(apr_file_t **in,
#endif
sa.lpSecurityDescriptor = NULL;
- (*in) = (apr_file_t *)apr_pcalloc(p, sizeof(apr_file_t));
- (*in)->pool = p;
+ (*in) = (apr_file_t *)apr_pcalloc(pool_in, sizeof(apr_file_t));
+ (*in)->pool = pool_in;
(*in)->fname = NULL;
(*in)->pipe = 1;
(*in)->timeout = -1;
@@ -111,8 +120,8 @@ APR_DECLARE(apr_status_t) apr_file_pipe_create_ex(apr_file_t **in,
#if APR_FILES_AS_SOCKETS
(void) apr_pollset_create(&(*in)->pollset, 1, p, 0);
#endif
- (*out) = (apr_file_t *)apr_pcalloc(p, sizeof(apr_file_t));
- (*out)->pool = p;
+ (*out) = (apr_file_t *)apr_pcalloc(pool_out, sizeof(apr_file_t));
+ (*out)->pool = pool_out;
(*out)->fname = NULL;
(*out)->pipe = 1;
(*out)->timeout = -1;
@@ -150,7 +159,8 @@ APR_DECLARE(apr_status_t) apr_file_pipe_create_ex(apr_file_t **in,
if (blocking == APR_WRITE_BLOCK /* READ_NONBLOCK */
|| blocking == APR_FULL_NONBLOCK) {
dwOpenMode |= FILE_FLAG_OVERLAPPED;
- (*in)->pOverlapped = (OVERLAPPED*) apr_pcalloc(p, sizeof(OVERLAPPED));
+ (*in)->pOverlapped =
+ (OVERLAPPED*) apr_pcalloc((*in)->pool, sizeof(OVERLAPPED));
(*in)->pOverlapped->hEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
(*in)->timeout = 0;
}
@@ -179,7 +189,8 @@ APR_DECLARE(apr_status_t) apr_file_pipe_create_ex(apr_file_t **in,
if (blocking == APR_READ_BLOCK /* WRITE_NONBLOCK */
|| blocking == APR_FULL_NONBLOCK) {
dwOpenMode |= FILE_FLAG_OVERLAPPED;
- (*out)->pOverlapped = (OVERLAPPED*) apr_pcalloc(p, sizeof(OVERLAPPED));
+ (*out)->pOverlapped =
+ (OVERLAPPED*) apr_pcalloc((*out)->pool, sizeof(OVERLAPPED));
(*out)->pOverlapped->hEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
(*out)->timeout = 0;
}