summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjwoolley <jwoolley@13f79535-47bb-0310-9956-ffa450edef68>2001-06-27 19:40:53 +0000
committerjwoolley <jwoolley@13f79535-47bb-0310-9956-ffa450edef68>2001-06-27 19:40:53 +0000
commit72ca7b58d638167d6cd29066a782212d734bcf35 (patch)
tree9fde80bba271a4ee79734a0809bb5b7223215314
parent556da97ac6014cb611e34e73ae2df2db9d098c00 (diff)
downloadlibapr-72ca7b58d638167d6cd29066a782212d734bcf35.tar.gz
*) Add apr_file_flags_get() which returns the flags that were originally
passed in to apr_file_open(). *) Added APR_HAS_XTHREAD_FILES macro that indicates whether or not the platform handles files opened in APR_XTHREAD mode natively. Currently only Win32 has such native support. git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@61804 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--CHANGES7
-rw-r--r--file_io/unix/fileacc.c5
-rw-r--r--file_io/unix/filedup.c1
-rw-r--r--file_io/unix/open.c2
-rw-r--r--file_io/win32/filedup.c1
-rw-r--r--file_io/win32/open.c1
-rw-r--r--include/apr.h.in1
-rw-r--r--include/apr.hw1
-rw-r--r--include/apr_file_io.h13
-rw-r--r--include/arch/unix/fileio.h2
-rw-r--r--include/arch/win32/fileio.h1
11 files changed, 33 insertions, 2 deletions
diff --git a/CHANGES b/CHANGES
index ec8434ccf..dbf47d88b 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,5 +1,12 @@
Changes with APR b1
+ *) Add apr_file_flags_get() which returns the flags that were originally
+ passed in to apr_file_open(). [Cliff Woolley]
+
+ *) Added APR_HAS_XTHREAD_FILES macro that indicates whether or not the
+ platform handles files opened in APR_XTHREAD mode natively. Currently
+ only Win32 has such native support. [Cliff Woolley]
+
*) Fix gmt offset handling on Solaris. Apache log messages now show
local time again. PR #7902 [Taketo Kabe <kabe@sra-tohoku.co.jp>]
diff --git a/file_io/unix/fileacc.c b/file_io/unix/fileacc.c
index 6addcf9af..0a6dfcd7d 100644
--- a/file_io/unix/fileacc.c
+++ b/file_io/unix/fileacc.c
@@ -64,6 +64,11 @@ APR_DECLARE(apr_status_t) apr_file_name_get(const char **fname,
return APR_SUCCESS;
}
+APR_DECLARE(apr_int32_t) apr_file_flags_get(apr_file_t *f)
+{
+ return f->flags;
+}
+
#if !defined(OS2) && !defined(WIN32)
mode_t apr_unix_perms2mode(apr_fileperms_t perms)
{
diff --git a/file_io/unix/filedup.c b/file_io/unix/filedup.c
index 897429248..e7e6507d4 100644
--- a/file_io/unix/filedup.c
+++ b/file_io/unix/filedup.c
@@ -86,6 +86,7 @@ apr_status_t apr_file_dup(apr_file_t **new_file, apr_file_t *old_file, apr_pool_
(*new_file)->buffer = apr_palloc(p, APR_FILE_BUFSIZE);
}
(*new_file)->blocking = old_file->blocking; /* this is the way dup() works */
+ (*new_file)->flags = old_file->flags;
apr_pool_cleanup_register((*new_file)->cntxt, (void *)(*new_file), apr_unix_file_cleanup,
apr_pool_cleanup_null);
return APR_SUCCESS;
diff --git a/file_io/unix/open.c b/file_io/unix/open.c
index 87ee1b3a0..f3b9f9600 100644
--- a/file_io/unix/open.c
+++ b/file_io/unix/open.c
@@ -90,7 +90,7 @@ apr_status_t apr_file_open(apr_file_t **new, const char *fname, apr_int32_t flag
(*new) = (apr_file_t *)apr_pcalloc(cont, sizeof(apr_file_t));
(*new)->cntxt = cont;
- (*new)->oflags = oflags;
+ (*new)->flags = flag;
(*new)->filedes = -1;
if ((flag & APR_READ) && (flag & APR_WRITE)) {
diff --git a/file_io/win32/filedup.c b/file_io/win32/filedup.c
index e3e048ebe..e60eb1df6 100644
--- a/file_io/win32/filedup.c
+++ b/file_io/win32/filedup.c
@@ -103,6 +103,7 @@ APR_DECLARE(apr_status_t) apr_file_dup(apr_file_t **new_file,
return APR_ENOTIMPL;
}
+ (*new_file)->flags = old_file->flags;
(*new_file)->cntxt = old_file->cntxt;
(*new_file)->fname = apr_pstrdup(old_file->cntxt, old_file->fname);
(*new_file)->append = old_file->append;
diff --git a/file_io/win32/open.c b/file_io/win32/open.c
index 92b21df15..8a3a8eb13 100644
--- a/file_io/win32/open.c
+++ b/file_io/win32/open.c
@@ -259,6 +259,7 @@ APR_DECLARE(apr_status_t) apr_file_open(apr_file_t **new, const char *fname,
(*new)->cntxt = cont;
(*new)->filehand = handle;
(*new)->fname = apr_pstrdup(cont, fname);
+ (*new)->flags = flag;
if (flag & APR_APPEND) {
(*new)->append = 1;
diff --git a/include/apr.h.in b/include/apr.h.in
index ae898d3d8..c420e2aec 100644
--- a/include/apr.h.in
+++ b/include/apr.h.in
@@ -134,6 +134,7 @@
#define APR_HAS_UNICODE_FS 0
#define APR_HAS_USER 1
#define APR_HAS_LARGE_FILES 0
+#define APR_HAS_XTHREAD_FILES 0
/* This macro tells APR that it is safe to make a file masquerade as a
* socket. This is necessary, because some platforms support poll'ing
diff --git a/include/apr.hw b/include/apr.hw
index a5c57ae15..59be81439 100644
--- a/include/apr.hw
+++ b/include/apr.hw
@@ -210,6 +210,7 @@
#define APR_HAS_UNICODE_FS 1
#define APR_HAS_USER 1
#define APR_HAS_LARGE_FILES 1
+#define APR_HAS_XTHREAD_FILES 1
/* Not all platforms have a real INADDR_NONE. This macro replaces INADDR_NONE
* on all platforms.
diff --git a/include/apr_file_io.h b/include/apr_file_io.h
index bb785b474..902f15901 100644
--- a/include/apr_file_io.h
+++ b/include/apr_file_io.h
@@ -136,6 +136,11 @@ typedef struct apr_file_t apr_file_t;
* APR_BUFFERED buffer the data. Default is non-buffered
* APR_EXCL return error if APR_CREATE and file exists
* APR_DELONCLOSE delete the file after closing.
+ * APR_XTHREAD Platform dependent tag to open the file
+ * for use across multiple threads
+ * APR_SHARELOCK Platform dependent support for higher
+ * level locked read/write access to support
+ * writes across process/machines
* </PRE>
* @param perm Access permissions for file.
* @param cont The pool to use.
@@ -550,6 +555,14 @@ APR_DECLARE(apr_status_t) apr_file_info_get(apr_finfo_t *finfo,
APR_DECLARE(apr_status_t) apr_file_trunc(apr_file_t *fp, apr_off_t offset);
/**
+ * Retrieve the flags that were passed into apr_file_open()
+ * when the file was opened.
+ * @return apr_int32_t the flags
+ * @deffunc apr_int32_t apr_file_flags_get(apr_file_t *f)
+ */
+APR_DECLARE(apr_int32_t) apr_file_flags_get(apr_file_t *f);
+
+/**
* Get the pool used by the file.
* @return apr_pool_t the pool
* @deffunc apr_pool_t apr_file_pool_get(apr_file_t *f)
diff --git a/include/arch/unix/fileio.h b/include/arch/unix/fileio.h
index 2aff13e40..cd3dd0848 100644
--- a/include/arch/unix/fileio.h
+++ b/include/arch/unix/fileio.h
@@ -122,7 +122,7 @@ struct apr_file_t {
apr_pool_t *cntxt;
int filedes;
char *fname;
- int oflags;
+ apr_int32_t flags;
int eof_hit;
int pipe;
apr_interval_time_t timeout;
diff --git a/include/arch/win32/fileio.h b/include/arch/win32/fileio.h
index e17dc5644..164651fd7 100644
--- a/include/arch/win32/fileio.h
+++ b/include/arch/win32/fileio.h
@@ -172,6 +172,7 @@ struct apr_file_t {
BOOLEAN pipe; // Is this a pipe of a file?
OVERLAPPED *pOverlapped;
apr_interval_time_t timeout;
+ apr_int32_t flags;
/* File specific info */
apr_finfo_t *finfo;