httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From stodd...@apache.org
Subject cvs commit: httpd-2.0/server/mpm/winnt mpm.h mpm_default.h mpm_winnt.c mpm_winnt.h
Date Fri, 02 Feb 2001 21:32:35 GMT
stoddard    01/02/02 13:32:35

  Modified:    .        CHANGES libhttpd.dsp
               include  scoreboard.h
               modules/cache mod_file_cache.dsp
               modules/generators mod_status.c mod_status.dsp
               server   scoreboard.c
               server/mpm/winnt mpm.h mpm_default.h mpm_winnt.c mpm_winnt.h
  Log:
  Begin restructuring scoreboard code to enable adding back in
  the ability to use IPC other than shared memory.
  Get mod_status working on Windows again.
  
  Still to do:
  Rename some of the function APIs. Replace all calls to reinit_scoreboard with
  ap_create_scoreboard. Add back in support for scoreboard files.
  
  Revision  Changes    Path
  1.72      +3 -0      httpd-2.0/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/CHANGES,v
  retrieving revision 1.71
  retrieving revision 1.72
  diff -u -r1.71 -r1.72
  --- CHANGES	2001/02/01 21:54:06	1.71
  +++ CHANGES	2001/02/02 21:32:27	1.72
  @@ -1,4 +1,7 @@
   Changes with Apache 2.0b1
  +  *) Begin restructuring scoreboard code to enable adding back in
  +     the ability to use IPC other than shared memory.
  +     Get mod_status working on Windows again. [Bill Stoddard]
   
     *) Make mod_status work with 2.0.  This will work for prefork,
        mpmt_pthread, and dexter.  [Ryan Bloom]
  
  
  
  1.12      +4 -0      httpd-2.0/libhttpd.dsp
  
  Index: libhttpd.dsp
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/libhttpd.dsp,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- libhttpd.dsp	2001/01/28 18:38:24	1.11
  +++ libhttpd.dsp	2001/02/02 21:32:28	1.12
  @@ -227,6 +227,10 @@
   # End Source File
   # Begin Source File
   
  +SOURCE=.\server\scoreboard.c
  +# End Source File
  +# Begin Source File
  +
   SOURCE=.\server\vhost.c
   # End Source File
   # End Group
  
  
  
  1.4       +11 -1     httpd-2.0/include/scoreboard.h
  
  Index: scoreboard.h
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/include/scoreboard.h,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- scoreboard.h	2001/02/02 16:47:44	1.3
  +++ scoreboard.h	2001/02/02 21:32:30	1.4
  @@ -139,6 +139,14 @@
    */
   typedef int ap_generation_t;
   
  +/* Is the scoreboard shared between processes or not? 
  + * Set by the MPM when the scoreboard is created.
  + */
  +typedef enum {
  +    SB_SHARED = 1,
  +    SB_NOT_SHARED = 2
  +} ap_scoreboard_e;
  +
   /* stuff which is thread/process specific */
   typedef struct {
   #ifdef OPTIMIZE_TIMEOUTS
  @@ -168,6 +176,7 @@
   } short_score;
   
   typedef struct {
  +    ap_scoreboard_e sb_type;
       ap_generation_t running_generation;	/* the generation of children which
                                            * should still be serving requests. */
   } global_score;
  @@ -211,12 +220,13 @@
   #endif
   
   AP_DECLARE(int) ap_exists_scoreboard_image(void);
  +AP_DECLARE(void) ap_create_scoreboard(apr_pool_t *p, ap_scoreboard_e t);
   void reinit_scoreboard(apr_pool_t *p);
   apr_status_t ap_cleanup_shared_mem(void *d);
   
   AP_DECLARE(void) reopen_scoreboard(apr_pool_t *p);
   
  -apr_inline void ap_sync_scoreboard_image(void);
  +void ap_sync_scoreboard_image(void);
   void increment_counts(int child_num, int thread_num, request_rec *r);
   void update_scoreboard_global(void);
   AP_DECLARE(int) find_child_by_pid(apr_proc_t *pid);
  
  
  
  1.12      +4 -4      httpd-2.0/modules/cache/mod_file_cache.dsp
  
  Index: mod_file_cache.dsp
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/cache/mod_file_cache.dsp,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- mod_file_cache.dsp	2000/12/21 01:24:41	1.11
  +++ mod_file_cache.dsp	2001/02/02 21:32:31	1.12
  @@ -52,8 +52,8 @@
   # ADD BASE BSC32 /nologo
   # ADD BSC32 /nologo
   LINK32=link.exe
  -# ADD BASE LINK32 /nologo /subsystem:windows /dll /incremental:no /map /out:"Release/mod_file_cache.so"
/machine:I386 /base:@..\..\os\win32\BaseAddr.ref,mod_file_cache
  -# ADD LINK32 /nologo /subsystem:windows /dll /incremental:no /map /out:"Release/mod_file_cache.so"
/machine:I386 /base:@..\..\os\win32\BaseAddr.ref,mod_file_cache
  +# ADD BASE LINK32 /nologo /subsystem:windows /dll /map /machine:I386 /out:"Release/mod_file_cache.so"
/base:@..\..\os\win32\BaseAddr.ref,mod_file_cache
  +# ADD LINK32 /nologo /subsystem:windows /dll /map /machine:I386 /out:"Release/mod_file_cache.so"
/base:@..\..\os\win32\BaseAddr.ref,mod_file_cache
   
   !ELSEIF  "$(CFG)" == "mod_file_cache - Win32 Debug"
   
  @@ -78,8 +78,8 @@
   # ADD BASE BSC32 /nologo
   # ADD BSC32 /nologo
   LINK32=link.exe
  -# ADD BASE LINK32 /nologo /subsystem:windows /dll /incremental:no /map /debug /out:"Debug/mod_file_cache.so"
/machine:I386 /base:@..\..\os\win32\BaseAddr.ref,mod_file_cache
  -# ADD LINK32 /nologo /subsystem:windows /dll /incremental:no /map /debug /out:"Debug/mod_file_cache.so"
/machine:I386 /base:@..\..\os\win32\BaseAddr.ref,mod_file_cache
  +# ADD BASE LINK32 /nologo /subsystem:windows /dll /incremental:no /map /debug /machine:I386
/out:"Debug/mod_file_cache.so" /base:@..\..\os\win32\BaseAddr.ref,mod_file_cache
  +# ADD LINK32 /nologo /subsystem:windows /dll /incremental:no /map /debug /machine:I386
/out:"Debug/mod_file_cache.so" /base:@..\..\os\win32\BaseAddr.ref,mod_file_cache
   
   !ENDIF 
   
  
  
  
  1.21      +1 -1      httpd-2.0/modules/generators/mod_status.c
  
  Index: mod_status.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/generators/mod_status.c,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- mod_status.c	2001/02/02 19:28:06	1.20
  +++ mod_status.c	2001/02/02 21:32:31	1.21
  @@ -308,7 +308,7 @@
       if (r->header_only)
   	return 0;
   
  -    ap_sync_scoreboard_image();
  +/*    ap_sync_scoreboard_image(); */
       for (i = 0; i < HARD_SERVER_LIMIT; ++i) {
           for (j = 0; j < HARD_THREAD_LIMIT; ++j) {
               int indx = (i * HARD_THREAD_LIMIT) + j;
  
  
  
  1.17      +6 -6      httpd-2.0/modules/generators/mod_status.dsp
  
  Index: mod_status.dsp
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/generators/mod_status.dsp,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- mod_status.dsp	2000/12/21 01:24:48	1.16
  +++ mod_status.dsp	2001/02/02 21:32:31	1.17
  @@ -43,7 +43,7 @@
   # PROP Ignore_Export_Lib 0
   # PROP Target_Dir ""
   # ADD BASE CPP /nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /FD /c
  -# ADD CPP /nologo /MD /W3 /O2 /I "..\..\include" /I "..\..\os\win32" /I "..\..\srclib\apr\include"
/I "../../srclib/apr-util/include" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /Fd"Release\mod_status"
/FD /c
  +# ADD CPP /nologo /MD /W3 /O2 /I "..\..\include" /I "..\..\os\win32" /I "..\..\srclib\apr\include"
/I "../../srclib/apr-util/include" /I "../../server/mpm/winnt" /D "NDEBUG" /D "WIN32" /D "_WINDOWS"
/Fd"Release\mod_status" /FD /c
   # ADD BASE MTL /nologo /D "NDEBUG" /win32
   # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
   # ADD BASE RSC /l 0x809 /d "NDEBUG"
  @@ -52,8 +52,8 @@
   # ADD BASE BSC32 /nologo
   # ADD BSC32 /nologo
   LINK32=link.exe
  -# ADD BASE LINK32 kernel32.lib /nologo /subsystem:windows /dll /incremental:no /map /out:"Release/mod_status.so"
/machine:I386 /base:@..\..\os\win32\BaseAddr.ref,mod_status
  -# ADD LINK32 kernel32.lib /nologo /subsystem:windows /dll /incremental:no /map /out:"Release/mod_status.so"
/machine:I386 /base:@..\..\os\win32\BaseAddr.ref,mod_status
  +# ADD BASE LINK32 kernel32.lib /nologo /subsystem:windows /dll /map /machine:I386 /out:"Release/mod_status.so"
/base:@..\..\os\win32\BaseAddr.ref,mod_status
  +# ADD LINK32 kernel32.lib /nologo /subsystem:windows /dll /map /machine:I386 /out:"Release/mod_status.so"
/base:@..\..\os\win32\BaseAddr.ref,mod_status
   
   !ELSEIF  "$(CFG)" == "mod_status - Win32 Debug"
   
  @@ -69,7 +69,7 @@
   # PROP Ignore_Export_Lib 0
   # PROP Target_Dir ""
   # ADD BASE CPP /nologo /MDd /W3 /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FD /c
  -# ADD CPP /nologo /MDd /W3 /GX /ZI /Od /I "..\..\include" /I "..\..\os\win32" /I "..\..\srclib\apr\include"
/I "../../srclib/apr-util/include" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /Fd"Debug\mod_status"
/FD /c
  +# ADD CPP /nologo /MDd /W3 /GX /ZI /Od /I "..\..\include" /I "..\..\os\win32" /I "..\..\srclib\apr\include"
/I "../../srclib/apr-util/include" /I "../../server/mpm/winnt" /D "_DEBUG" /D "WIN32" /D "_WINDOWS"
/Fd"Debug\mod_status" /FD /c
   # ADD BASE MTL /nologo /D "_DEBUG" /win32
   # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
   # ADD BASE RSC /l 0x809 /d "_DEBUG"
  @@ -78,8 +78,8 @@
   # ADD BASE BSC32 /nologo
   # ADD BSC32 /nologo
   LINK32=link.exe
  -# ADD BASE LINK32 kernel32.lib /nologo /subsystem:windows /dll /incremental:no /map /debug
/out:"Debug/mod_status.so" /machine:I386 /base:@..\..\os\win32\BaseAddr.ref,mod_status
  -# ADD LINK32 kernel32.lib /nologo /subsystem:windows /dll /incremental:no /map /debug /out:"Debug/mod_status.so"
/machine:I386 /base:@..\..\os\win32\BaseAddr.ref,mod_status
  +# ADD BASE LINK32 kernel32.lib /nologo /subsystem:windows /dll /incremental:no /map /debug
/machine:I386 /out:"Debug/mod_status.so" /base:@..\..\os\win32\BaseAddr.ref,mod_status
  +# ADD LINK32 kernel32.lib /nologo /subsystem:windows /dll /incremental:no /map /debug /machine:I386
/out:"Debug/mod_status.so" /base:@..\..\os\win32\BaseAddr.ref,mod_status
   
   !ENDIF 
   
  
  
  
  1.2       +71 -11    httpd-2.0/server/scoreboard.c
  
  Index: scoreboard.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/server/scoreboard.c,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- scoreboard.c	2001/02/01 21:54:25	1.1
  +++ scoreboard.c	2001/02/02 21:32:32	1.2
  @@ -64,7 +64,11 @@
   #include "http_main.h"
   #include "http_core.h"
   #include "http_config.h"
  +/* ToDo: Fix this right */
  +#ifndef WIN32
   #include "unixd.h"
  +#endif
  +
   #include "http_conf_globals.h"
   #include "mpm.h"
   #include "scoreboard.h"
  @@ -79,20 +83,33 @@
   
   #if APR_HAS_SHARED_MEMORY
   #include "apr_shmem.h"
  -
   static apr_shmem_t *scoreboard_shm = NULL;
  -
  +#endif
  +/*
  + * ToDo:
  + * This function should be renamed to cleanup_shared
  + * and it should handle cleaning up a scoreboard shared
  + * between processes using any form of IPC (file, shared memory
  + * segment, etc.). Leave it as is now because it is being used
  + * by various MPMs. 
  + */
   apr_status_t ap_cleanup_shared_mem(void *d)
   {
  +#if APR_HAD_SHARED_MEMORY
       apr_shm_free(scoreboard_shm, ap_scoreboard_image);
       ap_scoreboard_image = NULL;
       apr_shm_destroy(scoreboard_shm);
  -
  +#endif
       return APR_SUCCESS;
   }
   
  -static void setup_shared_mem(apr_pool_t *p)
  +/* ToDo: This function should be made to handle setting up 
  + * a scoreboard shared between processes using any IPC technique, 
  + * not just a shared memory segment
  + */
  +static void setup_shared(apr_pool_t *p)
   {
  +#if APR_HAD_SHARED_MEMORY
       char buf[512];
       char errmsg[120];
       const char *fname;
  @@ -114,26 +131,69 @@
           apr_shm_destroy(scoreboard_shm);
           exit(APEXIT_INIT);
       }
  -    apr_register_cleanup(p, NULL, ap_cleanup_shared_mem, apr_null_cleanup);
       ap_scoreboard_image->global.running_generation = 0;
  +#endif
   }
   
  -void reopen_scoreboard(apr_pool_t *p)
  +AP_DECLARE(void) reopen_scoreboard(apr_pool_t *p)
   {
   }
  -#endif   /* APR_SHARED_MEM */
   
  -/* Called by parent process */
  -void reinit_scoreboard(apr_pool_t *p)
  +/* ap_cleanup_scoreboard
  + * 
  + */
  +static void ap_cleanup_scoreboard(void *d) {
  +    if (ap_scoreboard_image == NULL)
  +        return;
  +    if (ap_scoreboard_image->global.sb_type == SB_SHARED) {
  +        ap_cleanup_shared_mem(NULL);
  +    }
  +    else {
  +        free(ap_scoreboard_image);
  +        ap_scoreboard_image = NULL;
  +    }
  +}
  +
  +/* ap_create_scoreboard(apr_pool_t*, ap_scoreboard_e t)
  + *
  + * Create or reinit an existing scoreboard. The MPM can control whether
  + * the scoreboard is shared across multiple processes or not
  + */
  +AP_DECLARE(void) ap_create_scoreboard(apr_pool_t *p, ap_scoreboard_e sb_type)
   {
       int running_gen = 0;
       if (ap_scoreboard_image)
   	running_gen = ap_scoreboard_image->global.running_generation;
       if (ap_scoreboard_image == NULL) {
  -        setup_shared_mem(p);
  +        if (sb_type == SB_SHARED) {
  +            setup_shared(p);
  +            ap_scoreboard_image->global.sb_type = SB_SHARED;
  +        }
  +        else {
  +            /* A simple malloc will suffice */
  +            char buf[512];
  +            ap_scoreboard_image = (scoreboard *) malloc(SCOREBOARD_SIZE);
  +            if (ap_scoreboard_image == NULL) {
  +                apr_snprintf(buf, sizeof(buf), "%s: cannot allocate scoreboard",
  +                             ap_server_argv0);
  +                perror(buf); /* o.k. since MM sets errno */
  +                exit(APEXIT_INIT);            
  +            }
  +            ap_scoreboard_image->global.sb_type = SB_NOT_SHARED;
  +        }
       }
       memset(ap_scoreboard_image, 0, SCOREBOARD_SIZE);
       ap_scoreboard_image->global.running_generation = running_gen;
  +    apr_register_cleanup(p, NULL, ap_cleanup_scoreboard, apr_null_cleanup);
  +}
  +
  +/* ToDo:
  + * reinit_scoreboard should be eliminated when all MPMs migrate to
  + * ap_create_scoreboard()
  + */
  +void reinit_scoreboard(apr_pool_t *p)
  +{
  +    ap_create_scoreboard(p, SB_SHARED);
   }
   
   /* Routines called to deal with the scoreboard image
  @@ -147,7 +207,7 @@
    * anyway.
    */
   
  -apr_inline void ap_sync_scoreboard_image(void)
  +void ap_sync_scoreboard_image(void)
   {
   }
   
  
  
  
  1.3       +5 -0      httpd-2.0/server/mpm/winnt/mpm.h
  
  Index: mpm.h
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/server/mpm/winnt/mpm.h,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- mpm.h	2000/07/13 21:27:37	1.2
  +++ mpm.h	2001/02/02 21:32:33	1.3
  @@ -59,5 +59,10 @@
   #ifndef APACHE_MPM_H
   #define APACHE_MPM_H
   
  +/* mpm.h is the place to make declarations that are MPM specific but that must be 
  + * shared with non-mpm specific code in the server.  Hummm, perhaps we can
  + * move most of this stuff to mpm_common.h?
  + */
  +extern int ap_threads_per_child;
   
   #endif /* APACHE_MPM_H */
  
  
  
  1.6       +3 -0      httpd-2.0/server/mpm/winnt/mpm_default.h
  
  Index: mpm_default.h
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/server/mpm/winnt/mpm_default.h,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- mpm_default.h	2000/07/30 04:53:33	1.5
  +++ mpm_default.h	2001/02/02 21:32:33	1.6
  @@ -59,6 +59,9 @@
   #ifndef APACHE_MPM_DEFAULT_H
   #define APACHE_MPM_DEFAULT_H
   
  +/* AP_CHILD_THREAD_FROM_ID is used by the scoreboard.  */
  +#define AP_CHILD_THREAD_FROM_ID(i)       i, 0
  +
   /* Number of threads to spawn off by default --- also, if fewer than
    * this free when the caretaker checks, it will spawn more.
    */
  
  
  
  1.129     +17 -1     httpd-2.0/server/mpm/winnt/mpm_winnt.c
  
  Index: mpm_winnt.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/server/mpm/winnt/mpm_winnt.c,v
  retrieving revision 1.128
  retrieving revision 1.129
  diff -u -r1.128 -r1.129
  --- mpm_winnt.c	2001/01/27 21:28:28	1.128
  +++ mpm_winnt.c	2001/02/02 21:32:33	1.129
  @@ -1,3 +1,4 @@
  +
   /* ====================================================================
    * The Apache Software License, Version 1.1
    *
  @@ -72,18 +73,20 @@
   #include "mpm_default.h"
   #include "mpm_winnt.h"
   #include "mpm_common.h"
  +#include "scoreboard.h"
   
   typedef HANDLE thread;
   
   /*
    * Definitions of WINNT MPM specific config globals
    */
  +
   static int workers_may_exit = 0;
   static int shutdown_in_progress = 0;
   static unsigned int g_blocked_threads = 0;
   
   static char *ap_pid_fname = NULL;
  -static int ap_threads_per_child = 0;
  +int ap_threads_per_child = 0;
   
   static int max_requests_per_child = 0;
   static HANDLE shutdown_event;	/* used to signal shutdown to parent */
  @@ -119,6 +122,15 @@
   DWORD my_pid;
   DWORD parent_pid;
   
  +/* ap_get_max_daemons and ap_my_generation are used by the scoreboard
  + * code
  + */
  +ap_generation_t volatile ap_my_generation=0; /* Used by the scoreboard */
  +AP_DECLARE(int) ap_get_max_daemons(void)
  +{
  +    return 1;
  +}
  +
   /* This is the helper code to resolve late bound entry points 
    * missing from one or more releases of the Win32 API...
    * but it sure would be nice if we didn't duplicate this code
  @@ -1216,6 +1228,10 @@
       int cld;
       apr_pool_t *pchild;
   
  +    /* Set up the scoreboard. The scoreboard in this MPM only applies to the
  +     * child process and is not shared across processes
  +     */
  +    ap_create_scoreboard(pconf, SB_NOT_SHARED);
   
       /* This is the child process or we are running in single process
        * mode.
  
  
  
  1.23      +0 -2      httpd-2.0/server/mpm/winnt/mpm_winnt.h
  
  Index: mpm_winnt.h
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/server/mpm/winnt/mpm_winnt.h,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- mpm_winnt.h	2000/12/04 19:03:42	1.22
  +++ mpm_winnt.h	2001/02/02 21:32:34	1.23
  @@ -114,9 +114,7 @@
   /* From winnt.c: */
   
   extern OSVERSIONINFO osver;
  -extern int ap_threads_per_child;
   extern int ap_max_requests_per_child;
  -extern int ap_extended_status;
   extern void clean_child_exit(int);
   
   AP_DECLARE(void) ap_start_shutdown(void);
  
  
  

Mime
View raw message