summaryrefslogtreecommitdiff
path: root/file_io/unix
diff options
context:
space:
mode:
authorColm MacCarthaigh <colm@apache.org>2005-10-15 08:22:41 +0000
committerColm MacCarthaigh <colm@apache.org>2005-10-15 08:22:41 +0000
commit6142ec9d2645ebd0249759b46eff6ecf491d140e (patch)
treec745d2f42b6e3986351dcdffdd485208803a0012 /file_io/unix
parentfe2b9c2641bd9bcb3e26c7c3c432f7a126da3eae (diff)
downloadapr-6142ec9d2645ebd0249759b46eff6ecf491d140e.tar.gz
Add apr_file_open_flags_std[err|out|in]() functions, to allow the opening of
the standard file descriptors with specific flags set. As a consequence we now also set APR_WRITE and APR_READ as appropriate when using the plain old apr_file_open_std[err|out|in]() functions. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@321314 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'file_io/unix')
-rw-r--r--file_io/unix/open.c39
1 files changed, 30 insertions, 9 deletions
diff --git a/file_io/unix/open.c b/file_io/unix/open.c
index 589c85314..3e3904ec0 100644
--- a/file_io/unix/open.c
+++ b/file_io/unix/open.c
@@ -262,28 +262,49 @@ APR_DECLARE(apr_status_t) apr_file_eof(apr_file_t *fptr)
return APR_SUCCESS;
}
-APR_DECLARE(apr_status_t) apr_file_open_stderr(apr_file_t **thefile,
- apr_pool_t *pool)
+APR_DECLARE(apr_status_t) apr_file_open_flags_stderr(apr_file_t **thefile,
+ apr_int32_t flags,
+ apr_pool_t *pool)
{
int fd = STDERR_FILENO;
- return apr_os_file_put(thefile, &fd, 0, pool);
+ return apr_os_file_put(thefile, &fd, flags | APR_WRITE, pool);
}
-APR_DECLARE(apr_status_t) apr_file_open_stdout(apr_file_t **thefile,
- apr_pool_t *pool)
+APR_DECLARE(apr_status_t) apr_file_open_flags_stdout(apr_file_t **thefile,
+ apr_int32_t flags,
+ apr_pool_t *pool)
{
int fd = STDOUT_FILENO;
- return apr_os_file_put(thefile, &fd, 0, pool);
+ return apr_os_file_put(thefile, &fd, flags | APR_WRITE, pool);
}
-APR_DECLARE(apr_status_t) apr_file_open_stdin(apr_file_t **thefile,
- apr_pool_t *pool)
+APR_DECLARE(apr_status_t) apr_file_open_flags_stdin(apr_file_t **thefile,
+ apr_int32_t flags,
+ apr_pool_t *pool)
{
int fd = STDIN_FILENO;
- return apr_os_file_put(thefile, &fd, 0, pool);
+ return apr_os_file_put(thefile, &fd, flags | APR_READ, pool);
+}
+
+APR_DECLARE(apr_status_t) apr_file_open_stderr(apr_file_t **thefile,
+ apr_pool_t *pool)
+{
+ return apr_file_open_flags_stderr(thefile, 0, pool);
+}
+
+APR_DECLARE(apr_status_t) apr_file_open_stdout(apr_file_t **thefile,
+ apr_pool_t *pool)
+{
+ return apr_file_open_flags_stdout(thefile, 0, pool);
+}
+
+APR_DECLARE(apr_status_t) apr_file_open_stdin(apr_file_t **thefile,
+ apr_pool_t *pool)
+{
+ return apr_file_open_flags_stdin(thefile, 0, pool);
}
APR_IMPLEMENT_INHERIT_SET(file, flags, pool, apr_unix_file_cleanup)