You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by dr...@apache.org on 2001/11/16 02:32:20 UTC

cvs commit: apache-1.3/src/main http_core.c http_main.c

dreid       01/11/15 17:32:20

  Modified:    src/include ap_config.h
               src/main http_core.c http_main.c
  Log:
  Add the serialization stuff for BeOS to get us building again.
  
  Also, stop detaching as it causes a segfault somewhere in the kernel.
  I'll try to find out where and see why...
  
  Revision  Changes    Path
  1.320     +11 -0     apache-1.3/src/include/ap_config.h
  
  Index: ap_config.h
  ===================================================================
  RCS file: /home/cvs/apache-1.3/src/include/ap_config.h,v
  retrieving revision 1.319
  retrieving revision 1.320
  diff -u -r1.319 -r1.320
  --- ap_config.h	2001/11/11 19:46:41	1.319
  +++ ap_config.h	2001/11/16 01:32:20	1.320
  @@ -895,7 +895,11 @@
   #undef PLATFORM
   #define PLATFORM "BeOS"
   #include <stddef.h>
  +#include <kernel/OS.h>
   
  +#define HAVE_BEOS_SERIALIZED_ACCEPT
  +#define SINGLE_LISTEN_UNSERIALIZED_ACCEPT
  +
   #define NO_WRITEV
   #define NO_KILLPG
   #define NEED_INITGROUPS
  @@ -905,9 +909,13 @@
   #elif defined(BONE)
   #undef PLATFORM
   #define PLATFORM "BeOS BONE"
  +#include <kernel/OS.h>
  +
   #define NO_KILLPG
   #define NEED_INITGROUPS
   #define S_IEXEC S_IXUSR
  +#define HAVE_BEOS_SERIALIZED_ACCEPT
  +#define SINGLE_LISTEN_UNSERIALIZED_ACCEPT
   
   #elif defined(_CX_SX)
   #define JMP_BUF sigjmp_buf
  @@ -1224,6 +1232,9 @@
   #endif
   #if defined(USE_TPF_CORE_SERIALIZED_ACCEPT) && !defined(HAVE_TPF_CORE_SERIALIZED_ACCEPT)
   #define HAVE_TPF_CORE_SERIALIZED_ACCEPT
  +#endif
  +#if defined(USE_BEOS_SERIALIZED_ACCEPT) && !defined(HAVE_BEOS_SERIALIZED_ACCEPT)
  +#define HAVE_BEOS_SERIALIZED_ACCEPT
   #endif
   #if defined(USE_NONE_SERIALIZED_ACCEPT) && !defined(HAVE_NONE_SERIALIZED_ACCEPT)
   #define HAVE_NONE_SERIALIZED_ACCEPT
  
  
  
  1.299     +3 -0      apache-1.3/src/main/http_core.c
  
  Index: http_core.c
  ===================================================================
  RCS file: /home/cvs/apache-1.3/src/main/http_core.c,v
  retrieving revision 1.298
  retrieving revision 1.299
  diff -u -r1.298 -r1.299
  --- http_core.c	2001/11/10 19:01:29	1.298
  +++ http_core.c	2001/11/16 01:32:20	1.299
  @@ -3251,6 +3251,9 @@
   #ifdef HAVE_TPF_CORE_SERIALIZED_ACCEPT
       "'tpfcore' "
   #endif
  +#ifdef HAVE_BEOS_SERIALIZED_ACCEPT
  +    "'beos_sem' "
  +#endif
   #ifdef HAVE_NONE_SERIALIZED_ACCEPT
       "'none' "
   #endif
  
  
  
  1.561     +75 -1     apache-1.3/src/main/http_main.c
  
  Index: http_main.c
  ===================================================================
  RCS file: /home/cvs/apache-1.3/src/main/http_main.c,v
  retrieving revision 1.560
  retrieving revision 1.561
  diff -u -r1.560 -r1.561
  --- http_main.c	2001/10/17 14:45:29	1.560
  +++ http_main.c	2001/11/16 01:32:20	1.561
  @@ -1104,6 +1104,65 @@
   };
   #endif
   
  +#ifdef HAVE_BEOS_SERIALIZED_ACCEPT
  +static sem_id _sem = -1;
  +static int  locked = 0;
  +
  +static void accept_mutex_child_cleanup_beos(void *foo)
  +{
  +    if (_sem > 0 && locked)
  +        release_sem(_sem);
  +}
  +
  +static void accept_mutex_child_init_beos(pool *p)
  +{
  +    ap_register_cleanup(p, NULL, accept_mutex_child_cleanup_beos, ap_null_cleanup);
  +    locked = 0;
  +}
  +
  +static void accept_mutex_cleanup_beos(void *foo)
  +{
  +    if (_sem > 0)
  +        delete_sem(_sem);
  +}
  +
  +static void accept_mutex_init_beos(pool *p)
  +{
  +    _sem = create_sem(1, "httpd_accept");
  +    if (_sem < 0) {
  +        ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_EMERG, server_conf,
  +                    "Parent cannot create lock semaphore, sem=%ld", _sem);
  +        exit(APEXIT_INIT);
  +    }
  +
  +    ap_register_cleanup(p, NULL, accept_mutex_cleanup_beos, ap_null_cleanup);
  +}                                                                                                        
  +void accept_mutex_on_beos(void)
  +{
  +    if (locked == 0) {
  +        if (acquire_sem(_sem) == B_OK)
  +            locked = 1;
  +    }
  +}
  +
  +static void accept_mutex_off_beos(void)
  +{
  +    if (locked == 1) {
  +        if (release_sem(_sem) == B_OK)
  +            locked = 0; 
  +    }
  +}
  +
  +accept_mutex_methods_s accept_mutex_beos_s = {
  +    accept_mutex_child_init_beos,
  +    accept_mutex_init_beos,
  +    accept_mutex_on_beos,
  +    accept_mutex_off_beos,
  +    "beos_sem"
  +};
  +#endif /* HAVE_BEOS_SERIALIZED_ACCEPT */
  +
  +
   /* Generally, HAVE_NONE_SERIALIZED_ACCEPT simply won't work but
    * for testing purposes, here it is... */
   #if defined HAVE_NONE_SERIALIZED_ACCEPT
  @@ -1147,6 +1206,8 @@
       t = "os2sem";
   #elif defined USE_TPF_CORE_SERIALIZED_ACCEPT
       t = "tpfcore";
  +#elif defined USE_BEOS_SERIALIZED_ACCEPT
  +    t = "beos_sem";
   #elif defined USE_NONE_SERIALIZED_ACCEPT
       t = "none";
   #else
  @@ -1180,6 +1241,10 @@
       if ((!(strcasecmp(t,"default"))) || (!(strcasecmp(t,"tpfcore"))))
       	return "tpfcore";
   #endif
  +#if defined HAVE_BEOS_SERIALIZED_ACCEPT
  +    if ((!(strcasecmp(t,"default"))) || (!(strcasecmp(t,"beos_sem"))))
  +        return "beos_sem";
  +#endif
   #if defined HAVE_NONE_SERIALIZED_ACCEPT
       if ((!(strcasecmp(t,"default"))) || (!(strcasecmp(t,"none"))))
       	return "none";
  @@ -1231,6 +1296,11 @@
       	amutex = &accept_mutex_tpfcore_s;
       } else 
   #endif
  +#if defined HAVE_BEOS_SERIALIZED_ACCEPT
  +    if (!(strcasecmp(t,"beos_sem"))) {
  +        amutex = &accept_mutex_beos_s;
  +    } else
  +#endif
   #if defined HAVE_NONE_SERIALIZED_ACCEPT
       if (!(strcasecmp(t,"none"))) {
       	amutex = &accept_mutex_none_s;
  @@ -3286,7 +3356,8 @@
       int x;
   
       chdir("/");
  -#if !defined(MPE) && !defined(OS2) && !defined(TPF)
  +#if !defined(MPE) && !defined(OS2) && !defined(TPF) && !defined(BEOS) && \
  +    !defined(BONE)
   /* Don't detach for MPE because child processes can't survive the death of
      the parent. */
       if ((x = fork()) > 0)
  @@ -3950,6 +4021,9 @@
   #ifdef HAVE_TPF_CORE_SERIALIZED_ACCEPT
       printf(" -D HAVE_TPF_CORE_SERIALIZED_ACCEPT\n");
   #endif
  +#ifdef HAVE_BEOS_SERIALIZED_ACCEPT
  +    printf(" -D HAVE_BEOS_SERIALIZED_ACCEPT\n");
  +#endif  
   #ifdef HAVE_NONE_SERIALIZED_ACCEPT
       printf(" -D HAVE_NONE_SERIALIZED_ACCEPT\n");
   #endif