dgaudet     98/07/20 09:37:15

  Modified:    src      CHANGES
               src/include ap_config.h
               src/main http_main.c
  Log:
  serialized accepts for OS/2
  
  Submitted by: Brian Havard
  
  Revision  Changes    Path
  1.972     +2 -0      apache-1.3/src/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /export/home/cvs/apache-1.3/src/CHANGES,v
  retrieving revision 1.971
  retrieving revision 1.972
  diff -u -r1.971 -r1.972
  --- CHANGES   1998/07/20 16:33:56     1.971
  +++ CHANGES   1998/07/20 16:37:05     1.972
  @@ -1,4 +1,6 @@
   Changes with Apache 1.3.2
  +  
  +  *) PORT: implement serialized accepts for OS/2.  [Brian Havard]
   
     *) mod_include had problems with the fsize and flastmod directives
        under WIN32.  Fix also avoids the minor security hole of using
  
  
  
  1.228     +1 -0      apache-1.3/src/include/ap_config.h
  
  Index: ap_config.h
  ===================================================================
  RCS file: /export/home/cvs/apache-1.3/src/include/ap_config.h,v
  retrieving revision 1.227
  retrieving revision 1.228
  diff -u -r1.227 -r1.228
  --- ap_config.h       1998/07/18 15:30:43     1.227
  +++ ap_config.h       1998/07/20 16:37:09     1.228
  @@ -671,6 +671,7 @@
   #define MAXSOCKETS 4096
   #define USE_OS2_SCOREBOARD
   #define NO_RELIABLE_PIPED_LOGS
  +#define USE_OS2SEM_SERIALIZED_ACCEPT
   
   #elif defined(__MACHTEN__)
   typedef int rlim_t;
  
  
  
  1.375     +64 -0     apache-1.3/src/main/http_main.c
  
  Index: http_main.c
  ===================================================================
  RCS file: /export/home/cvs/apache-1.3/src/main/http_main.c,v
  retrieving revision 1.374
  retrieving revision 1.375
  diff -u -r1.374 -r1.375
  --- http_main.c       1998/07/14 09:57:56     1.374
  +++ http_main.c       1998/07/20 16:37:11     1.375
  @@ -190,6 +190,7 @@
       /* Add MMAP style functionality to OS/2 */
   #define INCL_DOSMEMMGR
   #define INCL_DOSEXCEPTIONS
  +#define INCL_DOSSEMAPHORES
   #include <os2.h>
   #include <umalloc.h>
   #include <stdio.h>
  @@ -834,6 +835,69 @@
       if (flock(lock_fd, LOCK_UN) < 0) {
        ap_log_error(APLOG_MARK, APLOG_EMERG, server_conf,
                    "flock: LOCK_UN: Error freeing accept lock. Exiting!");
  +     clean_child_exit(APEXIT_CHILDFATAL);
  +    }
  +}
  +
  +#elif defined(USE_OS2SEM_SERIALIZED_ACCEPT)
  +
  +static HMTX lock_sem = -1;
  +
  +static void accept_mutex_cleanup(void *foo)
  +{
  +    DosCloseMutexSem(lock_sem);
  +}
  +
  +/*
  + * Initialize mutex lock.
  + * Done by each child at it's birth
  + */
  +static void accept_mutex_child_init(pool *p)
  +{
  +    int rc = DosOpenMutexSem(NULL, &lock_sem);
  +
  +    if (rc != 0) {
  +     ap_log_error(APLOG_MARK, APLOG_EMERG, server_conf,
  +                 "Child cannot open lock semaphore");
  +     clean_child_exit(APEXIT_CHILDINIT);
  +    }
  +}
  +
  +/*
  + * Initialize mutex lock.
  + * Must be safe to call this on a restart.
  + */
  +static void accept_mutex_init(pool *p)
  +{
  +    int rc = DosCreateMutexSem(NULL, &lock_sem, DC_SEM_SHARED, FALSE);
  +
  +    if (rc != 0) {
  +     ap_log_error(APLOG_MARK, APLOG_EMERG, server_conf,
  +                 "Parent cannot create lock semaphore");
  +     exit(APEXIT_INIT);
  +    }
  +
  +    ap_register_cleanup(p, NULL, accept_mutex_cleanup, ap_null_cleanup);
  +}
  +
  +static void accept_mutex_on(void)
  +{
  +    int rc = DosRequestMutexSem(lock_sem, SEM_INDEFINITE_WAIT);
  +
  +    if (rc != 0) {
  +     ap_log_error(APLOG_MARK, APLOG_EMERG, server_conf,
  +                 "OS2SEM: Error %d getting accept lock. Exiting!", rc);
  +     clean_child_exit(APEXIT_CHILDFATAL);
  +    }
  +}
  +
  +static void accept_mutex_off(void)
  +{
  +    int rc = DosReleaseMutexSem(lock_sem);
  +    
  +    if (rc != 0) {
  +     ap_log_error(APLOG_MARK, APLOG_EMERG, server_conf,
  +                 "OS2SEM: Error %d freeing accept lock. Exiting!", rc);
        clean_child_exit(APEXIT_CHILDFATAL);
       }
   }
  
  
  

Reply via email to