Mailing List Archive

[6875] cherokee/trunk: We are not longer using shm_open().
Revision: 6875
http://svn.cherokee-project.com/changeset/6875
Author: alo
Date: 2011-10-01 11:27:35 +0200 (Sat, 01 Oct 2011)
Log Message:
-----------
We are not longer using shm_open(). Removes the last few references to
POSIX shared memory.

Modified Paths:
--------------
cherokee/trunk/cherokee/Makefile.am
cherokee/trunk/cherokee/main.c
cherokee/trunk/cherokee/source_interpreter.c
cherokee/trunk/cherokee/spawner.c
cherokee/trunk/configure.in

Modified: cherokee/trunk/cherokee/Makefile.am
===================================================================
--- cherokee/trunk/cherokee/Makefile.am 2011-10-01 09:27:31 UTC (rev 6874)
+++ cherokee/trunk/cherokee/Makefile.am 2011-10-01 09:27:35 UTC (rev 6875)
@@ -1335,13 +1335,7 @@
win32_cservice.c
endif

-if USE_POSIX_SHM
-shm_src = \
-shm.h \
-shm.c
-endif

-
libcherokee_base_la_SOURCES = \
$(zlib_src) \
$(internal_pcre_src) \
@@ -1353,7 +1347,6 @@
$(poll_select_src) \
$(poll_win32_src) \
$(win32_src) \
-$(shm_src) \
cherokee.h \
init.h \
init.c \
@@ -1447,7 +1440,9 @@
logger_writer.h \
logger_writer.c \
xrealip.h \
-xrealip.c
+xrealip.c \
+shm.h \
+shm.c


libcherokee_client_la_SOURCES = \
@@ -1827,7 +1822,6 @@
error_list.py \
errors.h \
errors_defs.h \
-$(shm_src) \
$(pcre_src) \
$(win32_src) \
$(getopt_src) \

Modified: cherokee/trunk/cherokee/main.c
===================================================================
--- cherokee/trunk/cherokee/main.c 2011-10-01 09:27:31 UTC (rev 6874)
+++ cherokee/trunk/cherokee/main.c 2011-10-01 09:27:35 UTC (rev 6875)
@@ -405,7 +405,7 @@
free (pid_file_worker);
}

-#ifdef HAVE_POSIX_SHM
+#ifdef HAVE_SYSV_SEMAPHORES

static void
do_sem_op (int sem_num, int sem_op)
@@ -834,12 +834,14 @@
semctl (spawn_shared_sems, 0, IPC_RMID, dummy);
}
}
-#endif /* HAVE_POSIX_SHM */

+#endif /* HAVE_SYSV_SEMAPHORES */
+
+
static void
clean_up (void)
{
-#ifdef HAVE_POSIX_SHM
+#ifdef HAVE_SYSV_SEMAPHORES
spawn_clean();
#endif
pid_file_clean (pid_file_path);
@@ -1109,7 +1111,7 @@

/* Launch the spawning thread
*/
-#ifdef HAVE_POSIX_SHM
+#ifdef HAVE_SYSV_SEMAPHORES
if (! single_time) {
ret = spawn_init();
if (ret != ret_ok) {

Modified: cherokee/trunk/cherokee/source_interpreter.c
===================================================================
--- cherokee/trunk/cherokee/source_interpreter.c 2011-10-01 09:27:31 UTC (rev 6874)
+++ cherokee/trunk/cherokee/source_interpreter.c 2011-10-01 09:27:35 UTC (rev 6875)
@@ -484,7 +484,6 @@
}


-#ifdef HAVE_POSIX_SHM
static ret_t
_spawn_shm (cherokee_source_interpreter_t *src,
cherokee_logger_writer_t *error_writer)
@@ -530,7 +529,6 @@

return ret_ok;
}
-#endif


static ret_t
@@ -653,7 +651,6 @@

/* Try with SHM first
*/
-#ifdef HAVE_POSIX_SHM
if ((src->spawn_type == spawn_shm) ||
(src->spawn_type == spawn_unknown))
{
@@ -672,7 +669,6 @@
return ret_error;
}
}
-#endif

/* No luck, go 'local' then..
*/

Modified: cherokee/trunk/cherokee/spawner.c
===================================================================
--- cherokee/trunk/cherokee/spawner.c 2011-10-01 09:27:31 UTC (rev 6874)
+++ cherokee/trunk/cherokee/spawner.c 2011-10-01 09:27:35 UTC (rev 6875)
@@ -52,7 +52,7 @@
ret_t
cherokee_spawner_init (void)
{
-#ifdef HAVE_POSIX_SHM
+#ifdef HAVE_SYSV_SEMAPHORES
ret_t ret;
cherokee_buffer_t name = CHEROKEE_BUF_INIT;

@@ -102,13 +102,11 @@
{
CHEROKEE_MUTEX_DESTROY (&spawning_mutex);

-#ifdef HAVE_POSIX_SHM
cherokee_shm_mrproper (&cherokee_spawn_shared);
-#endif
return ret_ok;
}

-#ifdef HAVE_POSIX_SHM
+
static ret_t
write_logger (cherokee_buffer_t *buf,
cherokee_logger_writer_t *error_writer)
@@ -146,8 +144,8 @@
cherokee_buffer_add (buf, (char *)&val, sizeof(int));
return ret_ok;
}
-#endif

+
static ret_t
do_sem_op (int sem_ref, int sem_num, int sem_op)
{
@@ -194,7 +192,7 @@
cherokee_logger_writer_t *error_writer,
pid_t *pid_ret)
{
-#ifdef HAVE_POSIX_SHM
+#ifdef HAVE_SYSV_SEMAPHORES
char **n;
int *pid_shm;
int pid_prev;
@@ -322,6 +320,7 @@
return ret_error;
#else
return ret_not_found;
-#endif
+
+#endif /* HAVE_SYSV_SEMAPHORES */
}


Modified: cherokee/trunk/configure.in
===================================================================
--- cherokee/trunk/configure.in 2011-10-01 09:27:31 UTC (rev 6874)
+++ cherokee/trunk/configure.in 2011-10-01 09:27:35 UTC (rev 6875)
@@ -779,30 +779,7 @@
AC_DEFINE(HAVE_OFF64_T,1,[Whether off64_t is available])
fi

-dnl
-dnl Shared Memory
-dnl
-AC_CHECK_FUNC(shm_open, have_shm_open=yes)

-RT_LIBS=
-if test "$have_shm_open" != "yes"; then
- AC_CHECK_LIB(rt, shm_open, [
- RT_LIBS="-lrt"
- have_shm_open=yes])
-fi
-if test "$have_shm_open" != "yes"; then
- AC_CHECK_LIB(rt, shm_open, [
- RT_LIBS="-lposix4"
- have_shm_open=yes])
-fi
-AC_SUBST(RT_LIBS)
-
-if test "$have_shm_open" = "yes"; then
- AC_DEFINE(HAVE_POSIX_SHM, 1, [Define to 1 to use POSIX shared memory])
-fi
-AM_CONDITIONAL(USE_POSIX_SHM, test "$have_shm_open" = "yes")
-
-
dnl
dnl SYSV Semaphores
dnl