jim 96/06/22 06:58:36
Modified: src README conf.h http_main.c util.c
Log:
Start explaining defines and minor renaming
Revision Changes Path
1.6 +84 -0 apache/src/README
Index: README
===================================================================
RCS file: /export/home/cvs/apache/src/README,v
retrieving revision 1.5
retrieving revision 1.6
diff -C3 -r1.5 -r1.6
*** README 1996/03/14 19:12:42 1.5
--- README 1996/06/22 13:58:33 1.6
***************
*** 140,142 ****
--- 140,226 ----
alloc.c --- allocation of all resources which might have to be reclaimed
eventually, including memory, files, and child processes.
+ =================================================
+ List of various #defines used in the code:
+ The Apache code, specifically in conf.h, uses a variety of #defines to
+ control how the code is compiled and what options are available for each
+ support OS. The following list provides a short list and description
+ of these #defines.
+
+ --
+
+ NEED_*:
+ If the particular OS doesn't supply the specified function, we use the
+ Apache-supplied version (in util.c).
+
+ NEED_STRERROR:
+ NEED_STRDUP:
+ NEED_STRCASECMP:
+ NEED_STRNCASECMP:
+ NEED_INITGROUPS:
+ NEED_WAITPID:
+ NEED_STRERROR:
+ --
+
+ HAVE_*:
+ Does this OS have/support this capablity?
+
+ HAVE_GMTOFF:
+ Define if the OS's tm struct has the tm_gmtoff element
+
+ HAVE_RESOURCE:
+ Define if the OS supports the getrlimit()/setrlimit() functions
+
+ HAVE_MMAP:
+ Define if the OS supports the BSD mmap() call. This is used by various
+ OSs to allow the scoreboard file to be held in shared mmapped-memory
+ instead of a real file.
+
+ HAVE_SHMGET:
+ Define if the OS has the SysV-based shmget() family of shared-memory
+ functions. Used to allow the scoreboard to live in a shared-memory
+ slot instead of a real file.
+
+ HAVE_CRYPT_H:
+ Define if the OS has the <crypt.h> header file.
+
+ HAVE_SYS_SELECT_H:
+ Define if the OS has the <sys/select.h> header file.
+ --
+
+ USE_*:
+ These #defines are used for functions and ability that aren't exactly
+ required but should be used.
+
+ USE_FCNTL_SERIALIZED_ACCEPT:
+ Define if the OS requires a mutex "lock" around the socket accept()
+ call. Use fcntl() locking.
+
+ USE_FLOCK_SERIALIZED_ACCEPT:
+ Define if the OS requires a mutex "lock" around the socket accept()
+ call. Use flock() locking (fcntl() is expensive on some OSs, esp.
+ when using NFS).
+
+ USE_LONGJMP:
+ use the longjmp() call instead of siglongjmp()
+ --
+
+ NO_*:
+ These are defined if the OS does NOT have the specified function or if
+ we should not use it.
+
+ NO_KILLPG:
+ NO_SETSID:
+ NO_USE_SIGACTION:
+ Do not use the sigaction() call, even if we have it.
+ --
+
+ MISC #DEFINES:
+ Various other #defines used in the code.
+
+ JMP_BUF:
+ The variable-type for siglongjmp() or longjmp() call.
+
+ MOVEBREAK:
+ Amount to move sbrk() breakpoint, if required, before attaching
+ shared-memory segment.
1.15 +35 -36 apache/src/conf.h
Index: conf.h
===================================================================
RCS file: /export/home/cvs/apache/src/conf.h,v
retrieving revision 1.14
retrieving revision 1.15
diff -C3 -r1.14 -r1.15
*** conf.h 1996/06/17 20:52:04 1.14
--- conf.h 1996/06/22 13:58:34 1.15
***************
*** 54,59 ****
--- 54,60 ----
/*
* conf.h: system-dependant #defines and includes...
+ * See README for a list of what these mean
*/
#ifndef QNX
***************
*** 62,69 ****
/* Define one of these according to your system. */
#if defined(SUNOS4)
! #define HAS_GMTOFF
! #define HAVE_RESOURCE 1
#undef NO_KILLPG
#undef NO_SETSID
char *crypt(char *pw, char *salt);
--- 63,70 ----
/* Define one of these according to your system. */
#if defined(SUNOS4)
! #define HAVE_GMTOFF
! #define HAVE_RESOURCE
#undef NO_KILLPG
#undef NO_SETSID
char *crypt(char *pw, char *salt);
***************
*** 73,101 ****
#define NEED_STRERROR
#elif defined(SOLARIS2)
! #undef HAS_GMTOFF
#define NO_KILLPG
#undef NO_SETSID
! #define HAVE_RESOURCE 1
#define bzero(a,b) memset(a,0,b)
#define getwd(d) getcwd(d,MAX_STRING_LEN)
#define JMP_BUF sigjmp_buf
! #define FCNTL_SERIALIZED_ACCEPT
#define HAVE_MMAP
#define HAVE_CRYPT_H
#elif defined(IRIX)
! #undef HAS_GMTOFF
#undef NO_KILLPG
#undef NO_SETSID
#define JMP_BUF sigjmp_buf
! #define FCNTL_SERIALIZED_ACCEPT
#define HAVE_SHMGET
#define HAVE_CRYPT_H
#elif defined(HPUX)
! #define HAVE_RESOURCE 1
! #undef HAS_GMTOFF
#define NO_KILLPG
#undef NO_SETSID
#ifndef _HPUX_SOURCE
--- 74,102 ----
#define NEED_STRERROR
#elif defined(SOLARIS2)
! #undef HAVE_GMTOFF
#define NO_KILLPG
#undef NO_SETSID
! #define HAVE_RESOURCE
#define bzero(a,b) memset(a,0,b)
#define getwd(d) getcwd(d,MAX_STRING_LEN)
#define JMP_BUF sigjmp_buf
! #define USE_FCNTL_SERIALIZED_ACCEPT
#define HAVE_MMAP
#define HAVE_CRYPT_H
#elif defined(IRIX)
! #undef HAVE_GMTOFF
#undef NO_KILLPG
#undef NO_SETSID
#define JMP_BUF sigjmp_buf
! #define USE_FCNTL_SERIALIZED_ACCEPT
#define HAVE_SHMGET
#define HAVE_CRYPT_H
#elif defined(HPUX)
! #define HAVE_RESOURCE
! #undef HAVE_GMTOFF
#define NO_KILLPG
#undef NO_SETSID
#ifndef _HPUX_SOURCE
***************
*** 106,119 ****
#define HAVE_MMAP
#elif defined(AIX)
! #undef HAS_GMTOFF
#undef NO_KILLPG
#undef NO_SETSID
! #define NEED_SELECT_H
#define JMP_BUF sigjmp_buf
#elif defined(ULTRIX)
! #define HAS_GMTOFF
#undef NO_KILLPG
#undef NO_SETSID
#define ULTRIX_BRAIN_DEATH
--- 107,120 ----
#define HAVE_MMAP
#elif defined(AIX)
! #undef HAVE_GMTOFF
#undef NO_KILLPG
#undef NO_SETSID
! #define HAVE_SYS_SELECT_H
#define JMP_BUF sigjmp_buf
#elif defined(ULTRIX)
! #define HAVE_GMTOFF
#undef NO_KILLPG
#undef NO_SETSID
#define ULTRIX_BRAIN_DEATH
***************
*** 125,131 ****
#define JMP_BUF sigjmp_buf
#elif defined(OSF1)
! #define HAS_GMTOFF
#undef NO_KILLPG
#undef NO_SETSID
#define JMP_BUF sigjmp_buf
--- 126,132 ----
#define JMP_BUF sigjmp_buf
#elif defined(OSF1)
! #define HAVE_GMTOFF
#undef NO_KILLPG
#undef NO_SETSID
#define JMP_BUF sigjmp_buf
***************
*** 133,139 ****
#define HAVE_CRYPT_H
#elif defined(SEQUENT)
! #define HAS_GMTOFF
#undef NO_KILLPG
#define NO_SETSID
#define NEED_STRDUP
--- 134,140 ----
#define HAVE_CRYPT_H
#elif defined(SEQUENT)
! #define HAVE_GMTOFF
#undef NO_KILLPG
#define NO_SETSID
#define NEED_STRDUP
***************
*** 142,148 ****
#elif defined(NEXT)
#include <libc.h>
typedef unsigned short mode_t;
! #define HAS_GMTOFF
#undef NO_KILLPG
#define NO_SETSID
#define NEED_STRDUP
--- 143,149 ----
#elif defined(NEXT)
#include <libc.h>
typedef unsigned short mode_t;
! #define HAVE_GMTOFF
#undef NO_KILLPG
#define NO_SETSID
#define NEED_STRDUP
***************
*** 186,201 ****
#define NO_USE_SIGACTION
#elif defined(LINUX)
! #undef HAS_GMTOFF
#undef NO_KILLPG
#undef NO_SETSID
#undef NEED_STRDUP
#define JMP_BUF sigjmp_buf
! #define FCNTL_SERIALIZED_ACCEPT
#include <sys/time.h>
#elif defined(SCO)
! #undef HAS_GMTOFF
#undef NO_KILLPG
#undef NO_SETSID
#define NEED_INITGROUPS
--- 187,202 ----
#define NO_USE_SIGACTION
#elif defined(LINUX)
! #undef HAVE_GMTOFF
#undef NO_KILLPG
#undef NO_SETSID
#undef NEED_STRDUP
#define JMP_BUF sigjmp_buf
! #define USE_FCNTL_SERIALIZED_ACCEPT
#include <sys/time.h>
#elif defined(SCO)
! #undef HAVE_GMTOFF
#undef NO_KILLPG
#undef NO_SETSID
#define NEED_INITGROUPS
***************
*** 207,214 ****
#define JMP_BUF sigjmp_buf
#define SIGURG SIGUSR1
! #define NEED_SELECT_H
! #define FCNTL_SERIALIZED_ACCEPT
#define HAVE_MMAP
#define SecureWare
--- 208,215 ----
#define JMP_BUF sigjmp_buf
#define SIGURG SIGUSR1
! #define HAVE_SYS_SELECT_H
! #define USE_FCNTL_SERIALIZED_ACCEPT
#define HAVE_MMAP
#define SecureWare
***************
*** 218,235 ****
extern int strncasecmp(const char *,const char *,unsigned);
#elif defined(CONVEXOS)
! #define HAS_GMTOFF
#define NEED_STRDUP
#define getwd(d) getcwd(d,MAX_STRING_LEN)
#elif defined(AUX)
! #undef HAS_GMTOFF
#undef NO_KILLPG
#undef NO_SETSID
#define NEED_STRDUP
#define JMP_BUF sigjmp_buf
/* fcntl() locking is expensive with NFS */
! #undef FLOCK_SERIALIZED_ACCEPT
#define HAVE_SHMGET
#define MOVEBREAK 0x4000000
/* These are to let -Wall compile more cleanly */
--- 219,236 ----
extern int strncasecmp(const char *,const char *,unsigned);
#elif defined(CONVEXOS)
! #define HAVE_GMTOFF
#define NEED_STRDUP
#define getwd(d) getcwd(d,MAX_STRING_LEN)
#elif defined(AUX)
! #undef HAVE_GMTOFF
#undef NO_KILLPG
#undef NO_SETSID
#define NEED_STRDUP
#define JMP_BUF sigjmp_buf
/* fcntl() locking is expensive with NFS */
! #undef USE_FLOCK_SERIALIZED_ACCEPT
#define HAVE_SHMGET
#define MOVEBREAK 0x4000000
/* These are to let -Wall compile more cleanly */
***************
*** 246,252 ****
#define JMP_BUF sigjmp_buf
#define getwd(d) getcwd(d,MAX_STRING_LEN)
/* A lot of SVR4 systems need this */
! #define FCNTL_SERIALIZED_ACCEPT
#elif defined(DGUX)
#define NO_KILLPG
--- 247,253 ----
#define JMP_BUF sigjmp_buf
#define getwd(d) getcwd(d,MAX_STRING_LEN)
/* A lot of SVR4 systems need this */
! #define USE_FCNTL_SERIALIZED_ACCEPT
#elif defined(DGUX)
#define NO_KILLPG
***************
*** 258,273 ****
#define JMP_BUF sigjmp_buf
#define getwd(d) getcwd(d,MAX_STRING_LEN)
/* A lot of SVR4 systems need this */
! #define FCNTL_SERIALIZED_ACCEPT
#elif defined(__NetBSD__)
! #define HAS_GMTOFF
#undef NO_KILLPG
#undef NO_SETSID
#define JMP_BUF sigjmp_buf
#elif defined(UTS21)
! #undef HAS_GMTOFF
#undef NO_KILLPG
#define NO_SETSID
#define NEED_WAITPID
--- 259,274 ----
#define JMP_BUF sigjmp_buf
#define getwd(d) getcwd(d,MAX_STRING_LEN)
/* A lot of SVR4 systems need this */
! #define USE_FCNTL_SERIALIZED_ACCEPT
#elif defined(__NetBSD__)
! #define HAVE_GMTOFF
#undef NO_KILLPG
#undef NO_SETSID
#define JMP_BUF sigjmp_buf
#elif defined(UTS21)
! #undef HAVE_GMTOFF
#undef NO_KILLPG
#define NO_SETSID
#define NEED_WAITPID
***************
*** 278,290 ****
#include <sys/types.h>
#elif defined(APOLLO)
! #undef HAS_GMTOFF
#undef NO_KILLPG
#undef NO_SETSID
#define timezone _bky_timezone
#elif defined(__FreeBSD__) || defined(__bsdi__)
! #define HAS_GMTOFF
#undef NO_KILLPG
#undef NO_SETSID
#define JMP_BUF sigjmp_buf
--- 279,291 ----
#include <sys/types.h>
#elif defined(APOLLO)
! #undef HAVE_GMTOFF
#undef NO_KILLPG
#undef NO_SETSID
#define timezone _bky_timezone
#elif defined(__FreeBSD__) || defined(__bsdi__)
! #define HAVE_GMTOFF
#undef NO_KILLPG
#undef NO_SETSID
#define JMP_BUF sigjmp_buf
***************
*** 318,326 ****
/* Unknown system - Edit these to match */
#else
#ifdef BSD
! #define HAS_GMTOFF
#else
! #undef HAS_GMTOFF
#endif
/* NO_KILLPG is set on systems that don't have killpg */
#undef NO_KILLPG
--- 319,327 ----
/* Unknown system - Edit these to match */
#else
#ifdef BSD
! #define HAVE_GMTOFF
#else
! #undef HAVE_GMTOFF
#endif
/* NO_KILLPG is set on systems that don't have killpg */
#undef NO_KILLPG
***************
*** 333,341 ****
/* Do we have sys/resource.h; assume that BSD does. */
#ifndef HAVE_RESOURCE
#ifdef BSD
! #define HAVE_RESOURCE 1
! #else
! #define HAVE_RESOURCE 0
#endif
#endif /* HAVE_RESOURCE */
--- 334,340 ----
/* Do we have sys/resource.h; assume that BSD does. */
#ifndef HAVE_RESOURCE
#ifdef BSD
! #define HAVE_RESOURCE
#endif
#endif /* HAVE_RESOURCE */
***************
*** 363,369 ****
#include <sys/stat.h>
#include <sys/file.h>
#include <sys/socket.h>
! #ifdef NEED_SELECT_H
#include <sys/select.h>
#endif
#include <ctype.h>
--- 362,368 ----
#include <sys/stat.h>
#include <sys/file.h>
#include <sys/socket.h>
! #ifdef HAVE_SYS_SELECT_H
#include <sys/select.h>
#endif
#include <ctype.h>
***************
*** 383,389 ****
#include <memory.h>
#endif
! #if HAVE_RESOURCE
#include <sys/resource.h>
#ifdef SUNOS4
int getrlimit( int, struct rlimit *);
--- 382,388 ----
#include <memory.h>
#endif
! #ifdef HAVE_RESOURCE
#include <sys/resource.h>
#ifdef SUNOS4
int getrlimit( int, struct rlimit *);
1.40 +6 -6 apache/src/http_main.c
Index: http_main.c
===================================================================
RCS file: /export/home/cvs/apache/src/http_main.c,v
retrieving revision 1.39
retrieving revision 1.40
diff -C3 -r1.39 -r1.40
*** http_main.c 1996/06/13 20:33:02 1.39
--- http_main.c 1996/06/22 13:58:34 1.40
***************
*** 152,158 ****
int one_process = 0;
! #if defined(FCNTL_SERIALIZED_ACCEPT)
static struct flock lock_it = { F_WRLCK, 0, 0, 0 };
static struct flock unlock_it = { F_UNLCK, 0, 0, 0 };
--- 152,158 ----
int one_process = 0;
! #if defined(USE_FCNTL_SERIALIZED_ACCEPT)
static struct flock lock_it = { F_WRLCK, 0, 0, 0 };
static struct flock unlock_it = { F_UNLCK, 0, 0, 0 };
***************
*** 208,214 ****
exit(1);
}
}
! #elif defined(FLOCK_SERIALIZED_ACCEPT)
static int lock_fd=-1;
--- 208,214 ----
exit(1);
}
}
! #elif defined(USE_FLOCK_SERIALIZED_ACCEPT)
static int lock_fd=-1;
***************
*** 307,313 ****
}
if (!current_conn) {
! #ifdef NEXT
longjmp(jmpbuffer,1);
#else
siglongjmp(jmpbuffer,1);
--- 307,313 ----
}
if (!current_conn) {
! #if defined(NEXT) || defined(USE_LONGJMP)
longjmp(jmpbuffer,1);
#else
siglongjmp(jmpbuffer,1);
***************
*** 348,354 ****
bclose(timeout_req->connection->client);
if (!standalone) exit(0);
! #ifdef NEXT
longjmp(jmpbuffer,1);
#else
siglongjmp(jmpbuffer,1);
--- 348,354 ----
bclose(timeout_req->connection->client);
if (!standalone) exit(0);
! #if defined(NEXT) || defined(USE_LONGJMP)
longjmp(jmpbuffer,1);
#else
siglongjmp(jmpbuffer,1);
***************
*** 827,833 ****
static int wait_or_timeout_retval = -1;
static void longjmp_out_of_alarm (int sig) {
! #ifdef NEXT
longjmp (wait_timeout_buf, 1);
#else
siglongjmp (wait_timeout_buf, 1);
--- 827,833 ----
static int wait_or_timeout_retval = -1;
static void longjmp_out_of_alarm (int sig) {
! #if defined(NEXT) || defined(USE_LONGJMP)
longjmp (wait_timeout_buf, 1);
#else
siglongjmp (wait_timeout_buf, 1);
***************
*** 987,993 ****
void restart() {
signal (SIGALRM, SIG_IGN);
alarm (0);
! #ifdef NEXT
longjmp(restart_buffer,1);
#else
siglongjmp(restart_buffer,1);
--- 987,993 ----
void restart() {
signal (SIGALRM, SIG_IGN);
alarm (0);
! #if defined(NEXT) || defined(USE_LONGJMP)
longjmp(restart_buffer,1);
#else
siglongjmp(restart_buffer,1);
1.11 +1 -1 apache/src/util.c
Index: util.c
===================================================================
RCS file: /export/home/cvs/apache/src/util.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -C3 -r1.10 -r1.11
*** util.c 1996/05/27 19:48:40 1.10
--- util.c 1996/06/22 13:58:35 1.11
***************
*** 148,154 ****
tt = time(NULL);
t = localtime(&tt);
! #if defined(HAS_GMTOFF)
*tz = t->tm_gmtoff;
#elif !defined(NO_TIMEZONE)
*tz = - timezone;
--- 148,154 ----
tt = time(NULL);
t = localtime(&tt);
! #if defined(HAVE_GMTOFF)
*tz = t->tm_gmtoff;
#elif !defined(NO_TIMEZONE)
*tz = - timezone;