2 Copyright (c) 2003-2006 by Juliusz Chroboczek
4 Permission is hereby granted, free of charge, to any person obtaining a copy
5 of this software and associated documentation files (the "Software"), to deal
6 in the Software without restriction, including without limitation the rights
7 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 copies of the Software, and to permit persons to whom the Software is
9 furnished to do so, subject to the following conditions:
11 The above copyright notice and this permission notice shall be included in
12 all copies or substantial portions of the Software.
14 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
27 #include <sys/param.h>
29 #ifdef __MINGW32_VERSION
48 #include <sys/socket.h>
49 #include <netinet/in.h>
50 #include <netinet/tcp.h>
51 #include <arpa/inet.h>
53 #include <sys/types.h>
57 #include <sys/ioctl.h>
62 #define MAP_ANONYMOUS MAP_ANON
65 #if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
67 #elif defined(__GNUC__)
68 #define inline __inline
70 #define restrict __restrict
79 #if defined(__GNUC__) && (__GNUC__ >= 3)
80 #define ATTRIBUTE(x) __attribute__(x)
82 #define ATTRIBUTE(x) /**/
86 #define HAVE_TM_GMTOFF
95 #if (__GLIBC__ > 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2)
100 #if defined(__linux__) && (__GNU_LIBRARY__ == 1)
107 #define HAVE_TM_GMTOFF
114 #define HAVE_ASPRINTF
123 #if _POSIX_VERSION >= 200112L
130 #if (__GLIBC__ > 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2)
136 #define HAVE_ASPRINTF
137 #if __FreeBSD_version >= 400000
141 #if __FreeBSD_version >= 503001
147 #if __NetBSD_Version__ >= 105000000
150 #if __NetBSD_Version__ >= 200000000
152 #define HAVE_ASPRINTF
157 #if OpenBSD >= 200311
164 #if defined(i386) || defined(__mc68020__) || defined(__x86_64__)
165 #define UNALIGNED_ACCESS
173 #define HAVE_READV_WRITEV
175 #define READ(x, y, z) read(x, y, z)
176 #define WRITE(x, y, z) write(x, y, z)
177 #define CLOSE(x) close(x)
184 #ifdef HAVE_READV_WRITEV
185 #define WRITEV(x, y, z) writev(x, y, z)
186 #define READV(x, y, z) readv(x, y, z)
190 #define NO_REDIRECTOR
195 #include "ftsimport.h"
208 #include "diskcache.h"
210 #include "http_parse.h"
211 #include "parse_time.h"
212 #include "forbidden.h"
217 extern AtomPtr configFile
;
218 extern int daemonise
;
219 extern AtomPtr pidFile
;