/[hydra]/hydra/src/compat.h
ViewVC logotype

Contents of /hydra/src/compat.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.7.2.1 - (show annotations)
Sat Dec 14 08:50:25 2002 UTC (21 years, 3 months ago) by nmav
Branch: hydra_0_1_0_patches
CVS Tags: hydra_0_1_3, hydra_0_1_2, hydra_0_1_1
Changes since 1.7: +2 -2 lines
File MIME type: text/plain
Large file support is now enabled by default, since it does not
affect performance.

1 /*
2 * Boa, an http server
3 * Copyright (C) 1995 Paul Phillips <paulp@go2net.com>
4 * Some changes Copyright (C) 1999-2000 Jon Nelson <jnelson@boa.org>
5 * and Larry Doolittle <ldoolitt@boa.org>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 1, or (at your option)
10 * any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 *
21 */
22
23 /* $Id: compat.h,v 1.7 2002/10/26 20:58:48 nmav Exp $*/
24
25 #ifndef _COMPAT_H
26 #define _COMPAT_H
27
28 #include "config.h"
29
30 #ifdef USE_POLL
31 # include <sys/poll.h>
32 #else
33 # include <sys/select.h>
34 #endif
35
36 #ifdef FD_SETSIZE
37 # define MAX_FD FD_SETSIZE
38 #else
39 # define MAX_FD 2048
40 #endif
41
42 #ifdef TIME_WITH_SYS_TIME
43 #include <sys/time.h>
44 #endif
45
46 #ifdef HAVE_SYS_FCNTL_H
47 #include <sys/fcntl.h>
48 #endif
49
50 #ifndef OPEN_MAX
51 #define OPEN_MAX 256
52 #endif
53
54 #ifndef NI_MAXHOST
55 #define NI_MAXHOST 20
56 #endif
57
58 #include <sys/socket.h>
59 #ifndef SO_MAXCONN
60 #define SO_MAXCONN 250
61 #endif
62
63 #ifndef PATH_MAX
64 #define PATH_MAX 2048
65 #endif
66
67 /* Wild guess time, probably better done with configure */
68 #ifdef O_NONBLOCK
69 #define NOBLOCK O_NONBLOCK /* Linux */
70 #else /* O_NONBLOCK */
71 #ifdef O_NDELAY
72 #define NOBLOCK O_NDELAY /* Sun */
73 #else /* O_NDELAY */
74 #error "Can't find a way to #define NOBLOCK"
75 #endif /* O_NDELAY */
76 #endif /* O_NONBLOCK */
77
78 #ifndef MAP_FILE
79 #define MAP_OPTIONS MAP_SHARED /* Sun */
80 #else
81 #define MAP_OPTIONS MAP_FILE|MAP_SHARED /* Linux */
82 #endif
83
84 #ifdef INET6
85 #define SOCKADDR sockaddr_storage
86 #define S_FAMILY __s_family
87 #define SERVER_AF AF_INET6
88 #else
89 #define SOCKADDR sockaddr_in
90 #define S_FAMILY sin_family
91 #define SERVER_AF AF_INET
92 #endif
93
94 #if HAVE_DIRENT_H
95 # include <dirent.h>
96 # define NAMLEN(dirent) strlen((dirent)->d_name)
97 #else
98 # define dirent direct
99 # define NAMLEN(dirent) (dirent)->d_namlen
100 # if HAVE_SYS_NDIR_H
101 # include <sys/ndir.h>
102 # endif
103 # if HAVE_SYS_DIR_H
104 # include <sys/dir.h>
105 # endif
106 # if HAVE_NDIR_H
107 # include <ndir.h>
108 # endif
109 #endif
110
111 /* below here, functions are provided in extras */
112 #ifndef HAVE_SCANDIR
113 int
114 scandir (
115 const char *dir,
116 struct dirent ***namelist,
117 int (*select) (const struct dirent *),
118 int (*cmp) (const void *, const void *));
119 #endif
120
121 #ifndef HAVE_GMTIME_R
122 struct tm *gmtime_r(const time_t *timep, struct tm *result);
123 #endif
124
125 #ifndef HAVE_ALPHASORT
126 int alphasort(const struct dirent **a, const struct dirent **b);
127 #endif
128
129 #ifndef HAVE_STRSTR
130 char *strstr(char *s1, char *s2);
131 #endif
132
133 #ifndef HAVE_STRDUP
134 char *strdup(char *s);
135 #endif
136
137 #ifdef HAVE_TM_GMTOFF
138 # define TIMEZONE_OFFSET(foo) foo->tm_gmtoff
139 #else
140 # define TIMEZONE_OFFSET(foo) timezone
141 #endif
142
143 #ifdef HAVE_TM_ZONE
144 #define TIMEZONE(foo) foo##->tm_zone
145 #else
146 #define TIMEZONE(foo) *tzname
147 #endif
148
149 #ifdef HAVE_LIBDMALLOC
150 #define DMALLOC_FUNC_CHECK
151 #include <dmalloc.h>
152 #endif
153
154 #ifdef HAVE_GETOPT_H
155 #include <getopt.h>
156 #endif
157
158 #ifdef HAVE_LINUXSENDFILE
159 # include <sys/sendfile.h>
160 #endif
161
162 #ifdef HAVE_BSDSENDFILE
163 # include <sys/uio.h>
164 #endif
165
166 /* Defines to use 64 bit offsets in systems that
167 * support it.
168 */
169
170 #ifdef USE_LONG_OFFSETS
171
172 # ifdef HAVE_OPEN64
173 # define open open64
174 # ifdef HAVE_WRITE64
175 # define write write64
176 # endif
177 # ifdef HAVE_READ64
178 # define read read64
179 # endif
180 # endif
181
182 # ifdef HAVE_LSEEK64
183 # define lseek lseek64
184 # endif
185
186 # ifndef HAVE_OFF_T
187 typedef long off_t;
188 # endif
189
190 # ifndef HAVE_OFF64_T
191 typedef long long off64_t;
192 # endif
193
194 typedef off64_t large_int;
195
196 # ifdef HAVE_STAT64
197 # define stat_st struct stat64
198 # define stat stat64
199 # define lstat lstat64
200 # define fstat fstat64
201 # else
202 # ifdef HAVE_STAT
203 # define stat_st struct stat
204 # endif
205 # endif
206
207 #else
208
209 # define stat_st struct stat
210 # define atoll atol
211 typedef long large_int;
212
213 #endif /* USE_LONG_OFFSETS */
214
215 #endif

webmaster@linux.gr
ViewVC Help
Powered by ViewVC 1.1.26