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