1 /* ====================================================================
2 * Copyright (c) 1995-1999 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. For written permission, please contact
26 * 5. Products derived from this software may not be called "Apache"
27 * nor may "Apache" appear in their names without prior written
28 * permission of the Apache Group.
30 * 6. Redistributions of any form whatsoever must retain the following
32 * "This product includes software developed by the Apache Group
33 * for use in the Apache HTTP server project (http://www.apache.org/)."
35 * THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY
36 * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
37 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
38 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR
39 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
40 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
41 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
42 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
43 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
44 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
45 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
46 * OF THE POSSIBILITY OF SUCH DAMAGE.
47 * ====================================================================
49 * This software consists of voluntary contributions made by many
50 * individuals on behalf of the Apache Group and was originally based
51 * on public domain software written at the National Center for
52 * Supercomputing Applications, University of Illinois, Urbana-Champaign.
53 * For more information on the Apache Group and the Apache HTTP server
54 * project, please see <http://www.apache.org/>.
66 * ap_config.h: system-dependant #defines and includes...
67 * See PORTING for a listing of what they mean
70 #include "ap_mmn.h" /* MODULE_MAGIC_NUMBER_ */
73 * Support for platform dependent autogenerated defines
76 #include "ap_config_auto.h"
78 /* not available under WIN32, so provide important entries manually */
82 /* Have to include sys/stat.h before ../os/win32/os.h so we can override
84 #include <sys/types.h>
87 /* So that we can use inline on some critical functions, and use
88 * GNUC attributes (such as to get -Wall warnings for printf-like
89 * functions). Only do this in gcc 2.7 or later ... it may work
90 * on earlier stuff, but why chance it.
92 * We've since discovered that the gcc shipped with NeXT systems
93 * as "cc" is completely broken. It claims to be __GNUC__ and so
94 * on, but it doesn't implement half of the things that __GNUC__
95 * means. In particular it's missing inline and the __attribute__
96 * stuff. So we hack around it. PR#1613. -djg
98 #if !defined(__GNUC__) || __GNUC__ < 2 || \
99 (__GNUC__ == 2 && __GNUC_MINOR__ < 7) ||\
102 #define __attribute__(__x)
103 #define ENUM_BITFIELD(e,n,w) signed int n : w
105 #define ap_inline __inline__
106 #define USE_GNU_INLINE
107 #define ENUM_BITFIELD(e,n,w) e n : w
111 /* include process.h first so we can override spawn[lv]e* properly */
113 #include "os/win32/os.h"
118 #if !defined(QNX) && !defined(MPE) && !defined(WIN32) && !defined(TPF)
119 #include <sys/param.h>
122 /* Define one of these according to your system. */
125 #define JMP_BUF sigjmp_buf
126 #define NO_LONG_DOUBLE
127 #define USE_FLOCK_SERIALIZED_ACCEPT
129 #define EAGAIN EWOULDBLOCK
130 int initgroups (char *, int);
131 char *crypt (const char *pw, const char *salt);
132 int gethostname (char *name, int namelen);
135 #include <sys/times.h>
139 #define HAVE_SHMGET 1
140 #define USE_SHMGET_SCOREBOARD
141 #define SHM_R 0400 /* Read permission */
142 #define SHM_W 0200 /* Write permission */
143 #define NEED_INITGROUPS
144 #define NEED_STRCASECMP
146 #define NEED_STRNCASECMP
147 extern void GETPRIVMODE();
148 extern void GETUSERMODE();
149 extern char *inet_ntoa();
151 #define NO_GETTIMEOFDAY
152 #define S_IEXEC S_IXUSR
153 #define S_IREAD S_IRUSR
154 #define S_IWRITE S_IWUSR
155 #define PF_INET AF_INET
157 #elif defined(SUNOS4)
158 #define HAVE_GMTOFF 1
161 char *crypt(const char *pw, const char *salt);
162 char *mktemp(char *template);
164 #define USE_MMAP_SCOREBOARD
165 #define USE_MMAP_FILES
166 #include <sys/time.h>
167 #define NEED_STRERROR
170 #define memmove(a,b,c) memcpy(a, b, c)
173 #define USE_FLOCK_SERIALIZED_ACCEPT
174 #define NEED_DIFFTIME
175 #define HAVE_SYSLOG 1
177 #elif defined(SOLARIS2)
181 #if !defined(USE_SYSVSEM_SERIALIZED_ACCEPT) && \
182 !defined(USE_PTHREAD_SERIALIZED_ACCEPT)
183 #define USE_FCNTL_SERIALIZED_ACCEPT
185 #define NEED_UNION_SEMUN
187 #define USE_MMAP_SCOREBOARD
188 #define USE_MMAP_FILES
189 /* Transarc hack to get AIX to build */
190 #if ! defined(AIX) && ! defined(linux)
191 int gethostname(char *name, int namelen);
192 #endif /* ! AIX && ! linux */
193 #define HAVE_SYSLOG 1
194 #define SYS_SIGLIST _sys_siglist
198 /* IRIX has killpg, but it's only in _BSD_COMPAT, so don't use it in case
199 * there's some weird conflict with non-BSD signals */
202 #if !defined(USE_FLOCK_SERIALIZED_ACCEPT) && \
203 !defined(USE_USLOCK_SERIALIZED_ACCEPT) && \
204 !defined(USE_SYSVSEM_SERIALIZED_ACCEPT)
205 #define USE_FCNTL_SERIALIZED_ACCEPT
207 #define HAVE_SHMGET 1
208 #define USE_SHMGET_SCOREBOARD
210 #define USE_MMAP_FILES
211 #define NO_LONG_DOUBLE
213 #define HAVE_SYSLOG 1
222 #define HAVE_SHMGET 1
223 #define USE_SHMGET_SCOREBOARD
224 #define SELECT_NEEDS_CAST
225 #define HAVE_SYSLOG 1
227 #elif defined(HPUX) || defined(HPUX10)
231 #define USE_FCNTL_SERIALIZED_ACCEPT
235 #define HAVE_SHMGET 1
236 #define USE_SHMGET_SCOREBOARD
237 #define HAVE_SYSLOG 1
239 #define SELECT_NEEDS_CAST
243 #elif defined(HPUX11)
248 #define USE_SHMGET_SCOREBOARD
250 #define USE_FCNTL_SERIALIZED_ACCEPT
251 /* feeling brave? want to try using POSIX mutexes? */
252 /* #define HAVE_MMAP */
253 /* #define USE_MMAP_SCOREBOARD */
254 /* #define USE_MMAP_FILES */
255 /* #define USE_PTHREAD_SERIALIZED_ACCEPT */
266 #define USE_MMAP_SCOREBOARD
267 #define USE_MMAP_FILES
268 #define HAVE_SYSLOG 1
269 #ifndef DEFAULT_GROUP
270 #define DEFAULT_GROUP "nobody"
274 #define DEFAULT_USER "nobody"
279 #define USE_FCNTL_SERIALIZED_ACCEPT
281 #define memmove(a,b,c) memcpy(a, b, c)
284 #define NET_SIZE_T size_t
287 #elif defined(ULTRIX)
288 /* we don't want to use sys/resource.h under
289 Ultrix although this header exists. */
290 #undef HAVE_SYS_RESOURCE_H
291 #define HAVE_GMTOFF 1
294 #define ULTRIX_BRAIN_DEATH
296 /* If you have Ultrix 4.3, and are using cc, const is broken */
297 #ifndef __ultrix__ /* Hack to check for pre-Ultrix 4.4 cc */
298 #define const /* Not implemented */
302 #define HAVE_GMTOFF 1
306 #define USE_MMAP_SCOREBOARD
307 #define USE_MMAP_FILES
308 #define NO_LONG_DOUBLE
309 #define HAVE_SYSLOG 1
310 #define USE_FLOCK_SERIALIZED_ACCEPT
311 #define SINGLE_LISTEN_UNSERIALIZED_ACCEPT
313 #elif defined(PARAGON)
314 #define HAVE_GMTOFF 1
318 #define USE_MMAP_SCOREBOARD
319 #define USE_MMAP_FILES
320 #define NO_LONG_DOUBLE
321 #define HAVE_SYSLOG 1
324 #elif defined(SEQUENT)
325 #define HAVE_GMTOFF 1
329 #define HAVE_SYSLOG 1
332 typedef unsigned short mode_t;
333 #define HAVE_GMTOFF 1
343 #define S_ISDIR(m) (((m)&(S_IFMT)) == (S_IFDIR))
346 #define S_ISREG(m) (((m)&(S_IFMT)) == (S_IFREG))
349 #define S_IXUSR 00100
352 #define S_IRGRP 00040
355 #define S_IXGRP 00010
358 #define S_IROTH 00004
361 #define S_IXOTH 00001
364 #define S_IRUSR S_IREAD
367 #define S_IWUSR S_IWRITE
370 #define S_IWGRP 000020
373 #define S_IWOTH 000002
377 typedef u_long n_long;
380 #define STDIN_FILENO 0
381 #define STDOUT_FILENO 1
382 #define STDERR_FILENO 2
385 #define ap_wait_t union wait
386 #define waitpid(a,b,c) wait4((a) == -1 ? 0 : (a),(union wait *)(b),c,NULL)
387 #define WEXITSTATUS(status) (int)( WIFEXITED(status) ? ( (status).w_retcode ) : -1)
388 #define WTERMSIG(status) (int)( (status).w_termsig )
392 #define NO_USE_SIGACTION
393 #define HAVE_SYSLOG 1
395 #elif defined(RHAPSODY) /* Mac OS X Server */
398 #define USE_MMAP_FILES
399 #define USE_MMAP_SCOREBOARD
401 #define HAVE_RESOURCE
402 #define HAVE_SNPRINTF
403 #define JMP_BUF jmp_buf
405 #define USE_FLOCK_SERIALIZED_ACCEPT
406 #define SINGLE_LISTEN_UNSERIALIZED_ACCEPT
408 * If you are using APACI, (you should be on Rhapsody) these
409 * values are set at configure time. These are here as reference;
410 * the apache that is built into Rhapsody is configured with
414 #define HTTPD_ROOT "/Local/Library/WebServer"
415 #define DOCUMENT_LOCATION HTTPD_ROOT "/Documents"
416 #define DEFAULT_XFERLOG "Logs/Access"
417 #define DEFAULT_ERRORLOG "Logs/Errors"
418 #define DEFAULT_PIDLOG "Logs/Process"
419 #define DEFAULT_SCOREBOARD "Logs/Status"
420 #define DEFAULT_LOCKFILE "Logs/Lock"
421 #define SERVER_CONFIG_FILE "Configuration/Server"
422 #define RESOURCE_CONFIG_FILE "Configuration/Resources"
423 #define TYPES_CONFIG_FILE "Configuration/MIME"
424 #define ACCESS_CONFIG_FILE "Configuration/Access"
425 #define DEFAULT_USER_DIR "Library/Web Documents"
426 #define DEFAULT_USER "nobody"
427 #define DEFAULT_GROUP "nogroup"
428 #define DEFAULT_PATH "/bin:/usr/bin:/usr/local/bin"
434 #include <features.h>
436 /* libc4 systems probably still work, it probably doesn't define
438 * libc5 systems define __GNU_LIBRARY__ == 1, but don't define __GLIBC__
439 * glibc 2.x and later systems define __GNU_LIBRARY__ == 6, but list it as
440 * "deprecated in favour of __GLIBC__"; the value 6 will never be changed.
441 * glibc 1.x systems (i.e. redhat 4.x on sparc/alpha) should have
443 * all glibc based systems need crypt.h
445 #if defined(__GNU_LIBRARY__) && __GNU_LIBRARY__ > 1
449 /* glibc 2.0.0 through 2.0.4 need size_t * here, where 2.0.5 needs socklen_t *
450 * there's no way to discern between these two libraries. But using int should
451 * be portable because otherwise these libs would be hopelessly broken with
452 * reams of existing networking code. We'll use socklen_t * for 2.1.x and
455 * int works for all the earlier libs, and is picked up by default later.
457 #if defined(__GLIBC__) && (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 0))
458 #define NET_SIZE_T socklen_t
461 #define HAVE_SHMGET 1
462 #define USE_SHMGET_SCOREBOARD
464 #define USE_MMAP_FILES
466 /* flock is faster ... but hasn't been tested on 1.x systems */
467 /* PR#3531 indicates flock() may not be stable, probably depends on
468 * kernel version. Go back to using fcntl, but provide a way for
469 * folks to tweak their Configuration to get flock.
471 #ifndef USE_FLOCK_SERIALIZED_ACCEPT
472 #define USE_FCNTL_SERIALIZED_ACCEPT
475 #define SYS_SIGLIST _sys_siglist
478 #define USE_FCNTL_SERIALIZED_ACCEPT
485 #include <sys/time.h>
486 #define HAVE_SYSLOG 1
488 /* glibc 2.1 and later finally define rlim_t */
489 #if !defined(__GLIBC__) || __GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 1)
497 #define NEED_INITGROUPS
499 #include <sys/time.h>
500 #define HAVE_SYSLOG 1
501 #undef HAVE_SYS_RESOURCE_H
505 #define USE_FCNTL_SERIALIZED_ACCEPT
507 #define USE_MMAP_SCOREBOARD
508 #define USE_MMAP_FILES
510 #define HAVE_SYSLOG 1
512 /* Although SCO 5 defines these in <strings.h> (note the "s") they don't have
514 extern int strcasecmp(const char *, const char *);
515 extern int strncasecmp(const char *, const char *, unsigned);
518 /* These are to let -Wall compile more cleanly */
519 extern int strcasecmp(const char *, const char *);
520 extern int strncasecmp(const char *, const char *, unsigned);
521 extern int set42sig(), getopt(), getpeername();
522 extern int listen(), bind(), socket(), getsockname();
523 extern int accept(), gethostname(), connect(), lstat();
524 extern int select(), killpg(), shutdown();
525 extern int initgroups(), setsockopt();
526 extern char *shmat();
530 extern char *crypt();
531 #include <sys/time.h>
536 /* fcntl() locking is expensive with NFS */
537 #define USE_FLOCK_SERIALIZED_ACCEPT
538 #define SINGLE_LISTEN_UNSERIALIZED_ACCEPT
539 #define HAVE_SHMGET 1
540 #define USE_SHMGET_SCOREBOARD
542 * NOTE: If when you run Apache under A/UX and you get a warning
543 * that httpd couldn't move break, then the below value for
544 * MOVEBREAK (64megs) is too large for your setup. Try reducing
545 * to 0x2000000 which is still PLENTY of space. I doubt if
546 * even on heavy systems sbrk() would be called at all...
548 #define MOVEBREAK 0x4000000
551 #define HAVE_SYSLOG 1
552 #undef HAVE_SYS_RESOURCE_H /* exists but does not provide *rlimit funcs */
559 #define NEED_STRCASECMP
561 #define NEED_STRNCASECMP
564 /* A lot of SVR4 systems need this */
565 #ifndef USE_SYSVSEM_SERIALIZED_ACCEPT
566 #define USE_FCNTL_SERIALIZED_ACCEPT
568 #define HAVE_SYSLOG 1
569 #define NET_SIZE_T size_t
570 #define HAVE_SHMGET 1
571 #define USE_SHMGET_SCOREBOARD
572 #ifdef _OSD_POSIX /* BS2000-POSIX mainframe needs initgroups */
573 #define NEED_INITGROUPS
574 #define NEED_HASHBANG_EMUL /* execve() doesn't start shell scripts by default */
576 #undef NEED_STRCASECMP
577 #undef NEED_STRNCASECMP
578 #undef USE_SHMGET_SCOREBOARD
580 #endif /*_OSD_POSIX*/
584 #define USE_FCNTL_SERIALIZED_ACCEPT
590 #define NEED_STRCASECMP
591 #define NEED_STRNCASECMP
593 #define USE_MMAP_SCOREBOARD
594 #define USE_MMAP_FILES
595 #define HAVE_SHMGET 1
596 #undef USE_SHMGET_SCOREBOARD /* force use of mmap() scoreboard */
597 #include <sys/time.h>
599 #define _POSIX_SOURCE
601 #define NET_SIZE_T size_t
602 #define HAVE_SYSLOG 1
609 #undef NEED_STRCASECMP
610 #undef NEED_STRNCASECMP
612 #define NEED_STRCASECMP
613 #define NEED_STRNCASECMP
615 /* A lot of SVR4 systems need this */
616 #define USE_FCNTL_SERIALIZED_ACCEPT
617 #define ap_inet_addr inet_network
618 #define HAVE_SYSLOG 1
620 #elif defined(__NetBSD__) || defined(__OpenBSD__) || defined(NETBSD)
621 #define HAVE_GMTOFF 1
624 #define HAVE_SYSLOG 1
626 #define DEFAULT_USER "nobody"
628 #ifndef DEFAULT_GROUP
629 #define DEFAULT_GROUP "nogroup"
631 #define HAVE_SHMGET 1
633 #define USE_MMAP_SCOREBOARD
634 #define USE_MMAP_FILES
635 #define USE_FLOCK_SERIALIZED_ACCEPT
636 #define SINGLE_LISTEN_UNSERIALIZED_ACCEPT
643 #define STDIN_FILENO 0
644 #define STDOUT_FILENO 1
645 #define STDERR_FILENO 2
646 #define HAVE_SYSLOG 1
648 #define JMP_BUF jmp_buf
649 #define NO_USE_SIGACTION
650 #define NEED_STRERROR
652 #define NEED_HASHBANG_EMUL
653 #define NDELAY_PIPE_RETURNS_ZERO
654 #define NO_DATA NO_ADDRESS
655 #define ap_wait_t union wait
656 #define WEXITSTATUS(status) (int)((status).w_retcode)
657 #define WTERMSIG(status) (int)((status).w_termsig)
658 #define strftime(buf,bufsize,fmt,tm) ascftime(buf,fmt,tm)
659 #undef HAVE_SYS_RESOURCE_H /* exists but does not provide *rlimit funcs */
660 #include <sys/types.h>
661 #include <sys/time.h>
663 #elif defined(APOLLO)
667 #define HAVE_SYSLOG 1
669 #elif defined(__FreeBSD__) || defined(__bsdi__)
670 #if defined(__FreeBSD__)
671 #include <osreldate.h>
673 #define HAVE_GMTOFF 1
677 #define USE_MMAP_SCOREBOARD
678 #define USE_MMAP_FILES
680 #define DEFAULT_USER "nobody"
682 #ifndef DEFAULT_GROUP
683 #define DEFAULT_GROUP "nogroup"
685 #if defined(__bsdi__) || \
686 (defined(__FreeBSD_version) && (__FreeBSD_version < 220000))
687 typedef quad_t rlim_t;
689 #define USE_FLOCK_SERIALIZED_ACCEPT
690 #define SINGLE_LISTEN_UNSERIALIZED_ACCEPT
691 #define HAVE_SYSLOG 1
692 #define SYS_SIGLIST sys_siglist
696 char *crypt(const char *pw, const char *salt);
699 int initgroups(char *, int);
702 #define strncasecmp strnicmp
706 #define NEED_INITGROUPS
707 #define NEED_SELECT_H
708 #define NEED_PROCESS_H
711 #define USE_POSIX_SCOREBOARD
712 #define USE_FLOCK_SERIALIZED_ACCEPT
713 #define SINGLE_LISTEN_UNSERIALIZED_ACCEPT
714 #define HAVE_SYSLOG 1
716 #elif defined(LYNXOS)
718 #undef USE_MMAP_SCOREBOARD
719 #undef USE_SHMGET_SCOREBOARD
720 #undef USE_FCNTL_SERIALIZED_ACCEPT
721 #undef USE_FLOCK_SERIALIZED_ACCEPT
725 #undef NO_USE_SIGACTION
727 extern char *crypt(char *pw, char *salt);
729 #define HAVE_SYSLOG 1
732 #undef NEED_STRCASECMP
733 #undef NEED_STRNCASECMP
738 #define USE_FCNTL_SERIALIZED_ACCEPT
740 #define USE_MMAP_SCOREBOARD
741 #define USE_MMAP_FILES
742 #define HAVE_SYSLOG 1
745 /* Defines required for EMX OS/2 port. */
747 #define NEED_STRCASECMP
748 #define NEED_STRNCASECMP
751 #define CASE_BLIND_FILESYSTEM
752 /* Add some drive name support */
753 #define chdir _chdir2
754 #include <sys/time.h>
755 #define MAXSOCKETS 4096
756 #define USE_OS2_SCOREBOARD
757 #define NO_RELIABLE_PIPED_LOGS
758 #define USE_OS2SEM_SERIALIZED_ACCEPT
759 #define SINGLE_LISTEN_UNSERIALIZED_ACCEPT
761 #elif defined(__MACHTEN__)
765 #define HAVE_GMTOFF 1
766 #ifndef __MACHTEN_PPC__
767 #ifndef __MACHTEN_68K__
768 #define __MACHTEN_68K__
770 #define USE_FLOCK_SERIALIZED_ACCEPT
771 #define NO_USE_SIGACTION
772 #define JMP_BUF sigjmp_buf
776 #define HAVE_SHMGET 1
777 #define USE_SHMGET_SCOREBOARD
778 #define USE_FCNTL_SERIALIZED_ACCEPT
782 #elif defined(CONVEXOS11)
788 #define USE_MMAP_SCOREBOARD
789 #define USE_MMAP_FILES
790 #define HAVE_SYSLOG 1
794 #include <sys/types.h>
798 #include <net/errno.h>
801 #define HAVE_SHMGET 1
802 #define USE_SHMGET_SCOREBOARD
803 #define USE_FCNTL_SERIALIZED_ACCEPT
804 #define HAVE_SYSLOG 1
806 #elif defined(NEWSOS)
807 #define HAVE_SHMGET 1
808 #define USE_SHMGET_SCOREBOARD
811 #define NO_USE_SIGACTION
813 #define NO_OTHER_CHILD
814 #define HAVE_SYSLOG 1
815 #include <sys/time.h>
817 #include <sys/types.h>
822 #elif defined(RISCIX)
823 #include <sys/time.h>
825 #define NO_USE_SIGACTION
827 #define NEED_STRCASECMP
828 #define NEED_STRNCASECMP
836 #define NEED_INITGROUPS
838 #elif defined(_CX_SX)
839 #define JMP_BUF sigjmp_buf
840 #include <sys/types.h>
841 #include <sys/time.h>
845 /* All windows stuff is now in os/win32/os.h */
847 #elif defined(TPF) /* IBM Transaction Processing Facility operating system */
852 #include <sysgtime.h>
853 #define PRIMECRAS 0x010000
854 #define JMP_BUF jmp_buf
855 #define NEED_INITGROUPS
856 #define NEED_STRCASECMP
858 #define NEED_STRNCASECMP
859 #define NO_DBM_REWRITEMAP
860 #define NO_GETTIMEOFDAY
864 #define NO_OTHER_CHILD
865 #define NO_RELIABLE_PIPED_LOGS
870 #define NO_USE_SIGACTION
873 #define USE_TPF_SELECT
875 #define offsetof(s_type,field) ((size_t)&(((s_type*)0)->field))
878 /* Unknown system - Edit these to match */
880 #define HAVE_GMTOFF 1
884 /* NO_KILLPG is set on systems that don't have killpg */
886 /* NO_SETSID is set on systems that don't have setsid */
888 /* NEED_STRDUP is set on stupid systems that don't have strdup. */
892 /* stuff marked API_EXPORT is part of the API, and intended for use
896 #define API_EXPORT(type) type
899 /* Stuff marked API_EXPORT_NONSTD is part of the API, and intended for
900 * use by modules. The difference between API_EXPORT and
901 * API_EXPORT_NONSTD is that the latter is required for any functions
902 * which use varargs or are used via indirect function call. This
903 * is to accomodate the two calling conventions in windows dlls.
905 #ifndef API_EXPORT_NONSTD
906 #define API_EXPORT_NONSTD(type) type
909 #ifndef MODULE_VAR_EXPORT
910 #define MODULE_VAR_EXPORT
912 #ifndef API_VAR_EXPORT
913 #define API_VAR_EXPORT
916 /* modules should not used functions marked CORE_EXPORT
917 * or CORE_EXPORT_NONSTD */
919 #define CORE_EXPORT API_EXPORT
921 #ifndef CORE_EXPORT_NONSTD
922 #define CORE_EXPORT_NONSTD API_EXPORT_NONSTD
925 /* On Mac OS X Server, symbols that conflict with loaded dylibs
926 * (eg. System framework) need to be declared as private symbols with
927 * __private_extern__.
928 * For other systems, make that a no-op.
930 #if defined(RHAPSODY)
931 #define ap_private_extern __private_extern__
933 #define ap_private_extern
937 * The particular directory style your system supports. If you have dirent.h
938 * in /usr/include (POSIX) or /usr/include/sys (SYSV), #include
939 * that file and define DIR_TYPE to be dirent. Otherwise, if you have
940 * /usr/include/sys/dir.h, define DIR_TYPE to be direct and include that
941 * file. If you have neither, I'm confused.
944 #include <sys/types.h>
947 #if !defined(NEXT) && !defined(WIN32)
949 #define DIR_TYPE dirent
950 #elif !defined(WIN32)
952 #define DIR_TYPE direct
954 #define DIR_TYPE dirent
960 #include "ap_ctype.h"
961 #if !defined(MPE) && !defined(WIN32) && !defined(TPF)
962 #include <sys/file.h>
965 #include <sys/socket.h>
966 #ifdef HAVE_SYS_SELECT_H
967 #include <sys/select.h>
968 #endif /* HAVE_SYS_SELECT_H */
970 #include <netinet/in.h>
973 #include <sys/ioctl.h>
974 #if !defined(MPE) && !defined(BEOS) && !defined(TPF)
975 #include <arpa/inet.h> /* for inet_ntoa */
977 #include <sys/wait.h>
982 #define closesocket(s) close(s)
992 #endif /* ndef WIN32 */
994 #include <time.h> /* for ctime */
996 #define strftime(s,max,format,tm) os_strftime(s,max,format,tm)
1000 #if !defined(QNX) && !defined(CONVEXOS11) && !defined(NEXT) && !defined(TPF)
1004 #ifdef NEED_PROCESS_H
1005 #include <process.h>
1009 #include "include/hsregex.h"
1010 #elif defined(USE_HSREGEX)
1011 #include "hsregex.h"
1016 #ifdef HAVE_SYS_RESOURCE_H
1017 #include <sys/resource.h>
1019 int getrlimit(int, struct rlimit *);
1020 int setrlimit(int, struct rlimit *);
1023 #ifdef USE_MMAP_SCOREBOARD
1024 #if !defined(OS2) && !defined(WIN32)
1025 /* This file is not needed for OS/2 */
1026 #include <sys/mman.h>
1029 #if !defined(MAP_ANON) && defined(MAP_ANONYMOUS)
1030 #define MAP_ANON MAP_ANONYMOUS
1033 #if defined(USE_MMAP_FILES) && (defined(NO_MMAP) || !defined(HAVE_MMAP))
1034 #undef USE_MMAP_FILES
1037 #if defined(USE_MMAP_SCOREBOARD) && (defined(NO_MMAP) || !defined(HAVE_MMAP))
1038 #undef USE_MMAP_SCOREBOARD
1041 #if defined(USE_SHMGET_SCOREBOARD) && (defined(NO_SHMGET) || !defined(HAVE_SHMGET))
1042 #undef USE_SHMGET_SCOREBOARD
1046 #define LOGNAME_MAX 25
1049 #ifdef HAVE_UNISTD_H
1054 #define ULTRIX_BRAIN_DEATH
1058 #define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK)
1062 #define INADDR_NONE ((unsigned long) -1)
1066 * Replace signal function with sigaction equivalent
1068 #ifndef NO_USE_SIGACTION
1069 typedef void Sigfunc(int);
1071 #if defined(SIG_IGN) && !defined(SIG_ERR)
1072 #define SIG_ERR ((Sigfunc *)-1)
1076 * For some strange reason, QNX defines signal to signal. Eliminate it.
1081 #define signal(s,f) ap_signal(s,f)
1082 Sigfunc *signal(int signo, Sigfunc * func);
1087 #if defined(USE_LONGJMP)
1088 #define ap_longjmp(x, y) longjmp((x), (y))
1089 #define ap_setjmp(x) setjmp(x)
1091 #define JMP_BUF jmp_buf
1094 #define ap_longjmp(x, y) siglongjmp((x), (y))
1095 #define ap_setjmp(x) sigsetjmp((x), 1)
1097 #define JMP_BUF sigjmp_buf
1101 #ifdef SELECT_NEEDS_CAST
1102 #define ap_select(_a, _b, _c, _d, _e) \
1103 select((_a), (int *)(_b), (int *)(_c), (int *)(_d), (_e))
1104 #elif defined(USE_TPF_SELECT)
1105 #define ap_select tpf_select
1107 #define ap_select select
1110 #ifdef ULTRIX_BRAIN_DEATH
1111 #define ap_fdopen(d,m) fdopen((d), (char *)(m))
1113 #define ap_fdopen(d,m) fdopen((d), (m))
1116 #ifndef ap_inet_addr
1117 #define ap_inet_addr inet_addr
1120 #ifdef NO_OTHER_CHILD
1121 #define NO_RELIABLE_PIPED_LOGS
1124 /* When the underlying OS doesn't support exec() of scripts which start
1125 * with a HASHBANG (#!) followed by interpreter name and args, define this.
1127 #ifdef NEED_HASHBANG_EMUL
1128 extern int ap_execle(const char *filename, const char *arg,...);
1129 extern int ap_execve(const char *filename, const char *argv[],
1130 const char *envp[]);
1131 /* ap_execle() is a wrapper function around ap_execve(). */
1132 #define execle ap_execle
1133 #define execve(path,argv,envp) ap_execve(path,argv,envp)
1136 /* Finding offsets of elements within structures.
1137 * Taken from the X code... they've sweated portability of this stuff
1138 * so we don't have to. Sigh...
1141 #if defined(CRAY) || (defined(__arm) && !defined(LINUX))
1143 #define XtOffset(p_type,field) _Offsetof(p_type,field)
1146 #define XtOffset(p_type,field) \
1147 (sizeof(int)*((unsigned int)&(((p_type)NULL)->field)))
1151 #define XtOffset(p_type,field) ((unsigned int)&(((p_type)NULL)->field))
1154 #endif /* __STDC__ */
1155 #else /* ! (CRAY || __arm) */
1157 #define XtOffset(p_type,field) \
1158 ((long) (((char *) (&(((p_type)NULL)->field))) - ((char *) NULL)))
1163 #define XtOffsetOf(s_type,field) offsetof(s_type,field)
1165 #define XtOffsetOf(s_type,field) XtOffset(s_type*,field)
1169 * NET_SIZE_T exists because of shortsightedness on the POSIX committee. BSD
1170 * systems used "int *" as the parameter to accept(), getsockname(),
1171 * getpeername() et al. Consequently many unixes took an int * for that
1172 * parameter. The POSIX committee decided that "int" was just too generic and
1173 * had to be replaced with size_t almost everywhere. There's no problem with
1174 * that when you're passing by value. But when you're passing by reference
1175 * this creates a gross source incompatibility with existing programs. On
1176 * 32-bit architectures it creates only a warning. On 64-bit architectures it
1177 * creates broken code -- because "int *" is a pointer to a 64-bit quantity and
1178 * "size_t *" is frequently a pointer to a 32-bit quantity.
1180 * Some Unixes adopted "size_t *" for the sake of POSIX compliance. Others
1181 * ignored it because it was such a broken interface. Chaos ensued. POSIX
1182 * finally woke up and decided that it was wrong and created a new type
1183 * socklen_t. The only useful value for socklen_t is int, and that's how
1184 * everyone who has a clue implements it. It is almost always the case that
1185 * NET_SIZE_T should be defined to be an int, unless the system being compiled
1186 * for was created in the window of POSIX madness.
1189 #define NET_SIZE_T int
1192 /* Linux defines __WCOREDUMP, but doesn't define WCOREDUMP unless __USE_BSD
1193 * is in use... we'd prefer to just use WCOREDUMP everywhere.
1195 #if defined(__WCOREDUMP) && !defined(WCOREDUMP)
1196 #define WCOREDUMP __WCOREDUMP
1199 #ifdef SUNOS_LIB_PROTOTYPES
1200 /* Prototypes needed to get a clean compile with gcc -Wall.
1201 * Believe it or not, these do have to be declared, at least on SunOS,
1202 * because they aren't mentioned in the relevant system headers.
1203 * Sun Quality Software. Gotta love it. This section is not
1204 * currently (13Nov97) used.
1207 int getopt(int, char **, char *);
1209 int strcasecmp(const char *, const char *);
1210 int strncasecmp(const char *, const char *, int);
1214 int printf(char *,...);
1215 int fprintf(FILE *, char *,...);
1216 int fputs(char *, FILE *);
1217 int fread(char *, int, int, FILE *);
1218 int fwrite(char *, int, int, FILE *);
1220 char *fgets(char *s, int, FILE*);
1223 int ungetc(int, FILE *);
1224 int _filbuf(FILE *); /* !!! */
1225 int _flsbuf(unsigned char, FILE *); /* !!! */
1226 int sscanf(char *, char *,...);
1227 void setbuf(FILE *, char *);
1228 void perror(char *);
1230 time_t time(time_t *);
1231 int strftime(char *, int, const char *, struct tm *);
1233 int initgroups(char *, int);
1234 int wait3(int *, int, void *); /* Close enough for us... */
1235 int lstat(const char *, struct stat *);
1236 int stat(const char *, struct stat *);
1237 int flock(int, int);
1239 int killpg(int, int);
1241 int socket(int, int, int);
1242 int setsockopt(int, int, int, const char *, int);
1243 int listen(int, int);
1244 int bind(int, struct sockaddr *, int);
1245 int connect(int, struct sockaddr *, int);
1246 int accept(int, struct sockaddr *, int *);
1247 int shutdown(int, int);
1249 int getsockname(int s, struct sockaddr *name, int *namelen);
1250 int getpeername(int s, struct sockaddr *name, int *namelen);
1251 int gethostname(char *name, int namelen);
1252 void syslog(int, char *,...);
1253 char *mktemp(char *);
1255 long vfprintf(FILE *, const char *, va_list);
1257 #endif /* SUNOS_LIB_PROTOTYPES */
1259 /* The assumption is that when the functions are missing,
1260 * then there's no matching prototype available either.
1261 * Declare what is needed exactly as the replacement routines implement it.
1264 extern char *strdup (const char *str);
1266 #ifdef NEED_STRCASECMP
1267 extern int strcasecmp (const char *a, const char *b);
1269 #ifdef NEED_STRNCASECMP
1270 extern int strncasecmp (const char *a, const char *b, int n);
1272 #ifdef NEED_INITGROUPS
1273 extern int initgroups(const char *name, gid_t basegid);
1276 extern int waitpid(pid_t pid, int *statusp, int options);
1278 #ifdef NEED_STRERROR
1279 extern char *strerror (int err);
1281 #ifdef NEED_DIFFTIME
1282 extern double difftime(time_t time1, time_t time0);
1286 #define ap_wait_t int
1293 #endif /* !AP_CONFIG_H */