summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruce Momjian2000-07-05 16:09:31 +0000
committerBruce Momjian2000-07-05 16:09:31 +0000
commit411cf2da3f9c517d304bce85b5013052737da954 (patch)
tree21efb12990e3f36f1d52600c3ca5639ca66aab03
parent972604ec60ee950f47d0a722cadaf2fb4b5b71d3 (diff)
attached to this mail is a patch from a colleague that makes
PostgreSQL-7.0.2 run on Linux for the Intel-IA64 architecture. It also fixes a bug in the configure scripts that caused configure to fail on the fcntl(F_SETLK) test. This fix triggered a bug in the fcntl(F_SETLK) code of the Linux kernel when used on unix domain sockets resulting in postmaster to segfault immediately after startup. There is a fix available and included in the kernel that will be on SuSE Linux 7.0, but kernels <= 2.2.16 still have this bug. Reinhard Max
-rw-r--r--configure.in3
-rw-r--r--src/include/port/linux.h7
-rw-r--r--src/include/storage/s_lock.h20
3 files changed, 27 insertions, 3 deletions
diff --git a/configure.in b/configure.in
index d3199582abe..c01f83d5fb2 100644
--- a/configure.in
+++ b/configure.in
@@ -764,7 +764,8 @@ PGAC_UNION_SEMUN
AC_MSG_CHECKING(for fcntl(F_SETLK))
-AC_TRY_LINK([#include <fcntl.h>],
+AC_TRY_LINK([#include <stdio.h>
+#include <fcntl.h>],
[struct flock lck;
lck.l_whence = SEEK_SET; lck.l_start = lck.l_len = 0;
lck.l_type = F_WRLCK;
diff --git a/src/include/port/linux.h b/src/include/port/linux.h
index 2ddb34df2c5..3555aba6d04 100644
--- a/src/include/port/linux.h
+++ b/src/include/port/linux.h
@@ -33,7 +33,12 @@ typedef unsigned int slock_t;
#define HAS_TEST_AND_SET
#elif defined(__arm__)
-typedef unsigned char slock_t
+typedef unsigned char slock_t;
+
+#define HAS_TEST_AND_SET
+
+#elif defined(__ia64__)
+typedef unsigned int slock_t;
#define HAS_TEST_AND_SET
diff --git a/src/include/storage/s_lock.h b/src/include/storage/s_lock.h
index fadd87edb75..98cbf10920a 100644
--- a/src/include/storage/s_lock.h
+++ b/src/include/storage/s_lock.h
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/include/storage/s_lock.h,v 1.70 2000/04/12 17:16:51 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/include/storage/s_lock.h,v 1.71 2000/07/05 16:09:31 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -95,6 +95,24 @@ __asm__("lock; xchgb %0,%1": "=q"(_res), "=m"(*lock):"0"(_res));
#endif /* __i386__ */
+#ifdef __ia64__
+#define TAS(lock) tas(lock)
+
+static __inline__ int
+tas (volatile slock_t *lock)
+{
+ long int ret;
+
+ __asm__ __volatile__(
+ "xchg4 %0=%1,%2"
+ : "=r"(ret), "=m"(*lock)
+ : "r"(1), "1"(*lock)
+ : "memory");
+
+ return (int) ret;
+}
+#endif /* __ia64__ */
+
#if defined(__arm__) || defined(__arm__)
#define TAS(lock) tas(lock)