1
/* Copyright 2000-2005 The Apache Software Foundation or its licensors, as
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
* you may not use this file except in compliance with the License.
6
* You may obtain a copy of the License at
8
* http://www.apache.org/licenses/LICENSE-2.0
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.
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"
28
#include "apr_thread_mutex.h"
29
#ifndef WAITIO_USES_POLL
33
/* System headers the file I/O library needs */
37
#if APR_HAVE_SYS_TYPES_H
38
#include <sys/types.h>
46
#if APR_HAVE_STRINGS_H
52
#ifdef HAVE_SYS_STAT_H
64
#if APR_HAVE_SYS_UIO_H
67
#if APR_HAVE_SYS_TIME_H
71
#include <kernel/OS.h>
76
/* prior to BONE/7 fd_set & select were defined in sys/socket.h */
77
# include <sys/socket.h>
79
/* Be moved the fd_set stuff and also the FIONBIO definition... */
80
# include <sys/ioctl.h>
83
/* End System headers */
85
#define APR_FILE_BUFSIZE 4096
94
apr_interval_time_t timeout;
96
enum {BLK_UNKNOWN, BLK_OFF, BLK_ON } blocking;
97
int ungetchar; /* Last char provided by an unget op. (-1 = no char)*/
98
#ifndef WAITIO_USES_POLL
99
/* if there is a timeout set, then this pollset is used */
100
apr_pollset_t *pollset;
102
/* Stuff for buffered mode */
104
int bufpos; /* Read/Write position in buffer */
105
unsigned long dataRead; /* amount of valid data read into buffer */
106
int direction; /* buffer being used for 0 = read, 1 = write */
107
apr_off_t filePtr; /* position in file of handle */
109
struct apr_thread_mutex_t *thlock;
113
#if APR_HAS_LARGE_FILES && defined(_LARGEFILE64_SOURCE)
114
#define stat(f,b) stat64(f,b)
115
#define lstat(f,b) lstat64(f,b)
116
#define fstat(f,b) fstat64(f,b)
117
#define lseek(f,o,w) lseek64(f,o,w)
118
#define ftruncate(f,l) ftruncate64(f,l)
119
typedef struct stat64 struct_stat;
121
typedef struct stat struct_stat;
128
struct dirent *entry;
131
apr_status_t apr_unix_file_cleanup(void *);
133
mode_t apr_unix_perms2mode(apr_fileperms_t perms);
134
apr_fileperms_t apr_unix_mode2perms(mode_t mode);
137
#endif /* ! FILE_IO_H */