cvs commit: apache-1.3/src/modules/experimental mod_mmap_static.c

1998-07-12 Thread rse
rse 98/07/12 02:35:43

  Modified:src  CHANGES
   src/modules/experimental mod_mmap_static.c
  Log:
  Although Dean already has moved mod_mmap_static inside the Configuration to
  change its priority, it doesn't hurt is when we are additionally be even more
  conservative:
  
  Let mod_mmap_static be more reserved unless at least one "mmapfile" directive
  is present in the configuration. Because this experimental module has to do
  some black magic to operate inside the current API and thus forces
  side-effects for other modules under some circumstances.
  
  PS: For Apache 2.0 we really need dynamically configurable
  priorities _per API hook_ for each module, yes
  
  Revision  ChangesPath
  1.962 +6 -0  apache-1.3/src/CHANGES
  
  Index: CHANGES
  ===
  RCS file: /export/home/cvs/apache-1.3/src/CHANGES,v
  retrieving revision 1.961
  retrieving revision 1.962
  diff -u -r1.961 -r1.962
  --- CHANGES   1998/07/12 09:25:44 1.961
  +++ CHANGES   1998/07/12 09:35:40 1.962
  @@ -1,4 +1,10 @@
   Changes with Apache 1.3.1
  +
  +  *) Let mod_mmap_static be more reserved unless at least one "mmapfile"
  + directive is present in the configuration. Because this experimental
  + module has to do some black magic to operate inside the current API and
  + thus forces side-effects for other modules under some circumstances.
  + [Ralf S. Engelschall]

 *) Add conservative ticks around more egrep arguments in top-level 
configure
to avoid problems under brain-dead platforms like Digital Unix (OSF1).
  
  
  
  1.8   +6 -1  apache-1.3/src/modules/experimental/mod_mmap_static.c
  
  Index: mod_mmap_static.c
  ===
  RCS file: 
/export/home/cvs/apache-1.3/src/modules/experimental/mod_mmap_static.c,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- mod_mmap_static.c 1998/04/11 12:00:38 1.7
  +++ mod_mmap_static.c 1998/07/12 09:35:42 1.8
  @@ -280,12 +280,17 @@
   a_file *match;
   int res;
   
  +sconf = ap_get_module_config(r->server->module_config, 
&mmap_static_module);
  +
  +/* we only operate when at least one mmapfile directive was used */
  +if (ap_is_empty_table(sconf->files))
  + return DECLINED;
  +
   /* we require other modules to first set up a filename */
   res = core_module.translate_handler(r);
   if (res == DECLINED || !r->filename) {
return res;
   }
  -sconf = ap_get_module_config(r->server->module_config, 
&mmap_static_module);
   tmp.filename = r->filename;
   match = (a_file *)bsearch(&tmp, sconf->files->elts, sconf->files->nelts,
sizeof(a_file), file_compare);
  
  
  


cvs commit: apache-1.3/src/modules/experimental mod_mmap_static.c

1998-04-04 Thread rse
rse 98/04/04 04:48:09

  Modified:src/modules/experimental mod_mmap_static.c
  Log:
  Fix two GCC warnings "assignment from incompatible pointer type", because
  bsearch is "void *", it is ok to cast it to the correct type of the variable
  we assign its return value to.
  
  Revision  ChangesPath
  1.6   +2 -2  apache-1.3/src/modules/experimental/mod_mmap_static.c
  
  Index: mod_mmap_static.c
  ===
  RCS file: 
/export/home/cvs/apache-1.3/src/modules/experimental/mod_mmap_static.c,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- mod_mmap_static.c 1998/03/31 12:52:58 1.5
  +++ mod_mmap_static.c 1998/04/04 12:48:08 1.6
  @@ -287,7 +287,7 @@
   }
   sconf = get_module_config(r->server->module_config, &mmap_static_module);
   tmp.filename = r->filename;
  -match = bsearch(&tmp, sconf->files->elts, sconf->files->nelts,
  +match = (a_file *)bsearch(&tmp, sconf->files->elts, sconf->files->nelts,
sizeof(a_file), file_compare);
   if (match == NULL) {
return DECLINED;
  @@ -318,7 +318,7 @@
   tmp.finfo.st_dev = r->finfo.st_dev;
   tmp.finfo.st_ino = r->finfo.st_ino;
   ptmp = &tmp;
  -pmatch = bsearch(&ptmp, sconf->inode_sorted->elts,
  +pmatch = (a_file **)bsearch(&ptmp, sconf->inode_sorted->elts,
sconf->inode_sorted->nelts, sizeof(a_file *), inode_compare);
   if (pmatch == NULL) {
return DECLINED;
  
  
  


cvs commit: apache-1.3/src/modules/experimental mod_mmap_static.c

1998-03-17 Thread dgaudet
dgaudet 98/03/17 10:54:59

  Modified:src/modules/experimental mod_mmap_static.c
  Log:
  fix after static stuff
  
  Revision  ChangesPath
  1.4   +4 -2  apache-1.3/src/modules/experimental/mod_mmap_static.c
  
  Index: mod_mmap_static.c
  ===
  RCS file: 
/export/home/cvs/apache-1.3/src/modules/experimental/mod_mmap_static.c,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- mod_mmap_static.c 1998/03/13 19:20:19 1.3
  +++ mod_mmap_static.c 1998/03/17 18:54:58 1.4
  @@ -109,11 +109,14 @@
   #include 
   #include 
   
  +#define CORE_PRIVATE
  +
   #include "httpd.h"
   #include "http_config.h"
   #include "http_log.h"
   #include "http_protocol.h"
   #include "http_request.h"
  +#include "http_core.h"
   
   module MODULE_VAR_EXPORT mmap_static_module;
   
  @@ -265,7 +268,6 @@
   /* If it's one of ours, fill in r->finfo now to avoid extra stat()... this 
is a
* bit of a kludge, because we really want to run after core_translate runs.
*/
  -extern int core_translate(request_rec *r);
   
   static int mmap_static_xlat(request_rec *r)
   {
  @@ -275,7 +277,7 @@
   int res;
   
   /* we require other modules to first set up a filename */
  -res = core_translate(r);
  +res = core_module.translate_handler(r);
   if (res == DECLINED || !r->filename) {
return res;
   }
  
  
  


cvs commit: apache-1.3/src/modules/experimental mod_mmap_static.c

1998-02-10 Thread dgaudet
dgaudet 98/02/10 03:00:59

  Added:   src/modules/experimental mod_mmap_static.c
  Log:
  here ya go
  
  Revision  ChangesPath
  1.1  apache-1.3/src/modules/experimental/mod_mmap_static.c
  
  Index: mod_mmap_static.c
  ===
  /* 
   * Copyright (c) 1998 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
   *[EMAIL PROTECTED]
   *
   * 5. 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.
   * 
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Group and was originally based
   * on public domain software written at the National Center for
   * Supercomputing Applications, University of Illinois, Urbana-Champaign.
   * For more information on the Apache Group and the Apache HTTP server
   * project, please see .
   *
   */
  
  /*
   * mod_mmap_static: mmap a config-time list of files for faster serving
   *
   * v0.04
   * 
   * Author: Dean Gaudet <[EMAIL PROTECTED]>
   *
   * v0.01: initial implementation
   * v0.02: get rid of the extra stat() in the core by filling in what we know
   * v0.03: get rid of the cached match from the xlat routine since there are
   *many cases where the request is modified between it and the
   *handler... so we do the binary search twice, but the second time
   *we can use st_ino and st_dev to speed it up.
   * v0.04: work around mod_rewrite, which sets r->filename to the uri first
   */
  
  /*
  Documentation:
  
  The concept is simple.  Some sites have a set of static files that are
  really busy, and change infrequently (or even on a regular schedule).
  Save time by mmap()ing these files into memory and avoid a lot of the
  crap required to do normal file serving.  Place directives such as:
  
mmapfile /path/to/file1
mmapfile /path/to/file2
...
  
  into your configuration.  These files are only mmap()d when the server
  is restarted, so if you change the list, or if the files are changed,
  then you'll need to restart the server.
  
  To reiterate that point:  if the files are modified *in place*
  without restarting the server you may end up serving requests that
  are completely bogus.  You should update files by unlinking the old
  copy and putting a new copy in place.  Most tools such as rdist and
  mv do this.
  
  There's no such thing as inheriting these files across vhosts or
  whatever... place the directives in the main server only.
  
  Known problems:
  
  Don't use Alias or RewriteRule to move these files around...  unless
  you feel like paying for an extra stat() on each request.  This is
  a deficiency in the Apache API tha