GME
13
|
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 FILE_IO_H 00018 #define FILE_IO_H 00019 00020 #include "apr_private.h" 00021 #include "apr_general.h" 00022 #include "apr_thread_mutex.h" 00023 #include "apr_file_io.h" 00024 #include "apr_file_info.h" 00025 #include "apr_errno.h" 00026 #include "apr_poll.h" 00027 00028 /* We have an implementation of mkstemp but it's not very multi-threading 00029 * friendly & is part of the POSIX emulation rather than native so don't 00030 * use it. 00031 */ 00032 #undef HAVE_MKSTEMP 00033 00034 #define APR_FILE_DEFAULT_BUFSIZE 4096 00035 #define APR_FILE_BUFSIZE APR_FILE_DEFAULT_BUFSIZE 00036 00037 struct apr_file_t { 00038 apr_pool_t *pool; 00039 HFILE filedes; 00040 char * fname; 00041 int isopen; 00042 int buffered; 00043 int eof_hit; 00044 apr_int32_t flags; 00045 int timeout; 00046 int pipe; 00047 HEV pipeSem; 00048 enum { BLK_UNKNOWN, BLK_OFF, BLK_ON } blocking; 00049 00050 /* Stuff for buffered mode */ 00051 char *buffer; 00052 apr_size_t bufsize; /* Read/Write position in buffer */ 00053 apr_size_t bufpos; /* Read/Write position in buffer */ 00054 unsigned long dataRead; /* amount of valid data read into buffer */ 00055 int direction; /* buffer being used for 0 = read, 1 = write */ 00056 unsigned long filePtr; /* position in file of handle */ 00057 apr_thread_mutex_t *mutex; /* mutex semaphore, must be owned to access 00058 the above fields */ 00059 }; 00060 00061 struct apr_dir_t { 00062 apr_pool_t *pool; 00063 char *dirname; 00064 ULONG handle; 00065 FILEFINDBUF3 entry; 00066 int validentry; 00067 }; 00068 00069 apr_status_t apr_file_cleanup(void *); 00070 apr_status_t apr_os2_time_to_apr_time(apr_time_t *result, FDATE os2date, 00071 FTIME os2time); 00072 apr_status_t apr_apr_time_to_os2_time(FDATE *os2date, FTIME *os2time, 00073 apr_time_t aprtime); 00074 00075 /* see win32/fileio.h for description of these */ 00076 extern const char c_is_fnchar[256]; 00077 00078 #define IS_FNCHAR(c) c_is_fnchar[(unsigned char)c] 00079 00080 apr_status_t filepath_root_test(char *path, apr_pool_t *p); 00081 apr_status_t filepath_drive_get(char **rootpath, char drive, 00082 apr_int32_t flags, apr_pool_t *p); 00083 apr_status_t filepath_root_case(char **rootpath, char *root, apr_pool_t *p); 00084 00085 #endif /* ! FILE_IO_H */ 00086