ben 00/01/22 17:13:48
Modified: src/lib/apr configure.in
src/lib/apr/include apr_portable.h
src/lib/apr/locks/unix crossproc.c locks.h
src/lib/apr/time/unix timestr.c
Log:
Make interprocess mutexes actually choose, fix semaphore mutexes.
Revision Changes Path
1.46 +37 -38 apache-2.0/src/lib/apr/configure.in
Index: configure.in
===================================================================
RCS file: /export/home/cvs/apache-2.0/src/lib/apr/configure.in,v
retrieving revision 1.45
retrieving revision 1.46
diff -u -r1.45 -r1.46
--- configure.in 2000/01/19 01:14:49 1.45
+++ configure.in 2000/01/23 01:13:44 1.46
@@ -161,43 +161,6 @@
AC_CHECK_DEFINE(LOCK_EX, sys/file.h)
AC_CHECK_DEFINE(F_SETLK, fcntl.h)
-dnl Checks for libraries.
-AC_BEGIN_DECISION([lock implementation method])
-AC_IFALLYES(header:sys/file.h define:LOCK_EX,
- AC_DECIDE(USE_FLOCK_SERIALIZE, [4.2BSD-style flock()]))
-AC_IFALLYES(header:sys/ipc.h header:sys/sem.h header:sys/file.h dnl
- func:semget func:semctl,
- AC_DECIDE(USE_SYSVSEM_SERIALIZE, [SysV IPC semget()]))
-AC_IFALLYES(header:fcntl.h define:F_SETLK,
- AC_DECIDE(USE_FCNTL_SERIALIZE, [SVR4-style fcntl()]))
-AC_IFALLYES(header:pthread.h define:PTHREAD_PROCESS_SHARED dnl
- custom:use_pthread_cross,
- AC_DECIDE(USE_PROC_PTHREAD_SERIALIZE, [pthread mutex]))
-AC_DECISION_FORCE(USE_FCNTL_SERIALIZE)
-AC_END_DECISION
-AC_DEFINE_UNQUOTED($ac_decision)
-
-if test ".$ac_decision" = ".USE_FLOCK_SERIALIZE"; then
- flockser="1"
-else
- flockser="0"
-fi
-if test ".$ac_decision" = ".USE_SYSVSEM_SERIALIZE"; then
- sysvser="1"
-else
- sysvser="0"
-fi
-if test ".$ac_decision" = ".USE_FCNTL_SERIALIZE"; then
- fcntlser="1"
-else
- fcntlser="0"
-fi
-if test ".$ac_decision" = ".USE_PROC_PTHREAD_SERIALIZE"; then
- procpthreadser="1"
-else
- procpthreadser="0"
-fi
-
ac_cv_define_READDIR_IS_THREAD_SAFE=no
AC_CHECK_LIB(c_r, readdir, AC_DEFINE(READDIR_IS_THREAD_SAFE))
@@ -322,7 +285,7 @@
],[
union semun arg;
semctl(0, 0, 0, arg);
-], AC_DEFINE(HAVE_STRUCT_UNION_SEMUN)
+], [AC_DEFINE(HAVE_STRUCT_UNION_SEMUN) union_semun=yes]
msg=yes,dnl
msg=no)
AC_MSG_RESULT([$msg])
@@ -352,6 +315,42 @@
AC_SUBST(inet_network)
AC_CHECK_FUNCS(gmtime_r localtime_r)
+
+dnl Checks for libraries.
+AC_BEGIN_DECISION([lock implementation method])
+AC_IFALLYES(header:sys/file.h define:LOCK_EX,
+ AC_DECIDE(USE_FLOCK_SERIALIZE, [4.2BSD-style flock()]))
+AC_IFALLYES(header:fcntl.h define:F_SETLK,
+ AC_DECIDE(USE_FCNTL_SERIALIZE, [SVR4-style fcntl()]))
+AC_IFALLYES(custom:union_semun,
+ AC_DECIDE(USE_SYSVSEM_SERIALIZE, [SysV IPC semget()]))
+AC_IFALLYES(header:pthread.h define:PTHREAD_PROCESS_SHARED dnl
+ custom:use_pthread_cross,
+ AC_DECIDE(USE_PROC_PTHREAD_SERIALIZE, [pthread mutex]))
+dnl AC_DECISION_FORCE(USE_FCNTL_SERIALIZE)
+AC_END_DECISION
+AC_DEFINE_UNQUOTED($ac_decision)
+
+if test ".$ac_decision" = ".USE_FLOCK_SERIALIZE"; then
+ flockser="1"
+else
+ flockser="0"
+fi
+if test ".$ac_decision" = ".USE_SYSVSEM_SERIALIZE"; then
+ sysvser="1"
+else
+ sysvser="0"
+fi
+if test ".$ac_decision" = ".USE_FCNTL_SERIALIZE"; then
+ fcntlser="1"
+else
+ fcntlser="0"
+fi
+if test ".$ac_decision" = ".USE_PROC_PTHREAD_SERIALIZE"; then
+ procpthreadser="1"
+else
+ procpthreadser="0"
+fi
dnl Start building stuff from our information
AC_SUBST(LDLIBS)
1.19 +3 -0 apache-2.0/src/lib/apr/include/apr_portable.h
Index: apr_portable.h
===================================================================
RCS file: /export/home/cvs/apache-2.0/src/lib/apr/include/apr_portable.h,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- apr_portable.h 2000/01/09 20:58:22 1.18
+++ apr_portable.h 2000/01/23 01:13:45 1.19
@@ -81,6 +81,9 @@
#if APR_HAVE_PTHREAD_H
#include <pthread.h>
#endif
+#ifdef HAVE_STRUCT_UNION_SEMUN
+#include <sys/sem.h>
+#endif
#ifdef WIN32
/* The primitives for Windows types */
1.11 +7 -5 apache-2.0/src/lib/apr/locks/unix/crossproc.c
Index: crossproc.c
===================================================================
RCS file: /export/home/cvs/apache-2.0/src/lib/apr/locks/unix/crossproc.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- crossproc.c 1999/12/03 15:18:27 1.10
+++ crossproc.c 2000/01/23 01:13:46 1.11
@@ -56,12 +56,14 @@
#include "locks.h"
#if defined (USE_SYSVSEM_SERIALIZE)
-ap_status_t lock_cleanup(struct lock_t *lock)
+ap_status_t lock_cleanup(void *lock_)
{
+ struct lock_t *lock=lock_;
union semun ick;
+
if (lock->curr_locked == 1) {
ick.val = 0;
- semctl(new->interproc, 0, IPC_RMID, ick);
+ semctl(lock->interproc, 0, IPC_RMID, ick);
}
return APR_SUCCESS;
}
@@ -71,7 +73,7 @@
union semun ick;
struct semid_ds buf;
- new->interproc = semget(IPC_PRIVATE, 1, IPC_CREATE | 0600);
+ new->interproc = semget(IPC_PRIVATE, 1, IPC_CREAT | 0600);
if (new->interproc < 0) {
lock_cleanup(new);
@@ -97,7 +99,7 @@
ap_status_t lock_inter(struct lock_t *lock)
{
- new->curr_locked = 1;
+ lock->curr_locked = 1;
if (semop(lock->interproc, &lock->op_on, 1) < 0) {
return errno;
}
@@ -109,7 +111,7 @@
if (semop(lock->interproc, &lock->op_off, 1) < 0) {
return errno;
}
- new->curr_locked = 0;
+ lock->curr_locked = 0;
return APR_SUCCESS;
}
1.9 +4 -1 apache-2.0/src/lib/apr/locks/unix/locks.h
Index: locks.h
===================================================================
RCS file: /export/home/cvs/apache-2.0/src/lib/apr/locks/unix/locks.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- locks.h 1999/12/06 18:58:28 1.8
+++ locks.h 2000/01/23 01:13:47 1.9
@@ -88,6 +88,9 @@
#if HAVE_FCNTL_H
#include <fcntl.h>
#endif
+#ifdef HAVE_STRUCT_UNION_SEMUN
+#include <sys/sem.h>
+#endif
#if APR_HAS_THREADS
#if HAVE_PTHREAD_H
@@ -96,7 +99,7 @@
#endif
/* End System Headers */
-#ifndef HAVE_UNION_SEMUN
+#ifndef HAVE_STRUCT_UNION_SEMUN
/* it makes no sense, but this isn't defined on solaris */
union semun {
long val;
1.8 +3 -0 apache-2.0/src/lib/apr/time/unix/timestr.c
Index: timestr.c
===================================================================
RCS file: /export/home/cvs/apache-2.0/src/lib/apr/time/unix/timestr.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- timestr.c 2000/01/19 01:51:30 1.7
+++ timestr.c 2000/01/23 01:13:47 1.8
@@ -56,6 +56,8 @@
#include "atime.h"
#include "apr_portable.h"
+#include <string.h>
+
API_VAR_EXPORT const char ap_month_snames[12][4] =
{
"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct",
"Nov", "Dec"
@@ -159,6 +161,7 @@
const char *format, ap_exploded_time_t *xt)
{
struct tm tm;
+
memset(&tm, 0, sizeof tm);
tm.tm_sec = xt->tm_sec;
tm.tm_min = xt->tm_min;