apr_file_io.h

Go to the documentation of this file.
00001 /* Licensed to the Apache Software Foundation (ASF) under one or more
00002  * contributor license agreements.  See the NOTICE file distributed with
00003  * this work for additional information regarding copyright ownership.
00004  * The ASF licenses this file to You under the Apache License, Version 2.0
00005  * (the "License"); you may not use this file except in compliance with
00006  * the License.  You may obtain a copy of the License at
00007  *
00008  *     http://www.apache.org/licenses/LICENSE-2.0
00009  *
00010  * Unless required by applicable law or agreed to in writing, software
00011  * distributed under the License is distributed on an "AS IS" BASIS,
00012  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013  * See the License for the specific language governing permissions and
00014  * limitations under the License.
00015  */
00016 
00017 #ifndef APR_FILE_IO_H
00018 #define APR_FILE_IO_H
00019 
00025 #include "apr.h"
00026 #include "apr_pools.h"
00027 #include "apr_time.h"
00028 #include "apr_errno.h"
00029 #include "apr_file_info.h"
00030 #include "apr_inherit.h"
00031 
00032 #define APR_WANT_STDIO          
00033 #define APR_WANT_IOVEC          
00034 #include "apr_want.h"
00035 
00036 #ifdef __cplusplus
00037 extern "C" {
00038 #endif /* __cplusplus */
00039 
00051 /* Note to implementors: Values in the range 0x00100000--0x80000000
00052    are reserved for platform-specific values. */
00053 
00054 #define APR_READ       0x00001     
00055 #define APR_WRITE      0x00002     
00056 #define APR_CREATE     0x00004     
00057 #define APR_APPEND     0x00008     
00058 #define APR_TRUNCATE   0x00010     
00059 #define APR_BINARY     0x00020     
00060 #define APR_EXCL       0x00040     
00062 #define APR_BUFFERED   0x00080     
00063 #define APR_DELONCLOSE 0x00100     
00064 #define APR_XTHREAD    0x00200     
00066 #define APR_SHARELOCK  0x00400     
00069 #define APR_FILE_NOCLEANUP 0x00800 
00071 #define APR_SENDFILE_ENABLED 0x01000 
00073 #define APR_LARGEFILE   0x04000    
00094 /* flags for apr_file_seek */
00095 
00096 #define APR_SET SEEK_SET
00097 
00098 #define APR_CUR SEEK_CUR
00099 
00100 #define APR_END SEEK_END
00101 
00108 /* flags for apr_file_attrs_set */
00109 #define APR_FILE_ATTR_READONLY   0x01          
00110 #define APR_FILE_ATTR_EXECUTABLE 0x02          
00111 #define APR_FILE_ATTR_HIDDEN     0x04          
00115 typedef apr_uint32_t apr_fileattrs_t;
00116 
00118 typedef int       apr_seek_where_t;
00119 
00123 typedef struct apr_file_t         apr_file_t;
00124 
00125 /* File lock types/flags */
00131 #define APR_FLOCK_SHARED        1       
00137 #define APR_FLOCK_EXCLUSIVE     2       
00142 #define APR_FLOCK_TYPEMASK      0x000F  
00143 #define APR_FLOCK_NONBLOCK      0x0010  
00182 APR_DECLARE(apr_status_t) apr_file_open(apr_file_t **newf, const char *fname,
00183                                    apr_int32_t flag, apr_fileperms_t perm,
00184                                    apr_pool_t *pool);
00185 
00190 APR_DECLARE(apr_status_t) apr_file_close(apr_file_t *file);
00191 
00198 APR_DECLARE(apr_status_t) apr_file_remove(const char *path, apr_pool_t *cont);
00199 
00208 APR_DECLARE(apr_status_t) apr_file_rename(const char *from_path, 
00209                                           const char *to_path,
00210                                           apr_pool_t *pool);
00211 
00224 APR_DECLARE(apr_status_t) apr_file_copy(const char *from_path, 
00225                                         const char *to_path,
00226                                         apr_fileperms_t perms,
00227                                         apr_pool_t *pool);
00228 
00240 APR_DECLARE(apr_status_t) apr_file_append(const char *from_path, 
00241                                           const char *to_path,
00242                                           apr_fileperms_t perms,
00243                                           apr_pool_t *pool);
00244 
00250 APR_DECLARE(apr_status_t) apr_file_eof(apr_file_t *fptr);
00251 
00267 APR_DECLARE(apr_status_t) apr_file_open_stderr(apr_file_t **thefile,
00268                                           apr_pool_t *cont);
00269 
00285 APR_DECLARE(apr_status_t) apr_file_open_stdout(apr_file_t **thefile,
00286                                           apr_pool_t *cont);
00287 
00303 APR_DECLARE(apr_status_t) apr_file_open_stdin(apr_file_t **thefile,
00304                                               apr_pool_t *cont);
00305 
00323 APR_DECLARE(apr_status_t) apr_file_read(apr_file_t *thefile, void *buf,
00324                                    apr_size_t *nbytes);
00325 
00341 APR_DECLARE(apr_status_t) apr_file_write(apr_file_t *thefile, const void *buf,
00342                                     apr_size_t *nbytes);
00343 
00359 APR_DECLARE(apr_status_t) apr_file_writev(apr_file_t *thefile,
00360                                      const struct iovec *vec,
00361                                      apr_size_t nvec, apr_size_t *nbytes);
00362 
00382 APR_DECLARE(apr_status_t) apr_file_read_full(apr_file_t *thefile, void *buf,
00383                                         apr_size_t nbytes,
00384                                         apr_size_t *bytes_read);
00385 
00404 APR_DECLARE(apr_status_t) apr_file_write_full(apr_file_t *thefile, const void *buf,
00405                                          apr_size_t nbytes, 
00406                                          apr_size_t *bytes_written);
00407 
00413 APR_DECLARE(apr_status_t) apr_file_putc(char ch, apr_file_t *thefile);
00414 
00420 APR_DECLARE(apr_status_t) apr_file_getc(char *ch, apr_file_t *thefile);
00421 
00427 APR_DECLARE(apr_status_t) apr_file_ungetc(char ch, apr_file_t *thefile);
00428 
00436 APR_DECLARE(apr_status_t) apr_file_gets(char *str, int len, apr_file_t *thefile);
00437 
00443 APR_DECLARE(apr_status_t) apr_file_puts(const char *str, apr_file_t *thefile);
00444 
00449 APR_DECLARE(apr_status_t) apr_file_flush(apr_file_t *thefile);
00450 
00458 APR_DECLARE(apr_status_t) apr_file_dup(apr_file_t **new_file,
00459                                       apr_file_t *old_file,
00460                                       apr_pool_t *p);
00461 
00470 APR_DECLARE(apr_status_t) apr_file_dup2(apr_file_t *new_file,
00471                                         apr_file_t *old_file,
00472                                         apr_pool_t *p);
00473 
00485 APR_DECLARE(apr_status_t) apr_file_setaside(apr_file_t **new_file,
00486                                             apr_file_t *old_file,
00487                                             apr_pool_t *p);
00488 
00502 APR_DECLARE(apr_status_t) apr_file_seek(apr_file_t *thefile, 
00503                                    apr_seek_where_t where,
00504                                    apr_off_t *offset);
00505 
00512 APR_DECLARE(apr_status_t) apr_file_pipe_create(apr_file_t **in, apr_file_t **out,
00513                                           apr_pool_t *cont);
00514 
00521 APR_DECLARE(apr_status_t) apr_file_namedpipe_create(const char *filename, 
00522                                                apr_fileperms_t perm, 
00523                                                apr_pool_t *cont);
00524 
00530 APR_DECLARE(apr_status_t) apr_file_pipe_timeout_get(apr_file_t *thepipe, 
00531                                                apr_interval_time_t *timeout);
00532 
00539 APR_DECLARE(apr_status_t) apr_file_pipe_timeout_set(apr_file_t *thepipe, 
00540                                                apr_interval_time_t timeout);
00541 
00553 APR_DECLARE(apr_status_t) apr_file_lock(apr_file_t *thefile, int type);
00554 
00559 APR_DECLARE(apr_status_t) apr_file_unlock(apr_file_t *thefile);
00560 
00568 APR_DECLARE(apr_status_t) apr_file_name_get(const char **new_path, 
00569                                            apr_file_t *thefile);
00570 
00577 APR_DECLARE(apr_status_t) apr_file_data_get(void **data, const char *key, 
00578                                            apr_file_t *file);
00579 
00587 APR_DECLARE(apr_status_t) apr_file_data_set(apr_file_t *file, void *data,
00588                                            const char *key,
00589                                            apr_status_t (*cleanup)(void *));
00590 
00598 APR_DECLARE_NONSTD(int) apr_file_printf(apr_file_t *fptr, 
00599                                         const char *format, ...)
00600         __attribute__((format(printf,2,3)));
00601 
00612 APR_DECLARE(apr_status_t) apr_file_perms_set(const char *fname,
00613                                            apr_fileperms_t perms);
00614 
00633 APR_DECLARE(apr_status_t) apr_file_attrs_set(const char *fname,
00634                                              apr_fileattrs_t attributes,
00635                                              apr_fileattrs_t attr_mask,
00636                                              apr_pool_t *cont);
00637 
00646 APR_DECLARE(apr_status_t) apr_file_mtime_set(const char *fname,
00647                                              apr_time_t mtime,
00648                                              apr_pool_t *pool);
00649 
00656 APR_DECLARE(apr_status_t) apr_dir_make(const char *path, apr_fileperms_t perm, 
00657                         apr_pool_t *cont);
00658 
00666 APR_DECLARE(apr_status_t) apr_dir_make_recursive(const char *path,
00667                                                  apr_fileperms_t perm,
00668                                                  apr_pool_t *pool);
00669 
00675 APR_DECLARE(apr_status_t) apr_dir_remove(const char *path, apr_pool_t *cont);
00676 
00683 APR_DECLARE(apr_status_t) apr_file_info_get(apr_finfo_t *finfo, 
00684                                           apr_int32_t wanted,
00685                                           apr_file_t *thefile);
00686 
00687 
00694 APR_DECLARE(apr_status_t) apr_file_trunc(apr_file_t *fp, apr_off_t offset);
00695 
00701 APR_DECLARE(apr_int32_t) apr_file_flags_get(apr_file_t *f);
00702 
00706 APR_POOL_DECLARE_ACCESSOR(file);
00707 
00712 APR_DECLARE_INHERIT_SET(file);
00713 
00715 APR_DECLARE(void) apr_file_set_inherit(apr_file_t *file);
00716 
00720 APR_DECLARE_INHERIT_UNSET(file);
00721 
00723 APR_DECLARE(void) apr_file_unset_inherit(apr_file_t *file);
00724 
00741 APR_DECLARE(apr_status_t) apr_file_mktemp(apr_file_t **fp, char *templ,
00742                                           apr_int32_t flags, apr_pool_t *p);
00743 
00744 
00757 APR_DECLARE(apr_status_t) apr_temp_dir_get(const char **temp_dir, 
00758                                            apr_pool_t *p);
00759 
00762 #ifdef __cplusplus
00763 }
00764 #endif
00765 
00766 #endif  /* ! APR_FILE_IO_H */

Generated on Mon Nov 26 11:47:26 2007 for Apache Portable Runtime by  doxygen 1.5.2