[evolution-patches] Patch for 67600



With this patch, I'll also commit a ChangeLog and a newly generated
configure file. That should fix the remaining problem on #65996 too.

Intended for gnome-2-8 and HEAD (yeah, I know I don't need approval for
HEAD).

-- 
Hans Petter
? 67600.diff
Index: dbinc/mutex.h
===================================================================
RCS file: /cvs/gnome/evolution-data-server/libdb/dbinc/mutex.h,v
retrieving revision 1.1.1.1.14.1
diff -u -p -r1.1.1.1.14.1 mutex.h
--- dbinc/mutex.h	21 Sep 2004 22:36:49 -0000	1.1.1.1.14.1
+++ dbinc/mutex.h	8 Oct 2004 20:20:00 -0000
@@ -542,13 +542,17 @@ success:				\n\
 	bne 1f;				\
 	stwcx. %2,0,%1;			\
 	bne- 0b;			\
+	isync;				\
 1:"					\
 	: "=&r" (__r)			\
 	: "r" (__l), "r" (__one));	\
 	!(__r & 1);			\
 })
 #endif
-#define	MUTEX_UNSET(tsl)	(*(tsl) = 0)
+#define	MUTEX_UNSET(tsl)	({					\
+		asm volatile("lwsync # MUTEX_UNSET ":::"memory");	\
+		(*(tsl) = 0);						\
+	})
 #define	MUTEX_INIT(tsl)		MUTEX_UNSET(tsl)
 #endif
 #endif
@@ -666,6 +670,40 @@ typedef int tsl_t;
 #endif
 
 /*********************************************************************
+ * MIPS/gcc assembly.
+ *********************************************************************/
+#ifdef HAVE_MUTEX_MIPS_GCC_ASSEMBLY
+typedef unsigned int tsl_t;
+#define MUTEX_ALIGN     sizeof(unsigned int)
+
+#ifdef LOAD_ACTUAL_MUTEX_CODE
+/*
+ * For gcc/MIPS;
+ */
+#define MUTEX_SET(tsl) ({                                               \
+        tsl_t tmp, res;                                                 \
+        register tsl_t *__l = (tsl);                                    \
+        __asm__ __volatile__(                                           \
+                ".set\tnoreorder\t\t# test_and_set_bit\n"               \
+                "1:\tll\t%0, %1\n\t"                                    \
+                "ori\t%2, %0, 1\n\t"                                    \
+                "sc\t%2, %1\n\t"                                        \
+                "beqz\t%2, 1b\n\t"                                      \
+                " andi\t%2, %0, 1\n\t"                                  \
+                "sync\n\t"                                              \
+                ".set\treorder"                                         \
+                : "=&r" (tmp), "=m" (*__l), "=&r" (res)                 \
+                : "m" (*__l)                                            \
+                : "memory");                                            \
+                (res ^ 1) & 1;                                          \
+})
+
+#define	MUTEX_UNSET(tsl)	(*(tsl) = 0)
+#define	MUTEX_INIT(tsl)		MUTEX_UNSET(tsl)
+#endif
+#endif
+
+/*********************************************************************
  * x86/gcc assembly.
  *********************************************************************/
 #ifdef HAVE_MUTEX_X86_GCC_ASSEMBLY
@@ -713,6 +751,61 @@ typedef unsigned char tsl_t;
 #define  MUTEX_UNSET(tsl)  (*(tsl) = 0)
 #define  MUTEX_INIT(tsl)   MUTEX_UNSET(tsl)
 #endif
+#endif
+
+/*********************************************************************
+ * x86_64/gcc assembly.
+ *********************************************************************/
+#ifdef HAVE_MUTEX_X86_64_GCC_ASSEMBLY
+typedef unsigned char tsl_t;
+
+#ifdef LOAD_ACTUAL_MUTEX_CODE
+/*
+ * For gcc/x86-64, 0 is clear, 1 is set.
+ */
+#define	MUTEX_SET(tsl) ({						\
+	register tsl_t *__l = (tsl);					\
+	int __r;							\
+	asm volatile("movq $1,%%rax; lock; xchgb %1,%%al; xorq $1,%%rax"\
+	    : "=&a" (__r), "=m" (*__l)					\
+	    : "1" (*__l)						\
+	    );								\
+	__r & 1;							\
+})
+
+#define	MUTEX_UNSET(tsl)	(*(tsl) = 0)
+#define	MUTEX_INIT(tsl)		MUTEX_UNSET(tsl)
+#endif
+#endif
+
+/*********************************************************************
+ * alphalinux/gcc assembly.
+ *********************************************************************/
+#ifdef HAVE_MUTEX_ALPHA_LINUX_ASSEMBLY
+typedef unsigned long int tsl_t;
+
+#define	MUTEX_ALIGN	8
+#endif
+
+/*********************************************************************
+ * sparc32linux/gcc assembly.
+ *********************************************************************/
+#ifdef HAVE_MUTEX_SPARC32_LINUX_ASSEMBLY
+typedef unsigned char tsl_t;
+#endif
+
+/*********************************************************************
+ * sparc64linux/gcc assembly.
+ *********************************************************************/
+#ifdef HAVE_MUTEX_SPARC64_LINUX_ASSEMBLY
+typedef unsigned char tsl_t;
+#endif
+
+/*********************************************************************
+ * s390linux/gcc assembly.
+ *********************************************************************/
+#ifdef HAVE_MUTEX_S390_LINUX_ASSEMBLY
+typedef volatile int tsl_t;
 #endif
 
 /*
Index: dist/config.hin
===================================================================
RCS file: /cvs/gnome/evolution-data-server/libdb/dist/config.hin,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 config.hin
--- dist/config.hin	20 Nov 2003 22:13:21 -0000	1.1.1.1
+++ dist/config.hin	8 Oct 2004 20:20:00 -0000
@@ -91,6 +91,9 @@
 /* Define to 1 to use the GCC compiler and Alpha assembly language mutexes. */
 #undef HAVE_MUTEX_ALPHA_GCC_ASSEMBLY
 
+/* Define to use the GCC compiler and alpha assembly language mutexes. */
+#undef HAVE_MUTEX_ALPHA_LINUX_ASSEMBLY
+
 /* Define to 1 to use the GCC compiler and ARM assembly language mutexes. */
 #undef HAVE_MUTEX_ARM_GCC_ASSEMBLY
 
@@ -107,6 +110,9 @@
 /* Define to 1 to use the GCC compiler and IA64 assembly language mutexes. */
 #undef HAVE_MUTEX_IA64_GCC_ASSEMBLY
 
+/* Define to 1 to use the GCC compiler and Mips assembly language mutexes. */
+#undef HAVE_MUTEX_MIPS_GCC_ASSEMBLY
+
 /* Define to 1 to use the msem_XXX mutexes on systems other than HP-UX. */
 #undef HAVE_MUTEX_MSEM_INIT
 
@@ -126,6 +132,9 @@
 /* Define to 1 to use the GCC compiler and S/390 assembly language mutexes. */
 #undef HAVE_MUTEX_S390_GCC_ASSEMBLY
 
+/* Define to use the GCC compiler and s390 assembly language mutexes. */
+#undef HAVE_MUTEX_S390_LINUX_ASSEMBLY
+
 /* Define to 1 to use the SCO compiler and x86 assembly language mutexes. */
 #undef HAVE_MUTEX_SCO_X86_CC_ASSEMBLY
 
@@ -141,6 +150,12 @@
 /* Define to 1 to use the Solaris lwp threads mutexes. */
 #undef HAVE_MUTEX_SOLARIS_LWP
 
+/* Define to use the GCC compiler and sparc64 assembly language mutexes. */
+#undef HAVE_MUTEX_SPARC32_LINUX_ASSEMBLY
+
+/* Define to use the GCC compiler and sparc64 assembly language mutexes. */
+#undef HAVE_MUTEX_SPARC64_LINUX_ASSEMBLY
+
 /* Define to 1 to use the GCC compiler and Sparc assembly language mutexes. */
 #undef HAVE_MUTEX_SPARC_GCC_ASSEMBLY
 
@@ -167,6 +182,9 @@
 
 /* Define to 1 to use Windows mutexes. */
 #undef HAVE_MUTEX_WIN32
+
+/* Define to 1 to use the GCC compiler and amd64 assembly language mutexes. */
+#undef HAVE_MUTEX_X86_64_GCC_ASSEMBLY
 
 /* Define to 1 to use the GCC compiler and x86 assembly language mutexes. */
 #undef HAVE_MUTEX_X86_GCC_ASSEMBLY
Index: dist/aclocal/libtool.ac
===================================================================
RCS file: /cvs/gnome/evolution-data-server/libdb/dist/aclocal/libtool.ac,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 libtool.ac
--- dist/aclocal/libtool.ac	20 Nov 2003 22:13:27 -0000	1.1.1.1
+++ dist/aclocal/libtool.ac	8 Oct 2004 20:20:01 -0000
@@ -3428,7 +3428,7 @@ irix5* | irix6*)
 # This must be Linux ELF.
 linux-gnu*)
   case $host_cpu in
-  alpha* | hppa* | i*86 | powerpc* | sparc* | ia64* )
+  alpha* | hppa* | i*86 | powerpc* | sparc* | ia64* | *)
     lt_cv_deplibs_check_method=pass_all ;;
   *)
     # glibc up to 2.1.1 does not perform some relocations on ARM
Index: dist/aclocal/mutex.ac
===================================================================
RCS file: /cvs/gnome/evolution-data-server/libdb/dist/aclocal/mutex.ac,v
retrieving revision 1.1.1.1.14.1
diff -u -p -r1.1.1.1.14.1 mutex.ac
--- dist/aclocal/mutex.ac	21 Sep 2004 22:36:49 -0000	1.1.1.1.14.1
+++ dist/aclocal/mutex.ac	8 Oct 2004 20:20:01 -0000
@@ -226,7 +226,7 @@ fi
 if test "$db_cv_mutex" = no; then
 AC_TRY_LINK([
 #include <sys/mman.h>],[
-#if defined(__hppa)
+#if defined(__hppa__)
 	typedef msemaphore tsl_t;
 	msemaphore x;
 	msem_init(&x, 0);
@@ -352,6 +352,17 @@ AC_TRY_COMPILE(,[
 ], [db_cv_mutex="ARM/gcc-assembly"])
 fi
 
+# MIPS/gcc: Linux
+if test "$db_cv_mutex" = no; then
+AC_TRY_COMPILE(,[
+#if (defined(__mips) || defined(__mips__)) && defined(__GNUC__)
+	exit(0);
+#else
+	FAIL TO COMPILE/LINK
+#endif
+], [db_cv_mutex="MIPS/gcc-assembly"])
+fi
+
 # PaRisc/gcc: HP/UX
 if test "$db_cv_mutex" = no; then
 AC_TRY_COMPILE(,[
@@ -439,6 +450,18 @@ AC_TRY_COMPILE(,[
 ], [db_cv_mutex="x86_64/gcc-assembly"])
 fi
 
+# x86-64/gcc: FreeBSD, NetBSD, BSD/OS, Linux
+if test "$db_cv_mutex" = no; then
+AC_TRY_RUN([main(){
+#if defined(__x86_64__)
+#if defined(__GNUC__)
+	exit(0);
+#endif
+#endif
+	exit(1);
+}], [db_cv_mutex="x86_64/gcc-assembly"])
+fi
+
 # ia86/gcc: Linux
 if test "$db_cv_mutex" = no; then
 AC_TRY_COMPILE(,[
@@ -450,6 +473,53 @@ AC_TRY_COMPILE(,[
 ], [db_cv_mutex="ia64/gcc-assembly"])
 fi
 
+dnl alphalinux/gcc: Linux
+if test "$db_cv_mutex" = no; then
+AC_TRY_RUN([main(){
+#if defined(__alpha__)
+#if defined(__linux__)
+       exit(0);
+#endif
+#endif
+       exit(1);
+}], [db_cv_mutex="alphalinux/gcc-assembly"])
+fi
+
+dnl sparc32linux/gcc: Linux
+if test "$db_cv_mutex" = no; then
+AC_TRY_RUN([main(){
+#if defined(__sparc__) && !defined(__arch64__)
+#if defined(__linux__)
+       exit(0);
+#endif
+#endif
+       exit(1);
+}], [db_cv_mutex="sparc32linux/gcc-assembly"])
+fi
+
+dnl sparc64linux/gcc: Linux
+if test "$db_cv_mutex" = no; then
+AC_TRY_RUN([main(){
+#if defined(__sparc__) && defined(__arch64__)
+#if defined(__linux__)
+       exit(0);
+#endif
+#endif
+       exit(1);
+}], [db_cv_mutex="sparc64linux/gcc-assembly"])
+fi
+
+dnl s390linux/gcc: Linux
+if test "$db_cv_mutex" = no; then
+AC_TRY_RUN([main(){
+#if defined(__linux__) && defined(__s390__)
+       exit(0);
+#endif
+       exit(1);
+}], [db_cv_mutex="s390linux/gcc-assembly"])
+fi
+
+
 # uts/cc: UTS
 if test "$db_cv_mutex" = no; then
 AC_TRY_COMPILE(,[
@@ -580,6 +650,10 @@ UTS/cc-assembly)	ADDITIONAL_OBJS="$ADDIT
 			AC_DEFINE(HAVE_MUTEX_UTS_CC_ASSEMBLY)
 			AH_TEMPLATE(HAVE_MUTEX_UTS_CC_ASSEMBLY,
 			    [Define to 1 to use the UTS compiler and assembly language mutexes.]);;
+MIPS/gcc-assembly)	ADDITIONAL_OBJS="mut_tas${o} $ADDITIONAL_OBJS"
+			AC_DEFINE(HAVE_MUTEX_MIPS_GCC_ASSEMBLY)
+			AH_TEMPLATE(HAVE_MUTEX_MIPS_GCC_ASSEMBLY,
+			    [Define to 1 to use the GCC compiler and Mips assembly language mutexes.]);;
 x86/gcc-assembly)	ADDITIONAL_OBJS="mut_tas${o} $ADDITIONAL_OBJS"
 			AC_DEFINE(HAVE_MUTEX_X86_GCC_ASSEMBLY)
 			AH_TEMPLATE(HAVE_MUTEX_X86_GCC_ASSEMBLY,
@@ -588,6 +662,22 @@ x86_64/gcc-assembly)	ADDITIONAL_OBJS="mu
 			AC_DEFINE(HAVE_MUTEX_X86_64_GCC_ASSEMBLY)
 			AH_TEMPLATE(HAVE_MUTEX_X86_64_GCC_ASSEMBLY,
 			    [Define to 1 to use the GCC compiler and amd64 assembly language mutexes.]);;
+alphalinux/gcc-assembly)	ADDITIONAL_OBJS="mut_tas${o} $ADDITIONAL_OBJS"
+			AC_DEFINE(HAVE_MUTEX_ALPHA_LINUX_ASSEMBLY)
+			AH_TEMPLATE(HAVE_MUTEX_ALPHA_LINUX_ASSEMBLY,
+			   [Define to use the GCC compiler and alpha assembly language mutexes.]);;
+sparc32linux/gcc-assembly)	ADDITIONAL_OBJS="mut_tas${o} $ADDITIONAL_OBJS"
+			AC_DEFINE(HAVE_MUTEX_SPARC32_LINUX_ASSEMBLY)
+			AH_TEMPLATE(HAVE_MUTEX_SPARC32_LINUX_ASSEMBLY,
+			   [Define to use the GCC compiler and sparc64 assembly language mutexes.]);;
+sparc64linux/gcc-assembly)	ADDITIONAL_OBJS="mut_tas${o} $ADDITIONAL_OBJS"
+			AC_DEFINE(HAVE_MUTEX_SPARC64_LINUX_ASSEMBLY)
+			AH_TEMPLATE(HAVE_MUTEX_SPARC64_LINUX_ASSEMBLY,
+			   [Define to use the GCC compiler and sparc64 assembly language mutexes.]);;
+s390linux/gcc-assembly)	ADDITIONAL_OBJS="mut_tas${o} $ADDITIONAL_OBJS"
+			AC_DEFINE(HAVE_MUTEX_S390_LINUX_ASSEMBLY)
+			AH_TEMPLATE(HAVE_MUTEX_S390_LINUX_ASSEMBLY,
+			   [Define to use the GCC compiler and s390 assembly language mutexes.]);;
 UNIX/fcntl)		AC_MSG_WARN(
 			    [NO FAST MUTEXES FOUND FOR THIS COMPILER/ARCHITECTURE.])
 			ADDITIONAL_OBJS="mut_fcntl${o} $ADDITIONAL_OBJS"
Index: lock/lock_region.c
===================================================================
RCS file: /cvs/gnome/evolution-data-server/libdb/lock/lock_region.c,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 lock_region.c
--- lock/lock_region.c	20 Nov 2003 22:13:35 -0000	1.1.1.1
+++ lock/lock_region.c	8 Oct 2004 20:20:01 -0000
@@ -325,22 +325,22 @@ __lock_region_size(dbenv)
 	 * map one-to-one with the __db_shalloc calls in __lock_init.
 	 */
 	retval = 0;
-	retval += __db_shalloc_size(sizeof(DB_LOCKREGION), 1);
-	retval += __db_shalloc_size(dbenv->lk_modes * dbenv->lk_modes, 1);
+	retval += __db_shalloc_size(sizeof(DB_LOCKREGION), sizeof(db_align_t));
+	retval += __db_shalloc_size(dbenv->lk_modes * dbenv->lk_modes, sizeof(db_align_t));
 	retval += __db_shalloc_size(
-	    __db_tablesize(dbenv->lk_max_lockers) * (sizeof(DB_HASHTAB)), 1);
+	    __db_tablesize(dbenv->lk_max_lockers) * (sizeof(DB_HASHTAB)), sizeof(db_align_t));
 	retval += __db_shalloc_size(
-	    __db_tablesize(dbenv->lk_max_objects) * (sizeof(DB_HASHTAB)), 1);
+	    __db_tablesize(dbenv->lk_max_objects) * (sizeof(DB_HASHTAB)), sizeof(db_align_t));
 #ifdef HAVE_MUTEX_SYSTEM_RESOURCES
 	retval +=
-	    __db_shalloc_size(sizeof(REGMAINT) + __lock_region_maint(dbenv), 1);
+	    __db_shalloc_size(sizeof(REGMAINT) + __lock_region_maint(dbenv), sizeof(db_align_t));
 #endif
 	retval += __db_shalloc_size(
 	    sizeof(struct __db_lock), MUTEX_ALIGN) * dbenv->lk_max;
 	retval += __db_shalloc_size(
-	    sizeof(DB_LOCKOBJ), 1) * dbenv->lk_max_objects;
+	    sizeof(DB_LOCKOBJ), sizeof(db_align_t)) * dbenv->lk_max_objects;
 	retval += __db_shalloc_size(
-	    sizeof(DB_LOCKER), 1) * dbenv->lk_max_lockers;
+	    sizeof(DB_LOCKER), sizeof(db_align_t)) * dbenv->lk_max_lockers;
 
 	/*
 	 * Include 16 bytes of string space per lock.  DB doesn't use it
Index: mutex/mut_tas.c
===================================================================
RCS file: /cvs/gnome/evolution-data-server/libdb/mutex/mut_tas.c,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 mut_tas.c
--- mutex/mut_tas.c	20 Nov 2003 22:13:37 -0000	1.1.1.1
+++ mutex/mut_tas.c	8 Oct 2004 20:20:01 -0000
@@ -18,6 +18,18 @@ static const char revid[] = "$Id: mut_ta
 #include <string.h>
 #include <unistd.h>
 #endif
+#ifdef HAVE_MUTEX_ALPHA_LINUX_ASSEMBLY
+#include "alphalinux.gcc"
+#endif
+#ifdef HAVE_MUTEX_SPARC32_LINUX_ASSEMBLY
+#include "sparc32linux.gcc"
+#endif
+#ifdef HAVE_MUTEX_SPARC64_LINUX_ASSEMBLY
+#include "sparc64linux.gcc"
+#endif
+#ifdef HAVE_MUTEX_S390_LINUX_ASSEMBLY
+#include "s390linux.gcc"
+#endif
 
 /*
  * This is where we load in the actual test-and-set mutex code.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]