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 
00118 /* flags for apr_file_seek */
00119 
00120 #define APR_SET SEEK_SET
00121 
00122 #define APR_CUR SEEK_CUR
00123 
00124 #define APR_END SEEK_END
00125 
00132 /* flags for apr_file_attrs_set */
00133 #define APR_FILE_ATTR_READONLY   0x01          
00134 #define APR_FILE_ATTR_EXECUTABLE 0x02          
00135 #define APR_FILE_ATTR_HIDDEN     0x04          
00139 typedef apr_uint32_t apr_fileattrs_t;
00140 
00142 typedef int       apr_seek_where_t;
00143 
00147 typedef struct apr_file_t         apr_file_t;
00148 
00149 /* File lock types/flags */
00155 #define APR_FLOCK_SHARED        1       
00161 #define APR_FLOCK_EXCLUSIVE     2       
00166 #define APR_FLOCK_TYPEMASK      0x000F  
00167 #define APR_FLOCK_NONBLOCK      0x0010  
00206 APR_DECLARE(apr_status_t) apr_file_open(apr_file_t **new_file, const char *fname,
00207                                    apr_int32_t flag, apr_fileperms_t perm,
00208                                    apr_pool_t *cont);
00209 
00214 APR_DECLARE(apr_status_t) apr_file_close(apr_file_t *file);
00215 
00222 APR_DECLARE(apr_status_t) apr_file_remove(const char *path, apr_pool_t *cont);
00223 
00232 APR_DECLARE(apr_status_t) apr_file_rename(const char *from_path, 
00233                                           const char *to_path,
00234                                           apr_pool_t *pool);
00235 
00248 APR_DECLARE(apr_status_t) apr_file_copy(const char *from_path, 
00249                                         const char *to_path,
00250                                         apr_fileperms_t perms,
00251                                         apr_pool_t *pool);
00252 
00264 APR_DECLARE(apr_status_t) apr_file_append(const char *from_path, 
00265                                           const char *to_path,
00266                                           apr_fileperms_t perms,
00267                                           apr_pool_t *pool);
00268 
00274 APR_DECLARE(apr_status_t) apr_file_eof(apr_file_t *fptr);
00275 
00291 APR_DECLARE(apr_status_t) apr_file_open_stderr(apr_file_t **thefile,
00292                                           apr_pool_t *cont);
00293 
00309 APR_DECLARE(apr_status_t) apr_file_open_stdout(apr_file_t **thefile,
00310                                           apr_pool_t *cont);
00311 
00327 APR_DECLARE(apr_status_t) apr_file_open_stdin(apr_file_t **thefile,
00328                                               apr_pool_t *cont);
00329 
00347 APR_DECLARE(apr_status_t) apr_file_read(apr_file_t *thefile, void *buf,
00348                                    apr_size_t *nbytes);
00349 
00365 APR_DECLARE(apr_status_t) apr_file_write(apr_file_t *thefile, const void *buf,
00366                                     apr_size_t *nbytes);
00367 
00383 APR_DECLARE(apr_status_t) apr_file_writev(apr_file_t *thefile,
00384                                      const struct iovec *vec,
00385                                      apr_size_t nvec, apr_size_t *nbytes);
00386 
00406 APR_DECLARE(apr_status_t) apr_file_read_full(apr_file_t *thefile, void *buf,
00407                                         apr_size_t nbytes,
00408                                         apr_size_t *bytes_read);
00409 
00428 APR_DECLARE(apr_status_t) apr_file_write_full(apr_file_t *thefile, const void *buf,
00429                                          apr_size_t nbytes, 
00430                                          apr_size_t *bytes_written);
00431 
00437 APR_DECLARE(apr_status_t) apr_file_putc(char ch, apr_file_t *thefile);
00438 
00444 APR_DECLARE(apr_status_t) apr_file_getc(char *ch, apr_file_t *thefile);
00445 
00451 APR_DECLARE(apr_status_t) apr_file_ungetc(char ch, apr_file_t *thefile);
00452 
00460 APR_DECLARE(apr_status_t) apr_file_gets(char *str, int len, apr_file_t *thefile);
00461 
00467 APR_DECLARE(apr_status_t) apr_file_puts(const char *str, apr_file_t *thefile);
00468 
00473 APR_DECLARE(apr_status_t) apr_file_flush(apr_file_t *thefile);
00474 
00482 APR_DECLARE(apr_status_t) apr_file_dup(apr_file_t **new_file,
00483                                       apr_file_t *old_file,
00484                                       apr_pool_t *p);
00485 
00494 APR_DECLARE(apr_status_t) apr_file_dup2(apr_file_t *new_file,
00495                                         apr_file_t *old_file,
00496                                         apr_pool_t *p);
00497 
00509 APR_DECLARE(apr_status_t) apr_file_setaside(apr_file_t **new_file,
00510                                             apr_file_t *old_file,
00511                                             apr_pool_t *p);
00512 
00526 APR_DECLARE(apr_status_t) apr_file_seek(apr_file_t *thefile, 
00527                                    apr_seek_where_t where,
00528                                    apr_off_t *offset);
00529 
00536 APR_DECLARE(apr_status_t) apr_file_pipe_create(apr_file_t **in, apr_file_t **out,
00537                                           apr_pool_t *cont);
00538 
00545 APR_DECLARE(apr_status_t) apr_file_namedpipe_create(const char *filename, 
00546                                                apr_fileperms_t perm, 
00547                                                apr_pool_t *cont);
00548 
00554 APR_DECLARE(apr_status_t) apr_file_pipe_timeout_get(apr_file_t *thepipe, 
00555                                                apr_interval_time_t *timeout);
00556 
00563 APR_DECLARE(apr_status_t) apr_file_pipe_timeout_set(apr_file_t *thepipe, 
00564                                                apr_interval_time_t timeout);
00565 
00577 APR_DECLARE(apr_status_t) apr_file_lock(apr_file_t *thefile, int type);
00578 
00583 APR_DECLARE(apr_status_t) apr_file_unlock(apr_file_t *thefile);
00584 
00592 APR_DECLARE(apr_status_t) apr_file_name_get(const char **new_path, 
00593                                            apr_file_t *thefile);
00594 
00601 APR_DECLARE(apr_status_t) apr_file_data_get(void **data, const char *key, 
00602                                            apr_file_t *file);
00603 
00611 APR_DECLARE(apr_status_t) apr_file_data_set(apr_file_t *file, void *data,
00612                                            const char *key,
00613                                            apr_status_t (*cleanup)(void *));
00614 
00622 APR_DECLARE_NONSTD(int) apr_file_printf(apr_file_t *fptr, 
00623                                         const char *format, ...)
00624         __attribute__((format(printf,2,3)));
00625 
00636 APR_DECLARE(apr_status_t) apr_file_perms_set(const char *fname,
00637                                            apr_fileperms_t perms);
00638 
00657 APR_DECLARE(apr_status_t) apr_file_attrs_set(const char *fname,
00658                                              apr_fileattrs_t attributes,
00659                                              apr_fileattrs_t attr_mask,
00660                                              apr_pool_t *cont);
00661 
00670 APR_DECLARE(apr_status_t) apr_file_mtime_set(const char *fname,
00671                                              apr_time_t mtime,
00672                                              apr_pool_t *pool);
00673 
00680 APR_DECLARE(apr_status_t) apr_dir_make(const char *path, apr_fileperms_t perm, 
00681                         apr_pool_t *cont);
00682 
00690 APR_DECLARE(apr_status_t) apr_dir_make_recursive(const char *path,
00691                                                  apr_fileperms_t perm,
00692                                                  apr_pool_t *pool);
00693 
00699 APR_DECLARE(apr_status_t) apr_dir_remove(const char *path, apr_pool_t *cont);
00700 
00707 APR_DECLARE(apr_status_t) apr_file_info_get(apr_finfo_t *finfo, 
00708                                           apr_int32_t wanted,
00709                                           apr_file_t *thefile);
00710 
00711 
00717 APR_DECLARE(apr_status_t) apr_file_trunc(apr_file_t *fp, apr_off_t offset);
00718 
00724 APR_DECLARE(apr_int32_t) apr_file_flags_get(apr_file_t *f);
00725 
00729 APR_POOL_DECLARE_ACCESSOR(file);
00730 
00735 APR_DECLARE_INHERIT_SET(file);
00736 
00738 APR_DECLARE(void) apr_file_set_inherit(apr_file_t *file);
00739 
00743 APR_DECLARE_INHERIT_UNSET(file);
00744 
00746 APR_DECLARE(void) apr_file_unset_inherit(apr_file_t *file);
00747 
00764 APR_DECLARE(apr_status_t) apr_file_mktemp(apr_file_t **fp, char *templ,
00765                                           apr_int32_t flags, apr_pool_t *p);
00766 
00767 
00780 APR_DECLARE(apr_status_t) apr_temp_dir_get(const char **temp_dir, 
00781                                            apr_pool_t *p);
00782 
00785 #ifdef __cplusplus
00786 }
00787 #endif
00788 
00789 #endif  /* ! APR_FILE_IO_H */

Generated on Fri Oct 3 10:33:45 2003 for Apache Portable Runtime by doxygen 1.3.4