00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef FILE_IO_H
00018 #define FILE_IO_H
00019
00020 #include "apr.h"
00021 #include "apr_private.h"
00022 #include "apr_general.h"
00023 #include "apr_tables.h"
00024 #include "apr_file_io.h"
00025 #include "apr_file_info.h"
00026 #include "apr_errno.h"
00027 #include "apr_lib.h"
00028 #include "apr_thread_mutex.h"
00029 #ifndef WAITIO_USES_POLL
00030 #include "apr_poll.h"
00031 #endif
00032
00033
00034 #if APR_HAVE_FCNTL_H
00035 #include <fcntl.h>
00036 #endif
00037 #if APR_HAVE_SYS_TYPES_H
00038 #include <sys/types.h>
00039 #endif
00040 #if APR_HAVE_ERRNO_H
00041 #include <errno.h>
00042 #endif
00043 #if APR_HAVE_STRING_H
00044 #include <string.h>
00045 #endif
00046 #if APR_HAVE_STRINGS_H
00047 #include <strings.h>
00048 #endif
00049 #if APR_HAVE_DIRENT_H
00050 #include <dirent.h>
00051 #endif
00052 #ifdef HAVE_SYS_STAT_H
00053 #include <sys/stat.h>
00054 #endif
00055 #if APR_HAVE_UNISTD_H
00056 #include <unistd.h>
00057 #endif
00058 #if APR_HAVE_STDIO_H
00059 #include <stdio.h>
00060 #endif
00061 #if APR_HAVE_STDLIB_H
00062 #include <stdlib.h>
00063 #endif
00064 #if APR_HAVE_SYS_UIO_H
00065 #include <sys/uio.h>
00066 #endif
00067 #if APR_HAVE_SYS_TIME_H
00068 #include <sys/time.h>
00069 #endif
00070 #ifdef BEOS
00071 #include <kernel/OS.h>
00072 #endif
00073
00074 #if BEOS_BONE
00075 # ifndef BONE7
00076
00077 # include <sys/socket.h>
00078 # else
00079
00080 # include <sys/ioctl.h>
00081 # endif
00082 #endif
00083
00084
00085 #define APR_FILE_BUFSIZE 4096
00086
00087 struct apr_file_t {
00088 apr_pool_t *pool;
00089 int filedes;
00090 char *fname;
00091 apr_int32_t flags;
00092 int eof_hit;
00093 int is_pipe;
00094 apr_interval_time_t timeout;
00095 int buffered;
00096 enum {BLK_UNKNOWN, BLK_OFF, BLK_ON } blocking;
00097 int ungetchar;
00098 #ifndef WAITIO_USES_POLL
00099
00100 apr_pollset_t *pollset;
00101 #endif
00102
00103 char *buffer;
00104 int bufpos;
00105 unsigned long dataRead;
00106 int direction;
00107 apr_off_t filePtr;
00108 #if APR_HAS_THREADS
00109 struct apr_thread_mutex_t *thlock;
00110 #endif
00111 };
00112
00113 #if APR_HAS_LARGE_FILES && defined(_LARGEFILE64_SOURCE)
00114 #define stat(f,b) stat64(f,b)
00115 #define lstat(f,b) lstat64(f,b)
00116 #define fstat(f,b) fstat64(f,b)
00117 #define lseek(f,o,w) lseek64(f,o,w)
00118 #define ftruncate(f,l) ftruncate64(f,l)
00119 typedef struct stat64 struct_stat;
00120 #else
00121 typedef struct stat struct_stat;
00122 #endif
00123
00124 struct apr_dir_t {
00125 apr_pool_t *pool;
00126 char *dirname;
00127 DIR *dirstruct;
00128 struct dirent *entry;
00129 };
00130
00131 apr_status_t apr_unix_file_cleanup(void *);
00132
00133 mode_t apr_unix_perms2mode(apr_fileperms_t perms);
00134 apr_fileperms_t apr_unix_mode2perms(mode_t mode);
00135
00136
00137 #endif
00138