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

apr_file_io.h

Go to the documentation of this file.
00001 /* ====================================================================
00002  * The Apache Software License, Version 1.1
00003  *
00004  * Copyright (c) 2000-2003 The Apache Software Foundation.  All rights
00005  * reserved.
00006  *
00007  * Redistribution and use in source and binary forms, with or without
00008  * modification, are permitted provided that the following conditions
00009  * are met:
00010  *
00011  * 1. Redistributions of source code must retain the above copyright
00012  *    notice, this list of conditions and the following disclaimer.
00013  *
00014  * 2. Redistributions in binary form must reproduce the above copyright
00015  *    notice, this list of conditions and the following disclaimer in
00016  *    the documentation and/or other materials provided with the
00017  *    distribution.
00018  *
00019  * 3. The end-user documentation included with the redistribution,
00020  *    if any, must include the following acknowledgment:
00021  *       "This product includes software developed by the
00022  *        Apache Software Foundation (http://www.apache.org/)."
00023  *    Alternately, this acknowledgment may appear in the software itself,
00024  *    if and wherever such third-party acknowledgments normally appear.
00025  *
00026  * 4. The names "Apache" and "Apache Software Foundation" must
00027  *    not be used to endorse or promote products derived from this
00028  *    software without prior written permission. For written
00029  *    permission, please contact apache@apache.org.
00030  *
00031  * 5. Products derived from this software may not be called "Apache",
00032  *    nor may "Apache" appear in their name, without prior written
00033  *    permission of the Apache Software Foundation.
00034  *
00035  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
00036  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
00037  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
00038  * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
00039  * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
00040  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
00041  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
00042  * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
00043  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
00044  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
00045  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
00046  * SUCH DAMAGE.
00047  * ====================================================================
00048  *
00049  * This software consists of voluntary contributions made by many
00050  * individuals on behalf of the Apache Software Foundation.  For more
00051  * information on the Apache Software Foundation, please see
00052  * <http://www.apache.org/>.
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 /* __cplusplus */
00077 
00089 /* Note to implementors: Values in the range 0x00100000--0x80000000
00090    are reserved for platform-specific values. */
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 /* flags for apr_file_seek */
00133 
00134 #define APR_SET SEEK_SET
00135 
00136 #define APR_CUR SEEK_CUR
00137 
00138 #define APR_END SEEK_END
00139 
00146 /* flags for apr_file_attrs_set */
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 /* File lock types/flags */
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  /* ! APR_FILE_IO_H */

Generated on Mon Aug 10 12:41:09 2009 for Apache Portable Runtime by  doxygen 1.3.9.1