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
169 #define memmove(a,b,c) bcopy(b,a,c)
171 #define USE_FLOCK_SERIALIZED_ACCEPT
172 #define NEED_DIFFTIME
173 #define HAVE_SYSLOG 1
175 #elif defined(SOLARIS2)
179 #define bzero(a,b) memset(a,0,b)
180 #if !defined(USE_SYSVSEM_SERIALIZED_ACCEPT) && \
181 !defined(USE_PTHREAD_SERIALIZED_ACCEPT)
182 #define USE_FCNTL_SERIALIZED_ACCEPT
184 #define NEED_UNION_SEMUN
186 #define USE_MMAP_SCOREBOARD
187 #define USE_MMAP_FILES
188 /* Transarc hack to get AIX to build */
189 #if ! defined(AIX) && ! defined(linux)
190 int gethostname(char *name, int namelen);
191 #endif /* ! AIX && ! linux */
192 #define HAVE_SYSLOG 1
193 #define SYS_SIGLIST _sys_siglist
197 /* IRIX has killpg, but it's only in _BSD_COMPAT, so don't use it in case
198 * there's some weird conflict with non-BSD signals */
201 #if !defined(USE_FLOCK_SERIALIZED_ACCEPT) && \
202 !defined(USE_USLOCK_SERIALIZED_ACCEPT) && \
203 !defined(USE_SYSVSEM_SERIALIZED_ACCEPT)
204 #define USE_FCNTL_SERIALIZED_ACCEPT
206 #define HAVE_SHMGET 1
207 #define USE_SHMGET_SCOREBOARD
209 #define USE_MMAP_FILES
210 #define NO_LONG_DOUBLE
212 #define HAVE_SYSLOG 1
221 #define HAVE_SHMGET 1
222 #define USE_SHMGET_SCOREBOARD
223 #define SELECT_NEEDS_CAST
224 #define HAVE_SYSLOG 1
226 #elif defined(HPUX) || defined(HPUX10)
230 #define USE_FCNTL_SERIALIZED_ACCEPT
234 #define HAVE_SHMGET 1
235 #define USE_SHMGET_SCOREBOARD
236 #define HAVE_SYSLOG 1
238 #define SELECT_NEEDS_CAST
242 #elif defined(HPUX11)
247 #define USE_SHMGET_SCOREBOARD
249 #define USE_FCNTL_SERIALIZED_ACCEPT
250 /* feeling brave? want to try using POSIX mutexes? */
251 /* #define HAVE_MMAP */
252 /* #define USE_MMAP_SCOREBOARD */
253 /* #define USE_MMAP_FILES */
254 /* #define USE_PTHREAD_SERIALIZED_ACCEPT */
265 #define USE_MMAP_SCOREBOARD
266 #define USE_MMAP_FILES
267 #define HAVE_SYSLOG 1
268 #ifndef DEFAULT_GROUP
269 #define DEFAULT_GROUP "nobody"
273 #define DEFAULT_USER "nobody"
278 #define USE_FCNTL_SERIALIZED_ACCEPT
280 #define memmove(a,b,c) bcopy(b,a,c)
283 #define NET_SIZE_T size_t
286 #elif defined(ULTRIX)
287 /* we don't want to use sys/resource.h under
288 Ultrix although this header exists. */
289 #undef HAVE_SYS_RESOURCE_H
290 #define HAVE_GMTOFF 1
293 #define ULTRIX_BRAIN_DEATH
295 /* If you have Ultrix 4.3, and are using cc, const is broken */
296 #ifndef __ultrix__ /* Hack to check for pre-Ultrix 4.4 cc */
297 #define const /* Not implemented */
301 #define HAVE_GMTOFF 1
305 #define USE_MMAP_SCOREBOARD
306 #define USE_MMAP_FILES
307 #define NO_LONG_DOUBLE
308 #define HAVE_SYSLOG 1
309 #define USE_FLOCK_SERIALIZED_ACCEPT
310 #define SINGLE_LISTEN_UNSERIALIZED_ACCEPT
312 #elif defined(PARAGON)
313 #define HAVE_GMTOFF 1
317 #define USE_MMAP_SCOREBOARD
318 #define USE_MMAP_FILES
319 #define NO_LONG_DOUBLE
320 #define HAVE_SYSLOG 1
323 #elif defined(SEQUENT)
324 #define HAVE_GMTOFF 1
328 #define HAVE_SYSLOG 1
331 typedef unsigned short mode_t;
332 #define HAVE_GMTOFF 1
342 #define S_ISDIR(m) (((m)&(S_IFMT)) == (S_IFDIR))
345 #define S_ISREG(m) (((m)&(S_IFMT)) == (S_IFREG))
348 #define S_IXUSR 00100
351 #define S_IRGRP 00040
354 #define S_IXGRP 00010
357 #define S_IROTH 00004
360 #define S_IXOTH 00001
363 #define S_IRUSR S_IREAD
366 #define S_IWUSR S_IWRITE
369 #define S_IWGRP 000020
372 #define S_IWOTH 000002
376 typedef u_long n_long;
379 #define STDIN_FILENO 0
380 #define STDOUT_FILENO 1
381 #define STDERR_FILENO 2
384 #define ap_wait_t union wait
385 #define waitpid(a,b,c) wait4((a) == -1 ? 0 : (a),(union wait *)(b),c,NULL)
386 #define WEXITSTATUS(status) (int)( WIFEXITED(status) ? ( (status).w_retcode ) : -1)
387 #define WTERMSIG(status) (int)( (status).w_termsig )
391 #define NO_USE_SIGACTION
392 #define HAVE_SYSLOG 1
394 #elif defined(RHAPSODY) /* Mac OS X Server */
397 #define USE_MMAP_FILES
398 #define USE_MMAP_SCOREBOARD
400 #define HAVE_RESOURCE
401 #define HAVE_SNPRINTF
402 #define JMP_BUF jmp_buf
404 #define USE_FLOCK_SERIALIZED_ACCEPT
405 #define SINGLE_LISTEN_UNSERIALIZED_ACCEPT
407 * If you are using APACI, (you should be on Rhapsody) these
408 * values are set at configure time. These are here as reference;
409 * the apache that is built into Rhapsody is configured with
413 #define HTTPD_ROOT "/Local/Library/WebServer"
414 #define DOCUMENT_LOCATION HTTPD_ROOT "/Documents"
415 #define DEFAULT_XFERLOG "Logs/Access"
416 #define DEFAULT_ERRORLOG "Logs/Errors"
417 #define DEFAULT_PIDLOG "Logs/Process"
418 #define DEFAULT_SCOREBOARD "Logs/Status"
419 #define DEFAULT_LOCKFILE "Logs/Lock"
420 #define SERVER_CONFIG_FILE "Configuration/Server"
421 #define RESOURCE_CONFIG_FILE "Configuration/Resources"
422 #define TYPES_CONFIG_FILE "Configuration/MIME"
423 #define ACCESS_CONFIG_FILE "Configuration/Access"
424 #define DEFAULT_USER_DIR "Library/Web Documents"
425 #define DEFAULT_USER "nobody"
426 #define DEFAULT_GROUP "nogroup"
427 #define DEFAULT_PATH "/bin:/usr/bin:/usr/local/bin"
433 #include <features.h>
435 /* libc4 systems probably still work, it probably doesn't define
437 * libc5 systems define __GNU_LIBRARY__ == 1, but don't define __GLIBC__
438 * glibc 2.x and later systems define __GNU_LIBRARY__ == 6, but list it as
439 * "deprecated in favour of __GLIBC__"; the value 6 will never be changed.
440 * glibc 1.x systems (i.e. redhat 4.x on sparc/alpha) should have
442 * all glibc based systems need crypt.h
444 #if defined(__GNU_LIBRARY__) && __GNU_LIBRARY__ > 1
448 /* glibc 2.0.0 through 2.0.4 need size_t * here, where 2.0.5 needs socklen_t *
449 * there's no way to discern between these two libraries. But using int should
450 * be portable because otherwise these libs would be hopelessly broken with
451 * reams of existing networking code. We'll use socklen_t * for 2.1.x and
454 * int works for all the earlier libs, and is picked up by default later.
456 #if defined(__GLIBC__) && (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 0))
457 #define NET_SIZE_T socklen_t
460 #define HAVE_SHMGET 1
461 #define USE_SHMGET_SCOREBOARD
463 #define USE_MMAP_FILES
465 /* flock is faster ... but hasn't been tested on 1.x systems */
466 /* PR#3531 indicates flock() may not be stable, probably depends on
467 * kernel version. Go back to using fcntl, but provide a way for
468 * folks to tweak their Configuration to get flock.
470 #ifndef USE_FLOCK_SERIALIZED_ACCEPT
471 #define USE_FCNTL_SERIALIZED_ACCEPT
474 #define SYS_SIGLIST _sys_siglist
477 #define USE_FCNTL_SERIALIZED_ACCEPT
484 #include <sys/time.h>
485 #define HAVE_SYSLOG 1
487 /* glibc 2.1 and later finally define rlim_t */
488 #if !defined(__GLIBC__) || __GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 1)
496 #define NEED_INITGROUPS
498 #include <sys/time.h>
499 #define HAVE_SYSLOG 1
500 #undef HAVE_SYS_RESOURCE_H
504 #define USE_FCNTL_SERIALIZED_ACCEPT
506 #define USE_MMAP_SCOREBOARD
507 #define USE_MMAP_FILES
509 #define HAVE_SYSLOG 1
511 /* Although SCO 5 defines these in <strings.h> (note the "s") they don't have
513 extern int strcasecmp(const char *, const char *);
514 extern int strncasecmp(const char *, const char *, unsigned);
517 /* These are to let -Wall compile more cleanly */
518 extern int strcasecmp(const char *, const char *);
519 extern int strncasecmp(const char *, const char *, unsigned);
520 extern int set42sig(), getopt(), getpeername(), bzero();
521 extern int listen(), bind(), socket(), getsockname();
522 extern int accept(), gethostname(), connect(), lstat();
523 extern int select(), killpg(), shutdown();
524 extern int initgroups(), setsockopt();
525 extern char *shmat();
529 extern char *crypt();
530 #include <sys/time.h>
535 /* fcntl() locking is expensive with NFS */
536 #define USE_FLOCK_SERIALIZED_ACCEPT
537 #define SINGLE_LISTEN_UNSERIALIZED_ACCEPT
538 #define HAVE_SHMGET 1
539 #define USE_SHMGET_SCOREBOARD
541 * NOTE: If when you run Apache under A/UX and you get a warning
542 * that httpd couldn't move break, then the below value for
543 * MOVEBREAK (64megs) is too large for your setup. Try reducing
544 * to 0x2000000 which is still PLENTY of space. I doubt if
545 * even on heavy systems sbrk() would be called at all...
547 #define MOVEBREAK 0x4000000
550 #define HAVE_SYSLOG 1
551 #undef HAVE_SYS_RESOURCE_H /* exists but does not provide *rlimit funcs */
558 #define NEED_STRCASECMP
560 #define NEED_STRNCASECMP
563 #define bzero(a,b) memset(a,0,b)
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
592 #define bzero(a,b) memset(a,0,b)
594 #define USE_MMAP_SCOREBOARD
595 #define USE_MMAP_FILES
596 #define HAVE_SHMGET 1
597 #undef USE_SHMGET_SCOREBOARD /* force use of mmap() scoreboard */
598 #include <sys/time.h>
600 #define _POSIX_SOURCE
602 #define NET_SIZE_T size_t
603 #define HAVE_SYSLOG 1
610 #undef NEED_STRCASECMP
611 #undef NEED_STRNCASECMP
613 #define NEED_STRCASECMP
614 #define NEED_STRNCASECMP
616 #define bzero(a,b) memset(a,0,b)
617 /* A lot of SVR4 systems need this */
618 #define USE_FCNTL_SERIALIZED_ACCEPT
619 #define ap_inet_addr inet_network
620 #define HAVE_SYSLOG 1
622 #elif defined(__NetBSD__) || defined(__OpenBSD__) || defined(NETBSD)
623 #define HAVE_GMTOFF 1
626 #define HAVE_SYSLOG 1
628 #define DEFAULT_USER "nobody"
630 #ifndef DEFAULT_GROUP
631 #define DEFAULT_GROUP "nogroup"
633 #define HAVE_SHMGET 1
635 #define USE_MMAP_SCOREBOARD
636 #define USE_MMAP_FILES
637 #define USE_FLOCK_SERIALIZED_ACCEPT
638 #define SINGLE_LISTEN_UNSERIALIZED_ACCEPT
645 #define STDIN_FILENO 0
646 #define STDOUT_FILENO 1
647 #define STDERR_FILENO 2
648 #define HAVE_SYSLOG 1
650 #define JMP_BUF jmp_buf
651 #define NO_USE_SIGACTION
652 #define NEED_STRERROR
654 #define NEED_HASHBANG_EMUL
655 #define NDELAY_PIPE_RETURNS_ZERO
656 #define NO_DATA NO_ADDRESS
657 #define ap_wait_t union wait
658 #define WEXITSTATUS(status) (int)((status).w_retcode)
659 #define WTERMSIG(status) (int)((status).w_termsig)
660 #define strftime(buf,bufsize,fmt,tm) ascftime(buf,fmt,tm)
661 #undef HAVE_SYS_RESOURCE_H /* exists but does not provide *rlimit funcs */
662 #include <sys/types.h>
663 #include <sys/time.h>
665 #elif defined(APOLLO)
669 #define HAVE_SYSLOG 1
671 #elif defined(__FreeBSD__) || defined(__bsdi__)
672 #if defined(__FreeBSD__)
673 #include <osreldate.h>
675 #define HAVE_GMTOFF 1
679 #define USE_MMAP_SCOREBOARD
680 #define USE_MMAP_FILES
682 #define DEFAULT_USER "nobody"
684 #ifndef DEFAULT_GROUP
685 #define DEFAULT_GROUP "nogroup"
687 #if defined(__bsdi__) || \
688 (defined(__FreeBSD_version) && (__FreeBSD_version < 220000))
689 typedef quad_t rlim_t;
691 #define USE_FLOCK_SERIALIZED_ACCEPT
692 #define SINGLE_LISTEN_UNSERIALIZED_ACCEPT
693 #define HAVE_SYSLOG 1
694 #define SYS_SIGLIST sys_siglist
698 char *crypt(const char *pw, const char *salt);
701 int initgroups(char *, int);
704 #define strncasecmp strnicmp
708 #define NEED_INITGROUPS
709 #define NEED_SELECT_H
710 #define NEED_PROCESS_H
713 #define USE_POSIX_SCOREBOARD
714 #define USE_FLOCK_SERIALIZED_ACCEPT
715 #define SINGLE_LISTEN_UNSERIALIZED_ACCEPT
716 #define HAVE_SYSLOG 1
718 #elif defined(LYNXOS)
720 #undef USE_MMAP_SCOREBOARD
721 #undef USE_SHMGET_SCOREBOARD
722 #undef USE_FCNTL_SERIALIZED_ACCEPT
723 #undef USE_FLOCK_SERIALIZED_ACCEPT
727 #undef NO_USE_SIGACTION
729 extern char *crypt(char *pw, char *salt);
731 #define HAVE_SYSLOG 1
734 #undef NEED_STRCASECMP
735 #undef NEED_STRNCASECMP
740 #define bzero(a,b) memset(a,0,b)
741 #define USE_FCNTL_SERIALIZED_ACCEPT
743 #define USE_MMAP_SCOREBOARD
744 #define USE_MMAP_FILES
745 #define HAVE_SYSLOG 1
748 /* Defines required for EMX OS/2 port. */
750 #define NEED_STRCASECMP
751 #define NEED_STRNCASECMP
754 #define CASE_BLIND_FILESYSTEM
755 /* Add some drive name support */
756 #define chdir _chdir2
757 #include <sys/time.h>
758 #define MAXSOCKETS 4096
759 #define USE_OS2_SCOREBOARD
760 #define NO_RELIABLE_PIPED_LOGS
761 #define USE_OS2SEM_SERIALIZED_ACCEPT
762 #define SINGLE_LISTEN_UNSERIALIZED_ACCEPT
764 #elif defined(__MACHTEN__)
768 #define HAVE_GMTOFF 1
769 #ifndef __MACHTEN_PPC__
770 #ifndef __MACHTEN_68K__
771 #define __MACHTEN_68K__
773 #define USE_FLOCK_SERIALIZED_ACCEPT
774 #define NO_USE_SIGACTION
775 #define JMP_BUF sigjmp_buf
779 #define HAVE_SHMGET 1
780 #define USE_SHMGET_SCOREBOARD
781 #define USE_FCNTL_SERIALIZED_ACCEPT
785 #elif defined(CONVEXOS11)
791 #define USE_MMAP_SCOREBOARD
792 #define USE_MMAP_FILES
793 #define HAVE_SYSLOG 1
797 #include <sys/types.h>
801 #include <net/errno.h>
804 #define HAVE_SHMGET 1
805 #define USE_SHMGET_SCOREBOARD
806 #define USE_FCNTL_SERIALIZED_ACCEPT
807 #define HAVE_SYSLOG 1
809 #elif defined(NEWSOS)
810 #define HAVE_SHMGET 1
811 #define USE_SHMGET_SCOREBOARD
814 #define NO_USE_SIGACTION
816 #define NO_OTHER_CHILD
817 #define HAVE_SYSLOG 1
818 #include <sys/time.h>
820 #include <sys/types.h>
825 #elif defined(RISCIX)
826 #include <sys/time.h>
828 #define NO_USE_SIGACTION
830 #define NEED_STRCASECMP
831 #define NEED_STRNCASECMP
839 #define NEED_INITGROUPS
841 #elif defined(_CX_SX)
842 #define JMP_BUF sigjmp_buf
843 #include <sys/types.h>
844 #include <sys/time.h>
848 /* All windows stuff is now in os/win32/os.h */
850 #elif defined(TPF) /* IBM Transaction Processing Facility operating system */
855 #include <sysgtime.h>
856 #define PRIMECRAS 0x010000
857 #define JMP_BUF jmp_buf
858 #define NEED_INITGROUPS
859 #define NEED_STRCASECMP
861 #define NEED_STRNCASECMP
862 #define NO_DBM_REWRITEMAP
863 #define NO_GETTIMEOFDAY
867 #define NO_OTHER_CHILD
868 #define NO_RELIABLE_PIPED_LOGS
873 #define NO_USE_SIGACTION
876 #define USE_TPF_SELECT
878 #define offsetof(s_type,field) ((size_t)&(((s_type*)0)->field))
881 /* Unknown system - Edit these to match */
883 #define HAVE_GMTOFF 1
887 /* NO_KILLPG is set on systems that don't have killpg */
889 /* NO_SETSID is set on systems that don't have setsid */
891 /* NEED_STRDUP is set on stupid systems that don't have strdup. */
895 /* stuff marked API_EXPORT is part of the API, and intended for use
899 #define API_EXPORT(type) type
902 /* Stuff marked API_EXPORT_NONSTD is part of the API, and intended for
903 * use by modules. The difference between API_EXPORT and
904 * API_EXPORT_NONSTD is that the latter is required for any functions
905 * which use varargs or are used via indirect function call. This
906 * is to accomodate the two calling conventions in windows dlls.
908 #ifndef API_EXPORT_NONSTD
909 #define API_EXPORT_NONSTD(type) type
912 #ifndef MODULE_VAR_EXPORT
913 #define MODULE_VAR_EXPORT
915 #ifndef API_VAR_EXPORT
916 #define API_VAR_EXPORT
919 /* modules should not used functions marked CORE_EXPORT
920 * or CORE_EXPORT_NONSTD */
922 #define CORE_EXPORT API_EXPORT
924 #ifndef CORE_EXPORT_NONSTD
925 #define CORE_EXPORT_NONSTD API_EXPORT_NONSTD
928 /* On Mac OS X Server, symbols that conflict with loaded dylibs
929 * (eg. System framework) need to be declared as private symbols with
930 * __private_extern__.
931 * For other systems, make that a no-op.
933 #if defined(RHAPSODY)
934 #define ap_private_extern __private_extern__
936 #define ap_private_extern
940 * The particular directory style your system supports. If you have dirent.h
941 * in /usr/include (POSIX) or /usr/include/sys (SYSV), #include
942 * that file and define DIR_TYPE to be dirent. Otherwise, if you have
943 * /usr/include/sys/dir.h, define DIR_TYPE to be direct and include that
944 * file. If you have neither, I'm confused.
947 #include <sys/types.h>
950 #if !defined(NEXT) && !defined(WIN32)
952 #define DIR_TYPE dirent
953 #elif !defined(WIN32)
955 #define DIR_TYPE direct
957 #define DIR_TYPE dirent
963 #include "ap_ctype.h"
964 #if !defined(MPE) && !defined(WIN32) && !defined(TPF)
965 #include <sys/file.h>
968 #include <sys/socket.h>
969 #ifdef HAVE_SYS_SELECT_H
970 #include <sys/select.h>
971 #endif /* HAVE_SYS_SELECT_H */
973 #include <netinet/in.h>
976 #include <sys/ioctl.h>
977 #if !defined(MPE) && !defined(BEOS) && !defined(TPF)
978 #include <arpa/inet.h> /* for inet_ntoa */
980 #include <sys/wait.h>
985 #define closesocket(s) close(s)
995 #endif /* ndef WIN32 */
997 #include <time.h> /* for ctime */
999 #define strftime(s,max,format,tm) os_strftime(s,max,format,tm)
1003 #if !defined(QNX) && !defined(CONVEXOS11) && !defined(NEXT) && !defined(TPF)
1007 #ifdef NEED_PROCESS_H
1008 #include <process.h>
1012 #include "../include/hsregex.h"
1013 #elif defined(USE_HSREGEX)
1014 #include "hsregex.h"
1019 #ifdef HAVE_SYS_RESOURCE_H
1020 #include <sys/resource.h>
1022 int getrlimit(int, struct rlimit *);
1023 int setrlimit(int, struct rlimit *);
1026 #ifdef USE_MMAP_SCOREBOARD
1027 #if !defined(OS2) && !defined(WIN32)
1028 /* This file is not needed for OS/2 */
1029 #include <sys/mman.h>
1032 #if !defined(MAP_ANON) && defined(MAP_ANONYMOUS)
1033 #define MAP_ANON MAP_ANONYMOUS
1036 #if defined(USE_MMAP_FILES) && (defined(NO_MMAP) || !defined(HAVE_MMAP))
1037 #undef USE_MMAP_FILES
1040 #if defined(USE_MMAP_SCOREBOARD) && (defined(NO_MMAP) || !defined(HAVE_MMAP))
1041 #undef USE_MMAP_SCOREBOARD
1044 #if defined(USE_SHMGET_SCOREBOARD) && (defined(NO_SHMGET) || !defined(HAVE_SHMGET))
1045 #undef USE_SHMGET_SCOREBOARD
1049 #define LOGNAME_MAX 25
1052 #ifdef HAVE_UNISTD_H
1057 #define ULTRIX_BRAIN_DEATH
1061 #define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK)
1065 #define INADDR_NONE ((unsigned long) -1)
1069 * Replace signal function with sigaction equivalent
1071 #ifndef NO_USE_SIGACTION
1072 typedef void Sigfunc(int);
1074 #if defined(SIG_IGN) && !defined(SIG_ERR)
1075 #define SIG_ERR ((Sigfunc *)-1)
1079 * For some strange reason, QNX defines signal to signal. Eliminate it.
1084 #define signal(s,f) ap_signal(s,f)
1085 Sigfunc *signal(int signo, Sigfunc * func);
1090 #if defined(USE_LONGJMP)
1091 #define ap_longjmp(x, y) longjmp((x), (y))
1092 #define ap_setjmp(x) setjmp(x)
1094 #define JMP_BUF jmp_buf
1097 #define ap_longjmp(x, y) siglongjmp((x), (y))
1098 #define ap_setjmp(x) sigsetjmp((x), 1)
1100 #define JMP_BUF sigjmp_buf
1104 #ifdef SELECT_NEEDS_CAST
1105 #define ap_select(_a, _b, _c, _d, _e) \
1106 select((_a), (int *)(_b), (int *)(_c), (int *)(_d), (_e))
1107 #elif defined(USE_TPF_SELECT)
1108 #define ap_select tpf_select
1110 #define ap_select select
1113 #ifdef ULTRIX_BRAIN_DEATH
1114 #define ap_fdopen(d,m) fdopen((d), (char *)(m))
1116 #define ap_fdopen(d,m) fdopen((d), (m))
1119 #ifndef ap_inet_addr
1120 #define ap_inet_addr inet_addr
1123 #ifdef NO_OTHER_CHILD
1124 #define NO_RELIABLE_PIPED_LOGS
1127 /* When the underlying OS doesn't support exec() of scripts which start
1128 * with a HASHBANG (#!) followed by interpreter name and args, define this.
1130 #ifdef NEED_HASHBANG_EMUL
1131 extern int ap_execle(const char *filename, const char *arg,...);
1132 extern int ap_execve(const char *filename, const char *argv[],
1133 const char *envp[]);
1134 /* ap_execle() is a wrapper function around ap_execve(). */
1135 #define execle ap_execle
1136 #define execve(path,argv,envp) ap_execve(path,argv,envp)
1139 /* Finding offsets of elements within structures.
1140 * Taken from the X code... they've sweated portability of this stuff
1141 * so we don't have to. Sigh...
1144 #if defined(CRAY) || (defined(__arm) && !defined(LINUX))
1146 #define XtOffset(p_type,field) _Offsetof(p_type,field)
1149 #define XtOffset(p_type,field) \
1150 (sizeof(int)*((unsigned int)&(((p_type)NULL)->field)))
1154 #define XtOffset(p_type,field) ((unsigned int)&(((p_type)NULL)->field))
1157 #endif /* __STDC__ */
1158 #else /* ! (CRAY || __arm) */
1160 #define XtOffset(p_type,field) \
1161 ((long) (((char *) (&(((p_type)NULL)->field))) - ((char *) NULL)))
1166 #define XtOffsetOf(s_type,field) offsetof(s_type,field)
1168 #define XtOffsetOf(s_type,field) XtOffset(s_type*,field)
1172 * NET_SIZE_T exists because of shortsightedness on the POSIX committee. BSD
1173 * systems used "int *" as the parameter to accept(), getsockname(),
1174 * getpeername() et al. Consequently many unixes took an int * for that
1175 * parameter. The POSIX committee decided that "int" was just too generic and
1176 * had to be replaced with size_t almost everywhere. There's no problem with
1177 * that when you're passing by value. But when you're passing by reference
1178 * this creates a gross source incompatibility with existing programs. On
1179 * 32-bit architectures it creates only a warning. On 64-bit architectures it
1180 * creates broken code -- because "int *" is a pointer to a 64-bit quantity and
1181 * "size_t *" is frequently a pointer to a 32-bit quantity.
1183 * Some Unixes adopted "size_t *" for the sake of POSIX compliance. Others
1184 * ignored it because it was such a broken interface. Chaos ensued. POSIX
1185 * finally woke up and decided that it was wrong and created a new type
1186 * socklen_t. The only useful value for socklen_t is int, and that's how
1187 * everyone who has a clue implements it. It is almost always the case that
1188 * NET_SIZE_T should be defined to be an int, unless the system being compiled
1189 * for was created in the window of POSIX madness.
1192 #define NET_SIZE_T int
1195 /* Linux defines __WCOREDUMP, but doesn't define WCOREDUMP unless __USE_BSD
1196 * is in use... we'd prefer to just use WCOREDUMP everywhere.
1198 #if defined(__WCOREDUMP) && !defined(WCOREDUMP)
1199 #define WCOREDUMP __WCOREDUMP
1202 #ifdef SUNOS_LIB_PROTOTYPES
1203 /* Prototypes needed to get a clean compile with gcc -Wall.
1204 * Believe it or not, these do have to be declared, at least on SunOS,
1205 * because they aren't mentioned in the relevant system headers.
1206 * Sun Quality Software. Gotta love it. This section is not
1207 * currently (13Nov97) used.
1210 int getopt(int, char **, char *);
1212 int strcasecmp(const char *, const char *);
1213 int strncasecmp(const char *, const char *, int);
1217 int printf(char *,...);
1218 int fprintf(FILE *, char *,...);
1219 int fputs(char *, FILE *);
1220 int fread(char *, int, int, FILE *);
1221 int fwrite(char *, int, int, FILE *);
1223 char *fgets(char *s, int, FILE*);
1226 int ungetc(int, FILE *);
1227 int _filbuf(FILE *); /* !!! */
1228 int _flsbuf(unsigned char, FILE *); /* !!! */
1229 int sscanf(char *, char *,...);
1230 void setbuf(FILE *, char *);
1231 void perror(char *);
1233 time_t time(time_t *);
1234 int strftime(char *, int, const char *, struct tm *);
1236 int initgroups(char *, int);
1237 int wait3(int *, int, void *); /* Close enough for us... */
1238 int lstat(const char *, struct stat *);
1239 int stat(const char *, struct stat *);
1240 int flock(int, int);
1242 int killpg(int, int);
1244 int socket(int, int, int);
1245 int setsockopt(int, int, int, const char *, int);
1246 int listen(int, int);
1247 int bind(int, struct sockaddr *, int);
1248 int connect(int, struct sockaddr *, int);
1249 int accept(int, struct sockaddr *, int *);
1250 int shutdown(int, int);
1252 int getsockname(int s, struct sockaddr *name, int *namelen);
1253 int getpeername(int s, struct sockaddr *name, int *namelen);
1254 int gethostname(char *name, int namelen);
1255 void syslog(int, char *,...);
1256 char *mktemp(char *);
1258 long vfprintf(FILE *, const char *, va_list);
1260 #endif /* SUNOS_LIB_PROTOTYPES */
1262 /* The assumption is that when the functions are missing,
1263 * then there's no matching prototype available either.
1264 * Declare what is needed exactly as the replacement routines implement it.
1267 extern char *strdup (const char *str);
1269 #ifdef NEED_STRCASECMP
1270 extern int strcasecmp (const char *a, const char *b);
1272 #ifdef NEED_STRNCASECMP
1273 extern int strncasecmp (const char *a, const char *b, int n);
1275 #ifdef NEED_INITGROUPS
1276 extern int initgroups(const char *name, gid_t basegid);
1279 extern int waitpid(pid_t pid, int *statusp, int options);
1281 #ifdef NEED_STRERROR
1282 extern char *strerror (int err);
1284 #ifdef NEED_DIFFTIME
1285 extern double difftime(time_t time1, time_t time0);
1289 #define ap_wait_t int
1296 #endif /* !AP_CONFIG_H */