00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
#ifndef APR_FILE_IO_H
00056
#define APR_FILE_IO_H
00057
00063
#include "apr.h"
00064
#include "apr_pools.h"
00065
#include "apr_time.h"
00066
#include "apr_errno.h"
00067
#include "apr_file_info.h"
00068
#include "apr_inherit.h"
00069
00070 #define APR_WANT_STDIO
00071 #define APR_WANT_IOVEC
00072
#include "apr_want.h"
00073
00074
#ifdef __cplusplus
00075
extern "C" {
00076
#endif
00077
00089
00090
00091
00092 #define APR_READ 0x00001
00093 #define APR_WRITE 0x00002
00094 #define APR_CREATE 0x00004
00095 #define APR_APPEND 0x00008
00096 #define APR_TRUNCATE 0x00010
00097 #define APR_BINARY 0x00020
00098 #define APR_EXCL 0x00040
00100 #define APR_BUFFERED 0x00080
00101 #define APR_DELONCLOSE 0x00100
00102 #define APR_XTHREAD 0x00200
00104 #define APR_SHARELOCK 0x00400
00107 #define APR_FILE_NOCLEANUP 0x00800
00109 #define APR_SENDFILE_ENABLED 0x01000
00111 #define APR_LARGEFILE 0x04000
00132
00133
00134 #define APR_SET SEEK_SET
00135
00136 #define APR_CUR SEEK_CUR
00137
00138 #define APR_END SEEK_END
00139
00146
00147 #define APR_FILE_ATTR_READONLY 0x01
00148 #define APR_FILE_ATTR_EXECUTABLE 0x02
00149 #define APR_FILE_ATTR_HIDDEN 0x04
00153 typedef apr_uint32_t apr_fileattrs_t;
00154
00156 typedef int apr_seek_where_t;
00157
00161 typedef struct apr_file_t apr_file_t;
00162
00163
00169 #define APR_FLOCK_SHARED 1
00175 #define APR_FLOCK_EXCLUSIVE 2
00180 #define APR_FLOCK_TYPEMASK 0x000F
00181 #define APR_FLOCK_NONBLOCK 0x0010
00220
APR_DECLARE(apr_status_t) apr_file_open(apr_file_t **new_file, const char *fname,
00221
apr_int32_t flag,
apr_fileperms_t perm,
00222
apr_pool_t *cont);
00223
00228
APR_DECLARE(
apr_status_t) apr_file_close(apr_file_t *file);
00229
00236 APR_DECLARE(
apr_status_t) apr_file_remove(const
char *path,
apr_pool_t *cont);
00237
00246 APR_DECLARE(
apr_status_t) apr_file_rename(const
char *from_path,
00247 const
char *to_path,
00248
apr_pool_t *pool);
00249
00262 APR_DECLARE(
apr_status_t) apr_file_copy(const
char *from_path,
00263 const
char *to_path,
00264
apr_fileperms_t perms,
00265
apr_pool_t *pool);
00266
00278 APR_DECLARE(
apr_status_t) apr_file_append(const
char *from_path,
00279 const
char *to_path,
00280
apr_fileperms_t perms,
00281
apr_pool_t *pool);
00282
00288 APR_DECLARE(
apr_status_t) apr_file_eof(apr_file_t *fptr);
00289
00305 APR_DECLARE(
apr_status_t) apr_file_open_stderr(apr_file_t **thefile,
00306
apr_pool_t *cont);
00307
00323 APR_DECLARE(
apr_status_t) apr_file_open_stdout(apr_file_t **thefile,
00324
apr_pool_t *cont);
00325
00341 APR_DECLARE(
apr_status_t) apr_file_open_stdin(apr_file_t **thefile,
00342
apr_pool_t *cont);
00343
00361 APR_DECLARE(
apr_status_t) apr_file_read(apr_file_t *thefile,
void *buf,
00362 apr_size_t *nbytes);
00363
00379 APR_DECLARE(
apr_status_t) apr_file_write(apr_file_t *thefile, const
void *buf,
00380 apr_size_t *nbytes);
00381
00397 APR_DECLARE(
apr_status_t) apr_file_writev(apr_file_t *thefile,
00398 const struct iovec *vec,
00399 apr_size_t nvec, apr_size_t *nbytes);
00400
00420 APR_DECLARE(
apr_status_t) apr_file_read_full(apr_file_t *thefile,
void *buf,
00421 apr_size_t nbytes,
00422 apr_size_t *bytes_read);
00423
00442 APR_DECLARE(
apr_status_t) apr_file_write_full(apr_file_t *thefile, const
void *buf,
00443 apr_size_t nbytes,
00444 apr_size_t *bytes_written);
00445
00451 APR_DECLARE(
apr_status_t) apr_file_putc(
char ch, apr_file_t *thefile);
00452
00458 APR_DECLARE(
apr_status_t) apr_file_getc(
char *ch, apr_file_t *thefile);
00459
00465 APR_DECLARE(
apr_status_t) apr_file_ungetc(
char ch, apr_file_t *thefile);
00466
00474 APR_DECLARE(
apr_status_t) apr_file_gets(
char *str,
int len, apr_file_t *thefile);
00475
00481 APR_DECLARE(
apr_status_t) apr_file_puts(const
char *str, apr_file_t *thefile);
00482
00487 APR_DECLARE(
apr_status_t) apr_file_flush(apr_file_t *thefile);
00488
00496 APR_DECLARE(
apr_status_t) apr_file_dup(apr_file_t **new_file,
00497 apr_file_t *old_file,
00498
apr_pool_t *p);
00499
00508 APR_DECLARE(
apr_status_t) apr_file_dup2(apr_file_t *new_file,
00509 apr_file_t *old_file,
00510
apr_pool_t *p);
00511
00523 APR_DECLARE(
apr_status_t) apr_file_setaside(apr_file_t **new_file,
00524 apr_file_t *old_file,
00525
apr_pool_t *p);
00526
00540 APR_DECLARE(
apr_status_t) apr_file_seek(apr_file_t *thefile,
00541 apr_seek_where_t where,
00542 apr_off_t *offset);
00543
00550 APR_DECLARE(
apr_status_t) apr_file_pipe_create(apr_file_t **in, apr_file_t **out,
00551
apr_pool_t *cont);
00552
00559 APR_DECLARE(
apr_status_t) apr_file_namedpipe_create(const
char *filename,
00560
apr_fileperms_t perm,
00561
apr_pool_t *cont);
00562
00568 APR_DECLARE(
apr_status_t) apr_file_pipe_timeout_get(apr_file_t *thepipe,
00569
apr_interval_time_t *timeout);
00570
00577 APR_DECLARE(
apr_status_t) apr_file_pipe_timeout_set(apr_file_t *thepipe,
00578
apr_interval_time_t timeout);
00579
00591 APR_DECLARE(
apr_status_t) apr_file_lock(apr_file_t *thefile,
int type);
00592
00597 APR_DECLARE(
apr_status_t) apr_file_unlock(apr_file_t *thefile);
00598
00606 APR_DECLARE(
apr_status_t) apr_file_name_get(const
char **new_path,
00607 apr_file_t *thefile);
00608
00615 APR_DECLARE(
apr_status_t) apr_file_data_get(
void **data, const
char *key,
00616 apr_file_t *file);
00617
00625 APR_DECLARE(
apr_status_t) apr_file_data_set(apr_file_t *file,
void *data,
00626 const
char *key,
00627
apr_status_t (*cleanup)(
void *));
00628
00636 APR_DECLARE_NONSTD(
int) apr_file_printf(apr_file_t *fptr,
00637 const
char *format, ...)
00638 __attribute__((format(printf,2,3)));
00639
00650 APR_DECLARE(
apr_status_t) apr_file_perms_set(const
char *fname,
00651
apr_fileperms_t perms);
00652
00671 APR_DECLARE(
apr_status_t) apr_file_attrs_set(const
char *fname,
00672
apr_fileattrs_t attributes,
00673
apr_fileattrs_t attr_mask,
00674
apr_pool_t *cont);
00675
00684 APR_DECLARE(
apr_status_t) apr_file_mtime_set(const
char *fname,
00685
apr_time_t mtime,
00686
apr_pool_t *pool);
00687
00694 APR_DECLARE(
apr_status_t) apr_dir_make(const
char *path,
apr_fileperms_t perm,
00695
apr_pool_t *cont);
00696
00704 APR_DECLARE(
apr_status_t) apr_dir_make_recursive(const
char *path,
00705
apr_fileperms_t perm,
00706
apr_pool_t *pool);
00707
00713 APR_DECLARE(
apr_status_t) apr_dir_remove(const
char *path,
apr_pool_t *cont);
00714
00721 APR_DECLARE(
apr_status_t) apr_file_info_get(
apr_finfo_t *finfo,
00722 apr_int32_t wanted,
00723 apr_file_t *thefile);
00724
00725
00731 APR_DECLARE(
apr_status_t) apr_file_trunc(apr_file_t *fp, apr_off_t offset);
00732
00738 APR_DECLARE(apr_int32_t) apr_file_flags_get(apr_file_t *f);
00739
00743 APR_POOL_DECLARE_ACCESSOR(file);
00744
00749 APR_DECLARE_INHERIT_SET(file);
00750
00752 APR_DECLARE(
void) apr_file_set_inherit(apr_file_t *file);
00753
00757 APR_DECLARE_INHERIT_UNSET(file);
00758
00760 APR_DECLARE(
void) apr_file_unset_inherit(apr_file_t *file);
00761
00778 APR_DECLARE(
apr_status_t) apr_file_mktemp(apr_file_t **fp,
char *templ,
00779 apr_int32_t flags,
apr_pool_t *p);
00780
00781
00794 APR_DECLARE(
apr_status_t) apr_temp_dir_get(const
char **temp_dir,
00795
apr_pool_t *p);
00796
00799 #ifdef __cplusplus
00800 }
00801 #endif
00802
00803 #endif