~ubuntu-branches/ubuntu/feisty/apache2/feisty

« back to all changes in this revision

Viewing changes to srclib/apr/include/arch/unix/apr_arch_file_io.h

  • Committer: Bazaar Package Importer
  • Author(s): Andreas Barth
  • Date: 2006-12-09 21:05:45 UTC
  • mfrom: (0.6.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20061209210545-h70s0xaqc2v8vqr2
Tags: 2.2.3-3.2
* Non-maintainer upload.
* 043_ajp_connection_reuse: Patch from upstream Bugzilla, fixing a critical
  issue with regard to connection reuse in mod_proxy_ajp.
  Closes: #396265

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* Copyright 2000-2005 The Apache Software Foundation or its licensors, as
 
2
 * applicable.
 
3
 *
 
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
 
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_thread_mutex.h"
 
29
#ifndef WAITIO_USES_POLL
 
30
#include "apr_poll.h"
 
31
#endif
 
32
 
 
33
/* System headers the file I/O library needs */
 
34
#if APR_HAVE_FCNTL_H
 
35
#include <fcntl.h>
 
36
#endif
 
37
#if APR_HAVE_SYS_TYPES_H
 
38
#include <sys/types.h>
 
39
#endif
 
40
#if APR_HAVE_ERRNO_H
 
41
#include <errno.h>
 
42
#endif
 
43
#if APR_HAVE_STRING_H
 
44
#include <string.h>
 
45
#endif
 
46
#if APR_HAVE_STRINGS_H
 
47
#include <strings.h>
 
48
#endif
 
49
#if APR_HAVE_DIRENT_H
 
50
#include <dirent.h>
 
51
#endif
 
52
#ifdef HAVE_SYS_STAT_H
 
53
#include <sys/stat.h>
 
54
#endif
 
55
#if APR_HAVE_UNISTD_H
 
56
#include <unistd.h>
 
57
#endif
 
58
#if APR_HAVE_STDIO_H
 
59
#include <stdio.h>
 
60
#endif
 
61
#if APR_HAVE_STDLIB_H
 
62
#include <stdlib.h>
 
63
#endif
 
64
#if APR_HAVE_SYS_UIO_H
 
65
#include <sys/uio.h>
 
66
#endif
 
67
#if APR_HAVE_SYS_TIME_H
 
68
#include <sys/time.h>
 
69
#endif
 
70
#ifdef BEOS
 
71
#include <kernel/OS.h>
 
72
#endif
 
73
 
 
74
#if BEOS_BONE
 
75
# ifndef BONE7
 
76
  /* prior to BONE/7 fd_set & select were defined in sys/socket.h */
 
77
#  include <sys/socket.h>
 
78
# else
 
79
  /* Be moved the fd_set stuff and also the FIONBIO definition... */
 
80
#  include <sys/ioctl.h>
 
81
# endif
 
82
#endif
 
83
/* End System headers */
 
84
 
 
85
#define APR_FILE_BUFSIZE 4096
 
86
 
 
87
struct apr_file_t {
 
88
    apr_pool_t *pool;
 
89
    int filedes;
 
90
    char *fname;
 
91
    apr_int32_t flags;
 
92
    int eof_hit;
 
93
    int is_pipe;
 
94
    apr_interval_time_t timeout;
 
95
    int buffered;
 
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;
 
101
#endif
 
102
    /* Stuff for buffered mode */
 
103
    char *buffer;
 
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 */
 
108
#if APR_HAS_THREADS
 
109
    struct apr_thread_mutex_t *thlock;
 
110
#endif
 
111
};
 
112
 
 
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;
 
120
#else
 
121
typedef struct stat struct_stat;
 
122
#endif
 
123
 
 
124
struct apr_dir_t {
 
125
    apr_pool_t *pool;
 
126
    char *dirname;
 
127
    DIR *dirstruct;
 
128
    struct dirent *entry;
 
129
};
 
130
 
 
131
apr_status_t apr_unix_file_cleanup(void *);
 
132
 
 
133
mode_t apr_unix_perms2mode(apr_fileperms_t perms);
 
134
apr_fileperms_t apr_unix_mode2perms(mode_t mode);
 
135
 
 
136
 
 
137
#endif  /* ! FILE_IO_H */
 
138