diff -urN apache_1.3.20/10xpatchlevel-orig apache_1.3.20/10xpatchlevel --- apache_1.3.20/10xpatchlevel-orig Wed Dec 31 19:00:00 1969 +++ apache_1.3.20/10xpatchlevel Sat Jun 30 23:53:22 2001 @@ -0,0 +1,5 @@ +This file contains the patch level for the Accelerating Apache patches +available from + http://oss.sgi.com/projects/apache/ + +10xpatchlevel=1.3.20-0 diff -urN apache_1.3.20/ABOUT_APACHE-orig apache_1.3.20/ABOUT_APACHE --- apache_1.3.20/ABOUT_APACHE-orig Mon Apr 9 10:15:00 2001 +++ apache_1.3.20/ABOUT_APACHE Sat Jun 30 23:53:22 2001 @@ -114,7 +114,8 @@ Other major contributors - Howard Fear (mod_include), Florent Guillaume (language negotiation), + Mike Abbott (performance), Howard Fear (mod_include), + Florent Guillaume (language negotiation), Koen Holtman (rewrite of mod_negotiation), Kevin Hughes (creator of all those nifty icons), Brandon Long and Beth Frank (NCSA Server Development Team, post-1.3), diff -urN apache_1.3.20/conf/httpd.conf-dist-orig apache_1.3.20/conf/httpd.conf-dist --- apache_1.3.20/conf/httpd.conf-dist-orig Sun May 13 12:59:49 2001 +++ apache_1.3.20/conf/httpd.conf-dist Sat Jun 30 23:53:22 2001 @@ -183,6 +183,14 @@ #BindAddress * # +# SingleListen: Require that each child process listen to a single IP +# address and port, from the list specified using Listen options. +# Listen addresses are distributed evenly across child processes. This +# avoids the whole serialized accept problem. +# +SingleListen off + +# # Dynamic Shared Object (DSO) Support # # To be able to use the functionality of a module which was built as a DSO you @@ -205,6 +213,16 @@ # Off) when the "server-status" handler is called. The default is Off. # #ExtendedStatus On + +# +# QSC: Enable the Quick Shortcut Cache. The QSC caches response +# headers and data together for very fast response to requests for +# static content. It is tightly integrated with and requires the +# mmap_static module. +# + + QSC on + ### Section 2: 'Main' server configuration # diff -urN apache_1.3.20/htdocs/index.html.ca-orig apache_1.3.20/htdocs/index.html.ca --- apache_1.3.20/htdocs/index.html.ca-orig Tue May 1 05:31:08 2001 +++ apache_1.3.20/htdocs/index.html.ca Sat Jun 30 23:53:22 2001 @@ -47,5 +47,8 @@
+
+ +
diff -urN apache_1.3.20/htdocs/index.html.cz-orig apache_1.3.20/htdocs/index.html.cz --- apache_1.3.20/htdocs/index.html.cz-orig Tue May 1 05:31:08 2001 +++ apache_1.3.20/htdocs/index.html.cz Sat Jun 30 23:53:22 2001 @@ -47,5 +47,8 @@
+
+ +
diff -urN apache_1.3.20/htdocs/index.html.de-orig apache_1.3.20/htdocs/index.html.de --- apache_1.3.20/htdocs/index.html.de-orig Tue May 1 05:31:09 2001 +++ apache_1.3.20/htdocs/index.html.de Sat Jun 30 23:53:22 2001 @@ -57,5 +57,8 @@
Powered by Apache!
+
+ +
diff -urN apache_1.3.20/htdocs/index.html.dk-orig apache_1.3.20/htdocs/index.html.dk --- apache_1.3.20/htdocs/index.html.dk-orig Tue May 1 05:31:09 2001 +++ apache_1.3.20/htdocs/index.html.dk Sat Jun 30 23:53:22 2001 @@ -43,5 +43,8 @@
+
+ +
diff -urN apache_1.3.20/htdocs/index.html.ee-orig apache_1.3.20/htdocs/index.html.ee --- apache_1.3.20/htdocs/index.html.ee-orig Tue May 1 05:31:09 2001 +++ apache_1.3.20/htdocs/index.html.ee Sat Jun 30 23:53:22 2001 @@ -49,5 +49,8 @@
+
+ +
diff -urN apache_1.3.20/htdocs/index.html.en-orig apache_1.3.20/htdocs/index.html.en --- apache_1.3.20/htdocs/index.html.en-orig Thu May 3 19:00:38 2001 +++ apache_1.3.20/htdocs/index.html.en Sun Jul 1 01:50:04 2001 @@ -33,6 +33,10 @@ server. Thanks for using Apache!

+ +
+ Performance tuned by SGI +
diff -urN apache_1.3.20/htdocs/index.html.es-orig apache_1.3.20/htdocs/index.html.es --- apache_1.3.20/htdocs/index.html.es-orig Tue May 1 05:31:10 2001 +++ apache_1.3.20/htdocs/index.html.es Sat Jun 30 23:53:22 2001 @@ -49,5 +49,8 @@
+
+ +
diff -urN apache_1.3.20/htdocs/index.html.he.iso8859-8-orig apache_1.3.20/htdocs/index.html.he.iso8859-8 --- apache_1.3.20/htdocs/index.html.he.iso8859-8-orig Tue May 1 05:31:10 2001 +++ apache_1.3.20/htdocs/index.html.he.iso8859-8 Sat Jun 30 23:53:22 2001 @@ -50,5 +50,8 @@
+
+ Performance tuned by SGI +
diff -urN apache_1.3.20/htdocs/index.html.it-orig apache_1.3.20/htdocs/index.html.it --- apache_1.3.20/htdocs/index.html.it-orig Tue May 1 05:31:10 2001 +++ apache_1.3.20/htdocs/index.html.it Sat Jun 30 23:53:22 2001 @@ -34,5 +34,8 @@

+
+ +
diff -urN apache_1.3.20/htdocs/index.html.ja.jis-orig apache_1.3.20/htdocs/index.html.ja.jis --- apache_1.3.20/htdocs/index.html.ja.jis-orig Tue May 1 05:31:11 2001 +++ apache_1.3.20/htdocs/index.html.ja.jis Sat Jun 30 23:53:22 2001 @@ -38,5 +38,8 @@
+
+ +
diff -urN apache_1.3.20/htdocs/index.html.kr.iso-kr-orig apache_1.3.20/htdocs/index.html.kr.iso-kr --- apache_1.3.20/htdocs/index.html.kr.iso-kr-orig Tue May 1 05:31:11 2001 +++ apache_1.3.20/htdocs/index.html.kr.iso-kr Sat Jun 30 23:53:22 2001 @@ -36,5 +36,8 @@ Ʒ ִ Apache ̹ ϴ° Դϴ. ġ ּż մϴ!
+
+ Performance tuned by SGI +
diff -urN apache_1.3.20/htdocs/index.html.lu-orig apache_1.3.20/htdocs/index.html.lu --- apache_1.3.20/htdocs/index.html.lu-orig Tue May 1 05:31:11 2001 +++ apache_1.3.20/htdocs/index.html.lu Sat Jun 30 23:53:22 2001 @@ -35,5 +35,8 @@ Apache-powered Web server ze presenteieren. Merci dat Dir Apache benotzt!
+
+ +
diff -urN apache_1.3.20/htdocs/index.html.nl-orig apache_1.3.20/htdocs/index.html.nl --- apache_1.3.20/htdocs/index.html.nl-orig Tue May 1 05:31:11 2001 +++ apache_1.3.20/htdocs/index.html.nl Sat Jun 30 23:53:22 2001 @@ -50,5 +50,8 @@
Klein 'Powered by Apache' Logotje
+
+ +
diff -urN apache_1.3.20/htdocs/index.html.no-orig apache_1.3.20/htdocs/index.html.no --- apache_1.3.20/htdocs/index.html.no-orig Tue May 1 05:31:12 2001 +++ apache_1.3.20/htdocs/index.html.no Sat Jun 30 23:53:22 2001 @@ -44,5 +44,8 @@
+
+ Performance tuned by SGI +
diff -urN apache_1.3.20/htdocs/index.html.pt-orig apache_1.3.20/htdocs/index.html.pt --- apache_1.3.20/htdocs/index.html.pt-orig Tue May 1 05:31:12 2001 +++ apache_1.3.20/htdocs/index.html.pt Sat Jun 30 23:53:22 2001 @@ -38,5 +38,8 @@

A imagem abaixo pode ser usada livremente em qualquer site presente num servidor com o Apache Web Server instalado. Obrigado por usar o Apache Web Server!

+
+ +
diff -urN apache_1.3.20/htdocs/index.html.ru.cp-1251-orig apache_1.3.20/htdocs/index.html.ru.cp-1251 --- apache_1.3.20/htdocs/index.html.ru.cp-1251-orig Tue May 1 05:31:12 2001 +++ apache_1.3.20/htdocs/index.html.ru.cp-1251 Sat Jun 30 23:53:23 2001 @@ -30,5 +30,8 @@ Apache. Apache!
+
+ Performance tuned by SGI +
diff -urN apache_1.3.20/htdocs/index.html.ru.cp866-orig apache_1.3.20/htdocs/index.html.ru.cp866 --- apache_1.3.20/htdocs/index.html.ru.cp866-orig Tue May 1 05:31:13 2001 +++ apache_1.3.20/htdocs/index.html.ru.cp866 Sat Jun 30 23:53:23 2001 @@ -30,5 +30,8 @@ ᯮ騬 Apache. ᨡ ᯮ짮 Apache!
+
+ Performance tuned by SGI +
diff -urN apache_1.3.20/htdocs/index.html.ru.iso-ru-orig apache_1.3.20/htdocs/index.html.ru.iso-ru --- apache_1.3.20/htdocs/index.html.ru.iso-ru-orig Tue May 1 05:31:13 2001 +++ apache_1.3.20/htdocs/index.html.ru.iso-ru Sat Jun 30 23:53:23 2001 @@ -30,5 +30,8 @@ Apache. Apache!
+
+ Performance tuned by SGI +
diff -urN apache_1.3.20/htdocs/index.html.ru.koi8-r-orig apache_1.3.20/htdocs/index.html.ru.koi8-r --- apache_1.3.20/htdocs/index.html.ru.koi8-r-orig Tue May 1 05:31:13 2001 +++ apache_1.3.20/htdocs/index.html.ru.koi8-r Sat Jun 30 23:53:23 2001 @@ -30,5 +30,8 @@ Apache. Apache!
+
+ Performance tuned by SGI +
diff -urN apache_1.3.20/htdocs/index.html.ru.utf8-orig apache_1.3.20/htdocs/index.html.ru.utf8 --- apache_1.3.20/htdocs/index.html.ru.utf8-orig Tue May 1 05:31:13 2001 +++ apache_1.3.20/htdocs/index.html.ru.utf8 Sat Jun 30 23:53:23 2001 @@ -30,5 +30,8 @@ использующим ПО Apache. Спасибо за использование Apache!
+
+ Performance tuned by SGI +
diff -urN apache_1.3.20/htdocs/index.html.se-orig apache_1.3.20/htdocs/index.html.se --- apache_1.3.20/htdocs/index.html.se-orig Tue May 1 05:31:13 2001 +++ apache_1.3.20/htdocs/index.html.se Sat Jun 30 23:53:23 2001 @@ -39,5 +39,8 @@
+
+ +
diff -urN apache_1.3.20/htdocs/manual/64-bit.html-orig apache_1.3.20/htdocs/manual/64-bit.html --- apache_1.3.20/htdocs/manual/64-bit.html-orig Wed Dec 31 19:00:00 1969 +++ apache_1.3.20/htdocs/manual/64-bit.html Sat Jun 30 23:53:24 2001 @@ -0,0 +1,511 @@ + + + + + Guide to 64-Bit Apache + + + +

+

[APACHE DOCUMENTATION]

+

+Apache HTTP Server Version 1.3

+

+

+

+Guide to 64-Bit Apache

+

+Mike Abbott - mja@sgi.com
+Accelerating Apache Project

+

+

+Apache/1.3.7 and beyond can be compiled as either a 32-bit or a 64-bit +application, allowing use of a full 64-bit virtual address space and +native 64-bit arithmetic. (However, neither 32-bit nor 64-bit Apache +can serve files larger than about 2 GB; see below + for details.) Currently Apache supports only SGI's +64-bit application binary interface (ABI) but undoubtedly other +vendors will port it to their own 64-bit ABIs.

+

+Compiling

+

+By default Apache compiles as a 32-bit application. To compile Apache +as a 64-bit application, just enable configure's IRIX64 rule and run +make as usual:

+
+  $ configure --enable-rule=IRIX64
+  $ make
+
+

+However, there are some complications.

+ +

+Rules and ABIs

+

+Apache can be compiled using any of SGI's three ABIs -- known as old +32-bit or O32, new 32-bit or N32, and 64-bit + or 64 (sometimes called new 64-bit or N64) +-- on platforms that support them. Two of configure's rules, IRIXN32 +and IRIX64, select the ABI for which Apache is compiled. The IRIX64 +rule overrides the IRIXN32 rule. By default IRIXN32 is enabled and +IRIX64 is disabled so Apache is compiled for the N32 ABI.

+
+ + + + + + + + + + + + + + + + + + + + + +
Apache ABIIRIXN32 ruleIRIX64 rule
64-bit (64 or N64)don't careenabled
new 32-bit + (N32)enabled + (default)disabled + (default)
old 32-bit (O32)disableddisabled (default)
+
+

+On non-SGI platforms Apache can be compiled using only a 32-bit ABI and +the above rules do not apply.

+

+Programming

+

+SGI's 64-bit ABI -- and therefore 64-bit Apache -- uses an LP64 + model, wherein long ints and all pointers are 64 bits +wide (8 bytes) and ints are 32 bits wide (4 bytes). Other +types remain the same.

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Type32-bit ABI Size64-bit ABI Size
char8 bits8 bits
short1616
int3232
long3264
pointer3264
float3232
double6464
+
+

+The discussion and examples below will help you to write code that +works in both 32-bit and 64-bit Apache, but this is not a complete +porting guide. There is no substitute for passing code through a picky +64-bit compiler and cleaning up the warnings and errors. I recommend +always using the compiler option that produces the pickiest warnings +and fixing all the warnings it generates. The option to SGI's compilers +is -fullwarn, used by default.

+

+Standard Typedefs

+

+Programmers accustomed to 32-bit programming often assume that int + and long are interchangeable, and that certain types +defined by the development environment are defined in certain ways. +Examples relevant to 64-bit Apache are the standard types size_t, ssize_t, off_t, +and time_t.

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Type NameActual TypeAssumed Type
size_tunsigned longunsigned int
ssize_tlongint
off_tlongint
time_tintlong
+
+

+All of the following examples compile and run fine under 32-bit ABIs +but induce compiler errors or warnings and can produce erroneous +results under the 64-bit ABI:

+
+  int length = strlen(str);            /* oops: strlen() returns size_t */
+
+  int r = read(fd, buf, n);            /* oops: read() returns ssize_t */
+
+  struct stat sb;                      /* ok */
+  stat(filename, &sb);                 /* ok */
+  printf("%d\n", sb.st_size);          /* oops: sb.st_size is off_t */
+       /* this produces a warning under SGI's N32 ABI too, see below */
+
+  long now;
+  time(&now);                          /* oops: time() takes (time_t *) */
+
+

+Here are the same examples, corrected for clean 32-bit and 64-bit +compilation and operation:

+
+  size_t length = strlen(str);         /* better */
+  int length = (int) strlen(str);      /* an alternative */
+  int length = ap_strlen(str);         /* another alternative */
+
+  int r = (int) read(fd, buf, n);      /* better - see below */
+
+  struct stat sb;                      /* ok */
+  stat(filename, &sb);                 /* ok */
+  printf("%ld\n", (long) sb.st_size);  /* better - see below */
+
+  time_t now;
+  time(&now);                          /* better */
+
+

+The general rule is: always use the appropriate type (size_t, +etc.), not the base type you think that type is defined as. However, +most character strings are shorter than 2 GB so using int + to store a strlen() result (with a cast to appease the +compiler) is just fine. ap_strlen() is a convenience macro +that just casts strlen()'s result to int.

+

+See the sections below for the rule exceptions for file +sizes and printfs.

+

+Apache Typedefs

+

+Apache defines four types that are guaranteed to be the right size for +certain uses. These types are defined in the source file src/include/ap_types.h.

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Type NameDescriptionUse
ap_int32signed 32-bit integerwhen at most or exactly 32 bits are required
ap_uint32unsigned 32-bit integerwhen at most or exactly 32 bits are required
ap_ptrunsigned pointer-sized integer
+ (size varies)
for storing and performing arithmetic on addresses
ap_atomicunsigned atomically-updatable integer
+ (at least as large as ap_ptr)
for atomic operations
+
+

+Use ap_int32 and ap_uint32 instead of int/long + and unsigned int/long when you need at most +or exactly 32 bits. (You could use int or unsigned +int in SGI's 64-bit ABI, but future 64-bit ABIs may define int + as 64 bits.)

+
+  struct binary_log_entry {     /* on-disk binary log entry format */
+    ap_uint32  ip_addr;         /* IP address of requester */
+    ap_int32   time;            /* time requested */
+    ap_int32   nbytes;          /* number of body bytes in response */
+      /* ... */
+  };
+
+  #define FLAG0  ((ap_uint32) 0x00000001)
+  #define FLAG1  ((ap_uint32) 0x00000002)
+    /* ... */
+  #define FLAG30 ((ap_uint32) 0x40000000)
+  #define FLAG31 ((ap_uint32) 0x80000000)
+    /* (ap_uint32) cast avoids accidental 64-bit sign extension on FLAG31 */
+
+

+That reminds me: Avoid using the L or UL + suffix on constants; cast the constant to ap_int32 or ap_uint32 + instead. Beware constants with bit 31 (0x80000000) set, including -1 + and ~0. Broken examples:

+
+  #define FOO    4096UL                    /* oops: scales */
+  #define BIG    0xFFFFFFFFL               /* oops: sign-extends */
+
+  /* oops: in 64-bit Apache INADDR_NONE is 0xFFFFFFFFFFFFFF but
+   * inet_addr() returns 0xFFFFFFFF on failure */
+  #define INADDR_NONE ((unsigned long) -1)
+  unsigned long my_addr;
+  if ((my_addr = inet_addr(w)) != INADDR_NONE) /* ... */;
+
+

+Fixed examples:

+
+  #define FOO    ((ap_uint32) 4096)        /* better */
+  #define BIG    ((ap_uint32) 0xFFFFFFFF)  /* better */
+
+  /* better */
+  #define INADDR_NONE ((ap_uint32) -1)
+  ap_uint32 my_addr;
+  if ((my_addr = inet_addr(w)) != INADDR_NONE) /* ... */;
+
+

+Use ap_ptr for storing and performing arithmetic on +addresses. See below for details.

+

+Use ap_atomic for atomically-updatable data.

+

+Pointers

+

+Pointers are the same size as ints in 32-bit but not +64-bit programming environments. The following common constructs cause +problems:

+
+  int length = string2 - string1;          /* oops: result is long */
+
+  unsigned int address = (unsigned int) &anything;
+                                           /* oops: pointer is long */
+
+

+Corrected examples:

+
+  size_t length = string2 - string1;       /* better */
+  int length = (int) (string2 - string1);  /* an alternative */
+
+  unsigned long address = (unsigned long) &anything;  /* better */
+  ap_ptr address = (ap_ptr) &anything;     /* an alternative */
+
+

+Use ap_ptr, size_t, or ptrdiff_t + for pointer manipulation unless you're sure the result of pointer +subtraction is a small integer in which case cast and assign the result +to int.

+

+To store a constant or integer value into a variable having a pointer +type without compiler warnings, you must first cast the data to the +scaling type ap_ptr and then cast that to the pointer +type, like this:

+
+  void *vp = (void *) (ap_ptr) 1;
+  struct myfd *fp = (struct myfd *) (ap_ptr) fd;   /* fd is int */
+
+

+(I think this is yucky but I couldn't find a better way.)

+

+File Sizes

+

+In SGI's 64-bit ABI file sizes (off_t) are 64 bits wide, +i.e., files can be larger than 4 GB (theoretically up to 16 exabytes +[EB]). (Incidentally, off_t is 64 bits wide in SGI's N32 +ABI too, but not SGI's O32 ABI.) However, 64-bit Apache currently +forbids serving files whose sizes overflow 32 bits. It is possible to +enhance Apache to serve very large files but I chose not to do so. The +function ap_oversized_file() returns nonzero if a file is +too large to serve. Here is an example, heavily trimmed for clarity, of +how to serve a file in both 32-bit and 64-bit Apache:

+
+  struct stat sb;
+  int fd, nbytes;
+
+  stat(filename, &sb);
+  if (ap_oversized_file(sb.st_size)) {
+    ap_log_rerror(APLOG_MARK, APLOG_ERR | APLOG_NOERRNO, request,
+      "%s: File too large", filename);
+    return HTTP_NOT_IMPLEMENTED;
+  }
+
+  fd = open(filename, O_RDONLY);
+  while ((nbytes = (int) read(fd, buf, bufsiz)) > 0)
+    ap_rwrite(request, buf, nbytes);
+  close(fd);
+  return OK;
+
+

+The example checks the validity of the file size first, and safely +truncates the result from read() to an int.

+

+Printf Conversions

+

+At first glance it seems difficult to format output using printf(), sprintf(), +and the like without a priori knowledge of type sizes. In a 32-bit ABI %d + (and %o, %u, and %x) and %ld + (and %lo, %lu, and %lx) convert +a 32-bit integer, but in a 64-bit ABI %d (et al) converts +a 32-bit integer and %ld (et al) converts a 64-bit +integer. The following example is erroneous under both ABIs:

+
+  struct stat sb;                            /* ok */
+  stat(filename, &sb);                       /* ok */
+  printf("size is %d\n", sb.st_size);        /* oops: st_size scales */
+  printf("mod time is %ld\n", sb.st_mtime);  /* oops: st_mtime is int */
+
+

+There are solutions that I consider messy, such as using #ifdef + to select between different format strings or using #define + to select conversion strings and string concatenation to insert them +into the output string, and one that I think is simple and clean: +Always use the long form conversions (%ld, %lx, +etc.) and cast the data to long or unsigned long, +no matter what its original type.

+
+  struct stat sb;                            /* ok */
+  stat(filename, &sb);                       /* ok */
+  printf("size is %ld\n", (long) sb.st_size);  /* better */
+  printf("mod time is %ld\n", (long) sb.st_mtime);  /* better */
+
+  printf("pid is %ld\n", (long) getpid());
+  printf("address is %#lx\n", (unsigned long) &mumble);
+  printf("sent %lu bytes\n", (unsigned long) nbytes);
+
+

+SGI's 64-bit compiler checks printf-like format conversions against the +type of the corresponding arguments and generates warnings when they +don't match (%d with an argument of type long, +for instance). If you write your own formatting routine, preface its +definition and declarations with the lint-style comment /*PRINTFLIKEn*/ + to allow the compiler to compare the conversions with the arguments. n + is the ordinal of the format string.

+
+  /*PRINTFLIKE2*/
+  extern int myprintf(int mystuff, const char *fmt, ...);
+  myprintf(xyz, "this page visited %ld times\n", (long) count);
+
+

+General

+

+Beware shifting, anding or oring (<< >> & | + operators) beyond 32 bits and performing arithmetic (+ - * / + operators) that might over- or underflow 32 bits. Truncation to 32 +bits is implicit in a 32-bit ABI but not in a 64-bit ABI.

+

+SGI's struct timeval (defined in <sys/time.h>) +is defined such that the tv_sec field is 32 bits and the tv_usec + field is 64 bits. I have no idea why; it seems wrong to me. But +anyway, this causes the compiler to warn about the following construct:

+
+  tv.tv_sec = tv.tv_usec = 0;   /* oops: assigning 64 bits to 32 */
+
+

+The simple workaround is to separate this into two lines:

+
+  tv.tv_sec = 0;                /* better */
+  tv.tv_usec = 0;
+
+

+Performance

+

+64-bit Apache actually runs slightly slower than 32-bit Apache due to +the increased word size but it allows the mmap_static module to map enormous +amounts of file data.

+

+Porting to Other 64-bit ABIs

+

+As mentioned above, the only 64-bit ABI Apache supports currently is +SGI's. Porting to other 64-bit ABIs that use the LP64 model should be +straightforward, probably consisting mostly of enabling the equivalent +of the -fullwarn compiler option to identify problem areas +and modifying Apache's source code to handle your system's type quirks (size_t, off_t, +etc.) if they differ from SGI's. Porting to an ILP64 model, where ints +are also 64 bits, will require a larger effort to change all uses of int.

+

+See also

+

+SGI's MIPSpro +64-Bit Porting and Transition Guide contains excellent detailed +information about porting 32-bit applications to 64 bits.

+

+Refer to your system's programming documentation for details about its +64-bit implementation.

+
+

+Apache HTTP Server Version 1.3

+

+Index

+ + diff -urN apache_1.3.20/htdocs/manual/bind.html-orig apache_1.3.20/htdocs/manual/bind.html --- apache_1.3.20/htdocs/manual/bind.html-orig Tue May 15 11:45:08 2001 +++ apache_1.3.20/htdocs/manual/bind.html Sat Jun 30 23:53:24 2001 @@ -72,7 +72,7 @@ Syntax: Listen [ port | IP-address:port ]
+>Syntax: Listen [ port | IP-address:port ] [ CPU-num ]
Port directive. If an IP address is given as well as a port, the server -will listen on the given port and interface.

Multiple Listen +will listen on the given port and interface. + +

The optional CPU-num argument specifies a CPU to which child +processes listening to this address should be bound, when the SingleListen option is +on. + +

Multiple Listen directives may be used to specify a number of addresses and ports to listen to. The server will respond to requests from any of the listed addresses and ports.

@@ -131,6 +138,7 @@ Virtual Hosts, BindAddress directive, Port directive, +SingleListen directive, DNS Issues and <VirtualHost> section. diff -urN apache_1.3.20/htdocs/manual/misc/API.html-orig apache_1.3.20/htdocs/manual/misc/API.html --- apache_1.3.20/htdocs/manual/misc/API.html-orig Tue May 15 11:45:58 2001 +++ apache_1.3.20/htdocs/manual/misc/API.html Sat Jun 30 23:53:24 2001 @@ -36,6 +36,9 @@ some cases, they really are things I just haven't gotten around to yet. Welcome to the bleeding edge.

+See also the Guide to 64-Bit Apache for +tips on how to program for both 32-bit and 64-bit versions of Apache.

+ Finally, here's an outline, to give you some bare idea of what's coming up, and in what order: diff -urN apache_1.3.20/htdocs/manual/misc/client_block_api.html-orig apache_1.3.20/htdocs/manual/misc/client_block_api.html --- apache_1.3.20/htdocs/manual/misc/client_block_api.html-orig Tue May 15 11:45:59 2001 +++ apache_1.3.20/htdocs/manual/misc/client_block_api.html Sat Jun 30 23:53:24 2001 @@ -41,7 +41,7 @@

    int ap_setup_client_block (request_rec *, int read_policy);
    int ap_should_client_block (request_rec *);
-   long ap_get_client_block (request_rec *, char *buffer, int buffer_size);
+   ap_int32 ap_get_client_block (request_rec *, char *buffer, int buffer_size);
 
    diff -urN apache_1.3.20/htdocs/manual/misc/fin_wait_2.html-orig apache_1.3.20/htdocs/manual/misc/fin_wait_2.html --- apache_1.3.20/htdocs/manual/misc/fin_wait_2.html-orig Tue May 15 11:46:01 2001 +++ apache_1.3.20/htdocs/manual/misc/fin_wait_2.html Sat Jun 30 23:53:24 2001 @@ -189,7 +189,8 @@ support a timeout. For IRIX 5.3, 6.2, and 6.3, use patches 1654, 1703 and 1778 respectively. If you have trouble locating these patches, please contact your - SGI support channel for help. + SGI support channel for help. IRIX 6.5 supports the timeout + without needing a patch.
  1. NCR's MP RAS Unix 2.xx and 3.xx both have FIN_WAIT_2 timeouts. In 2.xx it is non-tunable at 600 seconds, while in 3.xx it defaults to 600 seconds and diff -urN apache_1.3.20/htdocs/manual/misc/perf-mja.html-orig apache_1.3.20/htdocs/manual/misc/perf-mja.html --- apache_1.3.20/htdocs/manual/misc/perf-mja.html-orig Wed Dec 31 19:00:00 1969 +++ apache_1.3.20/htdocs/manual/misc/perf-mja.html Sat Jun 30 23:53:24 2001 @@ -0,0 +1,660 @@ + + + + + Making Apache Ten Times Faster + + + +

    +

    [APACHE DOCUMENTATION]

    +

    +Apache HTTP Server Version 1.3

    +

    +

    +

    +Making Apache Ten Times Faster

    +

    +Mike Abbott - mja@sgi.com
    +Accelerating Apache +Project

    +

    +

    +I have contributed a bunch of +patches to the Apache Project that together increase the +performance of the Apache HTTP server up to 900%. This document +summarizes how to maximize the performance of Apache using my patches. +The measures of performance in this document are the SPECweb96 and SPECweb99 benchmarks. +SPECweb96 measures only the number of static HTTP/1.0 GET requests a +web server can service per second. SPECweb99 adds HTTP/1.1, a dynamic +component, and CGI and measures the number of simultaneous connections +a web server can handle. This paper assumes a working knowledge of +Apache internals.

    +
    +The advice that follows may or may not apply to your system and may +increase or decrease your system's performance depending on factors +beyond the scope of this document. Use this guide only in conjunction +with a clear understanding of your performance goals and overriding +needs.
    +

    +Contents

    + +

    +Introduction

    +

    +The patches + I contributed to the Apache Project modify Apache's source code and +standard configuration files to speed up the processing of HTTP +requests in various ways. Still, Apache must be configured, compiled, +and tuned to achieve the best performance on a given system. The +following sections describe the configurable options relevant for high +performance.

    +

    +The options fall into four categories by what they control: the QSC, +Apache's child processes, direct I/O, the stat cache, and other.

    +

    +Tuning the QSC

    +

    +The Quick Shortcut Cache (QSC) cuts out +unnecessary processing for requests to cached static content. It sports +a number of configurable options. +Two of these, QSC_HASH_SIZE and QSC_MAX_SIZE, +limit the maximum size of the cache and almost certainly need to be +increased from their default values to provide the maximum benefit for +a given system. A third, QSC_HEADER_GRAIN (which normally +uses the same value as CACHE_ALIGNMENT), regulates +alignment and padding and can improve performance more than you might +think when set correctly. See the QSC +documentation for details on these +options and for instructions on using +the QSC.

    +

    +Also, the QSC can manage the very large amounts of data enabled by a 64-bit address space although with a slight +performance penalty.

    +

    +As patched, Apache's standard run-time configuration file httpd.conf + enables the QSC when the mmap_static module is installed. Leave the QSC +on directive as is.

    +

    +Summary of options in this section:

    + +

    +Tuning Child Processes

    +

    +Under heavy load, a system can spend most of its computing power +creating, destroying, and scheduling Apache +child processes. Eliminating all this overhead allows the system to +spend more of its time processing HTTP requests but reduces Apache's +ability to adapt to a changing load.

    +

    +Apache's standard run-time configuration file httpd.conf + sets no limit on the number of requests each child process handles +before terminating itself and forcing the parent Apache process to fork +a replacement. Leave the MaxRequestsPerChild + 0 directive as is.

    +

    +Choose a number of processes and force Apache always to use that +number, never more or less. Set the MinSpareServers, MaxSpareServers, StartServers, +and MaxClients + options all to the same value and ignore the resulting warning:

    +
    +server reached MaxClients setting, consider raising the +MaxClients setting
    +

    +The number you use is up to you but remember, sometimes having fewer +processes runs faster than having more. Start with, say, two per +network interface and increase from there as necessary if your content +is predominantly static. You will need more if your content is +significantly dynamic (e.g., lots of CGI).

    +

    +Bind interrupts from network interface devices to specific processors +(distributing them as evenly as possible across all the processors) and +bind the Apache child processes listening to those interfaces to the +same processors using the Listen + directive. Force each child process to listen only to its designated +interface -- and eliminate performance-sapping accept serialization + -- by turning SingleListen + on.

    +

    +Summary of options in this section:

    + +

    +Direct I/O

    +

    +Direct I/O is the name for reading or writing data directly into +and out of user space without using the system's buffer cache.

    +

    +Normally Apache reads or memory-maps disk files containing content it +serves. The system DMAs data from disk into a system buffer. If Apache +uses read() the system copies the data into Apache's +memory; if Apache uses mmap() it and the system share the +system buffer's memory. Either way, the system maintains the cache of +buffered data which it manages without guidance from Apache. In +particular, the system can choose to invalidate any data in its buffer +cache when it needs to insert new data into a full cache. If the system +chooses poorly, it quickly becomes disk-bound re-reading data it just +had in its cache that it evicted to make room for other data. This +problem does not occur when the system has enough memory to store all +the files Apache serves (at once), a configuration I recommend. But +when memory is tight, direct I/O can help.

    +

    +Direct I/O bypasses the system's buffer cache. When Apache uses direct +I/O read() the system DMAs data from disk directly into +Apache's memory. Judicious use can reduce thrashing of the buffer +cache, but overuse can lead to similarly degraded performance because +every read() causes disk I/O. (Memory mapping cannot be +used with direct I/O.)

    +

    +At this time Apache supports only SGI's Irix implementation of direct +I/O.

    +

    +When USE_DIRECT_IO is defined, Apache's default request +handler will attempt to use direct I/O to serve files that are DIRECT_THRESHOLD + bytes in size or larger (default 64 MB). I say "attempt" +because direct I/O requires stringent data alignment which certain +types of requests (in particular, data ranges) violate. If Apache +cannot use direct I/O it falls back to using either mmap() + or read(). Note that only the default handler tries +direct I/O and that, in particular, the mmap_static module's handler +does not. To make Apache try direct I/O you must not include an mmapfile + directive for that file.

    +

    +Apache limits its use of direct I/O to large files on the assumption +that it serves small files more often than large ones, and because +under low memory conditions a single large file blows away many small +files in the system's buffer cache. This scheme increases the chance +that small files will remain buffered, helping performance.

    +

    +Two other parameters help control Apache's use of direct I/O. MAX_DIRECT_ALIGN + sets the maximum alignment boundary permissible when using direct I/O, +in bytes (default 4 KB). MAX_DIRECT_BUFSIZE sets the size +of the buffer Apache uses when performing direct I/O, in bytes (default IOBUFSIZE). +If the file's alignment restrictions exceed these parameters Apache +will log a warning and not use direct I/O for that file. Both +parameters must be powers of two greater than zero and can be changed +at will.

    +

    +Summary of options in this section:

    + +

    +The Stat Cache

    +

    +The Stat Cache caches the results of recent stat() system +calls. Most requests not handled by the QSC cause +Apache to stat() at least one file and possibly many +depending on other configuration settings. This saps performance and is +often unnecessary, as the same files or directories are queried +repeatedly and usually return the same status. The stat cache amortizes +the cost of these expensive file system operations over many requests +and improves performance, at the cost of using more memory and adding +delay between the time a file changes and the time Apache notices.

    +

    +Briefly, the stat cache, when enabled (USE_STAT_CACHE is +defined) caches the results of a certain number (STAT_CACHE_SIZE) +of stat() results for a period of time (STAT_CACHE_TIME + seconds) as long as the full path name of the file is short enough (STAT_CACHE_PATHLEN + bytes including the null).

    +

    +Each Apache child process has its own stat cache so I recommend keeping +it small. The total amount of memory the stat cache consumes is +proportional to:

    +
    +STAT_CACHE_SIZE * STAT_CACHE_PATHLEN * #-of-Apache-processes +

    +Each Apache process's stat cache maintains informational counters to +assist experienced users with tuning. The stat_cache_stats + structure, currently visible only via a debugger, contains:

    +
      +
    • + nhits - number of cache lookups that matched an + existing entry +
    • + nmisses - number of cache lookups that found no + existing entry +
    • + nrestats - number of cache hits with too-old results +
    • + nrejects - number of cache misses that could not be + entered into the cache because the path names were too long +
    +

    +Only certain parts of Apache take advantage of the stat cache. If you +know of other places where it is recommended and safe to use the stat +cache (ap_stat_cache()) instead of regular stat() + -- or if you have a better way to export the counters -- please contribute your changes.

    +

    +Stat cache options:

    + + + + + + + + + + + + + + + + + +
    USE_STAT_CACHE

    + Enables the stat cache.

    + Default: not defined, so the stat cache is disabled.
    STAT_CACHE_SIZE

    + Sets the number of cache entries.

    + Default: 16.
    STAT_CACHE_TIME

    + The maximum age in seconds of cached stat() + results. When a cached result is too old the cache (lazily) restats + the file.

    + Default: 30.
    STAT_CACHE_PATHLEN

    + The maximum length in bytes of a cached path name, including the + trailing null.

    + Default: 128.
    +

    +Summary of options in this section:

    +
      +
    • + configure options: +
        +
      • + none +
      +
    • + Compilation options: +
        +
      • + -DUSE_STAT_CACHE or -DSPEED_DAEMON +
      • + -DSTAT_CACHE_SIZE=something +
      • + -DSTAT_CACHE_TIME=something +
      • + -DSTAT_CACHE_PATHLEN=something +
      +
    • + Run-time configuration options: +
        +
      • + none +
      +
    +

    +General Tuning

    +

    +Always compile optimized.

    +

    +Define SPEED_DAEMON which defines all of these other +tokens:

    +
      +
    • + USE_QSC - enables the QSC +
    • + FAST_TIME - speeds up time-keeping +
    • + BUFFERED_LOGS - buffers server log entries +
    • + NO_GRACEFUL - eliminates signal overhead but disables graceful restarts +
    • + USE_QUICK_LOG - accelerates logging in common-log format +
    • + USE_STAT_CACHE - enables the stat + cache +
    +

    +Define the value of LOG_BUFSIZE + to be some multiple of the system's page size, less a few dozen bytes +or so for overhead.

    +

    +Use only the Common Log Format.

    +

    +Raise the limit on the number of response bytes written at a time by +defining the value of MMAP_SEGMENT_SIZE to be larger than +the largest cached file -- but not on Linux, where this actually slows +things down!

    +

    +Make the listen queue size as large as possible using the ListenBacklog + directive.

    +

    +Summary of options in this section:

    + +

    +Example

    +

    +Here is the configuration I use to achieve maximum SPECweb96 +performance on an SGI Origin200 server running Irix 6.5 with two +processors, two gigabytes of memory, and four 100BaseT network +interfaces. Without any patching or tuning Apache on this system +handles 240 operations per second; with my patches and the following +tuning it handles 2400*.

    +
    +* These are actual SPECweb96 results and while I believe they are +accurate and meaningful, they have not been submitted to SPEC for +review or publication. The following is for illustrative purposes only +and is not a SPECweb96 disclosure.
    +
      +
    • + configure options: +
        +
      • + --enable-module=mmap_static --enable-module=info +
      +
    • + Compilation options: +
        +
      • + -O2 +
      • + -DSPEED_DAEMON +
      • + -DLOG_BUFSIZE=65500 +
      • + -DMMAP_SEGMENT_SIZE=1048576 +
      • + -DQSC_HASH_SIZE=32768 +
      • + -DQSC_MAX_SIZE=5000000 +
      +
    • + Run-time configuration options: +
      +ServerType standalone
      +ServerName something
      +ServerAdmin root
      +ServerRoot /a/apache
      +ServerSignature Off
      +PidFile /a/apache/logs/httpd.pid
      +ScoreBoardFile /a/apache/logs/httpd.scoreboard
      +Timeout 300
      +KeepAlive On
      +MaxKeepAliveRequests 0
      +KeepAliveTimeout 15
      +MinSpareServers 12
      +MaxSpareServers 12
      +StartServers 12
      +MaxClients 12
      +MaxRequestsPerChild 0
      +User nobody
      +Group nobody
      +Port 80
      +Listen 100.100.100.101:80 0
      +Listen 100.100.100.102:80 0
      +Listen 100.100.100.103:80 1
      +Listen 100.100.100.104:80 1
      +ListenBacklog 1000
      +SingleListen on
      +QSC on
      +
      +ClearModuleList
      +AddModule mod_mmap_static.c
      +AddModule mod_log_config.c
      +
      +DocumentRoot "/a/htdocs"
      +<Directory />
      +    Options FollowSymLinks
      +    AllowOverride None
      +</Directory>
      +UseCanonicalName Off
      +DefaultType text/plain
      +HostnameLookups Off
      +ErrorLog /b/logs/errors-apache
      +LogLevel warn
      +LogFormat "%a %l %u %t \"%r\" %>s %b" quick
      +CustomLog /b/logs/access-apache quick
      +
      +AddModule mod_mime.c
      +AddModule mod_status.c
      +AddModule mod_info.c
      +<Location /server-status>
      +    SetHandler server-status
      +</Location>
      +<Location /server-info>
      +    SetHandler server-info
      +</Location>
      +
      +mmapfile /a/htdocs/spec/file_set/dir0/class0_0
      +mmapfile /a/htdocs/spec/file_set/dir0/class0_1
      +mmapfile /a/htdocs/spec/file_set/dir0/class0_2
      +mmapfile /a/htdocs/spec/file_set/dir0/class0_3
      + ...
      +mmapfile /a/htdocs/spec/file_set/dir223/class3_5
      +mmapfile /a/htdocs/spec/file_set/dir223/class3_6
      +mmapfile /a/htdocs/spec/file_set/dir223/class3_7
      +mmapfile /a/htdocs/spec/file_set/dir223/class3_8
      +AddModuleInfo mod_mmap_static.c "Configured for 2500 SPECweb96 ops/sec"
      +
      +
    +

    +Direct I/O is neither needed nor used because the entire SPECweb96 file +set fits in memory in this example. If the system had less memory I +would add:

    +
      +
    • + Compilation options: +
        +
      • + -DUSE_DIRECT_IO +
      • + -DDIRECT_THRESHOLD=800000 +
      • + -DMAX_DIRECT_BUFSIZE=65536 +
      +
    +

    +and delete the mmapfile directives for all class3_8 files:

    +
      +
    • + Run-time configuration options: +
      +# mmapfile /a/htdocs/spec/file_set/dir0/class3_8
      + ...
      +# mmapfile /a/htdocs/spec/file_set/dir223/class3_8
      +
      +
    +

    +and maybe class3_7, class3_6, and others too +until the system performs as few disk reads as possible during the +benchmark run.

    +

    +The stat cache also is neither needed nor used because the QSC handles +every request the benchmark measures and there are no stat()s +to cache. But when using direct I/O or CGI the stat cache can help. I +would add:

    +
      +
    • + Compilation options: (USE_STAT_CACHE is already + defined, by SPEED_DAEMON) +
        +
      • + -DSTAT_CACHE_SIZE=250 +
      • + -DSTAT_CACHE_TIME=30000 +
      • + -DSTAT_CACHE_PATHLEN=48 +
      +
    +

    +See also

    + +
    +

    +Apache HTTP Server Version 1.3

    +

    +Index

    + + diff -urN apache_1.3.20/htdocs/manual/misc/perf-tuning.html-orig apache_1.3.20/htdocs/manual/misc/perf-tuning.html --- apache_1.3.20/htdocs/manual/misc/perf-tuning.html-orig Tue May 15 11:46:05 2001 +++ apache_1.3.20/htdocs/manual/misc/perf-tuning.html Sat Jun 30 23:53:24 2001 @@ -61,6 +61,13 @@ performance out of Apache's current model, and want to understand why it does some things which slow it down. +

    Mike Abbott from SGI has increased Apache's performance ten-fold for +static HTTP GET requests such as those issued by the SPECweb96 benchmark. See +his tuning document and SGI's Web Server Performance Tuning +Guide for more information. +

    Note that this is tailored towards Apache 1.3 on Unix. Some of it applies to Apache on NT. Apache on NT has not been tuned for performance yet; in fact it probably performs very poorly because NT performance requires @@ -266,7 +273,7 @@ contains timing indications. For highest performance, set ExtendedStatus off (which is the default). -

    accept Serialization - multiple sockets

    +

    accept Serialization - multiple sockets

    This discusses a shortcoming in the Unix socket API. Suppose your diff -urN apache_1.3.20/htdocs/manual/misc/perf.html-orig apache_1.3.20/htdocs/manual/misc/perf.html --- apache_1.3.20/htdocs/manual/misc/perf.html-orig Tue May 15 11:46:05 2001 +++ apache_1.3.20/htdocs/manual/misc/perf.html Sat Jun 30 23:53:24 2001 @@ -33,6 +33,7 @@

  2. BSD-based (BSDI, FreeBSD, etc)
  3. Digital UNIX
  4. HPUX +
  5. SGI IRIX
  6. Linux
  7. Solaris
  8. SunOS 4.x @@ -74,6 +75,15 @@
  9. We have some newsgroup postings on how to tune Digital UNIX 3.2 and 4.0. + +


    +

    +IRIX +

    + +See Mike Abbott's performance tuning +document and SGI's Web Server +Performance Tuning Guide.


    diff -urN apache_1.3.20/htdocs/manual/mod/core.html-orig apache_1.3.20/htdocs/manual/mod/core.html --- apache_1.3.20/htdocs/manual/mod/core.html-orig Tue May 15 11:45:31 2001 +++ apache_1.3.20/htdocs/manual/mod/core.html Sun Jul 1 01:52:47 2001 @@ -79,6 +79,7 @@
  10. Options
  11. PidFile
  12. Port +
  13. QSC
  14. Require
  15. ResourceConfig
  16. RLimitCPU @@ -96,6 +97,7 @@
  17. ServerSignature
  18. ServerTokens
  19. ServerType +
  20. SingleListen
  21. StartServers
  22. ThreadsPerChild
  23. ThreadStackSize @@ -1760,7 +1762,7 @@ Apache 1.3.2 and later.

    -

    Number is an integer from 0 (meaning unlimited) to 32767. +

    Number is a long integer from 0 (meaning unlimited) to 2147483647. The default value is defined by the compile-time constant DEFAULT_LIMIT_REQUEST_FIELDS (100 as distributed).

    @@ -1883,7 +1885,7 @@ HREF="directive-dict.html#Syntax" REL="Help" >Syntax: -Listen [IP-address:]port
    +Listen [IP-address:]port [CPU-num]
    Compatibility: Listen is only available in Apache -1.1 and later.

    +1.1 and later. +The optional CPU-num argument is only available in Apache 1.3.7 and later.

    The Listen directive instructs Apache to listen to more than one IP address or port; by default it responds to requests on all IP @@ -1936,6 +1939,11 @@ Listen 192.170.2.5:8000 +

    The optional CPU-num argument specifies the CPU to which Apache child +processes listening exclusively to this address/port should be bound. +See the SingleListen directive for +detailed information. +

    See Also: DNS Issues
    See Also: @@ -2676,6 +2684,34 @@ root whilst handling connections, your site may be open to a major security attack.


    +

    QSC directive

    + +Syntax: QSC on|off
    +Default: <IfModule mod_mmap_static.c> QSC on </IfModule> else QSC off
    +Context: server config
    +Status: core
    +Compatibility: The QSC is only available in Apache +1.3.X and later. +

    +This directive enables or disables the Quick Shortcut Cache. +

    +


    +

    Require directive

    + +
    +

    SingleListen directive

    + +Syntax: SingleListen on|off
    +Default: SingleListen off
    +Context: server config
    +Status: core
    +Compatibility: SingleListen is only available in Apache +1.3.7 and later. +

    +This directive controls the set of IP addresses (and ports) to which +child processes listen. When SingleListen is on, each child process +listens to a single IP address and port from the list specified using +Listen directives. Listen addresses are distributed evenly across child +processes. This is a high-performance, but not necessarily +general-purpose, way to solve the thorny accept-serialization +problem found with multiple Listen addresses. When off, the +default, each child process listens to all Listen addresses +simultaneously. +

    +This directive also enables another performance optimization for systems +with multiple CPUs and multiple network interfaces. When the device +interrupts from each network interface are bound to particular CPUs and +the Apache child processes listening for requests from those interfaces +are bound to the same CPUs, performance is increased due to +cache-warming. (Listen directives specify IP-address/CPU-number pairs.) +This optimization is particularly helpful on cache-coherent non-uniform +memory access (ccNUMA) systems such as SGI's Origin series because it +also increases memory reference locality. CPU binding is disabled if +SingleListen is off. +

    +Here is an example of this: +

    Listen 111.22.33.44 0
    +Listen 111.22.33.45 1
    +Listen 111.22.33.46 2
    +Listen 111.22.33.47 3
    +SingleListen on
    +
    +Apache child processes listening to requests from 111.22.33.44 are bound +to CPU 0, child processes listening to 111.22.33.45 are bound to CPU 1, +and so on. When this configuration is used on a four-CPU system where +interrupts from the network controller for 111.22.33.44 are bound to CPU +0, interrupts from 111.22.33.45 are bound to CPU 1, and so on, +performance is increased over a system lacking such binding. Note that +binding child processes to CPUs other than those to which the network +interrupts are bound may result in worse performance. +

    +See also the Listen directive, +the status module, and +the performance tuning guide. +

    +


    StartServers directive

    diff -urN apache_1.3.20/htdocs/manual/mod/directives.html-orig apache_1.3.20/htdocs/manual/mod/directives.html --- apache_1.3.20/htdocs/manual/mod/directives.html-orig Tue May 15 11:45:33 2001 +++ apache_1.3.20/htdocs/manual/mod/directives.html Sat Jun 30 23:53:24 2001 @@ -179,6 +179,7 @@
  24. ProxyRemote
  25. ProxyRequests
  26. ProxyVia +
  27. QSC
  28. ReadmeName
  29. Redirect
  30. RedirectMatch @@ -225,6 +226,7 @@
  31. SetEnvIf
  32. SetEnvIfNoCase
  33. SetHandler +
  34. SingleListen
  35. StartServers
  36. ThreadsPerChild
  37. TimeOut diff -urN apache_1.3.20/htdocs/manual/mod/mod_log_config.html-orig apache_1.3.20/htdocs/manual/mod/mod_log_config.html --- apache_1.3.20/htdocs/manual/mod/mod_log_config.html-orig Tue May 15 11:45:46 2001 +++ apache_1.3.20/htdocs/manual/mod/mod_log_config.html Sat Jun 30 23:53:24 2001 @@ -236,6 +236,33 @@ within its definition, not in any of the main server's log files. See the examples below.

    +

    Performance Issues

    + +When Apache is compiled with USE_QUICK_LOG defined, logging +in Common Log Format (CLF) is extra fast. This module recognizes and +accelerates two variants of CLF: + +
      +
    • standard CLF ("%h %l %u %t \"%r\" %>s %b") +
    • numeric CLF ("%a %l %u %t \"%r\" %>s %b") +
    + +Numeric CLF is the same as using standard CLF with HostNameLookups off: +both log IP addresses rather than host names. Logging IP addresses is +much faster than logging host names. + +

    Buffering log entries also increases performance, but at the cost of +delaying writing those entries to disk. Compile Apache with +BUFFERED_LOGS defined to buffer log entries. The standard +amount buffered is PIPE_BUF bytes (a POSIX defined +constant). For an even faster web server you can increase the buffering +by defining LOG_BUFSIZE to be the number of bytes you want +buffered. Beware though: increase LOG_BUFSIZE beyond +PIPE_BUF only if you know you're not using piped logs and +your system can write more than PIPE_BUF bytes atomically +to disk at once +

    Security Considerations

    See the security tips diff -urN apache_1.3.20/htdocs/manual/mod/mod_mmap_static.html-orig apache_1.3.20/htdocs/manual/mod/mod_mmap_static.html --- apache_1.3.20/htdocs/manual/mod/mod_mmap_static.html-orig Tue May 15 11:45:48 2001 +++ apache_1.3.20/htdocs/manual/mod/mod_mmap_static.html Sat Jun 30 23:53:24 2001 @@ -56,6 +56,8 @@ call is available on most modern Unix derivates, but not on all. There are sometimes system-specific limits on the size and number of files that can be mmap()d, experimentation is probably the easiest way to find out. + 64-bit Apache can map more data than 32-bit + Apache can, but neither can map files larger than around 2 GB.

    This mmap()ing is done once at server start or restart, only. So whenever @@ -69,6 +71,15 @@ this. The reason why this modules doesn't take care of changes to the files is that this check would need an extra stat() every time which is a waste and against the intent of I/O reduction. +

    +

    + Use of this module allows use of the Quick Shortcut (or Static-content) + Cache (QSC) for very fast static-content serving. + See the QSC documentation for details. +

    +

    + Note that mapping a large number of files greatly increases server + start-up and restart time.

    Directives

    diff -urN apache_1.3.20/htdocs/manual/mod/mod_status.html-orig apache_1.3.20/htdocs/manual/mod/mod_status.html --- apache_1.3.20/htdocs/manual/mod/mod_status.html-orig Tue May 15 11:45:52 2001 +++ apache_1.3.20/htdocs/manual/mod/mod_status.html Sat Jun 30 23:53:24 2001 @@ -71,6 +71,8 @@
  38. The current percentage CPU used by each child and in total by Apache (*)
  39. The current hosts and requests being processed (*) +
  40. QSC statistics, if the QSC is +present and enabled.

    Details marked "(*)" are only available with diff -urN apache_1.3.20/htdocs/manual/programs/httpd.html-orig apache_1.3.20/htdocs/manual/programs/httpd.html --- apache_1.3.20/htdocs/manual/programs/httpd.html-orig Tue May 15 11:46:12 2001 +++ apache_1.3.20/htdocs/manual/programs/httpd.html Sun Jul 1 01:56:22 2001 @@ -119,6 +119,9 @@ -V Print the version and build parameters of httpd , and then exit. + -i For testing: Do not daemonize (i.e. fo not fork and exit on startup). + Apache (1.3.X and later). + FILES /usr/local/apache/conf/httpd.conf /usr/local/apache/conf/srm.conf diff -urN apache_1.3.20/htdocs/manual/qsc.html-orig apache_1.3.20/htdocs/manual/qsc.html --- apache_1.3.20/htdocs/manual/qsc.html-orig Wed Dec 31 19:00:00 1969 +++ apache_1.3.20/htdocs/manual/qsc.html Sat Jun 30 23:53:24 2001 @@ -0,0 +1,708 @@ + + + + + The Quick Shortcut Cache (QSC) + + + +

    +

    [APACHE DOCUMENTATION]

    +

    +Apache HTTP Server Version 1.3

    +

    +

    +

    +The Quick Shortcut Cache (QSC)

    +

    +Also known as the Quick Static-content Cache

    +

    +Mike Abbott - mja@sgi.com
    +Accelerating Apache Project

    +

    +

    +Apache/1.3.X and beyond support a very fast cache of static content and +HTTP response headers known as the Quick Shortcut (or Static-content) +Cache, or QSC. The QSC is meant for sites that serve lots of data as-is +from disk, such as images, unparsed HTML, and plain text. Sites that +serve mostly dynamically-generated content, such as CGI output or +on-disk content with headers or footers generated on the fly, probably +should not use the QSC.

    +

    +Contents

    + +

    +QSC Primer

    +

    +Normally Apache processes an HTTP request by following a long list of rules, such as converting the URI to a +file name, authenticating the request, generating HTTP headers for the +response, sending the response, and logging information about the +transaction. Apache performs all these steps (more or less) for every +request, even if it has handled the same request previously. This +memory-less behavior is required for steps such as authentication but +is unnecessary for URI-to-file translation and HTTP response header +generation when the response consists of static content. The QSC adds +memory to Apache, allowing it to shortcut the processing of +previously-seen requests for static content.

    +

    +Operation

    +

    +After Apache reads an HTTP request and locates the appropriate virtual host context in which to handle +the request, it checks whether the QSC can respond to the request -- +whether the request is cachable and whether the +URI and virtual host match a cached entry. If so, the QSC bypasses all +unnecessary processing and sends the previously-generated HTTP response +quickly, then Apache logs the transaction and moves on to the next +request.

    +

    +When the QSC cannot respond quickly, Apache continues processing the +request normally. When such normal processing results in the mmap_static module sending the +HTTP response, that module tries to insert the request and response +into the QSC -- which succeeds only if the request and response are cachable and the cache isn't full. +Finally, as with the cached response, Apache logs the transaction and +moves on to the next request. Note that the QSC caches both the +response headers and the response body.

    +

    +Interaction with the mmap_static Module

    +

    +Only the mmap_static module inserts entries into the QSC, for a number +of reasons:

    +
      +
    • + The mmap_static module keeps file contents mapped into memory so + sending the response body is simple and quick. (QSC entries point to + the memory-mapped file contents held by the mmap_static module; the QSC + sends this data as the HTTP response body.) +
    • + The mmap_static module responds only to requests for static content. +
    • + The mmap_static module responds only to requests for + explicitly-designated files. The administrator has full control. +
    • + Both the QSC and the mmap_static module reset themselves upon server + restarts. +
    • + Both the QSC and the mmap_static module share a sole purpose: to + increase performance. +
    +

    +Virtual Hosts

    +

    +When looking for a cache entry to satisfy a request, the QSC matches +the virtual host as well as the URI because different virtual hosts can +map the same URI to different files.

    +

    +Response Headers

    +

    +Each QSC entry contains two nearly identical sets of HTTP response +headers, one for keep-alive connections (the headers contain a Connection: +keep-alive header) and one for non-keep-alive connections (the +headers contain a Connection: close header). Caching both +versions allows the QSC to respond quickly regardless of the nature of +the connection and without having to generate the HTTP headers for each +request -- a key ingredient for quick response.

    +

    +Furthermore, the QSC aligns both sets of response headers on a certain +memory boundary and pads them out to a certain length. Generally this +alignment is the secondary cache line size of the system on which +Apache runs. When asked to send data out on a network, operating +systems typically align misaligned data by copying it. The QSC +pre-aligns the headers (and the mmap_static module automatically aligns +the body due to the nature of memory-mapping files) and pads the +headers (by adding spaces to the Server header value) to +eliminate this overhead. You can adjust or disable the +header alignment manually.

    +

    +Using the QSC

    +

    +This section describes how to compile and enable QSC support in your +Apache server.

    +

    +The QSC requires the mmap_static +module. In the standard Apache distribution neither the QSC nor the +mmap_static module are compiled into the server. You must add them both +to the compilation configuration to use the QSC:

    +
    +  $ CFLAGS=-DUSE_QSC configure --enable-module=mmap_static
    +  $ make
    +
    +

    +(The QSC is an enhancement to core Apache, while mmap_static is an +Apache module.) There are also advanced +options to controlling QSC behavior, described below.

    +

    +In addition, a run-time configuration directive, QSC, enables and disables +the QSC. By default the QSC is off (disabled) +but this snippet from the standard httpd.conf file enables it when the +mmap_static module is also compiled into the server:

    +
    +  <IfModule mod_mmap_static.c>
    +      QSC on
    +  </IfModule>
    +
    +

    +In other words, compiling both the QSC and the mmap_static module +automatically enables the QSC. The QSC directive exists to +allow you to disable it.

    +

    +You must also configure the mmap_static module by adding an mmapfile directive for +each file you want cached.

    +

    +Once configured the QSC will operate automatically.

    +

    +Shared Memory

    +

    +All of the data the QSC stores is in shared memory (memory accessible +to all of Apache's subprocesses) so that the cache is not duplicated +for each Apache child process. Systems that do not support anonymous +shared memory (that define neither HAVE_MMAP nor HAVE_SHMGET) +cannot use the QSC.

    +

    +Atomic Compare-and-Swap

    +

    +The QSC requires one piece of functionality that is completely new to +Apache and so has not had the benefit of years of multi-platform +porting: a way to compare and swap (cas) two values atomically +(i.e., in a thread-safe manner). All of the QSC's internal data +structures are stored in shared memory so every update to that data +must be done in a way that is guaranteed to be safe and correct for all +the child processes. If your attempt to compile the QSC fails with the +error "need atomic compare-and-swap function," you must port +the function qsc_cas() to your system.

    +

    +Monitoring the QSC

    +

    +The QSC gathers statistics about its operation. You can view these +statistics on the page that the status +module generates in response to requests of the form:

    +
    +  http://your.server.name/server-status
    +
    +

    +This section has examples and explanations of this information.

    +

    +This is what the status page looks like when the QSC is disabled:

    +
    +  Quick Shortcut Cache (QSC) Status:
    +  QSC disabled
    +
    +

    +There may be an explanation why the QSC is disabled in the server's +error log. The next example shows the statistics from a freshly-started +server with the QSC enabled:

    +
    +  Quick Shortcut Cache (QSC) Status:
    +    hit ratio            0/1 (0.00%)
    +    uncachable           1/1 (100.00%)
    +    uncachable misses    1/1 (100.00%)
    +    uncachable requests  0/1 (0.00%)
    +    uncachable responses 0/1 (0.00%)
    +    resets               1
    +  Hash table
    +    failed insertions    0
    +    entries              0
    +    duplicate entries    0
    +    bucket use           0/32768 (0.00%)
    +    hash effectiveness   0/0 (0.00%)
    +    longest chain        0
    +    avg. chain           0.0
    +    avg. nonempty chain  0.0
    +    Chain length histogram:
    +          1     2     3     4     5+
    +          0     0     0     0     0 
    +  Memory use (in bytes)
    +    table + misc         131104
    +    entries              0
    +    URIs                 0
    +    headers              0
    +    total                135264/5000000 (2.71%)
    +    mapped file data     0
    +    mapped file vaddrs   0 (0 16384-byte pages)
    +
    +

    +It's pretty clear that the cache is empty at this point. The next +example shows the statistics from the same server after running for a +while:

    +
    +  Quick Shortcut Cache (QSC) Status:
    +    hit ratio            2104749/2112853 (99.62%)
    +    uncachable           40/2112853 (0.00%)
    +    uncachable misses    40/8104 (0.49%)
    +    uncachable requests  0/2112853 (0.00%)
    +    uncachable responses 0/2112853 (0.00%)
    +    resets               1
    +  Hash table
    +    failed insertions    0
    +    entries              8064
    +    duplicate entries    0
    +    bucket use           7923/32768 (24.18%)
    +    hash effectiveness   7923/8064 (98.25%)
    +    longest chain        2
    +    avg. chain           0.2
    +    avg. nonempty chain  1.0
    +    Chain length histogram:
    +          1     2     3     4     5+
    +       7782   141     0     0     0 
    +  Memory use (in bytes)
    +    table + misc         131104
    +    entries              322560
    +    URIs                 246024
    +    headers              4128768
    +    total                4844640/5000000 (96.89%)
    +    mapped file data     1146761280
    +    mapped file vaddrs   1229455360 (75040 16384-byte pages)
    +
    +

    +The QSC computes some of the statistics (such as the hash chain +lengths, histogram, and memory use) only when requested, and computing +them frequently may interfere with normal server operation. You can +view a condensed statistics page that skips the computation by +appending ?qsc=quick to your request, like this:

    +
    +  http://your.server.name/server-status?qsc=quick
    +
    +

    +which produces this output:

    +
    +  Quick Shortcut Cache (QSC) Status:
    +    hit ratio            2104749/2112854 (99.62%)
    +    uncachable requests  0/2112854 (0.00%)
    +    uncachable responses 0/2112854 (0.00%)
    +    resets               1
    +  Hash table
    +    failed insertions    0
    +
    +

    +Alternatively, you can view detailed QSC information by appending ?qsc=full, +like this:

    +
    +  http://your.server.name/server-status?qsc=full
    +
    +

    +which produces this output (with a large portion omitted for brevity):

    +
    +  Quick Shortcut Cache (QSC) Status:
    +    hit ratio            2104749/2112855 (99.62%)
    +    uncachable           42/2112855 (0.00%)
    +    uncachable misses    42/8106 (0.52%)
    +    uncachable requests  0/2112855 (0.00%)
    +    uncachable responses 0/2112855 (0.00%)
    +    resets               1
    +  Hash table
    +    failed insertions    0
    +    entries              8064
    +    duplicate entries    0
    +    bucket use           7923/32768 (24.18%)
    +    hash effectiveness   7923/8064 (98.25%)
    +    longest chain        2
    +    avg. chain           0.2
    +    avg. nonempty chain  1.0
    +    Chain length histogram:
    +          1     2     3     4     5+
    +       7782   141     0     0     0 
    +  Memory use (in bytes)
    +    table + misc         131104
    +    entries              322560
    +    URIs                 246024
    +    headers              4128768
    +    total                4844640/5000000 (96.89%)
    +    mapped file data     1146761280
    +    mapped file vaddrs   1229455360 (75040 16384-byte pages)
    +  Full entry info
    +    server * URI @ hash-bucket -> keep-alive-header-bytes;non-keep-alive-header-bytes + body-bytes file-name
    +    main * /spec/file_set/dir115/class0_0 @ 37 -> 256;256 + 102 /a/htdocs/spec/file_set/dir115/class0_0
    +    main * /spec/file_set/dir115/class0_1 @ 38 -> 256;256 + 204 /a/htdocs/spec/file_set/dir115/class0_1
    +    main * /spec/file_set/dir115/class0_2 @ 39 -> 256;256 + 306 /a/htdocs/spec/file_set/dir115/class0_2
    +    main * /spec/file_set/dir115/class0_3 @ 40 -> 256;256 + 408 /a/htdocs/spec/file_set/dir115/class0_3
    +    ... thousands of lines elided for brevity ...
    +    main * /spec/file_set/dir214/class3_8 @ 32752 -> 256;256 + 921600 /a/htdocs/spec/file_set/dir214/class3_8
    +
    +

    +What Do the Statistics Mean?

    +

    +This section explains the final example above in great detail.

    +
    +    hit ratio            2104749/2112855 (99.62%)
    +
    +

    +The hit ratio is the ratio of the number of requests +successfully served by the QSC to the total number of requests made to +the server. The number in parentheses is the ratio expressed as a +percentage. In this case there were 2,112,855 total requests, 2,104,749 +or 99.62% of which were cache hits -- the QSC responded to the requests +quickly -- and 8,106 or 0.38% were cache misses -- Apache processed the +requests without assistance from the QSC.

    +
    +    uncachable           42/2112855 (0.00%)
    +    uncachable misses    42/8106 (0.52%)
    +    uncachable requests  0/2112855 (0.00%)
    +    uncachable responses 0/2112855 (0.00%)
    +
    +

    +These explain the cache misses. Of the 2,112,855 total requests, 42 +were uncachable meaning that not only did they miss (were not +in) the cache but also the QSC could not enter them into its cache for +some reason. In this case, all 42 uncachable requests were uncachable +misses meaning some handler other than the mmap_static module's +handled the request. For instance, all server-status requests are +handled by the status module and so are uncachable misses. (You can see +the number of uncachable misses increasing by one for each example +above.) Other reasons requests may be uncachable are uncachable +requests and uncachable responses.

    +

    +The QSC caches responses to HTTP requests only +when both the request and the response meet certain criteria. To be +cachable a request must:

    +
      +
    • + be an HTTP GET request, and +
    • + not have been marked uncachable by any module (e.g., r->no_cache + == 0), and +
    • + not contain any of the following headers: +
        +
      • + Authorization: ... +
      • + Cache-Control: ... +
      • + If-Modified-Since: ... +
      • + If-None-Match: ... +
      • + If-Range: ... +
      • + Pragma: no-cache +
      • + Range: ... +
      +
    +

    +and its response must:

    +
      +
    • + be produced by the mmap_static module, and +
    • + have status 200 OK, and +
    • + not be chunked, and +
    • + not have been marked uncachable by any module (e.g., r->no_cache + == 0), and +
    • + not contain any of the following headers: +
        +
      • + Cache-Control: ... +
      • + Content-Range: ... +
      • + ETag: W/... (that is, strong etags are cachable, weak ones are not) +
      • + Expires: ... +
      • + Pragma: no-cache +
      • + Vary: ... +
      +
    +

    +For example, pressing the "Reload" button on some popular +browsers causes them to issue requests with a Pragma: no-cache + and/or Cache-control header which are meant to bypass +caching mechanisms such as the QSC.

    +
    +    resets               1
    +
    +

    +The QSC counts the number of times it has been reset. The counter +starts at zero but Apache's normal startup procedures cause one reset. +Each time the server is restarted the QSC clears its cache completely, +zeros-out all the statistics except this counter, and increments this +counter. Thus, the statistics displayed are since the last reset, not +since the server was started.

    +
    +  Hash table
    +    failed insertions    0
    +
    +

    +This is the number of times the QSC tried to insert a new entry into +its cache and failed. Failure can occur when, for example, the QSC has +consumed all the memory it is allowed to use (i.e., the cache is full). +If you see a large number of failed insertions, consider increasing +your QSC's cache size.

    +
    +    entries              8064
    +    duplicate entries    0
    +
    +

    +This shows you how many entries are in the cache, and how many of those +entries are duplicates of one another. Duplicate entries are harmless +aside from wasting a little memory.

    +
    +    bucket use           7923/32768 (24.18%)
    +    hash effectiveness   7923/8064 (98.25%)
    +    longest chain        2
    +    avg. chain           0.2
    +    avg. nonempty chain  1.0
    +    Chain length histogram:
    +          1     2     3     4     5+
    +       7782   141     0     0     0 
    +
    +

    +The above information describes the effectiveness of the QSC's hash +algorithm. This particular instance has 32,768 cache buckets of which +7,923 or 24.18% have at least one entry (the rest are empty). The +effectiveness of the hash function is the ratio of the number of +buckets over which entries are spread to the number of entries, in this +case 7,923 to 8,064 or 98.25% effective. Higher effectiveness means +shorter hash chains which are faster when looking up entries. The +longest hash chain has only two entries which is very good. If your +server shows a low hash efficiency and long hash chains, consider +increasing your QSC's number of hash buckets. The +average (arithmetic mean) chain length is just 0.2 entries per bucket, +including empty buckets, and the average chain length of non-empty +buckets is 1.0 which is excellent. The histogram displays the number of +hash buckets having chains with one, two, three, four, and five-or-more +entries. You can control the number of histogram bins.

    +
    +  Memory use (in bytes)
    +    table + misc         131104
    +
    +

    +The QSC carefully manages the amount of memory it uses and this part of +the report explains where all the bytes are going. This line accounts +for the empty hash table -- the size of which is directly related to +the number of hash buckets -- and other data structures necessary for +the QSC's operation such as the statistics counters. In this example +there are 32,768 hash buckets each of which is four bytes in size so +the whole table consumes 131,072 bytes. The remaining 32 bytes (for a +total of 131,104) are for the statistics counters and other overhead.

    +
    +    entries              322560
    +
    +

    +This line accounts for the memory used for the hash entry data +structures. In this example each entry consumes 40 bytes and there are +8,064 of them for a total of 322,560 bytes.

    +
    +    URIs                 246024
    +
    +

    +Each hash entry maps a URI and virtual host to HTTP response headers +and data. This counts the amount of memory consumed by remembering +those URIs. The average cached URI length in this example is 246,024 +bytes divided by 8,064 entries or about 31 bytes.

    +
    +    headers              4128768
    +
    +

    +This is the number of bytes consumed by remembering the HTTP response +headers for each cached entry. This is approximately double the number +of bytes of header information sent in response to a cached entry +because the QSC keeps two sets of headers, +one for keep-alive connections and one for non-keep-alive connections. +The average number of bytes of cached headers is 4,128,768 bytes +divided by 8,064 entries or exactly 512 bytes (two sets of 256-byte +headers per entry). This number is so tidy because of header +padding and alignment.

    +
    +    total                4844640/5000000 (96.89%)
    +
    +

    +This line displays the total amount of memory that the QSC is using and +the maximum amount to which it limits itself. In this case the cache is +pretty close to full. You can control the maximum +cache size.

    +
    +    mapped file data     1146761280
    +    mapped file vaddrs   1229455360 (75040 16384-byte pages)
    +
    +

    +The QSC itself manages only the hash table, the URI strings, and the +headers. The mmap_static module manages the cache of memory-mapped file +contents. These two lines count the number of bytes of response body +data (in this case 1,146,761,280 bytes for an average file size of +142,208 bytes) and the number of bytes of virtual memory consumed +(1,229,455,360 bytes). The latter is larger because memory-mapping a +file whose size is not an exact multiple of the machine's page size +wastes the space between the end of the file and the end of the page. +In this case the machine's page size is 16 KB and 75,040 pages are used +to map the file contents.

    +
    +  Full entry info
    +    server * URI @ hash-bucket -> keep-alive-header-bytes;non-keep-alive-header-bytes + body-bytes file-name
    +    main * /spec/file_set/dir115/class0_0 @ 37 -> 256;256 + 102 /a/htdocs/spec/file_set/dir115/class0_0
    +    main * /spec/file_set/dir115/class0_1 @ 38 -> 256;256 + 204 /a/htdocs/spec/file_set/dir115/class0_1
    +    main * /spec/file_set/dir115/class0_2 @ 39 -> 256;256 + 306 /a/htdocs/spec/file_set/dir115/class0_2
    +    main * /spec/file_set/dir115/class0_3 @ 40 -> 256;256 + 408 /a/htdocs/spec/file_set/dir115/class0_3
    +    ... thousands of lines elided for brevity ...
    +    main * /spec/file_set/dir214/class3_8 @ 32752 -> 256;256 + 921600 /a/htdocs/spec/file_set/dir214/class3_8
    +
    +

    +This final section, available using the ?qsc=full + server-status extension, lists all of the information known about each +cache entry. There were as many lines as there are cache entries so +most of them were omitted for brevity. The following information is +printed for each entry, as the list's header notes:

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    serverThe file name and line number where the virtual server was + defined (for lack of better virtual host identification), or main + for the main server.
    URIThe URI for which the response is cached.
    hash-bucketThe ordinal of the bucket into which the URI hashes.
    keep-alive-header-bytesThe number of bytes of HTTP response header cached for a + keep-alive response.
    non-keep-alive-header-bytesThe number of bytes of HTTP response header cached for a + non-keep-alive (i.e., Connection: close) response.
    body-bytesThe number of bytes of HTTP response body.
    file-nameThe name of the cached file, available only when the QSC is + compiled with QSC_DEBUG enabled. Without QSC_DEBUG + n/a is displayed ("not available").
    +

    +Advanced Options

    +

    +All of the following are compile-time options. The first two must be +defined manually. The rest are defined in the QSC source code.

    + + + + + +
    USE_QSC

    + Compiles the QSC into Apache.

    + Default: USE_QSC is not defined so the QSC is + disabled.
    +

    +Debugging / Additional Information

    + + + + + + + + + +
    QSC_DEBUG

    + Enables internal consistency checks.

    +

    + Makes the QSC keep track of the name of the file mapped by the + mmap_static module for each entry. The file name is displayed on the full status page.

    + Default: QSC_DEBUG is not defined so debugging + is disabled.
    QSC_HIST_SIZE

    + Sets the number of hash bucket histogram bins the status page displays.

    + Default: 5.
    +

    +Size Restriction

    + + + + + + + + + +
    QSC_MAX_SIZE

    + Sets the maximum number of bytes of memory the QSC will consume. Note + that this does not include mapped file data.

    + Default: 4194304 (4 MB).
    QSC_HASH_SIZE

    + Sets the number of hash buckets.

    + Default: 128.
    +

    +Header Alignment

    + + + + + + + + + + + + + + + + + +
    QSC_HEADER_GRAIN

    + Sets both the virtual address alignment boundary of cached HTTP + response headers and the number of bytes to which the headers are + padded. For best performance make this equal to the size of the largest + cache line size on the system on which Apache runs. Must be a power of + two. The special value 0 disables alignment and padding.

    + Default: system dependent (typically 32 or 128).
    QSC_GRAIN

    + Sets both the virtual address alignment boundary of internal memory + allocations and the number of bytes to which the allocations are + padded. Must be a power of two at least as large as the larger of a + pointer and a long. Same idea as CLICK_SZ in + Apache's own memory management subsystem.

    + Default: system dependent (typically 4 or 8).
    QSC_MAX_ALLOC

    + Sets the maximum single-allocation size in bytes. Internal memory + allocations larger than this will fail and the request/response will + not be cached.

    + Default: 512.
    QSC_RED_ZONE

    + Sets the number of bytes of safety margin required between the two + internal memory allocation zones. Should be a small multiple of QSC_MAX_ALLOC + for safety.

    + Default: 4096.
    +

    +See also

    +

    +Apache API, mmap_static module, status module, virtual hosts

    +
    +

    +Apache HTTP Server Version 1.3

    +

    +Index

    + + diff -urN apache_1.3.20/htdocs/manual/stopping.html-orig apache_1.3.20/htdocs/manual/stopping.html --- apache_1.3.20/htdocs/manual/stopping.html-orig Tue May 15 11:45:24 2001 +++ apache_1.3.20/htdocs/manual/stopping.html Sat Jun 30 23:53:24 2001 @@ -125,6 +125,11 @@ complete for users on low bandwidth links then you could wait 15 minutes before doing anything with the old log. +

    Supporting graceful restarts slows Apache down somewhat. You can +increase performance by compiling apache with the +NO_GRACEFUL flag, which disables graceful restarts. +USR1 will behave like HUP. +

    Note: If your configuration file has errors in it when you issue a restart then your parent will not restart, it will exit with an error. diff -urN apache_1.3.20/htdocs/sgi_performance.gif.uu-orig apache_1.3.20/htdocs/sgi_performance.gif.uu --- apache_1.3.20/htdocs/sgi_performance.gif.uu-orig Wed Dec 31 19:00:00 1969 +++ apache_1.3.20/htdocs/sgi_performance.gif.uu Sat Jun 30 23:53:24 2001 @@ -0,0 +1,46 @@ +begin 444 sgi_performance.gif +M1TE&.#EA!0%'`,3_``"O3A"T62"Y9#"^;T##>E#(AFG0EW_7IH_ +M:*JN;.N^<"S/=&W?>*[O?.__P*!P2"P:C\BD$PNF\_HM'K-;KO?\+A\3J_;[_B\7@N93"![@6D0%AT=%8""BET/)1,: +MAAH3BY17#Q(5%A6-(A,8AAB3E:-1$16&'1H4)!09&:NDL4T2%Z@:%Q(E$8FR +MO3,/$+LO$,&U'1L6%+R^S#1]%)D5%!++)9?0F9$5NA+=W1$-EQ(1#^#-YPVF +MJ+85YKH5D.L=&,L0%1D8^1D6NQ7^$Q;0-8M0"!6'=?QT%31T,%)"$03E8@SLB*<-)"P%'.ZFN\#&F$9! +M`&"J'`4`KB:I>S>OC0@9.G"XR9"243^#5 +M2^-!063*4DS(C%)TP0RE$Z.&HIKUX\A*8IN8?6-"PPX +M>.Z-$&`*"S`V@/\"QC%(0H+]'2"@"><5F!Z!RI4P6W<)N+>`<2,@4)\)%,3# +MT#XY=<);:"6,!IQ:PM5@0``"U`5``/^)4("-`"`@P@(T\N@`9#P.T,`"-=:% +MXP@#)%G75`G`9:-4/+Z&I(T!C-AD`%..V(!J-OJ8'I=U#6"A"&#:*%>&Q8FP +M99PW4&.D!E!ZI)*8%R"5GI`8HF8"HCC4P +MP`$*["C`CTJR%VL`(UBJ0`*:BL`EKK'^.4*"G3K8`)NKJ7JCKS<&VRG_IL4V +MD*P"#B1Y9Z231INJ"+&*B4($$U1@3"0Y16!49Q'$PGKT8.HQ$'.0EFR`874#"!4@UAT-G0-4"M=%T'))YLRTRC +M;9SA4I,=]6M<*[>``59EJ[;7;W=-0.('U`AB_]E2,]YTR52OG9?B;9=^=LQQ +M2\VE"'B9ZP)UAY``CRT9F"B)"833`#G2>$K=^<##HTGUT8Y#K'*4>*(.HNJR +M%;]\U:Z3K/STG!=_E=N-PXV]9+$*^#$*`*78B4>%BK"0/$"9A52,PGL]N>DG +M'.]T\E>78'7E*N/2?[:6NNY5CS8J`-_IMB>^UY'N3YWK6NPD\R\&-.P$%M`` +M!P3GB)_P1&\HN0`D4%2-^8&":##@7P3U]SC[*4UR_Z,:96(HO09V#FH)S![3 +M",@]O71.@0<OTL7*,3LR5P(` +M%K[^1:UNVI(9#$L'0/]5[<02QJM$<1X`9AF#`'Q;@#4K,89N/1%$%%#"(O5Z` +METX=8$>`9%AC#J":,[X-2,!"VZU`29XQ4DZ&*GM+`100J\@54"]`&J5J4EG* +M`\SH82?@4JV(9`!4U44R:Q1E,4M)KAOY4DTH4,TJ;^0>Z)T1?2:"7U`,Q1L* +M1.";X"SASWJ&BH>D4$IU$8"7%.`D`I`G`*DLP9*:ELX1[6B.5HO5B.")MB<- +M@)=4BU*.KG1,]]1R6BD@5AH-1"8<$>",7!-HU=II4"P1JU8FD!-L4`8!Z@D90P]K(M(.SO&&D,Q&+VLR>0 +M`&^"THUTL0NTJ#V!1E*ACW)V)K6HI:PD;6&!L,(6M>FR@&XUD9O;^O:WP`VN +K<(=+W.(:][C(3:YRE\OZ"MC-KG:WRUT1A```.PVN +` +end diff -urN apache_1.3.20/src/Configuration-orig apache_1.3.20/src/Configuration --- apache_1.3.20/src/Configuration-orig Tue May 15 11:38:59 2001 +++ apache_1.3.20/src/Configuration Sat Jun 30 23:53:24 2001 @@ -124,7 +124,7 @@ # functions. The format is: Rule RULE=value # # At present, only the following RULES are known: WANTHSREGEX, SOCKS4, -# SOCKS5, IRIXNIS, IRIXN32, PARANOID, and DEV_RANDOM. +# SOCKS5, IRIXNIS, IRIXN32, IRIX64, PARANOID, and DEV_RANDOM. # # For all Rules except DEV_RANDOM, if set to "yes", then Configure knows # we want that capability and does what is required to add it in. If set @@ -152,6 +152,10 @@ # If you are running a version of IRIX and Configure detects # n32 libraries, it will use those instead of the o32 ones. # +# IRIX64: +# Build 64-bit (-64) rather than 32-bit (-o32 or -n32). Takes +# precedence over IRIXN32. +# # PARANOID: # New with version 1.3, during Configure modules can run # pre-programmed shell commands in the same environment that @@ -171,6 +175,7 @@ Rule SOCKS5=no Rule IRIXNIS=no Rule IRIXN32=yes +Rule IRIX64=no Rule PARANOID=no Rule EXPAT=default diff -urN apache_1.3.20/src/Configuration.tmpl-orig apache_1.3.20/src/Configuration.tmpl --- apache_1.3.20/src/Configuration.tmpl-orig Sat Aug 14 03:35:43 1999 +++ apache_1.3.20/src/Configuration.tmpl Sat Jun 30 23:53:24 2001 @@ -124,7 +124,7 @@ # functions. The format is: Rule RULE=value # # At present, only the following RULES are known: WANTHSREGEX, SOCKS4, -# SOCKS5, IRIXNIS, IRIXN32, PARANOID, and DEV_RANDOM. +# SOCKS5, IRIXNIS, IRIXN32, IRIX64, PARANOID, and DEV_RANDOM. # # For all Rules except DEV_RANDOM, if set to "yes", then Configure knows # we want that capability and does what is required to add it in. If set @@ -152,6 +152,10 @@ # If you are running a version of IRIX and Configure detects # n32 libraries, it will use those instead of the o32 ones. # +# IRIX64: +# Build 64-bit (-64) rather than 32-bit (-o32 or -n32). Takes +# precedence over IRIXN32. +# # PARANOID: # New with version 1.3, during Configure modules can run # pre-programmed shell commands in the same environment that @@ -171,6 +175,7 @@ Rule SOCKS5=no Rule IRIXNIS=no Rule IRIXN32=yes +Rule IRIX64=no Rule PARANOID=no Rule EXPAT=default diff -urN apache_1.3.20/src/Configure-orig apache_1.3.20/src/Configure --- apache_1.3.20/src/Configure-orig Thu May 10 09:04:16 2001 +++ apache_1.3.20/src/Configure Sat Jun 30 23:53:24 2001 @@ -233,6 +233,7 @@ RULE_SOCKS5=`./helpers/CutRule SOCKS5 $file` RULE_IRIXNIS=`./helpers/CutRule IRIXNIS $file` RULE_IRIXN32=`./helpers/CutRule IRIXN32 $file` +RULE_IRIX64=`./helpers/CutRule IRIX64 $file` RULE_PARANOID=`./helpers/CutRule PARANOID $file` RULE_EXPAT=`./helpers/CutRule EXPAT $file` RULE_SHARED_CORE=`./helpers/CutRule SHARED_CORE $file` @@ -388,50 +389,38 @@ DEF_WANTHSREGEX=yes LIBS="$LIBS -lm" ;; - *-sgi-irix64) - # Note: We'd like to see patches to compile 64-bit, but for now... - echo "You are running 64-bit Irix. For now, we will compile 32-bit" - echo "but if you would care to port to 64-bit, send us the patches." + *-sgi-irix*) DEF_WANTHSREGEX=yes DBM_LIB="" - if [ "x$RULE_IRIXNIS" = "xyes" ]; then - OS='SGI IRIX-64 w/NIS' - CFLAGS="$CFLAGS -DIRIX" - LIBS="$LIBS -lsun" - else - OS='SGI IRIX-64' - CFLAGS="$CFLAGS -DIRIX" - fi - ;; - *-sgi-irix32) - DEF_WANTHSREGEX=yes - DBM_LIB="" - if [ "x$RULE_IRIXN32" = "xyes" ]; then - if [ "x$RULE_IRIXNIS" = "xyes" ]; then - OS='SGI IRIX-32 w/NIS' + IRIXREL=`uname -r` + IRIXNUM=`uname -r | sed 's/^\([0-9]\)\.\([0-9]\).*$/\1\2/'` + CFLAGS="$CFLAGS -DIRIX=$IRIXNUM" + OS="SGI IRIX $IRIXREL ($IRIXNUM)" + case "$PLAT" in + *-sgi-irix64) + if [ "x$RULE_IRIX64" = "xyes" ]; then + OS="$OS, 64-bit ABI" + elif [ "x$RULE_IRIXN32" = "xyes" ]; then + OS="$OS, N32 ABI" else - OS='SGI IRIX-32' + OS="$OS, O32 ABI" fi - else - if [ "x$RULE_IRIXNIS" = "xyes" ]; then - OS='SGI IRIX w/NIS' + CC=cc + ;; + *-sgi-irix32) + if [ "x$RULE_IRIXN32" = "xyes" ]; then + OS="$OS, N32 ABI" else - OS='SGI IRIX' + OS="$OS, O32 ABI" fi - fi - CC='cc' - CFLAGS="$CFLAGS -DIRIX" - ;; - *-sgi-irix) - DEF_WANTHSREGEX=yes - DBM_LIB="" + CC=cc + ;; + esac if [ "x$RULE_IRIXNIS" = "xyes" ]; then - OS='SGI IRIX w/NIS' - CFLAGS="$CFLAGS -DIRIX" - LIBS="$LIBS -lsun" - else - OS='SGI IRIX' - CFLAGS="$CFLAGS -DIRIX" + OS="$OS w/NIS" + case "$PLAT" in + *-sgi-irix) LIBS="$LIBS -lsun" ;; + esac fi ;; *-linux20) @@ -1173,41 +1162,22 @@ LDFLAGS_MOD_SHLIB=$LDFLAGS_SHLIB LDFLAGS_SHLIB_EXPORT="" ;; - *-sgi-irix32) - case $CC in - */gcc|gcc ) - CFLAGS_SHLIB="-fpic" - N32FLAG="" - ;; - */cc|cc ) - CFLAGS_SHLIB="-KPIC" - N32FLAG="-n32" - ;; - esac - if [ "x$RULE_IRIXN32" = "xyes" ]; then - LDFLAGS_SHLIB="$N32FLAG -shared" - else - LDFLAGS_SHLIB="-shared" - fi - LDFLAGS_MOD_SHLIB=$LDFLAGS_SHLIB - LDFLAGS_SHLIB_EXPORT="" - ;; - *-sgi-irix64) + *-sgi-irix32 | *-sgi-irix64) case $CC in */gcc|gcc ) CFLAGS_SHLIB="-fpic" - N32FLAG="" + ABIFLAG="" ;; */cc|cc ) CFLAGS_SHLIB="-KPIC" - N32FLAG="-n32" + case "$OS" in + SGI\ IRIX*64-bit\ ABI*) ABIFLAG="-64" ;; + SGI\ IRIX*N32\ ABI*) ABIFLAG="-n32" ;; + SGI\ IRIX*O32\ ABI*) ABIFLAG="-o32" ;; + esac ;; esac - if [ "x$RULE_IRIXN32" = "xyes" ]; then - LDFLAGS_SHLIB="$N32FLAG -shared" - else - LDFLAGS_SHLIB="-shared" - fi + LDFLAGS_SHLIB="$ABIFLAG -shared" LDFLAGS_MOD_SHLIB=$LDFLAGS_SHLIB LDFLAGS_SHLIB_EXPORT="" ;; @@ -1500,25 +1470,23 @@ ;; esac ;; - *IRIX-64*) - if [ "x$RULE_IRIXN32" = "xyes" ]; then - case "$CC" in - */cc|cc ) - CFLAGS="$CFLAGS -n32" - LDFLAGS="$LDFLAGS -n32" - ;; - esac - fi - ;; - *IRIX-32*) - if [ "x$RULE_IRIXN32" = "xyes" ]; then - case "$CC" in - */cc|cc ) - CFLAGS="$CFLAGS -n32" - LDFLAGS="$LDFLAGS -n32" + SGI\ IRIX*64-bit\ ABI*) + CFLAGS="$CFLAGS -64 -fullwarn" + LDFLAGS="$LDFLAGS -64" + ;; + SGI\ IRIX*N32\ ABI*) + CFLAGS="$CFLAGS -n32 -fullwarn" + LDFLAGS="$LDFLAGS -n32" + ;; + SGI\ IRIX*O32\ ABI*) + CFLAGS="$CFLAGS -o32 -fullwarn" + LDFLAGS="$LDFLAGS -o32" + ;; + Linux) + case $CC in + gcc) CFLAGS="$CFLAGS -Wall" ;; - esac - fi + esac ;; IBM?AIX?4.[123]) case $CC in diff -urN apache_1.3.20/src/Makefile.tmpl-orig apache_1.3.20/src/Makefile.tmpl --- apache_1.3.20/src/Makefile.tmpl-orig Mon Apr 2 04:22:05 2001 +++ apache_1.3.20/src/Makefile.tmpl Sat Jun 30 23:53:24 2001 @@ -125,10 +125,12 @@ # DO NOT REMOVE buildmark.o: buildmark.c include/ap_config.h include/ap_mmn.h \ - include/ap_config_auto.h os/unix/os.h include/ap_ctype.h \ - include/hsregex.h include/httpd.h include/ap_alloc.h include/buff.h \ - include/ap.h include/util_uri.h -modules.o: modules.c include/httpd.h include/ap_config.h \ - include/ap_mmn.h include/ap_config_auto.h os/unix/os.h \ - include/ap_ctype.h include/hsregex.h include/ap_alloc.h include/buff.h \ - include/ap.h include/util_uri.h include/http_config.h + include/ap_config_auto.h os/unix/os.h os/unix/os-inline.c \ + include/ap_ctype.h include/hsregex.h include/httpd.h \ + include/ap_types.h include/ap_alloc.h include/buff.h include/ap.h \ + include/util_uri.h +modules.o: modules.c include/httpd.h include/ap_types.h \ + include/ap_config.h include/ap_mmn.h include/ap_config_auto.h \ + os/unix/os.h os/unix/os-inline.c include/ap_ctype.h include/hsregex.h \ + include/ap_alloc.h include/buff.h include/ap.h include/util_uri.h \ + include/http_config.h diff -urN apache_1.3.20/src/ap/Makefile.tmpl-orig apache_1.3.20/src/ap/Makefile.tmpl --- apache_1.3.20/src/ap/Makefile.tmpl-orig Fri Mar 9 05:10:12 2001 +++ apache_1.3.20/src/ap/Makefile.tmpl Sat Jun 30 23:53:24 2001 @@ -39,40 +39,54 @@ && rm Makefile.new # DO NOT REMOVE -ap_cpystrn.o: ap_cpystrn.c $(INCDIR)/httpd.h $(INCDIR)/ap_config.h \ - $(INCDIR)/ap_mmn.h $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h \ - $(OSDIR)/os-inline.c $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h \ - $(INCDIR)/ap_alloc.h $(INCDIR)/buff.h $(INCDIR)/ap.h \ - $(INCDIR)/util_uri.h -ap_execve.o: ap_execve.c $(INCDIR)/httpd.h $(INCDIR)/ap_config.h \ - $(INCDIR)/ap_mmn.h $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h \ - $(OSDIR)/os-inline.c $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h \ - $(INCDIR)/ap_alloc.h $(INCDIR)/buff.h $(INCDIR)/ap.h \ - $(INCDIR)/util_uri.h +ap_base64.o: ap_base64.c $(INCDIR)/ap_config.h $(INCDIR)/ap_mmn.h \ + $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h $(OSDIR)/os-inline.c \ + $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h $(INCDIR)/ap.h +ap_checkpass.o: ap_checkpass.c $(INCDIR)/httpd.h \ + $(INCDIR)/ap_types.h $(INCDIR)/ap_config.h $(INCDIR)/ap_mmn.h \ + $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h $(OSDIR)/os-inline.c \ + $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h $(INCDIR)/ap_alloc.h \ + $(INCDIR)/buff.h $(INCDIR)/ap.h $(INCDIR)/util_uri.h \ + $(INCDIR)/ap_md5.h $(INCDIR)/ap_sha1.h +ap_cpystrn.o: ap_cpystrn.c $(INCDIR)/httpd.h $(INCDIR)/ap_types.h \ + $(INCDIR)/ap_config.h $(INCDIR)/ap_mmn.h \ + $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h $(OSDIR)/os-inline.c \ + $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h $(INCDIR)/ap_alloc.h \ + $(INCDIR)/buff.h $(INCDIR)/ap.h $(INCDIR)/util_uri.h +ap_execve.o: ap_execve.c $(INCDIR)/httpd.h $(INCDIR)/ap_types.h \ + $(INCDIR)/ap_config.h $(INCDIR)/ap_mmn.h \ + $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h $(OSDIR)/os-inline.c \ + $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h $(INCDIR)/ap_alloc.h \ + $(INCDIR)/buff.h $(INCDIR)/ap.h $(INCDIR)/util_uri.h ap_fnmatch.o: ap_fnmatch.c $(INCDIR)/ap_config.h $(INCDIR)/ap_mmn.h \ $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h $(OSDIR)/os-inline.c \ $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h $(INCDIR)/fnmatch.h ap_getpass.o: ap_getpass.c $(INCDIR)/ap_config.h $(INCDIR)/ap_mmn.h \ $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h $(OSDIR)/os-inline.c \ $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h $(INCDIR)/ap.h -ap_md5c.o: ap_md5c.c $(INCDIR)/ap_config.h $(INCDIR)/ap_mmn.h \ +ap_md5c.o: ap_md5c.c $(INCDIR)/httpd.h $(INCDIR)/ap_types.h \ + $(INCDIR)/ap_config.h $(INCDIR)/ap_mmn.h \ $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h $(OSDIR)/os-inline.c \ - $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h $(INCDIR)/ap_md5.h \ - $(INCDIR)/ap.h -ap_sha1.o: ap_sha1.c $(INCDIR)/ap_config.h $(INCDIR)/ap_sha1.h \ - $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h $(OSDIR)/os-inline.c -ap_signal.o: ap_signal.c $(INCDIR)/httpd.h $(INCDIR)/ap_config.h \ - $(INCDIR)/ap_mmn.h $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h \ - $(OSDIR)/os-inline.c $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h \ - $(INCDIR)/ap_alloc.h $(INCDIR)/buff.h $(INCDIR)/ap.h \ - $(INCDIR)/util_uri.h -ap_slack.o: ap_slack.c $(INCDIR)/httpd.h $(INCDIR)/ap_config.h \ - $(INCDIR)/ap_mmn.h $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h \ - $(OSDIR)/os-inline.c $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h \ - $(INCDIR)/ap_alloc.h $(INCDIR)/buff.h $(INCDIR)/ap.h \ - $(INCDIR)/util_uri.h $(INCDIR)/http_log.h -ap_snprintf.o: ap_snprintf.c $(INCDIR)/httpd.h $(INCDIR)/ap_config.h \ + $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h $(INCDIR)/ap_alloc.h \ + $(INCDIR)/buff.h $(INCDIR)/ap.h $(INCDIR)/util_uri.h \ + $(INCDIR)/ap_md5.h +ap_sha1.o: ap_sha1.c $(INCDIR)/ap_types.h $(INCDIR)/ap_config.h \ $(INCDIR)/ap_mmn.h $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h \ $(OSDIR)/os-inline.c $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h \ - $(INCDIR)/ap_alloc.h $(INCDIR)/buff.h $(INCDIR)/ap.h \ - $(INCDIR)/util_uri.h + $(INCDIR)/ap_sha1.h $(INCDIR)/ap.h +ap_signal.o: ap_signal.c $(INCDIR)/httpd.h $(INCDIR)/ap_types.h \ + $(INCDIR)/ap_config.h $(INCDIR)/ap_mmn.h \ + $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h $(OSDIR)/os-inline.c \ + $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h $(INCDIR)/ap_alloc.h \ + $(INCDIR)/buff.h $(INCDIR)/ap.h $(INCDIR)/util_uri.h +ap_slack.o: ap_slack.c $(INCDIR)/httpd.h $(INCDIR)/ap_types.h \ + $(INCDIR)/ap_config.h $(INCDIR)/ap_mmn.h \ + $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h $(OSDIR)/os-inline.c \ + $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h $(INCDIR)/ap_alloc.h \ + $(INCDIR)/buff.h $(INCDIR)/ap.h $(INCDIR)/util_uri.h \ + $(INCDIR)/http_log.h +ap_snprintf.o: ap_snprintf.c $(INCDIR)/httpd.h $(INCDIR)/ap_types.h \ + $(INCDIR)/ap_config.h $(INCDIR)/ap_mmn.h \ + $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h $(OSDIR)/os-inline.c \ + $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h $(INCDIR)/ap_alloc.h \ + $(INCDIR)/buff.h $(INCDIR)/ap.h $(INCDIR)/util_uri.h diff -urN apache_1.3.20/src/ap/ap_base64.c-orig apache_1.3.20/src/ap/ap_base64.c --- apache_1.3.20/src/ap/ap_base64.c-orig Fri Mar 9 05:10:13 2001 +++ apache_1.3.20/src/ap/ap_base64.c Sat Jun 30 23:53:24 2001 @@ -122,7 +122,7 @@ bufin = (const unsigned char *) bufcoded; while (pr2six[*(bufin++)] <= 63); - nprbytes = (bufin - (const unsigned char *) bufcoded) - 1; + nprbytes = (int) ((bufin - (const unsigned char *) bufcoded) - 1); nbytesdecoded = ((nprbytes + 3) / 4) * 3; return nbytesdecoded + 1; @@ -157,7 +157,7 @@ bufin = (const unsigned char *) bufcoded; while (pr2six[*(bufin++)] <= 63); - nprbytes = (bufin - (const unsigned char *) bufcoded) - 1; + nprbytes = (int) ((bufin - (const unsigned char *) bufcoded) - 1); nbytesdecoded = ((nprbytes + 3) / 4) * 3; bufout = (unsigned char *) bufplain; @@ -269,5 +269,5 @@ } *p++ = '\0'; - return p - encoded; + return (int) (p - encoded); } diff -urN apache_1.3.20/src/ap/ap_checkpass.c-orig apache_1.3.20/src/ap/ap_checkpass.c --- apache_1.3.20/src/ap/ap_checkpass.c-orig Mon Jan 15 12:04:11 2001 +++ apache_1.3.20/src/ap/ap_checkpass.c Sat Jun 30 23:53:24 2001 @@ -63,10 +63,9 @@ */ #include -#include "ap_config.h" +#include "httpd.h" #include "ap_md5.h" #include "ap_sha1.h" -#include "ap.h" #if HAVE_CRYPT_H #include #endif @@ -95,7 +94,7 @@ */ else if (strncmp(hash, AP_SHA1PW_ID, AP_SHA1PW_IDLEN) == 0) { - ap_sha1_base64(passwd, strlen(passwd), sample); + ap_sha1_base64(passwd, ap_strlen(passwd), sample); } else { /* diff -urN apache_1.3.20/src/ap/ap_md5c.c-orig apache_1.3.20/src/ap/ap_md5c.c --- apache_1.3.20/src/ap/ap_md5c.c-orig Fri Mar 9 05:10:14 2001 +++ apache_1.3.20/src/ap/ap_md5c.c Sat Jun 30 23:59:40 2001 @@ -102,12 +102,18 @@ #include +#if 0 #include "ap_config.h" +#else /* 1 */ +#include "httpd.h" +#endif /* 0 */ #include "ap_md5.h" +#if 0 #include "ap.h" #ifdef CHARSET_EBCDIC #include "ap_ebcdic.h" #endif /*CHARSET_EBCDIC*/ +#endif #if HAVE_CRYPT_H #include #endif @@ -417,7 +423,7 @@ * the FreeBSD 3.0 /usr/src/lib/libcrypt/crypt.c file, which is * licenced as stated at the top of this file. */ -API_EXPORT(void) ap_to64(char *s, unsigned long v, int n) +API_EXPORT(void) ap_to64(char *s, ap_uint32 v, int n) { static unsigned char itoa64[] = /* 0 ... 63 => ASCII - 64 */ "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; @@ -446,7 +452,7 @@ int pl; unsigned int pwlen; AP_MD5_CTX ctx, ctx1; - unsigned long l; + ap_uint32 l; /* * Refine the salt first. It's possible we were given an already-hashed @@ -472,14 +478,14 @@ /* * Get the length of the true salt */ - sl = ep - sp; + sl = (int) (ep - sp); /* * 'Time to make the doughnuts..' */ ap_MD5Init(&ctx); - pwlen = strlen((char *)pw); + pwlen = ap_strlen((char *)pw); /* * The password first, since that is what is most unknown */ @@ -493,7 +499,7 @@ /* * Then the raw salt */ - ap_MD5Update(&ctx, sp, sl); + ap_MD5Update(&ctx, (const unsigned char *) sp, sl); /* * Then just as many characters of the MD5(pw, salt, pw) @@ -520,7 +526,7 @@ ap_MD5Update(&ctx, final, 1); } else { - ap_MD5Update(&ctx, pw, 1); + ap_MD5Update(&ctx, (const unsigned char *) pw, 1); } } @@ -549,7 +555,7 @@ ap_MD5Update(&ctx1, final, 16); } if (i % 3) { - ap_MD5Update(&ctx1, sp, sl); + ap_MD5Update(&ctx1, (const unsigned char *) sp, sl); } if (i % 7) { diff -urN apache_1.3.20/src/ap/ap_sha1.c-orig apache_1.3.20/src/ap/ap_sha1.c --- apache_1.3.20/src/ap/ap_sha1.c-orig Fri Mar 9 05:10:15 2001 +++ apache_1.3.20/src/ap/ap_sha1.c Sat Jun 30 23:53:24 2001 @@ -89,6 +89,7 @@ #include +#include "ap_types.h" #include "ap_config.h" #include "ap_sha1.h" #include "ap.h" @@ -109,10 +110,10 @@ #define f4(x,y,z) (x ^ y ^ z) /* SHA constants */ -#define CONST1 0x5a827999L -#define CONST2 0x6ed9eba1L -#define CONST3 0x8f1bbcdcL -#define CONST4 0xca62c1d6L +#define CONST1 ((ap_uint32) 0x5a827999) +#define CONST2 ((ap_uint32) 0x6ed9eba1) +#define CONST3 ((ap_uint32) 0x8f1bbcdc) +#define CONST4 ((ap_uint32) 0xca62c1d6) /* 32-bit rotate */ @@ -188,15 +189,15 @@ } union endianTest { - long Long; - char Char[sizeof(long)]; + ap_uint32 etword; + char etbytes[sizeof(ap_uint32)]; }; static char isLittleEndian(void) { static union endianTest u; - u.Long = 1; - return (u.Char[0] == 1); + u.etword = 1; + return (u.etbytes[0] == 1); } /* change endianness of data */ @@ -228,13 +229,13 @@ API_EXPORT(void) ap_SHA1Init(AP_SHA1_CTX *sha_info) { - sha_info->digest[0] = 0x67452301L; - sha_info->digest[1] = 0xefcdab89L; - sha_info->digest[2] = 0x98badcfeL; - sha_info->digest[3] = 0x10325476L; - sha_info->digest[4] = 0xc3d2e1f0L; - sha_info->count_lo = 0L; - sha_info->count_hi = 0L; + sha_info->digest[0] = (AP_LONG) 0x67452301; + sha_info->digest[1] = (AP_LONG) 0xefcdab89; + sha_info->digest[2] = (AP_LONG) 0x98badcfe; + sha_info->digest[3] = (AP_LONG) 0x10325476; + sha_info->digest[4] = (AP_LONG) 0xc3d2e1f0; + sha_info->count_lo = (AP_LONG) 0; + sha_info->count_hi = (AP_LONG) 0; sha_info->local = 0; } diff -urN apache_1.3.20/src/ap/ap_slack.c-orig apache_1.3.20/src/ap/ap_slack.c --- apache_1.3.20/src/ap/ap_slack.c-orig Mon Jan 15 12:04:14 2001 +++ apache_1.3.20/src/ap/ap_slack.c Sat Jun 30 23:53:24 2001 @@ -68,6 +68,9 @@ #include "http_log.h" #ifndef NO_SLACK +#ifndef HIGH_SLACK_LINE +/*ARGSUSED1*/ +#endif int ap_slack(int fd, int line) { #if !defined(F_DUPFD) diff -urN apache_1.3.20/src/ap/ap_snprintf.c-orig apache_1.3.20/src/ap/ap_snprintf.c --- apache_1.3.20/src/ap/ap_snprintf.c-orig Thu May 10 09:04:22 2001 +++ apache_1.3.20/src/ap/ap_snprintf.c Sat Jun 30 23:53:24 2001 @@ -405,7 +405,7 @@ } while (magnitude); - *len = buf_end - p; + *len = (int) (buf_end - p); return (p); } @@ -461,7 +461,7 @@ } while (magnitude); - *len = buf_end - p; + *len = (int) (buf_end - p); return (p); } @@ -474,15 +474,15 @@ bool_int is_negative; int sub_len; - p = conv_10((addr & 0x000000FF) , TRUE, &is_negative, p, &sub_len); + p = conv_10((wide_int) ((addr & 0x000000FF) ), TRUE, &is_negative, p, &sub_len); *--p = '.'; - p = conv_10((addr & 0x0000FF00) >> 8, TRUE, &is_negative, p, &sub_len); + p = conv_10((wide_int) ((addr & 0x0000FF00) >> 8), TRUE, &is_negative, p, &sub_len); *--p = '.'; - p = conv_10((addr & 0x00FF0000) >> 16, TRUE, &is_negative, p, &sub_len); + p = conv_10((wide_int) ((addr & 0x00FF0000) >> 16), TRUE, &is_negative, p, &sub_len); *--p = '.'; - p = conv_10((addr & 0xFF000000) >> 24, TRUE, &is_negative, p, &sub_len); + p = conv_10((wide_int) ((addr & 0xFF000000) >> 24), TRUE, &is_negative, p, &sub_len); - *len = buf_end - p; + *len = (int) (buf_end - p); return (p); } @@ -498,7 +498,7 @@ *--p = ':'; p = conv_in_addr(&si->sin_addr, p, &sub_len); - *len = buf_end - p; + *len = (int) (buf_end - p); return (p); } @@ -528,7 +528,7 @@ * Check for Infinity and NaN */ if (ap_isalpha(*p)) { - *len = strlen(strcpy(buf, p)); + *len = ap_strlen(strcpy(buf, p)); *is_negative = FALSE; return (buf); } @@ -590,7 +590,7 @@ } } - *len = s - buf; + *len = (int) (s - buf); return (buf); } @@ -623,7 +623,7 @@ } while (num); - *len = buf_end - p; + *len = (int) (buf_end - p); return (p); } @@ -645,7 +645,7 @@ } while (num); - *len = buf_end - p; + *len = (int) (buf_end - p); return (p); } @@ -653,6 +653,7 @@ /* * Do format conversion placing the output in buffer */ +/*PRINTFLIKE3*/ API_EXPORT(int) ap_vformatter(int (*flush_func)(ap_vformatter_buff *), ap_vformatter_buff *vbuff, const char *fmt, va_list ap) { @@ -817,7 +818,7 @@ switch (*fmt) { case 'u': if (var_type == IS_QUAD) { - i_quad = va_arg(ap, u_widest_int); + i_quad = (widest_int) va_arg(ap, u_widest_int); s = conv_10_quad(i_quad, 1, &is_negative, &num_buf[NUM_BUF_SIZE], &s_len); } @@ -915,7 +916,7 @@ case 's': s = va_arg(ap, char *); if (s != NULL) { - s_len = strlen(s); + s_len = ap_strlen(s); if (adjust_precision && precision < s_len) s_len = precision; } @@ -980,7 +981,7 @@ else if (print_blank) prefix_char = ' '; - s_len = strlen(s); + s_len = ap_strlen(s); if (alternate_form && (q = strchr(s, '.')) == NULL) { s[s_len++] = '.'; @@ -1031,6 +1032,10 @@ * don't handle "%p". */ case 'p': +#if defined(IRIX) && _MIPS_SIM != _ABIO32 +/* disable warnings about constant controlling expressions */ +#pragma set woff 1209 +#endif #ifdef AP_VOID_P_IS_QUAD if (sizeof(void *) <= sizeof(u_widest_int)) { ui_quad = (u_widest_int) va_arg(ap, void *); @@ -1044,6 +1049,9 @@ &num_buf[NUM_BUF_SIZE], &s_len); } #endif +#if defined(IRIX) && _MIPS_SIM != _ABIO32 +#pragma reset woff 1209 +#endif else { s = "%p"; s_len = 2; @@ -1162,6 +1170,7 @@ } +/*ARGSUSED0*/ static int snprintf_flush(ap_vformatter_buff *vbuff) { /* if the buffer fills we have to abort immediately, there is no way @@ -1171,6 +1180,7 @@ } +/*PRINTFLIKE3*/ API_EXPORT(int) ap_snprintf(char *buf, size_t len, const char *format,...) { int cc; @@ -1187,10 +1197,11 @@ cc = ap_vformatter(snprintf_flush, &vbuff, format, ap); va_end(ap); *vbuff.curpos = '\0'; - return (cc == -1) ? len : cc; + return (cc == -1) ? (int) len : cc; } +/*PRINTFLIKE3*/ API_EXPORT(int) ap_vsnprintf(char *buf, size_t len, const char *format, va_list ap) { @@ -1205,5 +1216,5 @@ vbuff.endpos = buf + len - 1; cc = ap_vformatter(snprintf_flush, &vbuff, format, ap); *vbuff.curpos = '\0'; - return (cc == -1) ? len : cc; + return (cc == -1) ? (int) len : cc; } diff -urN apache_1.3.20/src/include/ap.h-orig apache_1.3.20/src/include/ap.h --- apache_1.3.20/src/include/ap.h-orig Mon Jan 15 12:04:22 2001 +++ apache_1.3.20/src/include/ap.h Sat Jun 30 23:53:24 2001 @@ -141,6 +141,7 @@ char *endpos; } ap_vformatter_buff; +/*PRINTFLIKE3*/ API_EXPORT(int) ap_vformatter(int (*flush_func)(ap_vformatter_buff *), ap_vformatter_buff *, const char *fmt, va_list ap); @@ -159,8 +160,10 @@ * to distinguish between an output which was truncated, and an output which * exactly filled the buffer. */ +/*PRINTFLIKE3*/ API_EXPORT(int) ap_snprintf(char *buf, size_t len, const char *format,...) __attribute__((format(printf,3,4))); +/*PRINTFLIKE3*/ API_EXPORT(int) ap_vsnprintf(char *buf, size_t len, const char *format, va_list ap); /* Simple BASE64 encode/decode functions. diff -urN apache_1.3.20/src/include/ap_alloc.h-orig apache_1.3.20/src/include/ap_alloc.h --- apache_1.3.20/src/include/ap_alloc.h-orig Sat Feb 3 15:14:49 2001 +++ apache_1.3.20/src/include/ap_alloc.h Sat Jun 30 23:53:24 2001 @@ -157,14 +157,16 @@ /* routines to allocate memory from an pool... */ -API_EXPORT(void *) ap_palloc(struct pool *, int nbytes); -API_EXPORT(void *) ap_pcalloc(struct pool *, int nbytes); +API_EXPORT(void *) ap_palloc(struct pool *, size_t nbytes); +API_EXPORT(void *) ap_pcalloc(struct pool *, size_t nbytes); API_EXPORT(char *) ap_pstrdup(struct pool *, const char *s); /* make a nul terminated copy of the n characters starting with s */ -API_EXPORT(char *) ap_pstrndup(struct pool *, const char *s, int n); +API_EXPORT(char *) ap_pstrndup(struct pool *, const char *s, size_t n); API_EXPORT_NONSTD(char *) ap_pstrcat(struct pool *,...); /* all '...' must be char* */ +/*PRINTFLIKE2*/ API_EXPORT_NONSTD(char *) ap_psprintf(struct pool *, const char *fmt, ...) __attribute__((format(printf,2,3))); +/*PRINTFLIKE2*/ API_EXPORT(char *) ap_pvsprintf(struct pool *, const char *fmt, va_list); /* array and alist management... keeping lists of things. @@ -328,7 +330,7 @@ API_EXPORT(FILE *) ap_pfopen(struct pool *, const char *name, const char *fmode); API_EXPORT(FILE *) ap_pfdopen(struct pool *, int fd, const char *fmode); -API_EXPORT(int) ap_popenf(struct pool *, const char *name, int flg, int mode); +API_EXPORT(int) ap_popenf(struct pool *, const char *name, int flg, mode_t mode); API_EXPORT(void) ap_note_cleanups_for_file(pool *, FILE *); API_EXPORT(void) ap_note_cleanups_for_fd(pool *, int); @@ -397,8 +399,8 @@ /* Finally, some accounting */ -API_EXPORT(long) ap_bytes_in_pool(pool *p); -API_EXPORT(long) ap_bytes_in_free_blocks(void); +API_EXPORT(ap_int32) ap_bytes_in_pool(pool *p); +API_EXPORT(ap_int32) ap_bytes_in_free_blocks(void); #ifdef __cplusplus } diff -urN apache_1.3.20/src/include/ap_config.h-orig apache_1.3.20/src/include/ap_config.h --- apache_1.3.20/src/include/ap_config.h-orig Thu Apr 5 22:13:11 2001 +++ apache_1.3.20/src/include/ap_config.h Sat Jun 30 23:53:24 2001 @@ -98,8 +98,11 @@ * on, but it doesn't implement half of the things that __GNUC__ * means. In particular it's missing inline and the __attribute__ * stuff. So we hack around it. PR#1613. -djg + * + * Irix MIPSpro compilers support __inline__ but the ucode compilers don't. */ -#if !defined(__GNUC__) || __GNUC__ < 2 || \ +#if (!defined(IRIX) || _MIPS_SIM == _ABIO32) &&\ + !defined(__GNUC__) || __GNUC__ < 2 || \ (__GNUC__ == 2 && __GNUC_MINOR__ < 7) ||\ defined(NEXT) #define ap_inline @@ -197,18 +200,24 @@ * there's some weird conflict with non-BSD signals */ #define NO_KILLPG #undef NO_SETSID -#if !defined(USE_FLOCK_SERIALIZED_ACCEPT) && \ - !defined(USE_USLOCK_SERIALIZED_ACCEPT) && \ - !defined(USE_SYSVSEM_SERIALIZED_ACCEPT) +#undef USE_FCNTL_SERIALIZED_ACCEPT +#undef USE_FLOCK_SERIALIZED_ACCEPT +#undef USE_USLOCK_SERIALIZED_ACCEPT +#undef USE_SYSVSEM_SERIALIZED_ACCEPT +#if IRIX >= 65 +#define NO_SERIALIZED_ACCEPT +#else #define USE_FCNTL_SERIALIZED_ACCEPT #endif +#define SINGLE_LISTEN_UNSERIALIZED_ACCEPT #define HAVE_SHMGET 1 -#define USE_SHMGET_SCOREBOARD +#define USE_MMAP_SCOREBOARD #define HAVE_MMAP 1 #define USE_MMAP_FILES #define NO_LONG_DOUBLE #define NO_LINGCLOSE #define HAVE_SYSLOG 1 +#define CACHE_ALIGNMENT 128 /* best value for most SGI servers */ #elif defined(HIUX) #undef HAVE_GMTOFF @@ -975,6 +984,10 @@ #include #endif /* HAVE_SYS_PARAM_H */ +#if defined(FAST_TIME) && defined(NO_OTHER_CHILD) +# error "FAST_TIME requires other-child support" +#endif + /* stuff marked API_EXPORT is part of the API, and intended for use * by modules */ @@ -1130,7 +1143,7 @@ int setrlimit(int, struct rlimit *); #endif #endif -#ifdef USE_MMAP_SCOREBOARD +#ifdef HAVE_MMAP #if !defined(OS2) && !defined(WIN32) /* This file is not needed for OS/2 */ #include @@ -1140,6 +1153,12 @@ #define MAP_ANON MAP_ANONYMOUS #endif +#ifdef HAVE_SHMGET +#include +#include +#include +#endif + #if defined(USE_MMAP_FILES) && (defined(NO_MMAP) || !defined(HAVE_MMAP)) #undef USE_MMAP_FILES #endif @@ -1169,7 +1188,7 @@ #endif #ifndef INADDR_NONE -#define INADDR_NONE ((unsigned long) -1) +#define INADDR_NONE ((ap_uint32) -1) #endif /* @@ -1243,7 +1262,7 @@ #endif #ifndef ap_inet_addr -#define ap_inet_addr inet_addr +#define ap_inet_addr(str) ((ap_uint32) inet_addr(str)) #endif #ifdef NO_OTHER_CHILD @@ -1323,6 +1342,30 @@ */ #if defined(__WCOREDUMP) && !defined(WCOREDUMP) #define WCOREDUMP __WCOREDUMP +#endif + +/* + * Maximum number of bytes to write from an mmap'ed region per write(). + * See ap_send_mmap() and qsc_process_request(). + */ +#ifndef MMAP_SEGMENT_SIZE +#define MMAP_SEGMENT_SIZE 32768 +#endif + +/* + * Aligning the address and length of certain key data structures and + * buffers to exactly match cache lines can dramatically increase + * performance. In the absence of an architecture-specific + * CACHE_ALIGNMENT definition from above, assume this arbitrary default. + * Set to 0 to disable alignment. When adding your own specific version + * above, use the larger of your processor's primary and secondary cache + * line sizes. + */ +#ifndef CACHE_ALIGNMENT +#define CACHE_ALIGNMENT 32 /* in bytes */ +#endif +#if CACHE_ALIGNMENT & (CACHE_ALIGNMENT - 1) +#error "CACHE_ALIGNMENT must be a power of two" #endif #ifdef SUNOS_LIB_PROTOTYPES diff -urN apache_1.3.20/src/include/ap_md5.h-orig apache_1.3.20/src/include/ap_md5.h --- apache_1.3.20/src/include/ap_md5.h-orig Mon Jan 15 12:04:28 2001 +++ apache_1.3.20/src/include/ap_md5.h Sat Jun 30 23:53:24 2001 @@ -122,7 +122,7 @@ API_EXPORT(void) ap_MD5Encode(const unsigned char *password, const unsigned char *salt, char *result, size_t nbytes); -API_EXPORT(void) ap_to64(char *s, unsigned long v, int n); +API_EXPORT(void) ap_to64(char *s, ap_uint32 v, int n); #ifdef __cplusplus } diff -urN apache_1.3.20/src/include/ap_mmn.h-orig apache_1.3.20/src/include/ap_mmn.h --- apache_1.3.20/src/include/ap_mmn.h-orig Mon Jan 15 12:04:28 2001 +++ apache_1.3.20/src/include/ap_mmn.h Sat Jun 30 23:53:24 2001 @@ -233,7 +233,7 @@ * 19990320.10 - add ap_is_rdirectory() and ap_stripprefix() */ -#define MODULE_MAGIC_COOKIE 0x41503133UL /* "AP13" */ +#define MODULE_MAGIC_COOKIE ((ap_uint32) 0x41503133) /* "AP13" */ #ifndef MODULE_MAGIC_NUMBER_MAJOR #define MODULE_MAGIC_NUMBER_MAJOR 19990320 diff -urN apache_1.3.20/src/include/ap_sha1.h-orig apache_1.3.20/src/include/ap_sha1.h --- apache_1.3.20/src/include/ap_sha1.h-orig Mon Jan 15 12:04:29 2001 +++ apache_1.3.20/src/include/ap_sha1.h Sat Jun 30 23:53:24 2001 @@ -80,7 +80,7 @@ #define AP_SHA1PW_ID "{SHA}" #define AP_SHA1PW_IDLEN 5 -typedef unsigned long AP_LONG; /* a 32-bit quantity */ +typedef ap_uint32 AP_LONG; /* a 32-bit quantity */ typedef struct { AP_LONG digest[5]; /* message digest */ diff -urN apache_1.3.20/src/include/ap_types.h-orig apache_1.3.20/src/include/ap_types.h --- apache_1.3.20/src/include/ap_types.h-orig Wed Dec 31 19:00:00 1969 +++ apache_1.3.20/src/include/ap_types.h Sat Jun 30 23:53:24 2001 @@ -0,0 +1,29 @@ +#ifndef APACHE_TYPES_H +#define APACHE_TYPES_H + +/* + * Define standard-sized types. + * ap_int32 signed 32-bit integer + * ap_uint32 unsigned 32-bit integer + * ap_ptr unsigned pointer-sized integer + * ap_atomic unsigned atomically-updatable integer (>= ap_ptr) + */ + +#ifdef IRIX +/* + * Irix uses an ILP32 model in 32-bit mode (ints, longs, and pointers + * are all 32 bits) and an LP64 model in 64-bit mode (ints are 32 bits, + * longs and pointers are 64 bits) so the following are always correct. + */ +typedef int ap_int32; +typedef unsigned int ap_uint32; +typedef unsigned long ap_ptr; +typedef unsigned long ap_atomic; +#else +typedef long ap_int32; +typedef unsigned long ap_uint32; +typedef unsigned long ap_ptr; +typedef unsigned long ap_atomic; +#endif + +#endif diff -urN apache_1.3.20/src/include/buff.h-orig apache_1.3.20/src/include/buff.h --- apache_1.3.20/src/include/buff.h-orig Mon Jan 15 12:04:30 2001 +++ apache_1.3.20/src/include/buff.h Sat Jun 30 23:53:24 2001 @@ -59,6 +59,16 @@ #ifndef APACHE_BUFF_H #define APACHE_BUFF_H +#include +#ifdef NO_WRITEV +struct iovec { + void *iov_base; + size_t iov_len; +}; +#else +#include +#endif + #ifdef __cplusplus extern "C" { #endif @@ -111,7 +121,7 @@ int bufsiz; void (*error) (BUFF *fb, int op, void *data); void *error_data; - long int bytes_sent; /* number of bytes actually written */ + ap_int32 bytes_sent; /* number of bytes actually written */ ap_pool *pool; @@ -166,11 +176,14 @@ API_EXPORT(int) ap_blookc(char *buff, BUFF *fb); API_EXPORT(int) ap_bskiplf(BUFF *fb); API_EXPORT(int) ap_bwrite(BUFF *fb, const void *buf, int nbyte); +API_EXPORT(int) ap_bwritev(BUFF *fb, struct iovec *, int); API_EXPORT(int) ap_bflush(BUFF *fb); API_EXPORT(int) ap_bputs(const char *x, BUFF *fb); API_EXPORT(int) ap_bvputs(BUFF *fb,...); +/*PRINTFLIKE2*/ API_EXPORT_NONSTD(int) ap_bprintf(BUFF *fb, const char *fmt,...) __attribute__((format(printf,2,3))); +/*PRINTFLIKE2*/ API_EXPORT(int) ap_vbprintf(BUFF *fb, const char *fmt, va_list vlist); /* Internal routines */ diff -urN apache_1.3.20/src/include/hsregex.h-orig apache_1.3.20/src/include/hsregex.h --- apache_1.3.20/src/include/hsregex.h-orig Mon Sep 25 18:48:24 2000 +++ apache_1.3.20/src/include/hsregex.h Sun Jul 1 00:56:32 2001 @@ -16,12 +16,10 @@ #endif #endif -#ifndef ap_private_extern -#if defined(DARWIN) +#if defined(MAC_OS) || defined(MAC_OS_X_SERVER) #define ap_private_extern __private_extern__ #else #define ap_private_extern -#endif #endif typedef off_t regoff_t; diff -urN apache_1.3.20/src/include/http_conf_globals.h-orig apache_1.3.20/src/include/http_conf_globals.h --- apache_1.3.20/src/include/http_conf_globals.h-orig Mon Jan 15 12:04:31 2001 +++ apache_1.3.20/src/include/http_conf_globals.h Sat Jun 30 23:53:24 2001 @@ -92,6 +92,13 @@ extern int ap_listenbacklog; extern int ap_dump_settings; extern API_VAR_EXPORT int ap_extended_status; +#ifdef USE_QSC +extern int ap_qsc_enabled; +#endif + +#ifdef SINGLE_LISTEN_UNSERIALIZED_ACCEPT +extern int ap_single_listen; +#endif extern API_VAR_EXPORT char *ap_pid_fname; extern API_VAR_EXPORT char *ap_scoreboard_fname; diff -urN apache_1.3.20/src/include/http_config.h-orig apache_1.3.20/src/include/http_config.h --- apache_1.3.20/src/include/http_config.h-orig Mon Jan 15 12:04:32 2001 +++ apache_1.3.20/src/include/http_config.h Sat Jun 30 23:53:25 2001 @@ -205,7 +205,7 @@ struct module_struct *next; - unsigned long magic; /* Magic Cookie to identify a module structure; + ap_uint32 magic; /* Magic Cookie to identify a module structure; * It's mainly important for the DSO facility * (see also mod_so). */ diff -urN apache_1.3.20/src/include/http_core.h-orig apache_1.3.20/src/include/http_core.h --- apache_1.3.20/src/include/http_core.h-orig Fri Mar 9 05:10:20 2001 +++ apache_1.3.20/src/include/http_core.h Sat Jun 30 23:53:25 2001 @@ -132,7 +132,7 @@ API_EXPORT(char *) ap_construct_url(pool *p, const char *uri, request_rec *r); API_EXPORT(const char *) ap_get_server_name(request_rec *r); API_EXPORT(unsigned) ap_get_server_port(const request_rec *r); -API_EXPORT(unsigned long) ap_get_limit_req_body(const request_rec *r); +API_EXPORT(ap_uint32) ap_get_limit_req_body(const request_rec *r); API_EXPORT(void) ap_custom_response(request_rec *r, int status, char *string); API_EXPORT(int) ap_exists_config_define(char *name); @@ -263,7 +263,7 @@ #ifdef RLIMIT_NPROC struct rlimit *limit_nproc; #endif - unsigned long limit_req_body; /* limit on bytes in request msg body */ + ap_uint32 limit_req_body; /* limit on bytes in request msg body */ /* logging options */ enum { srv_sig_unset, srv_sig_off, srv_sig_on, diff -urN apache_1.3.20/src/include/http_log.h-orig apache_1.3.20/src/include/http_log.h --- apache_1.3.20/src/include/http_log.h-orig Mon Jan 15 12:04:33 2001 +++ apache_1.3.20/src/include/http_log.h Sat Jun 30 23:53:25 2001 @@ -115,9 +115,11 @@ * attack and other messy behavior. Instead, use a simple format string * like "%s", followed by the string containing the untrusted data. */ +/*PRINTFLIKE5*/ API_EXPORT(void) ap_log_error(const char *file, int line, int level, const server_rec *s, const char *fmt, ...) __attribute__((format(printf,5,6))); +/*PRINTFLIKE5*/ API_EXPORT(void) ap_log_rerror(const char *file, int line, int level, const request_rec *s, const char *fmt, ...) __attribute__((format(printf,5,6))); @@ -130,6 +132,7 @@ API_EXPORT(void) ap_log_error_old(const char *err, server_rec *s); API_EXPORT(void) ap_log_unixerr(const char *routine, const char *file, const char *msg, server_rec *s); +/*PRINTFLIKE2*/ API_EXPORT(void) ap_log_printf(const server_rec *s, const char *fmt, ...) __attribute__((format(printf,2,3))); API_EXPORT(void) ap_log_reason(const char *reason, const char *fname, diff -urN apache_1.3.20/src/include/http_main.h-orig apache_1.3.20/src/include/http_main.h --- apache_1.3.20/src/include/http_main.h-orig Mon Jan 15 12:04:34 2001 +++ apache_1.3.20/src/include/http_main.h Sat Jun 30 23:53:25 2001 @@ -130,6 +130,13 @@ void setup_signal_names(char *prefix); +#ifdef HAVE_MMAP +API_EXPORT(caddr_t) ap_map_anonymous(pool *p, caddr_t addr, size_t size); +#endif +#ifdef HAVE_SHMGET +API_EXPORT(caddr_t) ap_share_anonymous(pool *p, caddr_t addr, size_t size); +#endif + #ifndef NO_OTHER_CHILD /* * register an other_child -- a child which the main loop keeps track of diff -urN apache_1.3.20/src/include/http_protocol.h-orig apache_1.3.20/src/include/http_protocol.h --- apache_1.3.20/src/include/http_protocol.h-orig Mon Jan 15 12:04:35 2001 +++ apache_1.3.20/src/include/http_protocol.h Sat Jun 30 23:53:25 2001 @@ -83,10 +83,12 @@ * ap_send_http_header(). */ API_EXPORT(void) ap_basic_http_header(request_rec *r); +API_EXPORT(void) ap_tee_basic_http_header(request_rec *r, char *, size_t *); /* Send the Status-Line and header fields for HTTP response */ API_EXPORT(void) ap_send_http_header(request_rec *l); +API_EXPORT(void) ap_tee_http_header(request_rec *l, char *, size_t *); /* Send the response to special method requests */ @@ -113,7 +115,7 @@ * permit_cache argument is set to one). */ -API_EXPORT(int) ap_set_content_length(request_rec *r, long length); +API_EXPORT(int) ap_set_content_length(request_rec *r, ap_int32 length); API_EXPORT(int) ap_set_keepalive(request_rec *r); API_EXPORT(time_t) ap_rationalize_mtime(request_rec *r, time_t mtime); API_EXPORT(char *) ap_make_etag(request_rec *r, int force_weak); @@ -132,15 +134,20 @@ * (Ditto the send_header stuff). */ -API_EXPORT(long) ap_send_fd(FILE *f, request_rec *r); -API_EXPORT(long) ap_send_fd_length(FILE *f, request_rec *r, long length); +API_EXPORT(ap_int32) ap_send_fd(FILE *f, request_rec *r); +API_EXPORT(ap_int32) ap_send_fd_length(FILE *f, request_rec *r, ap_int32 length); +#ifdef USE_DIRECT_IO +API_EXPORT(ap_int32) ap_send_fd_direct(FILE *f, request_rec *r, const struct dioattr *da); +#endif -API_EXPORT(long) ap_send_fb(BUFF *f, request_rec *r); -API_EXPORT(long) ap_send_fb_length(BUFF *f, request_rec *r, long length); +API_EXPORT(ap_int32) ap_send_fb(BUFF *f, request_rec *r); +API_EXPORT(ap_int32) ap_send_fb_length(BUFF *f, request_rec *r, ap_int32 length); API_EXPORT(size_t) ap_send_mmap(void *mm, request_rec *r, size_t offset, size_t length); +API_EXPORT(size_t) ap_send_iovec(request_rec *, struct iovec *, int); + /* Hmmm... could macrofy these for now, and maybe forever, though the * definitions of the macros would get a whole lot hairier. */ @@ -149,7 +156,9 @@ API_EXPORT(int) ap_rputs(const char *str, request_rec *r); API_EXPORT(int) ap_rwrite(const void *buf, int nbyte, request_rec *r); API_EXPORT_NONSTD(int) ap_rvputs(request_rec *r,...); +/*PRINTFLIKE2*/ API_EXPORT(int) ap_vrprintf(request_rec *r, const char *fmt, va_list vlist); +/*PRINTFLIKE2*/ API_EXPORT_NONSTD(int) ap_rprintf(request_rec *r, const char *fmt,...) __attribute__((format(printf,2,3))); API_EXPORT(int) ap_rflush(request_rec *r); @@ -165,13 +174,13 @@ API_EXPORT(int) ap_setup_client_block(request_rec *r, int read_policy); API_EXPORT(int) ap_should_client_block(request_rec *r); -API_EXPORT(long) ap_get_client_block(request_rec *r, char *buffer, int bufsiz); +API_EXPORT(ap_int32) ap_get_client_block(request_rec *r, char *buffer, int bufsiz); API_EXPORT(int) ap_discard_request_body(request_rec *r); /* Sending a byterange */ API_EXPORT(int) ap_set_byterange(request_rec *r); -API_EXPORT(int) ap_each_byterange(request_rec *r, long *offset, long *length); +API_EXPORT(int) ap_each_byterange(request_rec *r, ap_int32 *offset, ap_int32 *length); /* Support for the Basic authentication protocol. Note that there's * nothing that prevents these from being in mod_auth.c, except that other diff -urN apache_1.3.20/src/include/httpd.h-orig apache_1.3.20/src/include/httpd.h --- apache_1.3.20/src/include/httpd.h-orig Tue May 15 10:58:46 2001 +++ apache_1.3.20/src/include/httpd.h Sat Jun 30 23:53:25 2001 @@ -67,8 +67,22 @@ * httpd.h: header for simple (ha! not anymore) http daemon */ +/* + * Mike Abbott - mja@sgi.com + * Accelerating Apache Project - http://oss.sgi.com/projects/apache/ + */ +#ifdef SPEED_DAEMON /* that's me, a real speed demon */ +# define USE_QSC /* enable the Quick Shortcut Cache */ +# define FAST_TIME /* eliminate redundant calls to time() */ +# define BUFFERED_LOGS /* buffer log messages */ +# define NO_GRACEFUL /* eliminate per-request signal manipulation */ +# define USE_QUICK_LOG /* fast path through logging code */ +# define USE_STAT_CACHE /* cache of recent stat() results */ +#endif + /* Headers in which EVERYONE has an interest... */ +#include "ap_types.h" #include "ap_config.h" #include "ap_alloc.h" #include "buff.h" @@ -702,6 +716,7 @@ */ char *the_request; /* First line of request, so we can log it */ + int the_request_len; /* strlen(the_request) */ int assbackwards; /* HTTP/0.9, "simple" request */ enum proxyreqtype proxyreq;/* A proxy request (calculated during * post_read_request or translate_name) */ @@ -745,7 +760,7 @@ int allowed; /* Allowed methods - for 405, OPTIONS, etc */ int sent_bodyct; /* byte count in stream is for body */ - long bytes_sent; /* body byte count, for easy access */ + ap_int32 bytes_sent; /* body byte count, for easy access */ time_t mtime; /* Time the resource was last modified */ /* HTTP/1.1 connection-level features */ @@ -754,10 +769,10 @@ int byterange; /* number of byte ranges */ char *boundary; /* multipart/byteranges boundary */ const char *range; /* The Range: header */ - long clength; /* The "real" content length */ + ap_int32 clength; /* The "real" content length */ - long remaining; /* bytes left to read */ - long read_length; /* bytes that have been read */ + ap_int32 remaining; /* bytes left to read */ + ap_int32 read_length; /* bytes that have been read */ int read_body; /* how the request body should be read */ int read_chunked; /* reading chunked transfer-coding */ unsigned expecting_100; /* is client waiting for a 100 response? */ @@ -851,6 +866,10 @@ * record to improve 64bit alignment the next time we need to break * binary compatibility for some other reason. */ + + char *rqbuf; /* quickly_read_request_line()'s buffer */ + char *rqhdr; /* quickly_get_mime_headers()'s headers */ + int rqhdr_len; /* strlen(rqhdr) */ }; @@ -873,7 +892,8 @@ struct sockaddr_in local_addr; /* local address */ struct sockaddr_in remote_addr; /* remote address */ - char *remote_ip; /* Client's IP address */ + char remote_ip[16]; /* Client's IP address */ + int remote_ip_len; /* strlen(remote_ip) */ char *remote_host; /* Client's DNS name, if known. * NULL if DNS hasn't been checked, * "" if it has and no address was found. @@ -895,7 +915,8 @@ signed int double_reverse:2;/* have we done double-reverse DNS? * -1 yes/failure, 0 not yet, 1 yes/success */ int keepalives; /* How many times have we used it? */ - char *local_ip; /* server IP address */ + char local_ip[16]; /* server IP address */ + int local_ip_len; /* strlen(local_ip) */ char *local_host; /* used for ap_get_server_name when * UseCanonicalName is set to DNS * (ignores setting of HostnameLookups) */ @@ -906,7 +927,7 @@ /* The address 255.255.255.255, when used as a virtualhost address, * will become the "default" server when the ip doesn't match other vhosts. */ -#define DEFAULT_VHOST_ADDR 0xfffffffful +#define DEFAULT_VHOST_ADDR ((ap_uint32) 0xffffffff) typedef struct server_addr_rec server_addr_rec; struct server_addr_rec { @@ -979,6 +1000,10 @@ struct sockaddr_in local_addr; /* local IP address and port */ int fd; int used; /* Only used during restart */ + int unique; /* is local_addr unique (not wild)? */ +#ifdef SINGLE_LISTEN_UNSERIALIZED_ACCEPT + int cpu; /* if ap_single_listen, cpu to bind to */ +#endif /* more stuff here, like which protocol is bound to the port */ }; @@ -991,10 +1016,12 @@ extern API_VAR_EXPORT const char ap_month_snames[12][4]; extern API_VAR_EXPORT const char ap_day_snames[7][4]; +API_EXPORT(time_t) ap_time(void); API_EXPORT(struct tm *) ap_get_gmtoff(int *tz); API_EXPORT(char *) ap_get_time(void); API_EXPORT(char *) ap_field_noparam(pool *p, const char *intype); API_EXPORT(char *) ap_ht_time(pool *p, time_t t, const char *fmt, int gmt); +API_EXPORT(int) ap_gm_timestr_822_buf(char *buf, size_t size, time_t t); API_EXPORT(char *) ap_gm_timestr_822(pool *p, time_t t); /* String handling. The *_nc variants allow you to use non-const char **s as @@ -1067,6 +1094,10 @@ API_EXPORT(char *) ap_escape_quotes (pool *p, const char *instring); API_EXPORT(void) ap_remove_spaces(char *dest, char *src); +API_EXPORT(char *) ap_inet_ntoa(struct in_addr, char * /* 16 bytes */, int *); +API_EXPORT(int) ap_oversized_file(off_t); +API_EXPORT(int) ap_stat_cache(const char *, struct stat *); + /* Common structure for reading of config files / passwd files etc. */ typedef struct { int (*getch) (void *param); /* a getc()-like function */ @@ -1136,7 +1167,7 @@ #endif /*#ifdef CHARSET_EBCDIC*/ char *ap_get_local_host(pool *); -unsigned long ap_get_virthost_addr(char *hostname, unsigned short *port); +ap_uint32 ap_get_virthost_addr(char *hostname, unsigned short *port); extern API_VAR_EXPORT time_t ap_restart_time; @@ -1216,6 +1247,22 @@ #undef strtoul #endif #define strtoul strtoul_is_not_a_portable_function_use_strtol_instead + +#ifdef USE_QSC +/* QSC - Quick Shortcut Cache */ +extern void qsc_init(pool *); +extern int qsc_process_request(request_rec *); +extern void qsc_insert_request(request_rec *, const char *, size_t, void *, + size_t, const char *, const char *); +extern void qsc_status(request_rec *, const char *); +#endif + +/* + * 64-bit porting aides. On 64-bit Irix, strlen() returns size_t which + * is 64 bits, generating many warnings when assigned to 32-bit objects. + */ +#define ap_strlen(str) ((int) strlen(str)) +#define ap_atol(str) ((ap_int32) atol(str)) #ifdef __cplusplus } diff -urN apache_1.3.20/src/include/scoreboard.h-orig apache_1.3.20/src/include/scoreboard.h --- apache_1.3.20/src/include/scoreboard.h-orig Mon Jan 15 12:04:39 2001 +++ apache_1.3.20/src/include/scoreboard.h Sat Jun 30 23:53:25 2001 @@ -161,11 +161,24 @@ char request[64]; /* We just want an idea... */ server_rec *vhostrec; /* What virtual host is being accessed? */ /* SEE ABOVE FOR SAFE USAGE! */ +#ifdef SINGLE_LISTEN_UNSERIALIZED_ACCEPT + int cpu; /* cpu to which it is bound */ + struct sockaddr_in single_addr; /* if ap_single_listen, listen addr */ +#endif +#ifdef USE_QSC + ap_atomic qsc_nucreq; /* uncachable requests */ + ap_atomic qsc_nucres; /* uncachable responses */ + ap_atomic qsc_nhits; /* successful qsc lookups */ + ap_atomic qsc_nmisses; /* unsuccessful qsc lookups */ +#endif } short_score; typedef struct { ap_generation_t running_generation; /* the generation of children which * should still be serving requests. */ +#ifdef FAST_TIME + time_t time; /* time of day from time() */ +#endif } global_score; /* stuff which the parent generally writes and the children rarely read */ diff -urN apache_1.3.20/src/lib/expat-lite/xmldef.h-orig apache_1.3.20/src/lib/expat-lite/xmldef.h --- apache_1.3.20/src/lib/expat-lite/xmldef.h-orig Wed Jun 9 05:45:03 1999 +++ apache_1.3.20/src/lib/expat-lite/xmldef.h Sat Jun 30 23:53:25 2001 @@ -64,6 +64,7 @@ #ifdef APACHE +#include "ap_types.h" #include "ap_config.h" #define XML_BYTE_ORDER AP_BYTE_ORDER diff -urN apache_1.3.20/src/lib/expat-lite/xmlparse.c-orig apache_1.3.20/src/lib/expat-lite/xmlparse.c --- apache_1.3.20/src/lib/expat-lite/xmlparse.c-orig Wed Mar 1 04:13:36 2000 +++ apache_1.3.20/src/lib/expat-lite/xmlparse.c Sat Jun 30 23:53:25 2001 @@ -31,13 +31,18 @@ #include "xmldef.h" #include "xmlparse.h" +#if defined(IRIX) && _MIPS_SIM != _ABIO32 +/* disable warnings about unused formal parameters */ +#pragma set woff 1174 +#endif + #ifdef XML_UNICODE #define XML_ENCODE_MAX XML_UTF16_ENCODE_MAX #define XmlConvert XmlUtf16Convert #define XmlGetInternalEncoding XmlGetUtf16InternalEncoding #define XmlGetInternalEncodingNS XmlGetUtf16InternalEncodingNS #define XmlEncode XmlUtf16Encode -#define MUST_CONVERT(enc, s) (!(enc)->isUtf16 || (((unsigned long)s) & 1)) +#define MUST_CONVERT(enc, s) (!(enc)->isUtf16 || (((ap_uint32)s) & 1)) typedef unsigned short ICHAR; #else #define XML_ENCODE_MAX XML_UTF8_ENCODE_MAX @@ -273,7 +278,7 @@ char *m_bufferEnd; /* allocated end of buffer */ const char *m_bufferLim; - long m_parseEndByteIndex; + ap_int32 m_parseEndByteIndex; const char *m_parseEndPtr; XML_Char *m_dataBuf; XML_Char *m_dataBufEnd; @@ -786,7 +791,7 @@ return 0; } XmlUpdatePosition(encoding, positionPtr, end, &position); - nLeftOver = s + len - end; + nLeftOver = (int) (s + len - end); if (nLeftOver) { if (buffer == 0 || nLeftOver > bufferLim - buffer) { /* FIXME avoid integer overflow */ @@ -833,7 +838,7 @@ { if (len > bufferLim - bufferEnd) { /* FIXME avoid integer overflow */ - int neededSize = len + (bufferEnd - bufferPtr); + int neededSize = len + (int) (bufferEnd - bufferPtr); if (neededSize <= bufferLim - buffer) { memmove(buffer, bufferPtr, bufferEnd - bufferPtr); bufferEnd = buffer + (bufferEnd - bufferPtr); @@ -841,7 +846,7 @@ } else { char *newBuf; - int bufferSize = bufferLim - bufferPtr; + int bufferSize = (int) (bufferLim - bufferPtr); if (bufferSize == 0) bufferSize = INIT_BUFFER_SIZE; do { @@ -869,17 +874,17 @@ return errorCode; } -long XML_GetCurrentByteIndex(XML_Parser parser) +ap_int32 XML_GetCurrentByteIndex(XML_Parser parser) { if (eventPtr) - return parseEndByteIndex - (parseEndPtr - eventPtr); + return (ap_int32) (parseEndByteIndex - (parseEndPtr - eventPtr)); return -1; } int XML_GetCurrentByteCount(XML_Parser parser) { if (eventEndPtr && eventPtr) - return eventEndPtr - eventPtr; + return (int) (eventEndPtr - eventPtr); return 0; } @@ -1223,7 +1228,7 @@ /* Need to guarantee that: tag->buf + ROUND_UP(tag->rawNameLength, sizeof(XML_Char)) <= tag->bufEnd - sizeof(XML_Char) */ if (tag->rawNameLength + (int)(sizeof(XML_Char) - 1) + (int)sizeof(XML_Char) > tag->bufEnd - tag->buf) { - int bufSize = tag->rawNameLength * 4; + size_t bufSize = tag->rawNameLength * 4; bufSize = ROUND_UP(bufSize, sizeof(XML_Char)); tag->buf = realloc(tag->buf, bufSize); if (!tag->buf) @@ -1240,7 +1245,7 @@ for (;;) { const char *rawNameEnd = tag->rawName + tag->rawNameLength; const char *fromPtr = tag->rawName; - int bufSize; + size_t bufSize; if (nextPtr) toPtr = (XML_Char *)(tag->buf + ROUND_UP(tag->rawNameLength, sizeof(XML_Char))); else @@ -1421,12 +1426,12 @@ if (MUST_CONVERT(enc, s)) { ICHAR *dataPtr = (ICHAR *)dataBuf; XmlConvert(enc, &s, end, &dataPtr, (ICHAR *)dataBufEnd); - characterDataHandler(handlerArg, dataBuf, dataPtr - (ICHAR *)dataBuf); + characterDataHandler(handlerArg, dataBuf, (int) (dataPtr - (ICHAR *)dataBuf)); } else characterDataHandler(handlerArg, (XML_Char *)s, - (XML_Char *)end - (XML_Char *)s); + (int) ((XML_Char *)end - (XML_Char *)s)); } else if (defaultHandler) reportDefault(parser, enc, s, end); @@ -1446,7 +1451,7 @@ ICHAR *dataPtr = (ICHAR *)dataBuf; XmlConvert(enc, &s, next, &dataPtr, (ICHAR *)dataBufEnd); *eventEndPP = s; - characterDataHandler(handlerArg, dataBuf, dataPtr - (ICHAR *)dataBuf); + characterDataHandler(handlerArg, dataBuf, (int) (dataPtr - (ICHAR *)dataBuf)); if (s == next) break; *eventPP = s; @@ -1455,7 +1460,7 @@ else characterDataHandler(handlerArg, (XML_Char *)s, - (XML_Char *)next - (XML_Char *)s); + (int) ((XML_Char *)next - (XML_Char *)s)); } else if (defaultHandler) reportDefault(parser, enc, s, next); @@ -1795,7 +1800,7 @@ ICHAR *dataPtr = (ICHAR *)dataBuf; XmlConvert(enc, &s, next, &dataPtr, (ICHAR *)dataBufEnd); *eventEndPP = next; - characterDataHandler(handlerArg, dataBuf, dataPtr - (ICHAR *)dataBuf); + characterDataHandler(handlerArg, dataBuf, (int) (dataPtr - (ICHAR *)dataBuf)); if (s == next) break; *eventPP = s; @@ -1804,7 +1809,7 @@ else characterDataHandler(handlerArg, (XML_Char *)s, - (XML_Char *)next - (XML_Char *)s); + (int) ((XML_Char *)next - (XML_Char *)s)); } else if (defaultHandler) reportDefault(parser, enc, s, next); @@ -2502,7 +2507,7 @@ case XML_TOK_NONE: if (declEntity) { declEntity->textPtr = pool->start; - declEntity->textLen = pool->ptr - pool->start; + declEntity->textLen = (int) (pool->ptr - pool->start); poolFinish(pool); } else @@ -2646,12 +2651,12 @@ ICHAR *dataPtr = (ICHAR *)dataBuf; XmlConvert(enc, &s, end, &dataPtr, (ICHAR *)dataBufEnd); *eventEndPP = s; - defaultHandler(handlerArg, dataBuf, dataPtr - (ICHAR *)dataBuf); + defaultHandler(handlerArg, dataBuf, (int) (dataPtr - (ICHAR *)dataBuf)); *eventPP = s; } while (s != end); } else - defaultHandler(handlerArg, (XML_Char *)s, (XML_Char *)end - (XML_Char *)s); + defaultHandler(handlerArg, (XML_Char *)s, (int) ((XML_Char *)end - (XML_Char *)s)); } @@ -3224,7 +3229,7 @@ } } if (pool->blocks && pool->start == pool->blocks->s) { - int blockSize = (pool->end - pool->start)*2; + int blockSize = (int) (pool->end - pool->start)*2; pool->blocks = realloc(pool->blocks, offsetof(BLOCK, s) + blockSize * sizeof(XML_Char)); if (!pool->blocks) return 0; @@ -3235,7 +3240,7 @@ } else { BLOCK *tem; - int blockSize = pool->end - pool->start; + int blockSize = (int) (pool->end - pool->start); if (blockSize < INIT_BLOCK_SIZE) blockSize = INIT_BLOCK_SIZE; else diff -urN apache_1.3.20/src/lib/expat-lite/xmlparse.h-orig apache_1.3.20/src/lib/expat-lite/xmlparse.h --- apache_1.3.20/src/lib/expat-lite/xmlparse.h-orig Mon May 31 05:56:25 1999 +++ apache_1.3.20/src/lib/expat-lite/xmlparse.h Sat Jun 30 23:53:25 2001 @@ -456,7 +456,7 @@ int XMLPARSEAPI XML_GetCurrentLineNumber(XML_Parser parser); int XMLPARSEAPI XML_GetCurrentColumnNumber(XML_Parser parser); -long XMLPARSEAPI XML_GetCurrentByteIndex(XML_Parser parser); +ap_int32 XMLPARSEAPI XML_GetCurrentByteIndex(XML_Parser parser); /* Return the number of bytes in the current event. Returns 0 if the event is in an internal entity. */ diff -urN apache_1.3.20/src/lib/expat-lite/xmlrole.c-orig apache_1.3.20/src/lib/expat-lite/xmlrole.c --- apache_1.3.20/src/lib/expat-lite/xmlrole.c-orig Mon May 31 05:56:25 1999 +++ apache_1.3.20/src/lib/expat-lite/xmlrole.c Sat Jun 30 23:53:25 2001 @@ -31,6 +31,11 @@ #include "xmldef.h" #include "xmlrole.h" +#if defined(IRIX) && _MIPS_SIM != _ABIO32 +/* disable warnings about unused formal parameters */ +#pragma set woff 1174 +#endif + /* Doesn't check: that ,| are not mixed in a model group diff -urN apache_1.3.20/src/lib/expat-lite/xmltok.c-orig apache_1.3.20/src/lib/expat-lite/xmltok.c --- apache_1.3.20/src/lib/expat-lite/xmltok.c-orig Wed Jun 9 05:50:07 1999 +++ apache_1.3.20/src/lib/expat-lite/xmltok.c Sat Jun 30 23:53:25 2001 @@ -32,6 +32,11 @@ #include "xmltok.h" #include "nametab.h" +#if defined(IRIX) && _MIPS_SIM != _ABIO32 +/* disable warnings about unused formal parameters */ +#pragma set woff 1174 +#endif + #define VTABLE1 \ { PREFIX(prologTok), PREFIX(contentTok), PREFIX(cdataSectionTok) }, \ { PREFIX(attributeValueTok), PREFIX(entityValueTok) }, \ @@ -314,7 +319,7 @@ break; case BT_LEAD4: { - unsigned long n; + ap_uint32 n; if (to + 1 == toLim) break; n = ((from[0] & 0x7) << 18) | ((from[1] & 0x3f) << 12) | ((from[2] & 0x3f) << 6) | (from[3] & 0x3f); diff -urN apache_1.3.20/src/lib/expat-lite/xmltok.h-orig apache_1.3.20/src/lib/expat-lite/xmltok.h --- apache_1.3.20/src/lib/expat-lite/xmltok.h-orig Thu Jun 3 05:35:27 1999 +++ apache_1.3.20/src/lib/expat-lite/xmltok.h Sat Jun 30 23:53:25 2001 @@ -124,8 +124,8 @@ typedef struct position { /* first line and first column are 0 not 1 */ - unsigned long lineNumber; - unsigned long columnNumber; + ap_uint32 lineNumber; + ap_uint32 columnNumber; } POSITION; typedef struct { diff -urN apache_1.3.20/src/lib/expat-lite/xmltok_impl.c-orig apache_1.3.20/src/lib/expat-lite/xmltok_impl.c --- apache_1.3.20/src/lib/expat-lite/xmltok_impl.c-orig Wed Jun 9 05:50:08 1999 +++ apache_1.3.20/src/lib/expat-lite/xmltok_impl.c Sat Jun 30 23:53:25 2001 @@ -28,6 +28,13 @@ your version of this file under either the MPL or the GPL. */ +#if defined(IRIX) && _MIPS_SIM != _ABIO32 +/* disable warnings about unused formal parameters */ +#pragma set woff 1174 +/* disable warnings about constant controlling expressions */ +#pragma set woff 1209 +#endif + #ifndef IS_INVALID_CHAR #define IS_INVALID_CHAR(enc, ptr, n) (0) #endif @@ -1682,7 +1689,7 @@ ptr += MINBPC(enc); break; default: - return ptr - start; + return (int) (ptr - start); } } } @@ -1718,7 +1725,7 @@ LEAD_CASE(2) LEAD_CASE(3) LEAD_CASE(4) #undef LEAD_CASE case BT_LF: - pos->columnNumber = (unsigned)-1; + pos->columnNumber = (ap_uint32)-1; pos->lineNumber++; ptr += MINBPC(enc); break; @@ -1727,7 +1734,7 @@ ptr += MINBPC(enc); if (ptr != end && BYTE_TYPE(enc, ptr) == BT_LF) ptr += MINBPC(enc); - pos->columnNumber = (unsigned)-1; + pos->columnNumber = (ap_uint32)-1; break; default: ptr += MINBPC(enc); diff -urN apache_1.3.20/src/main/Makefile.tmpl-orig apache_1.3.20/src/main/Makefile.tmpl --- apache_1.3.20/src/main/Makefile.tmpl-orig Thu Jun 22 18:22:27 2000 +++ apache_1.3.20/src/main/Makefile.tmpl Sat Jun 30 23:53:25 2001 @@ -5,13 +5,13 @@ LDFLAGS=$(LDFLAGS1) $(EXTRA_LDFLAGS) LIB= libmain.a -HEADERS= test_char.h uri_delims.h +HEADERS= test_char.h uri_delims.h aap_version.h OBJS= alloc.o buff.o \ http_config.o http_core.o http_log.o \ http_main.o http_protocol.o http_request.o http_vhost.o \ util.o util_date.o util_script.o util_uri.o util_md5.o \ - rfc1413.o + rfc1413.o qsc.o .c.o: $(CC) -c $(INCLUDES) $(CFLAGS) $< @@ -24,7 +24,7 @@ $(RANLIB) $@ clean: - rm -f *.o $(LIB) uri_delims.h gen_uri_delims test_char.h gen_test_char + rm -f *.o $(LIB) uri_delims.h gen_uri_delims test_char.h gen_test_char aap_version.h distclean: clean -rm -f Makefile @@ -41,6 +41,10 @@ gen_test_char: gen_test_char.o $(CC) $(CFLAGS) $(LDFLAGS) -o gen_test_char gen_test_char.o $(LIBS) +aap_version.h: gen_aap_version ../../10xpatchlevel + chmod u+x gen_aap_version + ./gen_aap_version > aap_version.h + # We really don't expect end users to use this rule. It works only with # gcc, and rebuilds Makefile.tmpl. You have to re-run Configure after # using it. @@ -58,31 +62,35 @@ $(OBJS): Makefile # DO NOT REMOVE -alloc.o: alloc.c $(INCDIR)/httpd.h $(INCDIR)/ap_config.h \ - $(INCDIR)/ap_mmn.h $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h \ +alloc.o: alloc.c $(INCDIR)/httpd.h $(INCDIR)/ap_types.h \ + $(INCDIR)/ap_config.h $(INCDIR)/ap_mmn.h \ + $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h $(OSDIR)/os-inline.c \ $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h $(INCDIR)/ap_alloc.h \ $(INCDIR)/buff.h $(INCDIR)/ap.h $(INCDIR)/util_uri.h \ $(INCDIR)/multithread.h $(INCDIR)/http_log.h -buff.o: buff.c $(INCDIR)/httpd.h $(INCDIR)/ap_config.h \ - $(INCDIR)/ap_mmn.h $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h \ +buff.o: buff.c $(INCDIR)/httpd.h $(INCDIR)/ap_types.h \ + $(INCDIR)/ap_config.h $(INCDIR)/ap_mmn.h \ + $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h $(OSDIR)/os-inline.c \ $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h $(INCDIR)/ap_alloc.h \ $(INCDIR)/buff.h $(INCDIR)/ap.h $(INCDIR)/util_uri.h \ $(INCDIR)/http_main.h $(INCDIR)/http_log.h gen_test_char.o: gen_test_char.c $(INCDIR)/httpd.h \ - $(INCDIR)/ap_config.h $(INCDIR)/ap_mmn.h \ - $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h $(INCDIR)/ap_ctype.h \ - $(INCDIR)/hsregex.h $(INCDIR)/ap_alloc.h $(INCDIR)/buff.h \ - $(INCDIR)/ap.h $(INCDIR)/util_uri.h + $(INCDIR)/ap_types.h $(INCDIR)/ap_config.h $(INCDIR)/ap_mmn.h \ + $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h $(OSDIR)/os-inline.c \ + $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h $(INCDIR)/ap_alloc.h \ + $(INCDIR)/buff.h $(INCDIR)/ap.h $(INCDIR)/util_uri.h gen_uri_delims.o: gen_uri_delims.c -http_config.o: http_config.c $(INCDIR)/httpd.h $(INCDIR)/ap_config.h \ - $(INCDIR)/ap_mmn.h $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h \ +http_config.o: http_config.c $(INCDIR)/httpd.h $(INCDIR)/ap_types.h \ + $(INCDIR)/ap_config.h $(INCDIR)/ap_mmn.h \ + $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h $(OSDIR)/os-inline.c \ $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h $(INCDIR)/ap_alloc.h \ $(INCDIR)/buff.h $(INCDIR)/ap.h $(INCDIR)/util_uri.h \ $(INCDIR)/http_config.h $(INCDIR)/http_core.h $(INCDIR)/http_log.h \ $(INCDIR)/http_request.h $(INCDIR)/http_conf_globals.h \ $(INCDIR)/http_vhost.h $(INCDIR)/explain.h -http_core.o: http_core.c $(INCDIR)/httpd.h $(INCDIR)/ap_config.h \ - $(INCDIR)/ap_mmn.h $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h \ +http_core.o: http_core.c $(INCDIR)/httpd.h $(INCDIR)/ap_types.h \ + $(INCDIR)/ap_config.h $(INCDIR)/ap_mmn.h \ + $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h $(OSDIR)/os-inline.c \ $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h $(INCDIR)/ap_alloc.h \ $(INCDIR)/buff.h $(INCDIR)/ap.h $(INCDIR)/util_uri.h \ $(INCDIR)/http_config.h $(INCDIR)/http_core.h \ @@ -91,66 +99,84 @@ $(INCDIR)/http_main.h $(INCDIR)/http_log.h $(INCDIR)/rfc1413.h \ $(INCDIR)/util_md5.h $(INCDIR)/ap_md5.h $(INCDIR)/scoreboard.h \ $(INCDIR)/fnmatch.h -http_log.o: http_log.c $(INCDIR)/httpd.h $(INCDIR)/ap_config.h \ - $(INCDIR)/ap_mmn.h $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h \ +http_log.o: http_log.c $(INCDIR)/httpd.h $(INCDIR)/ap_types.h \ + $(INCDIR)/ap_config.h $(INCDIR)/ap_mmn.h \ + $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h $(OSDIR)/os-inline.c \ $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h $(INCDIR)/ap_alloc.h \ $(INCDIR)/buff.h $(INCDIR)/ap.h $(INCDIR)/util_uri.h \ - $(INCDIR)/http_config.h $(INCDIR)/http_core.h $(INCDIR)/http_log.h \ - $(INCDIR)/http_main.h -http_main.o: http_main.c $(INCDIR)/httpd.h $(INCDIR)/ap_config.h \ - $(INCDIR)/ap_mmn.h $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h \ + $(INCDIR)/http_conf_globals.h $(INCDIR)/http_config.h \ + $(INCDIR)/http_core.h $(INCDIR)/http_log.h $(INCDIR)/http_main.h +http_main.o: http_main.c $(INCDIR)/httpd.h $(INCDIR)/ap_types.h \ + $(INCDIR)/ap_config.h $(INCDIR)/ap_mmn.h \ + $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h $(OSDIR)/os-inline.c \ $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h $(INCDIR)/ap_alloc.h \ $(INCDIR)/buff.h $(INCDIR)/ap.h $(INCDIR)/util_uri.h \ $(INCDIR)/http_main.h $(INCDIR)/http_log.h $(INCDIR)/http_config.h \ $(INCDIR)/http_protocol.h $(INCDIR)/http_request.h \ $(INCDIR)/http_conf_globals.h $(INCDIR)/http_core.h \ $(INCDIR)/http_vhost.h $(INCDIR)/util_script.h \ - $(INCDIR)/scoreboard.h $(INCDIR)/multithread.h $(INCDIR)/explain.h + $(INCDIR)/scoreboard.h $(INCDIR)/multithread.h $(INCDIR)/explain.h \ + aap_version.h ../lib/expat-lite/xmlparse.h http_protocol.o: http_protocol.c $(INCDIR)/httpd.h \ - $(INCDIR)/ap_config.h $(INCDIR)/ap_mmn.h \ - $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h $(INCDIR)/ap_ctype.h \ - $(INCDIR)/hsregex.h $(INCDIR)/ap_alloc.h $(INCDIR)/buff.h \ - $(INCDIR)/ap.h $(INCDIR)/util_uri.h $(INCDIR)/http_config.h \ - $(INCDIR)/http_core.h $(INCDIR)/http_protocol.h \ - $(INCDIR)/http_main.h $(INCDIR)/http_request.h \ - $(INCDIR)/http_vhost.h $(INCDIR)/http_log.h $(INCDIR)/util_date.h \ + $(INCDIR)/ap_types.h $(INCDIR)/ap_config.h $(INCDIR)/ap_mmn.h \ + $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h $(OSDIR)/os-inline.c \ + $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h $(INCDIR)/ap_alloc.h \ + $(INCDIR)/buff.h $(INCDIR)/ap.h $(INCDIR)/util_uri.h \ + $(INCDIR)/http_config.h $(INCDIR)/http_core.h \ + $(INCDIR)/http_protocol.h $(INCDIR)/http_main.h \ + $(INCDIR)/http_request.h $(INCDIR)/http_vhost.h \ + $(INCDIR)/http_log.h $(INCDIR)/util_date.h \ $(INCDIR)/http_conf_globals.h http_request.o: http_request.c $(INCDIR)/httpd.h \ + $(INCDIR)/ap_types.h $(INCDIR)/ap_config.h $(INCDIR)/ap_mmn.h \ + $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h $(OSDIR)/os-inline.c \ + $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h $(INCDIR)/ap_alloc.h \ + $(INCDIR)/buff.h $(INCDIR)/ap.h $(INCDIR)/util_uri.h \ + $(INCDIR)/http_config.h $(INCDIR)/http_request.h \ + $(INCDIR)/http_core.h $(INCDIR)/http_protocol.h \ + $(INCDIR)/http_conf_globals.h $(INCDIR)/http_log.h \ + $(INCDIR)/http_main.h $(INCDIR)/scoreboard.h $(INCDIR)/fnmatch.h +http_vhost.o: http_vhost.c $(INCDIR)/httpd.h $(INCDIR)/ap_types.h \ $(INCDIR)/ap_config.h $(INCDIR)/ap_mmn.h \ - $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h $(INCDIR)/ap_ctype.h \ - $(INCDIR)/hsregex.h $(INCDIR)/ap_alloc.h $(INCDIR)/buff.h \ - $(INCDIR)/ap.h $(INCDIR)/util_uri.h $(INCDIR)/http_config.h \ - $(INCDIR)/http_request.h $(INCDIR)/http_core.h \ - $(INCDIR)/http_protocol.h $(INCDIR)/http_conf_globals.h \ - $(INCDIR)/http_log.h $(INCDIR)/http_main.h $(INCDIR)/scoreboard.h \ - $(INCDIR)/fnmatch.h -http_vhost.o: http_vhost.c $(INCDIR)/httpd.h $(INCDIR)/ap_config.h \ - $(INCDIR)/ap_mmn.h $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h \ + $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h $(OSDIR)/os-inline.c \ $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h $(INCDIR)/ap_alloc.h \ $(INCDIR)/buff.h $(INCDIR)/ap.h $(INCDIR)/util_uri.h \ $(INCDIR)/http_config.h $(INCDIR)/http_conf_globals.h \ $(INCDIR)/http_log.h $(INCDIR)/http_vhost.h \ $(INCDIR)/http_protocol.h -rfc1413.o: rfc1413.c $(INCDIR)/httpd.h $(INCDIR)/ap_config.h \ - $(INCDIR)/ap_mmn.h $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h \ +qsc.o: qsc.c $(INCDIR)/httpd.h $(INCDIR)/ap_types.h \ + $(INCDIR)/ap_config.h $(INCDIR)/ap_mmn.h \ + $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h $(OSDIR)/os-inline.c \ + $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h $(INCDIR)/ap_alloc.h \ + $(INCDIR)/buff.h $(INCDIR)/ap.h $(INCDIR)/util_uri.h \ + $(INCDIR)/http_log.h $(INCDIR)/http_config.h \ + $(INCDIR)/http_conf_globals.h $(INCDIR)/http_protocol.h \ + $(INCDIR)/http_main.h $(INCDIR)/scoreboard.h +rfc1413.o: rfc1413.c $(INCDIR)/httpd.h $(INCDIR)/ap_types.h \ + $(INCDIR)/ap_config.h $(INCDIR)/ap_mmn.h \ + $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h $(OSDIR)/os-inline.c \ $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h $(INCDIR)/ap_alloc.h \ $(INCDIR)/buff.h $(INCDIR)/ap.h $(INCDIR)/util_uri.h \ $(INCDIR)/http_log.h $(INCDIR)/rfc1413.h $(INCDIR)/http_main.h -util.o: util.c $(INCDIR)/httpd.h $(INCDIR)/ap_config.h \ - $(INCDIR)/ap_mmn.h $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h \ +util.o: util.c $(INCDIR)/httpd.h $(INCDIR)/ap_types.h \ + $(INCDIR)/ap_config.h $(INCDIR)/ap_mmn.h \ + $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h $(OSDIR)/os-inline.c \ $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h $(INCDIR)/ap_alloc.h \ $(INCDIR)/buff.h $(INCDIR)/ap.h $(INCDIR)/util_uri.h \ - $(INCDIR)/http_conf_globals.h $(INCDIR)/http_log.h test_char.h + $(INCDIR)/http_conf_globals.h $(INCDIR)/http_log.h test_char.h \ + $(INCDIR)/scoreboard.h util_date.o: util_date.c $(INCDIR)/ap_config.h $(INCDIR)/ap_mmn.h \ - $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h $(INCDIR)/ap_ctype.h \ - $(INCDIR)/hsregex.h $(INCDIR)/util_date.h -util_md5.o: util_md5.c $(INCDIR)/httpd.h $(INCDIR)/ap_config.h \ - $(INCDIR)/ap_mmn.h $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h \ + $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h $(OSDIR)/os-inline.c \ + $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h $(INCDIR)/util_date.h +util_md5.o: util_md5.c $(INCDIR)/httpd.h $(INCDIR)/ap_types.h \ + $(INCDIR)/ap_config.h $(INCDIR)/ap_mmn.h \ + $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h $(OSDIR)/os-inline.c \ $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h $(INCDIR)/ap_alloc.h \ $(INCDIR)/buff.h $(INCDIR)/ap.h $(INCDIR)/util_uri.h \ $(INCDIR)/util_md5.h $(INCDIR)/ap_md5.h -util_script.o: util_script.c $(INCDIR)/httpd.h $(INCDIR)/ap_config.h \ - $(INCDIR)/ap_mmn.h $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h \ +util_script.o: util_script.c $(INCDIR)/httpd.h $(INCDIR)/ap_types.h \ + $(INCDIR)/ap_config.h $(INCDIR)/ap_mmn.h \ + $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h $(OSDIR)/os-inline.c \ $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h $(INCDIR)/ap_alloc.h \ $(INCDIR)/buff.h $(INCDIR)/ap.h $(INCDIR)/util_uri.h \ $(INCDIR)/http_config.h $(INCDIR)/http_conf_globals.h \ @@ -158,8 +184,9 @@ $(INCDIR)/http_protocol.h $(INCDIR)/http_core.h \ $(INCDIR)/http_request.h $(INCDIR)/util_script.h \ $(INCDIR)/util_date.h -util_uri.o: util_uri.c $(INCDIR)/httpd.h $(INCDIR)/ap_config.h \ - $(INCDIR)/ap_mmn.h $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h \ +util_uri.o: util_uri.c $(INCDIR)/httpd.h $(INCDIR)/ap_types.h \ + $(INCDIR)/ap_config.h $(INCDIR)/ap_mmn.h \ + $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h $(OSDIR)/os-inline.c \ $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h $(INCDIR)/ap_alloc.h \ $(INCDIR)/buff.h $(INCDIR)/ap.h $(INCDIR)/util_uri.h \ $(INCDIR)/http_log.h $(INCDIR)/http_conf_globals.h uri_delims.h diff -urN apache_1.3.20/src/main/alloc.c-orig apache_1.3.20/src/main/alloc.c --- apache_1.3.20/src/main/alloc.c-orig Mon Jan 15 12:04:55 2001 +++ apache_1.3.20/src/main/alloc.c Sat Jun 30 23:53:25 2001 @@ -174,13 +174,15 @@ }; static union block_hdr *block_freelist = NULL; +#ifdef MULTITHREAD static mutex *alloc_mutex = NULL; static mutex *spawn_mutex = NULL; +#endif #ifdef POOL_DEBUG static char *known_stack_point; static int stack_direction; static union block_hdr *global_block_list; -#define FREE_POOL ((struct pool *)(-1)) +#define FREE_POOL ((struct pool *) (ap_ptr) -1) #endif #ifdef ALLOC_STATS static unsigned long long num_free_blocks_calls; @@ -216,7 +218,7 @@ /* Get a completely new block from the system pool. Note that we rely on malloc() to provide aligned memory. */ -static union block_hdr *malloc_block(int size) +static union block_hdr *malloc_block(size_t size) { union block_hdr *blok; @@ -350,7 +352,7 @@ * if necessary. Must be called with alarms blocked. */ -static union block_hdr *new_block(int min_size) +static union block_hdr *new_block(size_t min_size) { union block_hdr **lastptr = &block_freelist; union block_hdr *blok = block_freelist; @@ -383,9 +385,9 @@ /* Accounting */ -static long bytes_in_block_list(union block_hdr *blok) +static ap_int32 bytes_in_block_list(union block_hdr *blok) { - long size = 0; + ap_int32 size = 0; while (blok) { size += blok->h.endp - (char *) (blok + 1); @@ -510,8 +512,10 @@ known_stack_point = &s; stack_var_init(&s); #endif +#ifdef MULTITHREAD alloc_mutex = ap_create_mutex(NULL); spawn_mutex = ap_create_mutex(NULL); +#endif permanent_pool = ap_make_sub_pool(NULL); #ifdef ALLOC_STATS atexit(dump_stats); @@ -582,11 +586,11 @@ ap_unblock_alarms(); } -API_EXPORT(long) ap_bytes_in_pool(pool *p) +API_EXPORT(ap_int32) ap_bytes_in_pool(pool *p) { return bytes_in_block_list(p->first); } -API_EXPORT(long) ap_bytes_in_free_blocks(void) +API_EXPORT(ap_int32) ap_bytes_in_free_blocks(void) { return bytes_in_block_list(block_freelist); } @@ -603,9 +607,9 @@ /* is ptr in the range [lo,hi) */ #define is_ptr_in_range(ptr, lo, hi) \ - (((unsigned long)(ptr) - (unsigned long)(lo)) \ + (((ap_ptr)(ptr) - (ap_ptr)(lo)) \ < \ - (unsigned long)(hi) - (unsigned long)(lo)) + (ap_ptr)(hi) - (ap_ptr)(lo)) /* Find the pool that ts belongs to, return NULL if it doesn't * belong to any pool. @@ -707,10 +711,10 @@ */ -API_EXPORT(void *) ap_palloc(struct pool *a, int reqsize) +API_EXPORT(void *) ap_palloc(struct pool *a, size_t reqsize) { #ifdef ALLOC_USE_MALLOC - int size = reqsize + CLICK_SZ; + size_t size = reqsize + CLICK_SZ; void *ptr; ap_block_alarms(); @@ -729,8 +733,8 @@ /* Round up requested size to an even number of alignment units (core clicks) */ - int nclicks = 1 + ((reqsize - 1) / CLICK_SZ); - int size = nclicks * CLICK_SZ; + size_t nclicks = 1 + ((reqsize - 1) / CLICK_SZ); + size_t size = nclicks * CLICK_SZ; /* First, see if we have space in the block most recently * allocated to this pool @@ -740,8 +744,12 @@ char *first_avail = blok->h.first_avail; char *new_first_avail; - if (reqsize <= 0) + if (reqsize <= 0) { +#if defined(IRIX) && _MIPS_SIM != _ABIO32 +#pragma mips_frequency_hint NEVER +#endif return NULL; + } new_first_avail = first_avail + size; @@ -776,7 +784,7 @@ #endif } -API_EXPORT(void *) ap_pcalloc(struct pool *a, int size) +API_EXPORT(void *) ap_pcalloc(struct pool *a, size_t size) { void *res = ap_palloc(a, size); memset(res, '\0', size); @@ -796,7 +804,7 @@ return res; } -API_EXPORT(char *) ap_pstrndup(struct pool *a, const char *s, int n) +API_EXPORT(char *) ap_pstrndup(struct pool *a, const char *s, size_t n) { char *res; @@ -889,12 +897,12 @@ #else union block_hdr *blok; union block_hdr *nblok; - size_t cur_len; + int cur_len; char *strp; blok = ps->blok; strp = ps->vbuff.curpos; - cur_len = strp - blok->h.first_avail; + cur_len = (int) (strp - blok->h.first_avail); /* must try another blok */ (void) ap_acquire_mutex(alloc_mutex); @@ -923,6 +931,7 @@ #endif } +/*PRINTFLIKE2*/ API_EXPORT(char *) ap_pvsprintf(pool *p, const char *fmt, va_list ap) { #ifdef ALLOC_USE_MALLOC @@ -954,7 +963,7 @@ #else struct psprintf_data ps; char *strp; - int size; + size_t size; ap_block_alarms(); ps.blok = p->last; @@ -986,6 +995,7 @@ #endif } +/*PRINTFLIKE2*/ API_EXPORT_NONSTD(char *) ap_psprintf(pool *p, const char *fmt, ...) { va_list ap; @@ -1028,6 +1038,9 @@ API_EXPORT(void *) ap_push_array(array_header *arr) { if (arr->nelts == arr->nalloc) { +#if defined(IRIX) && _MIPS_SIM != _ABIO32 +#pragma mips_frequency_hint NEVER +#endif int new_size = (arr->nalloc <= 0) ? 1 : arr->nalloc * 2; char *new_data; @@ -1147,7 +1160,7 @@ for (i = 0, strpp = (char **) arr->elts; ; ++strpp) { if (strpp && *strpp != NULL) { - len = strlen(*strpp); + len = ap_strlen(*strpp); memcpy(cp, *strpp, len); cp += len; } @@ -1617,15 +1630,15 @@ else { char *strp; char *value; - size_t len; + int len; /* Have to merge some headers. Let's re-use the order field, * since it's handy... we'll store the length of val there. */ - left->order = strlen(left->val); + left->order = ap_strlen(left->val); len = left->order; do { - right->order = strlen(right->val); + right->order = ap_strlen(right->val); len += 2 + right->order; ++right; } while (right < last @@ -1750,6 +1763,7 @@ #endif /* ndef WIN32 */ } +/*ARGSUSED0*/ API_EXPORT_NONSTD(void) ap_null_cleanup(void *data) { /* do nothing cleanup routine */ @@ -1763,20 +1777,20 @@ static void fd_cleanup(void *fdv) { - close((int) (long) fdv); + close((int) (ap_ptr) fdv); } API_EXPORT(void) ap_note_cleanups_for_fd(pool *p, int fd) { - ap_register_cleanup(p, (void *) (long) fd, fd_cleanup, fd_cleanup); + ap_register_cleanup(p, (void *) (ap_ptr) fd, fd_cleanup, fd_cleanup); } API_EXPORT(void) ap_kill_cleanups_for_fd(pool *p, int fd) { - ap_kill_cleanup(p, (void *) (long) fd, fd_cleanup); + ap_kill_cleanup(p, (void *) (ap_ptr) fd, fd_cleanup); } -API_EXPORT(int) ap_popenf(pool *a, const char *name, int flg, int mode) +API_EXPORT(int) ap_popenf(pool *a, const char *name, int flg, mode_t mode) { int fd; int save_errno; @@ -1801,7 +1815,7 @@ ap_block_alarms(); res = close(fd); save_errno = errno; - ap_kill_cleanup(a, (void *) (long) fd, fd_cleanup); + ap_kill_cleanup(a, (void *) (ap_ptr) fd, fd_cleanup); ap_unblock_alarms(); errno = save_errno; return res; @@ -1962,17 +1976,17 @@ static void socket_cleanup(void *fdv) { - closesocket((int) (long) fdv); + closesocket((int) (ap_ptr) fdv); } API_EXPORT(void) ap_note_cleanups_for_socket(pool *p, int fd) { - ap_register_cleanup(p, (void *) (long) fd, socket_cleanup, socket_cleanup); + ap_register_cleanup(p, (void *) (ap_ptr) fd, socket_cleanup, socket_cleanup); } API_EXPORT(void) ap_kill_cleanups_for_socket(pool *p, int sock) { - ap_kill_cleanup(p, (void *) (long) sock, socket_cleanup); + ap_kill_cleanup(p, (void *) (ap_ptr) sock, socket_cleanup); } API_EXPORT(int) ap_psocket(pool *p, int domain, int type, int protocol) @@ -2003,7 +2017,7 @@ errno = WSAGetLastError(); #endif /* WIN32 */ save_errno = errno; - ap_kill_cleanup(a, (void *) (long) sock, socket_cleanup); + ap_kill_cleanup(a, (void *) (ap_ptr) sock, socket_cleanup); ap_unblock_alarms(); errno = save_errno; return res; diff -urN apache_1.3.20/src/main/buff.c-orig apache_1.3.20/src/main/buff.c --- apache_1.3.20/src/main/buff.c-orig Mon Jan 15 12:04:56 2001 +++ apache_1.3.20/src/main/buff.c Sat Jun 30 23:53:25 2001 @@ -64,10 +64,6 @@ #include #include #include -#ifndef NO_WRITEV -#include -#include -#endif #ifdef HAVE_BSTRING_H #include /* for IRIX, FD_SET calls bzero() */ @@ -274,7 +270,21 @@ } else #endif - rv = read(fb->fd_in, buf, nbyte); + rv = (int) read(fb->fd_in, buf, nbyte); + +#if defined(IRIX) && _MIPS_SIM != _ABIO32 +/* + * Try to prefetch the first cache line of the read data ASAP so it's + * ready in the primary cache when the (ultimate) caller touches it. + * The cache line is prefetched for writing because the read data is + * often modified, and in this multi-process server there is going to be + * little to no penalty for owning the cache line exclusively + * unnecessarily (unlike on a highly-contended cache line in a + * multi-threaded server). + */ +# pragma prefetch_manual = 1 +# pragma prefetch_ref = ((char *) buf)[0], kind = wr +#endif return rv; } @@ -346,7 +356,7 @@ rv = send(fb->fd, buf, nbyte, 0); else #endif - rv = write(fb->fd, buf, nbyte); + rv = (int) write(fb->fd, buf, nbyte); #endif return rv; @@ -421,7 +431,7 @@ fb->outcnt = 0; fb->outchunk = -1; fb->error = NULL; - fb->bytes_sent = 0L; + fb->bytes_sent = 0; fb->fd = -1; fb->fd_in = -1; @@ -463,7 +473,7 @@ API_EXPORT(int) ap_bsetopt(BUFF *fb, int optname, const void *optval) { if (optname == BO_BYTECT) { - fb->bytes_sent = *(const long int *) optval - (long int) fb->outcnt;; + fb->bytes_sent = *(const ap_int32 *) optval - (ap_int32) fb->outcnt; return 0; } else { @@ -475,10 +485,10 @@ API_EXPORT(int) ap_bgetopt(BUFF *fb, int optname, void *optval) { if (optname == BO_BYTECT) { - long int bs = fb->bytes_sent + fb->outcnt; - if (bs < 0L) - bs = 0L; - *(long int *) optval = bs; + ap_int32 bs = fb->bytes_sent + fb->outcnt; + if (bs < (ap_int32) 0) + bs = 0; + *(ap_int32 *) optval = bs; return 0; } else { @@ -1076,43 +1086,93 @@ */ static int writev_it_all(BUFF *fb, struct iovec *vec, int nvec) { - int i, rv; + return (ap_bwritev(fb, vec, nvec) >= 0) ? 0 : -1; +} +#endif - /* while it's nice an easy to build the vector and crud, it's painful - * to deal with a partial writev() - */ - i = 0; - while (i < nvec) { - do - rv = writev(fb->fd, &vec[i], nvec - i); - while (rv == -1 && (errno == EINTR || errno == EAGAIN) - && !(fb->flags & B_EOUT)); - if (rv == -1) { - if (errno != EINTR && errno != EAGAIN) { +/* + * Write data using writev() if available, write() otherwise. + * Returns number of bytes written or -1 on error. + * Note that it may modify iov; + */ +API_EXPORT(int) +ap_bwritev(BUFF *fb, struct iovec *iov, int iovcnt) +{ + int rval; + + if ((fb->flags & (B_EOUT | B_WRERR | B_WR)) == B_WR) { +#ifndef NO_WRITEV + int i, len; + + rval = 0; + + len = 0; + for (i = 0; i < iovcnt; i++) + len += iov[i].iov_len; + + while (len > 0) { + int w; + + w = (iovcnt > 1) ? (int) writev(fb->fd, iov, iovcnt) : + (int) write(fb->fd, iov->iov_base, iov->iov_len); + if (w >= 0) { + rval += w; + fb->bytes_sent += w; + + len -= w; + if (len == 0) + break; /* shortcut the common case */ + + while (w > iov[0].iov_len) { + w -= iov[0].iov_len; + iov++; + iovcnt--; + } + iov[0].iov_base = (char *) iov[0].iov_base + w; + iov[0].iov_len -= w; + } else if (errno != EINTR && errno != EAGAIN) { doerror(fb, B_WR); + rval = -1; + break; } - return -1; - } - fb->bytes_sent += rv; - /* recalculate vec to deal with partial writes */ - while (rv > 0) { - if (rv < vec[i].iov_len) { - vec[i].iov_base = (char *) vec[i].iov_base + rv; - vec[i].iov_len -= rv; - rv = 0; + + if (fb->flags & B_EOUT) { /* set asynchronously */ + rval = -1; + break; } - else { - rv -= vec[i].iov_len; - ++i; + } +#else + int i; + + rval = 0; + for (i = 0; i < iovcnt; i++) { + while (iov[i].iov_len > 0) { + int w; + + w = write(fb->fd, iov[i].iov_base, iov[i].iov_len); + if (w >= 0) { + rval += w; + fb->bytes_sent += w; + iov[i].iov_base = (char *) iov[i].iov_base + w; + iov[i].iov_len -= w; + } else if (errno != EINTR && errno != EAGAIN) { + doerror(fb, B_WR); + rval = -1; + break; + } + + if (fb->flags & B_EOUT) { /* set asynchronously */ + rval = -1; + break; + } } } - if (fb->flags & B_EOUT) - return -1; - } - /* if we got here, we wrote it all */ - return 0; -} #endif + } else + rval = -1; + + return rval; +} /* A wrapper for buff_write which deals with error conditions and * bytes_sent. Also handles non-blocking writes. @@ -1530,7 +1590,7 @@ */ API_EXPORT(int) ap_bputs(const char *x, BUFF *fb) { - int i, j = strlen(x); + int i, j = ap_strlen(x); i = ap_bwrite(fb, x, j); if (i != j) return -1; @@ -1552,7 +1612,7 @@ x = va_arg(v, const char *); if (x == NULL) break; - j = strlen(x); + j = ap_strlen(x); i = ap_bwrite(fb, x, j); if (i != j) { va_end(v); @@ -1601,6 +1661,7 @@ return 0; } +/*PRINTFLIKE2*/ API_EXPORT_NONSTD(int) ap_bprintf(BUFF *fb, const char *fmt, ...) { va_list ap; @@ -1629,6 +1690,7 @@ return res; } +/*PRINTFLIKE2*/ API_EXPORT(int) ap_vbprintf(BUFF *fb, const char *fmt, va_list ap) { struct bprintf_data b; diff -urN apache_1.3.20/src/main/gen_aap_version-orig apache_1.3.20/src/main/gen_aap_version --- apache_1.3.20/src/main/gen_aap_version-orig Wed Dec 31 19:00:00 1969 +++ apache_1.3.20/src/main/gen_aap_version Sat Jun 30 23:53:25 2001 @@ -0,0 +1,17 @@ +pl=`grep 10xpatchlevel= ../../10xpatchlevel 2>/dev/null | \ + sed -e 's,^,(,' -e 's,=, ,' -e 's,$,),'` +case "$pl" in +"") # missing or broken 10xpatchlevel file, do nothing + ;; +*) cat << EOF +/* + * Accelerating Apache Project patch level. + * http://oss.sgi.com/projects/apache/ + * + * Automatically generated by gen_aap_version. + * Do not edit. + */ +#define AAP_VERSION "$pl" +EOF + ;; +esac diff -urN apache_1.3.20/src/main/http_config.c-orig apache_1.3.20/src/main/http_config.c --- apache_1.3.20/src/main/http_config.c-orig Tue Jan 23 21:11:09 2001 +++ apache_1.3.20/src/main/http_config.c Sun Jul 1 00:57:29 2001 @@ -302,7 +302,7 @@ static handler_func *method_ptrs; -void ap_cleanup_method_ptrs() +void ap_cleanup_method_ptrs(void) { if (method_ptrs) { free(method_ptrs); @@ -768,7 +768,7 @@ } /* Clear the internal list of modules, in preparation for starting over. */ -API_EXPORT(void) ap_clear_module_list() +API_EXPORT(void) ap_clear_module_list(void) { module **m = &top_module; module **next_m; @@ -1058,7 +1058,7 @@ { /* This one's pretty generic... */ - int offset = (int) (long) cmd->info; + int offset = (int) (ap_ptr) cmd->info; *(char **) (struct_ptr + offset) = arg; return NULL; } @@ -1068,7 +1068,7 @@ { /* This one's pretty generic... */ - int offset = (int) (long) cmd->info; + int offset = (int) (ap_ptr) cmd->info; ap_str_tolower(arg); *(char **) (struct_ptr + offset) = arg; return NULL; @@ -1079,7 +1079,7 @@ { /* This one's pretty generic too... */ - int offset = (int) (long) cmd->info; + int offset = (int) (ap_ptr) cmd->info; *(int *) (struct_ptr + offset) = arg ? 1 : 0; return NULL; } @@ -1090,7 +1090,11 @@ This allows .htaccess to be independent of server_root, so the server can be moved or mirrored with less pain. */ char *p; +#if 0 int offset = (int) (long) cmd->info; +#else + int offset = (int) (ap_ptr) cmd->info; +#endif #ifndef OS2 arg = ap_os_canonical_filename(cmd->pool, arg); #endif @@ -1514,6 +1518,12 @@ ap_listeners = NULL; ap_listenbacklog = DEFAULT_LISTENBACKLOG; ap_extended_status = 0; +#ifdef USE_QSC + ap_qsc_enabled = 0; +#endif +#ifdef SINGLE_LISTEN_UNSERIALIZED_ACCEPT + ap_single_listen = 0; +#endif /* Global virtual host hash bucket pointers. Init to null. */ ap_init_vhost_config(p); @@ -1569,6 +1579,10 @@ new->local_addr.sin_port = htons(s->port ? s->port : DEFAULT_HTTP_PORT); new->fd = -1; new->used = 0; + new->unique = new->local_addr.sin_addr.s_addr != htonl(INADDR_ANY); +#ifdef SINGLE_LISTEN_UNSERIALIZED_ACCEPT + new->cpu = -1; +#endif new->next = NULL; ap_listeners = new; } diff -urN apache_1.3.20/src/main/http_core.c-orig apache_1.3.20/src/main/http_core.c --- apache_1.3.20/src/main/http_core.c-orig Fri Mar 9 05:10:25 2001 +++ apache_1.3.20/src/main/http_core.c Sun Jul 1 00:59:55 2001 @@ -96,6 +96,13 @@ #define MMAP_LIMIT (4*1024*1024) #endif +#ifdef USE_DIRECT_IO +/* Files must be at least this big to have direct I/O used on them. */ +#ifndef DIRECT_THRESHOLD +#define DIRECT_THRESHOLD ((size_t) 64 * 1024 * 1024) /* arbitrary default */ +#endif +#endif + /* Server core module... This module provides support for really basic * server operations, including options and commands which control the * operation of other modules. Consider this the bureaucracy module. @@ -795,7 +802,7 @@ return ap_psprintf(p, "%s://%s:%u%s", ap_http_method(r), host, port, uri); } -API_EXPORT(unsigned long) ap_get_limit_req_body(const request_rec *r) +API_EXPORT(ap_uint32) ap_get_limit_req_body(const request_rec *r) { core_dir_config *d = (core_dir_config *)ap_get_module_config(r->per_dir_config, &core_module); @@ -1083,6 +1090,7 @@ return NULL; } +/*ARGSUSED1*/ static const char *set_access_name(cmd_parms *cmd, void *dummy, char *arg) { void *sconf = cmd->server->module_config; @@ -1136,6 +1144,7 @@ return NULL; } +/*ARGSUSED1*/ static const char *set_document_root(cmd_parms *cmd, void *dummy, char *arg) { void *sconf = cmd->server->module_config; @@ -1354,6 +1363,7 @@ return NULL; } +/*ARGSUSED0*/ static const char *satisfy(cmd_parms *cmd, core_dir_config *c, char *arg) { if (!strcasecmp(arg, "all")) { @@ -1381,6 +1391,7 @@ return NULL; } +/*ARGSUSED1*/ CORE_EXPORT_NONSTD(const char *) ap_limit_section(cmd_parms *cmd, void *dummy, const char *arg) { @@ -1421,6 +1432,7 @@ return NULL; } +/*ARGSUSED1*/ static const char *endlimit_section(cmd_parms *cmd, void *dummy, void *dummy2) { void *tog = cmd->cmd->cmd_data; @@ -1457,6 +1469,7 @@ #define USE_ICASE 0 #endif +/*ARGSUSED1*/ static const char *end_nested_section(cmd_parms *cmd, void *dummy) { if (cmd->end_token == NULL) { @@ -1485,6 +1498,7 @@ "> directive missing closing '>'", NULL); } +/*ARGSUSED1*/ static const char *dirsection(cmd_parms *cmd, void *dummy, const char *arg) { const char *errmsg; @@ -1565,6 +1579,7 @@ return NULL; } +/*ARGSUSED1*/ static const char *urlsection(cmd_parms *cmd, void *dummy, const char *arg) { const char *errmsg; @@ -1713,11 +1728,13 @@ * Extra (redundant, unpaired) directives are * simply silently ignored. */ +/*ARGSUSED0*/ static const char *end_ifmod(cmd_parms *cmd, void *dummy) { return NULL; } +/*ARGSUSED1*/ static const char *start_ifmod(cmd_parms *cmd, void *dummy, char *arg) { char *endp = strrchr(arg, '>'); @@ -1772,11 +1789,13 @@ return 0; } +/*ARGSUSED0*/ static const char *end_ifdefine(cmd_parms *cmd, void *dummy) { return NULL; } +/*ARGSUSED1*/ static const char *start_ifdefine(cmd_parms *cmd, void *dummy, char *arg) { char *endp; @@ -1820,6 +1839,7 @@ /* httpd.conf commands... beginning with the business */ +/*ARGSUSED1*/ static const char *virtualhost_section(cmd_parms *cmd, void *dummy, char *arg) { server_rec *main_server = cmd->server, *s; @@ -1883,6 +1903,7 @@ return errmsg; } +/*ARGSUSED1*/ static const char *set_server_alias(cmd_parms *cmd, void *dummy, const char *arg) { @@ -1902,6 +1923,7 @@ return NULL; } +/*ARGSUSED1*/ static const char *add_module_command(cmd_parms *cmd, void *dummy, char *arg) { const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); @@ -1916,6 +1938,7 @@ return NULL; } +/*ARGSUSED1*/ static const char *clear_module_list_command(cmd_parms *cmd, void *dummy) { const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); @@ -1927,12 +1950,13 @@ return NULL; } +/*ARGSUSED1*/ static const char *set_server_string_slot(cmd_parms *cmd, void *dummy, char *arg) { /* This one's pretty generic... */ - int offset = (int)(long)cmd->info; + int offset = (int) (ap_ptr) cmd->info; char *struct_ptr = (char *)cmd->server; const char *err = ap_check_cmd_context(cmd, @@ -1945,6 +1969,7 @@ return NULL; } +/*ARGSUSED1*/ static const char *server_type(cmd_parms *cmd, void *dummy, char *arg) { const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); @@ -1965,6 +1990,7 @@ return NULL; } +/*ARGSUSED1*/ static const char *server_port(cmd_parms *cmd, void *dummy, char *arg) { const char *err = ap_check_cmd_context(cmd, NOT_IN_DIR_LOC_FILE|NOT_IN_LIMIT); @@ -2006,6 +2032,7 @@ return NULL; } +/*ARGSUSED1*/ static const char *set_send_buffer_size(cmd_parms *cmd, void *dummy, char *arg) { int s = atoi(arg); @@ -2021,6 +2048,7 @@ return NULL; } +/*ARGSUSED1*/ static const char *set_user(cmd_parms *cmd, void *dummy, char *arg) { #ifdef WIN32 @@ -2068,6 +2096,7 @@ return NULL; } +/*ARGSUSED1*/ static const char *set_group(cmd_parms *cmd, void *dummy, char *arg) { const char *err = ap_check_cmd_context(cmd, NOT_IN_DIR_LOC_FILE|NOT_IN_LIMIT); @@ -2093,6 +2122,7 @@ return NULL; } +/*ARGSUSED1*/ static const char *set_server_root(cmd_parms *cmd, void *dummy, char *arg) { const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); @@ -2114,6 +2144,7 @@ return NULL; } +/*ARGSUSED1*/ static const char *set_timeout(cmd_parms *cmd, void *dummy, char *arg) { const char *err = ap_check_cmd_context(cmd, NOT_IN_DIR_LOC_FILE|NOT_IN_LIMIT); @@ -2125,6 +2156,7 @@ return NULL; } +/*ARGSUSED1*/ static const char *set_keep_alive_timeout(cmd_parms *cmd, void *dummy, char *arg) { @@ -2137,6 +2169,7 @@ return NULL; } +/*ARGSUSED1*/ static const char *set_keep_alive(cmd_parms *cmd, void *dummy, char *arg) { const char *err = ap_check_cmd_context(cmd, NOT_IN_DIR_LOC_FILE|NOT_IN_LIMIT); @@ -2156,6 +2189,7 @@ return NULL; } +/*ARGSUSED1*/ static const char *set_keep_alive_max(cmd_parms *cmd, void *dummy, char *arg) { const char *err = ap_check_cmd_context(cmd, NOT_IN_DIR_LOC_FILE|NOT_IN_LIMIT); @@ -2167,6 +2201,7 @@ return NULL; } +/*ARGSUSED1*/ static const char *set_pidfile(cmd_parms *cmd, void *dummy, char *arg) { const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); @@ -2181,6 +2216,7 @@ return NULL; } +/*ARGSUSED1*/ static const char *set_scoreboard(cmd_parms *cmd, void *dummy, char *arg) { const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); @@ -2192,6 +2228,7 @@ return NULL; } +/*ARGSUSED1*/ static const char *set_lockfile(cmd_parms *cmd, void *dummy, char *arg) { const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); @@ -2237,6 +2274,7 @@ return NULL; } +/*ARGSUSED1*/ static const char *set_serverpath(cmd_parms *cmd, void *dummy, char *arg) { const char *err = ap_check_cmd_context(cmd, NOT_IN_DIR_LOC_FILE|NOT_IN_LIMIT); @@ -2245,7 +2283,7 @@ } cmd->server->path = arg; - cmd->server->pathlen = strlen(arg); + cmd->server->pathlen = ap_strlen(arg); return NULL; } @@ -2283,6 +2321,7 @@ return NULL; } +/*ARGSUSED*/ static const char *set_daemons_to_start(cmd_parms *cmd, void *dummy, char *arg) { #ifdef WIN32 @@ -2300,6 +2339,7 @@ return NULL; } +/*ARGSUSED1*/ static const char *set_min_free_servers(cmd_parms *cmd, void *dummy, char *arg) { const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); @@ -2318,6 +2358,7 @@ return NULL; } +/*ARGSUSED1*/ static const char *set_max_free_servers(cmd_parms *cmd, void *dummy, char *arg) { const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); @@ -2329,6 +2370,7 @@ return NULL; } +/*ARGSUSED1*/ static const char *set_server_limit (cmd_parms *cmd, void *dummy, char *arg) { const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); @@ -2352,6 +2394,7 @@ return NULL; } +/*ARGSUSED1*/ static const char *set_max_requests(cmd_parms *cmd, void *dummy, char *arg) { const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); @@ -2363,6 +2406,7 @@ return NULL; } +/*ARGSUSED1*/ static const char *set_threads(cmd_parms *cmd, void *dummy, char *arg) { const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); if (err != NULL) { @@ -2386,6 +2430,7 @@ return NULL; } +/*ARGSUSED1*/ static const char *set_excess_requests(cmd_parms *cmd, void *dummy, char *arg) { const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); @@ -2455,6 +2500,7 @@ #endif #if !defined (RLIMIT_CPU) || !(defined (RLIMIT_DATA) || defined (RLIMIT_VMEM) || defined(RLIMIT_AS)) || !defined (RLIMIT_NPROC) +/*ARGSUSED1*/ static const char *no_set_limit(cmd_parms *cmd, core_dir_config *conf, char *arg, char *arg2) { @@ -2497,6 +2543,7 @@ } #endif +/*ARGSUSED1*/ static const char *set_bind_address(cmd_parms *cmd, void *dummy, char *arg) { const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); @@ -2521,11 +2568,14 @@ } #endif -static const char *set_listener(cmd_parms *cmd, void *dummy, char *ips) +/*ARGSUSED1*/ +static const char *set_listener(cmd_parms *cmd, void *dummy, char *ips, + char *cpustr) { listen_rec *new; char *ports; unsigned short port; + int cpu; const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); if (err != NULL) { @@ -2546,6 +2596,14 @@ ports = ips; } + cpu = -1; + if (cpustr) { + if (ap_isdigit(*cpustr)) + cpu = atoi(cpustr); + if (cpu < 0) + return "Optional CPU id must be positive number"; + } + new=ap_pcalloc(cmd->pool, sizeof(listen_rec)); new->local_addr.sin_family = AF_INET; if (ports == ips) { /* no address */ @@ -2561,11 +2619,16 @@ new->local_addr.sin_port = htons(port); new->fd = -1; new->used = 0; + new->unique = new->local_addr.sin_addr.s_addr != htonl(INADDR_ANY); +#ifdef SINGLE_LISTEN_UNSERIALIZED_ACCEPT + new->cpu = cpu; +#endif new->next = ap_listeners; ap_listeners = new; return NULL; } +/*ARGSUSED1*/ static const char *set_listenbacklog(cmd_parms *cmd, void *dummy, char *arg) { int b; @@ -2583,6 +2646,7 @@ return NULL; } +/*ARGSUSED1*/ static const char *set_coredumpdir (cmd_parms *cmd, void *dummy, char *arg) { struct stat finfo; @@ -2600,6 +2664,7 @@ return NULL; } +/*ARGSUSED1*/ static const char *include_config (cmd_parms *cmd, void *dummy, char *name) { name = ap_server_root_relative(cmd->pool, name); @@ -2609,6 +2674,7 @@ return NULL; } +/*ARGSUSED1*/ static const char *set_loglevel(cmd_parms *cmd, void *dummy, const char *arg) { char *str; @@ -2714,6 +2780,7 @@ * string. */ +/*ARGSUSED1*/ static const char *set_serv_tokens(cmd_parms *cmd, void *dummy, char *arg) { const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); @@ -2740,6 +2807,7 @@ return NULL; } +/*ARGSUSED1*/ static const char *set_limit_req_line(cmd_parms *cmd, void *dummy, char *arg) { const char *err = ap_check_cmd_context(cmd, @@ -2763,6 +2831,7 @@ return NULL; } +/*ARGSUSED1*/ static const char *set_limit_req_fieldsize(cmd_parms *cmd, void *dummy, char *arg) { @@ -2788,6 +2857,7 @@ return NULL; } +/*ARGSUSED1*/ static const char *set_limit_req_fields(cmd_parms *cmd, void *dummy, char *arg) { const char *err = ap_check_cmd_context(cmd, @@ -2819,10 +2889,38 @@ * Instead we have an idiotic define in httpd.h that prevents * it from being used even when it is available. Sheesh. */ - conf->limit_req_body = (unsigned long)strtol(arg, (char **)NULL, 10); + conf->limit_req_body = (ap_uint32)strtol(arg, (char **)NULL, 10); return NULL; } +/*ARGSUSED1*/ +static const char *set_qsc_enabled(cmd_parms *cmd, void *dummy, int arg) +{ + const char *err; + + err = ap_check_cmd_context(cmd, GLOBAL_ONLY); +#ifdef USE_QSC + if (err == NULL) + ap_qsc_enabled = arg != 0; +#endif + + return err; +} + +/*ARGSUSED1*/ +static const char *set_single_listen(cmd_parms *cmd, void *dummy, int arg) +{ + const char *err; + + err = ap_check_cmd_context(cmd, GLOBAL_ONLY); +#ifdef SINGLE_LISTEN_UNSERIALIZED_ACCEPT + if (err == NULL) + ap_single_listen = arg != 0; +#endif + + return err; +} + #ifdef WIN32 static const char *set_interpreter_source(cmd_parms *cmd, core_dir_config *d, char *arg) @@ -2988,10 +3086,10 @@ "authentication directives when accessed using specified HTTP methods" }, { "", endlimit_section, NULL, OR_ALL, NO_ARGS, "Marks end of " }, -{ "", endlimit_section, (void*)1, OR_ALL, NO_ARGS, +{ "", endlimit_section, (void*) (ap_ptr) 1, OR_ALL, NO_ARGS, "Marks end of " }, { "" }, -{ "" }, -{ "" }, -{ "" }, @@ -3144,8 +3242,8 @@ { "ThreadStackSize", set_threadstacksize, NULL, RSRC_CONF, TAKE1, "Stack size each created thread will use."}, #endif -{ "Listen", set_listener, NULL, RSRC_CONF, TAKE1, - "A port number or a numeric IP address and a port number"}, +{ "Listen", set_listener, NULL, RSRC_CONF, TAKE12, + "A port number or a numeric IP address and a port number, and an optional CPU id"}, { "SendBufferSize", set_send_buffer_size, NULL, RSRC_CONF, TAKE1, "Send buffer size in bytes"}, { "AddModule", add_module_command, NULL, RSRC_CONF, ITERATE, @@ -3187,6 +3285,20 @@ (void*)XtOffsetOf(core_dir_config, limit_req_body), OR_ALL, TAKE1, "Limit (in bytes) on maximum size of request message body" }, +{ "QSC", set_qsc_enabled, NULL, RSRC_CONF, FLAG, +#ifdef USE_QSC + "Enable/disable Quick Shortcut Cache" +#else + "Ignored because !USE_QSC" +#endif +}, +{ "SingleListen", set_single_listen, NULL, RSRC_CONF, FLAG, +#ifdef SINGLE_LISTEN_UNSERIALIZED_ACCEPT + "Force each child to server a single Listen address" +#else + "Ignored because !SINGLE_LISTEN_UNSERIALIZED_ACCEPT" +#endif +}, /* EBCDIC Conversion directives: */ #ifdef CHARSET_EBCDIC @@ -3254,6 +3366,7 @@ return OK; } +/*ARGSUSED0*/ static int do_nothing(request_rec *r) { return OK; } #ifdef CHARSET_EBCDIC @@ -3541,8 +3654,11 @@ (core_dir_config *)ap_get_module_config(r->per_dir_config, &core_module); int rangestatus, errstatus; FILE *f; +#ifdef USE_DIRECT_IO + struct dioattr da; +#endif #ifdef USE_MMAP_FILES - caddr_t mm; + caddr_t mm = (caddr_t) (ap_ptr) -1; #endif /* This handler has no use for a request body (yet), but we still @@ -3577,6 +3693,12 @@ return METHOD_NOT_ALLOWED; } + if (ap_oversized_file(r->finfo.st_size)) { + ap_log_rerror(APLOG_MARK, APLOG_ERR | APLOG_NOERRNO, r, + "%s: File too large", r->filename); + return HTTP_NOT_IMPLEMENTED; + } + #if defined(OS2) || defined(WIN32) || defined(NETWARE) /* Need binary mode for OS/2 */ f = ap_pfopen(r->pool, r->filename, "rb"); @@ -3595,10 +3717,33 @@ ap_set_etag(r); ap_table_setn(r->headers_out, "Accept-Ranges", "bytes"); if (((errstatus = ap_meets_conditions(r)) != OK) - || (errstatus = ap_set_content_length(r, r->finfo.st_size))) { + || (errstatus = ap_set_content_length(r, (ap_int32) r->finfo.st_size))) { return errstatus; } +#ifdef USE_DIRECT_IO + /* + * Use direct I/O (system DMAs data directly fromd disk into properly + * aligned user buffer, bypassing the system's buffer cache) for + * large files to avoid voiding valid buffer cache entries for small + * files. Use direct I/O only when actually sending the body + * (!r->header_only), when no content MD5 digest is requested, and + * when no data ranges are requested. Could handle content digest + * and ranges too but that would further complicate this routine. + */ + da.d_mem = 0;; + if (r->finfo.st_size >= DIRECT_THRESHOLD && !r->header_only && + (d->contdent_md5 & 1) == 0) { + if (fcntl (fileno (f), F_DIOINFO, &da) == 0) { + if (da.d_mem) + goto direct; + } else + ap_log_rerror (APLOG_MARK, APLOG_ERR, r, + "default_handler: fcntl (F_DIOINFO) failed on %s", + r->filename); + } +#endif /* USE_DIRECT_IO */ + #ifdef USE_MMAP_FILES ap_block_alarms(); if ((r->finfo.st_size >= MMAP_THRESHOLD) @@ -3608,16 +3753,13 @@ * file mmapped */ mm = mmap(NULL, r->finfo.st_size, PROT_READ, MAP_PRIVATE, fileno(f), 0); - if (mm == (caddr_t)-1) { + if (mm == (caddr_t) (ap_ptr) -1) { ap_log_rerror(APLOG_MARK, APLOG_CRIT, r, "default_handler: mmap failed: %s", r->filename); } } - else { - mm = (caddr_t)-1; - } - if (mm == (caddr_t)-1) { + if (mm == (caddr_t) (ap_ptr) -1) { ap_unblock_alarms(); #endif @@ -3633,16 +3775,24 @@ } #endif /* CHARSET_EBCDIC */ +#ifdef USE_DIRECT_IO +direct: +#endif rangestatus = ap_set_byterange(r); ap_send_http_header(r); if (!r->header_only) { if (!rangestatus) { +#ifdef USE_DIRECT_IO + if (da.d_mem) + ap_send_fd_direct(f, r, &da); + else +#endif ap_send_fd(f, r); } else { - long offset, length; + ap_int32 offset, length; while (ap_each_byterange(r, &offset, &length)) { /* * Non zero returns are more portable than checking @@ -3651,7 +3801,7 @@ if (fseek(f, offset, SEEK_SET)) { ap_log_error(APLOG_MARK, APLOG_ERR, r->server, "Failed to fseek for byterange (%ld, %ld)", - offset, length); + (long) offset, (long) length); } else { ap_send_fd_length(f, r, length); @@ -3688,7 +3838,7 @@ ap_send_mmap(mm, r, 0, r->finfo.st_size); } else { - long offset, length; + ap_int32 offset, length; while (ap_each_byterange(r, &offset, &length)) { ap_send_mmap(mm, r, offset, length); } diff -urN apache_1.3.20/src/main/http_log.c-orig apache_1.3.20/src/main/http_log.c --- apache_1.3.20/src/main/http_log.c-orig Mon Jan 15 12:04:59 2001 +++ apache_1.3.20/src/main/http_log.c Sat Jun 30 23:53:25 2001 @@ -156,6 +156,7 @@ {NULL, -1}, }; +/*ARGSUSED1*/ static int error_log_child(void *cmd, child_info *pinfo) { /* Child process code for 'ErrorLog "|..."'; @@ -309,6 +310,7 @@ dup2(fileno(s->error_log), STDERR_FILENO); } +/*PRINTFLIKE6*/ static void log_error_core(const char *file, int line, int level, const server_rec *s, const request_rec *r, const char *fmt, va_list args) @@ -472,6 +474,7 @@ #endif } +/*PRINTFLIKE5*/ API_EXPORT(void) ap_log_error(const char *file, int line, int level, const server_rec *s, const char *fmt, ...) { @@ -482,6 +485,7 @@ va_end(args); } +/*PRINTFLIKE5*/ API_EXPORT(void) ap_log_rerror(const char *file, int line, int level, const request_rec *r, const char *fmt, ...) { @@ -561,12 +565,14 @@ ap_log_error(APLOG_MARK, APLOG_ERR, s, "%s", err); } +/*ARGSUSED0*/ API_EXPORT(void) ap_log_unixerr(const char *routine, const char *file, const char *msg, server_rec *s) { ap_log_error(file, 0, APLOG_ERR, s, "%s", msg); } +/*PRINTFLIKE2*/ API_EXPORT(void) ap_log_printf(const server_rec *s, const char *fmt, ...) { va_list args; @@ -642,6 +648,7 @@ } +/*ARGSUSED2*/ static void piped_log_maintenance(int reason, void *data, ap_wait_t status) { piped_log *pl = data; diff -urN apache_1.3.20/src/main/http_main.c-orig apache_1.3.20/src/main/http_main.c --- apache_1.3.20/src/main/http_main.c-orig Thu Apr 12 12:49:26 2001 +++ apache_1.3.20/src/main/http_main.c Sun Jul 1 01:02:24 2001 @@ -105,11 +105,6 @@ #include "scoreboard.h" #include "multithread.h" #include -#ifdef USE_SHMGET_SCOREBOARD -#include -#include -#include -#endif #ifdef SecureWare #include #include @@ -260,6 +255,12 @@ int ap_listenbacklog; int ap_dump_settings = 0; API_VAR_EXPORT int ap_extended_status = 0; +#ifdef USE_QSC +int ap_qsc_enabled; +#endif +#ifdef SINGLE_LISTEN_UNSERIALIZED_ACCEPT +int ap_single_listen; +#endif /* * The max child slot ever assigned, preserved across restarts. Necessary @@ -302,7 +303,7 @@ #ifndef NETWARE static JMP_BUF APACHE_TLS jmpbuffer; #endif -static int sd; +static listen_rec *listener; static fd_set listenfds; static int listenmaxfd; #ifndef NETWARE @@ -382,6 +383,7 @@ * server version string to a known value and [re]enables modifications * (which are disabled by configuration completion). */ +/*ARGSUSED0*/ static void reset_version(void *dummy) { version_locked = 0; @@ -422,6 +424,7 @@ * This routine adds the real server base identity to the version string, * and then locks out changes until the next reconfig. */ +#include "aap_version.h" static void ap_set_version(void) { if (ap_server_tokens == SrvTk_PRODUCT_ONLY) { @@ -440,6 +443,10 @@ if (ap_server_tokens != SrvTk_FULL) { version_locked++; } + +#if defined(AAP_VERSION) && !defined(NO_AAP_VERSION) + ap_add_version_component(AAP_VERSION); +#endif } #ifndef NETWARE @@ -575,14 +582,14 @@ #include -static pthread_mutex_t *accept_mutex = (void *)(caddr_t) -1; +static pthread_mutex_t *accept_mutex = (void *) (ap_ptr) -1; static int have_accept_mutex; static sigset_t accept_block_mask; static sigset_t accept_previous_mask; static void accept_mutex_child_cleanup(void *foo) { - if (accept_mutex != (void *)(caddr_t)-1 + if (accept_mutex != (void *) (ap_ptr) -1 && have_accept_mutex) { pthread_mutex_unlock(accept_mutex); } @@ -595,11 +602,11 @@ static void accept_mutex_cleanup(void *foo) { - if (accept_mutex != (void *)(caddr_t)-1 + if (accept_mutex != (void *) (ap_ptr) -1 && munmap((caddr_t) accept_mutex, sizeof(*accept_mutex))) { perror("munmap"); } - accept_mutex = (void *)(caddr_t)-1; + accept_mutex = (void *) (ap_ptr) -1; } static void accept_mutex_init(pool *p) @@ -1027,14 +1034,15 @@ #endif /* On some architectures it's safe to do unserialized accept()s in the single - * Listen case. But it's never safe to do it in the case where there's + * Listen case. But it's never(*) safe to do it in the case where there's * multiple Listen statements. Define SINGLE_LISTEN_UNSERIALIZED_ACCEPT * when it's safe in the single Listen case. + * (*) multiple Listen unserialized accepts are safe on Irix 6.5 */ #ifdef SINGLE_LISTEN_UNSERIALIZED_ACCEPT -#define SAFE_ACCEPT(stmt) do {if(ap_listeners->next != ap_listeners) {stmt;}} while(0) +#define SAFE_ACCEPT(stmt) {if(!ap_single_listen && ap_listeners->next != ap_listeners) {stmt;}} #else -#define SAFE_ACCEPT(stmt) do {stmt;} while(0) +#define SAFE_ACCEPT(stmt) {stmt;} #endif static void usage(char *bin) @@ -1048,7 +1056,7 @@ #ifdef WIN32 fprintf(stderr, "Usage: %s [-D name] [-d directory] [-f file] [-n service]\n", bin); fprintf(stderr, " %s [-C \"directive\"] [-c \"directive\"] [-k signal]\n", pad); - fprintf(stderr, " %s [-v] [-V] [-h] [-l] [-L] [-S] [-t] [-T]\n", pad); + fprintf(stderr, " %s [-v] [-V] [-h] [-l] [-L] [-S] [-t] [-T]\n", pad); #else /* !WIN32 */ #ifdef SHARED_CORE fprintf(stderr, "Usage: %s [-R directory] [-D name] [-d directory] [-f file]\n", bin); @@ -1056,7 +1064,7 @@ fprintf(stderr, "Usage: %s [-D name] [-d directory] [-f file]\n", bin); #endif fprintf(stderr, " %s [-C \"directive\"] [-c \"directive\"]\n", pad); - fprintf(stderr, " %s [-v] [-V] [-h] [-l] [-L] [-S] [-t] [-T]\n", pad); + fprintf(stderr, " %s [-v] [-V] [-h] [-l] [-L] [-S] [-t] [-T] [-i]\n", pad); fprintf(stderr, "Options:\n"); #ifdef SHARED_CORE fprintf(stderr, " -R directory : specify an alternate location for shared object files\n"); @@ -1086,6 +1094,8 @@ fprintf(stderr, " -k install | -i: install an Apache service\n"); fprintf(stderr, " -k config : reconfigure an installed Apache service\n"); fprintf(stderr, " -k uninstall | -u: uninstall an Apache service\n"); +#else + fprintf(stderr, " -i : do not daemonize\n"); #endif #if defined(NETWARE) @@ -1149,9 +1159,13 @@ #endif +/*ARGSUSED*/ static void timeout(int sig) { +#if 0 void *dirconf; +#endif + #ifdef NETWARE get_tsd #endif @@ -1167,10 +1181,12 @@ ap_longjmp(jmpbuffer, 1); } +#if 0 if (timeout_req != NULL) dirconf = timeout_req->per_dir_config; else dirconf = current_conn->server->lookup_defaults; +#endif if (!current_conn->keptalive) { ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_INFO, current_conn->server, "[client %s] %s timed out", @@ -1304,6 +1320,9 @@ } #else if (alarm_fn && x && fn != alarm_fn) { +#if defined(IRIX) && _MIPS_SIM != _ABIO32 +#pragma mips_frequency_hint NEVER +#endif ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_DEBUG, NULL, "ap_set_callback_and_alarm: possible nested timer!"); } @@ -1312,6 +1331,9 @@ old = alarm(x); #else if (child_timeouts) { +#if defined(IRIX) && _MIPS_SIM != _ABIO32 +#pragma mips_frequency_hint NEVER +#endif old = alarm(x); } else { @@ -1409,6 +1431,7 @@ ap_set_callback_and_alarm(timeout, r->server->timeout); } +/*ARGSUSED0*/ API_EXPORT(void) ap_kill_timeout(request_rec *dummy) { #ifdef NETWARE @@ -1683,6 +1706,232 @@ } #endif +#ifdef FAST_TIME +/* + * A separate process -- the timekeeper -- is created to update a shared + * time-of-day variable in the scoreboard. The timekeeper is managed + * via the other-child registry. This changes the number of calls to + * the time() syscall from two-per-request to one-a-second which + * improves performance when handling many requests per second. + */ + +static pid_t timekeeper_pid = -1; + +/* + * Timekeeper process main loop. + */ +static void +keep_time(void) +{ + signal(SIGHUP, SIG_IGN); /* restarts are explicit via SIGTERM */ + signal(SIGTERM, SIG_DFL); + signal(SIGUSR1, SIG_IGN); + + for (;;) { + struct timeval tv; + + /* update the shared time of day */ + ap_scoreboard_image->global.time = time(NULL); + + /* wait one second for the time to change */ + tv.tv_sec = 1; + tv.tv_usec = 0; + select(0, NULL, NULL, NULL, &tv); + } +} + +/* + * Other-child maintenance callback. + */ +/*ARGSUSED1*/ +static void +timekeeper_maintenance(int reason, void *data, ap_wait_t status) +{ + switch (reason) { + case OC_REASON_DEATH: + case OC_REASON_LOST: + case OC_REASON_RESTART: + /* kill extant timekeeper and allow a new one to take over */ + kill(timekeeper_pid, SIGKILL); + timekeeper_pid = -1; + + /* unregister it */ + ap_unregister_other_child(&ap_scoreboard_image->global.time); + + /* alert everybody that they must now use time() directly */ + ap_scoreboard_image->global.time = 0; + break; + } +} + +/* + * Start a timekeeper thread if one is not already running. The + * scoreboard must already be initialized. + */ +static void +start_timekeeper(void) +{ + ap_assert(ap_scoreboard_image); + + if (!one_process && timekeeper_pid == -1) { + pid_t pid = fork(); + switch (pid) { + case -1: + ap_log_error(APLOG_MARK, APLOG_ERR, server_conf, "fork: Cannot start timekeeper"); + break; + case 0: + keep_time(); + exit(0); + break; + default: + timekeeper_pid = pid; + ap_register_other_child(pid, timekeeper_maintenance, + &ap_scoreboard_image->global.time, -1); + } + } +} +#endif + +#ifdef HAVE_MMAP +/*ARGSUSED*/ +caddr_t +ap_map_anonymous(pool *p, caddr_t addr, size_t size) +{ + caddr_t m = (caddr_t) (ap_ptr) -1; + +#ifdef MAP_ANON +/* BSD style */ +#ifdef CONVEXOS11 + { + unsigned int len = size; + + m = mmap(addr, &len, PROT_READ | PROT_WRITE, MAP_ANON | MAP_SHARED, + NOFD, 0); + if (m == (caddr_t) (ap_ptr) -1) { + perror("mmap"); + fprintf(stderr, "%s: Could not mmap memory\n", ap_server_argv0); + } + } +#elif defined(MAP_TMPFILE) + { + char *mfile = ap_pstrdup(p, "/tmp/apache_shmem_XXXX"); + int fd = mkstemp(mfile); + if (fd >= 0) { + m = mmap(addr, size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); + if (m == (caddr_t) (ap_ptr) -1) { + perror(mfile); + fprintf(stderr, "%s: Could not mmap %s\n", ap_server_argv0, mfile); + } + close(fd); + } else { + perror(mfile); + fprintf(stderr, "%s: Could not open %s\n", ap_server_argv0, mfile); + } + unlink(mfile); + } +#else + m = mmap(addr, size, PROT_READ | PROT_WRITE, MAP_ANON | MAP_SHARED, -1, 0); + if (m == (caddr_t) (ap_ptr) -1) { + perror("mmap"); + fprintf(stderr, "%s: Could not mmap memory\n", ap_server_argv0); + } +#endif +#else +/* Sun style */ + int fd = open("/dev/zero", O_RDWR); + if (fd >= 0) { + m = mmap(addr, size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); + if (m == (caddr_t) (ap_ptr) -1) { + perror("/dev/zero"); + fprintf(stderr, "%s: Could not mmap memory\n", ap_server_argv0); + } + close(fd); + } else { + perror("/dev/zero"); + fprintf(stderr, "%s: Could not open /dev/zero\n", ap_server_argv0); + } +#endif + + return m; +} +#endif + +#ifdef HAVE_SHMGET +/*ARGSUSED*/ +caddr_t +ap_share_anonymous(pool *p, caddr_t addr, size_t size) +{ + caddr_t m = (caddr_t) (ap_ptr) -1; + int shmid; + + shmid = shmget(IPC_PRIVATE, size, IPC_CREAT | SHM_R | SHM_W); + if (shmid >= 0) { +#ifdef MOVEBREAK + void *obrk; +#endif + + ap_log_error(APLOG_MARK, APLOG_INFO | APLOG_NOERRNO, server_conf, + "created shared memory segment #%d", shmid); + +#ifdef MOVEBREAK + /* + * Some SysV systems place the shared segment WAY too close + * to the dynamic memory break point (sbrk(0)). This severely + * limits the use of malloc/sbrk in the program since sbrk will + * refuse to move past that point. + * + * To get around this, we move the break point "way up there", + * attach the segment and then move break back down. Ugly + */ + if ((obrk = sbrk(MOVEBREAK)) == (void *) (ap_ptr) -1) { + ap_log_error(APLOG_MARK, APLOG_ERR, server_conf, + "sbrk() could not move break"); + } +#endif + + m = shmat(shmid, addr, 0); + if (m != (caddr_t) (ap_ptr) -1) { + struct shmid_ds shmbuf; + + if (shmctl(shmid, IPC_STAT, &shmbuf) == 0) { + shmbuf.shm_perm.uid = ap_user_id; + shmbuf.shm_perm.gid = ap_group_id; + if (shmctl(shmid, IPC_SET, &shmbuf) < 0) + ap_log_error(APLOG_MARK, APLOG_ERR, server_conf, + "shmctl(%d, IPC_SET, uid %d gid %d)", shmid, + ap_user_id, ap_group_id); + } else + ap_log_error(APLOG_MARK, APLOG_ERR, server_conf, + "shmctl(%d, IPC_STAT)", shmid); + } else + ap_log_error(APLOG_MARK, APLOG_ERR, server_conf, "shmat(%d, %p)", + shmid, addr); + + if (shmctl(shmid, IPC_RMID, NULL) < 0) + ap_log_error(APLOG_MARK, APLOG_WARNING, server_conf, + "shmctl(%d, IPC_RMID)", shmid); + +#ifdef MOVEBREAK + if (obrk != (void *) (ap_ptr) -1 && sbrk(-(MOVEBREAK)) == (void *) (ap_ptr) -1) + ap_log_error(APLOG_MARK, APLOG_ERR, server_conf, + "sbrk() could not restore break"); +#endif + } else { + ap_log_error(APLOG_MARK, APLOG_ERR, server_conf, + "shmget(IPC_PRIVATE, %ld)", (long) size); +#ifdef LINUX + if (errno == ENOSYS) + ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, server_conf, + "Your kernel was built without CONFIG_SYSVIPC\n" + "%s: Please consult the Apache FAQ for details", + ap_server_argv0); +#endif + } + + return m; +} +#endif + /***************************************************************** * * Dealing with the scoreboard... a lot of these variables are global @@ -1878,18 +2127,18 @@ ap_scoreboard_image->global.running_generation = 0; } +/*ARGSUSED*/ static void reopen_scoreboard(pool *p) { } #elif defined(USE_MMAP_SCOREBOARD) +/*ARGSUSED0*/ static void setup_shared_mem(pool *p) { caddr_t m; -#if defined(MAP_ANON) -/* BSD style */ #ifdef CONVEXOS11 /* * 9-Aug-97 - Jeff Venters (venters@convex.hp.com) @@ -1901,155 +2150,37 @@ * Also, the length requires a pointer as the actual length is * returned (rounded up to a page boundary). */ - { - unsigned len = SCOREBOARD_SIZE; - - m = mmap((caddr_t) 0xC0000000, &len, - PROT_READ | PROT_WRITE, MAP_ANON | MAP_SHARED, NOFD, 0); - } -#elif defined(MAP_TMPFILE) - { - char mfile[] = "/tmp/apache_shmem_XXXX"; - int fd = mkstemp(mfile); - if (fd == -1) { - perror("open"); - fprintf(stderr, "%s: Could not open %s\n", ap_server_argv0, mfile); - exit(APEXIT_INIT); - } - m = mmap((caddr_t) 0, SCOREBOARD_SIZE, - PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); - if (m == (caddr_t) - 1) { - perror("mmap"); - fprintf(stderr, "%s: Could not mmap %s\n", ap_server_argv0, mfile); - exit(APEXIT_INIT); - } - close(fd); - unlink(mfile); - } + m = ap_map_anonymous(p, 0xC0000000, SCOREBOARD_SIZE); #else - m = mmap((caddr_t) 0, SCOREBOARD_SIZE, - PROT_READ | PROT_WRITE, MAP_ANON | MAP_SHARED, -1, 0); + m = ap_map_anonymous(p, 0, SCOREBOARD_SIZE); #endif - if (m == (caddr_t) - 1) { - perror("mmap"); - fprintf(stderr, "%s: Could not mmap memory\n", ap_server_argv0); - exit(APEXIT_INIT); - } -#else -/* Sun style */ - int fd; - fd = open("/dev/zero", O_RDWR); - if (fd == -1) { - perror("open"); - fprintf(stderr, "%s: Could not open /dev/zero\n", ap_server_argv0); + if (m == (caddr_t) (ap_ptr) -1) exit(APEXIT_INIT); - } - m = mmap((caddr_t) 0, SCOREBOARD_SIZE, - PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); - if (m == (caddr_t) - 1) { - perror("mmap"); - fprintf(stderr, "%s: Could not mmap /dev/zero\n", ap_server_argv0); - exit(APEXIT_INIT); - } - close(fd); -#endif + ap_scoreboard_image = (scoreboard *) m; ap_scoreboard_image->global.running_generation = 0; } +/*ARGSUSED0*/ static void reopen_scoreboard(pool *p) { } #elif defined(USE_SHMGET_SCOREBOARD) -static key_t shmkey = IPC_PRIVATE; -static int shmid = -1; - static void setup_shared_mem(pool *p) { - struct shmid_ds shmbuf; -#ifdef MOVEBREAK - char *obrk; -#endif - - if ((shmid = shmget(shmkey, SCOREBOARD_SIZE, IPC_CREAT | SHM_R | SHM_W)) == -1) { -#ifdef LINUX - if (errno == ENOSYS) { - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_EMERG, server_conf, - "Your kernel was built without CONFIG_SYSVIPC\n" - "%s: Please consult the Apache FAQ for details", - ap_server_argv0); - } -#endif - ap_log_error(APLOG_MARK, APLOG_EMERG, server_conf, - "could not call shmget"); - exit(APEXIT_INIT); - } - - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_INFO, server_conf, - "created shared memory segment #%d", shmid); - -#ifdef MOVEBREAK - /* - * Some SysV systems place the shared segment WAY too close - * to the dynamic memory break point (sbrk(0)). This severely - * limits the use of malloc/sbrk in the program since sbrk will - * refuse to move past that point. - * - * To get around this, we move the break point "way up there", - * attach the segment and then move break back down. Ugly - */ - if ((obrk = sbrk(MOVEBREAK)) == (char *) -1) { - ap_log_error(APLOG_MARK, APLOG_ERR, server_conf, - "sbrk() could not move break"); - } -#endif + caddr_t m; -#define BADSHMAT ((scoreboard *)(-1)) - if ((ap_scoreboard_image = (scoreboard *) shmat(shmid, 0, 0)) == BADSHMAT) { - ap_log_error(APLOG_MARK, APLOG_EMERG, server_conf, "shmat error"); - /* - * We exit below, after we try to remove the segment - */ - } - else { /* only worry about permissions if we attached the segment */ - if (shmctl(shmid, IPC_STAT, &shmbuf) != 0) { - ap_log_error(APLOG_MARK, APLOG_ERR, server_conf, - "shmctl() could not stat segment #%d", shmid); - } - else { - shmbuf.shm_perm.uid = ap_user_id; - shmbuf.shm_perm.gid = ap_group_id; - if (shmctl(shmid, IPC_SET, &shmbuf) != 0) { - ap_log_error(APLOG_MARK, APLOG_ERR, server_conf, - "shmctl() could not set segment #%d", shmid); - } - } - } - /* - * We must avoid leaving segments in the kernel's - * (small) tables. - */ - if (shmctl(shmid, IPC_RMID, NULL) != 0) { - ap_log_error(APLOG_MARK, APLOG_WARNING, server_conf, - "shmctl: IPC_RMID: could not remove shared memory segment #%d", - shmid); - } - if (ap_scoreboard_image == BADSHMAT) /* now bailout */ + m = ap_share_anonymous(p, 0, SCOREBOARD_SIZE); + if (m == (caddr_t) (ap_ptr) -1) exit(APEXIT_INIT); -#ifdef MOVEBREAK - if (obrk == (char *) -1) - return; /* nothing else to do */ - if (sbrk(-(MOVEBREAK)) == (char *) -1) { - ap_log_error(APLOG_MARK, APLOG_ERR, server_conf, - "sbrk() could not move break back"); - } -#endif + ap_scoreboard_image = (scoreboard *) m; ap_scoreboard_image->global.running_generation = 0; } +/*ARGSUSED*/ static void reopen_scoreboard(pool *p) { } @@ -2158,6 +2289,9 @@ } memset(ap_scoreboard_image, 0, SCOREBOARD_SIZE); ap_scoreboard_image->global.running_generation = running_gen; +#ifdef FAST_TIME + start_timekeeper(); +#endif #else ap_scoreboard_image = &_scoreboard_image; ap_scoreboard_fname = ap_server_root_relative(p, ap_scoreboard_fname); @@ -2190,7 +2324,7 @@ ap_inline void ap_sync_scoreboard_image(void) { #ifdef SCOREBOARD_FILE - lseek(scoreboard_fd, 0L, 0); + lseek(scoreboard_fd, 0, 0); force_read(scoreboard_fd, ap_scoreboard_image, sizeof(*ap_scoreboard_image)); #endif } @@ -2202,11 +2336,12 @@ return (ap_scoreboard_image ? 1 : 0); } +/*ARGSUSED*/ static ap_inline void put_scoreboard_info(int child_num, short_score *new_score_rec) { #ifdef SCOREBOARD_FILE - lseek(scoreboard_fd, (long) child_num * sizeof(short_score), 0); + lseek(scoreboard_fd, (off_t) child_num * sizeof(short_score), 0); force_write(scoreboard_fd, new_score_rec, sizeof(short_score)); #endif } @@ -2240,8 +2375,12 @@ int old_status; short_score *ss; - if (child_num < 0) + if (child_num < 0) { +#if defined(IRIX) && _MIPS_SIM != _ABIO32 +#pragma mips_frequency_hint NEVER +#endif return -1; + } ap_check_signals(); @@ -2258,6 +2397,9 @@ #endif if (ap_extended_status) { +#if defined(IRIX) && _MIPS_SIM != _ABIO32 +#pragma mips_frequency_hint NEVER +#endif #ifndef OPTIMIZE_TIMEOUTS ss->last_used = time(NULL); #endif @@ -2266,8 +2408,8 @@ * Reset individual counters */ if (status == SERVER_DEAD) { - ss->my_access_count = 0L; - ss->my_bytes_served = 0L; + ss->my_access_count = 0; + ss->my_bytes_served = 0; } ss->conn_count = (unsigned short) 0; ss->conn_bytes = (unsigned long) 0; @@ -2291,6 +2433,9 @@ } } if (status == SERVER_STARTING && r == NULL) { +#if defined(IRIX) && _MIPS_SIM != _ABIO32 +#pragma mips_frequency_hint NEVER +#endif /* clean up the slot's vhostrec pointer (maybe re-used) * and mark the slot as belonging to a new generation. */ @@ -2337,9 +2482,10 @@ #endif /* NO_TIMES */ ss->start_time = (clock_t) 0; #else - if (gettimeofday(&ss->start_time, (struct timezone *) 0) < 0) - ss->start_time.tv_sec = - ss->start_time.tv_usec = 0L; + if (gettimeofday(&ss->start_time, (struct timezone *) 0) < 0) { + ss->start_time.tv_sec = 0; + ss->start_time.tv_usec = 0; + } #endif } else if (status == STOP_PREQUEST) { @@ -2349,11 +2495,12 @@ #endif ss->stop_time = ss->start_time = (clock_t) 0; #else - if (gettimeofday(&ss->stop_time, (struct timezone *) 0) < 0) - ss->stop_time.tv_sec = - ss->stop_time.tv_usec = - ss->start_time.tv_sec = - ss->start_time.tv_usec = 0L; + if (gettimeofday(&ss->stop_time, (struct timezone *) 0) < 0) { + ss->stop_time.tv_sec = 0; + ss->stop_time.tv_usec = 0; + ss->start_time.tv_sec = 0; + ss->start_time.tv_usec = 0; + } #endif } @@ -2363,7 +2510,7 @@ static void increment_counts(int child_num, request_rec *r) { - long int bs = 0; + ap_int32 bs = 0; short_score *ss; ap_sync_scoreboard_image(); @@ -2400,7 +2547,7 @@ { #ifndef MULTITHREAD int i, status; - long int waittime = 1024 * 16; /* in usecs */ + ap_int32 waittime = 1024 * 16; /* in usecs */ struct timeval tv; int waitret, tries; int not_dead_yet; @@ -2764,6 +2911,7 @@ * Connection structures and accounting... */ +/*ARGSUSED0*/ static void just_die(int sig) { /* SIGHUP to child process??? */ /* if alarms are blocked we have to wait to die otherwise we might @@ -2779,6 +2927,7 @@ } } +#ifndef NO_GRACEFUL static int volatile usr1_just_die = 1; static int volatile deferred_die; @@ -2789,6 +2938,7 @@ } deferred_die = 1; } +#endif /* volatile just in case */ static int volatile shutdown_pending; @@ -2901,6 +3051,9 @@ } /* do a graceful restart if graceful == 1 */ +#ifdef NO_GRACEFUL +/*ARGSUSED*/ +#endif API_EXPORT(void) ap_start_restart(int graceful) { #ifndef WIN32 @@ -2909,12 +3062,15 @@ return; } restart_pending = 1; +#ifndef NO_GRACEFUL is_graceful = graceful; +#endif #else signal_parent(1); /* get the parent process to wake up */ #endif /* WIN32 */ } +/*ARGSUSED0*/ static void sig_term(int sig) { ap_start_shutdown(); @@ -3038,6 +3194,8 @@ * Here follows a long bunch of generic server bookkeeping stuff... */ +int daemonize = 1; + static void detach(void) { #if !defined(WIN32) && !defined(NETWARE) @@ -3047,12 +3205,14 @@ #if !defined(MPE) && !defined(OS2) && !defined(TPF) /* Don't detach for MPE because child processes can't survive the death of the parent. */ - if ((x = fork()) > 0) - exit(0); - else if (x == -1) { - perror("fork"); - fprintf(stderr, "%s: unable to fork new process\n", ap_server_argv0); - exit(1); + if (daemonize) { + if ((x = fork()) > 0) + exit(0); + else if (x == -1) { + perror("fork"); + fprintf(stderr, "%s: unable to fork new process\n", ap_server_argv0); + exit(1); + } } RAISE_SIGSTOP(DETACH); #endif @@ -3082,24 +3242,26 @@ } #endif - /* close out the standard file descriptors */ - if (freopen("/dev/null", "r", stdin) == NULL) { - fprintf(stderr, "%s: unable to replace stdin with /dev/null: %s\n", - ap_server_argv0, strerror(errno)); - /* continue anyhow -- note we can't close out descriptor 0 because we - * have nothing to replace it with, and if we didn't have a descriptor - * 0 the next file would be created with that value ... leading to - * havoc. + if (daemonize) { + /* close out the standard file descriptors */ + if (freopen("/dev/null", "r", stdin) == NULL) { + fprintf(stderr, "%s: unable to replace stdin with /dev/null: %s\n", + ap_server_argv0, strerror(errno)); + /* continue anyhow -- note we can't close out descriptor 0 because we + * have nothing to replace it with, and if we didn't have a descriptor + * 0 the next file would be created with that value ... leading to + * havoc. + */ + } + if (freopen("/dev/null", "w", stdout) == NULL) { + fprintf(stderr, "%s: unable to replace stdout with /dev/null: %s\n", + ap_server_argv0, strerror(errno)); + } + /* stderr is a tricky one, we really want it to be the error_log, + * but we haven't opened that yet. So leave it alone for now and it'll + * be reopened moments later. */ } - if (freopen("/dev/null", "w", stdout) == NULL) { - fprintf(stderr, "%s: unable to replace stdout with /dev/null: %s\n", - ap_server_argv0, strerror(errno)); - } - /* stderr is a tricky one, we really want it to be the error_log, - * but we haven't opened that yet. So leave it alone for now and it'll - * be reopened moments later. - */ #endif /* ndef WIN32 */ } @@ -3216,16 +3378,16 @@ conn->pool = p; conn->local_addr = *saddr; - conn->local_ip = ap_pstrdup(conn->pool, - inet_ntoa(conn->local_addr.sin_addr)); + ap_inet_ntoa(conn->local_addr.sin_addr, conn->local_ip, + &conn->local_ip_len); conn->server = server; /* just a guess for now */ ap_update_vhost_given_ip(conn); conn->base_server = conn->server; conn->client = inout; conn->remote_addr = *remaddr; - conn->remote_ip = ap_pstrdup(conn->pool, - inet_ntoa(conn->remote_addr.sin_addr)); + ap_inet_ntoa(conn->remote_addr.sin_addr, conn->remote_ip, + &conn->remote_ip_len); return conn; } @@ -3264,10 +3426,12 @@ int one = 1; char addr[512]; - if (server->sin_addr.s_addr != htonl(INADDR_ANY)) + if (server->sin_addr.s_addr != htonl(INADDR_ANY)) { + char nbuf[16]; ap_snprintf(addr, sizeof(addr), "address %s port %d", - inet_ntoa(server->sin_addr), ntohs(server->sin_port)); - else + ap_inet_ntoa(server->sin_addr, nbuf, NULL), + ntohs(server->sin_port)); + } else ap_snprintf(addr, sizeof(addr), "port %d", ntohs(server->sin_port)); /* note that because we're about to slack we don't use psocket */ @@ -3562,11 +3726,15 @@ head_listener = ap_listeners; close_unused_listeners(); -#ifdef NO_SERIALIZED_ACCEPT +#if defined(NO_SERIALIZED_ACCEPT) && (!defined(IRIX) || IRIX < 65) /* warn them about the starvation problem if they're using multiple * sockets */ - if (ap_listeners->next != ap_listeners) { + if ( +#ifdef SINGLE_LISTEN_UNSERIALIZED_ACCEPT + !ap_single_listen && +#endif + ap_listeners->next != ap_listeners) { ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_CRIT, NULL, "You cannot use multiple Listens safely on your system, " "proceeding anyway. See src/PORTING, search for " @@ -3684,6 +3852,18 @@ printf(" -D MMAP_SEGMENT_SIZE=%ld\n",(long)MMAP_SEGMENT_SIZE); #endif #endif /*USE_MMAP_FILES*/ +#ifdef USE_DIRECT_IO + printf(" -D USE_DIRECT_IO\n"); +#ifdef DIRECT_THRESHOLD + printf(" -D DIRECT_THRESHOLD=%ld\n", (long) DIRECT_THRESHOLD); +#endif +#ifdef MAX_DIRECT_ALIGN + printf(" -D MAX_DIRECT_ALIGN=%ld\n", (long) MAX_DIRECT_ALIGN); +#endif +#ifdef MAX_DIRECT_BUFSIZE + printf(" -D MAX_DIRECT_BUFSIZE=%ld\n", (long) MAX_DIRECT_BUFSIZE); +#endif +#endif /* USE_DIRECT_IO */ #ifdef NO_WRITEV printf(" -D NO_WRITEV\n"); #endif @@ -3714,12 +3894,56 @@ #ifdef NO_RELIABLE_PIPED_LOGS printf(" -D NO_RELIABLE_PIPED_LOGS\n"); #endif +#ifdef USE_QSC + printf(" -D USE_QSC\n"); +# ifdef QSC_HASH_SIZE + printf(" -D QSC_HASH_SIZE=%d\n", QSC_HASH_SIZE); +# endif +# ifdef QSC_MAX_SIZE + printf(" -D QSC_MAX_SIZE=%lu\n", (unsigned long) QSC_MAX_SIZE); +# endif +# ifdef QSC_HEADER_GRAIN + printf(" -D QSC_HEADER_GRAIN=%d\n", QSC_HEADER_GRAIN); +# endif +# if !defined(QSC_HEADER_GRAIN) || QSC_HEADER_GRAIN > 0 +# ifdef QSC_MAX_ALLOC + printf(" -D QSC_MAX_ALLOC=%d\n", QSC_MAX_ALLOC); +# endif +# ifdef QSC_RED_ZONE + printf(" -D QSC_RED_ZONE=%d\n", QSC_RED_ZONE); +# endif +# endif +#endif +#ifdef FAST_TIME + printf(" -D FAST_TIME\n"); +#endif #ifdef BUFFERED_LOGS printf(" -D BUFFERED_LOGS\n"); +# ifdef LOG_BUFSIZE + printf(" -D LOG_BUFSIZE=%d\n", LOG_BUFSIZE); +# endif #ifdef PIPE_BUF printf(" -D PIPE_BUF=%ld\n",(long)PIPE_BUF); #endif #endif +#ifdef NO_GRACEFUL + printf(" -D NO_GRACEFUL\n"); +#endif +#ifdef USE_QUICK_LOG + printf(" -D USE_QUICK_LOG\n"); +#endif +#ifdef USE_STAT_CACHE + printf(" -D USE_STAT_CACHE\n"); +# ifdef STAT_CACHE_SIZE + printf(" -D STAT_CACHE_SIZE=%ld\n", (long) STAT_CACHE_SIZE); +# endif +# ifdef STAT_CACHE_TIME + printf(" -D STAT_CACHE_TIME=%ld\n", (long) STAT_CACHE_TIME); +# endif +# ifdef STAT_CACHE_PATHLEN + printf(" -D STAT_CACHE_PATHLEN=%ld\n", (long) STAT_CACHE_PATHLEN); +# endif +#endif #ifdef MULTITHREAD printf(" -D MULTITHREAD\n"); #endif @@ -3880,6 +4104,19 @@ } #endif +#ifdef SINGLE_LISTEN_UNSERIALIZED_ACCEPT + ap_sync_scoreboard_image(); + ap_scoreboard_image->servers[my_child_num].cpu = -1; + if (ap_single_listen) { + if (head_listener->cpu >= 0 && ap_os_bind_cpu(head_listener->cpu)) + ap_scoreboard_image->servers[my_child_num].cpu = + head_listener->cpu; + ap_scoreboard_image->servers[my_child_num].single_addr = + head_listener->local_addr; + } + put_scoreboard_info(my_child_num, &ap_scoreboard_image->servers[my_child_num]); +#endif + ap_child_init_modules(pchild, server_conf); /* done with the initialization critical section */ @@ -3911,16 +4148,18 @@ } #endif - while (1) { + for (;;) { BUFF *conn_io; request_rec *r; +#ifndef NO_GRACEFUL /* Prepare to receive a SIGUSR1 due to graceful restart so that * we can exit cleanly. Since we're between connections right * now it's the right time to exit, but we might be blocked in a * system call when the graceful restart request is made. */ usr1_just_die = 1; signal(SIGUSR1, usr1_handler); +#endif /* * (Re)initialize this child to a pre-connection state. @@ -3955,7 +4194,14 @@ SAFE_ACCEPT(accept_mutex_on()); for (;;) { - if (ap_listeners->next != ap_listeners) { + if ( +#ifdef SINGLE_LISTEN_UNSERIALIZED_ACCEPT + !ap_single_listen && +#endif + ap_listeners->next != ap_listeners) { +#if defined(IRIX) && _MIPS_SIM != _ABIO32 +#pragma mips_frequency_hint NEVER +#endif /* more than one socket */ memcpy(&main_fds, &listenfds, sizeof(fd_set)); srv = ap_select(listenmaxfd + 1, &main_fds, NULL, NULL, NULL); @@ -3977,27 +4223,31 @@ lr = find_ready_listener(&main_fds); if (lr == NULL) continue; - sd = lr->fd; + listener = lr; } else { /* only one socket, just pretend we did the other stuff */ - sd = ap_listeners->fd; + listener = head_listener; } /* if we accept() something we don't want to die, so we have to * defer the exit */ +#ifndef NO_GRACEFUL deferred_die = 0; usr1_just_die = 0; +#endif for (;;) { clen = sizeof(sa_client); - csd = ap_accept(sd, &sa_client, &clen); + csd = ap_accept(listener->fd, &sa_client, &clen); if (csd >= 0 || errno != EINTR) break; +#ifndef NO_GRACEFUL if (deferred_die) { /* we didn't get a socket, and we were told to die */ clean_child_exit(0); } +#endif } if (csd >= 0) @@ -4095,12 +4345,14 @@ } } +#ifndef NO_GRACEFUL /* go around again, safe to die */ usr1_just_die = 1; if (deferred_die) { /* ok maybe not, see ya later */ clean_child_exit(0); } +#endif /* or maybe we missed a signal, you never know on systems * without reliable signals */ @@ -4117,16 +4369,21 @@ continue; #endif +#ifndef NO_GRACEFUL /* We've got a socket, let's at least process one request off the * socket before we accept a graceful restart request. */ signal(SIGUSR1, SIG_IGN); +#endif ap_note_cleanups_for_fd(ptrans, csd); /* protect various fd_sets */ #ifdef CHECK_FD_SETSIZE if (csd >= FD_SETSIZE) { +#if defined(IRIX) && _MIPS_SIM != _ABIO32 +#pragma mips_frequency_hint NEVER +#endif ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_WARNING, NULL, "[csd] filedescriptor (%u) larger than FD_SETSIZE (%u) " "found, you probably need to rebuild Apache with a " @@ -4140,13 +4397,33 @@ * socket options, file descriptors, and read/write buffers. */ - clen = sizeof(sa_server); - if (getsockname(csd, &sa_server, &clen) < 0) { - ap_log_error(APLOG_MARK, APLOG_ERR, server_conf, "getsockname"); - continue; + if (listener->unique) { + /* + * The connection was accepted from a socket listening to + * just one address so we don't need to call getsockname(). + */ + sa_server = *((struct sockaddr *) &listener->local_addr); + } else { + /* + * The connection was accepted from a socket listening to + * multiple addresses so we need to find out which one + * provided. + */ + clen = sizeof(sa_server); + if (getsockname(csd, &sa_server, &clen) < 0) { + ap_log_error(APLOG_MARK, APLOG_ERR, server_conf, "getsockname"); + continue; + } } +#if defined(IRIX) && IRIX >= 65 + /* + * TCP_NODELAY is inherited from the accepting socket in Irix + * 6.5 and beyond. + */ +#else sock_disable_nagle(csd); +#endif (void) ap_update_child_status(my_child_num, SERVER_BUSY_READ, (request_rec *) NULL); @@ -4208,8 +4485,12 @@ if (r->status == HTTP_OK) ap_process_request(r); - if(ap_extended_status) + if(ap_extended_status) { +#if defined(IRIX) && _MIPS_SIM != _ABIO32 +#pragma mips_frequency_hint NEVER +#endif increment_counts(my_child_num, r); + } if (!current_conn->keepalive || current_conn->aborted) break; @@ -4220,10 +4501,14 @@ ap_sync_scoreboard_image(); if (ap_scoreboard_image->global.running_generation != ap_my_generation) { +#if defined(IRIX) && _MIPS_SIM != _ABIO32 +#pragma mips_frequency_hint NEVER +#endif ap_bclose(conn_io); clean_child_exit(0); } +#ifndef NO_GRACEFUL /* In case we get a graceful restart while we're blocked * waiting for the request. * @@ -4239,6 +4524,7 @@ */ usr1_just_die = 1; signal(SIGUSR1, usr1_handler); +#endif } /* @@ -4310,6 +4596,9 @@ signal(SIGQUIT, SIG_DFL); #endif signal(SIGTERM, just_die); +#ifdef SINGLE_LISTEN_UNSERIALIZED_ACCEPT + ap_single_listen = 0; +#endif child_main(slot); } @@ -4418,7 +4707,7 @@ int to_kill; int idle_count; short_score *ss; - time_t now = time(0); + time_t now = ap_time(); int free_length; int free_slots[MAX_SPAWN_RATE]; int last_non_dead; @@ -4608,7 +4897,7 @@ #ifndef STANDALONE_MAIN #define STANDALONE_MAIN standalone_main -static void standalone_main(int argc, char **argv) +static void standalone_main(void) { int remaining_children_to_start; @@ -4851,7 +5140,7 @@ } /* standalone_main */ #else /* prototype */ -void STANDALONE_MAIN(int argc, char **argv); +void STANDALONE_MAIN(void); #endif /* STANDALONE_MAIN */ extern char *optarg; @@ -4901,7 +5190,7 @@ ap_setup_prelinked_modules(); while ((c = getopt(argc, argv, - "D:C:c:xXd:f:vVlLR:StTh" + "D:C:c:xXd:f:vVlLR:StThi" #ifdef DEBUG_SIGSTOP "Z:" #endif @@ -4930,6 +5219,7 @@ ap_set_version(); printf("Server version: %s\n", ap_get_server_version()); printf("Server built: %s\n", ap_get_server_built()); + printf("Performance Tuned by SGI \n"); exit(0); case 'V': ap_set_version(); @@ -4978,6 +5268,9 @@ break; case 'h': usage(argv[0]); + case 'i': + daemonize = 0; + break; case '?': usage(argv[0]); } @@ -4994,6 +5287,10 @@ exit(0); } +#ifdef USE_QSC + qsc_init(pconf); +#endif + child_timeouts = !ap_standalone || one_process; #ifdef BEOS @@ -5007,7 +5304,7 @@ ap_set_version(); ap_init_modules(pconf, server_conf); version_locked++; - STANDALONE_MAIN(argc, argv); + STANDALONE_MAIN(); } #else if (!tpf_child) { @@ -5035,7 +5332,7 @@ child_main(input_parms.child.slot); } else - STANDALONE_MAIN(argc, argv); + STANDALONE_MAIN(); } #endif else { @@ -5123,7 +5420,7 @@ ap_bclose(cio); } - exit(0); + return 0; } #else /* ndef MULTITHREAD */ @@ -5683,7 +5980,7 @@ pchild = ap_make_sub_pool(pconf); ap_standalone = 1; - sd = -1; + listener = NULL; nthreads = ap_threads_per_child; if (nthreads <= 0) @@ -5794,13 +6091,13 @@ lr = find_ready_listener(&main_fds); if (lr != NULL) { - sd = lr->fd; + listener = lr; } } do { clen = sizeof(sa_client); - csd = accept(sd, (struct sockaddr *) &sa_client, &clen); + csd = accept(listener->fd, (struct sockaddr *) &sa_client, &clen); if (csd == INVALID_SOCKET) { csd = -1; @@ -5869,7 +6166,7 @@ pchild = ap_make_sub_pool(pconf); ap_standalone = 1; - sd = -1; + listener = NULL; nthreads = ap_threads_per_child; max_jobs_after_exit_request = ap_excess_requests_per_child; max_jobs_per_exe = ap_max_requests_per_child; @@ -6011,12 +6308,12 @@ lr = find_ready_listener(&main_fds); if (lr != NULL) { - sd = lr->fd; + listener = lr; } } do { clen = sizeof(sa_client); - csd = accept(sd, (struct sockaddr *) &sa_client, &clen); + csd = accept(listener ? listener->fd : -1, (struct sockaddr *) &sa_client, &clen); if (csd == INVALID_SOCKET) { csd = -1; } @@ -7074,6 +7371,10 @@ if (!child && !ap_dump_settings) { ap_log_pid(pconf, ap_pid_fname); } +#endif + +#ifdef USE_QSC + qsc_init(pconf); #endif post_parse_init(); diff -urN apache_1.3.20/src/main/http_protocol.c-orig apache_1.3.20/src/main/http_protocol.c --- apache_1.3.20/src/main/http_protocol.c-orig Fri Mar 9 05:10:26 2001 +++ apache_1.3.20/src/main/http_protocol.c Sun Jul 1 01:02:41 2001 @@ -78,9 +78,9 @@ #include "http_conf_globals.h" #define SET_BYTES_SENT(r) \ - do { if (r->sent_bodyct) \ + { if (r->sent_bodyct) \ ap_bgetopt (r->connection->client, BO_BYTECT, &r->bytes_sent); \ - } while (0) + } #ifdef CHARSET_EBCDIC /* Save & Restore the current conversion settings @@ -154,7 +154,11 @@ }; static enum byterange_token +#if 0 parse_byterange(request_rec *r, long *start, long *end) +#else + parse_byterange(request_rec *r, ap_int32 *start, ap_int32 *end) +#endif { /* parsing first, semantics later */ @@ -276,7 +280,7 @@ API_EXPORT(int) ap_set_byterange(request_rec *r) { const char *range, *if_range, *match; - long length, start, end, one_start = 0, one_end = 0; + ap_int32 length, start, end, one_start = 0, one_end = 0; int ranges, empty; if (!r->clength || r->assbackwards) @@ -374,7 +378,7 @@ ap_psprintf(r->pool, "bytes %ld-%ld/%ld", one_start, one_end, r->clength)); ap_table_setn(r->headers_out, "Content-Length", - ap_psprintf(r->pool, "%ld", one_end - one_start + 1)); + ap_psprintf(r->pool, "%ld", (long) one_end - one_start + 1)); r->boundary = NULL; r->byterange = 1; r->range = range; @@ -393,7 +397,7 @@ } } -API_EXPORT(int) ap_each_byterange(request_rec *r, long *offset, long *length) +API_EXPORT(int) ap_each_byterange(request_rec *r, ap_int32 *offset, ap_int32 *length) { long start, end; @@ -411,10 +415,10 @@ return 0; } -API_EXPORT(int) ap_set_content_length(request_rec *r, long clength) +API_EXPORT(int) ap_set_content_length(request_rec *r, ap_int32 clength) { r->clength = clength; - ap_table_setn(r->headers_out, "Content-Length", ap_psprintf(r->pool, "%ld", clength)); + ap_table_setn(r->headers_out, "Content-Length", ap_psprintf(r->pool, "%ld", (long) clength)); return 0; } @@ -459,7 +463,14 @@ ap_table_get(r->headers_out, "Transfer-Encoding"), "chunked") || ((r->proto_num >= HTTP_VERSION(1,1)) && +#if defined(IRIX) && _MIPS_SIM != _ABIO32 +/* disable warning about assignment (=) not comparison (==) */ +#pragma set woff 1184 +#endif (r->chunked = 1))) && /* THIS CODE IS CORRECT, see comment above. */ +#if defined(IRIX) && _MIPS_SIM != _ABIO32 +#pragma reset woff 1184 +#endif r->server->keep_alive && (r->server->keep_alive_timeout > 0) && ((r->server->keep_alive_max == 0) || @@ -935,11 +946,142 @@ } } +#ifndef RQBUF_SIZE +#define RQBUF_SIZE 4096 /* should be >= buff.c's DEFAULT_BUFSIZE */ +#endif + +/* + * Read the request and, as quickly as possible with minimal copying, + * parse it or pass it on to the regular parsing function + * read_request_line(). Shares state with quickly_get_mime_headers(), + * which has a similar mission. + */ +static int +quickly_read_request_line(request_rec *r) +{ + BUFF *fb; + int n; + + /* + * If r->rqbuf already exists, there could be pointers into it from + * r->headers_in so instead of reusing it, just replace it. + */ +#if CACHE_ALIGNMENT > 0 + /* align r->rqbuf on a cache line boundary */ + r->rqbuf = ap_palloc(r->pool, RQBUF_SIZE + CACHE_ALIGNMENT - 1); + r->rqbuf = (char *) (((ap_ptr) r->rqbuf + CACHE_ALIGNMENT - 1) & ~(CACHE_ALIGNMENT - 1)); +#else + r->rqbuf = ap_palloc(r->pool, RQBUF_SIZE); +#endif + + /* + * would read directly into fb->inptr but r->the_request needs an + * intact copy, sigh + */ + fb = r->connection->client; + fb->flags |= B_SAFEREAD; + n = ap_bread(fb, r->rqbuf, RQBUF_SIZE); + fb->flags &= ~B_SAFEREAD; + + /* 16 == strlen("GET / HTTP/1.0\n\n"): minimal valid request */ + if (n >= 16 && +#ifdef IRIX + /* use big-endian multi-character constant for speed */ + *(unsigned int *) r->rqbuf == 'GET ' +#else + r->rqbuf[0] == 'G' && + r->rqbuf[1] == 'E' && + r->rqbuf[2] == 'T' && + r->rqbuf[3] == ' ' +#endif + ) { + char *cp, *ep; + +#if defined(IRIX) && _MIPS_SIM != _ABIO32 && \ + CACHE_ALIGNMENT > 0 && RQBUF_SIZE > CACHE_ALIGNMENT +/* + * The first cache line was prefetched in ap_read() and used above; now + * try to prefetch the second cache line so parsing can proceed without + * delay. The cache line is prefetched for writing because parsing + * involves modification. With CACHE_ALIGNMENT=128, most request lines + * are smaller than two cache lines. Unfortunately the compiler doesn't + * yet allow "prefetch_ref = r->rqbuf[CACHE_ALIGNMENT]" so hard-code + * 128. + */ +# pragma prefetch_manual = 1 +# pragma prefetch_ref = r->rqbuf[/*CACHE_ALIGNMENT*/ 128], kind = wr +#endif + + /* find the end of the uri */ + cp = &r->rqbuf[4]; /* 4 == strlen("GET ") */ + ep = &r->rqbuf[n - 11]; /* 11 == strlen(" HTTP/1.0\n\n") */ + while (cp <= ep && !ap_isspace(*cp)) + cp++; + + if (cp <= ep && + cp[0] == ' ' && + cp[1] == 'H' && + cp[2] == 'T' && + cp[3] == 'T' && + cp[4] == 'P' && + cp[5] == '/' && + cp[6] == '1' && + cp[7] == '.' && + (cp[8] == '0' || cp[8] == '1') && + ((cp[9] == '\r' && cp[10] == '\n') || cp[9] == '\n')) { +#if defined(SIGUSR1) && !defined(NO_GRACEFUL) + signal(SIGUSR1, SIG_IGN); +#endif + + r->rqhdr = cp + 10 + (cp[9] == '\r'); + r->rqhdr_len = (int) (&r->rqbuf[n] - r->rqhdr); + cp[9] = 0; /* null-terminate r->the_request */ + + r->request_time = ap_time(); + r->the_request = r->rqbuf; + r->the_request_len = (int) (cp + 9 - r->rqbuf); + r->method = "GET"; + r->method_number = M_GET; + ap_assert(!r->assbackwards); + + if (cp[8] == '0') { + r->protocol = "HTTP/1.0"; + r->proto_num = HTTP_VERSION(1,0); + } else { + r->protocol = "HTTP/1.1"; + r->proto_num = HTTP_VERSION(1,1); + } + + *cp = 0; /* avoid copying uri; briefly mangles r->the_request */ + ap_parse_uri(r, &r->rqbuf[4]); + *cp = ' '; + + return 1; + } + } + + /* + * Shortcut parsing failed. No harm done, just copy the + * already-read data into fb and fall back to regular processing. + * If copying bothers you, extend the buffering code to allow an + * alternate read-ahead buffer and then just manipulate pointers. + */ + ap_assert(r->rqhdr_len == 0); + if (n > 0) { + ap_assert(&fb->inptr[n] <= &fb->inbase[fb->bufsiz]); + memcpy(fb->inptr, r->rqbuf, n); + fb->incnt += n; + } + + return 0; +} + static int read_request_line(request_rec *r) { char l[DEFAULT_LIMIT_REQUEST_LINE + 2]; /* getline's two extra for \n\0 */ const char *ll = l; const char *uri; + const char *pro; conn_rec *conn = r->connection; unsigned int major = 1, minor = 0; /* Assume HTTP/1.0 if non-"HTTP" protocol */ int len; @@ -965,19 +1107,20 @@ /* this is a hack to make sure that request time is set, * it's not perfect, but it's better than nothing */ - r->request_time = time(0); + r->request_time = ap_time(); return 0; } } /* we've probably got something to do, ignore graceful restart requests */ -#ifdef SIGUSR1 +#if defined(SIGUSR1) && !defined(NO_GRACEFUL) signal(SIGUSR1, SIG_IGN); #endif ap_bsetflag(conn->client, B_SAFEREAD, 0); - r->request_time = time(NULL); - r->the_request = ap_pstrdup(r->pool, l); + r->request_time = ap_time(); + r->the_request = ap_pstrndup(r->pool, l, len); + r->the_request_len = len; r->method = ap_getword_white(r->pool, &ll); uri = ap_getword_white(r->pool, &ll); @@ -1002,9 +1145,23 @@ } r->assbackwards = (ll[0] == '\0'); - r->protocol = ap_pstrdup(r->pool, ll[0] ? ll : "HTTP/0.9"); - if (2 == sscanf(r->protocol, "HTTP/%u.%u", &major, &minor) + if (ll[0]) { + pro = ll; + len = ap_strlen(ll); + } else { + pro = "HTTP/0.9"; + len = 8; + } + r->protocol = ap_pstrndup(r->pool, pro, len); + + /* avoid sscanf in the common case */ + if (len == 8 && + pro[0] == 'H' && pro[1] == 'T' && pro[2] == 'T' && pro[3] == 'P' && + pro[4] == '/' && ap_isdigit(pro[5]) && pro[6] == '.' && + ap_isdigit(pro[7])) { + r->proto_num = HTTP_VERSION(pro[5] - '0', pro[7] - '0'); + } else if (2 == sscanf(r->protocol, "HTTP/%u.%u", &major, &minor) && minor < HTTP_VERSION(1,0)) /* don't allow HTTP/0.1000 */ r->proto_num = HTTP_VERSION(major, minor); else @@ -1013,6 +1170,171 @@ return 1; } +/* + * Parse the request options as quickly as possible. Requires state + * from quickly_read_request_line(). Handles only the fast cases, and + * detects and defers the slow ones to the regular parser + * get_mime_headers(). + */ +static int +quickly_get_mime_headers(request_rec *r) +{ + int ok, nh, mh; + table *headers; + char *hp, *ep; + int remain; +#define NQHEADERS 16 /* see big comment below */ + struct qheader { + const char *name; + const char *value; + } qheaders[NQHEADERS]; + struct qheader *nqp, *qp; + +#if defined(IRIX) && _MIPS_SIM != _ABIO32 +/* + * Prefetch cache lines of the request headers so parsing can proceed + * without delay. The lines are prefetched for writing because parsing + * involves modification. Attempts to prefetch bogus addresses will + * simply have no effect and will raise no exceptions. + */ +# pragma prefetch_manual = 1 +# pragma prefetch_ref = r->rqhdr[0], kind = wr +#endif + + ok = 0; + + nh = ap_table_elts(r->headers_in)->nelts; + mh = r->server->limit_req_fields; + if (mh <= 0) + mh = 65536; /* essentially infinite */ + headers = NULL; + + hp = r->rqhdr; + ep = hp + r->rqhdr_len; + r->rqhdr_len = 0; /* never re-parse */ + + nqp = qheaders; + + while (hp < ep && nh < mh) { + char *name, *value; + +#if defined(IRIX) && _MIPS_SIM != _ABIO32 && CACHE_ALIGNMENT > 0 +/* + * Unfortunately the compiler doesn't yet allow "prefetch_ref = + * hp[CACHE_ALIGNMENT]" so hard-code 128. + */ +# pragma prefetch_ref = hp[/*CACHE_ALIGNMENT*/ 128], kind = wr +# pragma prefetch_ref = hp[/*CACHE_ALIGNMENT * 2*/ 256], kind = wr +#endif + + name = hp; + + /* find a : (end of name) */ + value = name; + while (value < ep && *value != ':' && !ap_isspace(*value)) + value++; + + /* complete name? */ + if (value > name && value < ep && *value == ':') { + *value = 0; /* null-terminate name */ + + /* skip white space */ + do + value++; + while (value < ep && (*value == ' ' || *value == '\t')); + + /* find end of value */ + hp = value; + while (hp < ep && *hp != '\n') + hp++; + + /* + * complete value? beware leading-space continuation lines, + * or the threat of one if we're right at the end of rqbuf. + * (there must be at least one more byte left and it must + * not be a leading space) + */ + if (hp + 1 < ep && hp[1] != ' ' && hp[1] != '\t') { + hp[-(hp[-1] == '\r')] = 0; /* null-terminate value */ + hp++; +#if defined(IRIX) && _MIPS_SIM != _ABIO32 +# pragma prefetch_ref = hp[0], kind = wr +#endif + + if (nqp < &qheaders[NQHEADERS]) { + /* still room in quick header array */ + nqp->name = name; + nqp->value = value; + nqp++; + } else if (headers) { + /* insert into established table */ + ap_table_addn(headers, name, value); + } else { + /* + * More headers than fit in the quick header array. + * Make a table for them. + */ + headers = ap_make_table(r->pool, NQHEADERS * 2); + for (qp = qheaders; qp < nqp; qp++) + ap_table_addn(headers, qp->name, qp->value); + ap_table_addn(headers, name, value); + } + + nh++; + } else { + hp = name; + do + name++; + while (*name); + *name = ':'; /* restore : for copy below */ + break; + } + } else { + if (hp < ep && *hp == '\r') + hp++; + if (hp < ep && *hp == '\n') { + hp++; + ok = 1; /* end of header section */ + } + break; + } + } + + /* + * My experiments on a variety of systems show that when all the + * header names are unique (no duplicates), calling + * ap_table_mergen() to insert each header is faster than calling + * ap_overlap_tables() once, up to around 16 headers. When there + * are more than about 16 headers, ap_overlap_tables() is faster. + * When there are some duplicate headers, using ap_table_mergen() + * almost always is faster no matter how many headers are inserted. + * All the benchmarks and browsers I know issue unique request + * headers so I set NQHEADERS to 16 to optimize: When there are at + * most NQHEADERS headers this function calls ap_table_mergen() once + * for each header, and when there are more it calls + * ap_overlap_tables() once. (But why, you might ask, use + * ap_table_mergen() instead of ap_table_addn() if all the headers + * are unique? Because we don't know apriori that they are unique, + * just that they usually are.) + */ + if (headers) + ap_overlap_tables(r->headers_in, headers, AP_OVERLAP_TABLES_MERGE); + else + for (qp = qheaders; qp < nqp; qp++) + ap_table_mergen(r->headers_in, qp->name, qp->value); + + remain = (int) (ep - hp); + if (remain > 0) { + BUFF *fb = r->connection->client; + + ap_assert(&fb->inptr[remain] <= &fb->inbase[fb->bufsiz]); + memcpy(fb->inptr, hp, remain); + fb->incnt += remain; + } + + return ok; +} + static void get_mime_headers(request_rec *r) { char field[DEFAULT_LIMIT_REQUEST_FIELDSIZE + 2]; /* getline's two extra */ @@ -1020,7 +1342,7 @@ char *value; char *copy; int len; - unsigned int fields_read = 0; + unsigned int fields_read = ap_table_elts(r->headers_in)->nelts; table *tmp_headers; /* We'll use ap_overlap_tables later to merge these into r->headers_in. */ @@ -1102,13 +1424,9 @@ r->request_config = ap_create_request_config(r->pool); r->per_dir_config = r->server->lookup_defaults; - r->sent_bodyct = 0; /* bytect isn't for body */ - - r->read_length = 0; r->read_body = REQUEST_NO_BODY; r->status = HTTP_REQUEST_TIME_OUT; /* Until we get a request */ - r->the_request = NULL; #ifdef CHARSET_EBCDIC ap_bsetflag(r->connection->client, B_ASCII2EBCDIC, r->ebcdic.conv_in = 1); @@ -1118,7 +1436,10 @@ /* Get the request... */ ap_keepalive_timeout("read request line", r); - if (!read_request_line(r)) { + if (!quickly_read_request_line(r) && !read_request_line(r)) { +#if defined(IRIX) && _MIPS_SIM != _ABIO32 +#pragma mips_frequency_hint NEVER +#endif ap_kill_timeout(r); if (r->status == HTTP_REQUEST_URI_TOO_LARGE) { @@ -1132,9 +1453,17 @@ } if (!r->assbackwards) { ap_hard_timeout("read request headers", r); - get_mime_headers(r); + if (!quickly_get_mime_headers(r)) { +#if defined(IRIX) && _MIPS_SIM != _ABIO32 +#pragma mips_frequency_hint NEVER +#endif + get_mime_headers(r); + } ap_kill_timeout(r); if (r->status != HTTP_REQUEST_TIME_OUT) { +#if defined(IRIX) && _MIPS_SIM != _ABIO32 +#pragma mips_frequency_hint NEVER +#endif ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, r, "request failed: error reading the headers"); ap_send_error_response(r, 0); @@ -1177,6 +1506,9 @@ if ((!r->hostname && (r->proto_num >= HTTP_VERSION(1,1))) || ((r->proto_num == HTTP_VERSION(1,1)) && !ap_table_get(r->headers_in, "Host"))) { +#if defined(IRIX) && _MIPS_SIM != _ABIO32 +#pragma mips_frequency_hint NEVER +#endif /* * Client sent us an HTTP/1.1 or later request without telling us the * hostname, either with a full URL or a Host: header. We therefore @@ -1190,12 +1522,18 @@ "(see RFC2616 section 14.23): %s", r->uri); } if (r->status != HTTP_OK) { +#if defined(IRIX) && _MIPS_SIM != _ABIO32 +#pragma mips_frequency_hint NEVER +#endif ap_send_error_response(r, 0); ap_log_transaction(r); return r; } if ((access_status = ap_run_post_read_request(r))) { +#if defined(IRIX) && _MIPS_SIM != _ABIO32 +#pragma mips_frequency_hint NEVER +#endif ap_die(access_status, r); ap_log_transaction(r); return NULL; @@ -1203,6 +1541,9 @@ if (((expect = ap_table_get(r->headers_in, "Expect")) != NULL) && (expect[0] != '\0')) { +#if defined(IRIX) && _MIPS_SIM != _ABIO32 +#pragma mips_frequency_hint NEVER +#endif /* * The Expect header field was added to HTTP/1.1 after RFC 2068 * as a means to signal when a 100 response is desired and, @@ -1237,6 +1578,7 @@ void ap_set_sub_req_protocol(request_rec *rnew, const request_rec *r) { rnew->the_request = r->the_request; /* Keep original request-line */ + rnew->the_request_len = r->the_request_len; rnew->assbackwards = 1; /* Don't send headers from this. */ rnew->no_local_copy = 1; /* Don't try to send USE_LOCAL_COPY for a @@ -1295,7 +1637,7 @@ r->proxyreq == STD_PROXY ? "Proxy-Authenticate" : "WWW-Authenticate", ap_psprintf(r->pool, "Digest realm=\"%s\", nonce=\"%lu\"", - ap_auth_name(r), r->request_time)); + ap_auth_name(r), (unsigned long) r->request_time)); } API_EXPORT(int) ap_get_basic_auth_pw(request_rec *r, const char **pw) @@ -1465,7 +1807,15 @@ API_EXPORT(void) ap_basic_http_header(request_rec *r) { + ap_tee_basic_http_header(r, NULL, NULL); +} + +API_EXPORT(void) ap_tee_basic_http_header(request_rec *r, + char *basic_header_copy, size_t *basic_header_copy_remain) +{ char *protocol; + const char *cp; + int len; if (r->assbackwards) return; @@ -1492,10 +1842,44 @@ /* Output the HTTP/1.x Status-Line and the Date and Server fields */ + /* + * The whole basic_header_copy* thing is a hack to include the basic + * http headers in the QSC entry for mod_mmap_static. Everything + * else uses the headers_out table, but noooo, this function has to + * emit headers directly, and since they may be flushed at any point + * we must copy them aside for later insertion into the QSC. + */ ap_rvputs(r, protocol, " ", r->status_line, CRLF, NULL); - - ap_send_header_field(r, "Date", ap_gm_timestr_822(r->pool, r->request_time)); - ap_send_header_field(r, "Server", ap_get_server_version()); + if (basic_header_copy) { + len = ap_snprintf(basic_header_copy, *basic_header_copy_remain, + "%s %s" CRLF, protocol, r->status_line); + basic_header_copy += len; + *basic_header_copy_remain -= len; + } + + cp = ap_gm_timestr_822(r->pool, r->request_time); + ap_send_header_field(r, "Date", cp); + if (basic_header_copy) { + len = ap_snprintf(basic_header_copy, *basic_header_copy_remain, + "Date: %s" CRLF, cp); + basic_header_copy += len; + *basic_header_copy_remain -= len; + } + + cp = ap_get_server_version(); + ap_send_header_field(r, "Server", cp); + if (basic_header_copy) { + len = ap_snprintf(basic_header_copy, *basic_header_copy_remain, + "Server: %s" CRLF, cp); + basic_header_copy += len; + *basic_header_copy_remain -= len; + } + /* + * NOTE: if you change the basic header such that the Server + * response-header is not at the end or its value is other than + * ap_get_server_version(), update the most-likely-place probe in + * qsc_insert_request(). + */ ap_table_unset(r->headers_out, "Date"); /* Avoid bogosity */ ap_table_unset(r->headers_out, "Server"); @@ -1523,7 +1907,7 @@ */ static void terminate_header(BUFF *client) { - long int bs; + ap_int32 bs; ap_bgetopt(client, BO_BYTECT, &bs); if (bs >= 255 && bs <= 257) @@ -1590,7 +1974,7 @@ int ap_send_http_options(request_rec *r) { - const long int zero = 0L; + const ap_int32 zero = 0; if (r->assbackwards) return DECLINED; @@ -1635,6 +2019,7 @@ * and recombine multiple Vary fields, though it is generic to any field * consisting of comma/space-separated tokens. */ +/*ARGSUSED1*/ static int uniq_field_values(void *d, const char *key, const char *val) { array_header *values; @@ -1709,8 +2094,14 @@ API_EXPORT(void) ap_send_http_header(request_rec *r) { + ap_tee_http_header(r, NULL, NULL); +} + +API_EXPORT(void) ap_tee_http_header(request_rec *r, char *basic_header_copy, + size_t *basic_header_copy_remain) +{ int i; - const long int zero = 0L; + const ap_int32 zero = 0; #ifdef CHARSET_EBCDIC /* Use previously determined conversion (output): */ @@ -1749,7 +2140,7 @@ ap_hard_timeout("send headers", r); - ap_basic_http_header(r); + ap_tee_basic_http_header(r, basic_header_copy, basic_header_copy_remain); #ifdef CHARSET_EBCDIC PUSH_EBCDIC_OUTPUTCONVERSION_STATE_r(r, 1); @@ -1881,7 +2272,7 @@ { const char *tenc = ap_table_get(r->headers_in, "Transfer-Encoding"); const char *lenp = ap_table_get(r->headers_in, "Content-Length"); - unsigned long max_body; + ap_uint32 max_body; r->read_body = read_policy; r->read_chunked = 0; @@ -1912,7 +2303,7 @@ return HTTP_BAD_REQUEST; } - r->remaining = atol(lenp); + r->remaining = ap_atol(lenp); } if ((r->read_body == REQUEST_NO_BODY) && @@ -1926,7 +2317,7 @@ if (max_body && (r->remaining > max_body)) { ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, r, "Request content-length of %s is larger than the configured " - "limit of %lu", lenp, max_body); + "limit of %lu", lenp, (unsigned long) max_body); return HTTP_REQUEST_ENTITY_TOO_LARGE; } @@ -1960,9 +2351,9 @@ return 1; } -static long get_chunk_size(char *b) +static ap_int32 get_chunk_size(char *b) { - long chunksize = 0; + ap_int32 chunksize = 0; while (ap_isxdigit(*b)) { int xvalue = 0; @@ -1995,12 +2386,12 @@ * hold a chunk-size line, including any extensions. For now, we'll leave * that to the caller, at least until we can come up with a better solution. */ -API_EXPORT(long) ap_get_client_block(request_rec *r, char *buffer, int bufsiz) +API_EXPORT(ap_int32) ap_get_client_block(request_rec *r, char *buffer, int bufsiz) { int c; - long len_read, len_to_read; - long chunk_start = 0; - unsigned long max_body; + ap_int32 len_read, len_to_read; + ap_int32 chunk_start = 0; + ap_uint32 max_body; if (!r->read_chunked) { /* Content-length read */ len_to_read = (r->remaining > bufsiz) ? bufsiz : r->remaining; @@ -2034,7 +2425,7 @@ if (max_body && (r->read_length > max_body)) { ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, r, "Chunked request body is larger than the configured limit of %lu", - max_body); + (unsigned long) max_body); r->connection->keepalive = -1; return -1; } @@ -2053,7 +2444,7 @@ if (len_to_read == 0) { /* Last chunk indicated, get footers */ if (r->read_body == REQUEST_CHUNKED_DECHUNK) { get_mime_headers(r); - ap_snprintf(buffer, bufsiz, "%ld", r->read_length); + ap_snprintf(buffer, bufsiz, "%ld", (long) r->read_length); ap_table_unset(r->headers_in, "Transfer-Encoding"); ap_table_setn(r->headers_in, "Content-Length", ap_pstrdup(r->pool, buffer)); @@ -2196,18 +2587,11 @@ return OK; } -/* - * Send the body of a response to the client. - */ -API_EXPORT(long) ap_send_fd(FILE *f, request_rec *r) -{ - return ap_send_fd_length(f, r, -1); -} - -API_EXPORT(long) ap_send_fd_length(FILE *f, request_rec *r, long length) +static ap_int32 +send_fd_length_internal(FILE *f, request_rec *r, ap_int32 length, + char *buf, ap_int32 bufsize) { - char buf[IOBUFSIZE]; - long total_bytes_sent = 0; + ap_int32 total_bytes_sent = 0; register int n, w, o, len; if (length == 0) @@ -2216,12 +2600,12 @@ ap_soft_timeout("send body", r); while (!r->connection->aborted) { - if ((length > 0) && (total_bytes_sent + IOBUFSIZE) > length) + if ((length > 0) && (total_bytes_sent + bufsize) > length) len = length - total_bytes_sent; else - len = IOBUFSIZE; + len = bufsize; - while ((n = fread(buf, sizeof(char), len, f)) < 1 + while ((n = (int) fread(buf, sizeof(char), len, f)) < 1 && ferror(f) && errno == EINTR && !r->connection->aborted) continue; @@ -2258,15 +2642,75 @@ /* * Send the body of a response to the client. */ -API_EXPORT(long) ap_send_fb(BUFF *fb, request_rec *r) +API_EXPORT(ap_int32) ap_send_fd(FILE *f, request_rec *r) +{ + char buf[IOBUFSIZE]; + return send_fd_length_internal(f, r, -1, buf, sizeof buf); +} + +API_EXPORT(ap_int32) ap_send_fd_length(FILE *f, request_rec *r, ap_int32 length) +{ + char buf[IOBUFSIZE]; + return send_fd_length_internal(f, r, length, buf, sizeof buf); +} + +#ifdef USE_DIRECT_IO + +/* + * Maximum alignment and buffer size are hard-coded to avoid dynamic + * memory allocation on each transmission. These must be powers of two + * greater than zero. + */ +#ifndef MAX_DIRECT_ALIGN +#define MAX_DIRECT_ALIGN (4 * 1024) +#endif + +#ifndef MAX_DIRECT_BUFSIZE +#define MAX_DIRECT_BUFSIZE IOBUFSIZE +#endif + +API_EXPORT(ap_int32) ap_send_fd_direct(FILE *f, request_rec *r, + const struct dioattr *da) +{ + char buf[MAX_DIRECT_BUFSIZE + MAX_DIRECT_ALIGN - 1]; + char *abuf = (char *) (((ap_ptr) buf + MAX_DIRECT_ALIGN - 1) & + ~(MAX_DIRECT_ALIGN - 1)); + + /* + * Check direct I/O restrictions. If they're within range, enable + * direct I/O for this file. + */ + if (da->d_mem <= MAX_DIRECT_ALIGN && + da->d_miniosz <= MAX_DIRECT_ALIGN && + da->d_miniosz <= MAX_DIRECT_BUFSIZE && + da->d_maxiosz >= MAX_DIRECT_BUFSIZE) { + if (fcntl(fileno(f), F_SETFL, FDIRECT) != 0) + ap_log_rerror(APLOG_MARK, APLOG_WARNING, r, + "fcntl(F_SETFL, FDIRECT) failed on %s; using non-direct I/O", + r->filename); + } else + ap_log_rerror(APLOG_MARK, APLOG_WARNING, r, + "%s exceeds direct I/O parameters; mem %ld miniosz %ld maxiosz %ld, MAX_DIRECT_ALIGN %ld MAX_DIRECT_BUFSIZE %ld", + r->filename, + (long) da->d_mem, (long) da->d_miniosz, (long) da->d_maxiosz, + (long) MAX_DIRECT_ALIGN, (long) MAX_DIRECT_BUFSIZE); + + return send_fd_length_internal(f, r, -1, abuf, MAX_DIRECT_BUFSIZE); +} +#endif + +/* + * Send the body of a response to the client. + */ +API_EXPORT(ap_int32) ap_send_fb(BUFF *fb, request_rec *r) { return ap_send_fb_length(fb, r, -1); } -API_EXPORT(long) ap_send_fb_length(BUFF *fb, request_rec *r, long length) +API_EXPORT(ap_int32) ap_send_fb_length(BUFF *fb, request_rec *r, ap_int32 length) { char buf[IOBUFSIZE]; - long total_bytes_sent = 0; + ap_int32 total_bytes_sent = 0; register int n, w, o, len, fd; fd_set fds; @@ -2381,9 +2825,6 @@ * To take advantage of zero-copy TCP under Solaris 2.6 this should be a * multiple of 16k. (And you need a SunATM2.0 network card.) */ -#ifndef MMAP_SEGMENT_SIZE -#define MMAP_SEGMENT_SIZE 32768 -#endif /* send data from an in-memory buffer */ API_EXPORT(size_t) ap_send_mmap(void *mm, request_rec *r, size_t offset, @@ -2403,7 +2844,7 @@ n = MMAP_SEGMENT_SIZE; } else { - n = length - offset; + n = (int) (length - offset); } while (n && !r->connection->aborted) { @@ -2431,6 +2872,36 @@ return total_bytes_sent; } +API_EXPORT(size_t) +ap_send_iovec(request_rec *r, struct iovec *iov, int iovcnt) +{ + size_t sent; + + sent = 0; + ap_soft_timeout("send iovec", r); + if (!r->connection->aborted) { + int w; + + /* + * No need to loop. ap_bwritev writes it all unless there was + * an error. + */ + w = ap_bwritev(r->connection->client, iov, iovcnt); + if (w > 0) + sent += w; + else { + ap_log_rerror(APLOG_MARK, APLOG_INFO, r, + "client stopped connection before send iovec completed"); + ap_bsetflag(r->connection->client, B_EOUT, 1); + r->connection->aborted = 1; + } + } + ap_kill_timeout(r); + SET_BYTES_SENT(r); + + return sent; +} + API_EXPORT(int) ap_rputc(int c, request_rec *r) { if (r->connection->aborted) @@ -2491,6 +2962,7 @@ return n; } +/*PRINTFLIKE2*/ API_EXPORT(int) ap_vrprintf(request_rec *r, const char *fmt, va_list ap) { int n; @@ -2513,6 +2985,7 @@ return n; } +/*PRINTFLIKE2*/ API_EXPORT(int) ap_rprintf(request_rec *r, const char *fmt,...) { va_list vlist; @@ -2553,7 +3026,7 @@ x = va_arg(args, const char *); if (x == NULL) break; - j = strlen(x); + j = ap_strlen(x); i = ap_bwrite(fb, x, j); if (i != j) { va_end(args); diff -urN apache_1.3.20/src/main/http_request.c-orig apache_1.3.20/src/main/http_request.c --- apache_1.3.20/src/main/http_request.c-orig Fri Mar 9 05:10:27 2001 +++ apache_1.3.20/src/main/http_request.c Sun Jul 1 00:13:38 2001 @@ -246,7 +246,7 @@ } else { errno = 0; - rv = stat(path, &r->finfo); + rv = ap_stat_cache (path, &r->finfo); #ifdef OS2 r->finfo.st_ino = 0; #endif @@ -427,7 +427,7 @@ return res; } - test_filename_len = strlen(test_filename); + test_filename_len = ap_strlen(test_filename); if (test_filename[test_filename_len - 1] == '/') --num_dirs; @@ -672,7 +672,7 @@ ap_get_module_config(entry_config, &core_module); entry_url = entry_core->d; - len = strlen(entry_url); + len = ap_strlen(entry_url); this_conf = NULL; @@ -910,7 +910,7 @@ rnew->uri = ap_make_full_path(rnew->pool, udir, new_file); rnew->filename = ap_make_full_path(rnew->pool, fdir, new_file); ap_parse_uri(rnew, rnew->uri); /* fill in parsed_uri values */ - if (stat(rnew->filename, &rnew->finfo) < 0) { + if (ap_stat_cache(rnew->filename, &rnew->finfo) < 0) { rnew->finfo.st_mode = 0; #ifdef ENAMETOOLONG /* Special case for filenames which exceed the maximum limit @@ -1317,10 +1317,23 @@ { int old_stat; - if (ap_extended_status) + if (ap_extended_status) { +#if defined(IRIX) && _MIPS_SIM != _ABIO32 +#pragma mips_frequency_hint NEVER +#endif ap_time_process_request(r->connection->child_num, START_PREQUEST); + } - process_request_internal(r); +#ifdef USE_QSC + if (!qsc_process_request(r)) { +#if defined(IRIX) && _MIPS_SIM != _ABIO32 +#pragma mips_frequency_hint NEVER +#endif +#endif + process_request_internal(r); +#ifdef USE_QSC + } +#endif old_stat = ap_update_child_status(r->connection->child_num, SERVER_BUSY_LOG, r); @@ -1336,8 +1349,12 @@ ap_log_transaction(r); (void) ap_update_child_status(r->connection->child_num, old_stat, r); - if (ap_extended_status) + if (ap_extended_status) { +#if defined(IRIX) && _MIPS_SIM != _ABIO32 +#pragma mips_frequency_hint NEVER +#endif ap_time_process_request(r->connection->child_num, STOP_PREQUEST); + } } static table *rename_original_env(pool *p, table *t) @@ -1384,6 +1401,7 @@ /* Inherit the rest of the protocol info... */ new->the_request = r->the_request; + new->the_request_len = r->the_request_len; new->allowed = r->allowed; diff -urN apache_1.3.20/src/main/http_vhost.c-orig apache_1.3.20/src/main/http_vhost.c --- apache_1.3.20/src/main/http_vhost.c-orig Sat Feb 24 05:09:46 2001 +++ apache_1.3.20/src/main/http_vhost.c Sun Jul 1 01:57:58 2001 @@ -149,6 +149,7 @@ /* called at the beginning of the config */ +/*ARGSUSED0*/ void ap_init_vhost_config(pool *p) { memset(iphash_table, 0, sizeof(iphash_table)); @@ -169,7 +170,7 @@ unsigned port) { struct hostent *hep; - unsigned long my_addr; + ap_uint32 my_addr; server_addr_rec *sar; char *t; int i, is_an_ip_addr; @@ -268,6 +269,7 @@ } +/*ARGSUSED1*/ const char *ap_set_name_virtual_host (cmd_parms *cmd, void *dummy, char *arg) { /* use whatever port the main server has at this point */ @@ -654,11 +656,12 @@ else { /* again, what can we do? They didn't specify a ServerName, and their DNS isn't working. -djg */ + char nbuf[16]; ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, main_s, "Failed to resolve server name " "for %s (check DNS) -- or specify an explicit " "ServerName", - inet_ntoa(s->addrs->host_addr)); + ap_inet_ntoa(s->addrs->host_addr, nbuf, NULL)); s->server_hostname = ap_pstrdup(p, "bogus_host_without_reverse_dns"); } @@ -687,7 +690,7 @@ * run-time vhost matching functions */ -/* Lowercase and remove any trailing dot and/or :port from the hostname, +/* Remove any trailing dot and/or :port from the hostname, * and check that it is sane. * * In most configurations the exact syntax of the hostname isn't @@ -702,13 +705,45 @@ */ static void fix_hostname(request_rec *r) { + /* + * Assume it is sane and pay the expense of rewriting it only + * if it isn't. + */ +#if 0 char *host = ap_palloc(r->pool, strlen(r->hostname) + 1); +#else + const char *host = r->hostname; +#endif const char *src; +#if 0 char *dst; +#endif - /* check and copy the host part */ - src = r->hostname; + /* check the host part */ + for (src = host; *src; src++) { + if (*src == '.') { + if (src > host && src[-1] == '.') { +#if defined(IRIX) && _MIPS_SIM != _ABIO32 +#pragma mips_frequency_hint NEVER +#endif + goto bad; + } + } else if (*src == ':') + break; + else if (!ap_isalnum (*src) && *src != '-') + goto bad; + } + /* cut off trailing . if present */ + if (src > host && src[-1] == '.') { +#if defined(IRIX) && _MIPS_SIM != _ABIO32 +#pragma mips_frequency_hint NEVER +#endif + host = ap_pstrndup (r->pool, host, src - host - 1); + } else if (*src == ':') + host = ap_pstrndup (r->pool, host, src - host); + src = r->hostname; +#if 0 dst = host; while (*src) { if (*src == '.') { @@ -722,12 +757,23 @@ goto bad; } if (*src == ':') { - /* check the port part */ - while (*++src) { - if (!ap_isdigit(*src)) { - goto bad; - } - } +#endif + /* check the port part */ + if (*src == ':') { +#if defined(IRIX) && _MIPS_SIM != _ABIO32 +#pragma mips_frequency_hint NEVER +#endif + while (*++src) { + if (!ap_isdigit(*src)) { +#if defined(IRIX) && _MIPS_SIM != _ABIO32 +#pragma mips_frequency_hint NEVER +#endif + goto bad; + } + } + } + +#if 0 if (src[-1] == ':') goto bad; else @@ -741,7 +787,7 @@ } else { dst[0] = '\0'; } - +#endif r->hostname = host; return; diff -urN apache_1.3.20/src/main/qsc.c-orig apache_1.3.20/src/main/qsc.c --- apache_1.3.20/src/main/qsc.c-orig Wed Dec 31 19:00:00 1969 +++ apache_1.3.20/src/main/qsc.c Sat Jun 30 23:53:25 2001 @@ -0,0 +1,1392 @@ +/* + * Copyright (c) 1999-2000 Silicon Graphics, Inc. All rights reserved. + */ + +/* ==================================================================== + * Copyright (c) 1999-2000 The Apache Group. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * 3. All advertising materials mentioning features or use of this + * software must display the following acknowledgment: + * "This product includes software developed by the Apache Group + * for use in the Apache HTTP server project (http://www.apache.org/)." + * + * 4. The names "Apache Server" and "Apache Group" must not be used to + * endorse or promote products derived from this software without + * prior written permission. For written permission, please contact + * apache@apache.org. + * + * 5. Products derived from this software may not be called "Apache" + * nor may "Apache" appear in their names without prior written + * permission of the Apache Group. + * + * 6. Redistributions of any form whatsoever must retain the following + * acknowledgment: + * "This product includes software developed by the Apache Group + * for use in the Apache HTTP server project (http://www.apache.org/)." + * + * THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY + * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * ==================================================================== + * + * For more information on the Apache Group and the Apache HTTP server + * project, please see . + * + */ + +/* + * QSC - Quick Shortcut Cache (or Quick Static-content Cache). + * Tightly integrated with mod_mmap_static. + * Mike Abbott - mja@sgi.com + * Accelerating Apache Project - http://oss.sgi.com/projects/apache/ + * + * Cache the response to a request for a static page, so that subsequent + * requests for the same page will bypass all the computation that is + * identical every time that page is requested. Caches the HTTP headers + * and body together for quick response with a single writev(). Hashes + * URIs for fast lookup. See htdocs/manual/qsc.html. + */ + +#include "httpd.h" + +#ifdef USE_QSC + +#include "http_log.h" +#include "http_config.h" +#include "http_conf_globals.h" +#include "http_protocol.h" +#include "http_main.h" +#include "scoreboard.h" + +/* + * Number of hash buckets. Larger values shorten chain lengths and + * increase performance. Default value is arbitrary. + */ +#ifndef QSC_HASH_SIZE +#define QSC_HASH_SIZE 128 +#endif + +/* + * Number of qsc_status() hash chain length histogram buckets. Default + * value is arbitrary. + */ +#ifndef QSC_HIST_SIZE +#define QSC_HIST_SIZE 5 +#endif + +/* + * Total size of shared data, in bytes. The QSC will not use more than + * this much memory. Default value is arbitrary. + */ +#ifndef QSC_MAX_SIZE +#define QSC_MAX_SIZE (4 * 1024 * 1024) +#endif + +/* + * Granularity of memory allocation in bytes. Must be power of two at + * least as large as max(sizeof (long), sizeof (void *)). + */ +#ifndef QSC_GRAIN +union qsc_granule { + size_t s; + void *c; + ap_atomic a; +}; +#define QSC_GRAIN sizeof (union qsc_granule) +#endif + +/* + * Granularity of headers, for processor cache alignment, or 0 for none. + * The Server response header is padded with spaces to force alignment. + */ +#ifndef QSC_HEADER_GRAIN +#define QSC_HEADER_GRAIN CACHE_ALIGNMENT +#endif + +#if QSC_HEADER_GRAIN > 0 +/* + * Maximum single allocation by qsc_malloc() or qsc_hmalloc(), in bytes, + * to avoid overlap race. + */ +# ifndef QSC_MAX_ALLOC +# define QSC_MAX_ALLOC 512 +# endif + +/* + * Minimum separation of upward-growing nonaligned allocations and + * downward-growing aligned allocations, in bytes, to avoid overlap + * race. Should be a small multiple of QSC_MAX_ALLOC for safety. + */ +# ifndef QSC_RED_ZONE +# define QSC_RED_ZONE 4096 +# endif +#endif + +#ifdef QSC_DEBUG +#define QSC_ASSERT(x) ap_assert(x) +#else +#define QSC_ASSERT(x) /* nothing */ +#endif + +/* Round x up to the next a */ +#define QSC_ALIGN(x, a) (((x) + (a) - 1) & ~((a) - 1)) + +/* + * Atomic compare-and-swap function. Returns nonzero on success. + */ +#ifdef IRIX +# if _MIPS_SIM == _ABIO32 +# if IRIX < 65 +/* + * SGI's ucode (o32 ABI) compilers lack an intrinsic so use _r4k_cas + * from libc. This won't work if you're using an R3000 or earlier, + * which lack load-linked/store-conditional instructions; you'll have to + * use uscas() after calling usinit(). + */ +extern int _r4k_cas(unsigned long *, unsigned long, unsigned long); +# define qsc_cas(p, oldval, newval) _r4k_cas(p, oldval, newval) +# else +/* + * Starting with Irix 6.5 _r4k_cas is hidden in libc so we can't use it. + * Either build -n32 or -64, use uscas() after calling usinit(), or + * don't use the QSC. + */ +# error "build -n32 or -64 on Irix 6.5 and above" +# endif +# else +/* + * Use SGI's MIPSpro (n32 and 64-bit ABIs) compiler intrinsic + * __compare_and_swap(). + */ +# define qsc_cas(p, oldval, newval) __compare_and_swap(p, oldval, newval) +# endif +#elif defined(__GNUC__) && __GNUC__ >= 2 && \ + (defined(__i486__) || defined(__i586__) || defined(__i686__) || \ + defined(__pentium__) || defined(__pentiumpro__)) +/* + * Use asm statement copied from Linux libpthread's __compare_and_swap(). + */ +static ap_inline int +qsc_cas(ap_atomic *p, ap_atomic oldval, ap_atomic newval) +{ + char ret; + ap_atomic readval; + + __asm__ __volatile__ ("lock; cmpxchgl %3, %1; sete %0" + : "=q" (ret), "=m" (*p), "=a" (readval) + : "r" (newval), "m" (*p), "a" (oldval)); + return ret; +} +#else +# error "need atomic compare-and-swap function" +#endif + +/* Hash table entry */ +struct qsc_entry { + struct qsc_entry *next; /* in hash bucket */ + char *uri; /* URI of cache entry */ + const server_rec *server; /* vhost serving entry */ + void *kaheaders; /* keep-alive HTTP response headers */ + size_t nkaheaderbytes; /* length of kaheaders */ + void *ccheaders; /* non-ka HTTP response headers */ + size_t nccheaderbytes; /* length of ccheaders */ + void *body; /* mmap_static response body */ + size_t nbodybytes; /* length of body */ + const char *nbodybytesstr; /* sprintf("%ld", (long) nbodybytes) */ +#ifdef QSC_DEBUG + const char *filename; /* name of mapped file */ +#endif +}; + +/* Counters */ +struct qsc_stats { + ap_atomic nfailures; /* number of failed insertions */ + ap_atomic nucreq; /* number of uncachable requests */ + ap_atomic nucres; /* number of uncachable responses */ + ap_atomic nhits; /* number of successful hash table lookups */ + ap_atomic nmisses; /* number of unsuccessful hash table lookups */ + ap_atomic nresets; /* number of resets */ +}; + +/* All QSC data */ +struct qsc { + struct qsc_stats stats; + struct qsc_entry *hash_table[QSC_HASH_SIZE]; + ap_atomic alloc_head; +#if QSC_HEADER_GRAIN > 0 + ap_atomic alloc_aligned; +#endif +}; + +static struct qsc *qsc; /* root of qsc data shared by all */ + +/* + * Add v to *p atomically and return the original value of *p. + */ +static ap_inline ap_atomic +qsc_atomic_add(ap_atomic *p, ap_atomic v) +{ + ap_atomic r; + + do + r = *p; + while (!qsc_cas(p, r, r + v)); + + return r; +} + +/* + * Atomically insert the new entry into the hash bucket at head and return + * the old value of *head. + */ +static ap_inline struct qsc_entry * +qsc_atomic_insert(struct qsc_entry **head, struct qsc_entry *new) +{ + do + new->next = *head; + while (!qsc_cas((ap_atomic *) head, (ap_atomic) new->next, + (ap_atomic) new)); + + return new->next; +} + +/* + * Initialize or reset the shared-memory allocator. + */ +static void +qsc_init_malloc(void) +{ + qsc->alloc_head = QSC_ALIGN((ap_atomic) (qsc + 1), QSC_GRAIN); +#if QSC_HEADER_GRAIN > 0 + qsc->alloc_aligned = ((ap_atomic) qsc + QSC_MAX_SIZE) & + ~(QSC_HEADER_GRAIN - 1); + if (qsc->alloc_aligned < qsc->alloc_head) + qsc->alloc_aligned = qsc->alloc_head; +#endif +} + +/* + * Allocate nbytes from shared memory. + */ +static void * +qsc_malloc(size_t nbytes) +{ + ap_atomic r, n; + + nbytes = QSC_ALIGN(nbytes, QSC_GRAIN); +#if QSC_HEADER_GRAIN > 0 + QSC_ASSERT(qsc->alloc_head <= qsc->alloc_aligned); + if (nbytes <= QSC_MAX_ALLOC) { +#endif + do { + r = qsc->alloc_head; + n = r + nbytes; + if (n > +#if QSC_HEADER_GRAIN > 0 + qsc->alloc_aligned - QSC_RED_ZONE +#else + (ap_atomic) qsc + QSC_MAX_SIZE +#endif + ) { + r = 0; + break; + } + } while (!qsc_cas(&qsc->alloc_head, r, n)); +#if QSC_HEADER_GRAIN > 0 + } else + r = 0; +#endif + + return (void *) r; +} + +#if QSC_HEADER_GRAIN > 0 +/* + * Allocate nbytes from shared memory, aligned to a QSC_HEADER_GRAIN + * virtual address. nbytes must be similarly aligned. + */ +static void * +qsc_hmalloc(size_t nbytes) +{ + ap_atomic n; + + QSC_ASSERT((qsc->alloc_aligned & (QSC_HEADER_GRAIN - 1)) == 0); + QSC_ASSERT((nbytes & (QSC_HEADER_GRAIN - 1)) == 0); + QSC_ASSERT(qsc->alloc_head <= qsc->alloc_aligned); + + if (nbytes <= QSC_MAX_ALLOC) { + ap_atomic r; + + do { + r = qsc->alloc_aligned; + n = r - nbytes; + if (n < qsc->alloc_head + QSC_RED_ZONE) { + n = 0; + break; + } + } while (!qsc_cas(&qsc->alloc_aligned, r, n)); + } else + n = 0; + + return (void *) n; +} +#endif + +/* + * Free vp to shared memory. + */ +/*ARGSUSED0*/ +static void +qsc_free(void *vp) +{ + /* no-op */ +} + +/* + * Return the number of bytes of shared memory in use. + */ +static ap_atomic +qsc_inuse(void) +{ + return qsc->alloc_head - (ap_atomic) qsc +#if QSC_HEADER_GRAIN > 0 + + ((ap_atomic) qsc + QSC_MAX_SIZE) - qsc->alloc_aligned + QSC_RED_ZONE +#endif + ; +} + +/* + * Hash the URI into an integer. + */ +static unsigned long +qsc_hash_uri(const char *uri) +{ + unsigned long hash = 0; + + while (*uri) + hash = (hash << 4) - hash + *uri++; /* hash = hash * 15 + *uri++ */ + + return hash; +} + +/* + * Return the hash table entry for the URI and vhost, or NULL if none. + */ +static struct qsc_entry * +qsc_lookup_uri(const char *uri, const server_rec *server) +{ + struct qsc_entry *ep; + + ep = qsc->hash_table[qsc_hash_uri(uri) % QSC_HASH_SIZE]; + while (ep && (ep->server != server || strcmp(ep->uri, uri))) { +#if defined(IRIX) && _MIPS_SIM != _ABIO32 +#pragma mips_frequency_hint NEVER +#endif + ep = ep->next; + } + + /* printf("%d: qsc_lookup_uri(%s, 0x%08x) -> 0x%08x\n", getpid(), uri, server, ep); */ + + return ep; +} + +/* + * Insert a new hash table entry for the URI and vhost and return it, or + * NULL if not possible. + */ +static struct qsc_entry * +qsc_insert_uri(const char *uri) +{ + struct qsc_entry *nep; + + nep = (struct qsc_entry *) qsc_malloc(sizeof *nep); + if (nep) { + size_t nb; + + nep->next = NULL; + + nb = strlen(uri) + 1; + nep->uri = (char *) qsc_malloc(nb); + if (nep->uri) { + memcpy(nep->uri, uri, nb); + + /* + * insert it even if some other thread already did; + * suffer an occasional duplicate entry rather than + * have to spin-lock the table + */ + qsc_atomic_insert(&qsc->hash_table[qsc_hash_uri(uri) % + QSC_HASH_SIZE], nep); + } else { + qsc_free(nep); + nep = NULL; + } + } + + /* printf("%d: qsc_insert_uri(%s) -> 0x%08x\n", getpid(), uri, nep); */ + + return nep; +} + +/* + * Clear out the shared QSC global data. Does not destroy it, just + * clears it. + */ +/*ARGSUSED0*/ +static void +qsc_cleanup(void *junk) +{ + ap_atomic n; + + /* + * No locking here because this is only ever called while the server + * is single-threaded (single-processed, whatever). + */ + + n = qsc->stats.nresets; + memset(qsc, 0, sizeof *qsc); + qsc->stats.nresets = n + 1; + + qsc_init_malloc(); +} + +/* + * Increment the insertion-failure counter and log an error if this is + * the first failure. + */ +static void +qsc_failure(void) +{ + if (qsc_atomic_add(&qsc->stats.nfailures, 1) == 0) + ap_log_error(APLOG_MARK, APLOG_WARNING | APLOG_NOERRNO, NULL, + "QSC is full; compile with larger QSC_MAX_SIZE and/or QSC_MAX_ALLOC to cache more"); +} + +/* + * Update a stats counter from a scoreboard counter. + */ +static void +qsc_counter_sync(ap_atomic *score_counter, ap_atomic *stats_counter) +{ + ap_atomic n; + + do + n = *score_counter; + while (n && !qsc_cas(score_counter, n, 0)); + + if (n) + qsc_atomic_add(stats_counter, n); +} + +/* + * Update the QSC stats counters from the individual scoreboard server + * counters. + */ +static void +qsc_sync_from_scoreboard(void) +{ + int i; + + for (i = 0; i < HARD_SERVER_LIMIT; i++) { + qsc_counter_sync(&ap_scoreboard_image->servers[i].qsc_nucreq, + &qsc->stats.nucreq); + qsc_counter_sync(&ap_scoreboard_image->servers[i].qsc_nucres, + &qsc->stats.nucres); + qsc_counter_sync(&ap_scoreboard_image->servers[i].qsc_nhits, + &qsc->stats.nhits); + qsc_counter_sync(&ap_scoreboard_image->servers[i].qsc_nmisses, + &qsc->stats.nmisses); + + /* + * This really only works with shared memory scoreboards. + * To make this work with a file-based scoreboard: + * - make qsc_counter_sync() return nonzero when it updates + * - if any call above returns nonzero, call put_scoreboard_info + * - but first make put_scoreboard_info global + * - call ap_sync_scoreboard_image() once before loop + * - pray two processes don't call this function at the same time + */ + } +} + +/* + * HTTP/1.1 header fields, from RFC 2068, and their effects on QSC operation. + * + * Header Field Name Type Cachability + * ----------------- ---- ------------ + * Accept request ignore, but should obey + * Accept-Charset request ignore, but should obey + * Accept-Encoding request ignore, but should obey + * Accept-Language request ignore, but should obey + * Accept-Ranges response ignore + * Age response ignore + * Allow entity ignore + * Alternates response ignore + * Authorization request uncachable by choice (could handle) + * Cache-Control general uncachable + * Connection general keep separate ka & !ka headers cached + * Content-Base entity ignore + * Content-Encoding entity ignore + * Content-Language entity ignore + * Content-Length entity ignore + * Content-Location entity ignore + * Content-MD5 entity ignore + * Content-Range entity uncachable by choice (could handle) + * Content-Type entity ignore + * Content-Version entity ignore + * Date general ignore + * Derived-From entity ignore + * ETag entity uncachable if weak, otherwise ignore + * Expires entity uncachable? (see 14.21) + * From request ignore + * Host request secondary cache key? (see 14.23) + * If-Modified-Since request uncachable by choice (could handle) + * If-Match request ignore: cached etags don't change + * If-None-Match request uncachable by choice (could handle) + * If-Range request uncachable by choice (could handle) + * If-Unmodified-Since request ignore: cached dates don't change + * Keep-Alive connection ignore + * Last-Modified entity ignore + * Link entity ignore + * Location response ignore + * Max-Forwards request ignore + * Pragma general uncachable if "no-cache", otherwise ignore + * Proxy-Authenticate response ignore + * Proxy-Authorization request ignore + * Public response ignore + * Range request uncachable by choice + * Referer request ignore + * Retry-After response ignore + * Server response ignore + * Transfer-Encoding general ignore + * Upgrade general ignore + * User-Agent request ignore + * Vary response uncachable + * Via general ignore + * Warning response ignore + * WWW-Authenticate response ignore + */ + +/* + * Return nonzero if the request is cachable, zero otherwise. + */ +static int +qsc_request_is_cachable(const request_rec *r) +{ + int cachable; + const array_header *ap; + int i; + + /* + * Requests are cachable if they: + * - are GET, and + * - are not explicitly marked no_cache, + * - are not translated, + * unless they contain one of the following headers: + * Authorization: ... + * QSC does not support authorization. + * Cache-Control: ... + * Most values limit cachability so assume all do, for speed. + * If-Modified-Since: ... + * If-None-Match: ... + * Both require extra processing. + * If-Range: ... + * QSC does not support ranges yet. + * Pragma: no-cache + * Explicit. + * Range: ... + * QSC does not support ranges yet. + */ + + cachable = r->method_number == M_GET && !r->header_only && !r->no_cache +#ifdef CHARSET_EBCDIC + && !ap_bgetflag(r->connection->client, B_ASCII2EBCDIC) +#endif + ; + ap = ap_table_elts(r->headers_in); + for (i = 0; cachable && i < ap->nelts; i++) { + const table_entry *tep = &((table_entry *) ap->elts)[i]; + + switch (ap_tolower(tep->key[0])) { + case 'a': + if (!strcasecmp(tep->key, "authorization")) { +#if defined(IRIX) && _MIPS_SIM != _ABIO32 +#pragma mips_frequency_hint NEVER +#endif + cachable = 0; + } + break; + case 'c': + if (!strcasecmp(tep->key, "cache-control")) { +#if defined(IRIX) && _MIPS_SIM != _ABIO32 +#pragma mips_frequency_hint NEVER +#endif + cachable = 0; + } + break; + case 'i': + if (!strcasecmp(tep->key, "if-modified-since") || + !strcasecmp(tep->key, "if-none-match") || + !strcasecmp(tep->key, "if-range")) { +#if defined(IRIX) && _MIPS_SIM != _ABIO32 +#pragma mips_frequency_hint NEVER +#endif + cachable = 0; + } + break; + case 'p': + if (!strcasecmp(tep->key, "pragma") && + !strcasecmp(tep->val, "no-cache")) { +#if defined(IRIX) && _MIPS_SIM != _ABIO32 +#pragma mips_frequency_hint NEVER +#endif + cachable = 0; + } + break; + case 'r': + if (!strcasecmp(tep->key, "range")) { +#if defined(IRIX) && _MIPS_SIM != _ABIO32 +#pragma mips_frequency_hint NEVER +#endif + cachable = 0; + } + break; + } + } + + return cachable; +} + +/* + * Return nonzero if the response is cachable, zero otherwise. + */ +static int +qsc_response_is_cachable(const request_rec *r) +{ + int cachable; + const array_header *ap; + int i; + + /* + * Responses are cachable if they: + * - have status 200 OK, and + * - are not chunked, and + * - are not explicitly marked no_cache, + * - are not translated, + * unless they contain one of the following headers: + * Cache-Control: ... + * Most values limit cachability so assume all do, for speed. + * Content-Range: ... + * QSC does not support ranges yet. + * ETag: W/... (that is, strong etags are cachable, weaks ones are not) + * Cache only strong entity-tags. Weak etags will change to + * strong soon enough (see ap_set_etag()). + * Expires: ... + * QSC does not support removal or update of cache entries. + * Pragma: no-cache + * Explicit. + * Vary: ... + * Response depends on values other than URI, and QSC uses only + * the URI to look up cache entries. + */ + + cachable = r->status == HTTP_OK && !r->chunked && !r->no_cache +#ifdef CHARSET_EBCDIC + && !ap_bgetflag(r->connection->client, B_EBCDIC2ASCII) +#endif + ; + ap = ap_table_elts(r->headers_out); + for (i = 0; cachable && i < ap->nelts; i++) { + const table_entry *tep = &((table_entry *) ap->elts)[i]; + + switch (ap_tolower(tep->key[0])) { + case 'c': + if (!strcasecmp(tep->key, "cache-control") || + !strcasecmp(tep->key, "content-range")) + cachable = 0; + break; + case 'e': + if ((!strcasecmp(tep->key, "etag") && + !strncasecmp(tep->val, "w/", 2)) || + !strcasecmp(tep->key, "expires")) + cachable = 0; + break; + case 'p': + if (!strcasecmp(tep->key, "pragma") && + !strcasecmp(tep->val, "no-cache")) + cachable = 0; + break; + case 'v': + if (!strcasecmp(tep->key, "vary")) + cachable = 0; + break; + } + } + + return cachable; +} + +/* + * Return nonzero if the request uses keep-alive. Also sets + * r->connection->keepalive. + */ +static int +qsc_set_keepalive(request_rec *r) +{ + conn_rec *c; + const server_rec *s; + const char *ch; + int ka; + + /* + * This performs the same function as ap_set_keepalive() but we can + * make some simplifying assumptions which speed up the decision. + * Specifically, we know: + * r->status == HTTP_OK + * !r->header_only + * r->headers_out contains a Content-Length header + * r->headers_out does not contain a Connection header + * r->subprocess_env does not contain a nokeepalive header + * Also we do not send a Keep-Alive header back, since it's optional + * anyway and the value changes every time if s->keep_alive_max > 0 + * (making it hard to cache and optimize). + */ + c = r->connection; + s = r->server; + ch = ap_table_get(r->headers_in, "Connection"); + if (c->keepalive >= 0 && + s->keep_alive && + s->keep_alive_timeout > 0 && + (s->keep_alive_max == 0 || s->keep_alive_max > c->keepalives) && + (ch == NULL || strcasecmp(ch, "close")) && + (r->proto_num >= HTTP_VERSION(1,1) || + (ch && !strcasecmp(ch, "keep-alive")))) { + ka = 1; + c->keepalives++; + } else + ka = 0; + + c->keepalive = ka; + return ka; +} + +/* + * Initialize the QSC. The given pool must match the one + * mod_mmap_static registers its cleanup upon, since we share pointers + * with it which it unmaps during its cleanup. + */ +void +qsc_init(pool *p) +{ + if (ap_qsc_enabled) { + if (ap_find_linked_module("mod_mmap_static.c")) { +#if defined(IRIX) && _MIPS_SIM != _ABIO32 +/* disable warning about constant controlling expression */ +#pragma set woff 1209 +#endif + if (QSC_MAX_SIZE >= sizeof *qsc) { +#if defined(IRIX) && _MIPS_SIM != _ABIO32 +#pragma reset woff 1209 +#endif + caddr_t m; + + /* + * Use the same mechanism as the scoreboard, except it + * must be shared memory of some sort (not a file). + */ +#ifdef USE_SHMGET_SCOREBOARD + m = ap_share_anonymous(p, 0, QSC_MAX_SIZE); +#else + m = ap_map_anonymous(p, 0, QSC_MAX_SIZE); +#endif + if (m != (caddr_t) (ap_ptr) -1) { + qsc = (struct qsc *) m; + qsc_init_malloc(); + ap_register_cleanup(p, NULL, qsc_cleanup, ap_null_cleanup); + } else + ap_log_error(APLOG_MARK, APLOG_WARNING | APLOG_NOERRNO, NULL, + "cannot obtain %d bytes of anonymous shared memory; QSC disabled", + QSC_MAX_SIZE); + } else + ap_log_error(APLOG_MARK, APLOG_WARNING | APLOG_NOERRNO, NULL, + "QSC_MAX_SIZE too small; QSC disabled"); + } else + ap_log_error(APLOG_MARK, APLOG_WARNING | APLOG_NOERRNO, NULL, + "mmap_static module not configured; QSC disabled"); + } +} + +/* + * Try to shortcut the request through the QSC. Returns nonzero if + * successful, zero if the server should continue normal processing. + */ +int +qsc_process_request(request_rec *r) +{ + int handled = 0; + + if (qsc) { + short_score *sp; + + sp = &ap_scoreboard_image->servers[r->connection->child_num]; + if (qsc_request_is_cachable(r)) { + const struct qsc_entry *ep; + + /* + * Used to increment shared stats counters directly but on + * large systems that can cause cache line thrashing. + * qsc_atomic_add(ep ? &qsc->stats.nhits : &qsc->stats.nmisses, 1); + * Instead increment nonshared scoreboard server counters + * and rely on qsc_sync_from_scoreboard() to update the + * shared stats counters. + */ + + QSC_ASSERT(r->prev == NULL); /* r is original request */ + ep = qsc_lookup_uri(r->unparsed_uri, r->server); + if (ep) { + struct iovec iovec[2]; + + qsc_atomic_add(&sp->qsc_nhits, 1); + + /* + * The set of headers sent depends on the connection + * status, keep-alive (ka) vs. single-shot (cc, for + * connection: close). + */ + if (qsc_set_keepalive(r)) { + iovec[0].iov_base = ep->kaheaders; + iovec[0].iov_len = ep->nkaheaderbytes; + } else { + iovec[0].iov_base = ep->ccheaders; + iovec[0].iov_len = ep->nccheaderbytes; + } +#if QSC_HEADER_GRAIN > 0 + QSC_ASSERT((iovec[0].iov_len & (QSC_HEADER_GRAIN - 1)) == 0); +#endif + iovec[1].iov_base = ep->body; + iovec[1].iov_len = ep->nbodybytes; + + if (iovec[1].iov_len <= MMAP_SEGMENT_SIZE) { + /* nice and small, write all at once */ + ap_send_iovec(r, iovec, 2); + } else { + /* + * bigger than we'd like; segment it WITHOUT using + * ap_bwrite() which copies data around and + * unnecessarily handles chunked encoding. + * ap_send_iovec() is streamlined for us. + */ + iovec[1].iov_len = MMAP_SEGMENT_SIZE; + if (ap_send_iovec(r, iovec, 2) > 0) { + size_t nw = MMAP_SEGMENT_SIZE; + do { + iovec[1].iov_base = (char *) ep->body + nw; + iovec[1].iov_len = ep->nbodybytes - nw; + if (iovec[1].iov_len > MMAP_SEGMENT_SIZE) + iovec[1].iov_len = MMAP_SEGMENT_SIZE; + } while (ap_send_iovec(r, &iovec[1], 1) > 0 && + (nw += iovec[1].iov_len) < ep->nbodybytes); + } + } + + /* keep logging happy */ + r->sent_bodyct = 1; + ap_table_addn(r->headers_out, "Content-Length", + ep->nbodybytesstr); + + handled = 1; + } else + qsc_atomic_add(&sp->qsc_nmisses, 1); + } else + qsc_atomic_add(&sp->qsc_nucreq, 1); + } + + return handled; +} + +/* + * Insert an entry into the QSC. The given basic header, headers from + * the request, and given body are all cached together indexed by the + * original request's URI. + */ +void +qsc_insert_request(request_rec *r, const char *basic_header, + size_t basic_header_len, void *body, size_t nbodybytes, + const char *nbodybytesstr, const char *filename) +{ + if (qsc && qsc_request_is_cachable(r) && qsc_response_is_cachable(r)) { + array_header *ap; + struct header_size { + size_t keylen; + size_t vallen; + } *header_sizes; + int i; + size_t nheaderbytes; +#if QSC_HEADER_GRAIN > 0 + size_t akalen, acclen; + const char *pp, *padpoint; +#endif + char *kaheaders, *ccheaders; + static const char katail[] = "Connection: keep-alive\r\n\r\n"; + static const char cctail[] = "Connection: close\r\n\r\n"; + enum { + kalength = 26, /* strlen(katail) */ + cclength = 21 /* strlen(cctail) */ + }; + + ap = ap_table_elts(r->headers_out); + header_sizes = (struct header_size *) ap_palloc(r->pool, + ap->nelts * sizeof *header_sizes); + +#if QSC_HEADER_GRAIN > 0 + /* + * Find where we will insert padding if necessary: append to + * the Server header value. Probe the most likely place first + * (where we think ap_tee_basic_http_header() put it) and + * failing that, scan for it. + */ + if (basic_header_len >= 12 && + !strncmp(basic_header + basic_header_len - + strlen(ap_get_server_version()) - 12, "\r\nServer: ", 10)) + padpoint = basic_header + basic_header_len - 2; + else { + padpoint = NULL; + for (pp = basic_header + basic_header_len; --pp >= basic_header; ) { + if (*pp == '\015') + padpoint = pp; + if ((*pp == 'S' || *pp == 's') && + pp + 8 < basic_header + basic_header_len && + !strncasecmp(pp, "server: ", 8)) + break; + } + if (pp < basic_header) + padpoint = NULL; + } +#endif + + /* measure lengths of strings and total length of linearized headers */ + nheaderbytes = basic_header_len; + for (i = 0; i < ap->nelts; i++) { + table_entry *tep; + int h; + + tep = &((table_entry *) ap->elts)[i]; + h = 1; + switch (ap_tolower(tep->key[0])) { + case 'c': + /* the Connection header is handled separately */ + if (!strcasecmp(tep->key, "connection")) + h = 0; + break; + case 'k': + /* don't cache the Keep-Alive header */ + if (!strcasecmp(tep->key, "keep-alive")) + h = 0; + break; + } + + if (h) { + header_sizes[i].keylen = strlen(tep->key); + header_sizes[i].vallen = strlen(tep->val); + + /* +4 for ": " and "\r\n" */ + nheaderbytes += header_sizes[i].keylen + + header_sizes[i].vallen + 4; + } else + header_sizes[i].keylen = 0; + } + + /* create ka & cc linearized headers using above info */ +#if QSC_HEADER_GRAIN > 0 + /* round up to QSC_HEADER_GRAIN */ + akalen = QSC_ALIGN(nheaderbytes + kalength, QSC_HEADER_GRAIN); + acclen = QSC_ALIGN(nheaderbytes + cclength, QSC_HEADER_GRAIN); + /* align that to QSC_HEADER_GRAIN vaddr */ + kaheaders = (char *) qsc_hmalloc(akalen); + ccheaders = (char *) qsc_hmalloc(acclen); +#else + kaheaders = (char *) qsc_malloc(nheaderbytes + kalength); + ccheaders = (char *) qsc_malloc(nheaderbytes + cclength); +#endif + if (kaheaders && ccheaders) { +#if QSC_HEADER_GRAIN > 0 + size_t npad; +#endif + char *hp; + request_rec *or; + struct qsc_entry *ep; + + /* linearize ka headers first */ +#if QSC_HEADER_GRAIN > 0 + npad = akalen - (nheaderbytes + kalength); + if (padpoint && npad > 0) { + size_t padoff = padpoint - basic_header; + + /* copy up to padpoint */ + memcpy(kaheaders, basic_header, padoff); + hp = kaheaders + padoff; + + /* pad with spaces */ + memset(hp, ' ', npad); + hp += npad; + + /* copy the rest */ + npad = basic_header_len - padoff; + memcpy(hp, basic_header + padoff, npad); + hp += npad; + } else { +#endif + memcpy(kaheaders, basic_header, basic_header_len); + hp = kaheaders + basic_header_len; +#if QSC_HEADER_GRAIN > 0 + } +#endif + for (i = 0; i < ap->nelts; i++) { + if (header_sizes[i].keylen > 0) { + table_entry *tep = &((table_entry *) ap->elts)[i]; + memcpy(hp, tep->key, header_sizes[i].keylen); + hp += header_sizes[i].keylen + 2; + hp[-2] = ':'; + hp[-1] = ' '; + memcpy(hp, tep->val, header_sizes[i].vallen); + hp += header_sizes[i].vallen + 2; + hp[-2] = '\r'; + hp[-1] = '\n'; + } + } + memcpy(hp, katail, kalength); +#if QSC_HEADER_GRAIN > 0 + QSC_ASSERT(((ap_ptr) kaheaders & (QSC_HEADER_GRAIN - 1)) == 0); + QSC_ASSERT(((ap_ptr) (hp + kalength) & (QSC_HEADER_GRAIN - 1)) == 0 || + padpoint == NULL); +#endif + + /* now linearize the cc headers */ +#if QSC_HEADER_GRAIN > 0 + npad = acclen - (nheaderbytes + cclength); + if (padpoint && npad > 0) { + size_t padoff = padpoint - basic_header; + + /* copy up to padpoint */ + memcpy(ccheaders, basic_header, padoff); + hp = ccheaders + padoff; + + /* pad with spaces */ + memset(hp, ' ', npad); + hp += npad; + + /* copy the rest */ + npad = basic_header_len - padoff; + memcpy(hp, basic_header + padoff, npad); + hp += npad; + } else { + memcpy(ccheaders, basic_header, basic_header_len); + hp = ccheaders + basic_header_len; + } + for (i = 0; i < ap->nelts; i++) { + if (header_sizes[i].keylen > 0) { + table_entry *tep = &((table_entry *) ap->elts)[i]; + memcpy(hp, tep->key, header_sizes[i].keylen); + hp += header_sizes[i].keylen + 2; + hp[-2] = ':'; + hp[-1] = ' '; + memcpy(hp, tep->val, header_sizes[i].vallen); + hp += header_sizes[i].vallen + 2; + hp[-2] = '\r'; + hp[-1] = '\n'; + } + } + memcpy(hp, cctail, cclength); + QSC_ASSERT(((ap_ptr) ccheaders & (QSC_HEADER_GRAIN - 1)) == 0); + QSC_ASSERT(((ap_ptr) (hp + cclength) & (QSC_HEADER_GRAIN - 1)) == 0 || + padpoint == NULL); +#else + /* ka & cc headers differ only in the tail portion */ + QSC_ASSERT(hp - kaheaders == nheaderbytes); + memcpy(ccheaders, kaheaders, nheaderbytes); + memcpy(ccheaders + nheaderbytes, cctail, cclength); +#endif + + /* + * insert headers and body into cache, indexed by original + * uri and current vhost + */ + for (or = r; or->prev; or = or->prev) + ; + ep = qsc_insert_uri(or->uri); + if (ep) { + ep->kaheaders = kaheaders; + ep->nkaheaderbytes = +#if QSC_HEADER_GRAIN > 0 + padpoint ? akalen : +#endif + nheaderbytes + kalength; + ep->ccheaders = ccheaders; + ep->nccheaderbytes = +#if QSC_HEADER_GRAIN > 0 + padpoint ? acclen : +#endif + nheaderbytes + cclength; + ep->body = body; + ep->nbodybytes = nbodybytes; + ep->nbodybytesstr = nbodybytesstr; +#ifdef QSC_DEBUG + ep->filename = filename; +#endif + /* + * set server field last so nobody uses this entry until + * it's all filled in + */ + ep->server = r->server; + } else { + qsc_free(ccheaders); + qsc_free(kaheaders); + qsc_failure(); + } + } else { + qsc_failure(); + if (ccheaders) + qsc_free(ccheaders); + if (kaheaders) + qsc_free(kaheaders); + } + } else if (qsc) + qsc_atomic_add(&ap_scoreboard_image->servers[r->connection->child_num].qsc_nucres, 1); +} + +/* + * Send a QSC report card. + * Options are: + * full show detailed info about each entry + * quick don't compute anything, just dump counters + */ +void +qsc_status(request_rec *r, const char *option) +{ + ap_rputs("

    Quick Shortcut Cache (QSC) Status:\n", r);
    +
    +    if (qsc) {
    +	static const char fmt[] = "  %-20s %s\n";
    +	char buf[128];
    +	struct qsc_stats stats;
    +	int i, full, quick, nbuckets, nentries, longest_chain, ndupent;
    +	ap_atomic nlookups, nuribytes, nheaderbytes, nbodybytes, nbodyvas;
    +	int histogram[QSC_HIST_SIZE], pagesize;
    +	struct qsc_entry *ep;
    +
    +	full = 0;
    +	quick = 0;
    +	if (option) {
    +	    if (!strcasecmp(option, "full"))
    +		full = 1;
    +	    else if (!strcasecmp(option, "quick"))
    +		quick = 1;
    +	    else
    +		ap_rprintf(r, "Unknown QSC status option \"%s\"\n",
    +		    ap_escape_html(r->pool, option));
    +	}
    +
    +	qsc_sync_from_scoreboard();
    +
    +	stats = qsc->stats;	/* take a more or less consistent snapshot */
    +	nbuckets = 0;
    +	nentries = 0;
    +	longest_chain = 0;
    +	nuribytes = 0;
    +	nheaderbytes = 0;
    +	nbodybytes = 0;
    +	nbodyvas = 0;
    +	ndupent = 0;
    +	memset(histogram, 0, sizeof histogram);
    +	pagesize = getpagesize();
    +	if (pagesize <= 0 || (pagesize & (pagesize - 1)) != 0)
    +	    pagesize = 4096;
    +
    +	if (!quick) {
    +	    for (i = 0; i < QSC_HASH_SIZE; i++) {
    +		ep = qsc->hash_table[i];
    +		if (ep) {
    +		    int cl;
    +
    +		    nbuckets++;
    +
    +		    cl = 0;
    +		    do {
    +			struct qsc_entry *dp;
    +
    +			cl++;
    +			nentries++;
    +			nuribytes += strlen(ep->uri) + 1;
    +			nheaderbytes += ep->nkaheaderbytes + ep->nccheaderbytes;
    +			nbodybytes += ep->nbodybytes;
    +			nbodyvas += QSC_ALIGN(ep->nbodybytes, pagesize);
    +
    +			/* don't double-count duplicates */
    +			for (dp = qsc->hash_table[i]; dp != ep; dp = dp->next)
    +			    if (ep->server == dp->server &&
    +			        !strcmp(ep->uri, dp->uri))
    +				break;
    +			if (dp == ep)
    +			    for (dp = ep->next; dp; dp = dp->next)
    +				if (ep->server == dp->server &&
    +				    !strcmp(ep->uri, dp->uri))
    +				    ndupent++;
    +
    +			ep = ep->next;
    +		    } while (ep);
    +
    +		    if (cl > longest_chain)
    +			longest_chain = cl;
    +		    histogram[((cl <= QSC_HIST_SIZE) ? cl : QSC_HIST_SIZE) - 1]++;
    +		}
    +	    }
    +	}
    +
    +	/*
    +	 * ap_vformatter() botches some conversions (like %.2f) so use
    +	 * sprintf() then ap_rprintf()
    +	 */
    +
    +	nlookups = stats.nucreq + stats.nucres + stats.nhits + stats.nmisses;
    +	sprintf(buf, "%ld/%ld (%.2f%%)",
    +	    (long) stats.nhits, (long) nlookups,
    +	    nlookups ? (double) stats.nhits * 100.0 / (double) nlookups : 0);
    +	ap_rprintf(r, fmt, "hit ratio", buf);
    +	if (!quick) {
    +	    ap_atomic uncachable;
    +
    +	    uncachable = stats.nucreq + stats.nucres + stats.nmisses -
    +	        nentries;
    +	    sprintf(buf, "%ld/%ld (%.2f%%)",
    +		(long) uncachable, (long) nlookups,
    +		nlookups ? (double) uncachable * 100.0 / (double) nlookups : 0);
    +	    ap_rprintf(r, fmt, "uncachable", buf);
    +
    +	    uncachable = stats.nmisses - nentries;
    +	    sprintf(buf, "%ld/%ld (%.2f%%)",
    +		(long) uncachable, (long) stats.nmisses,
    +		stats.nmisses ? (double) uncachable * 100.0 / (double) stats.nmisses : 0);
    +	    ap_rprintf(r, fmt, "uncachable misses", buf);
    +	}
    +	sprintf(buf, "%ld/%ld (%.2f%%)",
    +	    (long) stats.nucreq, (long) nlookups,
    +	    nlookups ? (double) stats.nucreq * 100.0 / (double) nlookups : 0);
    +	ap_rprintf(r, fmt, "uncachable requests", buf);
    +	sprintf(buf, "%ld/%ld (%.2f%%)",
    +	    (long) stats.nucres, (long) nlookups,
    +	    nlookups ? (double) stats.nucres * 100.0 / (double) nlookups : 0);
    +	ap_rprintf(r, fmt, "uncachable responses", buf);
    +	sprintf(buf, "%ld", (long) stats.nresets);
    +	ap_rprintf(r, fmt, "resets", buf);
    +
    +	ap_rputs("Hash table\n", r);
    +	sprintf(buf, "%ld", (long) stats.nfailures);
    +	ap_rprintf(r, fmt, "failed insertions", buf);
    +	if (!quick) {
    +	    ap_atomic inuse;
    +
    +	    sprintf(buf, "%d", nentries);
    +	    ap_rprintf(r, fmt, "entries", buf);
    +	    sprintf(buf, "%d", ndupent);
    +	    ap_rprintf(r, fmt, "duplicate entries", buf);
    +	    sprintf(buf, "%d/%d (%.2f%%)", nbuckets, QSC_HASH_SIZE,
    +		(double) nbuckets * 100.0 / (double) QSC_HASH_SIZE);
    +	    ap_rprintf(r, fmt, "bucket use", buf);
    +	    sprintf(buf, "%d/%d (%.2f%%)", nbuckets, nentries,
    +		nentries ? (double) nbuckets * 100.0 / (double) nentries : 0);
    +	    ap_rprintf(r, fmt, "hash effectiveness", buf);
    +	    sprintf(buf, "%d", longest_chain);
    +	    ap_rprintf(r, fmt, "longest chain", buf);
    +	    sprintf(buf, "%.1f", (double) nentries / QSC_HASH_SIZE);
    +	    ap_rprintf(r, fmt, "avg. chain", buf);
    +	    sprintf(buf, "%.1f", nbuckets ?
    +		(double) nentries / (double) nbuckets : 0);
    +	    ap_rprintf(r, fmt, "avg. nonempty chain", buf);
    +
    +	    ap_rputs("  Chain length histogram:\n    ", r);
    +	    for (i = 1; i < QSC_HIST_SIZE; i++)
    +		ap_rprintf(r, "%5d ", i);
    +	    ap_rprintf(r, "%5d+\n    ", i);
    +	    for (i = 1; i <= QSC_HIST_SIZE; i++)
    +		ap_rprintf(r, "%5d ", histogram[i - 1]);
    +	    ap_rputc('\n', r);
    +
    +	    ap_rputs("Memory use (in bytes)\n", r);
    +	    sprintf(buf, "%ld", (long) sizeof *qsc);
    +	    ap_rprintf(r, fmt, "table + misc", buf);
    +	    sprintf(buf, "%ld", (long) nentries * sizeof (struct qsc_entry));
    +	    ap_rprintf(r, fmt, "entries", buf);
    +	    sprintf(buf, "%lu", (unsigned long) nuribytes);
    +	    ap_rprintf(r, fmt, "URIs", buf);
    +	    sprintf(buf, "%lu", (unsigned long) nheaderbytes);
    +	    ap_rprintf(r, fmt, "headers", buf);
    +	    inuse = qsc_inuse();
    +	    sprintf(buf, "%ld/%ld (%.2f%%)", (long) inuse, (long) QSC_MAX_SIZE,
    +		(double) inuse * 100.0 / (double) QSC_MAX_SIZE);
    +	    ap_rprintf(r, fmt, "total", buf);
    +	    sprintf(buf, "%lu", (unsigned long) nbodybytes);
    +	    ap_rprintf(r, fmt, "mapped file data", buf);
    +	    sprintf(buf, "%lu (%lu %d-byte pages)", (unsigned long) nbodyvas,
    +		(unsigned long) (nbodyvas / pagesize), pagesize);
    +	    ap_rprintf(r, fmt, "mapped file vaddrs", buf);
    +	}
    +
    +	if (full) {
    +	    ap_rputs("Full entry info\n", r);
    +#ifndef QSC_DEBUG
    +	    ap_rputs("File names available only -DQSC_DEBUG\n", r);
    +#endif
    +	    ap_rputs("  server * URI @ hash-bucket -> keep-alive-header-bytes;non-keep-alive-header-bytes + body-bytes file-name\n", r);
    +
    +	    for (i = 0; i < QSC_HASH_SIZE; i++) {
    +		for (ep = qsc->hash_table[i]; ep; ep = ep->next) {
    +		    if (ep->server->defn_name)
    +			sprintf(buf, "%s:%u", ep->server->defn_name,
    +			    ep->server->defn_line_number);
    +		    else
    +			strcpy(buf, "main");
    +
    +		    ap_rprintf(r, "  %s * %s @ %d -> %lu;%lu + %lu ",
    +			ap_escape_html(r->pool, buf),
    +			ap_escape_html(r->pool, ep->uri),
    +			i,
    +			(unsigned long) ep->nkaheaderbytes,
    +			(unsigned long) ep->nccheaderbytes,
    +			(unsigned long) ep->nbodybytes);
    +#ifdef QSC_DEBUG
    +		    ap_rputs(ep->filename, r);
    +#else
    +		    ap_rwrite("n/a", 3, r);
    +#endif
    +		    ap_rputc('\n', r);
    +		}
    +	    }
    +	}
    +    } else
    +	ap_rputs("QSC disabled\n", r);
    +
    +    ap_rputs("
    \n", r); +} + +#endif diff -urN apache_1.3.20/src/main/rfc1413.c-orig apache_1.3.20/src/main/rfc1413.c --- apache_1.3.20/src/main/rfc1413.c-orig Mon Jan 15 12:05:04 2001 +++ apache_1.3.20/src/main/rfc1413.c Sat Jun 30 23:53:25 2001 @@ -118,7 +118,6 @@ int i; char *cp; char buffer[RFC1413_MAXDATA + 1]; - int buflen; /* * Bind the local and remote ends of the query socket to the same @@ -153,7 +152,7 @@ return -1; /* send the data */ - buflen = ap_snprintf(buffer, sizeof(buffer), "%u,%u\r\n", ntohs(rmt_sin->sin_port), + ap_snprintf(buffer, sizeof(buffer), "%u,%u\r\n", ntohs(rmt_sin->sin_port), ntohs(our_sin->sin_port)); /* send query to server. Handle short write. */ @@ -163,7 +162,7 @@ i = 0; while(i < strlen(buffer)) { int j; - j = write(sock, buffer+i, (strlen(buffer+i))); + j = (int) write(sock, buffer+i, (strlen(buffer+i))); if (j < 0 && errno != EINTR) { ap_log_error(APLOG_MARK, APLOG_CRIT, srv, "write: rfc1413: error sending request"); @@ -203,7 +202,7 @@ return -1; } #endif /* TPF */ - j = read(sock, buffer+i, (sizeof(buffer) - 1) - i); + j = (int) read(sock, buffer+i, (sizeof(buffer) - 1) - i); if (j < 0 && errno != EINTR) { ap_log_error(APLOG_MARK, APLOG_CRIT, srv, "read: rfc1413: error reading response"); diff -urN apache_1.3.20/src/main/util.c-orig apache_1.3.20/src/main/util.c --- apache_1.3.20/src/main/util.c-orig Fri Mar 30 12:37:54 2001 +++ apache_1.3.20/src/main/util.c Sat Jun 30 23:53:25 2001 @@ -189,47 +189,121 @@ return ap_pstrdup(p, ts); } +API_EXPORT(int) ap_gm_timestr_822_buf(char *buf, size_t size, time_t sec) +{ + struct tm *tms = gmtime(&sec); + + /* RFC date format; as strftime '%a, %d %b %Y %T GMT' */ + return ap_snprintf(buf, size, "%s, %.2d %s %d %.2d:%.2d:%.2d GMT", + ap_day_snames[tms->tm_wday], tms->tm_mday, + ap_month_snames[tms->tm_mon], tms->tm_year + 1900, + tms->tm_hour, tms->tm_min, tms->tm_sec); +} + +/*ARGSUSED*/ API_EXPORT(char *) ap_gm_timestr_822(pool *p, time_t sec) { - struct tm *tms; + /* + * Assume we're called most often to convert the current time of + * day. Since that changes at most once a second, cache the result + * to avoid unnecessary formatting under very heavy load. + */ + static struct { + time_t time; + char str[32]; + int len; + } last; - tms = gmtime(&sec); + if (sec != last.time) { +#if defined(IRIX) && _MIPS_SIM != _ABIO32 +#pragma mips_frequency_hint NEVER +#endif + last.time = sec; + last.len = ap_gm_timestr_822_buf(last.str, sizeof last.str, sec); + } - /* RFC date format; as strftime '%a, %d %b %Y %T GMT' */ - return ap_psprintf(p, - "%s, %.2d %s %d %.2d:%.2d:%.2d GMT", ap_day_snames[tms->tm_wday], - tms->tm_mday, ap_month_snames[tms->tm_mon], tms->tm_year + 1900, - tms->tm_hour, tms->tm_min, tms->tm_sec); + return ap_pstrndup(p, last.str, last.len); +} + +#ifdef FAST_TIME +# include "scoreboard.h" +#endif +/* + * Return the current time of day, ala time() only faster. + */ +API_EXPORT(time_t) ap_time(void) +{ +#ifdef FAST_TIME + /* + * Use the global shared time that the timekeeper maintains for us, + * unless there is no timekeeper. + */ + time_t t = ap_scoreboard_image ? ap_scoreboard_image->global.time : 0; + if (t == 0) { +#if defined(IRIX) && _MIPS_SIM != _ABIO32 +#pragma mips_frequency_hint NEVER +#endif + t = time(NULL); + } + return t; +#else + return time(NULL); +#endif } +/* + * The GMT offset hardly ever changes, so recompute it only once a + * second to avoid unnecessary work under very heavy load. + */ +struct { + time_t time; + struct tm tm; + int off; +} gmt_info; + /* What a pain in the ass. */ #if defined(HAVE_GMTOFF) API_EXPORT(struct tm *) ap_get_gmtoff(int *tz) { - time_t tt = time(NULL); - struct tm *t; + time_t tt = ap_time(); - t = localtime(&tt); - *tz = (int) (t->tm_gmtoff / 60); - return t; + if (tt != gmt_info.time) { +#if defined(IRIX) && _MIPS_SIM != _ABIO32 +#pragma mips_frequency_hint NEVER +#endif + gmt_info.time = tt; + gmt_info.tm = *localtime(&tt); + gmt_info.off = (int) (gmt_info.tm.tm_gmtoff / 60); + } + + *tz = gmt_info.off; + return &gmt_info.tm; } #else API_EXPORT(struct tm *) ap_get_gmtoff(int *tz) { - time_t tt = time(NULL); - struct tm gmt; - struct tm *t; - int days, hours, minutes; - - /* Assume we are never more than 24 hours away. */ - gmt = *gmtime(&tt); /* remember gmtime/localtime return ptr to static */ - t = localtime(&tt); /* buffer... so be careful */ - days = t->tm_yday - gmt.tm_yday; - hours = ((days < -1 ? 24 : 1 < days ? -24 : days * 24) - + t->tm_hour - gmt.tm_hour); - minutes = hours * 60 + t->tm_min - gmt.tm_min; - *tz = minutes; - return t; + time_t tt = ap_time(); + + if (tt != gmt_info.time) { +#if defined(IRIX) && _MIPS_SIM != _ABIO32 +#pragma mips_frequency_hint NEVER +#endif + struct tm *gmt; + int days, hours; + + gmt_info.time = tt; + /* Assume we are never more than 24 hours away. */ + /* remember that gmtime/localtime return ptr to static buffer... so be careful */ + gmt_info.tm = *localtime(&tt); + gmt = gmtime(&tt); + days = gmt_info.tm.tm_yday - gmt->tm_yday; + hours = ((days < -1 ? 24 : 1 < days ? -24 : days * 24) + + gmt_info.tm.tm_hour - gmt->tm_hour); + gmt_info.off = hours * 60 + gmt_info.tm.tm_min - gmt->tm_min; + } + + *tz = gmt_info.off; + return &gmt_info.tm; } #endif @@ -315,7 +389,7 @@ /* an empty s2 */ return((char *)s1); } - while(1) { + for (;;) { for ( ; (*s1 != '\0') && (ap_tolower(*s1) != ap_tolower(*s2)); s1++); if (*s1 == '\0') return(NULL); /* found first character of s2, see if the rest matches */ @@ -401,7 +475,7 @@ char *dest, *dst; char c; size_t no; - int len; + size_t len; if (!source) return NULL; @@ -601,7 +675,7 @@ { char *last_slash = strrchr(s, '/'); char *d; - int l; + size_t l; if (last_slash == NULL) { /* XXX: well this is really broken if this happens */ @@ -760,7 +834,7 @@ * all honored */ -static char *substring_conf(pool *p, const char *start, int len, char quote) +static char *substring_conf(pool *p, const char *start, size_t len, char quote) { char *result = ap_palloc(p, len + 2); char *resp = result; @@ -854,7 +928,7 @@ static void *cfg_getstr(void *buf, size_t bufsiz, void *param) { poolfile_t *cfp = (poolfile_t *) param; - return (fgets(buf, bufsiz, cfp->file)); + return (fgets(buf, (int) bufsiz, cfp->file)); } /* Open a configfile_t as FILE, return open configfile_t struct pointer */ @@ -969,7 +1043,7 @@ char *cbuf = buf; size_t cbufsize = bufsize; - while (1) { + for (;;) { ++cfp->line_number; if (cfp->getstr(cbuf, cbufsize, cfp->param) == NULL) return 1; @@ -1047,7 +1121,7 @@ return 1; } - while (1) { + for (;;) { if ((c == '\t') || (c == ' ')) { buf[i++] = ' '; while ((c == '\t') || (c == ' ')) @@ -1139,7 +1213,7 @@ } } - if ((*len = (ptr - token)) == 0) { + if ((*len = (int) (ptr - token)) == 0) { *field = (const char *)ptr; return NULL; } @@ -1248,6 +1322,7 @@ * This would be much more efficient if we stored header fields as * an array of list items as they are received instead of a plain string. */ +/*ARGSUSED*/ API_EXPORT(int) ap_find_list_item(pool *p, const char *line, const char *tok) { const unsigned char *pos; @@ -1356,7 +1431,7 @@ const char *ptr = *accept_line; const char *tok_start; char *token; - int tok_len; + size_t tok_len; /* Find first non-white byte */ @@ -1391,6 +1466,7 @@ /* find http tokens, see the definition of token from RFC2068 */ +/*ARGSUSED*/ API_EXPORT(int) ap_find_token(pool *p, const char *line, const char *tok) { const unsigned char *start_token; @@ -1425,16 +1501,18 @@ } +/*ARGSUSED*/ API_EXPORT(int) ap_find_last_token(pool *p, const char *line, const char *tok) { - int llen, tlen, lidx; + size_t llen, tlen; + int lidx; if (!line) return 0; llen = strlen(line); tlen = strlen(tok); - lidx = llen - tlen; + lidx = (int) (llen - tlen); if ((lidx < 0) || ((lidx > 0) && !(ap_isspace(line[lidx - 1]) || line[lidx - 1] == ','))) @@ -1534,6 +1612,7 @@ return OK; } +/*ARGSUSED3*/ API_EXPORT(char *) ap_construct_server(pool *p, const char *hostname, unsigned port, const request_rec *r) { @@ -1696,7 +1775,7 @@ API_EXPORT(char *) ap_make_full_path(pool *a, const char *src1, const char *src2) { - register int x; + size_t x; x = strlen(src1); if (x == 0) @@ -1903,7 +1982,7 @@ { register int x; - for (x = strlen(s) - 1; x != -1; x--) + for (x = ap_strlen(s) - 1; x != -1; x--) if (s[x] == c) return x; @@ -1959,10 +2038,10 @@ * Parses a host of the form
    [:port] * :port is permitted if 'port' is not NULL */ -unsigned long ap_get_virthost_addr(char *w, unsigned short *ports) +ap_uint32 ap_get_virthost_addr(char *w, unsigned short *ports) { struct hostent *hep; - unsigned long my_addr; + ap_uint32 my_addr; char *p; p = strchr(w, ':'); @@ -2089,7 +2168,7 @@ API_EXPORT(char *) ap_pbase64encode(pool *p, char *string) { char *encoded; - int l = strlen(string); + int l = ap_strlen(string); encoded = (char *) ap_palloc(p, 1 + ap_base64encode_len(l)); l = ap_base64encode(encoded, string, l); @@ -2271,3 +2350,230 @@ } *dest = 0; } + +/* + * Fast implementation of inet_ntoa(). buf should be 16 bytes. Returns + * buf and, if rlen is non-null, sets *rlen to strlen(buf). + */ +API_EXPORT(char *) +ap_inet_ntoa(struct in_addr in, char *buf, int *rlen) +{ + int i; + char *bp; + + /* + * This implementation is fast because it avoids sprintf(), + * division/modulo, and global static array lookups. + */ + + bp = buf; + for (i = 0; i < 4; i++) { + unsigned int o, n; + + o = ((unsigned char *) &in)[i]; + n = o; + if (n >= 200) { + *bp++ = '2'; + n -= 200; + } else if (n >= 100) { + *bp++ = '1'; + n -= 100; + } + if (o >= 10) { + int i; + for (i = 0; n >= 10; i++) + n -= 10; + *bp++ = i + '0'; + } + *bp++ = n + '0'; + *bp++ = '.'; + } + *--bp = 0; + if (rlen) + *rlen = (int) (bp - buf); + + return buf; +} + +/* Return nonzero if the given file size is too large to serve. */ +API_EXPORT(int) +ap_oversized_file(off_t size) +{ + /* + * For now, only files with sizes that exceed 32 bits are too large + * to serve. Serving them would be possible if someone ported a bunch + * of code to allow for 64-bit file sizes. I don't feel like it today. + * (Ain't no 64-bit browsers neither.) + * + * Maybe the rule should instead be files with sizes larger than 2^31-1? + */ + ap_uint32 s = (ap_uint32) size; + return s != size; +} + +#ifdef USE_STAT_CACHE +/* + * The STAT_CACHE code maintains a cache of the last few most recent + * stat() requests and results. It reduces the average number of system + * calls per request, uses more memory, and incurs a latency between the + * time a file changes and the time Apache notices. + * + * Mike Abbott - mja@sgi.com + * Accelerating Apache Project - http://oss.sgi.com/projects/apache/ + * Copyright (c) 2000 Silicon Graphics, Inc. All rights reserved. + */ + +/* Number of entries in the cache. */ +#ifndef STAT_CACHE_SIZE +#define STAT_CACHE_SIZE 16 +#endif + +/* Time between stat()s of the same file, in seconds. */ +#ifndef STAT_CACHE_TIME +#define STAT_CACHE_TIME 30 +#endif + +/* Maximum path length cached. */ +#ifndef STAT_CACHE_PATHLEN +#define STAT_CACHE_PATHLEN 128 +#endif + +typedef struct { + char file[STAT_CACHE_PATHLEN]; /* name of file */ + time_t stattime; /* time of last stat() */ + struct stat statbuf; /* result of last stat() */ +} stat_cache_entry; + +static struct { + unsigned long nhits; /* number of cache hits */ + unsigned long nmisses; /* number of cache misses */ + unsigned long nrestats; /* number of hit restats */ + unsigned long nrejects; /* number of too-long paths */ +} stat_cache_stats; + +/* + * stat_cache_entries[] holds the actual entries, unsorted. + * stat_cache_table[] points to those entries in LRU order: the most + * recently used entry is in [0]. + */ +static stat_cache_entry stat_cache_entries[STAT_CACHE_SIZE]; +static stat_cache_entry *stat_cache_table[STAT_CACHE_SIZE]; + +/* + * Promote the given table entry to the top of the table, i.e., make it + * MRU. + */ +static void +stat_cache_promote(stat_cache_entry **table_entry) +{ + if (table_entry != stat_cache_table) { + stat_cache_entry *ep = *table_entry; + memmove(&stat_cache_table[1], stat_cache_table, + (table_entry - stat_cache_table) * sizeof ep); + stat_cache_table[0] = ep; + } +} + +/* + * Demote the given table entry to the bottom of the table, i.e., make + * it LRU. + */ +static void +stat_cache_demote(stat_cache_entry **table_entry) +{ + if (table_entry != &stat_cache_table[STAT_CACHE_SIZE - 1]) { + stat_cache_entry *ep = *table_entry; + memmove(table_entry, table_entry + 1, + (STAT_CACHE_SIZE - 1 - (table_entry - stat_cache_table)) * sizeof ep); + stat_cache_table[STAT_CACHE_SIZE - 1] = ep; + } +} + +/* + * Just like stat() but may return cached (i.e., slightly stale) data + * for speed. + */ +API_EXPORT(int) +ap_stat_cache(const char *file, struct stat *statbuf) +{ + time_t now, then; + stat_cache_entry **epp, *np; + + now = ap_time(); + then = now - STAT_CACHE_TIME; /* restat cutoff time */ + for (epp = stat_cache_table; epp < &stat_cache_table[STAT_CACHE_SIZE]; + epp++) { + stat_cache_entry *ep = *epp; + if (ep) { + if (!strcmp(ep->file, file)) { + stat_cache_stats.nhits++; + + if (ep->stattime < then) { + /* Found the entry but it's stale. Restat. */ +#if defined(IRIX) && _MIPS_SIM != _ABIO32 +#pragma mips_frequency_hint NEVER +#endif + int result; + + stat_cache_stats.nrestats++; + + result = stat(file, &ep->statbuf); + if (result == 0) + ep->stattime = now; + else if (result < 0) { + /* stat failed, delete entry */ + ep->file[0] = 0; + stat_cache_demote(epp); + return result; + } + } + + /* Found the entry and it's fresh. */ + stat_cache_promote(epp); + *statbuf = ep->statbuf; + return 0; + } + } else + break; /* hit the bottom of a partially-filled table */ + } + + stat_cache_stats.nmisses++; + + /* + * Invariant: + * epp >= &stat_cache_table[STAT_CACHE_SIZE] || *epp == NULL + * First case: table is full, throw out last entry and reuse slot. + * Second case: table is partial, use new slot. + */ + if (epp >= &stat_cache_table[STAT_CACHE_SIZE]) + epp = &stat_cache_table[STAT_CACHE_SIZE - 1]; + else + *epp = &stat_cache_entries[epp - stat_cache_table]; + + np = *epp; + if (stat(file, &np->statbuf) == 0) { + if (strlen(file) < sizeof np->file) { + /* insert and promote new entry */ + strcpy(np->file, file); + np->stattime = now; + stat_cache_promote(epp); + } else { + /* path name is too long */ + stat_cache_stats.nrejects++; + np->file[0] = 0; + } + + *statbuf = np->statbuf; + return 0; + } else + np->file[0] = 0; /* stat failed, maybe munged np->statbuf */ + + return -1; +} +#else +API_EXPORT(int) +ap_stat_cache(const char *file, struct stat *statbuf) +{ + return stat(file, statbuf); +} +#endif diff -urN apache_1.3.20/src/main/util_md5.c-orig apache_1.3.20/src/main/util_md5.c --- apache_1.3.20/src/main/util_md5.c-orig Mon Jan 15 12:05:06 2001 +++ apache_1.3.20/src/main/util_md5.c Sat Jun 30 23:53:25 2001 @@ -197,7 +197,7 @@ int nbytes; ap_MD5Init(&context); - while ((nbytes = fread(buf, 1, sizeof(buf), infile))) { + while ((nbytes = (int) fread(buf, 1, sizeof(buf), infile))) { if (!convert) { ascii2ebcdic(buf, buf, nbytes); } @@ -216,7 +216,7 @@ unsigned int nbytes; ap_MD5Init(&context); - while ((nbytes = fread(buf, 1, sizeof(buf), infile))) { + while ((nbytes = (unsigned int) fread(buf, 1, sizeof(buf), infile))) { ap_MD5Update(&context, buf, nbytes); } rewind(infile); diff -urN apache_1.3.20/src/main/util_script.c-orig apache_1.3.20/src/main/util_script.c --- apache_1.3.20/src/main/util_script.c-orig Wed May 9 00:17:11 2001 +++ apache_1.3.20/src/main/util_script.c Sat Jun 30 23:53:25 2001 @@ -333,8 +333,8 @@ API_EXPORT(int) ap_find_path_info(const char *uri, const char *path_info) { - int lu = strlen(uri); - int lp = strlen(path_info); + int lu = ap_strlen(uri); + int lp = ap_strlen(path_info); while (lu-- && lp-- && uri[lu] == path_info[lp]); @@ -475,7 +475,7 @@ cookie_table = ap_make_table(r->pool, 2); ap_table_do(set_cookie_doo_doo, cookie_table, r->err_headers_out, "Set-Cookie", NULL); - while (1) { + for (;;) { if ((*getsfunc) (w, MAX_STRING_LEN - 1, getsfunc_data) == 0) { ap_kill_timeout(r); @@ -486,7 +486,7 @@ /* Delete terminal (CR?)LF */ - p = strlen(w); + p = ap_strlen(w); /* Indeed, the host's '\n': '\012' for UNIX; '\015' for MacOS; '\025' for OS/390 -- whatever the script generates. @@ -669,7 +669,7 @@ ++p; else p = strchr(strs->curpos, '\0'); - t = p - strs->curpos; + t = (int) (p - strs->curpos); if (t > len) t = len; strncpy (w, strs->curpos, t); @@ -721,13 +721,13 @@ ap_rputs(" 1k", r); } else if (size < 1048576) { - ap_rprintf(r, "%4dk", (size + 512) / 1024); + ap_rprintf(r, "%4ldk", (long) (size + 512) / 1024); } else if (size < 103809024) { - ap_rprintf(r, "%4.1fM", size / 1048576.0); + ap_rprintf(r, "%4.1fM", (double) size / 1048576.0); } else { - ap_rprintf(r, "%4dM", (size + 524288) / 1048576); + ap_rprintf(r, "%4ldM", (long) (size + 524288) / 1048576); } } @@ -765,6 +765,7 @@ #endif +/*ARGSUSED*/ API_EXPORT(int) ap_call_exec(request_rec *r, child_info *pinfo, char *argv0, char **env, int shellcmd) { diff -urN apache_1.3.20/src/main/util_uri.c-orig apache_1.3.20/src/main/util_uri.c --- apache_1.3.20/src/main/util_uri.c-orig Sun Apr 8 02:50:02 2001 +++ apache_1.3.20/src/main/util_uri.c Sun Jul 1 01:04:09 2001 @@ -340,7 +340,6 @@ const char *s1; const char *hostinfo; char *endstr; - int port; /* Initialize the structure. parse_uri() and parse_uri_components() * can be called more than once per request. @@ -427,8 +426,12 @@ ++s; uptr->port_str = ap_pstrndup(p, s, uri - s); if (uri != s) { +#if 0 port = strtol(uptr->port_str, &endstr, 10); uptr->port = port; +#else + uptr->port = (unsigned short) strtol (uptr->port_str, &endstr, 10); +#endif if (*endstr == '\0') { goto deal_with_path; } @@ -482,7 +485,11 @@ ++s; uptr->port_str = ap_pstrdup(p, s); if (*s != '\0') { +#if 0 uptr->port = strtol(uptr->port_str, &endstr, 10); +#else + uptr->port = (unsigned short) strtol (uptr->port_str, &endstr, 10); +#endif if (*endstr == '\0') { return HTTP_OK; } diff -urN apache_1.3.20/src/modules/example/Makefile.tmpl-orig apache_1.3.20/src/modules/example/Makefile.tmpl --- apache_1.3.20/src/modules/example/Makefile.tmpl-orig Thu Jun 22 18:22:32 2000 +++ apache_1.3.20/src/modules/example/Makefile.tmpl Sat Jun 30 23:53:25 2001 @@ -5,11 +5,11 @@ # DO NOT REMOVE mod_example.o: mod_example.c $(INCDIR)/httpd.h \ - $(INCDIR)/ap_config.h $(INCDIR)/ap_mmn.h \ - $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h \ - $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h \ - $(INCDIR)/ap_alloc.h $(INCDIR)/buff.h $(INCDIR)/ap.h \ - $(INCDIR)/util_uri.h $(INCDIR)/http_config.h \ - $(INCDIR)/http_core.h $(INCDIR)/http_log.h \ - $(INCDIR)/http_main.h $(INCDIR)/http_protocol.h \ - $(INCDIR)/util_script.h + $(INCDIR)/ap_types.h $(INCDIR)/ap_config.h \ + $(INCDIR)/ap_mmn.h $(INCDIR)/ap_config_auto.h \ + $(OSDIR)/os.h $(OSDIR)/os-inline.c $(INCDIR)/ap_ctype.h \ + $(INCDIR)/hsregex.h $(INCDIR)/ap_alloc.h $(INCDIR)/buff.h \ + $(INCDIR)/ap.h $(INCDIR)/util_uri.h \ + $(INCDIR)/http_config.h $(INCDIR)/http_core.h \ + $(INCDIR)/http_log.h $(INCDIR)/http_main.h \ + $(INCDIR)/http_protocol.h $(INCDIR)/util_script.h diff -urN apache_1.3.20/src/modules/example/mod_example.c-orig apache_1.3.20/src/modules/example/mod_example.c --- apache_1.3.20/src/modules/example/mod_example.c-orig Fri Mar 9 05:10:30 2001 +++ apache_1.3.20/src/modules/example/mod_example.c Sat Jun 30 23:53:25 2001 @@ -289,7 +289,7 @@ /* * This routine sets up some module-wide cells if they haven't been already. */ -static void setup_module_cells() +static void setup_module_cells(void) { /* * If we haven't already allocated our module-private pool, do so now. @@ -326,6 +326,7 @@ #define TRACE_NOTE "example-trace" +/*ARGSUSED*/ static void trace_add(server_rec *s, request_rec *r, excfg *mconfig, const char *note) { diff -urN apache_1.3.20/src/modules/experimental/Makefile.tmpl-orig apache_1.3.20/src/modules/experimental/Makefile.tmpl --- apache_1.3.20/src/modules/experimental/Makefile.tmpl-orig Thu Jun 22 18:22:33 2000 +++ apache_1.3.20/src/modules/experimental/Makefile.tmpl Sat Jun 30 23:53:25 2001 @@ -4,20 +4,23 @@ $(OBJS) $(OBJS_PIC): Makefile # DO NOT REMOVE -mod_mmap_static.o: mod_mmap_static.c $(INCDIR)/httpd.h \ - $(INCDIR)/ap_config.h $(INCDIR)/ap_mmn.h \ - $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h \ - $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h \ - $(INCDIR)/ap_alloc.h $(INCDIR)/buff.h $(INCDIR)/ap.h \ - $(INCDIR)/util_uri.h $(INCDIR)/http_config.h \ - $(INCDIR)/http_log.h $(INCDIR)/http_protocol.h \ - $(INCDIR)/http_request.h $(INCDIR)/http_core.h mod_auth_digest.o: mod_auth_digest.c $(INCDIR)/httpd.h \ - $(INCDIR)/ap_config.h $(INCDIR)/ap_mmn.h \ - $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h \ - $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h \ - $(INCDIR)/ap_alloc.h $(INCDIR)/buff.h $(INCDIR)/ap.h \ - $(INCDIR)/util_uri.h $(INCDIR)/http_config.h \ - $(INCDIR)/http_core.h $(INCDIR)/http_log.h \ - $(INCDIR)/http_protocol.h $(INCDIR)/util_md5.h \ - $(INCDIR)/ap_md5.h + $(INCDIR)/ap_types.h $(INCDIR)/ap_config.h \ + $(INCDIR)/ap_mmn.h $(INCDIR)/ap_config_auto.h \ + $(OSDIR)/os.h $(OSDIR)/os-inline.c $(INCDIR)/ap_ctype.h \ + $(INCDIR)/hsregex.h $(INCDIR)/ap_alloc.h $(INCDIR)/buff.h \ + $(INCDIR)/ap.h $(INCDIR)/util_uri.h \ + $(INCDIR)/http_config.h $(INCDIR)/http_conf_globals.h \ + $(INCDIR)/http_core.h $(INCDIR)/http_request.h \ + $(INCDIR)/http_log.h $(INCDIR)/http_protocol.h \ + $(INCDIR)/util_md5.h $(INCDIR)/ap_md5.h \ + $(INCDIR)/ap_sha1.h +mod_mmap_static.o: mod_mmap_static.c $(INCDIR)/httpd.h \ + $(INCDIR)/ap_types.h $(INCDIR)/ap_config.h \ + $(INCDIR)/ap_mmn.h $(INCDIR)/ap_config_auto.h \ + $(OSDIR)/os.h $(OSDIR)/os-inline.c $(INCDIR)/ap_ctype.h \ + $(INCDIR)/hsregex.h $(INCDIR)/ap_alloc.h $(INCDIR)/buff.h \ + $(INCDIR)/ap.h $(INCDIR)/util_uri.h \ + $(INCDIR)/http_config.h $(INCDIR)/http_log.h \ + $(INCDIR)/http_protocol.h $(INCDIR)/http_request.h \ + $(INCDIR)/http_core.h diff -urN apache_1.3.20/src/modules/experimental/mod_mmap_static.c-orig apache_1.3.20/src/modules/experimental/mod_mmap_static.c --- apache_1.3.20/src/modules/experimental/mod_mmap_static.c-orig Mon Jan 15 12:05:24 2001 +++ apache_1.3.20/src/modules/experimental/mod_mmap_static.c Sat Jun 30 23:53:25 2001 @@ -129,6 +129,8 @@ char *filename; void *mm; struct stat finfo; + char mtimestr[32]; + char sizestr[21]; /* big enough to hold any 64-bit file size + null */ } a_file; typedef struct { @@ -137,6 +139,7 @@ } a_server_config; +/*ARGSUSED1*/ static void *create_server_config(pool *p, server_rec *s) { a_server_config *sconf = ap_palloc(p, sizeof(*sconf)); @@ -161,6 +164,7 @@ } } +/*ARGSUSED1*/ static const char *mmapfile(cmd_parms *cmd, void *dummy, char *filename) { a_server_config *sconf; @@ -179,6 +183,11 @@ "mmap_static: %s isn't a regular file, skipping", filename); return NULL; } + if (ap_oversized_file(tmp.finfo.st_size)) { + ap_log_error(APLOG_MARK, APLOG_WARNING | APLOG_NOERRNO, cmd->server, + "mmap_static: %s is too large, skipping", filename); + return NULL; + } ap_block_alarms(); fd = open(filename, O_RDONLY, 0); if (fd == -1) { @@ -187,7 +196,7 @@ return NULL; } mm = mmap(NULL, tmp.finfo.st_size, PROT_READ, MAP_SHARED, fd, 0); - if (mm == (caddr_t)-1) { + if (mm == (caddr_t) (ap_ptr) -1) { int save_errno = errno; close(fd); ap_unblock_alarms(); @@ -199,6 +208,9 @@ close(fd); tmp.mm = mm; tmp.filename = ap_pstrdup(cmd->pool, filename); + ap_gm_timestr_822_buf(tmp.mtimestr, sizeof tmp.mtimestr, + tmp.finfo.st_mtime); + ap_snprintf(tmp.sizestr, sizeof tmp.sizestr, "%ld", (long) tmp.finfo.st_size); sconf = ap_get_module_config(cmd->server->module_config, &mmap_static_module); new_file = ap_push_array(sconf->files); *new_file = tmp; @@ -233,11 +245,14 @@ { const a_file *a = *(a_file **)av; const a_file *b = *(a_file **)bv; - long c; + int c; - c = a->finfo.st_ino - b->finfo.st_ino; + c = (int) (a->finfo.st_ino - b->finfo.st_ino); if (c == 0) { - return a->finfo.st_dev - b->finfo.st_dev; +#if defined(IRIX) && _MIPS_SIM != _ABIO32 +#pragma mips_frequency_hint NEVER +#endif + return (int) (a->finfo.st_dev - b->finfo.st_dev); } return c; } @@ -313,12 +328,26 @@ a_file **pmatch; a_file *match; int rangestatus, errstatus; +#ifdef USE_QSC + char basic_header[1024]; + size_t basic_header_len; +#endif /* we don't handle anything but GET */ - if (r->method_number != M_GET) return DECLINED; + if (r->method_number != M_GET) { +#if defined(IRIX) && _MIPS_SIM != _ABIO32 +#pragma mips_frequency_hint NEVER +#endif + return DECLINED; + } /* file doesn't exist, we won't be dealing with it */ - if (r->finfo.st_mode == 0) return DECLINED; + if (r->finfo.st_mode == 0) { +#if defined(IRIX) && _MIPS_SIM != _ABIO32 +#pragma mips_frequency_hint NEVER +#endif + return DECLINED; + } sconf = ap_get_module_config(r->server->module_config, &mmap_static_module); tmp.finfo.st_dev = r->finfo.st_dev; @@ -327,6 +356,9 @@ pmatch = (a_file **)bsearch(&ptmp, sconf->inode_sorted->elts, sconf->inode_sorted->nelts, sizeof(a_file *), inode_compare); if (pmatch == NULL) { +#if defined(IRIX) && _MIPS_SIM != _ABIO32 +#pragma mips_frequency_hint NEVER +#endif return DECLINED; } match = *pmatch; @@ -337,35 +369,80 @@ /* This handler has no use for a request body (yet), but we still * need to read and discard it if the client sent one. */ - if ((errstatus = ap_discard_request_body(r)) != OK) + if ((errstatus = ap_discard_request_body(r)) != OK) { +#if defined(IRIX) && _MIPS_SIM != _ABIO32 +#pragma mips_frequency_hint NEVER +#endif return errstatus; + } ap_update_mtime(r, match->finfo.st_mtime); - ap_set_last_modified(r); + + /* + * ap_set_last_modified() always converts the file mtime to a string + * which is slow. Accelerate the common case. + * ap_set_last_modified(r); + */ + { + time_t mod_time = ap_rationalize_mtime(r, r->mtime); + ap_table_setn(r->headers_out, "Last-Modified", + (mod_time == match->finfo.st_mtime) ? match->mtimestr : + ap_gm_timestr_822(r->pool, mod_time)); + } + ap_set_etag(r); - if (((errstatus = ap_meets_conditions(r)) != OK) - || (errstatus = ap_set_content_length (r, match->finfo.st_size))) { - return errstatus; + + if ((errstatus = ap_meets_conditions(r)) != OK) { +#if defined(IRIX) && _MIPS_SIM != _ABIO32 +#pragma mips_frequency_hint NEVER +#endif + return errstatus; } + /* + * ap_set_content_length() always converts the same number and never + * returns an error. Accelerate it. + * if ((errstatus = ap_set_content_length (r, (ap_int32) match->finfo.st_size))) + * return errstatus; + */ + r->clength = (ap_int32) match->finfo.st_size; + ap_table_setn(r->headers_out, "Content-Length", match->sizestr); + #ifdef CHARSET_EBCDIC /* check Content Type to see if ebcdic conversion is appropriate */ ap_checkconv(r); #endif rangestatus = ap_set_byterange(r); + +#ifdef USE_QSC + basic_header_len = sizeof basic_header; + ap_tee_http_header(r, basic_header, &basic_header_len); +#else ap_send_http_header(r); +#endif if (!r->header_only) { if (!rangestatus) { ap_send_mmap (match->mm, r, 0, match->finfo.st_size); } else { - long offset, length; + ap_int32 offset, length; while (ap_each_byterange(r, &offset, &length)) { ap_send_mmap(match->mm, r, offset, length); } } } + +#ifdef USE_QSC + if (basic_header_len > 0) { + /* convert from bytes remaining to bytes used */ + basic_header_len = sizeof basic_header - basic_header_len; + + qsc_insert_request(r, basic_header, basic_header_len, + match->mm, match->finfo.st_size, match->sizestr, match->filename); + } +#endif + return OK; } diff -urN apache_1.3.20/src/modules/proxy/Makefile.tmpl-orig apache_1.3.20/src/modules/proxy/Makefile.tmpl --- apache_1.3.20/src/modules/proxy/Makefile.tmpl-orig Thu Jun 22 18:22:35 2000 +++ apache_1.3.20/src/modules/proxy/Makefile.tmpl Sat Jun 30 23:53:25 2001 @@ -58,56 +58,60 @@ # DO NOT REMOVE mod_proxy.o: mod_proxy.c mod_proxy.h $(INCDIR)/httpd.h \ - $(INCDIR)/ap_config.h $(INCDIR)/ap_mmn.h \ - $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h \ - $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h \ - $(INCDIR)/ap_alloc.h $(INCDIR)/buff.h $(INCDIR)/ap.h \ - $(INCDIR)/util_uri.h $(INCDIR)/http_config.h \ - $(INCDIR)/http_protocol.h $(INCDIR)/explain.h \ - $(INCDIR)/http_log.h $(INCDIR)/http_vhost.h \ - $(INCDIR)/http_request.h + $(INCDIR)/ap_types.h $(INCDIR)/ap_config.h \ + $(INCDIR)/ap_mmn.h $(INCDIR)/ap_config_auto.h \ + $(OSDIR)/os.h $(OSDIR)/os-inline.c $(INCDIR)/ap_ctype.h \ + $(INCDIR)/hsregex.h $(INCDIR)/ap_alloc.h $(INCDIR)/buff.h \ + $(INCDIR)/ap.h $(INCDIR)/util_uri.h \ + $(INCDIR)/http_config.h $(INCDIR)/http_protocol.h \ + $(INCDIR)/explain.h $(INCDIR)/http_log.h \ + $(INCDIR)/http_vhost.h $(INCDIR)/http_request.h proxy_cache.o: proxy_cache.c mod_proxy.h $(INCDIR)/httpd.h \ - $(INCDIR)/ap_config.h $(INCDIR)/ap_mmn.h \ - $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h \ - $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h \ - $(INCDIR)/ap_alloc.h $(INCDIR)/buff.h $(INCDIR)/ap.h \ - $(INCDIR)/util_uri.h $(INCDIR)/http_config.h \ - $(INCDIR)/http_protocol.h $(INCDIR)/explain.h \ + $(INCDIR)/ap_types.h $(INCDIR)/ap_config.h \ + $(INCDIR)/ap_mmn.h $(INCDIR)/ap_config_auto.h \ + $(OSDIR)/os.h $(OSDIR)/os-inline.c $(INCDIR)/ap_ctype.h \ + $(INCDIR)/hsregex.h $(INCDIR)/ap_alloc.h $(INCDIR)/buff.h \ + $(INCDIR)/ap.h $(INCDIR)/util_uri.h \ + $(INCDIR)/http_config.h $(INCDIR)/http_protocol.h \ + $(INCDIR)/explain.h $(INCDIR)/http_conf_globals.h \ $(INCDIR)/http_log.h $(INCDIR)/http_main.h \ $(INCDIR)/util_date.h $(INCDIR)/multithread.h \ $(INCDIR)/ap_md5.h proxy_connect.o: proxy_connect.c mod_proxy.h $(INCDIR)/httpd.h \ - $(INCDIR)/ap_config.h $(INCDIR)/ap_mmn.h \ - $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h \ - $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h \ - $(INCDIR)/ap_alloc.h $(INCDIR)/buff.h $(INCDIR)/ap.h \ - $(INCDIR)/util_uri.h $(INCDIR)/http_config.h \ - $(INCDIR)/http_protocol.h $(INCDIR)/explain.h \ - $(INCDIR)/http_log.h $(INCDIR)/http_main.h + $(INCDIR)/ap_types.h $(INCDIR)/ap_config.h \ + $(INCDIR)/ap_mmn.h $(INCDIR)/ap_config_auto.h \ + $(OSDIR)/os.h $(OSDIR)/os-inline.c $(INCDIR)/ap_ctype.h \ + $(INCDIR)/hsregex.h $(INCDIR)/ap_alloc.h $(INCDIR)/buff.h \ + $(INCDIR)/ap.h $(INCDIR)/util_uri.h \ + $(INCDIR)/http_config.h $(INCDIR)/http_protocol.h \ + $(INCDIR)/explain.h $(INCDIR)/http_log.h \ + $(INCDIR)/http_main.h proxy_ftp.o: proxy_ftp.c mod_proxy.h $(INCDIR)/httpd.h \ - $(INCDIR)/ap_config.h $(INCDIR)/ap_mmn.h \ - $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h \ - $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h \ - $(INCDIR)/ap_alloc.h $(INCDIR)/buff.h $(INCDIR)/ap.h \ - $(INCDIR)/util_uri.h $(INCDIR)/http_config.h \ - $(INCDIR)/http_protocol.h $(INCDIR)/explain.h \ - $(INCDIR)/http_main.h $(INCDIR)/http_log.h + $(INCDIR)/ap_types.h $(INCDIR)/ap_config.h \ + $(INCDIR)/ap_mmn.h $(INCDIR)/ap_config_auto.h \ + $(OSDIR)/os.h $(OSDIR)/os-inline.c $(INCDIR)/ap_ctype.h \ + $(INCDIR)/hsregex.h $(INCDIR)/ap_alloc.h $(INCDIR)/buff.h \ + $(INCDIR)/ap.h $(INCDIR)/util_uri.h \ + $(INCDIR)/http_config.h $(INCDIR)/http_protocol.h \ + $(INCDIR)/explain.h $(INCDIR)/http_main.h \ + $(INCDIR)/http_log.h $(INCDIR)/http_core.h proxy_http.o: proxy_http.c mod_proxy.h $(INCDIR)/httpd.h \ - $(INCDIR)/ap_config.h $(INCDIR)/ap_mmn.h \ - $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h \ - $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h \ - $(INCDIR)/ap_alloc.h $(INCDIR)/buff.h $(INCDIR)/ap.h \ - $(INCDIR)/util_uri.h $(INCDIR)/http_config.h \ - $(INCDIR)/http_protocol.h $(INCDIR)/explain.h \ - $(INCDIR)/http_log.h $(INCDIR)/http_main.h \ - $(INCDIR)/http_core.h $(INCDIR)/util_date.h -proxy_util.o: proxy_util.c mod_proxy.h $(INCDIR)/httpd.h \ - $(INCDIR)/ap_config.h $(INCDIR)/ap_mmn.h \ - $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h \ - $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h \ - $(INCDIR)/ap_alloc.h $(INCDIR)/buff.h $(INCDIR)/ap.h \ - $(INCDIR)/util_uri.h $(INCDIR)/http_config.h \ - $(INCDIR)/http_protocol.h $(INCDIR)/explain.h \ - $(INCDIR)/http_main.h $(INCDIR)/ap_md5.h \ - $(INCDIR)/multithread.h $(INCDIR)/http_log.h \ + $(INCDIR)/ap_types.h $(INCDIR)/ap_config.h \ + $(INCDIR)/ap_mmn.h $(INCDIR)/ap_config_auto.h \ + $(OSDIR)/os.h $(OSDIR)/os-inline.c $(INCDIR)/ap_ctype.h \ + $(INCDIR)/hsregex.h $(INCDIR)/ap_alloc.h $(INCDIR)/buff.h \ + $(INCDIR)/ap.h $(INCDIR)/util_uri.h \ + $(INCDIR)/http_config.h $(INCDIR)/http_protocol.h \ + $(INCDIR)/explain.h $(INCDIR)/http_log.h \ + $(INCDIR)/http_main.h $(INCDIR)/http_core.h \ $(INCDIR)/util_date.h +proxy_util.o: proxy_util.c mod_proxy.h $(INCDIR)/httpd.h \ + $(INCDIR)/ap_types.h $(INCDIR)/ap_config.h \ + $(INCDIR)/ap_mmn.h $(INCDIR)/ap_config_auto.h \ + $(OSDIR)/os.h $(OSDIR)/os-inline.c $(INCDIR)/ap_ctype.h \ + $(INCDIR)/hsregex.h $(INCDIR)/ap_alloc.h $(INCDIR)/buff.h \ + $(INCDIR)/ap.h $(INCDIR)/util_uri.h \ + $(INCDIR)/http_config.h $(INCDIR)/http_protocol.h \ + $(INCDIR)/explain.h $(INCDIR)/http_main.h \ + $(INCDIR)/ap_md5.h $(INCDIR)/multithread.h \ + $(INCDIR)/http_log.h $(INCDIR)/util_date.h diff -urN apache_1.3.20/src/modules/proxy/mod_proxy.c-orig apache_1.3.20/src/modules/proxy/mod_proxy.c --- apache_1.3.20/src/modules/proxy/mod_proxy.c-orig Mon Jan 15 12:05:27 2001 +++ apache_1.3.20/src/modules/proxy/mod_proxy.c Sat Jun 30 23:53:25 2001 @@ -127,7 +127,7 @@ * doubled slashes) */ - return urip - uri; + return (int) (urip - uri); } /* Detect if an absoluteURI should be proxied or not. Note that we @@ -247,6 +247,7 @@ /* domain in this case. I think it is better to redirect to a FQDN, since */ /* these will later be found in the bookmarks files. */ /* The "ProxyDomain" directive determines what domain will be appended */ +/*ARGSUSED1*/ static int proxy_needsdomain(request_rec *r, const char *url, const char *domain) { char *nuri; @@ -404,6 +405,7 @@ /* -------------------------------------------------------------- */ /* Setup configurable data */ +/*ARGSUSED1*/ static void * create_proxy_config(pool *p, server_rec *s) { @@ -481,6 +483,7 @@ return ps; } +/*ARGSUSED1*/ static const char * add_proxy(cmd_parms *cmd, void *dummy, char *f, char *r) { @@ -523,6 +526,7 @@ return NULL; } +/*ARGSUSED1*/ static const char * add_pass(cmd_parms *cmd, void *dummy, char *f, char *r) { @@ -537,6 +541,7 @@ return NULL; } +/*ARGSUSED1*/ static const char * add_pass_reverse(cmd_parms *cmd, void *dummy, char *f, char *r) { @@ -552,6 +557,7 @@ return NULL; } +/*ARGSUSED1*/ static const char * set_proxy_exclude(cmd_parms *parms, void *dummy, char *arg) { @@ -586,6 +592,7 @@ /* * Set the ports CONNECT can use */ +/*ARGSUSED1*/ static const char * set_allowed_ports(cmd_parms *parms, void *dummy, char *arg) { @@ -605,6 +612,7 @@ /* Similar to set_proxy_exclude(), but defining directly connected hosts, * which should never be accessed via the configured ProxyRemote servers */ +/*ARGSUSED1*/ static const char * set_proxy_dirconn(cmd_parms *parms, void *dummy, char *arg) { @@ -655,6 +663,7 @@ return NULL; } +/*ARGSUSED1*/ static const char * set_proxy_domain(cmd_parms *parms, void *dummy, char *arg) { @@ -668,6 +677,7 @@ return NULL; } +/*ARGSUSED1*/ static const char * set_proxy_req(cmd_parms *parms, void *dummy, int flag) { @@ -680,6 +690,7 @@ } +/*ARGSUSED1*/ static const char * set_cache_size(cmd_parms *parms, char *struct_ptr, char *arg) { @@ -694,6 +705,7 @@ return NULL; } +/*ARGSUSED1*/ static const char * set_cache_root(cmd_parms *parms, void *dummy, char *arg) { @@ -705,6 +717,7 @@ return NULL; } +/*ARGSUSED1*/ static const char * set_cache_factor(cmd_parms *parms, void *dummy, char *arg) { @@ -720,6 +733,7 @@ return NULL; } +/*ARGSUSED1*/ static const char * set_cache_maxex(cmd_parms *parms, void *dummy, char *arg) { @@ -734,6 +748,7 @@ return NULL; } +/*ARGSUSED1*/ static const char * set_cache_defex(cmd_parms *parms, void *dummy, char *arg) { @@ -748,6 +763,7 @@ return NULL; } +/*ARGSUSED1*/ static const char * set_cache_gcint(cmd_parms *parms, void *dummy, char *arg) { @@ -762,6 +778,7 @@ return NULL; } +/*ARGSUSED1*/ static const char * set_cache_dirlevels(cmd_parms *parms, char *struct_ptr, char *arg) { @@ -779,6 +796,7 @@ return NULL; } +/*ARGSUSED1*/ static const char * set_cache_dirlength(cmd_parms *parms, char *struct_ptr, char *arg) { @@ -796,6 +814,7 @@ return NULL; } +/*ARGSUSED1*/ static const char * set_cache_exclude(cmd_parms *parms, void *dummy, char *arg) { @@ -827,6 +846,7 @@ return NULL; } +/*ARGSUSED1*/ static const char * set_recv_buffer_size(cmd_parms *parms, void *dummy, char *arg) { @@ -842,6 +862,7 @@ return NULL; } +/*ARGSUSED1*/ static const char* set_cache_completion(cmd_parms *parms, void *dummy, char *arg) { @@ -860,6 +881,7 @@ return NULL; } +/*ARGSUSED1*/ static const char* set_via_opt(cmd_parms *parms, void *dummy, char *arg) { diff -urN apache_1.3.20/src/modules/proxy/mod_proxy.h-orig apache_1.3.20/src/modules/proxy/mod_proxy.h --- apache_1.3.20/src/modules/proxy/mod_proxy.h-orig Mon Jan 15 12:05:28 2001 +++ apache_1.3.20/src/modules/proxy/mod_proxy.h Sat Jun 30 23:53:25 2001 @@ -187,7 +187,7 @@ /* static information about the local cache */ struct cache_conf { const char *root; /* the location of the cache directory */ - off_t space; /* Maximum cache size (in 1024 bytes) */ + ap_int32 space; /* Maximum cache size (in 1024 bytes) */ char space_set; time_t maxexpire; /* Maximum time to keep cached files in secs */ char maxexpire_set; @@ -247,7 +247,7 @@ time_t lmod; /* last-modified date of cached entity */ time_t date; /* the date the cached file was last touched */ int version; /* update count of the file */ - off_t len; /* content length */ + ap_int32 len; /* content length */ char *protocol; /* Protocol, and major/minor number, e.g. HTTP/1.1 */ int status; /* the status of the cached file */ unsigned int written; /* total *content* bytes written to cache */ @@ -264,7 +264,7 @@ struct per_thread_data { struct hostent hpbuf; - u_long ipaddr; + ap_uint32 ipaddr; char *charpbuf[2]; }; /* Function prototypes */ @@ -299,13 +299,13 @@ int ap_proxy_hex2c(const char *x); void ap_proxy_c2hex(int ch, char *x); -char *ap_proxy_canonenc(pool *p, const char *x, int len, enum enctype t, +char *ap_proxy_canonenc(pool *p, const char *x, size_t len, enum enctype t, enum proxyreqtype isenc); char *ap_proxy_canon_netloc(pool *p, char **const urlp, char **userp, char **passwordp, char **hostp, int *port); const char *ap_proxy_date_canon(pool *p, const char *x); table *ap_proxy_read_headers(request_rec *r, char *buffer, int size, BUFF *f); -long int ap_proxy_send_fb(BUFF *f, request_rec *r, cache_req *c); +ap_int32 ap_proxy_send_fb(BUFF *f, request_rec *r, cache_req *c); void ap_proxy_send_headers(request_rec *r, const char *respline, table *hdrs); int ap_proxy_liststr(const char *list, const char *val); void ap_proxy_hash(const char *it, char *val, int ndepth, int nlength); diff -urN apache_1.3.20/src/modules/proxy/proxy_cache.c-orig apache_1.3.20/src/modules/proxy/proxy_cache.c --- apache_1.3.20/src/modules/proxy/proxy_cache.c-orig Mon Jan 15 12:05:29 2001 +++ apache_1.3.20/src/modules/proxy/proxy_cache.c Sat Jun 30 23:53:26 2001 @@ -81,15 +81,15 @@ DEF_Explain struct gc_ent { - unsigned long int len; + ap_uint32 len; time_t expire; char file[HASH_LEN + 1]; }; /* Poor man's 61 bit arithmetic */ typedef struct { - long lower; /* lower 30 bits of result */ - long upper; /* upper 31 bits of result */ + ap_int32 lower; /* lower 30 bits of result */ + ap_int32 upper; /* upper 31 bits of result */ } long61_t; /* FIXME: The block size can be different on a `per file system' base. @@ -108,12 +108,13 @@ */ #define ROUNDUP2BLOCKS(_bytes) (((_bytes)+block_size-1) & ~(block_size-1)) -static long block_size = 512; /* this must be a power of 2 */ +static ap_int32 block_size = 512; /* this must be a power of 2 */ static long61_t curbytes, cachesize; static time_t garbage_now, garbage_expire; static mutex *garbage_mutex = NULL; +/*ARGSUSED*/ int ap_proxy_garbage_init(server_rec *r, pool *p) { if (!garbage_mutex) @@ -161,22 +162,22 @@ static void -add_long61 (long61_t *accu, long val) +add_long61 (long61_t *accu, ap_int32 val) { /* Add in lower 30 bits */ - accu->lower += (val & 0x3FFFFFFFL); + accu->lower += (val & (ap_int32) 0x3FFFFFFF); /* add in upper bits, and carry */ - accu->upper += (val >> 30) + ((accu->lower & ~0x3FFFFFFFL) != 0L); + accu->upper += (val >> 30) + ((accu->lower & ~((ap_int32) 0x3FFFFFFF)) != 0); /* Clear carry */ - accu->lower &= 0x3FFFFFFFL; + accu->lower &= (ap_int32) 0x3FFFFFFF; } static void -sub_long61 (long61_t *accu, long val) +sub_long61 (long61_t *accu, ap_int32 val) { - int carry = (val & 0x3FFFFFFFL) > accu->lower; + int carry = (val & (ap_int32) 0x3FFFFFFF) > accu->lower; /* Subtract lower 30 bits */ - accu->lower = accu->lower - (val & 0x3FFFFFFFL) + ((carry) ? 0x40000000 : 0); + accu->lower = accu->lower - (val & (ap_int32) 0x3FFFFFFF) + ((carry) ? 0x40000000 : 0); /* add in upper bits, and carry */ accu->upper -= (val >> 30) + carry; } @@ -186,7 +187,7 @@ * return 0 when left == right * return >0 when left > right */ -static long +static ap_int32 cmp_long61 (long61_t *left, long61_t *right) { return (left->upper == right->upper) ? (left->lower - right->lower) @@ -212,7 +213,6 @@ { pid_t pid; int status; - pid_t pgrp; #if 0 ap_log_error(APLOG_MARK, APLOG_DEBUG, r->server, @@ -239,21 +239,21 @@ case 0: /* Child */ /* The setpgrp() stuff was snarfed from http_main.c */ #ifndef NO_SETSID - if ((pgrp = setsid()) == -1) { + if (setsid() == -1) { perror("setsid"); fprintf(stderr, "%s: setsid failed\n", ap_server_argv0); exit(1); } #elif defined(NEXT) || defined(NEWSOS) - if (setpgrp(0, getpid()) == -1 || (pgrp = getpgrp(0)) == -1) { + if (setpgrp(0, getpid()) == -1 || getpgrp(0) == -1) { perror("setpgrp"); fprintf(stderr, "%S: setpgrp or getpgrp failed\n", ap_server_argv0); exit(1); } #else - if ((pgrp = setpgrp(getpid(), 0)) == -1) { + if (setpgrp(getpid(), 0) == -1) { perror("setpgrp"); fprintf(stderr, "%s: setpgrp failed\n", ap_server_argv0); @@ -368,11 +368,11 @@ ap_block_alarms(); /* avoid SIGALRM on big cache cleanup */ files = ap_make_array(r->pool, 100, sizeof(struct gc_ent)); - curbytes.upper = curbytes.lower = 0L; + curbytes.upper = curbytes.lower = 0; sub_garbage_coll(r, files, cachedir, "/"); - if (cmp_long61(&curbytes, &cachesize) < 0L) { + if (cmp_long61(&curbytes, &cachesize) < 0) { ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, r->server, "proxy GC: Cache is %ld%% full (nothing deleted)", (long)(((curbytes.upper<<20)|(curbytes.lower>>10))*100/conf->space)); @@ -525,6 +525,13 @@ close(fd); continue; } + + if (ap_oversized_file(buf.st_size)) { + ap_log_error(APLOG_MARK, APLOG_WARNING | APLOG_NOERRNO, r->server, + "proxy gc: %s: File too large", filename); + close(fd); + continue; + } #endif /* In OS/2 and TPF this has already been done above */ @@ -548,7 +555,7 @@ --nfiles; } else { /* Directory is not empty. Account for its size: */ - add_long61(&curbytes, ROUNDUP2BLOCKS(buf.st_size)); + add_long61(&curbytes, ROUNDUP2BLOCKS((ap_int32) buf.st_size)); } continue; } @@ -567,7 +574,7 @@ } #endif - i = read(fd, line, 26); + i = (int) read(fd, line, 26); close(fd); if (i == -1) { ap_log_error(APLOG_MARK, APLOG_ERR, r->server, @@ -599,13 +606,13 @@ * */ fent = (struct gc_ent *) ap_push_array(files); - fent->len = buf.st_size; + fent->len = (ap_uint32) buf.st_size; fent->expire = garbage_expire; strcpy(fent->file, cachesubdir); strcat(fent->file, ent->d_name); /* accumulate in blocks, to cope with directories > 4Gb */ - add_long61(&curbytes, ROUNDUP2BLOCKS(buf.st_size)); + add_long61(&curbytes, ROUNDUP2BLOCKS(fent->len)); } closedir(dir); @@ -707,7 +714,7 @@ time_t now; BUFF *cachefp; int cfd, i; - const long int zero = 0L; + const ap_int32 zero = 0; void *sconf = r->server->module_config; proxy_server_conf *pconf = (proxy_server_conf *) ap_get_module_config(sconf, &proxy_module); @@ -870,7 +877,7 @@ void *sconf = r->server->module_config; proxy_server_conf *conf = (proxy_server_conf *) ap_get_module_config(sconf, &proxy_module); - const long int zero = 0L; + const ap_int32 zero = 0; c->tempfile = NULL; @@ -1119,7 +1126,7 @@ void ap_proxy_cache_tidy(cache_req *c) { server_rec *s; - long int bc; + ap_int32 bc; if (c == NULL || c->fp == NULL) return; diff -urN apache_1.3.20/src/modules/proxy/proxy_connect.c-orig apache_1.3.20/src/modules/proxy/proxy_connect.c --- apache_1.3.20/src/modules/proxy/proxy_connect.c-orig Mon Jan 15 12:05:29 2001 +++ apache_1.3.20/src/modules/proxy/proxy_connect.c Sat Jun 30 23:53:26 2001 @@ -112,6 +112,7 @@ } +/*ARGSUSED1*/ int ap_proxy_connect_handler(request_rec *r, cache_req *c, char *url, const char *proxyhost, int proxyport) { @@ -227,10 +228,10 @@ Explain0("Sending the CONNECT request to the remote proxy"); ap_snprintf(buffer, sizeof(buffer), "CONNECT %s HTTP/1.0" CRLF, r->uri); - send(sock, buffer, strlen(buffer),0); + send(sock, buffer, ap_strlen(buffer),0); ap_snprintf(buffer, sizeof(buffer), "Proxy-agent: %s" CRLF CRLF, ap_get_server_version()); - send(sock, buffer, strlen(buffer),0); + send(sock, buffer, ap_strlen(buffer),0); } else { Explain0("Returning 200 OK Status"); @@ -239,7 +240,7 @@ ap_bflush(r->connection->client); } - while (1) { /* Infinite loop until error (one side closes the connection) */ + for (;;) { /* Infinite loop until error (one side closes the connection) */ FD_ZERO(&fds); FD_SET(sock, &fds); FD_SET(ap_bfileno(r->connection->client, B_WR), &fds); diff -urN apache_1.3.20/src/modules/proxy/proxy_ftp.c-orig apache_1.3.20/src/modules/proxy/proxy_ftp.c --- apache_1.3.20/src/modules/proxy/proxy_ftp.c-orig Fri Mar 9 05:10:31 2001 +++ apache_1.3.20/src/modules/proxy/proxy_ftp.c Sat Jun 30 23:53:26 2001 @@ -264,15 +264,15 @@ return status; } -static long int send_dir(BUFF *f, request_rec *r, cache_req *c, char *cwd) +static ap_int32 send_dir(BUFF *f, request_rec *r, cache_req *c, char *cwd) { char buf[IOBUFSIZE]; char buf2[IOBUFSIZE]; char *filename; - int searchidx = 0; + size_t searchidx = 0; char *searchptr = NULL; int firstfile = 1; - unsigned long total_bytes_sent = 0; + ap_uint32 total_bytes_sent = 0; register int n, o, w; conn_rec *con = r->connection; char *dir, *path, *reldir, *site; @@ -285,7 +285,7 @@ /* Copy path, strip (all except the last) trailing slashes */ path = dir = ap_pstrcat(r->pool, path, "/", NULL); - while ((n = strlen(path)) > 1 && path[n-1] == '/' && path[n-2] == '/') + while ((n = ap_strlen(path)) > 1 && path[n-1] == '/' && path[n-2] == '/') path[n-1] = '\0'; /* print "ftp://host/" */ @@ -338,11 +338,11 @@ } while (filename[0] != ' '); *(filename++) = '\0'; *(link_ptr++) = '\0'; - if ((n = strlen(link_ptr)) > 1 && link_ptr[n - 1] == '\n') + if ((n = ap_strlen(link_ptr)) > 1 && link_ptr[n - 1] == '\n') link_ptr[n - 1] = '\0'; ap_snprintf(buf2, sizeof(buf2), "%s %s %s\n", buf, filename, filename, link_ptr); ap_cpystrn(buf, buf2, sizeof(buf)); - n = strlen(buf); + n = ap_strlen(buf); } else if (buf[0] == 'd' || buf[0] == '-' || buf[0] == 'l' || ap_isdigit(buf[0])) { if (ap_isdigit(buf[0])) { /* handle DOS dir */ @@ -378,7 +378,7 @@ ap_snprintf(buf2, sizeof(buf2), "%s %s\n", buf, filename, filename); } ap_cpystrn(buf, buf2, sizeof(buf)); - n = strlen(buf); + n = ap_strlen(buf); } o = 0; @@ -443,6 +443,7 @@ * Troy Morrison * PASV added by Chuck */ +/*ARGSUSED2*/ int ap_proxy_ftp_handler(request_rec *r, cache_req *c, char *url) { char *host, *path, *strp, *parms; @@ -461,7 +462,7 @@ BUFF *data = NULL; pool *p = r->pool; int one = 1; - const long int zero = 0L; + const ap_int32 zero = 0; NET_SIZE_T clen; struct tbl_do_args tdo; diff -urN apache_1.3.20/src/modules/proxy/proxy_http.c-orig apache_1.3.20/src/modules/proxy/proxy_http.c --- apache_1.3.20/src/modules/proxy/proxy_http.c-orig Fri Feb 9 07:40:27 2001 +++ apache_1.3.20/src/modules/proxy/proxy_http.c Sat Jun 30 23:53:26 2001 @@ -118,7 +118,8 @@ void *sconf; proxy_server_conf *conf; struct proxy_alias *ent; - int i, l1, l2; + int i; + size_t l1, l2; char *u; sconf = r->server->module_config; @@ -184,7 +185,7 @@ char buffer[HUGE_STRING_LEN]; char portstr[32]; pool *p = r->pool; - const long int zero = 0L; + const ap_int32 zero = 0; int destport = 0; char *destportstr = NULL; const char *urlptr = NULL; diff -urN apache_1.3.20/src/modules/proxy/proxy_util.c-orig apache_1.3.20/src/modules/proxy/proxy_util.c --- apache_1.3.20/src/modules/proxy/proxy_util.c-orig Fri Mar 16 02:01:23 2001 +++ apache_1.3.20/src/modules/proxy/proxy_util.c Sat Jun 30 23:53:26 2001 @@ -135,10 +135,11 @@ * and encodes those which must be encoded, and does not touch * those which must not be touched. */ -char *ap_proxy_canonenc(pool *p, const char *x, int len, enum enctype t, +char *ap_proxy_canonenc(pool *p, const char *x, size_t len, enum enctype t, enum proxyreqtype isenc) { - int i, j, ch; + size_t i, j; + int ch; char *y; const char *allowed; /* characters which should not be encoded */ const char *reserved; /* characters which much not be en/de-coded */ @@ -490,11 +491,11 @@ return resp_hdrs; } -long int ap_proxy_send_fb(BUFF *f, request_rec *r, cache_req *c) +ap_int32 ap_proxy_send_fb(BUFF *f, request_rec *r, cache_req *c) { int ok; char buf[IOBUFSIZE]; - long total_bytes_rcvd; + ap_int32 total_bytes_rcvd; register int n, o, w; conn_rec *con = r->connection; int alternate_timeouts = 1; /* 1 if we alternate between soft & hard timeouts */ @@ -598,7 +599,7 @@ */ ok = (c->len > 0) && (c->cache_completion > 0) && - (c->len * c->cache_completion < total_bytes_rcvd); + ((ap_int32) ((float) c->len * c->cache_completion) < total_bytes_rcvd); if (! ok) { ap_pclosef(c->req->pool, ap_bfileno(c->fp, B_WR)); @@ -656,7 +657,7 @@ */ int ap_proxy_liststr(const char *list, const char *val) { - int len, i; + size_t len, i; const char *p; len = strlen(val); @@ -752,7 +753,7 @@ #endif ap_MD5Init(&context); - ap_MD5Update(&context, (const unsigned char *) it, strlen(it)); + ap_MD5Update(&context, (const unsigned char *) it, ap_strlen(it)); ap_MD5Final(digest, &context); /* encode 128 bits as 22 characters, using a modified uuencoding */ @@ -925,6 +926,7 @@ } /* Return TRUE if addr represents an IP address (or an IP network address) */ +/*ARGSUSED1*/ int ap_proxy_is_ipaddr(struct dirconn_entry *This, pool *p) { const char *addr = This->name; @@ -1106,6 +1108,7 @@ } /* Return TRUE if addr represents a domain name */ +/*ARGSUSED1*/ int ap_proxy_is_domainname(struct dirconn_entry *This, pool *p) { char *addr = This->name; @@ -1130,7 +1133,7 @@ return 0; /* Strip trailing dots */ - for (i = strlen(addr) - 1; i > 0 && addr[i] == '.'; --i) + for (i = ap_strlen(addr) - 1; i > 0 && addr[i] == '.'; --i) addr[i] = '\0'; This->matcher = proxy_match_domainname; @@ -1141,7 +1144,7 @@ static int proxy_match_domainname(struct dirconn_entry *This, request_rec *r) { const char *host = proxy_get_host_of_request(r); - int d_len = strlen(This->name), h_len; + size_t d_len = strlen(This->name), h_len; if (host == NULL) /* some error was logged already */ return 0; @@ -1185,7 +1188,7 @@ This->hostentry = ap_pduphostent (p, &host); /* Strip trailing dots */ - for (i = strlen(addr) - 1; i > 0 && addr[i] == '.'; --i) + for (i = ap_strlen(addr) - 1; i > 0 && addr[i] == '.'; --i) addr[i] = '\0'; This->matcher = proxy_match_hostname; @@ -1197,8 +1200,8 @@ { char *host = This->name; const char *host2 = proxy_get_host_of_request(r); - int h2_len; - int h1_len; + size_t h2_len; + size_t h1_len; if (host == NULL || host2 == NULL) return 0; /* oops! */ @@ -1225,6 +1228,7 @@ } /* Return TRUE if addr is to be matched as a word */ +/*ARGSUSED1*/ int ap_proxy_is_word(struct dirconn_entry *This, pool *p) { This->matcher = proxy_match_word; diff -urN apache_1.3.20/src/modules/standard/Makefile.tmpl-orig apache_1.3.20/src/modules/standard/Makefile.tmpl --- apache_1.3.20/src/modules/standard/Makefile.tmpl-orig Thu Jun 22 18:22:40 2000 +++ apache_1.3.20/src/modules/standard/Makefile.tmpl Sat Jun 30 23:53:26 2001 @@ -5,252 +5,284 @@ # DO NOT REMOVE mod_access.o: mod_access.c $(INCDIR)/httpd.h \ - $(INCDIR)/ap_config.h $(INCDIR)/ap_mmn.h \ - $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h \ - $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h \ - $(INCDIR)/ap_alloc.h $(INCDIR)/buff.h $(INCDIR)/ap.h \ - $(INCDIR)/util_uri.h $(INCDIR)/http_core.h \ + $(INCDIR)/ap_types.h $(INCDIR)/ap_config.h \ + $(INCDIR)/ap_mmn.h $(INCDIR)/ap_config_auto.h \ + $(OSDIR)/os.h $(OSDIR)/os-inline.c $(INCDIR)/ap_ctype.h \ + $(INCDIR)/hsregex.h $(INCDIR)/ap_alloc.h $(INCDIR)/buff.h \ + $(INCDIR)/ap.h $(INCDIR)/util_uri.h $(INCDIR)/http_core.h \ $(INCDIR)/http_config.h $(INCDIR)/http_log.h \ $(INCDIR)/http_request.h mod_actions.o: mod_actions.c $(INCDIR)/httpd.h \ - $(INCDIR)/ap_config.h $(INCDIR)/ap_mmn.h \ - $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h \ - $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h \ - $(INCDIR)/ap_alloc.h $(INCDIR)/buff.h $(INCDIR)/ap.h \ - $(INCDIR)/util_uri.h $(INCDIR)/http_config.h \ - $(INCDIR)/http_request.h $(INCDIR)/http_core.h \ - $(INCDIR)/http_protocol.h $(INCDIR)/http_main.h \ - $(INCDIR)/http_log.h $(INCDIR)/util_script.h + $(INCDIR)/ap_types.h $(INCDIR)/ap_config.h \ + $(INCDIR)/ap_mmn.h $(INCDIR)/ap_config_auto.h \ + $(OSDIR)/os.h $(OSDIR)/os-inline.c $(INCDIR)/ap_ctype.h \ + $(INCDIR)/hsregex.h $(INCDIR)/ap_alloc.h $(INCDIR)/buff.h \ + $(INCDIR)/ap.h $(INCDIR)/util_uri.h \ + $(INCDIR)/http_config.h $(INCDIR)/http_request.h \ + $(INCDIR)/http_core.h $(INCDIR)/http_protocol.h \ + $(INCDIR)/http_main.h $(INCDIR)/http_log.h \ + $(INCDIR)/util_script.h mod_alias.o: mod_alias.c $(INCDIR)/httpd.h \ - $(INCDIR)/ap_config.h $(INCDIR)/ap_mmn.h \ - $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h \ - $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h \ - $(INCDIR)/ap_alloc.h $(INCDIR)/buff.h $(INCDIR)/ap.h \ - $(INCDIR)/util_uri.h $(INCDIR)/http_config.h -mod_asis.o: mod_asis.c $(INCDIR)/httpd.h $(INCDIR)/ap_config.h \ - $(INCDIR)/ap_mmn.h $(INCDIR)/ap_config_auto.h \ - $(OSDIR)/os.h $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h \ - $(INCDIR)/ap_alloc.h $(INCDIR)/buff.h $(INCDIR)/ap.h \ - $(INCDIR)/util_uri.h $(INCDIR)/http_config.h \ - $(INCDIR)/http_protocol.h $(INCDIR)/http_log.h \ - $(INCDIR)/util_script.h $(INCDIR)/http_main.h \ - $(INCDIR)/http_request.h -mod_auth.o: mod_auth.c $(INCDIR)/httpd.h $(INCDIR)/ap_config.h \ + $(INCDIR)/ap_types.h $(INCDIR)/ap_config.h \ $(INCDIR)/ap_mmn.h $(INCDIR)/ap_config_auto.h \ - $(OSDIR)/os.h $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h \ - $(INCDIR)/ap_alloc.h $(INCDIR)/buff.h $(INCDIR)/ap.h \ - $(INCDIR)/util_uri.h $(INCDIR)/http_config.h \ - $(INCDIR)/http_core.h $(INCDIR)/http_log.h \ - $(INCDIR)/http_protocol.h -mod_auth_anon.o: mod_auth_anon.c $(INCDIR)/httpd.h \ + $(OSDIR)/os.h $(OSDIR)/os-inline.c $(INCDIR)/ap_ctype.h \ + $(INCDIR)/hsregex.h $(INCDIR)/ap_alloc.h $(INCDIR)/buff.h \ + $(INCDIR)/ap.h $(INCDIR)/util_uri.h \ + $(INCDIR)/http_config.h +mod_asis.o: mod_asis.c $(INCDIR)/httpd.h $(INCDIR)/ap_types.h \ $(INCDIR)/ap_config.h $(INCDIR)/ap_mmn.h \ $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h \ - $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h \ - $(INCDIR)/ap_alloc.h $(INCDIR)/buff.h $(INCDIR)/ap.h \ - $(INCDIR)/util_uri.h $(INCDIR)/http_config.h \ - $(INCDIR)/http_core.h $(INCDIR)/http_log.h \ - $(INCDIR)/http_protocol.h $(INCDIR)/http_request.h -mod_auth_db.o: mod_auth_db.c $(INCDIR)/httpd.h \ + $(OSDIR)/os-inline.c $(INCDIR)/ap_ctype.h \ + $(INCDIR)/hsregex.h $(INCDIR)/ap_alloc.h $(INCDIR)/buff.h \ + $(INCDIR)/ap.h $(INCDIR)/util_uri.h \ + $(INCDIR)/http_config.h $(INCDIR)/http_protocol.h \ + $(INCDIR)/http_log.h $(INCDIR)/util_script.h \ + $(INCDIR)/http_main.h $(INCDIR)/http_request.h +mod_auth.o: mod_auth.c $(INCDIR)/httpd.h $(INCDIR)/ap_types.h \ $(INCDIR)/ap_config.h $(INCDIR)/ap_mmn.h \ $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h \ - $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h \ - $(INCDIR)/ap_alloc.h $(INCDIR)/buff.h $(INCDIR)/ap.h \ - $(INCDIR)/util_uri.h $(INCDIR)/http_config.h \ - $(INCDIR)/http_core.h $(INCDIR)/http_log.h \ - $(INCDIR)/http_protocol.h + $(OSDIR)/os-inline.c $(INCDIR)/ap_ctype.h \ + $(INCDIR)/hsregex.h $(INCDIR)/ap_alloc.h $(INCDIR)/buff.h \ + $(INCDIR)/ap.h $(INCDIR)/util_uri.h \ + $(INCDIR)/http_config.h $(INCDIR)/http_core.h \ + $(INCDIR)/http_log.h $(INCDIR)/http_protocol.h +mod_auth_anon.o: mod_auth_anon.c $(INCDIR)/httpd.h \ + $(INCDIR)/ap_types.h $(INCDIR)/ap_config.h \ + $(INCDIR)/ap_mmn.h $(INCDIR)/ap_config_auto.h \ + $(OSDIR)/os.h $(OSDIR)/os-inline.c $(INCDIR)/ap_ctype.h \ + $(INCDIR)/hsregex.h $(INCDIR)/ap_alloc.h $(INCDIR)/buff.h \ + $(INCDIR)/ap.h $(INCDIR)/util_uri.h \ + $(INCDIR)/http_config.h $(INCDIR)/http_core.h \ + $(INCDIR)/http_log.h $(INCDIR)/http_protocol.h \ + $(INCDIR)/http_request.h +mod_auth_db.o: mod_auth_db.c $(INCDIR)/httpd.h \ + $(INCDIR)/ap_types.h $(INCDIR)/ap_config.h \ + $(INCDIR)/ap_mmn.h $(INCDIR)/ap_config_auto.h \ + $(OSDIR)/os.h $(OSDIR)/os-inline.c $(INCDIR)/ap_ctype.h \ + $(INCDIR)/hsregex.h $(INCDIR)/ap_alloc.h $(INCDIR)/buff.h \ + $(INCDIR)/ap.h $(INCDIR)/util_uri.h \ + $(INCDIR)/http_config.h $(INCDIR)/http_core.h \ + $(INCDIR)/http_log.h $(INCDIR)/http_protocol.h mod_auth_dbm.o: mod_auth_dbm.c $(INCDIR)/httpd.h \ - $(INCDIR)/ap_config.h $(INCDIR)/ap_mmn.h \ - $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h \ - $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h \ - $(INCDIR)/ap_alloc.h $(INCDIR)/buff.h $(INCDIR)/ap.h \ - $(INCDIR)/util_uri.h $(INCDIR)/http_config.h \ - $(INCDIR)/http_core.h $(INCDIR)/http_log.h \ - $(INCDIR)/http_protocol.h + $(INCDIR)/ap_types.h $(INCDIR)/ap_config.h \ + $(INCDIR)/ap_mmn.h $(INCDIR)/ap_config_auto.h \ + $(OSDIR)/os.h $(OSDIR)/os-inline.c $(INCDIR)/ap_ctype.h \ + $(INCDIR)/hsregex.h $(INCDIR)/ap_alloc.h $(INCDIR)/buff.h \ + $(INCDIR)/ap.h $(INCDIR)/util_uri.h \ + $(INCDIR)/http_config.h $(INCDIR)/http_core.h \ + $(INCDIR)/http_log.h $(INCDIR)/http_protocol.h mod_autoindex.o: mod_autoindex.c $(INCDIR)/httpd.h \ - $(INCDIR)/ap_config.h $(INCDIR)/ap_mmn.h \ - $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h \ - $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h \ - $(INCDIR)/ap_alloc.h $(INCDIR)/buff.h $(INCDIR)/ap.h \ - $(INCDIR)/util_uri.h $(INCDIR)/http_config.h \ - $(INCDIR)/http_core.h $(INCDIR)/http_request.h \ - $(INCDIR)/http_protocol.h $(INCDIR)/http_log.h \ - $(INCDIR)/http_main.h $(INCDIR)/util_script.h + $(INCDIR)/ap_types.h $(INCDIR)/ap_config.h \ + $(INCDIR)/ap_mmn.h $(INCDIR)/ap_config_auto.h \ + $(OSDIR)/os.h $(OSDIR)/os-inline.c $(INCDIR)/ap_ctype.h \ + $(INCDIR)/hsregex.h $(INCDIR)/ap_alloc.h $(INCDIR)/buff.h \ + $(INCDIR)/ap.h $(INCDIR)/util_uri.h \ + $(INCDIR)/http_config.h $(INCDIR)/http_core.h \ + $(INCDIR)/http_request.h $(INCDIR)/http_protocol.h \ + $(INCDIR)/http_log.h $(INCDIR)/http_main.h \ + $(INCDIR)/util_script.h $(INCDIR)/fnmatch.h mod_cern_meta.o: mod_cern_meta.c $(INCDIR)/httpd.h \ - $(INCDIR)/ap_config.h $(INCDIR)/ap_mmn.h \ - $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h \ - $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h \ - $(INCDIR)/ap_alloc.h $(INCDIR)/buff.h $(INCDIR)/ap.h \ - $(INCDIR)/util_uri.h $(INCDIR)/http_config.h \ - $(INCDIR)/util_script.h $(INCDIR)/http_log.h \ - $(INCDIR)/http_request.h -mod_cgi.o: mod_cgi.c $(INCDIR)/httpd.h $(INCDIR)/ap_config.h \ + $(INCDIR)/ap_types.h $(INCDIR)/ap_config.h \ $(INCDIR)/ap_mmn.h $(INCDIR)/ap_config_auto.h \ - $(OSDIR)/os.h $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h \ - $(INCDIR)/ap_alloc.h $(INCDIR)/buff.h $(INCDIR)/ap.h \ - $(INCDIR)/util_uri.h $(INCDIR)/http_config.h \ - $(INCDIR)/http_request.h $(INCDIR)/http_core.h \ - $(INCDIR)/http_protocol.h $(INCDIR)/http_main.h \ - $(INCDIR)/http_log.h $(INCDIR)/util_script.h \ - $(INCDIR)/http_conf_globals.h -mod_digest.o: mod_digest.c $(INCDIR)/httpd.h \ + $(OSDIR)/os.h $(OSDIR)/os-inline.c $(INCDIR)/ap_ctype.h \ + $(INCDIR)/hsregex.h $(INCDIR)/ap_alloc.h $(INCDIR)/buff.h \ + $(INCDIR)/ap.h $(INCDIR)/util_uri.h \ + $(INCDIR)/http_config.h $(INCDIR)/util_script.h \ + $(INCDIR)/http_log.h $(INCDIR)/http_request.h +mod_cgi.o: mod_cgi.c $(INCDIR)/httpd.h $(INCDIR)/ap_types.h \ $(INCDIR)/ap_config.h $(INCDIR)/ap_mmn.h \ $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h \ - $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h \ - $(INCDIR)/ap_alloc.h $(INCDIR)/buff.h $(INCDIR)/ap.h \ - $(INCDIR)/util_uri.h $(INCDIR)/http_config.h \ - $(INCDIR)/http_core.h $(INCDIR)/http_log.h \ - $(INCDIR)/http_protocol.h $(INCDIR)/util_md5.h \ - $(INCDIR)/ap_md5.h -mod_dir.o: mod_dir.c $(INCDIR)/httpd.h $(INCDIR)/ap_config.h \ - $(INCDIR)/ap_mmn.h $(INCDIR)/ap_config_auto.h \ - $(OSDIR)/os.h $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h \ - $(INCDIR)/ap_alloc.h $(INCDIR)/buff.h $(INCDIR)/ap.h \ - $(INCDIR)/util_uri.h $(INCDIR)/http_config.h \ - $(INCDIR)/http_core.h $(INCDIR)/http_request.h \ - $(INCDIR)/http_protocol.h $(INCDIR)/http_log.h \ - $(INCDIR)/http_main.h $(INCDIR)/util_script.h -mod_env.o: mod_env.c $(INCDIR)/httpd.h $(INCDIR)/ap_config.h \ - $(INCDIR)/ap_mmn.h $(INCDIR)/ap_config_auto.h \ - $(OSDIR)/os.h $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h \ - $(INCDIR)/ap_alloc.h $(INCDIR)/buff.h $(INCDIR)/ap.h \ - $(INCDIR)/util_uri.h $(INCDIR)/http_config.h + $(OSDIR)/os-inline.c $(INCDIR)/ap_ctype.h \ + $(INCDIR)/hsregex.h $(INCDIR)/ap_alloc.h $(INCDIR)/buff.h \ + $(INCDIR)/ap.h $(INCDIR)/util_uri.h \ + $(INCDIR)/http_config.h $(INCDIR)/http_request.h \ + $(INCDIR)/http_core.h $(INCDIR)/http_protocol.h \ + $(INCDIR)/http_main.h $(INCDIR)/http_log.h \ + $(INCDIR)/util_script.h $(INCDIR)/http_conf_globals.h +mod_digest.o: mod_digest.c $(INCDIR)/httpd.h \ + $(INCDIR)/ap_types.h $(INCDIR)/ap_config.h \ + $(INCDIR)/ap_mmn.h $(INCDIR)/ap_config_auto.h \ + $(OSDIR)/os.h $(OSDIR)/os-inline.c $(INCDIR)/ap_ctype.h \ + $(INCDIR)/hsregex.h $(INCDIR)/ap_alloc.h $(INCDIR)/buff.h \ + $(INCDIR)/ap.h $(INCDIR)/util_uri.h \ + $(INCDIR)/http_config.h $(INCDIR)/http_core.h \ + $(INCDIR)/http_log.h $(INCDIR)/http_protocol.h \ + $(INCDIR)/util_md5.h $(INCDIR)/ap_md5.h +mod_dir.o: mod_dir.c $(INCDIR)/httpd.h $(INCDIR)/ap_types.h \ + $(INCDIR)/ap_config.h $(INCDIR)/ap_mmn.h \ + $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h \ + $(OSDIR)/os-inline.c $(INCDIR)/ap_ctype.h \ + $(INCDIR)/hsregex.h $(INCDIR)/ap_alloc.h $(INCDIR)/buff.h \ + $(INCDIR)/ap.h $(INCDIR)/util_uri.h \ + $(INCDIR)/http_config.h $(INCDIR)/http_core.h \ + $(INCDIR)/http_request.h $(INCDIR)/http_protocol.h \ + $(INCDIR)/http_log.h $(INCDIR)/http_main.h \ + $(INCDIR)/util_script.h +mod_env.o: mod_env.c $(INCDIR)/httpd.h $(INCDIR)/ap_types.h \ + $(INCDIR)/ap_config.h $(INCDIR)/ap_mmn.h \ + $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h \ + $(OSDIR)/os-inline.c $(INCDIR)/ap_ctype.h \ + $(INCDIR)/hsregex.h $(INCDIR)/ap_alloc.h $(INCDIR)/buff.h \ + $(INCDIR)/ap.h $(INCDIR)/util_uri.h \ + $(INCDIR)/http_config.h mod_expires.o: mod_expires.c $(INCDIR)/httpd.h \ - $(INCDIR)/ap_config.h $(INCDIR)/ap_mmn.h \ - $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h \ - $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h \ - $(INCDIR)/ap_alloc.h $(INCDIR)/buff.h $(INCDIR)/ap.h \ - $(INCDIR)/util_uri.h $(INCDIR)/http_config.h \ - $(INCDIR)/http_log.h + $(INCDIR)/ap_types.h $(INCDIR)/ap_config.h \ + $(INCDIR)/ap_mmn.h $(INCDIR)/ap_config_auto.h \ + $(OSDIR)/os.h $(OSDIR)/os-inline.c $(INCDIR)/ap_ctype.h \ + $(INCDIR)/hsregex.h $(INCDIR)/ap_alloc.h $(INCDIR)/buff.h \ + $(INCDIR)/ap.h $(INCDIR)/util_uri.h \ + $(INCDIR)/http_config.h $(INCDIR)/http_log.h mod_headers.o: mod_headers.c $(INCDIR)/httpd.h \ + $(INCDIR)/ap_types.h $(INCDIR)/ap_config.h \ + $(INCDIR)/ap_mmn.h $(INCDIR)/ap_config_auto.h \ + $(OSDIR)/os.h $(OSDIR)/os-inline.c $(INCDIR)/ap_ctype.h \ + $(INCDIR)/hsregex.h $(INCDIR)/ap_alloc.h $(INCDIR)/buff.h \ + $(INCDIR)/ap.h $(INCDIR)/util_uri.h \ + $(INCDIR)/http_config.h +mod_imap.o: mod_imap.c $(INCDIR)/httpd.h $(INCDIR)/ap_types.h \ $(INCDIR)/ap_config.h $(INCDIR)/ap_mmn.h \ $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h \ - $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h \ - $(INCDIR)/ap_alloc.h $(INCDIR)/buff.h $(INCDIR)/ap.h \ - $(INCDIR)/util_uri.h $(INCDIR)/http_config.h -mod_imap.o: mod_imap.c $(INCDIR)/httpd.h $(INCDIR)/ap_config.h \ - $(INCDIR)/ap_mmn.h $(INCDIR)/ap_config_auto.h \ - $(OSDIR)/os.h $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h \ - $(INCDIR)/ap_alloc.h $(INCDIR)/buff.h $(INCDIR)/ap.h \ - $(INCDIR)/util_uri.h $(INCDIR)/http_config.h \ - $(INCDIR)/http_request.h $(INCDIR)/http_core.h \ - $(INCDIR)/http_protocol.h $(INCDIR)/http_main.h \ - $(INCDIR)/http_log.h $(INCDIR)/util_script.h + $(OSDIR)/os-inline.c $(INCDIR)/ap_ctype.h \ + $(INCDIR)/hsregex.h $(INCDIR)/ap_alloc.h $(INCDIR)/buff.h \ + $(INCDIR)/ap.h $(INCDIR)/util_uri.h \ + $(INCDIR)/http_config.h $(INCDIR)/http_request.h \ + $(INCDIR)/http_core.h $(INCDIR)/http_protocol.h \ + $(INCDIR)/http_main.h $(INCDIR)/http_log.h \ + $(INCDIR)/util_script.h mod_include.o: mod_include.c $(INCDIR)/httpd.h \ + $(INCDIR)/ap_types.h $(INCDIR)/ap_config.h \ + $(INCDIR)/ap_mmn.h $(INCDIR)/ap_config_auto.h \ + $(OSDIR)/os.h $(OSDIR)/os-inline.c $(INCDIR)/ap_ctype.h \ + $(INCDIR)/hsregex.h $(INCDIR)/ap_alloc.h $(INCDIR)/buff.h \ + $(INCDIR)/ap.h $(INCDIR)/util_uri.h \ + $(INCDIR)/http_config.h $(INCDIR)/http_request.h \ + $(INCDIR)/http_core.h $(INCDIR)/http_protocol.h \ + $(INCDIR)/http_log.h $(INCDIR)/http_main.h \ + $(INCDIR)/util_script.h +mod_info.o: mod_info.c $(INCDIR)/httpd.h $(INCDIR)/ap_types.h \ $(INCDIR)/ap_config.h $(INCDIR)/ap_mmn.h \ $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h \ - $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h \ - $(INCDIR)/ap_alloc.h $(INCDIR)/buff.h $(INCDIR)/ap.h \ - $(INCDIR)/util_uri.h $(INCDIR)/http_config.h \ - $(INCDIR)/http_request.h $(INCDIR)/http_core.h \ - $(INCDIR)/http_protocol.h $(INCDIR)/http_log.h \ - $(INCDIR)/http_main.h $(INCDIR)/util_script.h -mod_info.o: mod_info.c $(INCDIR)/httpd.h $(INCDIR)/ap_config.h \ - $(INCDIR)/ap_mmn.h $(INCDIR)/ap_config_auto.h \ - $(OSDIR)/os.h $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h \ - $(INCDIR)/ap_alloc.h $(INCDIR)/buff.h $(INCDIR)/ap.h \ - $(INCDIR)/util_uri.h $(INCDIR)/http_config.h \ - $(INCDIR)/http_core.h $(INCDIR)/http_log.h \ - $(INCDIR)/http_main.h $(INCDIR)/http_protocol.h \ - $(INCDIR)/util_script.h $(INCDIR)/http_conf_globals.h + $(OSDIR)/os-inline.c $(INCDIR)/ap_ctype.h \ + $(INCDIR)/hsregex.h $(INCDIR)/ap_alloc.h $(INCDIR)/buff.h \ + $(INCDIR)/ap.h $(INCDIR)/util_uri.h \ + $(INCDIR)/http_config.h $(INCDIR)/http_core.h \ + $(INCDIR)/http_log.h $(INCDIR)/http_main.h \ + $(INCDIR)/http_protocol.h $(INCDIR)/util_script.h \ + $(INCDIR)/http_conf_globals.h mod_log_agent.o: mod_log_agent.c $(INCDIR)/httpd.h \ - $(INCDIR)/ap_config.h $(INCDIR)/ap_mmn.h \ - $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h \ - $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h \ - $(INCDIR)/ap_alloc.h $(INCDIR)/buff.h $(INCDIR)/ap.h \ - $(INCDIR)/util_uri.h $(INCDIR)/http_config.h \ - $(INCDIR)/http_log.h + $(INCDIR)/ap_types.h $(INCDIR)/ap_config.h \ + $(INCDIR)/ap_mmn.h $(INCDIR)/ap_config_auto.h \ + $(OSDIR)/os.h $(OSDIR)/os-inline.c $(INCDIR)/ap_ctype.h \ + $(INCDIR)/hsregex.h $(INCDIR)/ap_alloc.h $(INCDIR)/buff.h \ + $(INCDIR)/ap.h $(INCDIR)/util_uri.h \ + $(INCDIR)/http_config.h $(INCDIR)/http_log.h mod_log_config.o: mod_log_config.c $(INCDIR)/httpd.h \ - $(INCDIR)/ap_config.h $(INCDIR)/ap_mmn.h \ - $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h \ - $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h \ - $(INCDIR)/ap_alloc.h $(INCDIR)/buff.h $(INCDIR)/ap.h \ - $(INCDIR)/util_uri.h $(INCDIR)/http_config.h \ - $(INCDIR)/http_core.h $(INCDIR)/http_log.h -mod_log_referer.o: mod_log_referer.c $(INCDIR)/httpd.h \ - $(INCDIR)/ap_config.h $(INCDIR)/ap_mmn.h \ - $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h \ - $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h \ - $(INCDIR)/ap_alloc.h $(INCDIR)/buff.h $(INCDIR)/ap.h \ - $(INCDIR)/util_uri.h $(INCDIR)/http_config.h \ - $(INCDIR)/http_log.h -mod_mime.o: mod_mime.c $(INCDIR)/httpd.h $(INCDIR)/ap_config.h \ + $(INCDIR)/ap_types.h $(INCDIR)/ap_config.h \ $(INCDIR)/ap_mmn.h $(INCDIR)/ap_config_auto.h \ - $(OSDIR)/os.h $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h \ - $(INCDIR)/ap_alloc.h $(INCDIR)/buff.h $(INCDIR)/ap.h \ - $(INCDIR)/util_uri.h $(INCDIR)/http_config.h \ + $(OSDIR)/os.h $(OSDIR)/os-inline.c $(INCDIR)/ap_ctype.h \ + $(INCDIR)/hsregex.h $(INCDIR)/ap_alloc.h $(INCDIR)/buff.h \ + $(INCDIR)/ap.h $(INCDIR)/util_uri.h \ + $(INCDIR)/http_config.h $(INCDIR)/http_core.h \ $(INCDIR)/http_log.h -mod_mime_magic.o: mod_mime_magic.c $(INCDIR)/httpd.h \ +mod_log_referer.o: mod_log_referer.c $(INCDIR)/httpd.h \ + $(INCDIR)/ap_types.h $(INCDIR)/ap_config.h \ + $(INCDIR)/ap_mmn.h $(INCDIR)/ap_config_auto.h \ + $(OSDIR)/os.h $(OSDIR)/os-inline.c $(INCDIR)/ap_ctype.h \ + $(INCDIR)/hsregex.h $(INCDIR)/ap_alloc.h $(INCDIR)/buff.h \ + $(INCDIR)/ap.h $(INCDIR)/util_uri.h \ + $(INCDIR)/http_config.h $(INCDIR)/http_log.h +mod_mime.o: mod_mime.c $(INCDIR)/httpd.h $(INCDIR)/ap_types.h \ $(INCDIR)/ap_config.h $(INCDIR)/ap_mmn.h \ $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h \ - $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h \ - $(INCDIR)/ap_alloc.h $(INCDIR)/buff.h $(INCDIR)/ap.h \ - $(INCDIR)/util_uri.h $(INCDIR)/http_config.h \ - $(INCDIR)/http_request.h $(INCDIR)/http_core.h \ - $(INCDIR)/http_log.h $(INCDIR)/http_protocol.h + $(OSDIR)/os-inline.c $(INCDIR)/ap_ctype.h \ + $(INCDIR)/hsregex.h $(INCDIR)/ap_alloc.h $(INCDIR)/buff.h \ + $(INCDIR)/ap.h $(INCDIR)/util_uri.h \ + $(INCDIR)/http_config.h $(INCDIR)/http_log.h +mod_mime_magic.o: mod_mime_magic.c $(INCDIR)/httpd.h \ + $(INCDIR)/ap_types.h $(INCDIR)/ap_config.h \ + $(INCDIR)/ap_mmn.h $(INCDIR)/ap_config_auto.h \ + $(OSDIR)/os.h $(OSDIR)/os-inline.c $(INCDIR)/ap_ctype.h \ + $(INCDIR)/hsregex.h $(INCDIR)/ap_alloc.h $(INCDIR)/buff.h \ + $(INCDIR)/ap.h $(INCDIR)/util_uri.h \ + $(INCDIR)/http_config.h $(INCDIR)/http_request.h \ + $(INCDIR)/http_core.h $(INCDIR)/http_log.h \ + $(INCDIR)/http_protocol.h mod_negotiation.o: mod_negotiation.c $(INCDIR)/httpd.h \ - $(INCDIR)/ap_config.h $(INCDIR)/ap_mmn.h \ - $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h \ - $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h \ - $(INCDIR)/ap_alloc.h $(INCDIR)/buff.h $(INCDIR)/ap.h \ - $(INCDIR)/util_uri.h $(INCDIR)/http_config.h \ - $(INCDIR)/http_request.h $(INCDIR)/http_core.h \ + $(INCDIR)/ap_types.h $(INCDIR)/ap_config.h \ + $(INCDIR)/ap_mmn.h $(INCDIR)/ap_config_auto.h \ + $(OSDIR)/os.h $(OSDIR)/os-inline.c $(INCDIR)/ap_ctype.h \ + $(INCDIR)/hsregex.h $(INCDIR)/ap_alloc.h $(INCDIR)/buff.h \ + $(INCDIR)/ap.h $(INCDIR)/util_uri.h \ + $(INCDIR)/http_config.h $(INCDIR)/http_request.h \ + $(INCDIR)/http_protocol.h $(INCDIR)/http_core.h \ $(INCDIR)/http_log.h $(INCDIR)/util_script.h mod_rewrite.o: mod_rewrite.c mod_rewrite.h $(INCDIR)/httpd.h \ - $(INCDIR)/ap_config.h $(INCDIR)/ap_mmn.h \ - $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h \ - $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h \ - $(INCDIR)/ap_alloc.h $(INCDIR)/buff.h $(INCDIR)/ap.h \ - $(INCDIR)/util_uri.h $(INCDIR)/http_config.h \ - $(INCDIR)/http_conf_globals.h $(INCDIR)/http_request.h \ - $(INCDIR)/http_core.h $(INCDIR)/http_log.h \ - $(INCDIR)/http_vhost.h + $(INCDIR)/ap_types.h $(INCDIR)/ap_config.h \ + $(INCDIR)/ap_mmn.h $(INCDIR)/ap_config_auto.h \ + $(OSDIR)/os.h $(OSDIR)/os-inline.c $(INCDIR)/ap_ctype.h \ + $(INCDIR)/hsregex.h $(INCDIR)/ap_alloc.h $(INCDIR)/buff.h \ + $(INCDIR)/ap.h $(INCDIR)/util_uri.h \ + $(INCDIR)/http_config.h $(INCDIR)/http_conf_globals.h \ + $(INCDIR)/http_request.h $(INCDIR)/http_core.h \ + $(INCDIR)/http_log.h $(INCDIR)/http_vhost.h mod_setenvif.o: mod_setenvif.c $(INCDIR)/httpd.h \ - $(INCDIR)/ap_config.h $(INCDIR)/ap_mmn.h \ - $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h \ - $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h \ - $(INCDIR)/ap_alloc.h $(INCDIR)/buff.h $(INCDIR)/ap.h \ - $(INCDIR)/util_uri.h $(INCDIR)/http_config.h \ - $(INCDIR)/http_core.h $(INCDIR)/http_log.h -mod_so.o: mod_so.c $(INCDIR)/httpd.h $(INCDIR)/ap_config.h \ - $(INCDIR)/ap_mmn.h $(INCDIR)/ap_config_auto.h \ - $(OSDIR)/os.h $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h \ - $(INCDIR)/ap_alloc.h $(INCDIR)/buff.h $(INCDIR)/ap.h \ - $(INCDIR)/util_uri.h $(INCDIR)/http_config.h \ + $(INCDIR)/ap_types.h $(INCDIR)/ap_config.h \ + $(INCDIR)/ap_mmn.h $(INCDIR)/ap_config_auto.h \ + $(OSDIR)/os.h $(OSDIR)/os-inline.c $(INCDIR)/ap_ctype.h \ + $(INCDIR)/hsregex.h $(INCDIR)/ap_alloc.h $(INCDIR)/buff.h \ + $(INCDIR)/ap.h $(INCDIR)/util_uri.h \ + $(INCDIR)/http_config.h $(INCDIR)/http_core.h \ $(INCDIR)/http_log.h -mod_speling.o: mod_speling.c $(INCDIR)/httpd.h \ +mod_so.o: mod_so.c $(INCDIR)/httpd.h $(INCDIR)/ap_types.h \ $(INCDIR)/ap_config.h $(INCDIR)/ap_mmn.h \ $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h \ - $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h \ - $(INCDIR)/ap_alloc.h $(INCDIR)/buff.h $(INCDIR)/ap.h \ - $(INCDIR)/util_uri.h $(INCDIR)/http_core.h \ + $(OSDIR)/os-inline.c $(INCDIR)/ap_ctype.h \ + $(INCDIR)/hsregex.h $(INCDIR)/ap_alloc.h $(INCDIR)/buff.h \ + $(INCDIR)/ap.h $(INCDIR)/util_uri.h \ + $(INCDIR)/http_config.h $(INCDIR)/http_log.h +mod_speling.o: mod_speling.c $(INCDIR)/httpd.h \ + $(INCDIR)/ap_types.h $(INCDIR)/ap_config.h \ + $(INCDIR)/ap_mmn.h $(INCDIR)/ap_config_auto.h \ + $(OSDIR)/os.h $(OSDIR)/os-inline.c $(INCDIR)/ap_ctype.h \ + $(INCDIR)/hsregex.h $(INCDIR)/ap_alloc.h $(INCDIR)/buff.h \ + $(INCDIR)/ap.h $(INCDIR)/util_uri.h $(INCDIR)/http_core.h \ $(INCDIR)/http_config.h $(INCDIR)/http_log.h mod_status.o: mod_status.c $(INCDIR)/httpd.h \ - $(INCDIR)/ap_config.h $(INCDIR)/ap_mmn.h \ - $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h \ - $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h \ - $(INCDIR)/ap_alloc.h $(INCDIR)/buff.h $(INCDIR)/ap.h \ - $(INCDIR)/util_uri.h $(INCDIR)/http_config.h \ - $(INCDIR)/http_core.h $(INCDIR)/http_protocol.h \ - $(INCDIR)/http_conf_globals.h $(INCDIR)/http_main.h \ - $(INCDIR)/util_script.h $(INCDIR)/scoreboard.h \ - $(INCDIR)/http_log.h + $(INCDIR)/ap_types.h $(INCDIR)/ap_config.h \ + $(INCDIR)/ap_mmn.h $(INCDIR)/ap_config_auto.h \ + $(OSDIR)/os.h $(OSDIR)/os-inline.c $(INCDIR)/ap_ctype.h \ + $(INCDIR)/hsregex.h $(INCDIR)/ap_alloc.h $(INCDIR)/buff.h \ + $(INCDIR)/ap.h $(INCDIR)/util_uri.h \ + $(INCDIR)/http_config.h $(INCDIR)/http_core.h \ + $(INCDIR)/http_protocol.h $(INCDIR)/http_conf_globals.h \ + $(INCDIR)/http_main.h $(INCDIR)/util_script.h \ + $(INCDIR)/scoreboard.h $(INCDIR)/http_log.h mod_unique_id.o: mod_unique_id.c $(INCDIR)/httpd.h \ - $(INCDIR)/ap_config.h $(INCDIR)/ap_mmn.h \ - $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h \ - $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h \ - $(INCDIR)/ap_alloc.h $(INCDIR)/buff.h $(INCDIR)/ap.h \ - $(INCDIR)/util_uri.h $(INCDIR)/http_config.h \ - $(INCDIR)/http_log.h $(INCDIR)/multithread.h + $(INCDIR)/ap_types.h $(INCDIR)/ap_config.h \ + $(INCDIR)/ap_mmn.h $(INCDIR)/ap_config_auto.h \ + $(OSDIR)/os.h $(OSDIR)/os-inline.c $(INCDIR)/ap_ctype.h \ + $(INCDIR)/hsregex.h $(INCDIR)/ap_alloc.h $(INCDIR)/buff.h \ + $(INCDIR)/ap.h $(INCDIR)/util_uri.h \ + $(INCDIR)/http_config.h $(INCDIR)/http_log.h \ + $(INCDIR)/multithread.h mod_userdir.o: mod_userdir.c $(INCDIR)/httpd.h \ - $(INCDIR)/ap_config.h $(INCDIR)/ap_mmn.h \ - $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h \ - $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h \ - $(INCDIR)/ap_alloc.h $(INCDIR)/buff.h $(INCDIR)/ap.h \ - $(INCDIR)/util_uri.h $(INCDIR)/http_config.h + $(INCDIR)/ap_types.h $(INCDIR)/ap_config.h \ + $(INCDIR)/ap_mmn.h $(INCDIR)/ap_config_auto.h \ + $(OSDIR)/os.h $(OSDIR)/os-inline.c $(INCDIR)/ap_ctype.h \ + $(INCDIR)/hsregex.h $(INCDIR)/ap_alloc.h $(INCDIR)/buff.h \ + $(INCDIR)/ap.h $(INCDIR)/util_uri.h \ + $(INCDIR)/http_config.h mod_usertrack.o: mod_usertrack.c $(INCDIR)/httpd.h \ - $(INCDIR)/ap_config.h $(INCDIR)/ap_mmn.h \ - $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h \ - $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h \ - $(INCDIR)/ap_alloc.h $(INCDIR)/buff.h $(INCDIR)/ap.h \ - $(INCDIR)/util_uri.h $(INCDIR)/http_config.h \ - $(INCDIR)/http_core.h + $(INCDIR)/ap_types.h $(INCDIR)/ap_config.h \ + $(INCDIR)/ap_mmn.h $(INCDIR)/ap_config_auto.h \ + $(OSDIR)/os.h $(OSDIR)/os-inline.c $(INCDIR)/ap_ctype.h \ + $(INCDIR)/hsregex.h $(INCDIR)/ap_alloc.h $(INCDIR)/buff.h \ + $(INCDIR)/ap.h $(INCDIR)/util_uri.h \ + $(INCDIR)/http_config.h $(INCDIR)/http_core.h +mod_vhost_alias.o: mod_vhost_alias.c $(INCDIR)/httpd.h \ + $(INCDIR)/ap_types.h $(INCDIR)/ap_config.h \ + $(INCDIR)/ap_mmn.h $(INCDIR)/ap_config_auto.h \ + $(OSDIR)/os.h $(OSDIR)/os-inline.c $(INCDIR)/ap_ctype.h \ + $(INCDIR)/hsregex.h $(INCDIR)/ap_alloc.h $(INCDIR)/buff.h \ + $(INCDIR)/ap.h $(INCDIR)/util_uri.h \ + $(INCDIR)/http_config.h $(INCDIR)/http_core.h diff -urN apache_1.3.20/src/modules/standard/mod_access.c-orig apache_1.3.20/src/modules/standard/mod_access.c --- apache_1.3.20/src/modules/standard/mod_access.c-orig Mon Jan 15 12:05:34 2001 +++ apache_1.3.20/src/modules/standard/mod_access.c Sat Jun 30 23:53:26 2001 @@ -82,8 +82,8 @@ union { char *from; struct { - unsigned long net; - unsigned long mask; + ap_uint32 net; + ap_uint32 mask; } ip; } x; enum allowdeny_type type; @@ -102,6 +102,7 @@ module MODULE_VAR_EXPORT access_module; +/*ARGSUSED1*/ static void *create_access_dir_config(pool *p, char *dummy) { access_dir_conf *conf = @@ -167,7 +168,7 @@ } else if ((s = strchr(where, '/'))) { - unsigned long mask; + ap_uint32 mask; a->type = T_IP; /* trample on where, we won't be using it any more */ @@ -199,7 +200,7 @@ a->type = T_FAIL; return "invalid mask in network/netmask"; } - mask = 0xFFFFFFFFUL << (32 - mask); + mask = ((ap_uint32) 0xFFFFFFFF) << (32 - mask); mask = htonl(mask); } a->x.ip.mask = mask; @@ -242,7 +243,7 @@ return "each octet must be between 0 and 255 inclusive"; } a->x.ip.net |= octet << shift; - a->x.ip.mask |= 0xFFUL << shift; + a->x.ip.mask |= ((ap_uint32) 0xFF) << shift; s = t; shift -= 8; } @@ -271,8 +272,8 @@ static int in_domain(const char *domain, const char *what) { - int dl = strlen(domain); - int wl = strlen(what); + int dl = ap_strlen(domain); + int wl = ap_strlen(what); if ((wl - dl) >= 0) { if (strcasecmp(domain, &what[wl - dl]) != 0) diff -urN apache_1.3.20/src/modules/standard/mod_actions.c-orig apache_1.3.20/src/modules/standard/mod_actions.c --- apache_1.3.20/src/modules/standard/mod_actions.c-orig Mon Jan 15 12:05:35 2001 +++ apache_1.3.20/src/modules/standard/mod_actions.c Sat Jun 30 23:53:26 2001 @@ -104,6 +104,7 @@ module action_module; +/*ARGSUSED1*/ static void *create_action_dir_config(pool *p, char *dummy) { action_dir_config *new = @@ -134,6 +135,7 @@ return new; } +/*ARGSUSED*/ static const char *add_action(cmd_parms *cmd, action_dir_config *m, char *type, char *script) { @@ -141,6 +143,7 @@ return NULL; } +/*ARGSUSED*/ static const char *set_script(cmd_parms *cmd, action_dir_config *m, char *method, char *script) { diff -urN apache_1.3.20/src/modules/standard/mod_alias.c-orig apache_1.3.20/src/modules/standard/mod_alias.c --- apache_1.3.20/src/modules/standard/mod_alias.c-orig Mon Jan 15 12:05:35 2001 +++ apache_1.3.20/src/modules/standard/mod_alias.c Sat Jun 30 23:53:26 2001 @@ -86,6 +86,7 @@ module MODULE_VAR_EXPORT alias_module; +/*ARGSUSED1*/ static void *create_alias_config(pool *p, server_rec *s) { alias_server_conf *a = @@ -96,6 +97,7 @@ return a; } +/*ARGSUSED1*/ static void *create_alias_dir_config(pool *p, char *d) { alias_dir_conf *a = @@ -124,6 +126,7 @@ return a; } +/*ARGSUSED1*/ static const char *add_alias_internal(cmd_parms *cmd, void *dummy, char *f, char *r, int use_regex) { @@ -170,7 +173,7 @@ server_rec *s = cmd->server; alias_server_conf *serverconf = (alias_server_conf *) ap_get_module_config(s->module_config, &alias_module); - int status = (int) (long) cmd->info; + int status = (int) (ap_ptr) cmd->info; regex_t *r = NULL; char *f = arg2; char *url = arg3; @@ -237,20 +240,20 @@ "a fakename and a realname"}, {"ScriptAlias", add_alias, "cgi-script", RSRC_CONF, TAKE2, "a fakename and a realname"}, - {"Redirect", add_redirect, (void *) HTTP_MOVED_TEMPORARILY, + {"Redirect", add_redirect, (void *) (ap_ptr) HTTP_MOVED_TEMPORARILY, OR_FILEINFO, TAKE23, "an optional status, then document to be redirected and destination URL"}, {"AliasMatch", add_alias_regex, NULL, RSRC_CONF, TAKE2, "a regular expression and a filename"}, {"ScriptAliasMatch", add_alias_regex, "cgi-script", RSRC_CONF, TAKE2, "a regular expression and a filename"}, - {"RedirectMatch", add_redirect_regex, (void *) HTTP_MOVED_TEMPORARILY, + {"RedirectMatch", add_redirect_regex, (void *) (ap_ptr) HTTP_MOVED_TEMPORARILY, OR_FILEINFO, TAKE23, "an optional status, then a regular expression and destination URL"}, - {"RedirectTemp", add_redirect, (void *) HTTP_MOVED_TEMPORARILY, + {"RedirectTemp", add_redirect, (void *) (ap_ptr) HTTP_MOVED_TEMPORARILY, OR_FILEINFO, TAKE2, "a document to be redirected, then the destination URL"}, - {"RedirectPermanent", add_redirect, (void *) HTTP_MOVED_PERMANENTLY, + {"RedirectPermanent", add_redirect, (void *) (ap_ptr) HTTP_MOVED_PERMANENTLY, OR_FILEINFO, TAKE2, "a document to be redirected, then the destination URL"}, {NULL} @@ -291,7 +294,7 @@ * doubled slashes) */ - return urip - uri; + return (int) (urip - uri); } static char *try_alias_list(request_rec *r, array_header *aliases, int doesc, int *status) diff -urN apache_1.3.20/src/modules/standard/mod_auth.c-orig apache_1.3.20/src/modules/standard/mod_auth.c --- apache_1.3.20/src/modules/standard/mod_auth.c-orig Mon Jan 15 12:05:36 2001 +++ apache_1.3.20/src/modules/standard/mod_auth.c Sat Jun 30 23:53:26 2001 @@ -82,6 +82,7 @@ int auth_authoritative; } auth_config_rec; +/*ARGSUSED1*/ static void *create_auth_dir_config(pool *p, char *d) { auth_config_rec *sec = diff -urN apache_1.3.20/src/modules/standard/mod_auth_anon.c-orig apache_1.3.20/src/modules/standard/mod_auth_anon.c --- apache_1.3.20/src/modules/standard/mod_auth_anon.c-orig Mon Jan 15 12:05:37 2001 +++ apache_1.3.20/src/modules/standard/mod_auth_anon.c Sat Jun 30 23:53:26 2001 @@ -117,6 +117,7 @@ } anon_auth_config_rec; +/*ARGSUSED1*/ static void *create_anon_auth_dir_config(pool *p, char *d) { anon_auth_config_rec *sec = (anon_auth_config_rec *) @@ -136,6 +137,7 @@ return sec; } +/*ARGSUSED*/ static const char *anon_set_passwd_flag(cmd_parms *cmd, anon_auth_config_rec * sec, int arg) { @@ -143,24 +145,28 @@ return NULL; } +/*ARGSUSED*/ static const char *anon_set_userid_flag(cmd_parms *cmd, anon_auth_config_rec * sec, int arg) { sec->auth_anon_nouserid = arg; return NULL; } +/*ARGSUSED*/ static const char *anon_set_logemail_flag(cmd_parms *cmd, anon_auth_config_rec * sec, int arg) { sec->auth_anon_logemail = arg; return NULL; } +/*ARGSUSED*/ static const char *anon_set_verifyemail_flag(cmd_parms *cmd, anon_auth_config_rec * sec, int arg) { sec->auth_anon_verifyemail = arg; return NULL; } +/*ARGSUSED*/ static const char *anon_set_authoritative_flag(cmd_parms *cmd, anon_auth_config_rec * sec, int arg) { @@ -272,9 +278,9 @@ return DECLINED; } +#ifdef NOTYET static int check_anon_access(request_rec *r) { -#ifdef NOTYET conn_rec *c = r->connection; anon_auth_config_rec *sec = (anon_auth_config_rec *) ap_get_module_config(r->per_dir_config, @@ -287,10 +293,14 @@ return DECLINED; return OK; -#endif +} +#else +/*ARGSUSED*/ +static int check_anon_access(request_rec *r) +{ return DECLINED; } - +#endif module MODULE_VAR_EXPORT anon_auth_module = { diff -urN apache_1.3.20/src/modules/standard/mod_auth_dbm.c-orig apache_1.3.20/src/modules/standard/mod_auth_dbm.c --- apache_1.3.20/src/modules/standard/mod_auth_dbm.c-orig Tue Mar 20 22:09:45 2001 +++ apache_1.3.20/src/modules/standard/mod_auth_dbm.c Sat Jun 30 23:53:26 2001 @@ -105,6 +105,7 @@ } dbm_auth_config_rec; +/*ARGSUSED1*/ static void *create_dbm_auth_dir_config(pool *p, char *d) { dbm_auth_config_rec *sec diff -urN apache_1.3.20/src/modules/standard/mod_autoindex.c-orig apache_1.3.20/src/modules/standard/mod_autoindex.c --- apache_1.3.20/src/modules/standard/mod_autoindex.c-orig Fri Mar 9 05:10:33 2001 +++ apache_1.3.20/src/modules/standard/mod_autoindex.c Sat Jun 30 23:53:26 2001 @@ -296,6 +296,7 @@ #define WILDCARDS_REQUIRED 0 #endif +/*ARGSUSED*/ static const char *add_desc(cmd_parms *cmd, void *d, char *desc, char *to) { autoindex_config_rec *dcfg = (autoindex_config_rec *) d; @@ -342,6 +343,7 @@ /* A legacy directive, FancyIndexing is superseded by the IndexOptions * keyword. But for compatibility.. */ +/*ARGSUSED0*/ static const char *fancy_indexing(cmd_parms *cmd, void *d, int arg) { int curopts; @@ -599,6 +601,7 @@ {NULL} }; +/*ARGSUSED1*/ static void *create_autoindex_config(pool *p, char *dummy) { autoindex_config_rec *new = @@ -943,7 +946,7 @@ ap_rputs("
    \n", r);
         while (!feof(f)) {
     	do {
    -	    n = fread(buf, sizeof(char), IOBUFSIZE, f);
    +	    n = (int) fread(buf, sizeof(char), IOBUFSIZE, f);
     	}
     	while (n == -1 && ferror(f) && errno == EINTR);
     	if (n == -1 || n == 0) {
    @@ -1156,7 +1159,7 @@
             if (!(thefile = ap_pfopen(r->pool, r->filename, "r"))) {
     	    return NULL;
     	}
    -	n = fread(titlebuf, sizeof(char), MAX_STRING_LEN - 1, thefile);
    +	n = (int) fread(titlebuf, sizeof(char), MAX_STRING_LEN - 1, thefile);
     	if (n <= 0) {
     	    ap_pfclose(r->pool, thefile);
     	    return NULL;
    @@ -1268,6 +1271,7 @@
         return (p);
     }
     
    +/*ARGSUSED0*/
     static char *terminate_description(autoindex_config_rec *d, char *desc,
     				   int autoindex_opts, int desc_width)
     {
    @@ -1367,7 +1371,7 @@
         if (d->desc_adjust == K_ADJUST) {
     	for (x = 0; x < n; x++) {
     	    if (ar[x]->desc != NULL) {
    -		int t = strlen(ar[x]->desc);
    +		int t = ap_strlen(ar[x]->desc);
     		if (t > desc_width) {
     		    desc_width = t;
     		}
    @@ -1377,7 +1381,7 @@
         name_width = d->name_width;
         if (d->name_adjust == K_ADJUST) {
     	for (x = 0; x < n; x++) {
    -	    int t = strlen(ar[x]->name);
    +	    int t = ap_strlen(ar[x]->name);
     	    if (t > name_width) {
     		name_width = t;
     	    }
    @@ -1471,7 +1475,7 @@
     		ap_rputs("", r);
     	    }
     
    -	    nwidth = strlen(t2);
    +	    nwidth = ap_strlen(t2);
     	    if (nwidth > name_width) {
     		memcpy(name_scratch, t2, name_width - 3);
     		name_scratch[name_width - 3] = '.';
    diff -urN apache_1.3.20/src/modules/standard/mod_cern_meta.c-orig apache_1.3.20/src/modules/standard/mod_cern_meta.c
    --- apache_1.3.20/src/modules/standard/mod_cern_meta.c-orig	Mon Jan 15 12:05:39 2001
    +++ apache_1.3.20/src/modules/standard/mod_cern_meta.c	Sat Jun 30 23:53:26 2001
    @@ -173,6 +173,7 @@
         int metafiles;
     } cern_meta_dir_config;
     
    +/*ARGSUSED1*/
     static void *create_cern_meta_dir_config(pool *p, char *dummy)
     {
         cern_meta_dir_config *new =
    @@ -199,18 +200,21 @@
         return new;
     }
     
    +/*ARGSUSED*/
     static const char *set_metadir(cmd_parms *parms, cern_meta_dir_config * dconf, char *arg)
     {
         dconf->metadir = arg;
         return NULL;
     }
     
    +/*ARGSUSED1*/
     static const char *set_metasuffix(cmd_parms *parms, cern_meta_dir_config * dconf, char *arg)
     {
         dconf->metasuffix = arg;
         return NULL;
     }
     
    +/*ARGSUSED*/
     static const char *set_metafiles(cmd_parms *parms, cern_meta_dir_config * dconf, int arg)
     {
         dconf->metafiles = arg;
    @@ -236,7 +240,7 @@
     {
         char w[MAX_STRING_LEN];
         char *l;
    -    int p;
    +    size_t p;
         table *tmp_headers;
     
         tmp_headers = ap_make_table(r->pool, 5);
    diff -urN apache_1.3.20/src/modules/standard/mod_cgi.c-orig apache_1.3.20/src/modules/standard/mod_cgi.c
    --- apache_1.3.20/src/modules/standard/mod_cgi.c-orig	Fri Mar  9 05:10:33 2001
    +++ apache_1.3.20/src/modules/standard/mod_cgi.c	Sat Jun 30 23:53:26 2001
    @@ -104,6 +104,7 @@
         int bufbytes;
     } cgi_server_conf;
     
    +/*ARGSUSED1*/
     static void *create_cgi_config(pool *p, server_rec *s)
     {
         cgi_server_conf *c =
    @@ -116,6 +117,7 @@
         return c;
     }
     
    +/*ARGSUSED*/
     static void *merge_cgi_config(pool *p, void *basev, void *overridesv)
     {
         cgi_server_conf *base = (cgi_server_conf *) basev, *overrides = (cgi_server_conf *) overridesv;
    @@ -123,6 +125,7 @@
         return overrides->logname ? overrides : base;
     }
     
    +/*ARGSUSED1*/
     static const char *set_scriptlog(cmd_parms *cmd, void *dummy, char *arg)
     {
         server_rec *s = cmd->server;
    @@ -133,6 +136,7 @@
         return NULL;
     }
     
    +/*ARGSUSED1*/
     static const char *set_scriptlog_length(cmd_parms *cmd, void *dummy, char *arg)
     {
         server_rec *s = cmd->server;
    @@ -143,6 +147,7 @@
         return NULL;
     }
     
    +/*ARGSUSED1*/
     static const char *set_scriptlog_buffer(cmd_parms *cmd, void *dummy, char *arg)
     {
         server_rec *s = cmd->server;
    @@ -169,15 +174,16 @@
     {
         FILE *f;
         struct stat finfo;
    +    const char *fn;
     
         ap_log_rerror(APLOG_MARK, show_errno|APLOG_ERR, r, 
     		"%s: %s", error, r->filename);
     
    -    if (!conf->logname ||
    -	((stat(ap_server_root_relative(r->pool, conf->logname), &finfo) == 0)
    +    fn = conf->logname ? ap_server_root_relative(r->pool, conf->logname) : NULL;
    +    if (!fn ||
    +	((ap_stat_cache(fn, &finfo) == 0)
     	 &&   (finfo.st_size > conf->logbytes)) ||
    -         ((f = ap_pfopen(r->pool, ap_server_root_relative(r->pool, conf->logname),
    -		      "a")) == NULL)) {
    +         ((f = ap_pfopen(r->pool, fn, "a")) == NULL)) {
     	return ret;
         }
     
    @@ -199,15 +205,16 @@
         array_header *hdrs_arr = ap_table_elts(r->headers_in);
         table_entry *hdrs = (table_entry *) hdrs_arr->elts;
         char argsbuffer[HUGE_STRING_LEN];
    +    const char *fn;
         FILE *f;
         int i;
         struct stat finfo;
     
    -    if (!conf->logname ||
    -	((stat(ap_server_root_relative(r->pool, conf->logname), &finfo) == 0)
    +    fn = conf->logname ? ap_server_root_relative(r->pool, conf->logname) : NULL;
    +    if (!fn ||
    +	((ap_stat_cache(fn, &finfo) == 0)
     	 &&   (finfo.st_size > conf->logbytes)) ||
    -         ((f = ap_pfopen(r->pool, ap_server_root_relative(r->pool, conf->logname),
    -		      "a")) == NULL)) {
    +         ((f = ap_pfopen(r->pool, fn, "a")) == NULL)) {
     	/* Soak up script output */
     	while (ap_bgets(argsbuffer, HUGE_STRING_LEN, script_in) > 0)
     	    continue;
    @@ -301,7 +308,9 @@
         struct cgi_child_stuff *cld = (struct cgi_child_stuff *) child_stuff;
         request_rec *r = cld->r;
         char *argv0 = cld->argv0;
    +#if defined(WIN32) || defined(OS2)
         int child_pid;
    +#endif
     
     #ifdef DEBUG_CGI
     #ifdef OS2
    @@ -345,7 +354,10 @@
     #else
         ap_cleanup_for_exec();
     
    -    child_pid = ap_call_exec(r, pinfo, argv0, env, 0);
    +#if defined(WIN32) || defined(OS2)
    +    child_pid = 
    +#endif
    +    ap_call_exec(r, pinfo, argv0, env, 0);
     #if defined(WIN32) || defined(OS2)
         return (child_pid);
     #else
    @@ -409,7 +421,7 @@
     
     	newfile = ap_pstrcat(r->pool, r->filename, ".EXE", NULL);
     
    -	if ((stat(newfile, &statbuf) != 0) || (!S_ISREG(statbuf.st_mode))) {
    +	if ((ap_stat_cache(newfile, &statbuf) != 0) || (!S_ISREG(statbuf.st_mode))) {
     	    return log_scripterror(r, conf, NOT_FOUND, 0,
     				   "script not found or unable to stat");
     	} else {
    diff -urN apache_1.3.20/src/modules/standard/mod_digest.c-orig apache_1.3.20/src/modules/standard/mod_digest.c
    --- apache_1.3.20/src/modules/standard/mod_digest.c-orig	Mon Jan 15 12:05:40 2001
    +++ apache_1.3.20/src/modules/standard/mod_digest.c	Sat Jun 30 23:53:26 2001
    @@ -83,6 +83,7 @@
         char *digest;
     } digest_header_rec;
     
    +/*ARGSUSED1*/
     static void *create_digest_dir_config(pool *p, char *d)
     {
         return ap_pcalloc(p, sizeof(digest_config_rec));
    @@ -138,7 +139,7 @@
     static int get_digest_rec(request_rec *r, digest_header_rec * response)
     {
         const char *auth_line;
    -    int l;
    +    size_t l;
         int s, vk = 0, vv = 0;
         const char *t;
         char *key, *value;
    diff -urN apache_1.3.20/src/modules/standard/mod_dir.c-orig apache_1.3.20/src/modules/standard/mod_dir.c
    --- apache_1.3.20/src/modules/standard/mod_dir.c-orig	Mon Feb 26 09:09:04 2001
    +++ apache_1.3.20/src/modules/standard/mod_dir.c	Sat Jun 30 23:53:26 2001
    @@ -96,6 +96,7 @@
         {NULL}
     };
     
    +/*ARGSUSED1*/
     static void *create_dir_config(pool *p, char *dummy)
     {
         dir_config_rec *new =
    diff -urN apache_1.3.20/src/modules/standard/mod_env.c-orig apache_1.3.20/src/modules/standard/mod_env.c
    --- apache_1.3.20/src/modules/standard/mod_env.c-orig	Mon Jan 15 12:05:41 2001
    +++ apache_1.3.20/src/modules/standard/mod_env.c	Sat Jun 30 23:53:26 2001
    @@ -110,6 +110,7 @@
     
     module MODULE_VAR_EXPORT env_module;
     
    +/*ARGSUSED1*/
     static void *create_env_dir_config(pool *p, char *dummy)
     {
         env_dir_config_rec *new =
    diff -urN apache_1.3.20/src/modules/standard/mod_expires.c-orig apache_1.3.20/src/modules/standard/mod_expires.c
    --- apache_1.3.20/src/modules/standard/mod_expires.c-orig	Mon Jan 15 12:05:41 2001
    +++ apache_1.3.20/src/modules/standard/mod_expires.c	Sat Jun 30 23:53:26 2001
    @@ -214,6 +214,7 @@
     
     module MODULE_VAR_EXPORT expires_module;
     
    +/*ARGSUSED1*/
     static void *create_dir_expires_config(pool *p, char *dummy)
     {
         expires_dir_config *new =
    @@ -224,6 +225,7 @@
         return (void *) new;
     }
     
    +/*ARGSUSED*/
     static const char *set_expiresactive(cmd_parms *cmd, expires_dir_config * dir_config, int arg)
     {
         /* if we're here at all it's because someone explicitly
    diff -urN apache_1.3.20/src/modules/standard/mod_headers.c-orig apache_1.3.20/src/modules/standard/mod_headers.c
    --- apache_1.3.20/src/modules/standard/mod_headers.c-orig	Mon Jan 15 12:05:41 2001
    +++ apache_1.3.20/src/modules/standard/mod_headers.c	Sat Jun 30 23:53:26 2001
    @@ -128,6 +128,7 @@
     
     module MODULE_VAR_EXPORT headers_module;
     
    +/*ARGSUSED1*/
     static void *create_headers_config(pool *p, server_rec *s)
     {
         headers_conf *a =
    @@ -137,6 +138,7 @@
         return a;
     }
     
    +/*ARGSUSED1*/
     static void *create_headers_dir_config(pool *p, char *d)
     {
         return (headers_conf *) create_headers_config(p, NULL);
    diff -urN apache_1.3.20/src/modules/standard/mod_imap.c-orig apache_1.3.20/src/modules/standard/mod_imap.c
    --- apache_1.3.20/src/modules/standard/mod_imap.c-orig	Fri Mar  9 05:10:34 2001
    +++ apache_1.3.20/src/modules/standard/mod_imap.c	Sat Jun 30 23:53:26 2001
    @@ -122,6 +122,7 @@
         char *imap_base;
     } imap_conf_rec;
     
    +/*ARGSUSED1*/
     static void *create_imap_dir_config(pool *p, char *dummy)
     {
         imap_conf_rec *icr =
    @@ -442,7 +443,7 @@
     
         while (!strncmp(value, "../", 3) || !strcmp(value, "..")) {
     
    -        if (directory && (slen = strlen(directory))) {
    +        if (directory && (slen = ap_strlen(directory))) {
     
                 /* for each '..',  knock a directory off the end 
                    by ending the string right at the last slash.
    @@ -457,7 +458,7 @@
                     if ((string_pos = strrchr(directory, '/'))) {
                         *string_pos = '\0';
     		}
    -                clen = strlen(directory);
    +                clen = ap_strlen(directory);
                     if (clen == 0) {
                         break;
     		}
    diff -urN apache_1.3.20/src/modules/standard/mod_include.c-orig apache_1.3.20/src/modules/standard/mod_include.c
    --- apache_1.3.20/src/modules/standard/mod_include.c-orig	Fri Feb 23 11:37:26 2001
    +++ apache_1.3.20/src/modules/standard/mod_include.c	Sat Jun 30 23:53:26 2001
    @@ -209,13 +209,13 @@
     
     static int find_string(FILE *in, const char *str, request_rec *r, int printing)
     {
    -    int x, l = strlen(str), p;
    +    int x, l = ap_strlen(str), p;
         char outbuf[OUTBUFSIZE];
         int outind = 0;
         char c;
     
         p = 0;
    -    while (1) {
    +    for (;;) {
             GET_CHAR(in, c, 1, r);
             if (c == str[p]) {
                 if ((++p) == l) {
    @@ -379,7 +379,7 @@
         }
     
         /* find end of tag name */
    -    while (1) {
    +    for (;;) {
             if (t - tag == tagbuf_len) {
                 *t = '\0';
                 return NULL;
    @@ -412,7 +412,7 @@
             return NULL;
         }
         term = c;
    -    while (1) {
    +    for (;;) {
             GET_CHAR(in, c, NULL, p);
             if (t - tag == tagbuf_len) {
                 *t = '\0';
    @@ -447,14 +447,14 @@
         --len;
     
         /* skip initial whitespace */
    -    while (1) {
    +    for (;;) {
             GET_CHAR(in, c, 1, p);
             if (!ap_isspace(c)) {
                 break;
             }
         }
         /* now get directive */
    -    while (1) {
    +    for (;;) {
     	if (d - dest == len) {
     	    return 1;
     	}
    @@ -658,7 +658,7 @@
         char parsed_string[MAX_STRING_LEN];
         char *tag_val;
     
    -    while (1) {
    +    for (;;) {
             if (!(tag_val = get_tag(r->pool, in, tag, sizeof(tag), 1))) {
                 return 1;
             }
    @@ -881,7 +881,7 @@
         char *file = r->filename;
         char parsed_string[MAX_STRING_LEN];
     
    -    while (1) {
    +    for (;;) {
             if (!(tag_val = get_tag(r->pool, in, tag, sizeof(tag), 1))) {
                 return 1;
             }
    @@ -932,7 +932,7 @@
     
         encode = E_ENTITY;
     
    -    while (1) {
    +    for (;;) {
             if (!(tag_val = get_tag(r->pool, in, tag, sizeof(tag), 1))) {
                 return 1;
             }
    @@ -994,7 +994,7 @@
     		      r->filename);
             return DECLINED;
         }
    -    while (1) {
    +    for (;;) {
             if (!(tag_val = get_tag(r->pool, in, tag, sizeof(tag), 1))) {
                 break;
             }
    @@ -1027,7 +1027,7 @@
         char parsed_string[MAX_STRING_LEN];
         table *env = r->subprocess_env;
     
    -    while (1) {
    +    for (;;) {
             if (!(tag_val = get_tag(r->pool, in, tag, sizeof(tag), 0))) {
                 return 1;
             }
    @@ -1086,7 +1086,7 @@
     
                 if (rr->status == HTTP_OK && rr->finfo.st_mode != 0) {
                     to_send = rr->filename;
    -                if (stat(to_send, finfo)) {
    +                if (ap_stat_cache(to_send, finfo)) {
                         error_fmt = "unable to get information about \"%s\" "
                                     "in parsed file %s";
                     }
    @@ -1143,7 +1143,7 @@
         struct stat finfo;
         char parsed_string[MAX_STRING_LEN];
     
    -    while (1) {
    +    for (;;) {
             if (!(tag_val = get_tag(r->pool, in, tag, sizeof(tag), 1))) {
                 return 1;
             }
    @@ -1159,11 +1159,18 @@
                     else {
                         int l, x;
     #if defined(AP_OFF_T_IS_QUAD)
    +#if defined(IRIX) && _MIPS_SIM != _ABIO32
    +/* disable warning about invalid format string conversion (irix uses ll not q for 64-bit values) */
    +#pragma set woff 1199
    +#endif
                         ap_snprintf(tag, sizeof(tag), "%qd", finfo.st_size);
    +#if defined(IRIX) && _MIPS_SIM != _ABIO32
    +#pragma reset woff 1199
    +#endif
     #else
    -                    ap_snprintf(tag, sizeof(tag), "%ld", finfo.st_size);
    +                    ap_snprintf(tag, sizeof(tag), "%ld", (long) finfo.st_size);
     #endif
    -                    l = strlen(tag);    /* grrr */
    +                    l = ap_strlen(tag);    /* grrr */
                         for (x = 0; x < l; x++) {
                             if (x && (!((l - x) % 3))) {
                                 ap_rputc(',', r);
    @@ -1183,7 +1190,7 @@
         struct stat finfo;
         char parsed_string[MAX_STRING_LEN];
     
    -    while (1) {
    +    for (;;) {
             if (!(tag_val = get_tag(r->pool, in, tag, sizeof(tag), 1))) {
                 return 1;
             }
    @@ -1407,7 +1414,7 @@
         expr_pool = ap_make_sub_pool(r->pool);
     
         /* Create Parse Tree */
    -    while (1) {
    +    for (;;) {
             new = (struct parse_node *) ap_palloc(expr_pool,
                                                sizeof(struct parse_node));
             new->parent = new->left = new->right = (struct parse_node *) NULL;
    @@ -1789,7 +1796,7 @@
                 ap_cpystrn(current->right->token.value, buffer,
     			sizeof(current->right->token.value));
                 if (current->right->token.value[0] == '/') {
    -                int len;
    +                size_t len;
                     len = strlen(current->right->token.value);
                     if (current->right->token.value[len - 1] == '/') {
                         current->right->token.value[len - 1] = '\0';
    @@ -1957,7 +1964,7 @@
         char *expr;
     
         expr = NULL;
    -    while (1) {
    +    for (;;) {
             tag_val = get_tag(r->pool, in, tag, sizeof(tag), 0);
             if (*tag == '\0') {
                 return 1;
    @@ -2000,7 +2007,7 @@
         char *expr;
     
         expr = NULL;
    -    while (1) {
    +    for (;;) {
             tag_val = get_tag(r->pool, in, tag, sizeof(tag), 0);
             if (*tag == '\0') {
                 return 1;
    @@ -2105,7 +2112,7 @@
         char *var;
     
         var = (char *) NULL;
    -    while (1) {
    +    for (;;) {
             if (!(tag_val = get_tag(r->pool, in, tag, sizeof(tag), 1))) {
                 return 1;
             }
    @@ -2138,12 +2145,11 @@
     static int handle_printenv(FILE *in, request_rec *r, const char *error)
     {
         char tag[MAX_STRING_LEN];
    -    char *tag_val;
         array_header *arr = ap_table_elts(r->subprocess_env);
         table_entry *elts = (table_entry *) arr->elts;
         int i;
     
    -    if (!(tag_val = get_tag(r->pool, in, tag, sizeof(tag), 1))) {
    +    if (!get_tag(r->pool, in, tag, sizeof(tag), 1)) {
             return 1;
         }
         else if (!strcmp(tag, "done")) {
    @@ -2198,7 +2204,7 @@
                       ap_escape_shell_cmd(r->pool, arg_copy));
         }
     
    -    while (1) {
    +    for (;;) {
             if (!find_string(f, STARTING_SEQUENCE, r, printing)) {
                 if (get_directive(f, directive, sizeof(directive), r->pool)) {
     		ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, r,
    @@ -2325,6 +2331,7 @@
     #define DEFAULT_XBITHACK xbithack_off
     #endif
     
    +/*ARGSUSED1*/
     static void *create_includes_dir_config(pool *p, char *dummy)
     {
         enum xbithack *result = (enum xbithack *) ap_palloc(p, sizeof(enum xbithack));
    @@ -2332,6 +2339,7 @@
         return result;
     }
     
    +/*ARGSUSED0*/
     static const char *set_xbithack(cmd_parms *cmd, void *xbp, char *arg)
     {
         enum xbithack *state = (enum xbithack *) xbp;
    diff -urN apache_1.3.20/src/modules/standard/mod_info.c-orig apache_1.3.20/src/modules/standard/mod_info.c
    --- apache_1.3.20/src/modules/standard/mod_info.c-orig	Fri Mar  9 05:10:34 2001
    +++ apache_1.3.20/src/modules/standard/mod_info.c	Sat Jun 30 23:53:26 2001
    @@ -124,6 +124,7 @@
         return strcmp(f1->fname,f2->fname);
     }
     
    +/*ARGSUSED1*/
     static void *create_info_config(pool *p, server_rec *s)
     {
         info_svr_conf *conf = (info_svr_conf *) ap_pcalloc(p, sizeof(info_svr_conf));
    @@ -721,6 +722,7 @@
         return 0;
     }
     
    +/*ARGSUSED1*/
     static const char *add_module_info(cmd_parms *cmd, void *dummy, char *name,
                                        char *info)
     {
    diff -urN apache_1.3.20/src/modules/standard/mod_log_agent.c-orig apache_1.3.20/src/modules/standard/mod_log_agent.c
    --- apache_1.3.20/src/modules/standard/mod_log_agent.c-orig	Mon Jan 15 12:05:44 2001
    +++ apache_1.3.20/src/modules/standard/mod_log_agent.c	Sat Jun 30 23:53:26 2001
    @@ -76,6 +76,7 @@
         int agent_fd;
     } agent_log_state;
     
    +/*ARGSUSED1*/
     static void *make_agent_log_state(pool *p, server_rec *s)
     {
         agent_log_state *cls =
    @@ -87,6 +88,7 @@
         return (void *) cls;
     }
     
    +/*ARGSUSED1*/
     static const char *set_agent_log(cmd_parms *parms, void *dummy, char *arg)
     {
         agent_log_state *cls = ap_get_module_config(parms->server->module_config,
    diff -urN apache_1.3.20/src/modules/standard/mod_log_config.c-orig apache_1.3.20/src/modules/standard/mod_log_config.c
    --- apache_1.3.20/src/modules/standard/mod_log_config.c-orig	Mon Jan 15 12:05:44 2001
    +++ apache_1.3.20/src/modules/standard/mod_log_config.c	Sat Jun 30 23:53:26 2001
    @@ -177,8 +177,6 @@
      *
      * --- rst */
     
    -#define DEFAULT_LOG_FORMAT "%h %l %u %t \"%r\" %>s %b"
    -
     #include "httpd.h"
     #include "http_config.h"
     #include "http_core.h"          /* For REMOTE_NAME */
    @@ -195,6 +193,20 @@
     static mode_t xfer_mode = (S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
     #endif
     
    +static const char common_log_format[] = "%h %l %u %t \"%r\" %>s %b";
    +#ifdef USE_QUICK_LOG
    +#define QUICK_CLF_MARKER	((array_header *) (ap_ptr) 0x1)
    +
    +static const char quick_log_format[] = "%a %l %u %t \"%r\" %>s %b";
    +#define QUICK_QLF_MARKER	((array_header *) (ap_ptr) 0x2)
    +#endif
    +
    +/*
    + * Increasing LOG_BUFSIZE beyond PIPE_BUF is good for performance but do
    + * so only if you know you're not using piped logs and your system can
    + * write more than PIPE_BUF bytes atomically to disk at once
    + */
    +#ifndef LOG_BUFSIZE
     /* POSIX.1 defines PIPE_BUF as the maximum number of bytes that is
      * guaranteed to be atomic when writing a pipe.  And PIPE_BUF >= 512
      * is guaranteed.  So we'll just guess 512 in the event the system
    @@ -209,6 +221,7 @@
     #else
     #define LOG_BUFSIZE     (512)
     #endif
    +#endif
     
     /*
      * multi_log_state is our per-(virtual)-server configuration. We store
    @@ -259,140 +272,179 @@
      * Note that many of these could have ap_sprintfs replaced with static buffers.
      */
     
    -typedef const char *(*item_key_func) (request_rec *, char *);
    +typedef const char *(*item_key_func) (request_rec *, char *, size_t *);
     
     typedef struct {
         item_key_func func;
         char *arg;
    +    size_t arglen;
         int condition_sense;
         int want_orig;
         array_header *conditions;
     } log_format_item;
     
    -static char *format_integer(pool *p, int i)
    -{
    -    return ap_psprintf(p, "%d", i);
    -}
    -
    -static char *pfmt(pool *p, int i)
    -{
    -    if (i <= 0) {
    -        return "-";
    -    }
    -    else {
    -        return format_integer(p, i);
    -    }
    -}
    -
    -static const char *constant_item(request_rec *dummy, char *stuff)
    +/*ARGSUSED*/
    +static const char *constant_item(request_rec *dummy, char *stuff, size_t *rlen)
     {
         return stuff;
     }
     
    -static const char *log_remote_host(request_rec *r, char *a)
    +/*ARGSUSED1*/
    +static const char *log_remote_host(request_rec *r, char *a, size_t *rlen)
     {
         return ap_get_remote_host(r->connection, r->per_dir_config,
                                         REMOTE_NAME);
     }
     
    -static const char *log_remote_address(request_rec *r, char *a)
    +/*ARGSUSED1*/
    +static const char *log_remote_address(request_rec *r, char *a, size_t *rlen)
     {
    +    *rlen = r->connection->remote_ip_len;
         return r->connection->remote_ip;
     }
     
    -static const char *log_local_address(request_rec *r, char *a)
    +/*ARGSUSED1*/
    +static const char *log_local_address(request_rec *r, char *a, size_t *rlen)
     {
    +    *rlen = r->connection->local_ip_len;
         return r->connection->local_ip;
     }
     
    -static const char *log_remote_logname(request_rec *r, char *a)
    +/*ARGSUSED1*/
    +static const char *log_remote_logname(request_rec *r, char *a, size_t *rlen)
     {
         return ap_get_remote_logname(r);
     }
     
    -static const char *log_remote_user(request_rec *r, char *a)
    +/*ARGSUSED*/
    +static const char *log_remote_user(request_rec *r, char *a, size_t *rlen)
     {
         char *rvalue = r->connection->user;
     
    -    if (rvalue == NULL) {
    -        rvalue = "-";
    -    }
    -    else if (strlen(rvalue) == 0) {
    -        rvalue = "\"\"";
    +    if (rvalue && *rvalue == 0) {
    +#if defined(IRIX) && _MIPS_SIM != _ABIO32
    +#pragma mips_frequency_hint NEVER
    +#endif
    +	rvalue = "\"\"";
    +	*rlen = 2;
         }
    +
         return rvalue;
     }
     
    -static const char *log_request_line(request_rec *r, char *a)
    +/*ARGSUSED1*/
    +static const char *log_request_line(request_rec *r, char *a, size_t *rlen)
     {
    -	    /* NOTE: If the original request contained a password, we
    -	     * re-write the request line here to contain XXXXXX instead:
    -	     * (note the truncation before the protocol string for HTTP/0.9 requests)
    -	     * (note also that r->the_request contains the unmodified request)
    -	     */
    -    return (r->parsed_uri.password) ? ap_pstrcat(r->pool, r->method, " ",
    -					 ap_unparse_uri_components(r->pool, &r->parsed_uri, 0),
    -					 r->assbackwards ? NULL : " ", r->protocol, NULL)
    -					: r->the_request;
    +    /* NOTE: If the original request contained a password, we
    +     * re-write the request line here to contain XXXXXX instead:
    +     * (note the truncation before the protocol string for HTTP/0.9 requests)
    +     * (note also that r->the_request contains the unmodified request)
    +     */
    +
    +    if (r->parsed_uri.password == NULL) {
    +	*rlen = r->the_request_len;
    +	return r->the_request;
    +    }
    +
    +    return ap_pstrcat(r->pool, r->method, " ",
    +	ap_unparse_uri_components(r->pool, &r->parsed_uri, 0),
    +	r->assbackwards ? NULL : " ", r->protocol, NULL);
     }
     
    -static const char *log_request_file(request_rec *r, char *a)
    +/*ARGSUSED1*/
    +static const char *log_request_file(request_rec *r, char *a, size_t *rlen)
     {
         return r->filename;
     }
    -static const char *log_request_uri(request_rec *r, char *a)
    +
    +/*ARGSUSED1*/
    +static const char *log_request_uri(request_rec *r, char *a, size_t *rlen)
     {
         return r->uri;
     }
    -static const char *log_request_method(request_rec *r, char *a)
    +
    +/*ARGSUSED1*/
    +static const char *log_request_method(request_rec *r, char *a, size_t *rlen)
     {
         return r->method;
     }
    -static const char *log_request_protocol(request_rec *r, char *a)
    +
    +/*ARGSUSED1*/
    +static const char *log_request_protocol(request_rec *r, char *a, size_t *rlen)
     {
         return r->protocol;
     }
    -static const char *log_request_query(request_rec *r, char *a)
    +
    +/*ARGSUSED1*/
    +static const char *log_request_query(request_rec *r, char *a, size_t *rlen)
     {
         return (r->args != NULL) ? ap_pstrcat(r->pool, "?", r->args, NULL)
                                  : "";
     }
    -static const char *log_status(request_rec *r, char *a)
    +
    +/*ARGSUSED*/
    +static const char *log_status(request_rec *r, char *a, size_t *rlen)
     {
    -    return pfmt(r->pool, r->status);
    +    /* Cache the last converted status. */
    +    static struct {
    +	int	status;
    +	char	str[16];
    +	size_t	len;
    +    } last;
    +
    +    if (r->status > 0) {
    +	if (r->status != last.status) {
    +#if defined(IRIX) && _MIPS_SIM != _ABIO32
    +#pragma mips_frequency_hint NEVER
    +#endif
    +	    last.status = r->status;
    +	    last.len = sprintf(last.str, "%d", last.status);
    +	}
    +
    +	*rlen = last.len;
    +	return last.str;
    +    }
    +
    +    return NULL;
     }
     
    -static const char *clf_log_bytes_sent(request_rec *r, char *a)
    +/*ARGSUSED1*/
    +static const char *clf_log_bytes_sent(request_rec *r, char *a, size_t *rlen)
     {
    -    if (!r->sent_bodyct) {
    -        return "-";
    -    }
    +    const char *cp;
    +    const char *length;
    +
    +    if (!r->sent_bodyct)
    +        cp = NULL;
    +    else if ((length = ap_table_get(r->headers_out, "Content-Length")) != NULL)
    +	cp = length;
         else {
    -        long int bs;
    +        ap_int32 bs;
             ap_bgetopt(r->connection->client, BO_BYTECT, &bs);
    -	return ap_psprintf(r->pool, "%ld", bs);
    +	cp = ap_psprintf(r->pool, "%ld", (long) bs);
         }
    +
    +    return cp;
     }
     
    -static const char *log_bytes_sent(request_rec *r, char *a)
    +static const char *log_bytes_sent(request_rec *r, char *a, size_t *rlen)
     {
    -    if (!r->sent_bodyct) {
    -        return "0";
    -    }
    -    else {
    -        long int bs;
    -        ap_bgetopt(r->connection->client, BO_BYTECT, &bs);
    -	return ap_psprintf(r->pool, "%ld", bs);
    +    const char *cp = clf_log_bytes_sent(r, a, rlen);
    +    if (cp == NULL) {
    +	cp = "0";
    +	*rlen = 1;
         }
    +    return cp;
     }
     
    -
    -static const char *log_header_in(request_rec *r, char *a)
    +/*ARGSUSED2*/
    +static const char *log_header_in(request_rec *r, char *a, size_t *rlen)
     {
         return ap_table_get(r->headers_in, a);
     }
     
    -static const char *log_header_out(request_rec *r, char *a)
    +/*ARGSUSED2*/
    +static const char *log_header_out(request_rec *r, char *a, size_t *rlen)
     {
         const char *cp = ap_table_get(r->headers_out, a);
         if (!strcasecmp(a, "Content-type") && r->content_type) {
    @@ -404,55 +456,83 @@
         return ap_table_get(r->err_headers_out, a);
     }
     
    -static const char *log_note(request_rec *r, char *a)
    +/*ARGSUSED2*/
    +static const char *log_note(request_rec *r, char *a, size_t *rlen)
     {
         return ap_table_get(r->notes, a);
     }
    -static const char *log_env_var(request_rec *r, char *a)
    +
    +/*ARGSUSED2*/
    +static const char *log_env_var(request_rec *r, char *a, size_t *rlen)
     {
         return ap_table_get(r->subprocess_env, a);
     }
     
    -static const char *log_request_time(request_rec *r, char *a)
    +static const char *log_request_time(request_rec *r, char *a, size_t *rlen)
     {
    +    /* Cache the last converted time.  See ap_gm_timestr_822(). */
    +    static struct {
    +	time_t	time;
    +	char	str[64];
    +	size_t	len;
    +    } last;
         int timz;
         struct tm *t;
    -    char tstr[MAX_STRING_LEN];
    +    char *cp;
     
    -    t = ap_get_gmtoff(&timz);
    +    if (!a || !*a) {
    +	time_t now = ap_time();
    +	if (now != last.time) {
    +#if defined(IRIX) && _MIPS_SIM != _ABIO32
    +#pragma mips_frequency_hint NEVER
    +#endif
    +	    char sign;
     
    -    if (a && *a) {              /* Custom format */
    -        strftime(tstr, MAX_STRING_LEN, a, t);
    -    }
    -    else {                      /* CLF format */
    -        char sign = (timz < 0 ? '-' : '+');
    +	    t = ap_get_gmtoff(&timz);
    +	    if (timz < 0) {
    +		sign = '-';
    +		timz = -timz;
    +	    } else
    +		sign = '+';
    +
    +	    last.time = now;
    +	    last.len = ap_snprintf(last.str, sizeof last.str,
    +		"[%02d/%s/%d:%02d:%02d:%02d %c%.2d%.2d]",
    +		t->tm_mday, ap_month_snames[t->tm_mon], t->tm_year+1900, 
    +		t->tm_hour, t->tm_min, t->tm_sec,
    +		sign, timz / 60, timz % 60);
    +	}
     
    -        if (timz < 0) {
    -            timz = -timz;
    -        }
    -        ap_snprintf(tstr, sizeof(tstr), "[%02d/%s/%d:%02d:%02d:%02d %c%.2d%.2d]",
    -                t->tm_mday, ap_month_snames[t->tm_mon], t->tm_year+1900, 
    -                t->tm_hour, t->tm_min, t->tm_sec,
    -                sign, timz / 60, timz % 60);
    +	cp = last.str;
    +	*rlen = last.len;
    +    } else {			/* Custom format */
    +	char tstr[MAX_STRING_LEN];
    +
    +	t = ap_get_gmtoff(&timz);
    +        strftime(tstr, MAX_STRING_LEN, a, t);
    +	cp = ap_pstrdup(r->pool, tstr);
         }
     
    -    return ap_pstrdup(r->pool, tstr);
    +    return cp;
     }
     
    -static const char *log_request_duration(request_rec *r, char *a)
    +/*ARGSUSED1*/
    +static const char *log_request_duration(request_rec *r, char *a, size_t *rlen)
     {
    -    return ap_psprintf(r->pool, "%ld", time(NULL) - r->request_time);
    +    return ap_psprintf(r->pool, "%ld", (long) (time(NULL) - r->request_time));
     }
     
     /* These next two routines use the canonical name:port so that log
      * parsers don't need to duplicate all the vhost parsing crud.
      */
    -static const char *log_virtual_host(request_rec *r, char *a)
    +/*ARGSUSED1*/
    +static const char *log_virtual_host(request_rec *r, char *a, size_t *rlen)
     {
         return r->server->server_hostname;
     }
     
    -static const char *log_server_port(request_rec *r, char *a)
    +/*ARGSUSED1*/
    +static const char *log_server_port(request_rec *r, char *a, size_t *rlen)
     {
         return ap_psprintf(r->pool, "%u",
     	r->server->port ? r->server->port : ap_default_port(r));
    @@ -461,12 +541,14 @@
     /* This respects the setting of UseCanonicalName so that
      * the dynamic mass virtual hosting trick works better.
      */
    -static const char *log_server_name(request_rec *r, char *a)
    +/*ARGSUSED1*/
    +static const char *log_server_name(request_rec *r, char *a, size_t *rlen)
     {
         return ap_get_server_name(r);
     }
     
    -static const char *log_child_pid(request_rec *r, char *a)
    +/*ARGSUSED1*/
    +static const char *log_child_pid(request_rec *r, char *a, size_t *rlen)
     {
         return ap_psprintf(r->pool, "%ld", (long) getpid());
     }
    @@ -638,6 +720,7 @@
     	}
         }
         *d = '\0';
    +    it->arglen = d - it->arg;
     
         *sa = s;
         return NULL;
    @@ -656,6 +739,7 @@
         it->conditions = NULL;
         it->want_orig = -1;
         it->arg = "";               /* For safety's sake... */
    +    it->arglen = 0;
     
         while (*s) {
             int i;
    @@ -730,9 +814,17 @@
     
     static array_header *parse_log_string(pool *p, const char *s, const char **err)
     {
    -    array_header *a = ap_make_array(p, 30, sizeof(log_format_item));
    +    array_header *a;
         char *res;
     
    +#ifdef USE_QUICK_LOG
    +    if (s == common_log_format || !strcmp(s, common_log_format))
    +	return QUICK_CLF_MARKER;
    +    else if (s == quick_log_format || !strcmp(s, quick_log_format))
    +	return QUICK_QLF_MARKER;
    +#endif
    +
    +    a = ap_make_array(p, 30, sizeof(log_format_item));
         while (*s) {
             if ((res = parse_log_item(p, (log_format_item *) ap_push_array(a), &s))) {
                 *err = res;
    @@ -751,9 +843,10 @@
      */
     
     static const char *process_item(request_rec *r, request_rec *orig,
    -                          log_format_item *item)
    +                          log_format_item *item, size_t *rlen)
     {
         const char *cp;
    +    static const char dash[2] = "-";
     
         /* First, see if we need to process this thing at all... */
     
    @@ -771,14 +864,20 @@
     
             if ((item->condition_sense && in_list)
                 || (!item->condition_sense && !in_list)) {
    -            return "-";
    +	    *rlen = 1;
    +	    return dash;
             }
         }
     
         /* We do.  Do it... */
     
    -    cp = (*item->func) (item->want_orig ? orig : r, item->arg);
    -    return cp ? cp : "-";
    +    *rlen = item->arglen;
    +    cp = (*item->func) (item->want_orig ? orig : r, item->arg, rlen);
    +    if (cp)
    +	return cp;
    +
    +    *rlen = 1;
    +    return dash;
     }
     
     #ifdef BUFFERED_LOGS
    @@ -791,20 +890,192 @@
     }
     #endif
     
    +static void
    +log_vec(request_rec *r, config_log_state *cls, struct iovec *iovec,
    +    int iovcnt, size_t len)
    +{
    +    int i;
    +    char *s;
    +
    +#ifdef BUFFERED_LOGS
    +    if (len + cls->outcnt > LOG_BUFSIZE) {
    +#if defined(IRIX) && _MIPS_SIM != _ABIO32
    +#pragma mips_frequency_hint NEVER
    +#endif
    +        flush_log(cls);
    +    }
    +    if (len < LOG_BUFSIZE) {
    +	for (i = 0, s = &cls->outbuf[cls->outcnt]; i < iovcnt; i++) {
    +	    memcpy(s, iovec[i].iov_base, iovec[i].iov_len);
    +	    s += iovec[i].iov_len;
    +	}
    +	cls->outcnt += len;
    +    } else {
    +#endif
    +	char *str = ap_palloc(r->pool, len);
    +	for (i = 0, s = str; i < iovcnt; i++) {
    +	    memcpy(s, iovec[i].iov_base, iovec[i].iov_len);
    +	    s += iovec[i].iov_len;
    +	}
    +	write(cls->log_fd, str, len);
    +#ifdef BUFFERED_LOGS
    +    }
    +#endif
    +}
    +
    +#ifdef USE_QUICK_LOG
    +static int quick_log(request_rec *r, request_rec *orig, config_log_state *cls,
    +    const array_header *format)
    +{
    +    struct iovec iovec[14];
    +    static const char sqsdn[6] = " \" -\n";
    +
    +    /*
    +     * format is either:
    +     *	QUICK_CLF_MARKER for "%h %l %u %t \"%r\" %>s %b\n"
    +     * or
    +     *	QUICK_QLF_MARKER for "%a %l %u %t \"%r\" %>s %b\n"
    +     */
    +
    +    /* "%h" or "%a" */
    +    iovec[0].iov_len = 0;
    +    iovec[0].iov_base = (format == QUICK_QLF_MARKER) ?
    +	(void *) log_remote_address(r, NULL, &iovec[0].iov_len) :
    +	(void *) log_remote_host(r, NULL, &iovec[0].iov_len);
    +    if (iovec[0].iov_base) {
    +	if (iovec[0].iov_len == 0) {
    +#if defined(IRIX) && _MIPS_SIM != _ABIO32
    +#pragma mips_frequency_hint NEVER
    +#endif
    +	    iovec[0].iov_len = strlen(iovec[0].iov_base);
    +	}
    +    } else {
    +	iovec[0].iov_base = (void *) &sqsdn[3];
    +	iovec[0].iov_len = 1;
    +    }
    +
    +    /* " " */
    +    iovec[1].iov_base = (void *) sqsdn;
    +    iovec[1].iov_len = 1;
    +
    +    /* "%l" */
    +    iovec[2].iov_len = 0;
    +    iovec[2].iov_base = (void *) log_remote_logname(r, NULL, &iovec[2].iov_len);
    +    if (iovec[2].iov_base == NULL) {
    +	iovec[2].iov_base = (void *) &sqsdn[3];
    +	iovec[2].iov_len = 1;
    +    } else if (iovec[2].iov_len == 0)
    +	iovec[2].iov_len = strlen(iovec[2].iov_base);
    +
    +    /* " " */
    +    iovec[3].iov_base = (void *) sqsdn;
    +    iovec[3].iov_len = 1;
    +
    +    /* "%u" */
    +    iovec[4].iov_len = 0;
    +    iovec[4].iov_base = (void *) log_remote_user(r, NULL, &iovec[4].iov_len);
    +    if (iovec[4].iov_base == NULL) {
    +	iovec[4].iov_base = (void *) &sqsdn[3];
    +	iovec[4].iov_len = 1;
    +    } else if (iovec[4].iov_len == 0)
    +	iovec[4].iov_len = strlen(iovec[4].iov_base);
    +
    +    /* " " */
    +    iovec[5].iov_base = (void *) sqsdn;
    +    iovec[5].iov_len = 1;
    +
    +    /* "%t" */
    +    iovec[6].iov_len = 0;
    +    iovec[6].iov_base = (void *) log_request_time(r, NULL, &iovec[6].iov_len);
    +    if (iovec[6].iov_len == 0) {
    +#if defined(IRIX) && _MIPS_SIM != _ABIO32
    +#pragma mips_frequency_hint NEVER
    +#endif
    +	iovec[6].iov_len = strlen(iovec[6].iov_base);
    +    }
    +
    +    /* " \"" */
    +    iovec[7].iov_base = (void *) sqsdn;
    +    iovec[7].iov_len = 2;
    +
    +    /* "%r" */
    +    iovec[8].iov_len = 0;
    +    iovec[8].iov_base = (void *) log_request_line(orig, NULL, &iovec[8].iov_len);
    +    if (iovec[8].iov_base) {
    +	if (iovec[8].iov_len == 0) {
    +#if defined(IRIX) && _MIPS_SIM != _ABIO32
    +#pragma mips_frequency_hint NEVER
    +#endif
    +	    iovec[8].iov_len = strlen(iovec[8].iov_base); 
    +	}
    +    } else {
    +	iovec[8].iov_base = (void *) &sqsdn[3];
    +	iovec[8].iov_len = 1;
    +    }
    +
    +    /* "\" " */
    +    iovec[9].iov_base = (void *) &sqsdn[1];
    +    iovec[9].iov_len = 2;
    +
    +    /* "%>s" */
    +    iovec[10].iov_len = 0;
    +    iovec[10].iov_base = (void *) log_status(r, NULL, &iovec[10].iov_len);
    +    if (iovec[10].iov_base) {
    +	if (iovec[10].iov_len == 0) {
    +#if defined(IRIX) && _MIPS_SIM != _ABIO32
    +#pragma mips_frequency_hint NEVER
    +#endif
    +	    iovec[10].iov_len = strlen(iovec[10].iov_base);
    +	}
    +    } else {
    +	iovec[10].iov_base = (void *) &sqsdn[3];
    +	iovec[10].iov_len = 1;
    +    }
    +
    +    /* " " */
    +    iovec[11].iov_base = (void *) sqsdn;
    +    iovec[11].iov_len = 1;
    +
    +    /* "%b" */
    +    iovec[12].iov_len = 0;
    +    iovec[12].iov_base = (void *) clf_log_bytes_sent(r, NULL, &iovec[12].iov_len);
    +    if (iovec[12].iov_base) {
    +	if (iovec[12].iov_len == 0)
    +	    iovec[12].iov_len = strlen(iovec[12].iov_base);
    +    } else {
    +	iovec[12].iov_base = (void *) &sqsdn[3];
    +	iovec[12].iov_len = 1;
    +    }
    +
    +    /* "\n" */
    +    iovec[13].iov_base = (void *) &sqsdn[4];
    +    iovec[13].iov_len = 1;
    +
    +    log_vec(r, cls, iovec, 14,
    +	iovec[0].iov_len + iovec[1].iov_len + iovec[2].iov_len +
    +	iovec[3].iov_len + iovec[4].iov_len + iovec[5].iov_len +
    +	iovec[6].iov_len + iovec[7].iov_len + iovec[8].iov_len +
    +	iovec[9].iov_len + iovec[10].iov_len + iovec[11].iov_len +
    +	iovec[12].iov_len + iovec[13].iov_len);
    +
    +    return OK;
    +}
    +#endif
    +
     static int config_log_transaction(request_rec *r, config_log_state *cls,
                                       array_header *default_format)
     {
         log_format_item *items;
    -    char *str, *s;
    -    const char **strs;
    -    int *strl;
         request_rec *orig;
    -    int i;
    -    int len = 0;
    +    int i, len;
         array_header *format;
         char *envar;
    +    struct iovec local_iovec[20], *iovec;
     
         if (cls->fname == NULL) {
    +#if defined(IRIX) && _MIPS_SIM != _ABIO32
    +#pragma mips_frequency_hint NEVER
    +#endif
             return DECLINED;
         }
     
    @@ -813,6 +1084,9 @@
          * to make.
          */
         if (cls->condition_var != NULL) {
    +#if defined(IRIX) && _MIPS_SIM != _ABIO32
    +#pragma mips_frequency_hint NEVER
    +#endif
     	envar = cls->condition_var;
     	if (*envar != '!') {
     	    if (ap_table_get(r->subprocess_env, envar) == NULL) {
    @@ -826,12 +1100,6 @@
     	}
         }
     
    -    format = cls->format ? cls->format : default_format;
    -
    -    strs = ap_palloc(r->pool, sizeof(char *) * (format->nelts));
    -    strl = ap_palloc(r->pool, sizeof(int) * (format->nelts));
    -    items = (log_format_item *) format->elts;
    -
         orig = r;
         while (orig->prev) {
             orig = orig->prev;
    @@ -840,43 +1108,30 @@
             r = r->next;
         }
     
    -    for (i = 0; i < format->nelts; ++i) {
    -        strs[i] = process_item(r, orig, &items[i]);
    -    }
    +    format = cls->format ? cls->format : default_format;
     
    -    for (i = 0; i < format->nelts; ++i) {
    -        len += strl[i] = strlen(strs[i]);
    -    }
    +#ifdef USE_QUICK_LOG
    +    if (format == QUICK_CLF_MARKER || format == QUICK_QLF_MARKER)
    +	return quick_log(r, orig, cls, format);
    +#endif
     
    -#ifdef BUFFERED_LOGS
    -    if (len + cls->outcnt > LOG_BUFSIZE) {
    -        flush_log(cls);
    -    }
    -    if (len >= LOG_BUFSIZE) {
    -        str = ap_palloc(r->pool, len + 1);
    -        for (i = 0, s = str; i < format->nelts; ++i) {
    -            memcpy(s, strs[i], strl[i]);
    -            s += strl[i];
    -        }
    -        write(cls->log_fd, str, len);
    -    }
    -    else {
    -        for (i = 0, s = &cls->outbuf[cls->outcnt]; i < format->nelts; ++i) {
    -            memcpy(s, strs[i], strl[i]);
    -            s += strl[i];
    -        }
    -        cls->outcnt += len;
    -    }
    -#else
    -    str = ap_palloc(r->pool, len + 1);
    +    len = 0;
    +    if (format->nelts <= sizeof local_iovec / sizeof local_iovec[0])
    +	iovec = local_iovec;
    +    else
    +	iovec = ap_palloc(r->pool, sizeof *iovec * format->nelts);
    +    items = (log_format_item *) format->elts;
     
    -    for (i = 0, s = str; i < format->nelts; ++i) {
    -        memcpy(s, strs[i], strl[i]);
    -        s += strl[i];
    +    for (i = 0; i < format->nelts; ++i) {
    +	iovec[i].iov_len = 0;
    +	iovec[i].iov_base = (void *) process_item(r, orig, &items[i],
    +	    &iovec[i].iov_len);
    +	if (iovec[i].iov_len == 0)
    +	    iovec[i].iov_len = strlen(iovec[i].iov_base);
    +	len += iovec[i].iov_len;
         }
     
    -    write(cls->log_fd, str, len);
    -#endif
    +    log_vec(r, cls, iovec, format->nelts, len);
     
         return OK;
     }
    @@ -916,6 +1171,7 @@
      * Module glue...
      */
     
    +/*ARGSUSED1*/
     static void *make_config_log_state(pool *p, server_rec *s)
     {
         multi_log_state *mls;
    @@ -926,7 +1182,7 @@
         mls->default_format = NULL;
         mls->server_config_logs = NULL;
         mls->formats = ap_make_table(p, 4);
    -    ap_table_setn(mls->formats, "CLF", DEFAULT_LOG_FORMAT);
    +    ap_table_setn(mls->formats, "CLF", common_log_format);
     
         return mls;
     }
    @@ -955,6 +1211,7 @@
     /*
      * Set the default logfile format, or define a nickname for a format string.
      */
    +/*ARGSUSED1*/
     static const char *log_format(cmd_parms *cmd, void *dummy, char *fmt,
                                   char *name)
     {
    @@ -980,7 +1237,7 @@
         return err_string;
     }
     
    -
    +/*ARGSUSED1*/
     static const char *add_custom_log(cmd_parms *cmd, void *dummy, char *fn,
                                       char *fmt, char *envclause)
     {
    @@ -1039,6 +1296,7 @@
         {NULL}
     };
     
    +/*ARGSUSED3*/
     static config_log_state *open_config_log(server_rec *s, pool *p,
                                              config_log_state *cls,
                                              array_header *default_format)
    @@ -1092,7 +1350,7 @@
         }    
     
         if (!mls->default_format) {
    -        mls->default_format = parse_log_string(p, DEFAULT_LOG_FORMAT, &dummy);
    +        mls->default_format = parse_log_string(p, common_log_format, &dummy);
         }
     
         if (mls->config_logs->nelts) {
    @@ -1145,6 +1403,7 @@
     }
     
     #ifdef BUFFERED_LOGS
    +/*ARGSUSED1*/
     static void flush_all_logs(server_rec *s, pool *p)
     {
         multi_log_state *mls;
    diff -urN apache_1.3.20/src/modules/standard/mod_log_referer.c-orig apache_1.3.20/src/modules/standard/mod_log_referer.c
    --- apache_1.3.20/src/modules/standard/mod_log_referer.c-orig	Mon Jan 15 12:05:45 2001
    +++ apache_1.3.20/src/modules/standard/mod_log_referer.c	Sat Jun 30 23:53:26 2001
    @@ -78,6 +78,7 @@
         array_header *referer_ignore_list;
     } referer_log_state;
     
    +/*ARGSUSED1*/
     static void *make_referer_log_state(pool *p, server_rec *s)
     {
         referer_log_state *cls =
    @@ -89,6 +90,7 @@
         return (void *) cls;
     }
     
    +/*ARGSUSED1*/
     static const char *set_referer_log(cmd_parms *parms, void *dummy, char *arg)
     {
         referer_log_state *cls = ap_get_module_config(parms->server->module_config,
    @@ -98,6 +100,7 @@
         return NULL;
     }
     
    +/*ARGSUSED1*/
     static const char *add_referer_ignore(cmd_parms *parms, void *dummy, char *arg)
     {
         char **addme;
    diff -urN apache_1.3.20/src/modules/standard/mod_mime.c-orig apache_1.3.20/src/modules/standard/mod_mime.c
    --- apache_1.3.20/src/modules/standard/mod_mime.c-orig	Mon Jan 15 12:05:45 2001
    +++ apache_1.3.20/src/modules/standard/mod_mime.c	Sat Jun 30 23:53:26 2001
    @@ -115,6 +115,7 @@
     
     module MODULE_VAR_EXPORT mime_module;
     
    +/*ARGSUSED1*/
     static void *create_mime_dir_config(pool *p, char *dummy)
     {
         mime_dir_config *new =
    @@ -177,6 +178,7 @@
         return new;
     }
     
    +/*ARGSUSED*/
     static const char *add_type(cmd_parms *cmd, mime_dir_config *m, char *ct,
                                 char *ext)
     {
    @@ -188,6 +190,7 @@
         return NULL;
     }
     
    +/*ARGSUSED*/
     static const char *add_encoding(cmd_parms *cmd, mime_dir_config *m, char *enc,
                                     char *ext)
     {
    @@ -198,6 +201,7 @@
         return NULL;
     }
     
    +/*ARGSUSED*/
     static const char *add_charset(cmd_parms *cmd, mime_dir_config *m,
     			       char *charset, char *ext)
     {
    @@ -209,6 +213,7 @@
         return NULL;
     }
     
    +/*ARGSUSED*/
     static const char *add_language(cmd_parms *cmd, mime_dir_config *m, char *lang,
                                     char *ext)
     {
    @@ -220,6 +225,7 @@
         return NULL;
     }
     
    +/*ARGSUSED*/
     static const char *add_handler(cmd_parms *cmd, mime_dir_config *m, char *hdlr,
                                    char *ext)
     {
    @@ -286,6 +292,7 @@
      * the name of its config file, so...
      */
     
    +/*ARGSUSED1*/
     static const char *set_types_config(cmd_parms *cmd, void *dummy, char *arg)
     {
         ap_set_module_config(cmd->server->module_config, &mime_module, arg);
    @@ -563,7 +570,7 @@
     		}
     	    }
     	    else {
    -		while (1) {
    +		for (;;) {
     		    if (is_token((int) *cp) > 0) {
     			cp++;
     		    }
    diff -urN apache_1.3.20/src/modules/standard/mod_mime_magic.c-orig apache_1.3.20/src/modules/standard/mod_mime_magic.c
    --- apache_1.3.20/src/modules/standard/mod_mime_magic.c-orig	Mon Jan 15 12:05:46 2001
    +++ apache_1.3.20/src/modules/standard/mod_mime_magic.c	Sat Jun 30 23:53:26 2001
    @@ -163,9 +163,9 @@
         short cont_level;		/* level of ">" */
         struct {
     	char type;		/* byte short long */
    -	long offset;		/* offset from indirection */
    +	ap_int32 offset;	/* offset from indirection */
         } in;
    -    long offset;		/* offset to magic number */
    +    ap_int32 offset;		/* offset to magic number */
         unsigned char reln;		/* relation (0=eq, '>'=gt, etc) */
         char type;			/* int, short, long or string. */
         char vallen;		/* length of string value, if any */
    @@ -183,12 +183,12 @@
         union VALUETYPE {
     	unsigned char b;
     	unsigned short h;
    -	unsigned long l;
    +	ap_uint32 l;
     	char s[MAXstring];
     	unsigned char hs[2];	/* 2 bytes of a fixed-endian "short" */
     	unsigned char hl[4];	/* 2 bytes of a fixed-endian "long" */
         } value;			/* either number or string */
    -    unsigned long mask;		/* mask before comparison with value */
    +    ap_uint32 mask;		/* mask before comparison with value */
         char nospflag;		/* supress space character */
     
         /* NOTE: this string is suspected of overrunning - find it! */
    @@ -259,7 +259,7 @@
     
     static int uncompress(request_rec *, int, 
     		      unsigned char **, int);
    -static long from_oct(int, char *);
    +static ap_int32 from_oct(int, char *);
     static int fsmagic(request_rec *r, const char *fn);
     
     /*
    @@ -499,6 +499,7 @@
     
     module mime_magic_module;
     
    +/*ARGSUSED1*/
     static void *create_magic_server_config(pool *p, server_rec *d)
     {
         /* allocate the config - use pcalloc because it needs to be zeroed */
    @@ -518,6 +519,7 @@
         return new;
     }
     
    +/*ARGSUSED1*/
     static const char *set_magicfile(cmd_parms *cmd, char *d, char *arg)
     {
         magic_server_config_rec *conf = (magic_server_config_rec *)
    @@ -611,6 +613,7 @@
     }
     
     /* RSL hook for printf-type functions */
    +/*PRINTFLIKE2*/
     static int magic_rsl_printf(request_rec *r, char *str,...)
     {
         va_list ap;
    @@ -878,7 +881,7 @@
         /*
          * try looking at the first HOWMANY bytes
          */
    -    if ((nbytes = read(fd, (char *) buf, sizeof(buf) - 1)) == -1) {
    +    if ((nbytes = (int) read(fd, (char *) buf, sizeof(buf) - 1)) == -1) {
     	ap_log_rerror(APLOG_MARK, APLOG_ERR, r,
     		    MODNAME ": read failed: %s", r->filename);
     	return HTTP_INTERNAL_SERVER_ERROR;
    @@ -1012,17 +1015,17 @@
         ap_log_error(APLOG_MARK, APLOG_NOERRNO | APLOG_DEBUG, s,
     		MODNAME ": apprentice test");
         for (m = conf->magic; m; m = m->next) {
    -	if (ap_isprint((((unsigned long) m) >> 24) & 255) &&
    -	    ap_isprint((((unsigned long) m) >> 16) & 255) &&
    -	    ap_isprint((((unsigned long) m) >> 8) & 255) &&
    -	    ap_isprint(((unsigned long) m) & 255)) {
    +	if (ap_isprint((((ap_uint32) m) >> 24) & 255) &&
    +	    ap_isprint((((ap_uint32) m) >> 16) & 255) &&
    +	    ap_isprint((((ap_uint32) m) >> 8) & 255) &&
    +	    ap_isprint(((ap_uint32) m) & 255)) {
     	    ap_log_error(APLOG_MARK, APLOG_NOERRNO | APLOG_DEBUG, s,
     			MODNAME ": apprentice: POINTER CLOBBERED! "
     			"m=\"%c%c%c%c\" line=%d",
    -			(((unsigned long) m) >> 24) & 255,
    -			(((unsigned long) m) >> 16) & 255,
    -			(((unsigned long) m) >> 8) & 255,
    -			((unsigned long) m) & 255,
    +			(((ap_uint32) m) >> 24) & 255,
    +			(((ap_uint32) m) >> 16) & 255,
    +			(((ap_uint32) m) >> 8) & 255,
    +			((ap_uint32) m) & 255,
     			prevm ? prevm->lineno : -1);
     	    break;
     	}
    @@ -1036,7 +1039,7 @@
     /*
      * extend the sign bit if the comparison is to be signed
      */
    -static unsigned long signextend(server_rec *s, struct magic *m, unsigned long v)
    +static ap_uint32 signextend(server_rec *s, struct magic *m, ap_uint32 v)
     {
         if (!(m->flag & UNSIGNED))
     	switch (m->type) {
    @@ -1058,7 +1061,7 @@
     	case LONG:
     	case BELONG:
     	case LELONG:
    -	    v = (long) v;
    +	    v = (ap_int32) v;
     	    break;
     	case STRING:
     	    break;
    @@ -1144,7 +1147,7 @@
     	if (*l == '+' || *l == '-')
     	    l++;
     	if (ap_isdigit((unsigned char) *l)) {
    -	    m->in.offset = strtol(l, &t, 0);
    +	    m->in.offset = (ap_int32) strtol(l, &t, 0);
     	    if (*s == '-')
     		m->in.offset = -m->in.offset;
     	}
    @@ -1232,10 +1235,10 @@
         /* New-style anding: "0 byte&0x80 =0x80 dynamically linked" */
         if (*l == '&') {
     	++l;
    -	m->mask = signextend(serv, m, strtol(l, &l, 0));
    +	m->mask = signextend(serv, m, (ap_uint32) strtol(l, &l, 0));
         }
         else
    -	m->mask = ~0L;
    +	m->mask = ~0;
         EATAB;
     
         switch (*l) {
    @@ -1310,7 +1313,7 @@
     	m->vallen = slen;
         }
         else if (m->reln != 'x')
    -	m->value.l = signextend(s, m, strtol(*p, p, 0));
    +	m->value.l = signextend(s, m, (ap_uint32) strtol(*p, p, 0));
         return 0;
     }
     
    @@ -1423,7 +1426,7 @@
         }
       out:
         *p = '\0';
    -    *slen = p - origp;
    +    *slen = (int) (p - origp);
         return s;
     }
     
    @@ -1574,17 +1577,17 @@
     
     #if MIME_MAGIC_DEBUG
         for (m = conf->magic; m; m = m->next) {
    -	if (ap_isprint((((unsigned long) m) >> 24) & 255) &&
    -	    ap_isprint((((unsigned long) m) >> 16) & 255) &&
    -	    ap_isprint((((unsigned long) m) >> 8) & 255) &&
    -	    ap_isprint(((unsigned long) m) & 255)) {
    +	if (ap_isprint((((ap_uint32) m) >> 24) & 255) &&
    +	    ap_isprint((((ap_uint32) m) >> 16) & 255) &&
    +	    ap_isprint((((ap_uint32) m) >> 8) & 255) &&
    +	    ap_isprint(((ap_uint32) m) & 255)) {
     	    ap_log_rerror(APLOG_MARK, APLOG_NOERRNO | APLOG_DEBUG, r,
     			MODNAME ": match: POINTER CLOBBERED! "
     			"m=\"%c%c%c%c\"",
    -			(((unsigned long) m) >> 24) & 255,
    -			(((unsigned long) m) >> 16) & 255,
    -			(((unsigned long) m) >> 8) & 255,
    -			((unsigned long) m) & 255);
    +			(((ap_uint32) m) >> 24) & 255,
    +			(((ap_uint32) m) >> 16) & 255,
    +			(((ap_uint32) m) >> 8) & 255,
    +			((ap_uint32) m) & 255);
     	    break;
     	}
         }
    @@ -1715,7 +1718,7 @@
     static void mprint(request_rec *r, union VALUETYPE *p, struct magic *m)
     {
         char *pp, *rt;
    -    unsigned long v;
    +    ap_uint32 v;
     
         switch (m->type) {
         case BYTE:
    @@ -1760,7 +1763,7 @@
         }
     
         v = signextend(r->server, m, v) & m->mask;
    -    (void) magic_rsl_printf(r, m->desc, (unsigned long) v);
    +    (void) magic_rsl_printf(r, m->desc, (ap_uint32) v);
     }
     
     /*
    @@ -1787,7 +1790,7 @@
     	return 1;
         case BELONG:
         case BEDATE:
    -	p->l = (long)
    +	p->l = (ap_int32)
     	    ((p->hl[0] << 24) | (p->hl[1] << 16) | (p->hl[2] << 8) | (p->hl[3]));
     	return 1;
         case LESHORT:
    @@ -1795,7 +1798,7 @@
     	return 1;
         case LELONG:
         case LEDATE:
    -	p->l = (long)
    +	p->l = (ap_int32)
     	    ((p->hl[3] << 24) | (p->hl[2] << 16) | (p->hl[1] << 8) | (p->hl[0]));
     	return 1;
         default:
    @@ -1809,7 +1812,7 @@
     static int mget(request_rec *r, union VALUETYPE *p, unsigned char *s,
     		struct magic *m, int nbytes)
     {
    -    long offset = m->offset;
    +    ap_int32 offset = m->offset;
     
         if (offset + sizeof(union VALUETYPE) > nbytes)
     	          return 0;
    @@ -1846,8 +1849,8 @@
     
     static int mcheck(request_rec *r, union VALUETYPE *p, struct magic *m)
     {
    -    register unsigned long l = m->value.l;
    -    register unsigned long v;
    +    register ap_uint32 l = m->value.l;
    +    register ap_uint32 v;
         int matched;
     
         if ((m->value.s[0] == 'x') && (m->value.s[1] == '\0')) {
    @@ -1907,7 +1910,7 @@
         case 'x':
     #if MIME_MAGIC_DEBUG
     	ap_log_rerror(APLOG_MARK, APLOG_NOERRNO | APLOG_DEBUG, r,
    -		    "%lu == *any* = 1", v);
    +		    "%lu == *any* = 1", (unsigned long) v);
     #endif
     	matched = 1;
     	break;
    @@ -1916,7 +1919,7 @@
     	matched = v != l;
     #if MIME_MAGIC_DEBUG
     	ap_log_rerror(APLOG_MARK, APLOG_NOERRNO | APLOG_DEBUG, r,
    -		    "%lu != %lu = %d", v, l, matched);
    +		    "%lu != %lu = %d", (unsigned long) v, (unsigned long) l, matched);
     #endif
     	break;
     
    @@ -1924,7 +1927,7 @@
     	matched = v == l;
     #if MIME_MAGIC_DEBUG
     	ap_log_rerror(APLOG_MARK, APLOG_NOERRNO | APLOG_DEBUG, r,
    -		    "%lu == %lu = %d", v, l, matched);
    +		    "%lu == %lu = %d", (unsigned long) v, (unsigned long) l, matched);
     #endif
     	break;
     
    @@ -1933,14 +1936,14 @@
     	    matched = v > l;
     #if MIME_MAGIC_DEBUG
     	    ap_log_rerror(APLOG_MARK, APLOG_NOERRNO | APLOG_DEBUG, r,
    -			"%lu > %lu = %d", v, l, matched);
    +			"%lu > %lu = %d", (unsigned long) v, (unsigned long) l, matched);
     #endif
     	}
     	else {
    -	    matched = (long) v > (long) l;
    +	    matched = (ap_int32) v > (ap_int32) l;
     #if MIME_MAGIC_DEBUG
     	    ap_log_rerror(APLOG_MARK, APLOG_NOERRNO | APLOG_DEBUG, r,
    -			"%ld > %ld = %d", v, l, matched);
    +			"%ld > %ld = %d", (long) v, (long) l, matched);
     #endif
     	}
     	break;
    @@ -1950,14 +1953,14 @@
     	    matched = v < l;
     #if MIME_MAGIC_DEBUG
     	    ap_log_rerror(APLOG_MARK, APLOG_NOERRNO | APLOG_DEBUG, r,
    -			"%lu < %lu = %d", v, l, matched);
    +			"%lu < %lu = %d", (unsigned long) v, (unsigned long) l, matched);
     #endif
     	}
     	else {
    -	    matched = (long) v < (long) l;
    +	    matched = (ap_int32) v < (ap_int32) l;
     #if MIME_MAGIC_DEBUG
     	    ap_log_rerror(APLOG_MARK, APLOG_NOERRNO | APLOG_DEBUG, r,
    -			"%ld < %ld = %d", v, l, matched);
    +			"%ld < %ld = %d", (long) v, (long) l, matched);
     #endif
     	}
     	break;
    @@ -1966,7 +1969,7 @@
     	matched = (v & l) == l;
     #if MIME_MAGIC_DEBUG
     	ap_log_rerror(APLOG_MARK, APLOG_NOERRNO | APLOG_DEBUG, r,
    -		    "((%lx & %lx) == %lx) = %d", v, l, l, matched);
    +		    "((%lx & %lx) == %lx) = %d", (unsigned long) v, (unsigned long) l, (unsigned long) l, matched);
     #endif
     	break;
     
    @@ -1974,7 +1977,7 @@
     	matched = (v & l) != l;
     #if MIME_MAGIC_DEBUG
     	ap_log_rerror(APLOG_MARK, APLOG_NOERRNO | APLOG_DEBUG, r,
    -		    "((%lx & %lx) != %lx) = %d", v, l, l, matched);
    +		    "((%lx & %lx) != %lx) = %d", (unsigned long) v, (unsigned long) l, (unsigned long) l, matched);
     #endif
     	break;
     
    @@ -2143,6 +2146,7 @@
         int method;
     };
     
    +/*ARGSUSED1*/
     static int uncompress_child(void *data, child_info *pinfo)
     {
         struct uncompress_parms *parm = data;
    @@ -2233,7 +2237,7 @@
     {
         register union record *header = (union record *) buf;
         register int i;
    -    register long sum, recsum;
    +    register ap_int32 sum, recsum;
         register char *p;
     
         if (nbytes < sizeof(union record))
    @@ -2270,9 +2274,9 @@
      *
      * Result is -1 if the field is invalid (all blank, or nonoctal).
      */
    -static long from_oct(int digs, char *where)
    +static ap_int32 from_oct(int digs, char *where)
     {
    -    register long value;
    +    register ap_int32 value;
     
         while (ap_isspace(*where)) {	/* Skip spaces */
     	where++;
    @@ -2313,7 +2317,7 @@
     #endif /* MIME_MAGIC_DEBUG */
     
         /* check for recognized revision suffix */
    -    suffix_pos = strlen(r->filename) - 1;
    +    suffix_pos = ap_strlen(r->filename) - 1;
         if (!ap_isdigit(r->filename[suffix_pos])) {
     	return 0;
         }
    @@ -2385,17 +2389,17 @@
     	    ap_log_error(APLOG_MARK, APLOG_NOERRNO | APLOG_DEBUG, s,
     			MODNAME ": magic_init 1 test");
     	    for (m = conf->magic; m; m = m->next) {
    -		if (ap_isprint((((unsigned long) m) >> 24) & 255) &&
    -		    ap_isprint((((unsigned long) m) >> 16) & 255) &&
    -		    ap_isprint((((unsigned long) m) >> 8) & 255) &&
    -		    ap_isprint(((unsigned long) m) & 255)) {
    +		if (ap_isprint((((ap_uint32) m) >> 24) & 255) &&
    +		    ap_isprint((((ap_uint32) m) >> 16) & 255) &&
    +		    ap_isprint((((ap_uint32) m) >> 8) & 255) &&
    +		    ap_isprint(((ap_uint32) m) & 255)) {
     		    ap_log_error(APLOG_MARK, APLOG_NOERRNO | APLOG_DEBUG, s,
     				MODNAME ": magic_init 1: POINTER CLOBBERED! "
     				"m=\"%c%c%c%c\" line=%d",
    -				(((unsigned long) m) >> 24) & 255,
    -				(((unsigned long) m) >> 16) & 255,
    -				(((unsigned long) m) >> 8) & 255,
    -				((unsigned long) m) & 255,
    +				(((ap_uint32) m) >> 24) & 255,
    +				(((ap_uint32) m) >> 16) & 255,
    +				(((ap_uint32) m) >> 8) & 255,
    +				((ap_uint32) m) & 255,
     				prevm ? prevm->lineno : -1);
     		    break;
     		}
    diff -urN apache_1.3.20/src/modules/standard/mod_negotiation.c-orig apache_1.3.20/src/modules/standard/mod_negotiation.c
    --- apache_1.3.20/src/modules/standard/mod_negotiation.c-orig	Mon Feb 12 05:18:04 2001
    +++ apache_1.3.20/src/modules/standard/mod_negotiation.c	Sat Jun 30 23:53:26 2001
    @@ -81,6 +81,7 @@
     
     module MODULE_VAR_EXPORT negotiation_module;
     
    +/*ARGSUSED1*/
     static void *create_neg_dir_config(pool *p, char *dummy)
     {
         neg_dir_config *new = (neg_dir_config *) ap_palloc(p, sizeof(neg_dir_config));
    @@ -101,6 +102,7 @@
         return new;
     }
     
    +/*ARGSUSED*/
     static const char *set_language_priority(cmd_parms *cmd, void *n, char *lang)
     {
         array_header *arr = ((neg_dir_config *) n)->language_priority;
    @@ -110,6 +112,7 @@
         return NULL;
     }
     
    +/*ARGSUSED1*/
     static const char *cache_negotiated_docs(cmd_parms *cmd, void *dummy,
                                              char *dummy2)
     {
    @@ -908,7 +911,7 @@
         }
     
         ++filp;
    -    prefix_len = strlen(filp);
    +    prefix_len = ap_strlen(filp);
     
         dirp = ap_popendir(neg->pool, neg->dir_name);
     
    @@ -1043,7 +1046,7 @@
     {
         char *accept_type = accept_r->name;
         char *avail_type = avail->mime_type;
    -    int len = strlen(accept_type);
    +    int len = ap_strlen(accept_type);
     
         if (accept_type[0] == '*') {        /* Anything matches star/star */
             if (avail->mime_stars < 1) {
    @@ -1352,7 +1355,7 @@
                          * if it is longer than the previous best match.
                          */
                         
    -                    alen = strlen(accs[i].name);
    +                    alen = ap_strlen(accs[i].name);
                         
                         if ((strlen(lang) >= alen) &&
                             !strncmp(lang, accs[i].name, alen) &&
    @@ -1382,7 +1385,7 @@
                              * fiddle does not handle multi-level prefixes.
                              */
                             if ((p = strchr(accs[i].name, '-'))) {
    -                            int plen = p - accs[i].name;
    +                            size_t plen = p - accs[i].name;
     
                                 if (!strncmp(lang, accs[i].name, plen)) {
                                     fiddle_q = 0.001f;
    @@ -1745,6 +1748,7 @@
      * v1.0) from rfc2296.  This is the algorithm that goes together with
      * transparent content negotiation (TCN).
      */
    +/*ARGSUSED*/
     static int is_variant_better_rvsa(negotiation_state *neg, var_rec *variant,
                                       var_rec *best, float *p_bestq)
     {
    diff -urN apache_1.3.20/src/modules/standard/mod_rewrite.c-orig apache_1.3.20/src/modules/standard/mod_rewrite.c
    --- apache_1.3.20/src/modules/standard/mod_rewrite.c-orig	Sun May  6 17:00:02 2001
    +++ apache_1.3.20/src/modules/standard/mod_rewrite.c	Sun Jul  1 00:01:15 2001
    @@ -423,6 +423,7 @@
         return NULL;
     }
     
    +/*ARGSUSED1*/
     static const char *cmd_rewritelog(cmd_parms *cmd, void *dconf, char *a1)
     {
         rewrite_server_conf *sconf;
    @@ -435,6 +436,7 @@
         return NULL;
     }
     
    +/*ARGSUSED1*/
     static const char *cmd_rewriteloglevel(cmd_parms *cmd, void *dconf, char *a1)
     {
         rewrite_server_conf *sconf;
    @@ -447,6 +449,7 @@
         return NULL;
     }
     
    +/*ARGSUSED1*/
     static const char *cmd_rewritemap(cmd_parms *cmd, void *dconf, char *a1,
                                       char *a2)
     {
    @@ -525,6 +528,7 @@
         return NULL;
     }
     
    +/*ARGSUSED1*/
     static const char *cmd_rewritelock(cmd_parms *cmd, void *dconf, char *a1)
     {
         const char *error;
    @@ -681,6 +685,7 @@
         return NULL;
     }
     
    +/*ARGSUSED3*/
     static const char *cmd_rewritecond_setflag(pool *p, rewritecond_entry *cfg,
                                                char *key, char *val)
     {
    @@ -1247,7 +1252,7 @@
                 n = prefix_stat(r->filename, &finfo);
                 if (n == 0) {
                     if ((ccp = ap_document_root(r)) != NULL) {
    -                    l = ap_cpystrn(docroot, ccp, sizeof(docroot)) - docroot;
    +                    l = (int) (ap_cpystrn(docroot, ccp, sizeof(docroot)) - docroot);
     
                         /* always NOT have a trailing slash */
                         if (docroot[l-1] == '/') {
    @@ -1322,7 +1327,11 @@
         char *cp2;
         const char *ccp;
         char *prefix;
    +#if 0
         int l;
    +#else 
    +	size_t l;
    +#endif
         int rulestatus;
         int n;
         char *ofilename;
    @@ -2105,6 +2114,7 @@
         return 1;
     }
     
    +/*ARGSUSED2*/
     static int apply_rewrite_cond(request_rec *r, rewritecond_entry *p,
                                   char *perdir, backrefinfo *briRR,
                                   backrefinfo *briRC)
    @@ -2471,7 +2481,7 @@
         char host[LONG_STRING_LEN];
         char buf[MAX_STRING_LEN];
         char *olduri;
    -    int l;
    +    size_t l;
     
         cp = ap_http_method(r);
         l  = strlen(cp);
    @@ -2583,7 +2593,7 @@
     
     static int is_absolute_uri(char *uri)
     {
    -    int i = strlen(uri);
    +    int i = ap_strlen(uri);
         if (   (i > 7 && strncasecmp(uri, "http://",   7) == 0)
             || (i > 8 && strncasecmp(uri, "https://",  8) == 0)
             || (i > 9 && strncasecmp(uri, "gopher://", 9) == 0)
    @@ -3112,6 +3122,7 @@
         return;
     }
     
    +/*PRINTFLIKE3*/
     static void rewritelog(request_rec *r, int level, const char *text, ...)
     {
         rewrite_server_conf *conf;
    @@ -3282,6 +3293,7 @@
         return;
     }
     
    +/*ARGSUSED*/
     static void rewritelock_remove(void *data)
     {
         /* only operate if a lockfile is used */
    @@ -3373,6 +3385,7 @@
     }
     
     /* child process code */
    +/*ARGSUSED1*/
     static int rewritemap_program_child(void *cmd, child_info *pinfo)
     {
         int child_pid = 1;
    @@ -3728,6 +3741,7 @@
         return c;
     }
     
    +/*ARGSUSED2*/
     static void set_cache_string(cache *c, char *res, int mode, time_t t,
                                  char *key, char *value)
     {
    @@ -3764,12 +3778,12 @@
     
     static int cache_tlb_hash(char *key)
     {
    -    unsigned long n;
    +    ap_uint32 n;
         char *p;
     
         n = 0;
         for (p = key; *p != '\0'; p++) {
    -        n = ((n << 5) + n) ^ (unsigned long)(*p++);
    +        n = ((n << 5) + n) ^ (ap_uint32)(*p++);
         }
     
         return (int)(n % CACHE_TLB_ROWS);
    @@ -3803,7 +3817,7 @@
         for (i=1; i < CACHE_TLB_COLS; ++i)
             tlb->t[i] = tlb->t[i-1];
     
    -    tlb->t[0] = e - elt;
    +    tlb->t[0] = (int) (e - elt);
     }
     
     static void store_cache_string(cache *c, char *res, cacheentry *ce)
    @@ -3919,7 +3933,7 @@
         char matchbuf[LONG_STRING_LEN];
         char substbuf[LONG_STRING_LEN];
         char *output;
    -    int l;
    +    size_t l;
     
         output = input;
     
    @@ -4042,7 +4056,7 @@
         char var[MAX_STRING_LEN];
         char val[MAX_STRING_LEN];
         char *cp;
    -    int n;
    +    size_t n;
     
         if ((cp = strchr(s, ':')) != NULL) {
             n = ((cp-s) > MAX_STRING_LEN-1 ? MAX_STRING_LEN-1 : (cp-s));
    @@ -4186,8 +4200,8 @@
     
     static int compare_lexicography(char *cpNum1, char *cpNum2)
     {
    -    int i;
    -    int n1, n2;
    +    size_t i;
    +    size_t n1, n2;
     
         n1 = strlen(cpNum1);
         n2 = strlen(cpNum2);
    diff -urN apache_1.3.20/src/modules/standard/mod_rewrite.h-orig apache_1.3.20/src/modules/standard/mod_rewrite.h
    --- apache_1.3.20/src/modules/standard/mod_rewrite.h-orig	Sun May  6 17:00:02 2001
    +++ apache_1.3.20/src/modules/standard/mod_rewrite.h	Sun Jul  1 01:05:56 2001
    @@ -130,7 +130,7 @@
          * so we also need to know the file extension
          */
     #ifndef NO_DBM_REWRITEMAP
    -#include 
    +#include 
     #if defined(DBM_SUFFIX)
     #define NDBM_FILE_SUFFIX DBM_SUFFIX
     #elif defined(__FreeBSD__) || (defined(DB_LOCK) && defined(DB_SHMEM))
    @@ -354,7 +354,7 @@
          */
     typedef struct backrefinfo {
         char *source;
    -    int nsub;
    +    size_t nsub;
         regmatch_t regmatch[10];
     } backrefinfo;
     
    @@ -453,6 +453,7 @@
     
         /* rewriting logfile support */
     static void  open_rewritelog(server_rec *s, pool *p);
    +/*PRINTFLIKE3*/
     static void  rewritelog(request_rec *r, int level, const char *text, ...)
                             __attribute__((format(printf,3,4)));
     static char *current_logtime(request_rec *r);
    diff -urN apache_1.3.20/src/modules/standard/mod_setenvif.c-orig apache_1.3.20/src/modules/standard/mod_setenvif.c
    --- apache_1.3.20/src/modules/standard/mod_setenvif.c-orig	Mon Jan 15 12:05:48 2001
    +++ apache_1.3.20/src/modules/standard/mod_setenvif.c	Sat Jun 30 23:53:26 2001
    @@ -163,11 +163,13 @@
         return (void *) new;
     }
     
    +/*ARGSUSED1*/
     static void *create_setenvif_config_svr(pool *p, server_rec *dummy)
     {
         return create_setenvif_config(p);
     }
     
    +/*ARGSUSED1*/
     static void *create_setenvif_config_dir(pool *p, char *dummy)
     {
         return create_setenvif_config(p);
    @@ -190,6 +192,7 @@
     #define ICASE_MAGIC	((void *)(&setenvif_module))
     #define SEI_MAGIC_HEIRLOOM "setenvif-phase-flag"
     
    +/*ARGSUSED1*/
     static const char *add_setenvif_core(cmd_parms *cmd, void *mconfig,
     				     char *fname, const char *args)
     {
    diff -urN apache_1.3.20/src/modules/standard/mod_so.c-orig apache_1.3.20/src/modules/standard/mod_so.c
    --- apache_1.3.20/src/modules/standard/mod_so.c-orig	Mon Feb 26 22:59:53 2001
    +++ apache_1.3.20/src/modules/standard/mod_so.c	Sat Jun 30 23:53:26 2001
    @@ -148,6 +148,7 @@
         array_header *loaded_modules;
     } so_server_conf;
     
    +/*ARGSUSED1*/
     static void *so_sconf_create(pool *p, server_rec *s)
     {
         so_server_conf *soc;
    @@ -206,6 +207,7 @@
      * a shared object file into the address space of the server process.
      */
     
    +/*ARGSUSED1*/
     static const char *load_module(cmd_parms *cmd, void *dummy, 
                                    char *modname, char *filename)
     {
    @@ -298,6 +300,7 @@
      * shared object file into the adress space of the server process.
      */
     
    +/*ARGSUSED1*/
     static const char *load_file(cmd_parms *cmd, void *dummy, char *filename)
     {
         ap_os_dso_handle_t handle;
    diff -urN apache_1.3.20/src/modules/standard/mod_speling.c-orig apache_1.3.20/src/modules/standard/mod_speling.c
    --- apache_1.3.20/src/modules/standard/mod_speling.c-orig	Mon Jan 15 12:05:49 2001
    +++ apache_1.3.20/src/modules/standard/mod_speling.c	Sat Jun 30 23:53:26 2001
    @@ -111,6 +111,7 @@
      * Respond to a callback to create configuration record for a server or
      * vhost environment.
      */
    +/*ARGSUSED1*/
     static void *create_mconfig_for_server(pool *p, server_rec *s)
     {
         return mkconfig(p);
    @@ -119,6 +120,7 @@
     /*
      * Respond to a callback to create a config record for a specific directory.
      */
    +/*ARGSUSED1*/
     static void *create_mconfig_for_directory(pool *p, char *dir)
     {
         return mkconfig(p);
    @@ -127,6 +129,7 @@
     /*
      * Handler for the CheckSpelling directive, which is FLAG.
      */
    +/*ARGSUSED*/
     static const char *set_speling(cmd_parms *cmd, void *mconfig, int arg)
     {
         spconfig *cfg = (spconfig *) mconfig;
    @@ -278,8 +281,8 @@
         /* postgood = mispelling/more */
         postgood = ap_pstrcat(r->pool, bad, r->path_info, NULL);
     
    -    urlen = strlen(r->uri);
    -    pglen = strlen(postgood);
    +    urlen = ap_strlen(r->uri);
    +    pglen = ap_strlen(postgood);
     
         /* Check to see if the URL pieces add up */
         if (strcmp(postgood, r->uri + (urlen - pglen))) {
    @@ -299,7 +302,7 @@
     
         dotloc = ap_ind(bad, '.');
         if (dotloc == -1) {
    -        dotloc = strlen(bad);
    +        dotloc = ap_strlen(bad);
         }
     
         while ((dir_entry = readdir(dirp)) != NULL) {
    @@ -370,7 +373,7 @@
                  */
                 int entloc = ap_ind(dir_entry->d_name, '.');
                 if (entloc == -1) {
    -                entloc = strlen(dir_entry->d_name);
    +                entloc = ap_strlen(dir_entry->d_name);
     	    }
     
                 if ((dotloc == entloc)
    diff -urN apache_1.3.20/src/modules/standard/mod_status.c-orig apache_1.3.20/src/modules/standard/mod_status.c
    --- apache_1.3.20/src/modules/standard/mod_status.c-orig	Fri Mar  9 05:10:35 2001
    +++ apache_1.3.20/src/modules/standard/mod_status.c	Sat Jun 30 23:53:26 2001
    @@ -75,6 +75,9 @@
      * /server-status?refresh - Returns page with 1 second refresh
      * /server-status?refresh=6 - Returns page with refresh every 6 seconds
      * /server-status?auto - Returns page with data for automatic parsing
    +#ifdef USE_QSC
    + * /server-status?qsc=... - Returns page with extra QSC status info
    +#endif
      *
      * Mark Cox, mark@ukweb.com, November 1995
      *
    @@ -136,6 +139,7 @@
      *command-related code. This is here to prevent use of ExtendedStatus
      * without status_module included.
      */
    +/*ARGSUSED1*/
     static const char *set_extended_status(cmd_parms *cmd, void *dummy, int arg) 
     {
         const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY);
    @@ -204,6 +208,7 @@
     #define STAT_OPT_REFRESH	0
     #define STAT_OPT_NOTABLE	1
     #define STAT_OPT_AUTO		2
    +#define STAT_OPT_QSC		3
     
     struct stat_opt {
         int id;
    @@ -216,6 +221,9 @@
         {STAT_OPT_REFRESH, "refresh", "Refresh"},
         {STAT_OPT_NOTABLE, "notable", NULL},
         {STAT_OPT_AUTO, "auto", NULL},
    +#ifdef USE_QSC
    +    {STAT_OPT_QSC, "qsc", NULL},
    +#endif
         {STAT_OPT_END, NULL, NULL}
     };
     
    @@ -238,7 +246,7 @@
         long req_time;
     #ifndef NO_TIMES
     #ifdef _SC_CLK_TCK
    -    float tick = sysconf(_SC_CLK_TCK);
    +    float tick = (float) sysconf(_SC_CLK_TCK);
     #else
         float tick = HZ;
     #endif
    @@ -249,8 +257,15 @@
         parent_score ps_record;
         char stat_buffer[HARD_SERVER_LIMIT];
         int pid_buffer[HARD_SERVER_LIMIT];
    +#ifdef SINGLE_LISTEN_UNSERIALIZED_ACCEPT
    +    int cpu_buffer[HARD_SERVER_LIMIT];
    +    struct sockaddr_in addr_buffer[HARD_SERVER_LIMIT];
    +#endif
         clock_t tu, ts, tcu, tcs;
         server_rec *vhost;
    +#ifdef USE_QSC
    +    const char *qscp = NULL;
    +#endif
     
         tu = ts = tcu = tcs = 0;
     
    @@ -280,7 +295,7 @@
                                         + 1) > 0)
     			ap_table_set(r->headers_out,
     			      status_options[i].hdr_out_str,
    -			      loc + strlen(status_options[i].hdr_out_str) + 1);
    +			      loc + strlen(status_options[i].form_data_str) + 1);
     		    else
     			ap_table_set(r->headers_out,
     			      status_options[i].hdr_out_str, "1");
    @@ -292,6 +307,12 @@
     		    r->content_type = "text/plain";
     		    short_report = 1;
     		    break;
    +#ifdef USE_QSC
    +		case STAT_OPT_QSC:
    +		    if (loc[strlen(status_options[i].form_data_str)] == '=')
    +			qscp = &loc[strlen(status_options[i].form_data_str) + 1];
    +		    break;
    +#endif
     		}
     	    }
     	    i++;
    @@ -314,6 +335,11 @@
     	res = score_record.status;
     	stat_buffer[i] = status_flags[res];
     	pid_buffer[i] = (int) ps_record.pid;
    +#ifdef SINGLE_LISTEN_UNSERIALIZED_ACCEPT
    +	cpu_buffer[i] = score_record.cpu;
    +	if (ap_single_listen)
    +	    addr_buffer[i] = score_record.single_addr;
    +#endif
     	if (res == SERVER_READY)
     	    ready++;
     	else if (res != SERVER_DEAD)
    @@ -372,7 +398,7 @@
     	    /* Allow for OS/2 not having CPU stats */
     	    if (ts || tu || tcu || tcs)
     		ap_rprintf(r, "CPULoad: %g\n",
    -		    (tu + ts + tcu + tcs) / tick / up_time * 100.);
    +		    (float) (tu + ts + tcu + tcs) / tick / (float) up_time * 100.);
     #endif
     
     	    ap_rprintf(r, "Uptime: %ld\n", (long) (up_time));
    @@ -396,11 +422,12 @@
     	    /* Allow for OS/2 not having CPU stats */
     	    ap_rputs("
    \n", r); ap_rprintf(r, "CPU Usage: u%g s%g cu%g cs%g", - tu / tick, ts / tick, tcu / tick, tcs / tick); + (float) tu / tick, (float) ts / tick, + (float) tcu / tick, (float) tcs / tick); if (ts || tu || tcu || tcs) ap_rprintf(r, " - %.3g%% CPU load", - (tu + ts + tcu + tcs) / tick / up_time * 100.); + (float) (tu + ts + tcu + tcs) / tick / (float) up_time * 100.); #endif ap_rputs("
    \n", r); @@ -410,12 +437,12 @@ (float) count / (float) up_time); if (up_time > 0) { - format_byte_out(r, KBYTE * (float) kbcount / (float) up_time); + format_byte_out(r, (unsigned long) (KBYTE * (float) kbcount / (float) up_time)); ap_rputs("/second - ", r); } if (count > 0) { - format_byte_out(r, KBYTE * (float) kbcount / (float) count); + format_byte_out(r, (unsigned long) (KBYTE * (float) kbcount / (float) count)); ap_rputs("/request", r); } @@ -463,6 +490,26 @@ ap_rputs("
    \n", r);
     	    for (i = 0; i < HARD_SERVER_LIMIT; ++i) {
     		if (stat_buffer[i] != '.') {
    +#ifdef SINGLE_LISTEN_UNSERIALIZED_ACCEPT
    +		    char slbuf[32];
    +
    +		    if (cpu_buffer[i] >= 0)
    +			ap_snprintf(slbuf, sizeof slbuf, "cpu %d", cpu_buffer[i]);
    +		    else
    +			strcpy(slbuf, "any cpu");
    +		    ap_rprintf(r, "   %d in state: %c on %s", pid_buffer[i],
    +		     stat_buffer[i], slbuf);
    +		    if (ap_single_listen)
    +			ap_rprintf(r, " listening to %s:%hu\n",
    +			    (addr_buffer[i].sin_addr.s_addr == htonl(INADDR_ANY)) ?
    +			    "*" : ap_inet_ntoa(addr_buffer[i].sin_addr, slbuf, NULL),
    +			    ntohs(addr_buffer[i].sin_port));
    +		    else if (++j >= 2) {
    +		    	ap_rputs("\n", r);
    +			j = 0;
    +		    } else
    +		    	ap_rputs(",", r);
    +#else
     		    ap_rprintf(r, "   %d in state: %c ", pid_buffer[i],
     		     stat_buffer[i]);
     		    if (++j >= 3) {
    @@ -470,6 +517,7 @@
     			j = 0;
     		    } else
     		    	ap_rputs(",", r);
    +#endif
     		}
     	    }
     	    ap_rputs("\n", r);
    @@ -502,7 +550,7 @@
     #ifndef NO_TIMES
     	    if (score_record.start_time == (clock_t) 0)
     #endif /* NO_TIMES */
    -		req_time = 0L;
    +		req_time = 0;
     #ifndef NO_TIMES
     	    else {
     		req_time = score_record.stop_time - score_record.start_time;
    @@ -510,16 +558,16 @@
     	    }
     #endif /* NO_TIMES */
     #else
    -	    if (score_record.start_time.tv_sec == 0L &&
    -		score_record.start_time.tv_usec == 0L)
    -		req_time = 0L;
    +	    if (score_record.start_time.tv_sec == 0 &&
    +		score_record.start_time.tv_usec == 0)
    +		req_time = 0;
     	    else
     		req_time =
     		    ((score_record.stop_time.tv_sec - score_record.start_time.tv_sec) * 1000) +
     		    ((score_record.stop_time.tv_usec - score_record.start_time.tv_usec) / 1000);
     #endif
    -	    if (req_time < 0L)
    -		req_time = 0L;
    +	    if (req_time < 0)
    +		req_time = 0;
     
     	    lres = score_record.access_count;
     	    my_lres = score_record.my_access_count;
    @@ -581,10 +629,10 @@
     #else
     
     			ap_rprintf(r, "] u%g s%g cu%g cs%g\n %.0f %ld (",
    -			    score_record.times.tms_utime / tick,
    -			    score_record.times.tms_stime / tick,
    -			    score_record.times.tms_cutime / tick,
    -			    score_record.times.tms_cstime / tick,
    +			    (float) score_record.times.tms_utime / tick,
    +			    (float) score_record.times.tms_stime / tick,
    +			    (float) score_record.times.tms_cutime / tick,
    +			    (float) score_record.times.tms_cstime / tick,
     #endif
     #ifdef OPTIMIZE_TIMEOUTS
     			    difftime(nowtime, ps_record.last_rtime),
    @@ -654,7 +702,7 @@
     			ap_rprintf(r, "\n%.0f%ld",
     #else
     			ap_rprintf(r, "\n%.2f%.0f%ld",
    -			    (score_record.times.tms_utime +
    +			    (float) (score_record.times.tms_utime +
     			     score_record.times.tms_stime +
     			     score_record.times.tms_cutime +
     			     score_record.times.tms_cstime) / tick,
    @@ -725,6 +773,11 @@
     
         }
     
    +#ifdef USE_QSC
    +    ap_rputs("
    ", r); + qsc_status(r, qscp); +#endif + if (!short_report) { ap_rputs(ap_psignature("
    \n",r), r); ap_rputs("\n", r); @@ -735,6 +788,7 @@ } +/*ARGSUSED0*/ static void status_init(server_rec *s, pool *p) { status_flags[SERVER_DEAD] = '.'; /* We don't want to assume these are in */ diff -urN apache_1.3.20/src/modules/standard/mod_unique_id.c-orig apache_1.3.20/src/modules/standard/mod_unique_id.c --- apache_1.3.20/src/modules/standard/mod_unique_id.c-orig Mon Jan 15 12:05:51 2001 +++ apache_1.3.20/src/modules/standard/mod_unique_id.c Sat Jun 30 23:53:26 2001 @@ -158,6 +158,7 @@ unique_id_rec_total_size, unique_id_rec_size_uu; +/*ARGSUSED1*/ static void unique_id_global_init(server_rec *s, pool *p) { #ifndef MAXHOSTNAMELEN @@ -172,13 +173,13 @@ /* * Calculate the sizes and offsets in cur_unique_id. */ - unique_id_rec_offset[0] = XtOffsetOf(unique_id_rec, stamp); + unique_id_rec_offset[0] = (unsigned short) XtOffsetOf(unique_id_rec, stamp); unique_id_rec_size[0] = sizeof(cur_unique_id.stamp); - unique_id_rec_offset[1] = XtOffsetOf(unique_id_rec, in_addr); + unique_id_rec_offset[1] = (unsigned short) XtOffsetOf(unique_id_rec, in_addr); unique_id_rec_size[1] = sizeof(cur_unique_id.in_addr); - unique_id_rec_offset[2] = XtOffsetOf(unique_id_rec, pid); + unique_id_rec_offset[2] = (unsigned short) XtOffsetOf(unique_id_rec, pid); unique_id_rec_size[2] = sizeof(cur_unique_id.pid); - unique_id_rec_offset[3] = XtOffsetOf(unique_id_rec, counter); + unique_id_rec_offset[3] = (unsigned short) XtOffsetOf(unique_id_rec, counter); unique_id_rec_size[3] = sizeof(cur_unique_id.counter); unique_id_rec_total_size = unique_id_rec_size[0] + unique_id_rec_size[1] + unique_id_rec_size[2] + unique_id_rec_size[3]; @@ -240,6 +241,7 @@ #endif } +/*ARGSUSED1*/ static void unique_id_child_init(server_rec *s, pool *p) { pid_t pid; @@ -285,7 +287,7 @@ /* Some systems have very low variance on the low end of their * system counter, defend against that. */ - cur_unique_id.counter = tv.tv_usec / 10; + cur_unique_id.counter = (unsigned short) (tv.tv_usec / 10); } #else cur_unique_id.counter = 0; diff -urN apache_1.3.20/src/modules/standard/mod_userdir.c-orig apache_1.3.20/src/modules/standard/mod_userdir.c --- apache_1.3.20/src/modules/standard/mod_userdir.c-orig Wed Feb 14 23:31:48 2001 +++ apache_1.3.20/src/modules/standard/mod_userdir.c Sat Jun 30 23:53:26 2001 @@ -109,6 +109,7 @@ * explicit) disablement, and the replacement string for all others. */ +/*ARGSUSED1*/ static void *create_userdir_config(pool *p, server_rec *s) { userdir_config @@ -125,6 +126,7 @@ #define O_ENABLE 1 #define O_DISABLE 2 +/*ARGSUSED1*/ static const char *set_user_dir(cmd_parms *cmd, void *dummy, char *arg) { userdir_config diff -urN apache_1.3.20/src/modules/standard/mod_usertrack.c-orig apache_1.3.20/src/modules/standard/mod_usertrack.c --- apache_1.3.20/src/modules/standard/mod_usertrack.c-orig Thu Feb 1 08:07:29 2001 +++ apache_1.3.20/src/modules/standard/mod_usertrack.c Sat Jun 30 23:53:26 2001 @@ -249,6 +249,7 @@ return OK; /* We set our cookie */ } +/*ARGSUSED1*/ static void *make_cookie_log_state(pool *p, server_rec *s) { cookie_log_state *cls = @@ -259,6 +260,7 @@ return (void *) cls; } +/*ARGSUSED1*/ static void *make_cookie_dir(pool *p, char *d) { cookie_dir_rec *dcfg; @@ -269,6 +271,7 @@ return dcfg; } +/*ARGSUSED*/ static const char *set_cookie_enable(cmd_parms *cmd, void *mconfig, int arg) { cookie_dir_rec *dcfg = mconfig; @@ -277,6 +280,7 @@ return NULL; } +/*ARGSUSED1*/ static const char *set_cookie_exp(cmd_parms *parms, void *dummy, const char *arg) { cookie_log_state *cls = ap_get_module_config(parms->server->module_config, @@ -287,7 +291,7 @@ /* The simple case first - all numbers (we assume) */ if (ap_isdigit(arg[0]) && ap_isdigit(arg[strlen(arg) - 1])) { - cls->expires = atol(arg); + cls->expires = (time_t) atol(arg); return NULL; } diff -urN apache_1.3.20/src/modules/standard/mod_vhost_alias.c-orig apache_1.3.20/src/modules/standard/mod_vhost_alias.c --- apache_1.3.20/src/modules/standard/mod_vhost_alias.c-orig Mon Jan 15 12:05:52 2001 +++ apache_1.3.20/src/modules/standard/mod_vhost_alias.c Sat Jun 30 23:53:26 2001 @@ -102,6 +102,7 @@ mva_mode_e cgi_root_mode; } mva_sconf_t; +/*ARGSUSED1*/ static void *mva_create_server_config(pool *p, server_rec *s) { mva_sconf_t *conf; @@ -150,6 +151,7 @@ vhost_alias_set_doc_root_name, vhost_alias_set_cgi_root_name; +/*ARGSUSED*/ static const char *vhost_alias_set(cmd_parms *cmd, void *dummy, char *map) { mva_sconf_t *conf; @@ -160,22 +162,22 @@ conf = (mva_sconf_t *) ap_get_module_config(cmd->server->module_config, &vhost_alias_module); /* there ought to be a better way of doing this */ - if (&vhost_alias_set_doc_root_ip == cmd->info) { + if ((void *) &vhost_alias_set_doc_root_ip == cmd->info) { mode = VHOST_ALIAS_IP; pmap = &conf->doc_root; pmode = &conf->doc_root_mode; } - else if (&vhost_alias_set_cgi_root_ip == cmd->info) { + else if ((void *) &vhost_alias_set_cgi_root_ip == cmd->info) { mode = VHOST_ALIAS_IP; pmap = &conf->cgi_root; pmode = &conf->cgi_root_mode; } - else if (&vhost_alias_set_doc_root_name == cmd->info) { + else if ((void *) &vhost_alias_set_doc_root_name == cmd->info) { mode = VHOST_ALIAS_NAME; pmap = &conf->doc_root; pmode = &conf->doc_root_mode; } - else if (&vhost_alias_set_cgi_root_name == cmd->info) { + else if ((void *) &vhost_alias_set_cgi_root_name == cmd->info) { mode = VHOST_ALIAS_NAME; pmap = &conf->cgi_root; pmode = &conf->cgi_root_mode; @@ -390,7 +392,7 @@ end = end-M+1; } } - vhost_alias_checkspace(r, buf, &dest, end - start); + vhost_alias_checkspace(r, buf, &dest, (int) (end - start)); for (p = start; p < end; ++p) { *dest++ = ap_tolower(*p); } diff -urN apache_1.3.20/src/os/unix/Makefile.tmpl-orig apache_1.3.20/src/os/unix/Makefile.tmpl --- apache_1.3.20/src/os/unix/Makefile.tmpl-orig Mon Sep 7 01:59:35 1998 +++ apache_1.3.20/src/os/unix/Makefile.tmpl Sat Jun 30 23:53:26 2001 @@ -44,4 +44,5 @@ $(OSDIR)/os.h $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h os.o: os.c $(INCDIR)/ap_config.h $(INCDIR)/ap_mmn.h \ $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h \ - $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h os.h + $(OSDIR)/os-inline.c $(INCDIR)/ap_ctype.h \ + $(INCDIR)/hsregex.h os.h diff -urN apache_1.3.20/src/os/unix/os-inline.c-orig apache_1.3.20/src/os/unix/os-inline.c --- apache_1.3.20/src/os/unix/os-inline.c-orig Mon Jul 13 06:32:49 1998 +++ apache_1.3.20/src/os/unix/os-inline.c Sat Jun 30 23:53:26 2001 @@ -29,3 +29,13 @@ { return file[0] == '/'; } + +/* + * changed from macro to inline function to eliminate compiler warnings + * about constant controlling expressions + */ +/*ARGSUSED0*/ +INLINE int ap_os_is_filename_valid(const char *file) +{ + return 1; +} diff -urN apache_1.3.20/src/os/unix/os.c-orig apache_1.3.20/src/os/unix/os.c --- apache_1.3.20/src/os/unix/os.c-orig Sat Jan 15 11:01:09 2000 +++ apache_1.3.20/src/os/unix/os.c Sat Jun 30 23:53:26 2001 @@ -6,6 +6,11 @@ #include "ap_config.h" #include "os.h" +#if defined(IRIX) && IRIX >= 50 +#include "httpd.h" +#include "http_log.h" +#include +#endif /* some linkers complain unless there's at least one function in each * .o file... and extra prototype is for gcc -Wmissing-prototypes @@ -181,4 +186,25 @@ #else return dlerror(); #endif +} + +/* + * Bind the current process to the given CPU. Return nonzero if + * successful. + */ +int +ap_os_bind_cpu(int cpu) +{ + int bound = 0; + +#if defined(IRIX) && IRIX >= 50 + /* only Irix 5.0 and beyond have sysmp(MP_MUSTRUN) */ + if (sysmp(MP_MUSTRUN, cpu) != -1) + bound = 1; + else + ap_log_error(APLOG_MARK, APLOG_WARNING, NULL, + "cannot bind process %d to cpu %d", getpid(), cpu); +#endif + + return bound; } diff -urN apache_1.3.20/src/os/unix/os.h-orig apache_1.3.20/src/os/unix/os.h --- apache_1.3.20/src/os/unix/os.h-orig Mon Jan 15 12:06:25 2001 +++ apache_1.3.20/src/os/unix/os.h Sat Jun 30 23:53:26 2001 @@ -78,6 +78,7 @@ #define INLINE extern ap_inline INLINE int ap_os_is_path_absolute(const char *file); +INLINE int ap_os_is_filename_valid(const char *file); #include "os-inline.c" @@ -87,11 +88,11 @@ * as normal */ extern int ap_os_is_path_absolute(const char *file); +extern int ap_os_is_filename_valid(const char *file); #endif /* Other ap_os_ routines not used by this platform */ -#define ap_os_is_filename_valid(f) (1) #define ap_os_kill(pid, sig) kill(pid, sig) /* @@ -147,5 +148,7 @@ void ap_os_dso_unload(void *); void * ap_os_dso_sym(void *, const char *); const char *ap_os_dso_error(void); + +int ap_os_bind_cpu(int); #endif /* !APACHE_OS_H */ diff -urN apache_1.3.20/src/os/win32/os.h-orig apache_1.3.20/src/os/win32/os.h --- apache_1.3.20/src/os/win32/os.h-orig Thu May 10 09:54:54 2001 +++ apache_1.3.20/src/os/win32/os.h Sat Jun 30 23:53:26 2001 @@ -206,6 +206,7 @@ /* Other ap_os_ routines not used by this platform */ #define ap_os_kill(pid, sig) kill(pid, sig) +#define ap_os_bind_cpu(c) (0) /* Some Win32isms */ #define HAVE_ISNAN diff -urN apache_1.3.20/src/regex/debug.c-orig apache_1.3.20/src/regex/debug.c --- apache_1.3.20/src/regex/debug.c-orig Tue Jun 29 09:16:45 1999 +++ apache_1.3.20/src/regex/debug.c Sat Jun 30 23:53:26 2001 @@ -16,9 +16,7 @@ == void regprint(regex_t *r, FILE *d); */ void -regprint(r, d) -regex_t *r; -FILE *d; +regprint(regex_t *r, FILE *d) { register struct re_guts *g = r->re_g; register int i; @@ -89,9 +87,7 @@ == static void s_print(register struct re_guts *g, FILE *d); */ static void -s_print(g, d) -register struct re_guts *g; -FILE *d; +s_print(register struct re_guts *g, FILE *d) { register sop *s; register cset *cs; @@ -230,8 +226,7 @@ == static char *regchar(int ch); */ static char * /* -> representation */ -regchar(ch) -int ch; +regchar(int ch) { static char buf[10]; diff -urN apache_1.3.20/src/regex/engine.c-orig apache_1.3.20/src/regex/engine.c --- apache_1.3.20/src/regex/engine.c-orig Mon Jul 13 06:32:52 1998 +++ apache_1.3.20/src/regex/engine.c Sat Jun 30 23:53:26 2001 @@ -64,12 +64,8 @@ == size_t nmatch, regmatch_t pmatch[], int eflags); */ static int /* 0 success, REG_NOMATCH failure */ -matcher(g, string, nmatch, pmatch, eflags) -register struct re_guts *g; -char *string; -size_t nmatch; -regmatch_t pmatch[]; -int eflags; +matcher(register struct re_guts *g, char *string, size_t nmatch, + regmatch_t pmatch[], int eflags) { register char *endp; register int i; @@ -230,12 +226,8 @@ == char *stop, sopno startst, sopno stopst); */ static char * /* == stop (success) always */ -dissect(m, start, stop, startst, stopst) -register struct match *m; -char *start; -char *stop; -sopno startst; -sopno stopst; +dissect(register struct match *m, char *start, char *stop, sopno startst, + sopno stopst) { register int i; register sopno ss; /* start sop of current subRE */ @@ -249,7 +241,9 @@ register char *ssp; /* start of string matched by subsubRE */ register char *sep; /* end of string matched by subsubRE */ register char *oldssp; /* previous ssp */ +#ifndef NDEBUG register char *dp; +#endif AT("diss", start, stop, startst, stopst); sp = start; @@ -308,7 +302,10 @@ esub = es - 1; /* did innards match? */ if (slow(m, sp, rest, ssub, esub) != NULL) { - dp = dissect(m, sp, rest, ssub, esub); +#ifndef NDEBUG + dp = +#endif + dissect(m, sp, rest, ssub, esub); assert(dp == rest); } else /* no */ assert(sp == rest); @@ -346,7 +343,10 @@ } assert(sep == rest); /* must exhaust substring */ assert(slow(m, ssp, sep, ssub, esub) == rest); - dp = dissect(m, ssp, sep, ssub, esub); +#ifndef NDEBUG + dp = +#endif + dissect(m, ssp, sep, ssub, esub); assert(dp == sep); sp = rest; break; @@ -365,7 +365,7 @@ assert(stp >= sp); /* it did work */ } ssub = ss + 1; - esub = ss + OPND(m->g->strip[ss]) - 1; + esub = (sopno) (ss + OPND(m->g->strip[ss]) - 1); assert(OP(m->g->strip[esub]) == OOR1); for (;;) { /* find first matching branch */ if (slow(m, sp, rest, ssub, esub) == rest) @@ -381,7 +381,10 @@ else assert(OP(m->g->strip[esub]) == O_CH); } - dp = dissect(m, sp, rest, ssub, esub); +#ifndef NDEBUG + dp = +#endif + dissect(m, sp, rest, ssub, esub); assert(dp == rest); sp = rest; break; @@ -393,12 +396,12 @@ assert(nope); break; case OLPAREN: - i = OPND(m->g->strip[ss]); + i = (int) OPND(m->g->strip[ss]); assert(0 < i && i <= m->g->nsub); m->pmatch[i].rm_so = sp - m->offp; break; case ORPAREN: - i = OPND(m->g->strip[ss]); + i = (int) OPND(m->g->strip[ss]); assert(0 < i && i <= m->g->nsub); m->pmatch[i].rm_eo = sp - m->offp; break; @@ -418,13 +421,9 @@ == char *stop, sopno startst, sopno stopst, sopno lev); */ static char * /* == stop (success) or NULL (failure) */ -backref(m, start, stop, startst, stopst, lev) -register struct match *m; -char *start; -char *stop; -sopno startst; -sopno stopst; -sopno lev; /* PLUS nesting level */ +backref(register struct match *m, char *start, char *stop, sopno startst, + sopno stopst, sopno lev) + /* lev: PLUS nesting level */ { register int i; register sopno ss; /* start sop of current subRE */ @@ -524,7 +523,7 @@ s = m->g->strip[ss]; switch (OP(s)) { case OBACK_: /* the vilest depths */ - i = OPND(s); + i = (int) OPND(s); assert(0 < i && i <= m->g->nsub); if (m->pmatch[i].rm_eo == -1) return(NULL); @@ -539,33 +538,29 @@ while (m->g->strip[ss] != SOP(O_BACK, i)) ss++; return(backref(m, sp+len, stop, ss+1, stopst, lev)); - break; case OQUEST_: /* to null or not */ dp = backref(m, sp, stop, ss+1, stopst, lev); if (dp != NULL) return(dp); /* not */ - return(backref(m, sp, stop, ss+OPND(s)+1, stopst, lev)); - break; + return(backref(m, sp, stop, ss + (sopno) OPND(s) + 1, stopst, lev)); case OPLUS_: assert(m->lastpos != NULL); assert(lev+1 <= m->g->nplus); m->lastpos[lev+1] = sp; return(backref(m, sp, stop, ss+1, stopst, lev+1)); - break; case O_PLUS: if (sp == m->lastpos[lev]) /* last pass matched null */ return(backref(m, sp, stop, ss+1, stopst, lev-1)); /* try another pass */ m->lastpos[lev] = sp; - dp = backref(m, sp, stop, ss-OPND(s)+1, stopst, lev); + dp = backref(m, sp, stop, ss - (sopno) OPND(s) + 1, stopst, lev); if (dp == NULL) return(backref(m, sp, stop, ss+1, stopst, lev-1)); else return(dp); - break; case OCH_: /* find the right one, if any */ ssub = ss + 1; - esub = ss + OPND(s) - 1; + esub = ss + (sopno) OPND(s) - 1; assert(OP(m->g->strip[esub]) == OOR1); for (;;) { /* find first matching branch */ dp = backref(m, sp, stop, ssub, esub, lev); @@ -583,9 +578,10 @@ else assert(OP(m->g->strip[esub]) == O_CH); } + /* NOTREACHED */ break; case OLPAREN: /* must undo assignment if rest fails */ - i = OPND(s); + i = (int) OPND(s); assert(0 < i && i <= m->g->nsub); offsave = m->pmatch[i].rm_so; m->pmatch[i].rm_so = sp - m->offp; @@ -594,9 +590,8 @@ return(dp); m->pmatch[i].rm_so = offsave; return(NULL); - break; case ORPAREN: /* must undo assignment if rest fails */ - i = OPND(s); + i = (int) OPND(s); assert(0 < i && i <= m->g->nsub); offsave = m->pmatch[i].rm_eo; m->pmatch[i].rm_eo = sp - m->offp; @@ -605,7 +600,6 @@ return(dp); m->pmatch[i].rm_eo = offsave; return(NULL); - break; default: /* uh oh */ assert(nope); break; @@ -623,12 +617,8 @@ == char *stop, sopno startst, sopno stopst); */ static char * /* where tentative match ended, or NULL */ -fast(m, start, stop, startst, stopst) -register struct match *m; -char *start; -char *stop; -sopno startst; -sopno stopst; +fast(register struct match *m, char *start, char *stop, sopno startst, + sopno stopst) { register states st = m->st; register states fresh = m->fresh; @@ -714,12 +704,8 @@ == char *stop, sopno startst, sopno stopst); */ static char * /* where it ended */ -slow(m, start, stop, startst, stopst) -register struct match *m; -char *start; -char *stop; -sopno startst; -sopno stopst; +slow(register struct match *m, char *start, char *stop, sopno startst, + sopno stopst) { register states st = m->st; register states empty = m->empty; @@ -810,13 +796,13 @@ == #define NNONCHAR (CODEMAX-CHAR_MAX) */ static states -step(g, start, stop, bef, ch, aft) -register struct re_guts *g; -sopno start; /* start state within strip */ -sopno stop; /* state after stop state within strip */ -register states bef; /* states reachable before */ -int ch; /* character or NONCHAR code */ -register states aft; /* states already known reachable after */ +step(register struct re_guts *g, sopno start, sopno stop, register states bef, + int ch, register states aft) + /* start: start state within strip */ + /* stop: state after stop state within strip */ + /* bef: states reachable before */ + /* ch: character or NONCHAR code */ + /* aft: states already known reachable after */ { register cset *cs; register sop s; @@ -871,7 +857,7 @@ break; case O_PLUS: /* both forward and back */ FWD(aft, aft, 1); - i = ISSETBACK(aft, OPND(s)); + i = (int) ISSETBACK(aft, OPND(s)); BACK(aft, aft, OPND(s)); if (!i && ISSETBACK(aft, OPND(s))) { /* oho, must reconsider loop body */ @@ -932,12 +918,7 @@ == #endif */ static void -print(m, caption, st, ch, d) -struct match *m; -char *caption; -states st; -int ch; -FILE *d; +print(struct match *m, char *caption, states st, int ch, FILE *d) { register struct re_guts *g = m->g; register int i; @@ -965,13 +946,8 @@ == #endif */ static void -at(m, title, start, stop, startst, stopst) -struct match *m; -char *title; -char *start; -char *stop; -sopno startst; -sopno stopst; +at(struct match *m, char *title, char *start, char *stop, sopno startst, + sopno stopst) { if (!(m->eflags®_TRACE)) return; @@ -995,8 +971,7 @@ * the non-debug compilation anyway, so it doesn't matter much. */ static char * /* -> representation */ -pchar(ch) -int ch; +pchar(int ch) { static char pbuf[10]; diff -urN apache_1.3.20/src/regex/main.c-orig apache_1.3.20/src/regex/main.c --- apache_1.3.20/src/regex/main.c-orig Tue Aug 31 23:29:09 1999 +++ apache_1.3.20/src/regex/main.c Sat Jun 30 23:53:26 2001 @@ -29,9 +29,7 @@ /* - main - do the simple case, hand off to regress() for regression */ -int main(argc, argv) -int argc; -char *argv[]; +int main(int argc, char *argv[]) { regex_t re; # define NS 10 @@ -127,8 +125,7 @@ == void regress(FILE *in); */ void -regress(in) -FILE *in; +regress(FILE *in) { char inbuf[1000]; # define MAXF 10 @@ -207,13 +204,8 @@ == void try(char *f0, char *f1, char *f2, char *f3, char *f4, int opts); */ void -try(f0, f1, f2, f3, f4, opts) -char *f0; -char *f1; -char *f2; -char *f3; -char *f4; -int opts; /* may not match f1 */ +try(char *f0, char *f1, char *f2, char *f3, char *f4, int opts) + /* opts: may not match f1 */ { regex_t re; # define NSUBS 10 @@ -318,9 +310,8 @@ == int options(int type, char *s); */ int -options(type, s) -int type; /* 'c' compile, 'e' exec */ -char *s; +options(int type, char *s) + /* type: 'c' compile, 'e' exec */ { register char *p; register int o = (type == 'c') ? copts : eopts; @@ -375,9 +366,7 @@ == int opt(int c, char *s); */ int /* predicate */ -opt(c, s) -int c; -char *s; +opt(int c, char *s) { return(strchr(s, c) != NULL); } @@ -387,8 +376,7 @@ == void fixstr(register char *p); */ void -fixstr(p) -register char *p; +fixstr(register char *p) { if (p == NULL) return; @@ -409,10 +397,7 @@ == char *check(char *str, regmatch_t sub, char *should); */ char * /* NULL or complaint */ -check(str, sub, should) -char *str; -regmatch_t sub; -char *should; +check(char *str, regmatch_t sub, char *should) { register int len; register int shlen; @@ -486,8 +471,7 @@ == static char *eprint(int err); */ static char * -eprint(err) -int err; +eprint(int err) { static char epbuf[100]; size_t len; @@ -502,8 +486,7 @@ == static int efind(char *name); */ static int -efind(name) -char *name; +efind(char *name) { static char efbuf[100]; regex_t re; diff -urN apache_1.3.20/src/regex/regcomp.c-orig apache_1.3.20/src/regex/regcomp.c --- apache_1.3.20/src/regex/regcomp.c-orig Mon Dec 6 17:17:03 1999 +++ apache_1.3.20/src/regex/regcomp.c Sat Jun 30 23:53:26 2001 @@ -85,10 +85,7 @@ */ ap_private_extern API_EXPORT(int) /* 0 success, otherwise REG_something */ -regcomp(preg, pattern, cflags) -regex_t *preg; -const char *pattern; -int cflags; +regcomp(regex_t *preg, const char *pattern, int cflags) { struct parse pa; register struct re_guts *g; @@ -140,7 +137,7 @@ (NC-1)*sizeof(cat_t)); if (g == NULL) return(REG_ESPACE); - p->ssize = len/(size_t)2*(size_t)3 + (size_t)1; /* ugh */ + p->ssize = (sopno) (len/(size_t)2*(size_t)3 + (size_t)1); /* ugh */ p->strip = (sop *)malloc(p->ssize * sizeof(sop)); p->slen = 0; if (p->strip == NULL) { @@ -212,9 +209,8 @@ == static void p_ere(register struct parse *p, int stop); */ static void -p_ere(p, stop) -register struct parse *p; -int stop; /* character this ERE should end at */ +p_ere(register struct parse *p, int stop) + /* stop: character this ERE should end at */ { register char c; register sopno prevback = 0; @@ -258,8 +254,7 @@ == static void p_ere_exp(register struct parse *p); */ static void -p_ere_exp(p) -register struct parse *p; +p_ere_exp(register struct parse *p) { register char c; register sopno pos; @@ -276,7 +271,7 @@ case '(': REQUIRE(MORE(), REG_EPAREN); p->g->nsub++; - subno = p->g->nsub; + subno = (sopno) p->g->nsub; if (subno < NPAREN) p->pbegin[subno] = HERE(); EMIT(OLPAREN, subno); @@ -407,8 +402,7 @@ == static void p_str(register struct parse *p); */ static void -p_str(p) -register struct parse *p; +p_str(register struct parse *p) { REQUIRE(MORE(), REG_EMPTY); while (MORE()) @@ -428,10 +422,9 @@ * The amount of lookahead needed to avoid this kludge is excessive. */ static void -p_bre(p, end1, end2) -register struct parse *p; -register int end1; /* first terminating character */ -register int end2; /* second terminating character */ +p_bre(register struct parse *p, register int end1, register int end2) + /* end1: first terminating character */ + /* end2: second terminating character */ { register sopno start = HERE(); register int first = 1; /* first subexpression? */ @@ -461,9 +454,8 @@ == static int p_simp_re(register struct parse *p, int starordinary); */ static int /* was the simple RE an unbackslashed $? */ -p_simp_re(p, starordinary) -register struct parse *p; -int starordinary; /* is a leading * an ordinary character? */ +p_simp_re(register struct parse *p, int starordinary) + /* starordinary: is a leading * an ordinary character? */ { register int c; register int count; @@ -496,7 +488,7 @@ break; case BACKSL|'(': p->g->nsub++; - subno = p->g->nsub; + subno = (sopno) p->g->nsub; if (subno < NPAREN) p->pbegin[subno] = HERE(); EMIT(OLPAREN, subno); @@ -579,8 +571,7 @@ == static int p_count(register struct parse *p); */ static int /* the value */ -p_count(p) -register struct parse *p; +p_count(register struct parse *p) { register int count = 0; register int ndigits = 0; @@ -602,8 +593,7 @@ * no set operations are done. */ static void -p_bracket(p) -register struct parse *p; +p_bracket(register struct parse *p) { register cset *cs = allocset(p); register int invert = 0; @@ -676,9 +666,7 @@ == static void p_b_term(register struct parse *p, register cset *cs); */ static void -p_b_term(p, cs) -register struct parse *p; -register cset *cs; +p_b_term(register struct parse *p, register cset *cs) { register char c; register char start, finish; @@ -692,7 +680,6 @@ case '-': SETERROR(REG_ERANGE); return; /* NOTE RETURN */ - break; default: c = '\0'; break; @@ -756,9 +743,7 @@ == static void p_b_cclass(register struct parse *p, register cset *cs); */ static void -p_b_cclass(p, cs) -register struct parse *p; -register cset *cs; +p_b_cclass(register struct parse *p, register cset *cs) { register char *sp = p->next; register struct cclass *cp; @@ -792,9 +777,7 @@ * This implementation is incomplete. xxx */ static void -p_b_eclass(p, cs) -register struct parse *p; -register cset *cs; +p_b_eclass(register struct parse *p, register cset *cs) { register char c; @@ -807,8 +790,7 @@ == static char p_b_symbol(register struct parse *p); */ static char /* value of symbol */ -p_b_symbol(p) -register struct parse *p; +p_b_symbol(register struct parse *p) { register char value; @@ -827,9 +809,8 @@ == static char p_b_coll_elem(register struct parse *p, int endc); */ static char /* value of collating element */ -p_b_coll_elem(p, endc) -register struct parse *p; -int endc; /* name ended by endc,']' */ +p_b_coll_elem(register struct parse *p, int endc) + /* endc: name ended by endc,']' */ { register char *sp = p->next; register struct cname *cp; @@ -841,7 +822,7 @@ SETERROR(REG_EBRACK); return(0); } - len = p->next - sp; + len = (int) (p->next - sp); for (cp = cnames; cp->name != NULL; cp++) if (strncmp(cp->name, sp, len) == 0 && cp->name[len] == '\0') return(cp->code); /* known name */ @@ -856,8 +837,7 @@ == static char othercase(int ch); */ static char /* if no counterpart, return ch */ -othercase(ch) -int ch; +othercase(int ch) { assert(ap_isalpha(ch)); if (ap_isupper(ch)) @@ -875,9 +855,7 @@ * Boy, is this implementation ever a kludge... */ static void -bothcases(p, ch) -register struct parse *p; -int ch; +bothcases(register struct parse *p, int ch) { register char *oldnext = p->next; register char *oldend = p->end; @@ -900,9 +878,7 @@ == static void ordinary(register struct parse *p, register int ch); */ static void -ordinary(p, ch) -register struct parse *p; -register int ch; +ordinary(register struct parse *p, register int ch) { register cat_t *cap = p->g->categories; @@ -922,8 +898,7 @@ * Boy, is this implementation ever a kludge... */ static void -nonnewline(p) -register struct parse *p; +nonnewline(register struct parse *p) { register char *oldnext = p->next; register char *oldend = p->end; @@ -946,11 +921,10 @@ == static void repeat(register struct parse *p, sopno start, int from, int to); */ static void -repeat(p, start, from, to) -register struct parse *p; -sopno start; /* operand from here to end of strip */ -int from; /* repeated from this number */ -int to; /* to this number of times (maybe INFINITY) */ +repeat(register struct parse *p, sopno start, int from, int to) + /* start: operand from here to end of strip */ + /* from: repeated from this number */ + /* to: to this number of times (maybe INFINITY) */ { register sopno finish = HERE(); # define N 2 @@ -1018,9 +992,7 @@ == static int seterr(register struct parse *p, int e); */ static int /* useless but makes type checking happy */ -seterr(p, e) -register struct parse *p; -int e; +seterr(register struct parse *p, int e) { if (p->error == 0) /* keep earliest error condition */ p->error = e; @@ -1034,8 +1006,7 @@ == static cset *allocset(register struct parse *p); */ static cset * -allocset(p) -register struct parse *p; +allocset(register struct parse *p) { register int no = p->g->ncsets++; register size_t nc; @@ -1089,9 +1060,7 @@ == static void freeset(register struct parse *p, register cset *cs); */ static void -freeset(p, cs) -register struct parse *p; -register cset *cs; +freeset(register struct parse *p, register cset *cs) { register int i; register cset *top = &p->g->sets[p->g->ncsets]; @@ -1114,9 +1083,7 @@ * the same value! */ static int /* set number */ -freezeset(p, cs) -register struct parse *p; -register cset *cs; +freezeset(register struct parse *p, register cset *cs) { register uch h = cs->hash; register int i; @@ -1148,9 +1115,7 @@ == static int firstch(register struct parse *p, register cset *cs); */ static int /* character; there is no "none" value */ -firstch(p, cs) -register struct parse *p; -register cset *cs; +firstch(register struct parse *p, register cset *cs) { register int i; register size_t css = (size_t)p->g->csetsize; @@ -1167,9 +1132,7 @@ == static int nch(register struct parse *p, register cset *cs); */ static int -nch(p, cs) -register struct parse *p; -register cset *cs; +nch(register struct parse *p, register cset *cs) { register int i; register size_t css = (size_t)p->g->csetsize; @@ -1187,10 +1150,7 @@ == register char *cp); */ static void -mcadd(p, cs, cp) -register struct parse *p; -register cset *cs; -register char *cp; +mcadd(register struct parse *p, register cset *cs, register char *cp) { register size_t oldend = cs->smultis