stoddard 02/03/05 19:23:23
Modified: . CHANGES
file_io/os2 open.c
file_io/unix open.c
file_io/win32 open.c
include apr_file_io.h
Log:
Add the APR_FILE_NOCLEANUP flag to apr_file_open().
Adding the flag will prevent the file from being closed
when the pool passed in on apr_file_open() is destroyed.
This feature is useful when using apr_os_file_get|put()
to manage the apr_os_file_t in apr_file_t (ie, file handle
caching in the HTTP server) [Bill Stoddard]
Revision Changes Path
1.232 +7 -0 apr/CHANGES
Index: CHANGES
===================================================================
RCS file: /home/cvs/apr/CHANGES,v
retrieving revision 1.231
retrieving revision 1.232
diff -u -r1.231 -r1.232
--- CHANGES 6 Mar 2002 02:47:33 -0000 1.231
+++ CHANGES 6 Mar 2002 03:23:23 -0000 1.232
@@ -1,4 +1,11 @@
Changes with APR b1
+ *) Add the APR_FILE_NOCLEANUP flag to apr_file_open().
+ Adding the flag will prevent the file from being closed
+ when the pool passed in on apr_file_open() is destroyed.
+ This feature is useful when using apr_os_file_get|put()
+ to manage the apr_os_file_t in apr_file_t (ie, file handle
+ caching in the HTTP server) [Bill Stoddard]
+
*) Win32: Fix APR_XTHREAD problems in apr_file_read()
and apr_file_write(). Multiple threads were using the
same overlapped structure and io event handle created
1.49 +4 -1 apr/file_io/os2/open.c
Index: open.c
===================================================================
RCS file: /home/cvs/apr/file_io/os2/open.c,v
retrieving revision 1.48
retrieving revision 1.49
diff -u -r1.48 -r1.49
--- open.c 8 Jan 2002 06:26:09 -0000 1.48
+++ open.c 6 Mar 2002 03:23:23 -0000 1.49
@@ -144,7 +144,10 @@
dafile->dataRead = 0;
dafile->direction = 0;
dafile->pipe = FALSE;
- apr_pool_cleanup_register(dafile->cntxt, dafile, apr_file_cleanup,
apr_file_cleanup);
+
+ if (!(flag & APR_FILE_NOCLEANUP)) {
+ apr_pool_cleanup_register(dafile->cntxt, dafile, apr_file_cleanup,
apr_file_cleanup);
+ }
return APR_SUCCESS;
}
1.91 +5 -2 apr/file_io/unix/open.c
Index: open.c
===================================================================
RCS file: /home/cvs/apr/file_io/unix/open.c,v
retrieving revision 1.90
retrieving revision 1.91
diff -u -r1.90 -r1.91
--- open.c 8 Jan 2002 06:26:09 -0000 1.90
+++ open.c 6 Mar 2002 03:23:23 -0000 1.91
@@ -172,8 +172,11 @@
(*new)->bufpos = 0;
(*new)->dataRead = 0;
(*new)->direction = 0;
- apr_pool_cleanup_register((*new)->cntxt, (void *)(*new),
- apr_unix_file_cleanup, apr_unix_file_cleanup);
+
+ if (!(flag & APR_FILE_NOCLEANUP)) {
+ apr_pool_cleanup_register((*new)->cntxt, (void *)(*new),
+ apr_unix_file_cleanup,
apr_unix_file_cleanup);
+ }
return APR_SUCCESS;
}
1.97 +4 -2 apr/file_io/win32/open.c
Index: open.c
===================================================================
RCS file: /home/cvs/apr/file_io/win32/open.c,v
retrieving revision 1.96
retrieving revision 1.97
diff -u -r1.96 -r1.97
--- open.c 6 Mar 2002 02:47:34 -0000 1.96
+++ open.c 6 Mar 2002 03:23:23 -0000 1.97
@@ -403,8 +403,10 @@
(*new)->direction = 0;
(*new)->filePtr = 0;
- apr_pool_cleanup_register((*new)->cntxt, (void *)(*new), file_cleanup,
- apr_pool_cleanup_null);
+ if (!(flag & APR_FILE_NOCLEANUP)) {
+ apr_pool_cleanup_register((*new)->cntxt, (void *)(*new),
file_cleanup,
+ apr_pool_cleanup_null);
+ }
return APR_SUCCESS;
}
1.119 +6 -0 apr/include/apr_file_io.h
Index: apr_file_io.h
===================================================================
RCS file: /home/cvs/apr/include/apr_file_io.h,v
retrieving revision 1.118
retrieving revision 1.119
diff -u -r1.118 -r1.119
--- apr_file_io.h 11 Feb 2002 21:03:44 -0000 1.118
+++ apr_file_io.h 6 Mar 2002 03:23:23 -0000 1.119
@@ -101,6 +101,8 @@
#define APR_SHARELOCK 1024 /**< Platform dependent support for higher
level locked read/write access to
support
writes across process/machines */
+#define APR_FILE_NOCLEANUP 2048 /**< Do not register a cleanup when the
file
+ is opened */
/** @} */
@@ -179,6 +181,10 @@
* APR_SHARELOCK Platform dependent support for higher
* level locked read/write access to support
* writes across process/machines
+ * APR_FILE_NOCLEANUP Do not register a cleanup with the pool
+ * passed in on the <EM>cont</EM> argument
(see below).
+ * The apr_os_file_t handle in apr_file_t
will not
+ & be closed when the pool is destroyed.
* </PRE>
* @param perm Access permissions for file.
* @param cont The pool to use.