Apache2
apr_file_io.h
Go to the documentation of this file.
1 /* Licensed to the Apache Software Foundation (ASF) under one or more
2  * contributor license agreements. See the NOTICE file distributed with
3  * this work for additional information regarding copyright ownership.
4  * The ASF licenses this file to You under the Apache License, Version 2.0
5  * (the "License"); you may not use this file except in compliance with
6  * the License. You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef APR_FILE_IO_H
18 #define APR_FILE_IO_H
19 
25 #include "apr.h"
26 #include "apr_pools.h"
27 #include "apr_time.h"
28 #include "apr_errno.h"
29 #include "apr_file_info.h"
30 #include "apr_inherit.h"
31 
32 #define APR_WANT_STDIO
33 #define APR_WANT_IOVEC
34 #include "apr_want.h"
35 
36 #ifdef __cplusplus
37 extern "C" {
38 #endif /* __cplusplus */
39 
51 /* Note to implementors: Values in the range 0x00100000--0x80000000
52  are reserved for platform-specific values. */
53 
54 #define APR_FOPEN_READ 0x00001
55 #define APR_FOPEN_WRITE 0x00002
56 #define APR_FOPEN_CREATE 0x00004
57 #define APR_FOPEN_APPEND 0x00008
58 #define APR_FOPEN_TRUNCATE 0x00010
60 #define APR_FOPEN_BINARY 0x00020
63 #define APR_FOPEN_EXCL 0x00040
65 #define APR_FOPEN_BUFFERED 0x00080
66 #define APR_FOPEN_DELONCLOSE 0x00100
67 #define APR_FOPEN_XTHREAD 0x00200
70 #define APR_FOPEN_SHARELOCK 0x00400
74 #define APR_FOPEN_NOCLEANUP 0x00800
79 #define APR_FOPEN_SENDFILE_ENABLED 0x01000
82 #define APR_FOPEN_LARGEFILE 0x04000
86 #define APR_FOPEN_SPARSE 0x08000
90 #define APR_FOPEN_ROTATING 0x10000
92 #define APR_FOPEN_MANUAL_ROTATE 0x20000
94 #define APR_FOPEN_NONBLOCK 0x40000
99 /* backcompat */
100 #define APR_READ APR_FOPEN_READ
101 #define APR_WRITE APR_FOPEN_WRITE
102 #define APR_CREATE APR_FOPEN_CREATE
103 #define APR_APPEND APR_FOPEN_APPEND
104 #define APR_TRUNCATE APR_FOPEN_TRUNCATE
105 #define APR_BINARY APR_FOPEN_BINARY
106 #define APR_EXCL APR_FOPEN_EXCL
107 #define APR_BUFFERED APR_FOPEN_BUFFERED
108 #define APR_DELONCLOSE APR_FOPEN_DELONCLOSE
109 #define APR_XTHREAD APR_FOPEN_XTHREAD
110 #define APR_SHARELOCK APR_FOPEN_SHARELOCK
111 #define APR_FILE_NOCLEANUP APR_FOPEN_NOCLEANUP
112 #define APR_SENDFILE_ENABLED APR_FOPEN_SENDFILE_ENABLED
113 #define APR_LARGEFILE APR_FOPEN_LARGEFILE
150 /* flags for apr_file_seek */
152 #define APR_SET SEEK_SET
154 #define APR_CUR SEEK_CUR
156 #define APR_END SEEK_END
164 /* flags for apr_file_attrs_set */
165 #define APR_FILE_ATTR_READONLY 0x01
166 #define APR_FILE_ATTR_EXECUTABLE 0x02
167 #define APR_FILE_ATTR_HIDDEN 0x04
174 #if defined(DOXYGEN)
175 #define APR_MAX_IOVEC_SIZE 1024
177 #elif defined(IOV_MAX)
178 #define APR_MAX_IOVEC_SIZE IOV_MAX
179 #elif defined(MAX_IOVEC)
180 #define APR_MAX_IOVEC_SIZE MAX_IOVEC
181 #else
182 #define APR_MAX_IOVEC_SIZE 1024
183 #endif
188 
190 typedef int apr_seek_where_t;
191 
195 typedef struct apr_file_t apr_file_t;
196 
197 /* File lock types/flags */
203 #define APR_FLOCK_SHARED 1
209 #define APR_FLOCK_EXCLUSIVE 2
214 #define APR_FLOCK_TYPEMASK 0x000F
215 #define APR_FLOCK_NONBLOCK 0x0010
260  apr_int32_t flag, apr_fileperms_t perm,
261  apr_pool_t *pool);
262 
268 
277 
287 APR_DECLARE(apr_status_t) apr_file_rename(const char *from_path,
288  const char *to_path,
289  apr_pool_t *pool);
290 
297 APR_DECLARE(apr_status_t) apr_file_link(const char *from_path,
298  const char *to_path);
299 
312 APR_DECLARE(apr_status_t) apr_file_copy(const char *from_path,
313  const char *to_path,
314  apr_fileperms_t perms,
315  apr_pool_t *pool);
316 
332 APR_DECLARE(apr_status_t) apr_file_append(const char *from_path,
333  const char *to_path,
334  apr_fileperms_t perms,
335  apr_pool_t *pool);
336 
343 
360  apr_pool_t *pool);
361 
370  apr_pool_t *pool);
371 
380  apr_pool_t *pool);
381 
401  apr_pool_t *pool);
402 
422  apr_pool_t *pool);
423 
443  apr_pool_t *pool);
444 
463  apr_size_t *nbytes);
464 
481  apr_size_t *nbytes);
482 
499  const struct iovec *vec,
500  apr_size_t nvec, apr_size_t *nbytes);
501 
523  apr_size_t nbytes,
524  apr_size_t *bytes_read);
525 
547  const void *buf,
548  apr_size_t nbytes,
549  apr_size_t *bytes_written);
550 
551 
566  const struct iovec *vec,
567  apr_size_t nvec,
568  apr_size_t *nbytes);
575 
582 
589 
599  apr_file_t *thefile);
600 
607 
617 
623 
629 
635 
644  apr_file_t *old_file,
645  apr_pool_t *p);
646 
656  apr_file_t *old_file,
657  apr_pool_t *p);
658 
671  apr_file_t *old_file,
672  apr_pool_t *p);
673 
686  char * buffer,
688 
694 
707  apr_seek_where_t where,
708  apr_off_t *offset);
709 
724  apr_file_t **out,
725  apr_pool_t *pool);
726 
748  apr_file_t **out,
750  apr_pool_t *pool);
751 
774  apr_file_t **out,
776  apr_pool_t *pool_in,
777  apr_pool_t *pool_out);
778 
786  apr_fileperms_t perm,
787  apr_pool_t *pool);
788 
796 
805 
818 
824 
833  apr_file_t *thefile);
834 
841 APR_DECLARE(apr_status_t) apr_file_data_get(void **data, const char *key,
842  apr_file_t *file);
843 
852  const char *key,
853  apr_status_t (*cleanup)(void *));
854 
863  const char *format, ...)
864  __attribute__((format(printf,2,3)));
865 
879  apr_fileperms_t perms);
880 
898  apr_fileattrs_t attributes,
899  apr_fileattrs_t attr_mask,
900  apr_pool_t *pool);
901 
911  apr_time_t mtime,
912  apr_pool_t *pool);
913 
921  apr_pool_t *pool);
922 
931  apr_fileperms_t perm,
932  apr_pool_t *pool);
933 
942 
950  apr_int32_t wanted,
951  apr_file_t *thefile);
952 
953 
961 
968 
973 
979 
984 
1004 
1005 
1016  apr_pool_t *p);
1017 
1018 
1021 
1025 #ifdef __cplusplus
1026 }
1027 #endif
1028 
1029 #endif /* ! APR_FILE_IO_H */
APR Platform Definitions.
APR Error Codes.
APR File Information.
APR File Handle Inheritance Helpers.
APR memory allocation.
APR Time Library.
APR Standard Headers Support.
dav_resource int dav_locktoken dav_response int flags
Definition: mod_dav.h:1458
dav_buffer const char * str
Definition: mod_dav.h:465
apr_bucket_brigade request_rec apr_pool_t * pool
Definition: mod_dav.h:557
int apr_status_t
Definition: apr_errno.h:44
apr_int32_t apr_fileperms_t
Definition: apr_file_info.h:125
apr_int32_t apr_file_flags_get(apr_file_t *f)
apr_status_t apr_file_pipe_wait(apr_file_t *thepipe, apr_wait_type_t direction)
apr_status_t apr_file_append(const char *from_path, const char *to_path, apr_fileperms_t perms, apr_pool_t *pool)
apr_status_t apr_file_open_stdout(apr_file_t **thefile, apr_pool_t *pool)
apr_uint32_t apr_fileattrs_t
Definition: apr_file_io.h:187
apr_status_t apr_file_remove(const char *path, apr_pool_t *pool)
apr_status_t apr_file_writev_full(apr_file_t *thefile, const struct iovec *vec, apr_size_t nvec, apr_size_t *nbytes)
apr_status_t apr_file_rename(const char *from_path, const char *to_path, apr_pool_t *pool)
apr_status_t apr_file_copy(const char *from_path, const char *to_path, apr_fileperms_t perms, apr_pool_t *pool)
apr_status_t apr_file_lock(apr_file_t *thefile, int type)
apr_status_t apr_file_write(apr_file_t *thefile, const void *buf, apr_size_t *nbytes)
apr_status_t apr_file_pipe_create_ex(apr_file_t **in, apr_file_t **out, apr_int32_t blocking, apr_pool_t *pool)
apr_status_t apr_file_putc(char ch, apr_file_t *thefile)
apr_status_t apr_file_info_get(apr_finfo_t *finfo, apr_int32_t wanted, apr_file_t *thefile)
apr_status_t apr_file_unlock(apr_file_t *thefile)
apr_status_t apr_file_open_flags_stdin(apr_file_t **thefile, apr_int32_t flags, apr_pool_t *pool)
APR_DECLARE_INHERIT_UNSET(file)
apr_size_t apr_file_buffer_size_get(apr_file_t *thefile)
apr_status_t apr_file_sync(apr_file_t *thefile)
apr_status_t apr_dir_make(const char *path, apr_fileperms_t perm, apr_pool_t *pool)
apr_status_t apr_file_open_stdin(apr_file_t **thefile, apr_pool_t *pool)
apr_status_t apr_dir_remove(const char *path, apr_pool_t *pool)
apr_status_t apr_file_close(apr_file_t *file)
apr_status_t apr_file_write_full(apr_file_t *thefile, const void *buf, apr_size_t nbytes, apr_size_t *bytes_written)
APR_DECLARE_INHERIT_SET(file)
apr_status_t apr_file_data_set(apr_file_t *file, void *data, const char *key, apr_status_t(*cleanup)(void *))
apr_status_t apr_file_name_get(const char **new_path, apr_file_t *thefile)
apr_status_t apr_temp_dir_get(const char **temp_dir, apr_pool_t *p)
int apr_status_t apr_file_perms_set(const char *fname, apr_fileperms_t perms)
apr_status_t apr_file_dup2(apr_file_t *new_file, apr_file_t *old_file, apr_pool_t *p)
apr_status_t apr_file_namedpipe_create(const char *filename, apr_fileperms_t perm, apr_pool_t *pool)
apr_status_t apr_file_flush(apr_file_t *thefile)
apr_status_t apr_dir_make_recursive(const char *path, apr_fileperms_t perm, apr_pool_t *pool)
apr_status_t apr_file_dup(apr_file_t **new_file, apr_file_t *old_file, apr_pool_t *p)
apr_status_t apr_file_open_flags_stderr(apr_file_t **thefile, apr_int32_t flags, apr_pool_t *pool)
apr_status_t apr_file_mtime_set(const char *fname, apr_time_t mtime, apr_pool_t *pool)
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 apr_file_getc(char *ch, apr_file_t *thefile)
int apr_seek_where_t
Definition: apr_file_io.h:190
apr_status_t apr_file_eof(apr_file_t *fptr)
apr_status_t apr_file_pipe_timeout_get(apr_file_t *thepipe, apr_interval_time_t *timeout)
apr_status_t apr_file_rotating_check(apr_file_t *thefile)
apr_status_t apr_file_attrs_set(const char *fname, apr_fileattrs_t attributes, apr_fileattrs_t attr_mask, apr_pool_t *pool)
apr_status_t apr_file_ungetc(char ch, apr_file_t *thefile)
apr_status_t apr_file_seek(apr_file_t *thefile, apr_seek_where_t where, apr_off_t *offset)
apr_status_t apr_file_datasync(apr_file_t *thefile)
apr_status_t apr_file_link(const char *from_path, const char *to_path)
apr_status_t apr_file_pipe_create(apr_file_t **in, apr_file_t **out, apr_pool_t *pool)
apr_status_t apr_file_rotating_manual_check(apr_file_t *thefile, apr_time_t time)
apr_status_t apr_file_open(apr_file_t **newf, const char *fname, apr_int32_t flag, apr_fileperms_t perm, apr_pool_t *pool)
apr_status_t apr_file_trunc(apr_file_t *fp, apr_off_t offset)
apr_status_t apr_file_mktemp(apr_file_t **fp, char *templ, apr_int32_t flags, apr_pool_t *p)
apr_status_t apr_file_writev(apr_file_t *thefile, const struct iovec *vec, apr_size_t nvec, apr_size_t *nbytes)
apr_status_t apr_file_puts(const char *str, apr_file_t *thefile)
int apr_file_printf(apr_file_t *fptr, const char *format,...) __attribute__((format(printf
apr_status_t apr_file_setaside(apr_file_t **new_file, apr_file_t *old_file, apr_pool_t *p)
apr_status_t apr_file_read(apr_file_t *thefile, void *buf, apr_size_t *nbytes)
APR_POOL_DECLARE_ACCESSOR(file)
apr_status_t apr_file_open_flags_stdout(apr_file_t **thefile, apr_int32_t flags, apr_pool_t *pool)
apr_status_t apr_file_read_full(apr_file_t *thefile, void *buf, apr_size_t nbytes, apr_size_t *bytes_read)
apr_status_t apr_file_open_stderr(apr_file_t **thefile, apr_pool_t *pool)
apr_status_t apr_file_pipe_timeout_set(apr_file_t *thepipe, apr_interval_time_t timeout)
apr_status_t apr_file_gets(char *str, int len, apr_file_t *thefile)
apr_status_t apr_file_data_get(void **data, const char *key, apr_file_t *file)
apr_status_t apr_file_buffer_set(apr_file_t *thefile, char *buffer, apr_size_t bufsize)
apr_wait_type_t
Definition: apr_general.h:71
int apr_int32_t
Definition: apr.h:347
unsigned int apr_uint32_t
Definition: apr.h:348
off_t apr_off_t
Definition: apr.h:396
#define __attribute__(__x)
Definition: apr.h:63
size_t apr_size_t
Definition: apr.h:394
struct apr_pool_t apr_pool_t
Definition: apr_pools.h:60
apr_int64_t apr_interval_time_t
Definition: apr_time.h:55
apr_int64_t apr_time_t
Definition: apr_time.h:45
#define APR_DECLARE(x)
Definition: macros.h:6
#define APR_DECLARE_NONSTD(x)
Definition: macros.h:7
Definition: apr_arch_file_io.h:107
int direction
Definition: apr_arch_file_io.h:127
apr_interval_time_t timeout
Definition: apr_arch_file_io.h:114
char * buffer
Definition: apr_arch_file_io.h:123
apr_finfo_t * finfo
Definition: apr_arch_file_io.h:175
char * fname
Definition: apr_arch_file_io.h:110
enum apr_file_t::@20 blocking
apr_size_t bufsize
Definition: apr_arch_file_io.h:125
Definition: apr_file_info.h:174
apr_pool_t * p