1 /* ====================================================================
2 * Copyright (c) 1995-1997 The Apache Group. All rights reserved.
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in
13 * the documentation and/or other materials provided with the
16 * 3. All advertising materials mentioning features or use of this
17 * software must display the following acknowledgment:
18 * "This product includes software developed by the Apache Group
19 * for use in the Apache HTTP server project (http://www.apache.org/)."
21 * 4. The names "Apache Server" and "Apache Group" must not be used to
22 * endorse or promote products derived from this software without
23 * prior written permission.
25 * 5. Redistributions of any form whatsoever must retain the following
27 * "This product includes software developed by the Apache Group
28 * for use in the Apache HTTP server project (http://www.apache.org/)."
30 * THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY
31 * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
32 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
33 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR
34 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
35 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
36 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
37 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
40 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
41 * OF THE POSSIBILITY OF SUCH DAMAGE.
42 * ====================================================================
44 * This software consists of voluntary contributions made by many
45 * individuals on behalf of the Apache Group and was originally based
46 * on public domain software written at the National Center for
47 * Supercomputing Applications, University of Illinois, Urbana-Champaign.
48 * For more information on the Apache Group and the Apache HTTP server
49 * project, please see <http://www.apache.org/>.
54 * conf.h: system-dependant #defines and includes...
55 * See PORTING for a listing of what they mean
58 #if !defined(QNX) && !defined(MPE)
59 #include <sys/param.h>
62 /* Define one of these according to your system. */
64 #include <sys/times.h>
65 #define JMP_BUF sigjmp_buf
69 #define NEED_INITGROUPS
70 #define NEED_STRCASECMP
72 #define NEED_STRNCASECMP
73 extern void GETPRIVMODE();
74 extern void GETUSERMODE();
75 extern char *inet_ntoa();
80 #define HAVE_SYS_RESOURCE_H
83 char *crypt(const char *pw
, const char *salt
);
84 char *mktemp(char *template);
85 #define JMP_BUF sigjmp_buf
91 #define memmove(a,b,c) memcpy(a, b, c)
94 #define USE_FLOCK_SERIALIZED_ACCEPT
96 #elif defined(SOLARIS2)
100 #define HAVE_SYS_RESOURCE_H
101 #define JMP_BUF sigjmp_buf
102 #define USE_FCNTL_SERIALIZED_ACCEPT
105 int gethostname(char *name
, int namelen
);
109 /* IRIX has killpg, but it's only in _BSD_COMPAT, so don't use it in case
110 * there's some weird conflict with non-BSD signals */
113 #define JMP_BUF sigjmp_buf
114 #define USE_FCNTL_SERIALIZED_ACCEPT
117 #define NO_LONG_DOUBLE
118 #define HAVE_BSTRING_H
122 #define HAVE_SYS_RESOURCE_H
129 #define JMP_BUF sigjmp_buf
131 #define SELECT_NEEDS_CAST
133 #elif defined(HPUX) || defined(HPUX10)
134 #define HAVE_SYS_RESOURCE_H
141 #define JMP_BUF sigjmp_buf
144 #define SELECT_NEEDS_CAST
152 #define HAVE_SYS_SELECT_H
153 #define JMP_BUF sigjmp_buf
156 #define DEFAULT_GROUP "nobody"
158 #define DEFAULT_USER "nobody"
163 #elif defined(ULTRIX)
167 #define ULTRIX_BRAIN_DEATH
169 /* If you have Ultrix 4.3, and are using cc, const is broken */
170 #ifndef __ultrix__ /* Hack to check for pre-Ultrix 4.4 cc */
171 #define const /* Not implemented */
173 #define JMP_BUF sigjmp_buf
179 #define JMP_BUF sigjmp_buf
182 #define NO_LONG_DOUBLE
184 #elif defined(PARAGON)
188 #define JMP_BUF sigjmp_buf
191 #define NO_LONG_DOUBLE
194 #elif defined(SEQUENT)
199 #define tolower(c) (isupper(c) ? tolower(c) : c)
202 typedef unsigned short mode_t
;
214 #define S_ISDIR(m) (((m)&(S_IFMT)) == (S_IFDIR))
217 #define S_ISREG(m) (((m)&(S_IFMT)) == (S_IFREG))
220 #define S_IXUSR 00100
223 #define S_IRGRP 00040
226 #define S_IXGRP 00010
229 #define S_IROTH 00004
232 #define S_IXOTH 00001
235 #define S_IRUSR S_IREAD
238 #define S_IWUSR S_IWRITE
241 #define S_IWGRP 000020
244 #define S_IWOTH 000002
248 typedef u_long n_long
;
251 #define STDIN_FILENO 0
252 #define STDOUT_FILENO 1
253 #define STDERR_FILENO 2
254 #define waitpid(a,b,c) wait4((a) == -1 ? 0 : (a),(union wait *)(b),c,NULL)
256 #define JMP_BUF jmp_buf
258 #define NO_USE_SIGACTION
263 #define HAVE_SYS_RESOURCE_H
266 #define USE_FCNTL_SERIALIZED_ACCEPT
271 #define JMP_BUF sigjmp_buf
272 #include <sys/time.h>
278 #define NEED_INITGROUPS
280 #define JMP_BUF sigjmp_buf
281 #define SIGURG SIGUSR1 /* but note, this signal will be sent to a process group if enabled (for OOB data). It is not currently enabled. */
282 #include <sys/time.h>
286 #define JMP_BUF sigjmp_buf
287 #define SIGURG SIGUSR1
288 #define HAVE_SYS_SELECT_H
289 #define USE_FCNTL_SERIALIZED_ACCEPT
291 #define HAVE_SYS_RESOURCE_H
294 /* Although SCO 5 defines these in <strings.h> (note the "s") they don't have
296 extern int strcasecmp(const char *, const char *);
297 extern int strncasecmp(const char *, const char *, unsigned);
300 /* These are to let -Wall compile more cleanly */
301 extern int strcasecmp(const char *, const char *);
302 extern int strncasecmp(const char *, const char *, unsigned);
303 extern int set42sig(), getopt(), getpeername();
304 extern int listen(), bind(), socket(), getsockname();
305 extern int accept(), gethostname(), connect(), lstat();
306 extern int select(), killpg(), shutdown();
307 extern int initgroups(), setsockopt();
308 extern char *shmat();
312 extern char *crypt();
313 #include <sys/time.h>
318 #define JMP_BUF sigjmp_buf
319 /* fcntl() locking is expensive with NFS */
320 #define USE_FLOCK_SERIALIZED_ACCEPT
323 * NOTE: If when you run Apache under A/UX and you get a warning
324 * that httpd couldn't move break, then the below value for
325 * MOVEBREAK (64megs) is too large for your setup. Try reducing
326 * to 0x2000000 which is still PLENTY of space. I doubt if
327 * even on heavy systems sbrk() would be called at all...
329 #define MOVEBREAK 0x4000000
337 #define NEED_STRCASECMP
338 #define NEED_STRNCASECMP
339 #define JMP_BUF sigjmp_buf
340 /* A lot of SVR4 systems need this */
341 #define USE_FCNTL_SERIALIZED_ACCEPT
348 #define NEED_STRCASECMP
349 #define NEED_STRNCASECMP
350 #define JMP_BUF sigjmp_buf
351 #define HAVE_RESOURCE
355 #define HAVE_SYS_SELECT_H
356 #define HAVE_SYS_RESOURCE_H
357 #include <sys/time.h>
358 #define _POSIX_SOURCE
364 #define NEED_STRCASECMP
365 #define NEED_STRNCASECMP
366 #define JMP_BUF sigjmp_buf
367 /* A lot of SVR4 systems need this */
368 #define USE_FCNTL_SERIALIZED_ACCEPT
370 #elif defined(__NetBSD__) || defined(__OpenBSD__)
371 #define HAVE_SYS_RESOURCE_H
375 #define JMP_BUF sigjmp_buf
376 #define DEFAULT_USER "nobody"
377 #define DEFAULT_GROUP "nogroup"
384 #define STDIN_FILENO 0
385 #define STDOUT_FILENO 1
386 #define STDERR_FILENO 2
387 #define strftime(buf,bufsize,fmt,tm) ascftime(buf,fmt,tm)
388 #include <sys/types.h>
390 #elif defined(APOLLO)
395 #elif defined(__FreeBSD__) || defined(__bsdi__)
396 #if defined(__FreeBSD__)
397 #include <osreldate.h>
399 #define HAVE_SYS_RESOURCE_H
403 #define JMP_BUF sigjmp_buf
405 #define DEFAULT_USER "nobody"
406 #define DEFAULT_GROUP "nogroup"
407 #if defined(__bsdi__) || \
408 (defined(__FreeBSD_version) && (__FreeBSD_version < 220000))
409 typedef quad_t rlim_t
;
411 #define USE_FLOCK_SERIALIZED_ACCEPT
415 char *crypt(const char *pw
, const char *salt
);
418 int initgroups(char *, int);
421 #define strncasecmp strnicmp
425 #define NEED_INITGROUPS
426 #define NEED_SELECT_H
427 #define NEED_PROCESS_H
428 #define HAVE_SYS_SELECT_H
430 #define JMP_BUF sigjmp_buf
432 #elif defined(LYNXOS)
435 #define NEED_STRCASECMP
436 #define NEED_STRNCASECMP
437 #define NEED_INITGROUPS
438 #define JMP_BUF jmp_buf
441 #undef NEED_STRCASECMP
442 #undef NEED_STRNCASECMP
447 #define HAVE_RESOURCE 1
448 #define JMP_BUF sigjmp_buf
449 #define USE_FCNTL_SERIALIZED_ACCEPT
453 #elif defined(__EMX__)
454 /* Defines required for EMX OS/2 port. */
455 #define JMP_BUF sigjmp_buf
457 #define NEED_STRCASECMP
458 #define NEED_STRNCASECMP
460 /* Add some drive name support */
461 #define chdir _chdir2
462 #include <sys/time.h>
463 #define MAXSOCKETS 4096
466 #elif defined(__MACHTEN__)
468 #define JMP_BUF sigjmp_buf
472 #ifndef __MACHTEN_PPC__
473 #ifndef __MACHTEN_68K__
474 #define __MACHTEN_68K__
476 #define USE_FLOCK_SERIALIZED_ACCEPT
477 #define NO_USE_SIGACTION
482 #define USE_FCNTL_SERIALIZED_ACCEPT
486 #elif defined(CONVEXOS11)
495 #include <sys/types.h>
496 #define JMP_BUF jmp_buf
500 #include <net/errno.h>
504 #define SIGURG SIGUSR1
505 #define JMP_BUF sigjmp_buf
506 #define USE_FCNTL_SERIALIZED_ACCEPT
508 /* Unknown system - Edit these to match */
515 /* NO_KILLPG is set on systems that don't have killpg */
517 /* NO_SETSID is set on systems that don't have setsid */
519 /* NEED_STRDUP is set on stupid systems that don't have strdup. */
523 /* Do we have sys/resource.h; assume that BSD does. */
524 #ifndef HAVE_SYS_RESOURCE_H
526 #define HAVE_SYS_RESOURCE_H
528 #endif /* HAVE_SYS_RESOURCE_H */
531 * The particular directory style your system supports. If you have dirent.h
532 * in /usr/include (POSIX) or /usr/include/sys (SYSV), #include
533 * that file and define DIR_TYPE to be dirent. Otherwise, if you have
534 * /usr/include/sys/dir.h, define DIR_TYPE to be direct and include that
535 * file. If you have neither, I'm confused.
538 #include <sys/types.h>
541 * We use snprintf() to avoid overflows, but we include
542 * our own version (ap_snprintf). Allow for people to use their
543 * snprintf() if they want
546 #define ap_snprintf snprintf
547 #define ap_vsnprintf vsnprintf
549 int ap_snprintf(char *buf
, size_t len
, const char *format
, ...);
550 int ap_vsnprintf(char *buf
, size_t len
, const char *format
, va_list ap
);
555 #define DIR_TYPE dirent
558 #define DIR_TYPE direct
564 #include <sys/stat.h>
566 #include <sys/file.h>
568 #include <sys/socket.h>
569 #ifdef HAVE_SYS_SELECT_H
570 #include <sys/select.h>
573 #include <netinet/in.h>
575 #include <sys/ioctl.h>
577 #include <arpa/inet.h> /* for inet_ntoa */
579 #include <time.h> /* for ctime */
582 #include <sys/wait.h>
587 #if !defined(QNX) && !defined(CONVEXOS11) && !defined(NEXT)
590 #ifdef NEED_PROCESS_H
596 #ifdef HAVE_SYS_RESOURCE_H
597 #include <sys/resource.h>
599 int getrlimit(int, struct rlimit
*);
600 int setrlimit(int, struct rlimit
*);
605 /* This file is not needed for OS/2 */
606 #include <sys/mman.h>
609 #if !defined(MAP_ANON) && defined(MAP_ANONYMOUS)
610 #define MAP_ANON MAP_ANONYMOUS
613 #if defined(HAVE_MMAP) && defined(NO_MMAP)
618 #define LOGNAME_MAX 25
626 #define ULTRIX_BRAIN_DEATH
631 /* Don't define this for OS/2 */
632 #define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK)
637 #define INADDR_NONE ((unsigned long) -1)
641 * Replace signal function with sigaction equivalent
643 #ifndef NO_USE_SIGACTION
644 typedef void Sigfunc(int);
646 #if defined(SIG_IGN) && !defined(SIG_ERR)
647 #define SIG_ERR ((Sigfunc *)-1)
651 * For some strange reason, QNX defines signal to signal. Eliminate it.
656 #define signal(s,f) ap_signal(s,f)
657 Sigfunc
*signal(int signo
, Sigfunc
* func
);
662 #if defined(USE_LONGJMP)
663 #define ap_longjmp(x, y) longjmp((x), (y))
664 #define ap_setjmp(x) setjmp(x)
666 #define ap_longjmp(x, y) siglongjmp((x), (y))
667 #define ap_setjmp(x) sigsetjmp((x), 1)
670 /* Finding offsets of elements within structures.
671 * Taken from the X code... they've sweated portability of this stuff
672 * so we don't have to. Sigh...
675 #if defined(CRAY) || defined(__arm)
677 #define XtOffset(p_type,field) _Offsetof(p_type,field)
680 #define XtOffset(p_type,field) \
681 (sizeof(int)*((unsigned int)&(((p_type)NULL)->field)))
685 #define XtOffset(p_type,field) ((unsigned int)&(((p_type)NULL)->field))
688 #endif /* __STDC__ */
689 #else /* ! (CRAY || __arm) */
691 #define XtOffset(p_type,field) \
692 ((long) (((char *) (&(((p_type)NULL)->field))) - ((char *) NULL)))
697 #define XtOffsetOf(s_type,field) offsetof(s_type,field)
699 #define XtOffsetOf(s_type,field) XtOffset(s_type*,field)
702 #ifdef SUNOS_LIB_PROTOTYPES
703 /* Prototypes needed to get a clean compile with gcc -Wall.
704 * Believe it or not, these do have to be declared, at least on SunOS,
705 * because they aren't mentioned in the relevant system headers.
706 * Sun Quality Software. Gotta love it.
709 int getopt(int, char **, char *);
711 int strcasecmp(char *, char *);
712 int strncasecmp(char *, char *, int);
716 int printf(char *, ...);
717 int fprintf(FILE *, char *, ...);
718 int fputs(char *, FILE *);
719 int fread(char *, int, int, FILE *);
720 int fwrite(char *, int, int, FILE *);
723 int ungetc(int, FILE *);
724 int _filbuf(FILE *); /* !!! */
725 int _flsbuf(unsigned char, FILE *); /* !!! */
726 int sscanf(char *, char *, ...);
727 void setbuf(FILE *, char *);
730 time_t time(time_t *);
731 int strftime(char *, int, char *, struct tm
*);
733 int initgroups(char *, int);
734 int wait3(int *, int, void *); /* Close enough for us... */
735 int lstat(const char *, struct stat
*);
736 int stat(const char *, struct stat
*);
739 int killpg(int, int);
741 int socket(int, int, int);
742 int setsockopt(int, int, int, const char *, int);
743 int listen(int, int);
744 int bind(int, struct sockaddr
*, int);
745 int connect(int, struct sockaddr
*, int);
746 int accept(int, struct sockaddr
*, int *);
747 int shutdown(int, int);
749 int getsockname(int s
, struct sockaddr
*name
, int *namelen
);
750 int getpeername(int s
, struct sockaddr
*name
, int *namelen
);
751 int gethostname(char *name
, int namelen
);
752 void syslog(int, char *, ...);
753 char *mktemp(char *);
755 long vfprintf(FILE *, char *, va_list);