Main Page | Modules | Data Structures | File List | Data Fields | Globals | Related Pages

apr_file_io.h

Go to the documentation of this file.
00001 /* Copyright 2000-2004 The Apache Software Foundation
00002  *
00003  * Licensed under the Apache License, Version 2.0 (the "License");
00004  * you may not use this file except in compliance with the License.
00005  * You may obtain a copy of the License at
00006  *
00007  *     http://www.apache.org/licenses/LICENSE-2.0
00008  *
00009  * Unless required by applicable law or agreed to in writing, software
00010  * distributed under the License is distributed on an "AS IS" BASIS,
00011  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00012  * See the License for the specific language governing permissions and
00013  * limitations under the License.
00014  */
00015 
00016 #ifndef APR_FILE_IO_H
00017 #define APR_FILE_IO_H
00018 
00024 #include "apr.h"
00025 #include "apr_pools.h"
00026 #include "apr_time.h"
00027 #include "apr_errno.h"
00028 #include "apr_file_info.h"
00029 #include "apr_inherit.h"
00030 
00031 #define APR_WANT_STDIO          
00032 #define APR_WANT_IOVEC          
00033 #include "apr_want.h"
00034 
00035 #ifdef __cplusplus
00036 extern "C" {
00037 #endif /* __cplusplus */
00038 
00050 /* Note to implementors: Values in the range 0x00100000--0x80000000
00051    are reserved for platform-specific values. */
00052 
00053 #define APR_READ       0x00001     
00054 #define APR_WRITE      0x00002     
00055 #define APR_CREATE     0x00004     
00056 #define APR_APPEND     0x00008     
00057 #define APR_TRUNCATE   0x00010     
00058 #define APR_BINARY     0x00020     
00059 #define APR_EXCL       0x00040     
00061 #define APR_BUFFERED   0x00080     
00062 #define APR_DELONCLOSE 0x00100     
00063 #define APR_XTHREAD    0x00200     
00065 #define APR_SHARELOCK  0x00400     
00068 #define APR_FILE_NOCLEANUP 0x00800 
00070 #define APR_SENDFILE_ENABLED 0x01000 
00072 #define APR_LARGEFILE   0x04000    
00093 /* flags for apr_file_seek */
00094 
00095 #define APR_SET SEEK_SET
00096 
00097 #define APR_CUR SEEK_CUR
00098 
00099 #define APR_END SEEK_END
00100 
00107 /* flags for apr_file_attrs_set */
00108 #define APR_FILE_ATTR_READONLY   0x01          
00109 #define APR_FILE_ATTR_EXECUTABLE 0x02          
00110 #define APR_FILE_ATTR_HIDDEN     0x04          
00114 typedef apr_uint32_t apr_fileattrs_t;
00115 
00117 typedef int       apr_seek_where_t;
00118 
00122 typedef struct apr_file_t         apr_file_t;
00123 
00124 /* File lock types/flags */
00130 #define APR_FLOCK_SHARED        1       
00136 #define APR_FLOCK_EXCLUSIVE     2       
00141 #define APR_FLOCK_TYPEMASK      0x000F  
00142 #define APR_FLOCK_NONBLOCK      0x0010  
00181 APR_DECLARE(apr_status_t) apr_file_open(apr_file_t **new_file, const char *fname,
00182                                    apr_int32_t flag, apr_fileperms_t perm,
00183                                    apr_pool_t *cont);
00184 
00189 APR_DECLARE(apr_status_t) apr_file_close(apr_file_t *file);
00190 
00197 APR_DECLARE(apr_status_t) apr_file_remove(const char *path, apr_pool_t *cont);
00198 
00207 APR_DECLARE(apr_status_t) apr_file_rename(const char *from_path, 
00208                                           const char *to_path,
00209                                           apr_pool_t *pool);
00210 
00223 APR_DECLARE(apr_status_t) apr_file_copy(const char *from_path, 
00224                                         const char *to_path,
00225                                         apr_fileperms_t perms,
00226                                         apr_pool_t *pool);
00227 
00239 APR_DECLARE(apr_status_t) apr_file_append(const char *from_path, 
00240                                           const char *to_path,
00241                                           apr_fileperms_t perms,
00242                                           apr_pool_t *pool);
00243 
00249 APR_DECLARE(apr_status_t) apr_file_eof(apr_file_t *fptr);
00250 
00266 APR_DECLARE(apr_status_t) apr_file_open_stderr(apr_file_t **thefile,
00267                                           apr_pool_t *cont);
00268 
00284 APR_DECLARE(apr_status_t) apr_file_open_stdout(apr_file_t **thefile,
00285                                           apr_pool_t *cont);
00286 
00302 APR_DECLARE(apr_status_t) apr_file_open_stdin(apr_file_t **thefile,
00303                                               apr_pool_t *cont);
00304 
00322 APR_DECLARE(apr_status_t) apr_file_read(apr_file_t *thefile, void *buf,
00323                                    apr_size_t *nbytes);
00324 
00340 APR_DECLARE(apr_status_t) apr_file_write(apr_file_t *thefile, const void *buf,
00341                                     apr_size_t *nbytes);
00342 
00358 APR_DECLARE(apr_status_t) apr_file_writev(apr_file_t *thefile,
00359                                      const struct iovec *vec,
00360                                      apr_size_t nvec, apr_size_t *nbytes);
00361 
00381 APR_DECLARE(apr_status_t) apr_file_read_full(apr_file_t *thefile, void *buf,
00382                                         apr_size_t nbytes,
00383                                         apr_size_t *bytes_read);
00384 
00403 APR_DECLARE(apr_status_t) apr_file_write_full(apr_file_t *thefile, const void *buf,
00404                                          apr_size_t nbytes, 
00405                                          apr_size_t *bytes_written);
00406 
00412 APR_DECLARE(apr_status_t) apr_file_putc(char ch, apr_file_t *thefile);
00413 
00419 APR_DECLARE(apr_status_t) apr_file_getc(char *ch, apr_file_t *thefile);
00420 
00426 APR_DECLARE(apr_status_t) apr_file_ungetc(char ch, apr_file_t *thefile);
00427 
00435 APR_DECLARE(apr_status_t) apr_file_gets(char *str, int len, apr_file_t *thefile);
00436 
00442 APR_DECLARE(apr_status_t) apr_file_puts(const char *str, apr_file_t *thefile);
00443 
00448 APR_DECLARE(apr_status_t) apr_file_flush(apr_file_t *thefile);
00449 
00457 APR_DECLARE(apr_status_t) apr_file_dup(apr_file_t **new_file,
00458                                       apr_file_t *old_file,
00459                                       apr_pool_t *p);
00460 
00469 APR_DECLARE(apr_status_t) apr_file_dup2(apr_file_t *new_file,
00470                                         apr_file_t *old_file,
00471                                         apr_pool_t *p);
00472 
00484 APR_DECLARE(apr_status_t) apr_file_setaside(apr_file_t **new_file,
00485                                             apr_file_t *old_file,
00486                                             apr_pool_t *p);
00487 
00501 APR_DECLARE(apr_status_t) apr_file_seek(apr_file_t *thefile, 
00502                                    apr_seek_where_t where,
00503                                    apr_off_t *offset);
00504 
00511 APR_DECLARE(apr_status_t) apr_file_pipe_create(apr_file_t **in, apr_file_t **out,
00512                                           apr_pool_t *cont);
00513 
00520 APR_DECLARE(apr_status_t) apr_file_namedpipe_create(const char *filename, 
00521                                                apr_fileperms_t perm, 
00522                                                apr_pool_t *cont);
00523 
00529 APR_DECLARE(apr_status_t) apr_file_pipe_timeout_get(apr_file_t *thepipe, 
00530                                                apr_interval_time_t *timeout);
00531 
00538 APR_DECLARE(apr_status_t) apr_file_pipe_timeout_set(apr_file_t *thepipe, 
00539                                                apr_interval_time_t timeout);
00540 
00552 APR_DECLARE(apr_status_t) apr_file_lock(apr_file_t *thefile, int type);
00553 
00558 APR_DECLARE(apr_status_t) apr_file_unlock(apr_file_t *thefile);
00559 
00567 APR_DECLARE(apr_status_t) apr_file_name_get(const char **new_path, 
00568                                            apr_file_t *thefile);
00569 
00576 APR_DECLARE(apr_status_t) apr_file_data_get(void **data, const char *key, 
00577                                            apr_file_t *file);
00578 
00586 APR_DECLARE(apr_status_t) apr_file_data_set(apr_file_t *file, void *data,
00587                                            const char *key,
00588                                            apr_status_t (*cleanup)(void *));
00589 
00597 APR_DECLARE_NONSTD(int) apr_file_printf(apr_file_t *fptr, 
00598                                         const char *format, ...)
00599         __attribute__((format(printf,2,3)));
00600 
00611 APR_DECLARE(apr_status_t) apr_file_perms_set(const char *fname,
00612                                            apr_fileperms_t perms);
00613 
00632 APR_DECLARE(apr_status_t) apr_file_attrs_set(const char *fname,
00633                                              apr_fileattrs_t attributes,
00634                                              apr_fileattrs_t attr_mask,
00635                                              apr_pool_t *cont);
00636 
00645 APR_DECLARE(apr_status_t) apr_file_mtime_set(const char *fname,
00646                                              apr_time_t mtime,
00647                                              apr_pool_t *pool);
00648 
00655 APR_DECLARE(apr_status_t) apr_dir_make(const char *path, apr_fileperms_t perm, 
00656                         apr_pool_t *cont);
00657 
00665 APR_DECLARE(apr_status_t) apr_dir_make_recursive(const char *path,
00666                                                  apr_fileperms_t perm,
00667                                                  apr_pool_t *pool);
00668 
00674 APR_DECLARE(apr_status_t) apr_dir_remove(const char *path, apr_pool_t *cont);
00675 
00682 APR_DECLARE(apr_status_t) apr_file_info_get(apr_finfo_t *finfo, 
00683                                           apr_int32_t wanted,
00684                                           apr_file_t *thefile);
00685 
00686 
00692 APR_DECLARE(apr_status_t) apr_file_trunc(apr_file_t *fp, apr_off_t offset);
00693 
00699 APR_DECLARE(apr_int32_t) apr_file_flags_get(apr_file_t *f);
00700 
00704 APR_POOL_DECLARE_ACCESSOR(file);
00705 
00710 APR_DECLARE_INHERIT_SET(file);
00711 
00713 APR_DECLARE(void) apr_file_set_inherit(apr_file_t *file);
00714 
00718 APR_DECLARE_INHERIT_UNSET(file);
00719 
00721 APR_DECLARE(void) apr_file_unset_inherit(apr_file_t *file);
00722 
00739 APR_DECLARE(apr_status_t) apr_file_mktemp(apr_file_t **fp, char *templ,
00740                                           apr_int32_t flags, apr_pool_t *p);
00741 
00742 
00755 APR_DECLARE(apr_status_t) apr_temp_dir_get(const char **temp_dir, 
00756                                            apr_pool_t *p);
00757 
00760 #ifdef __cplusplus
00761 }
00762 #endif
00763 
00764 #endif  /* ! APR_FILE_IO_H */

Generated on Fri Sep 17 11:18:21 2004 for Apache Portable Runtime by doxygen 1.3.5