Apache HTTPD
apr_arch_file_io.h
Go to the documentation of this file.
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#include "apr_poll.h"
29
30/* System headers the file I/O library needs */
31#if APR_HAVE_FCNTL_H
32#include <fcntl.h>
33#endif
34#if APR_HAVE_SYS_TYPES_H
35#include <sys/types.h>
36#endif
37#if APR_HAVE_ERRNO_H
38#include <errno.h>
39#endif
40#if APR_HAVE_STRING_H
41#include <string.h>
42#endif
43#if APR_HAVE_STRINGS_H
44#include <strings.h>
45#endif
46#if APR_HAVE_DIRENT_H
47#include <dirent.h>
48#endif
49#ifdef HAVE_SYS_STAT_H
50#include <sys/stat.h>
51#endif
52#if APR_HAVE_UNISTD_H
53#include <unistd.h>
54#endif
55#if APR_HAVE_STDIO_H
56#include <stdio.h>
57#endif
58#if APR_HAVE_STDLIB_H
59#include <stdlib.h>
60#endif
61#if APR_HAVE_SYS_UIO_H
62#include <sys/uio.h>
63#endif
64#if APR_HAVE_SYS_TIME_H
65#include <sys/time.h>
66#endif
67
68#include <fsio.h>
69
70/* End System headers */
71
72#define APR_FILE_DEFAULT_BUFSIZE 4096
73/* For backwards compat */
74#define APR_FILE_BUFSIZE APR_FILE_DEFAULT_BUFSIZE
75
76#if APR_HAS_THREADS
77#define file_lock(f) do { \
78 if ((f)->thlock) \
79 apr_thread_mutex_lock((f)->thlock); \
80 } while (0)
81#define file_unlock(f) do { \
82 if ((f)->thlock) \
83 apr_thread_mutex_unlock((f)->thlock); \
84 } while (0)
85#else
86#define file_lock(f) do {} while (0)
87#define file_unlock(f) do {} while (0)
88#endif
89
90#if APR_HAS_LARGE_FILES
91#define lseek(f,o,w) lseek64(f,o,w)
92#define ftruncate(f,l) ftruncate64(f,l)
93#endif
94
95typedef struct stat struct_stat;
96
97struct apr_file_t {
100 char *fname;
107 int ungetchar; /* Last char provided by an unget op. (-1 = no char)*/
108
109 /* if there is a timeout set, then this pollset is used */
111
112 /* Stuff for buffered mode */
113 char *buffer;
114 apr_size_t bufpos; /* Read/Write position in buffer */
115 apr_size_t bufsize; /* The buffer size */
116 apr_off_t dataRead; /* amount of valid data read into buffer */
117 int direction; /* buffer being used for 0 = read, 1 = write */
118 apr_off_t filePtr; /* position in file of handle */
119#if APR_HAS_THREADS
121#endif
122};
123
130
132
139
140#define MAX_SERVER_NAME 64
141#define MAX_VOLUME_NAME 64
142#define MAX_PATH_NAME 256
143#define MAX_FILE_NAME 256
144
145#define DRIVE_ONLY 1
146
147/* If the user passes d: vs. D: (or //mach/share vs. //MACH/SHARE),
148 * we need to fold the case to canonical form. This function is
149 * supposed to do so.
150 */
152
153/* This function check to see of the given path includes a drive/volume
154 * specifier. If the _only_ parameter is set to DRIVE_ONLY then it
155 * check to see of the path only contains a drive/volume specifier and
156 * nothing else.
157 */
159
160/* This function compares the drive/volume specifiers for each given path.
161 * It returns zero if they match or non-zero if not.
162 */
163apr_status_t filepath_compare_drive(const char *path1, const char *path2, apr_pool_t *p);
164
167
170
174
175#endif /* ! FILE_IO_H */
176
mode_t
Definition aplibtool.c:31
APR Error Codes.
APR File Information.
APR File I/O Handling.
APR Miscellaneous library routines.
APR general purpose library routines.
APR Poll interface.
APR Table library.
apr_dbd_transaction_t int mode
Definition apr_dbd.h:261
apr_size_t size
int apr_status_t
Definition apr_errno.h:44
apr_int32_t apr_fileperms_t
apr_file_t * thefile
const char apr_fileperms_t perms
const char apr_int32_t wanted
const char * rootpath
apr_int64_t apr_interval_time_t
Definition apr_time.h:55
apr_int64_t apr_time_t
Definition apr_time.h:45
apr_pool_t * p
Definition md_event.c:32
apr_status_t filepath_root_case(char **rootpath, char *root, apr_pool_t *p)
Definition filesys.c:21
mode_t apr_unix_perms2mode(apr_fileperms_t perms)
Definition fileacc.c:35
struct stat struct_stat
apr_status_t apr_unix_file_cleanup(void *)
Definition open.c:71
apr_status_t filepath_compare_drive(const char *path1, const char *path2, apr_pool_t *p)
Definition filesys.c:49
apr_status_t filepath_has_drive(const char *rootpath, int only, apr_pool_t *p)
Definition filesys.c:31
apr_fileperms_t apr_unix_mode2perms(mode_t mode)
Definition fileacc.c:71
apr_status_t apr_unix_child_file_cleanup(void *)
Definition open.c:85
apr_status_t apr_file_flush_locked(apr_file_t *thefile)
Definition readwrite.c:313
apr_status_t apr_file_info_get_locked(apr_finfo_t *finfo, apr_int32_t wanted, apr_file_t *thefile)
Definition filestat.c:85
struct dirent * entry
apr_pool_t * pool
apr_int32_t flags
apr_interval_time_t timeout
apr_size_t bufpos
apr_off_t filePtr
apr_pollset_t * pollset
apr_off_t dataRead
apr_pool_t * pool
apr_size_t bufsize
enum apr_file_t::@57 blocking
char * casedName
apr_time_t expire
NXPathCtx_t pathCtx
INT info