apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From minf...@apache.org
Subject svn commit: r1736523 - in /apr/apr/branches/1.6.x: ./ CHANGES file_io/netware/pipe.c file_io/os2/pipe.c file_io/unix/pipe.c file_io/win32/pipe.c include/apr_file_io.h test/testpipe.c
Date Fri, 25 Mar 2016 01:28:13 GMT
Author: minfrin
Date: Fri Mar 25 01:28:13 2016
New Revision: 1736523

URL: http://svn.apache.org/viewvc?rev=1736523&view=rev
Log:
Backport 1734816:

apr_file_io: Add apr_file_pipe_create_pools() allowing a pair of
pipes to be created, each in a different pool.

Modified:
    apr/apr/branches/1.6.x/   (props changed)
    apr/apr/branches/1.6.x/CHANGES
    apr/apr/branches/1.6.x/file_io/netware/pipe.c
    apr/apr/branches/1.6.x/file_io/os2/pipe.c
    apr/apr/branches/1.6.x/file_io/unix/pipe.c
    apr/apr/branches/1.6.x/file_io/win32/pipe.c
    apr/apr/branches/1.6.x/include/apr_file_io.h
    apr/apr/branches/1.6.x/test/testpipe.c

Propchange: apr/apr/branches/1.6.x/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Mar 25 01:28:13 2016
@@ -1,4 +1,4 @@
 /apr/apr/branches/1.4.x:1003369,1101301
-/apr/apr/trunk:733052,739635,741862,741866-741867,741869,741871,745763-745764,746310,747990,748080,748361,748371,748565,748888,748902,748988,749810,760443,767895,775683,782838,783398,783958,784633,784773,788588,789050,793192-793193,794118,794485,795267,799497,800627,809745,809854,810472,811455,813063,821306,829490,831641,832904,835607,888669,892028,892159,892435,892909,896382,896653,899905,902090,908427,910419,910597,917819,917837-917838,925965,929796,930508,931973,951771,960665,960671,979891,983618,989450,990435,1003338,1044440,1044447,1055657,1072165,1078845,1081462,1081495,1083038,1083242,1084662,1086695,1088023,1089031,1089129,1089438,1099348,1103310,1183683,1183685-1183686,1183688,1183693,1183698,1213382,1235047,1236970,1237078,1237507,1240472,1340286,1340288,1340470,1341193,1341196,1343233,1343243,1367050,1368819,1370494,1372018,1372022,1372093,1372849,1376957,1384764,1389077,1400200,1402868,1405985,1406690,1420106,1420109,1425356,1428809,1438940,1438957-1438959,1442903,144956
 8,1456418,1459994,1460179-1460180,1460241,1460399,1460405,1462738,1462813,1470186,1470348,1475509,1478905,1480067,1481262,1481265,1484271,1487796,1489517,1496407,1502804,1510354,1516261,1523384,1523479,1523484,1523505,1523521,1523604,1523613,1523615,1523844-1523845,1523853,1524014,1524031,1528797,1528809,1529488,1529495,1529515,1529521,1529668,1530786,1530800,1530988,1531554,1531768,1531884,1532022,1533104,1533111,1533979,1535027,1535157,1536744,1538171,1539374,1539389,1539455,1539603,1541054,1541061,1541486,1541655,1541666,1541744,1542601,1542779,1543033,1543056,1548575,1550907,1551650,1551659,1558905,1559382,1559873,1559975,1561040,1561260,1561265,1561321,1561347,1561356,1561361,1561394,1561555,1571894,1575509,1578420,1587045,1587063,1587543,1587545,1588878,1588937,1593611,1593614-1593615,1593680,1594684,1594708,1595549,1597797,1597803,1604590,1604596,1604598,1605104,1610854,1611023,1611107,1611110,1611117,1611120,1611125,1611184,1611193,1611466,1611515,1611517,1625173,1626564,163
 4615,1642159,1648830,1664406,1664447,1664451,1664471,1664769-1664770,1664775,1664904,1664911,1664958,1666341,1666411,1666458,1666611,1667420-1667421,1667423,1667900-1667901,1667903,1667914-1667916,1667962,1669077,1671292,1671329,1671356,1671389,1671513-1671514,1671957,1672354,1672366,1672495,1672575,1675644,1675656,1675668,1676013,1685929,1696140,1696767,1722547,1722557,1726928,1727020,1727160,1727175,1727199,1728957,1732582,1733451,1733594
+/apr/apr/trunk:733052,739635,741862,741866-741867,741869,741871,745763-745764,746310,747990,748080,748361,748371,748565,748888,748902,748988,749810,760443,767895,775683,782838,783398,783958,784633,784773,788588,789050,793192-793193,794118,794485,795267,799497,800627,809745,809854,810472,811455,813063,821306,829490,831641,832904,835607,888669,892028,892159,892435,892909,896382,896653,899905,902090,908427,910419,910597,917819,917837-917838,925965,929796,930508,931973,951771,960665,960671,979891,983618,989450,990435,1003338,1044440,1044447,1055657,1072165,1078845,1081462,1081495,1083038,1083242,1084662,1086695,1088023,1089031,1089129,1089438,1099348,1103310,1183683,1183685-1183686,1183688,1183693,1183698,1213382,1235047,1236970,1237078,1237507,1240472,1340286,1340288,1340470,1341193,1341196,1343233,1343243,1367050,1368819,1370494,1372018,1372022,1372093,1372849,1376957,1384764,1389077,1400200,1402868,1405985,1406690,1420106,1420109,1425356,1428809,1438940,1438957-1438959,1442903,144956
 8,1456418,1459994,1460179-1460180,1460241,1460399,1460405,1462738,1462813,1470186,1470348,1475509,1478905,1480067,1481262,1481265,1484271,1487796,1489517,1496407,1502804,1510354,1516261,1523384,1523479,1523484,1523505,1523521,1523604,1523613,1523615,1523844-1523845,1523853,1524014,1524031,1528797,1528809,1529488,1529495,1529515,1529521,1529668,1530786,1530800,1530988,1531554,1531768,1531884,1532022,1533104,1533111,1533979,1535027,1535157,1536744,1538171,1539374,1539389,1539455,1539603,1541054,1541061,1541486,1541655,1541666,1541744,1542601,1542779,1543033,1543056,1548575,1550907,1551650,1551659,1558905,1559382,1559873,1559975,1561040,1561260,1561265,1561321,1561347,1561356,1561361,1561394,1561555,1571894,1575509,1578420,1587045,1587063,1587543,1587545,1588878,1588937,1593611,1593614-1593615,1593680,1594684,1594708,1595549,1597797,1597803,1604590,1604596,1604598,1605104,1610854,1611023,1611107,1611110,1611117,1611120,1611125,1611184,1611193,1611466,1611515,1611517,1625173,1626564,163
 4615,1642159,1648830,1664406,1664447,1664451,1664471,1664769-1664770,1664775,1664904,1664911,1664958,1666341,1666411,1666458,1666611,1667420-1667421,1667423,1667900-1667901,1667903,1667914-1667916,1667962,1669077,1671292,1671329,1671356,1671389,1671513-1671514,1671957,1672354,1672366,1672495,1672575,1675644,1675656,1675668,1676013,1685929,1696140,1696767,1722547,1722557,1726928,1727020,1727160,1727175,1727199,1728957,1732582,1733451,1733594,1734816
 /apr/apr/trunk/test/testnames.c:1460405
 /httpd/httpd/trunk:1604590

Modified: apr/apr/branches/1.6.x/CHANGES
URL: http://svn.apache.org/viewvc/apr/apr/branches/1.6.x/CHANGES?rev=1736523&r1=1736522&r2=1736523&view=diff
==============================================================================
--- apr/apr/branches/1.6.x/CHANGES [utf-8] (original)
+++ apr/apr/branches/1.6.x/CHANGES [utf-8] Fri Mar 25 01:28:13 2016
@@ -1,6 +1,9 @@
                                                      -*- coding: utf-8 -*-
 Changes for APR 1.6.0
 
+  *) apr_file_io: Add apr_file_pipe_create_pools() allowing a pair of
+     pipes to be created, each in a different pool. [Graham Leggett]
+
   *) Add apr_pollcb_wakeup(), with similar behavior to
      apr_pollset_wakeup(). Add apr_pollcb_method_name(), with similar 
      behavior to apr_pollset_method_name().

Modified: apr/apr/branches/1.6.x/file_io/netware/pipe.c
URL: http://svn.apache.org/viewvc/apr/apr/branches/1.6.x/file_io/netware/pipe.c?rev=1736523&r1=1736522&r2=1736523&view=diff
==============================================================================
--- apr/apr/branches/1.6.x/file_io/netware/pipe.c (original)
+++ apr/apr/branches/1.6.x/file_io/netware/pipe.c Fri Mar 25 01:28:13 2016
@@ -133,7 +133,8 @@ APR_DECLARE(apr_status_t) apr_os_pipe_pu
     return apr_os_pipe_put_ex(file, thefile, 0, pool);
 }
 
-APR_DECLARE(apr_status_t) apr_file_pipe_create(apr_file_t **in, apr_file_t **out, apr_pool_t
*pool)
+static apr_status_t file_pipe_create(apr_file_t **in, apr_file_t **out,
+        apr_pool_t *pool_in, apr_pool_t *pool_out)
 {
 	int     	filedes[2];
 
@@ -141,11 +142,11 @@ APR_DECLARE(apr_status_t) apr_file_pipe_
         return errno;
     }
 
-    (*in) = (apr_file_t *)apr_pcalloc(pool, sizeof(apr_file_t));
-    (*out) = (apr_file_t *)apr_pcalloc(pool, sizeof(apr_file_t));
+    (*in) = (apr_file_t *)apr_pcalloc(pool_in, sizeof(apr_file_t));
+    (*out) = (apr_file_t *)apr_pcalloc(pool_out, sizeof(apr_file_t));
 
-    (*in)->pool     =
-    (*out)->pool    = pool;
+    (*in)->pool     = pool_in;
+    (*out)->pool    = pool_out;
     (*in)->filedes   = filedes[0];
     (*out)->filedes  = filedes[1];
     (*in)->flags     = APR_INHERIT;
@@ -163,8 +164,8 @@ APR_DECLARE(apr_status_t) apr_file_pipe_
     (*in)->ungetchar = -1;
     (*in)->thlock    =
     (*out)->thlock   = NULL;
-    (void) apr_pollset_create(&(*in)->pollset, 1, pool, 0);
-    (void) apr_pollset_create(&(*out)->pollset, 1, pool, 0);
+    (void) apr_pollset_create(&(*in)->pollset, 1, pool_in, 0);
+    (void) apr_pollset_create(&(*out)->pollset, 1, pool_out, 0);
 
     apr_pool_cleanup_register((*in)->pool, (void *)(*in), apr_unix_file_cleanup,
                          apr_pool_cleanup_null);
@@ -174,6 +175,30 @@ APR_DECLARE(apr_status_t) apr_file_pipe_
     return APR_SUCCESS;
 }
 
+static void file_pipe_block(apr_file_t **in, apr_file_t **out,
+        apr_int32_t blocking)
+{
+    switch (blocking) {
+    case APR_FULL_BLOCK:
+        break;
+    case APR_READ_BLOCK:
+        apr_file_pipe_timeout_set(*out, 0);
+        break;
+    case APR_WRITE_BLOCK:
+        apr_file_pipe_timeout_set(*in, 0);
+        break;
+    default:
+        apr_file_pipe_timeout_set(*out, 0);
+        apr_file_pipe_timeout_set(*in, 0);
+        break;
+    }
+}
+
+APR_DECLARE(apr_status_t) apr_file_pipe_create(apr_file_t **in, apr_file_t **out, apr_pool_t
*pool)
+{
+    return file_pipe_create(in, out, pool, pool);
+}
+
 APR_DECLARE(apr_status_t) apr_file_pipe_create_ex(apr_file_t **in, 
                                                   apr_file_t **out, 
                                                   apr_int32_t blocking,
@@ -181,23 +206,26 @@ APR_DECLARE(apr_status_t) apr_file_pipe_
 {
     apr_status_t status;
 
-    if ((status = apr_file_pipe_create(in, out, pool)) != APR_SUCCESS)
+    if ((status = file_pipe_create(in, out, pool, pool)) != APR_SUCCESS) {
         return status;
+    }
 
-    switch (blocking) {
-        case APR_FULL_BLOCK:
-            break;
-        case APR_READ_BLOCK:
-            apr_file_pipe_timeout_set(*out, 0);
-            break;
-        case APR_WRITE_BLOCK:
-            apr_file_pipe_timeout_set(*in, 0);
-            break;
-        default:
-            apr_file_pipe_timeout_set(*out, 0);
-            apr_file_pipe_timeout_set(*in, 0);
+    file_pipe_block(in, out, blocking);
+
+    return APR_SUCCESS;
+}
+
+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)
+{
+    apr_status_t status;
+
+    if ((status = file_pipe_create(in, out, pool_in, pool_out)) != APR_SUCCESS) {
+        return status;
     }
 
+    file_pipe_block(in, out, blocking);
+
     return APR_SUCCESS;
 }
 

Modified: apr/apr/branches/1.6.x/file_io/os2/pipe.c
URL: http://svn.apache.org/viewvc/apr/apr/branches/1.6.x/file_io/os2/pipe.c?rev=1736523&r1=1736522&r2=1736523&view=diff
==============================================================================
--- apr/apr/branches/1.6.x/file_io/os2/pipe.c (original)
+++ apr/apr/branches/1.6.x/file_io/os2/pipe.c Fri Mar 25 01:28:13 2016
@@ -24,7 +24,8 @@
 #include <string.h>
 #include <process.h>
 
-APR_DECLARE(apr_status_t) apr_file_pipe_create(apr_file_t **in, apr_file_t **out, apr_pool_t
*pool)
+static apr_status_t file_pipe_create(apr_file_t **in, apr_file_t **out,
+        apr_pool_t *pool_in, apr_pool_t *pool_out)
 {
     ULONG filedes[2];
     ULONG rc, action;
@@ -54,7 +55,7 @@ APR_DECLARE(apr_status_t) apr_file_pipe_
         return APR_FROM_OS_ERROR(rc);
     }
 
-    (*in) = (apr_file_t *)apr_palloc(pool, sizeof(apr_file_t));
+    (*in) = (apr_file_t *)apr_palloc(pool_in, sizeof(apr_file_t));
     rc = DosCreateEventSem(NULL, &(*in)->pipeSem, DC_SEM_SHARED, FALSE);
 
     if (rc) {
@@ -76,33 +77,59 @@ APR_DECLARE(apr_status_t) apr_file_pipe_
         return APR_FROM_OS_ERROR(rc);
     }
 
-    (*in)->pool = pool;
+    (*in)->pool = pool_in;
     (*in)->filedes = filedes[0];
-    (*in)->fname = apr_pstrdup(pool, pipename);
+    (*in)->fname = apr_pstrdup(pool_in, pipename);
     (*in)->isopen = TRUE;
     (*in)->buffered = FALSE;
     (*in)->flags = 0;
     (*in)->pipe = 1;
     (*in)->timeout = -1;
     (*in)->blocking = BLK_ON;
-    apr_pool_cleanup_register(pool, *in, apr_file_cleanup, apr_pool_cleanup_null);
+    apr_pool_cleanup_register(pool_in, *in, apr_file_cleanup,
+            apr_pool_cleanup_null);
 
-    (*out) = (apr_file_t *)apr_palloc(pool, sizeof(apr_file_t));
-    (*out)->pool = pool;
+    (*out) = (apr_file_t *)apr_palloc(pool_out, sizeof(apr_file_t));
+    (*out)->pool = pool_out;
     (*out)->filedes = filedes[1];
-    (*out)->fname = apr_pstrdup(pool, pipename);
+    (*out)->fname = apr_pstrdup(pool_out, pipename);
     (*out)->isopen = TRUE;
     (*out)->buffered = FALSE;
     (*out)->flags = 0;
     (*out)->pipe = 1;
     (*out)->timeout = -1;
     (*out)->blocking = BLK_ON;
-    apr_pool_cleanup_register(pool, *out, apr_file_cleanup, apr_pool_cleanup_null);
+    apr_pool_cleanup_register(pool_out, *out, apr_file_cleanup,
+            apr_pool_cleanup_null);
 
     return APR_SUCCESS;
 }
 
+static void file_pipe_block(apr_file_t **in, apr_file_t **out,
+        apr_int32_t blocking)
+{
+    switch (blocking) {
+    case APR_FULL_BLOCK:
+        break;
+    case APR_READ_BLOCK:
+        apr_file_pipe_timeout_set(*out, 0);
+        break;
+    case APR_WRITE_BLOCK:
+        apr_file_pipe_timeout_set(*in, 0);
+        break;
+    default:
+        apr_file_pipe_timeout_set(*out, 0);
+        apr_file_pipe_timeout_set(*in, 0);
+        break;
+    }
+}
 
+APR_DECLARE(apr_status_t) apr_file_pipe_create(apr_file_t **in,
+                                               apr_file_t **out,
+                                               apr_pool_t *pool)
+{
+    return file_pipe_create(in, out, pool, pool);
+}
 
 APR_DECLARE(apr_status_t) apr_file_pipe_create_ex(apr_file_t **in, 
                                                   apr_file_t **out, 
@@ -111,26 +138,29 @@ APR_DECLARE(apr_status_t) apr_file_pipe_
 {
     apr_status_t status;
 
-    if ((status = apr_file_pipe_create(in, out, pool)) != APR_SUCCESS)
+    if ((status = file_pipe_create(in, out, pool, pool)) != APR_SUCCESS)
         return status;
 
-    switch (blocking) {
-        case APR_FULL_BLOCK:
-            break;
-        case APR_READ_BLOCK:
-            apr_file_pipe_timeout_set(*out, 0);
-            break;
-        case APR_WRITE_BLOCK:
-            apr_file_pipe_timeout_set(*in, 0);
-            break;
-        default:
-            apr_file_pipe_timeout_set(*out, 0);
-            apr_file_pipe_timeout_set(*in, 0);
-    }
+    file_pipe_block(in, out, blocking);
 
     return APR_SUCCESS;
 }
 
+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)
+{
+    apr_status_t status;
+
+    if ((status = file_pipe_create(in, out, pool_in, pool_out)) != APR_SUCCESS)
+        return status;
+
+    file_pipe_block(in, out, blocking);
+
+    return APR_SUCCESS;
+}
     
     
 APR_DECLARE(apr_status_t) apr_file_namedpipe_create(const char *filename, apr_fileperms_t
perm, apr_pool_t *pool)

Modified: apr/apr/branches/1.6.x/file_io/unix/pipe.c
URL: http://svn.apache.org/viewvc/apr/apr/branches/1.6.x/file_io/unix/pipe.c?rev=1736523&r1=1736522&r2=1736523&view=diff
==============================================================================
--- apr/apr/branches/1.6.x/file_io/unix/pipe.c (original)
+++ apr/apr/branches/1.6.x/file_io/unix/pipe.c Fri Mar 25 01:28:13 2016
@@ -176,7 +176,8 @@ APR_DECLARE(apr_status_t) apr_os_pipe_pu
     return apr_os_pipe_put_ex(file, thefile, 0, pool);
 }
 
-APR_DECLARE(apr_status_t) apr_file_pipe_create(apr_file_t **in, apr_file_t **out, apr_pool_t
*pool)
+static apr_status_t file_pipe_create(apr_file_t **in, apr_file_t **out,
+        apr_pool_t *pool_in, apr_pool_t *pool_out)
 {
     int filedes[2];
 
@@ -184,8 +185,8 @@ APR_DECLARE(apr_status_t) apr_file_pipe_
         return errno;
     }
     
-    (*in) = (apr_file_t *)apr_pcalloc(pool, sizeof(apr_file_t));
-    (*in)->pool = pool;
+    (*in) = (apr_file_t *)apr_pcalloc(pool_in, sizeof(apr_file_t));
+    (*in)->pool = pool_in;
     (*in)->filedes = filedes[0];
     (*in)->is_pipe = 1;
     (*in)->fname = NULL;
@@ -200,8 +201,8 @@ APR_DECLARE(apr_status_t) apr_file_pipe_
 #ifndef WAITIO_USES_POLL
     (*in)->pollset = NULL;
 #endif
-    (*out) = (apr_file_t *)apr_pcalloc(pool, sizeof(apr_file_t));
-    (*out)->pool = pool;
+    (*out) = (apr_file_t *)apr_pcalloc(pool_out, sizeof(apr_file_t));
+    (*out)->pool = pool_out;
     (*out)->filedes = filedes[1];
     (*out)->is_pipe = 1;
     (*out)->fname = NULL;
@@ -222,6 +223,30 @@ APR_DECLARE(apr_status_t) apr_file_pipe_
     return APR_SUCCESS;
 }
 
+static void file_pipe_block(apr_file_t **in, apr_file_t **out, apr_int32_t blocking)
+{
+    switch (blocking) {
+    case APR_FULL_BLOCK:
+        break;
+    case APR_READ_BLOCK:
+        apr_file_pipe_timeout_set(*out, 0);
+        break;
+    case APR_WRITE_BLOCK:
+        apr_file_pipe_timeout_set(*in, 0);
+        break;
+    default:
+        apr_file_pipe_timeout_set(*out, 0);
+        apr_file_pipe_timeout_set(*in, 0);
+        break;
+    }
+}
+
+APR_DECLARE(apr_status_t) apr_file_pipe_create(apr_file_t **in,
+        apr_file_t **out, apr_pool_t *pool)
+{
+    return file_pipe_create(in, out, pool, pool);
+}
+
 APR_DECLARE(apr_status_t) apr_file_pipe_create_ex(apr_file_t **in, 
                                                   apr_file_t **out, 
                                                   apr_int32_t blocking,
@@ -229,23 +254,26 @@ APR_DECLARE(apr_status_t) apr_file_pipe_
 {
     apr_status_t status;
 
-    if ((status = apr_file_pipe_create(in, out, pool)) != APR_SUCCESS)
+    if ((status = file_pipe_create(in, out, pool, pool)) != APR_SUCCESS) {
         return status;
+    }
 
-    switch (blocking) {
-        case APR_FULL_BLOCK:
-            break;
-        case APR_READ_BLOCK:
-            apr_file_pipe_timeout_set(*out, 0);
-            break;
-        case APR_WRITE_BLOCK:
-            apr_file_pipe_timeout_set(*in, 0);
-            break;
-        default:
-            apr_file_pipe_timeout_set(*out, 0);
-            apr_file_pipe_timeout_set(*in, 0);
+    file_pipe_block(in, out, blocking);
+
+    return APR_SUCCESS;
+}
+
+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)
+{
+    apr_status_t status;
+
+    if ((status = file_pipe_create(in, out, pool_in, pool_out)) != APR_SUCCESS) {
+        return status;
     }
 
+    file_pipe_block(in, out, blocking);
+
     return APR_SUCCESS;
 }
 

Modified: apr/apr/branches/1.6.x/file_io/win32/pipe.c
URL: http://svn.apache.org/viewvc/apr/apr/branches/1.6.x/file_io/win32/pipe.c?rev=1736523&r1=1736522&r2=1736523&view=diff
==============================================================================
--- apr/apr/branches/1.6.x/file_io/win32/pipe.c (original)
+++ apr/apr/branches/1.6.x/file_io/win32/pipe.c Fri Mar 25 01:28:13 2016
@@ -68,7 +68,7 @@ APR_DECLARE(apr_status_t) apr_file_pipe_
                                                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_
                                                   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_
 #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_
 #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_
         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_
         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;
         }

Modified: apr/apr/branches/1.6.x/include/apr_file_io.h
URL: http://svn.apache.org/viewvc/apr/apr/branches/1.6.x/include/apr_file_io.h?rev=1736523&r1=1736522&r2=1736523&view=diff
==============================================================================
--- apr/apr/branches/1.6.x/include/apr_file_io.h (original)
+++ apr/apr/branches/1.6.x/include/apr_file_io.h Fri Mar 25 01:28:13 2016
@@ -695,7 +695,7 @@ APR_DECLARE(apr_status_t) apr_file_seek(
  * @bug  Some platforms cannot toggle between blocking and nonblocking,
  * and when passing a pipe as a standard handle to an application which
  * does not expect it, a non-blocking stream will fluxor the client app.
- * @deprecated @see apr_file_pipe_create_ex()
+ * @deprecated @see apr_file_pipe_create_pools()
  */
 APR_DECLARE(apr_status_t) apr_file_pipe_create(apr_file_t **in, 
                                                apr_file_t **out,
@@ -719,6 +719,7 @@ APR_DECLARE(apr_status_t) apr_file_pipe_
  * does not expect it, a non-blocking stream will fluxor the client app.
  * Use this function rather than apr_file_pipe_create() to create pipes 
  * where one or both ends require non-blocking semantics.
+ * @deprecated @see apr_file_pipe_create_pools()
  */
 APR_DECLARE(apr_status_t) apr_file_pipe_create_ex(apr_file_t **in, 
                                                   apr_file_t **out, 
@@ -726,6 +727,33 @@ APR_DECLARE(apr_status_t) apr_file_pipe_
                                                   apr_pool_t *pool);
 
 /**
+ * Create an anonymous pipe which portably supports async timeout options,
+ * placing each side of the pipe in a different pool.
+ * @param in The newly created pipe's file for reading.
+ * @param out The newly created pipe's file for writing.
+ * @param blocking one of these values defined in apr_thread_proc.h;
+ *                 @li #APR_FULL_BLOCK
+ *                 @li #APR_READ_BLOCK
+ *                 @li #APR_WRITE_BLOCK
+ *                 @li #APR_FULL_NONBLOCK
+ * @param pool_in The pool for the reading pipe.
+ * @param pool_out The pool for the writing pipe.
+ * @remark By default, the returned file descriptors will be inherited
+ * by child processes created using apr_proc_create().  This can be
+ * changed using apr_file_inherit_unset().
+ * @remark Some platforms cannot toggle between blocking and nonblocking,
+ * and when passing a pipe as a standard handle to an application which
+ * does not expect it, a non-blocking stream will fluxor the client app.
+ * Use this function rather than apr_file_pipe_create() to create pipes
+ * where one or both ends require non-blocking semantics.
+ */
+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);
+
+/**
  * Create a named pipe.
  * @param filename The filename of the named pipe
  * @param perm The permissions for the newly created pipe.

Modified: apr/apr/branches/1.6.x/test/testpipe.c
URL: http://svn.apache.org/viewvc/apr/apr/branches/1.6.x/test/testpipe.c?rev=1736523&r1=1736522&r2=1736523&view=diff
==============================================================================
--- apr/apr/branches/1.6.x/test/testpipe.c (original)
+++ apr/apr/branches/1.6.x/test/testpipe.c Fri Mar 25 01:28:13 2016
@@ -56,7 +56,7 @@ static void set_timeout(abts_case *tc, v
     apr_status_t rv;
     apr_interval_time_t timeout;
 
-    rv = apr_file_pipe_create_ex(&readp, &writep, APR_WRITE_BLOCK, p);
+    rv = apr_file_pipe_create_pools(&readp, &writep, APR_WRITE_BLOCK, p, p);
     ABTS_INT_EQUAL(tc, APR_SUCCESS, rv);
     ABTS_PTR_NOTNULL(tc, readp);
     ABTS_PTR_NOTNULL(tc, writep);
@@ -83,7 +83,7 @@ static void read_write(abts_case *tc, vo
     nbytes = strlen("this is a test");
     buf = (char *)apr_palloc(p, nbytes + 1);
 
-    rv = apr_file_pipe_create_ex(&readp, &writep, APR_WRITE_BLOCK, p);
+    rv = apr_file_pipe_create_pools(&readp, &writep, APR_WRITE_BLOCK, p, p);
     ABTS_INT_EQUAL(tc, APR_SUCCESS, rv);
     ABTS_PTR_NOTNULL(tc, readp);
     ABTS_PTR_NOTNULL(tc, writep);



Mime
View raw message