aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBruce Momjian <bruce@momjian.us>1997-10-30 05:24:19 +0000
committerBruce Momjian <bruce@momjian.us>1997-10-30 05:24:19 +0000
commit58ed1232f589789dda1710f7d3ab852ae783a975 (patch)
tree08caafe5bedf454d867de7f096112901f5dcfe0a /src
parente2617c856eddb805b7b966319dad271ecaf5fb4c (diff)
downloadpostgresql-58ed1232f589789dda1710f7d3ab852ae783a975.tar.gz
postgresql-58ed1232f589789dda1710f7d3ab852ae783a975.zip
Fix for netbsd locking, from Henry B. Hotz.
Diffstat (limited to 'src')
-rw-r--r--src/include/port/BSD44_derived.h12
-rw-r--r--src/include/storage/s_lock.h31
2 files changed, 41 insertions, 2 deletions
diff --git a/src/include/port/BSD44_derived.h b/src/include/port/BSD44_derived.h
index 867246f3b86..12787118aea 100644
--- a/src/include/port/BSD44_derived.h
+++ b/src/include/port/BSD44_derived.h
@@ -1,15 +1,25 @@
#define USE_POSIX_TIME
+
#if defined(i386)
#define NEED_I386_TAS_ASM
+#define HAS_TEST_AND_SET
#endif
+
#if defined(sparc)
#define NEED_SPARC_TAS_ASM
+#define HAS_TEST_AND_SET
#endif
+
#if defined(ns32k)
#define NEED_NS32k_TAS_ASM
+#define HAS_TEST_AND_SET
#endif
+
+#if defined(__m68k__)
#define HAS_TEST_AND_SET
+#endif
+
#if defined(__mips__)
-/* # undef HAS_TEST_AND_SET */
+/* # undef HAS_TEST_AND_SET */
#endif
typedef unsigned char slock_t;
diff --git a/src/include/storage/s_lock.h b/src/include/storage/s_lock.h
index 761ae6b11cd..1722d33b938 100644
--- a/src/include/storage/s_lock.h
+++ b/src/include/storage/s_lock.h
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/include/storage/s_lock.h,v 1.10 1997/10/03 15:27:18 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/include/storage/s_lock.h,v 1.11 1997/10/30 05:24:19 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -24,6 +24,10 @@
* ;
* }
*
+ * In addition to modifying this file you will need to modify
+ * the appropriate ...src/include/port/...h file to define
+ * HAS_TEST_AND_SET for the appropriate circumstances.
+ *
* If this is not done, POSTGRES will default to using System V
* semaphores (and take a large performance hit -- around 40% of
* its time on a DS5000/240 is spent in semop(3)...).
@@ -229,6 +233,31 @@ tas_dummy()
#endif /* sun3 */
/*
+ * M68000 ports under NetBSD.
+ *
+ * This version should also work on a sun3, but I can't test it.
+ * Conversely the sun3 version should work under NetBSD/m68k, but
+ * it doesn't.
+ */
+#if defined(__NetBSD__) && defined(__m68k__)
+
+static void S_LOCK(char *lock)
+{
+ asm("
+ movel a6@(8),a0
+ LOOP:
+ tas a0@
+ bmi LOOP
+ ");
+}
+
+#define S_UNLOCK(lock) (*(lock) = 0)
+
+#define S_INIT_LOCK(lock) S_UNLOCK(lock)
+
+#endif /* M68000 && NetBSD */
+
+/*
* sparc machines
*/