#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
#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
#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
#endif
};
#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
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
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";
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;
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)
#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