bottleneck testcase based on rubbos
[bottlenecks.git] / rubbos / app / httpd-2.0.64 / srclib / apr / include / arch / netware / apr_arch_file_io.h
1 /* Licensed to the Apache Software Foundation (ASF) under one or more
2  * contributor license agreements.  See the NOTICE file distributed with
3  * this work for additional information regarding copyright ownership.
4  * The ASF licenses this file to You under the Apache License, Version 2.0
5  * (the "License"); you may not use this file except in compliance with
6  * the License.  You may obtain a copy of the License at
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 #ifndef FILE_IO_H
18 #define FILE_IO_H
19
20 #include "apr.h"
21 #include "apr_private.h"
22 #include "apr_general.h"
23 #include "apr_tables.h"
24 #include "apr_file_io.h"
25 #include "apr_file_info.h"
26 #include "apr_errno.h"
27 #include "apr_lib.h"
28
29 /* System headers the file I/O library needs */
30 #if APR_HAVE_FCNTL_H
31 #include <fcntl.h>
32 #endif
33 #if APR_HAVE_SYS_TYPES_H
34 #include <sys/types.h>
35 #endif
36 #if APR_HAVE_ERRNO_H
37 #include <errno.h>
38 #endif
39 #if APR_HAVE_STRING_H
40 #include <string.h>
41 #endif
42 #if APR_HAVE_STRINGS_H
43 #include <strings.h>
44 #endif
45 #if APR_HAVE_DIRENT_H
46 #include <dirent.h>
47 #endif
48 #ifdef HAVE_SYS_STAT_H
49 #include <sys/stat.h>
50 #endif
51 #if APR_HAVE_UNISTD_H
52 #include <unistd.h>
53 #endif
54 #if APR_HAVE_STDIO_H
55 #include <stdio.h>
56 #endif
57 #if APR_HAVE_STDLIB_H
58 #include <stdlib.h>
59 #endif
60 #if APR_HAVE_SYS_UIO_H
61 #include <sys/uio.h>
62 #endif
63 #if APR_HAVE_SYS_TIME_H
64 #include <sys/time.h>
65 #endif
66
67 #include <fsio.h>
68
69 /* End System headers */
70
71 #define APR_FILE_BUFSIZE 4096
72
73 struct apr_file_t {
74     apr_pool_t *pool;
75     int filedes;
76     char *fname;
77     apr_int32_t flags;
78     int eof_hit;
79     int is_pipe;
80     apr_interval_time_t timeout;
81     int buffered;
82     enum {BLK_UNKNOWN, BLK_OFF, BLK_ON } blocking;
83     int ungetchar;    /* Last char provided by an unget op. (-1 = no char)*/
84
85     /* Stuff for buffered mode */
86     char *buffer;
87     int bufpos;               /* Read/Write position in buffer */
88     unsigned long dataRead;   /* amount of valid data read into buffer */
89     int direction;            /* buffer being used for 0 = read, 1 = write */
90     unsigned long filePtr;    /* position in file of handle */
91 #if APR_HAS_THREADS
92     struct apr_thread_mutex_t *thlock;
93 #endif
94 };
95
96 #if APR_HAS_THREADS
97 #define file_lock(f)   do { \
98                            if ((f)->thlock) \
99                                apr_thread_mutex_lock((f)->thlock); \
100                        } while (0)
101 #define file_unlock(f) do { \
102                            if ((f)->thlock) \
103                                apr_thread_mutex_unlock((f)->thlock); \
104                        } while (0)
105 #else
106 #define file_lock(f)   do {} while (0)
107 #define file_unlock(f) do {} while (0)
108 #endif
109
110 struct apr_dir_t {
111     apr_pool_t *pool;
112     char *dirname;
113     DIR *dirstruct;
114     struct dirent *entry;
115 };
116
117 typedef struct apr_stat_entry_t apr_stat_entry_t;
118
119 struct apr_stat_entry_t {
120     struct stat info;
121     char *casedName;
122     apr_time_t expire;
123     NXPathCtx_t pathCtx;
124 };
125
126 #define MAX_SERVER_NAME     64
127 #define MAX_VOLUME_NAME     64
128 #define MAX_PATH_NAME       256
129 #define MAX_FILE_NAME       256
130
131 #define DRIVE_ONLY          1
132
133 /* If the user passes d: vs. D: (or //mach/share vs. //MACH/SHARE),
134  * we need to fold the case to canonical form.  This function is
135  * supposed to do so.
136  */
137 apr_status_t filepath_root_case(char **rootpath, char *root, apr_pool_t *p);
138
139 /* This function check to see of the given path includes a drive/volume
140  * specifier.  If the _only_ parameter is set to DRIVE_ONLY then it 
141  * check to see of the path only contains a drive/volume specifier and
142  * nothing else.
143  */
144 apr_status_t filepath_has_drive(const char *rootpath, int only, apr_pool_t *p);
145
146 /* This function compares the drive/volume specifiers for each given path.
147  * It returns zero if they match or non-zero if not. 
148  */
149 apr_status_t filepath_compare_drive(const char *path1, const char *path2, apr_pool_t *p);
150
151 apr_status_t apr_unix_file_cleanup(void *);
152 apr_status_t apr_unix_child_file_cleanup(void *);
153
154 apr_status_t apr_file_flush_locked(apr_file_t *thefile);
155 apr_status_t apr_file_info_get_locked(apr_finfo_t *finfo, apr_int32_t wanted,
156                                       apr_file_t *thefile);
157
158 #endif  /* ! FILE_IO_H */
159