Index: src/backend/port/dynloader/netbsd.c =================================================================== RCS file: /cvsroot/pgsql-server/src/backend/port/dynloader/netbsd.c,v retrieving revision 1.12 diff -c -c -r1.12 netbsd.c *** src/backend/port/dynloader/netbsd.c 4 Aug 2003 02:40:02 -0000 1.12 --- src/backend/port/dynloader/netbsd.c 23 Dec 2003 03:28:43 -0000 *************** *** 1,4 **** ! /*- * Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group * Portions Copyright (c) 1990 The Regents of the University of California. * All rights reserved. --- 1,4 ---- ! /* * Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group * Portions Copyright (c) 1990 The Regents of the University of California. * All rights reserved. Index: src/backend/port/dynloader/openbsd.c =================================================================== RCS file: /cvsroot/pgsql-server/src/backend/port/dynloader/openbsd.c,v retrieving revision 1.12 diff -c -c -r1.12 openbsd.c *** src/backend/port/dynloader/openbsd.c 4 Aug 2003 02:40:02 -0000 1.12 --- src/backend/port/dynloader/openbsd.c 23 Dec 2003 03:28:43 -0000 *************** *** 1,4 **** ! /*- * Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group * Portions Copyright (c) 1990 The Regents of the University of California. * All rights reserved. --- 1,4 ---- ! /* * Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group * Portions Copyright (c) 1990 The Regents of the University of California. * All rights reserved. Index: src/backend/storage/lmgr/s_lock.c =================================================================== RCS file: /cvsroot/pgsql-server/src/backend/storage/lmgr/s_lock.c,v retrieving revision 1.19 diff -c -c -r1.19 s_lock.c *** src/backend/storage/lmgr/s_lock.c 23 Dec 2003 00:32:06 -0000 1.19 --- src/backend/storage/lmgr/s_lock.c 23 Dec 2003 03:28:43 -0000 *************** *** 17,23 **** #include #include - #include "storage/s_lock.h" --- 17,22 ---- *************** *** 118,123 **** --- 117,125 ---- * Various TAS implementations that cannot live in s_lock.h as no inline * definition exists (yet). * In the future, get rid of tas.[cso] and fold it into this file. + * + * If you change something here, you have to modify s_lock.h because + * the definitions for these is split between this file and s_lock.h. */ Index: src/backend/storage/lmgr/spin.c =================================================================== RCS file: /cvsroot/pgsql-server/src/backend/storage/lmgr/spin.c,v retrieving revision 1.12 diff -c -c -r1.12 spin.c *** src/backend/storage/lmgr/spin.c 29 Nov 2003 19:51:57 -0000 1.12 --- src/backend/storage/lmgr/spin.c 23 Dec 2003 03:28:43 -0000 *************** *** 25,30 **** --- 25,31 ---- #include "storage/lwlock.h" #include "storage/pg_sema.h" #include "storage/spin.h" + #include "storage/s_lock.h" #ifdef HAS_TEST_AND_SET Index: src/include/port/aix.h =================================================================== RCS file: /cvsroot/pgsql-server/src/include/port/aix.h,v retrieving revision 1.9 diff -c -c -r1.9 aix.h *** src/include/port/aix.h 12 Nov 2002 00:39:08 -0000 1.9 --- src/include/port/aix.h 23 Dec 2003 03:28:46 -0000 *************** *** 1,8 **** #define CLASS_CONFLICT #define DISABLE_XOPEN_NLS - #define HAS_TEST_AND_SET - - typedef unsigned int slock_t; #include /* ENDIAN definitions for network * communication */ --- 1,5 ---- Index: src/include/port/beos.h =================================================================== RCS file: /cvsroot/pgsql-server/src/include/port/beos.h,v retrieving revision 1.11 diff -c -c -r1.11 beos.h *** src/include/port/beos.h 25 Oct 2001 05:50:09 -0000 1.11 --- src/include/port/beos.h 23 Dec 2003 03:28:46 -0000 *************** *** 2,11 **** #include #include - #define HAS_TEST_AND_SET - - typedef unsigned char slock_t; - #define AF_UNIX 10 /* no domain sockets on BeOS */ /* Beos doesn't have all the required getrusage fields */ --- 2,7 ---- Index: src/include/port/bsdi.h =================================================================== RCS file: /cvsroot/pgsql-server/src/include/port/bsdi.h,v retrieving revision 1.11 diff -c -c -r1.11 bsdi.h *** src/include/port/bsdi.h 23 Dec 2003 00:32:06 -0000 1.11 --- src/include/port/bsdi.h 23 Dec 2003 03:28:46 -0000 *************** *** 1,12 **** - #if defined(__i386__) || defined(__x86_64__) - typedef unsigned char slock_t; - #endif - #if defined(__ia64) - typedef unsigned int slock_t; - #endif - #if defined(__sparc__) - typedef unsigned char slock_t; - #endif - - #define HAS_TEST_AND_SET - --- 0 ---- Index: src/include/port/cygwin.h =================================================================== RCS file: /cvsroot/pgsql-server/src/include/port/cygwin.h,v retrieving revision 1.5 diff -c -c -r1.5 cygwin.h *** src/include/port/cygwin.h 29 Nov 2003 19:52:08 -0000 1.5 --- src/include/port/cygwin.h 23 Dec 2003 03:28:46 -0000 *************** *** 1,8 **** /* $PostgreSQL: pgsql-server/src/include/port/cygwin.h,v 1.5 2003/11/29 19:52:08 pgsql Exp $ */ - #define HAS_TEST_AND_SET - typedef unsigned char slock_t; - #include /* --- 1,5 ---- Index: src/include/port/darwin.h =================================================================== RCS file: /cvsroot/pgsql-server/src/include/port/darwin.h,v retrieving revision 1.5 diff -c -c -r1.5 darwin.h *** src/include/port/darwin.h 28 Oct 2001 06:26:08 -0000 1.5 --- src/include/port/darwin.h 23 Dec 2003 03:28:46 -0000 *************** *** 1,13 **** #define __darwin__ 1 - - #if defined(__ppc__) - #define HAS_TEST_AND_SET - #endif - - #if defined(__ppc__) - typedef unsigned int slock_t; - - #else - typedef unsigned char slock_t; - - #endif --- 1 ---- Index: src/include/port/freebsd.h =================================================================== RCS file: /cvsroot/pgsql-server/src/include/port/freebsd.h,v retrieving revision 1.13 diff -c -c -r1.13 freebsd.h *** src/include/port/freebsd.h 23 Dec 2003 00:32:06 -0000 1.13 --- src/include/port/freebsd.h 23 Dec 2003 03:28:46 -0000 *************** *** 1,51 **** - #if defined(__i386__) || defined(__x86_64__) - #define HAS_TEST_AND_SET - typedef unsigned char slock_t; - #endif - - #if defined(__ia64) - #define HAS_TEST_AND_SET - typedef unsigned int slock_t; - #endif - - #if defined(__sparc__) - #define HAS_TEST_AND_SET - typedef unsigned char slock_t; - #endif - - #if defined(__vax__) - #define NEED_VAX_TAS_ASM - #define HAS_TEST_AND_SET - typedef unsigned char slock_t; - #endif - - #if defined(__ns32k__) - #define NEED_NS32K_TAS_ASM - #define HAS_TEST_AND_SET - typedef unsigned char slock_t; - #endif - - #if defined(__m68k__) - #define HAS_TEST_AND_SET - typedef unsigned char slock_t; - #endif - - #if defined(__arm__) - #define HAS_TEST_AND_SET - typedef unsigned char slock_t; - #endif - - #if defined(__mips__) - /* # undef HAS_TEST_AND_SET */ - #endif - - #if defined(__alpha__) - #define HAS_TEST_AND_SET - typedef unsigned long slock_t; - #endif - - #if defined(__powerpc__) - #define HAS_TEST_AND_SET - typedef unsigned int slock_t; - - #endif --- 0 ---- Index: src/include/port/hpux.h =================================================================== RCS file: /cvsroot/pgsql-server/src/include/port/hpux.h,v retrieving revision 1.19 diff -c -c -r1.19 hpux.h *** src/include/port/hpux.h 4 Aug 2003 00:43:32 -0000 1.19 --- src/include/port/hpux.h 23 Dec 2003 03:28:46 -0000 *************** *** 10,29 **** #if defined(__hppa) - #define HAS_TEST_AND_SET - typedef struct - { - int sema[4]; - } slock_t; - #ifndef BYTE_ORDER #define BYTE_ORDER BIG_ENDIAN #endif #elif defined(__ia64) - - #define HAS_TEST_AND_SET - typedef unsigned int slock_t; #ifndef BYTE_ORDER #define BYTE_ORDER LITTLE_ENDIAN --- 10,20 ---- Index: src/include/port/irix5.h =================================================================== RCS file: /cvsroot/pgsql-server/src/include/port/irix5.h,v retrieving revision 1.8 diff -c -c -r1.8 irix5.h *** src/include/port/irix5.h 12 Nov 2002 00:39:08 -0000 1.8 --- src/include/port/irix5.h 23 Dec 2003 03:28:46 -0000 *************** *** 1,3 **** - #define HAS_TEST_AND_SET - - typedef unsigned long slock_t; --- 0 ---- Index: src/include/port/linux.h =================================================================== RCS file: /cvsroot/pgsql-server/src/include/port/linux.h,v retrieving revision 1.38 diff -c -c -r1.38 linux.h *** src/include/port/linux.h 26 Oct 2003 01:41:10 -0000 1.38 --- src/include/port/linux.h 23 Dec 2003 03:28:46 -0000 *************** *** 1,51 **** - #if defined(__i386__) || defined(__x86_64__) - typedef unsigned char slock_t; - - #define HAS_TEST_AND_SET - - #elif defined(__sparc__) - typedef unsigned char slock_t; - - #define HAS_TEST_AND_SET - - #elif defined(__powerpc64__) - typedef unsigned long slock_t; - - #define HAS_TEST_AND_SET - - #elif defined(__powerpc__) - typedef unsigned int slock_t; - - #define HAS_TEST_AND_SET - - #elif defined(__alpha__) - typedef long int slock_t; - - #define HAS_TEST_AND_SET - - #elif defined(__mips__) - typedef unsigned int slock_t; - - #define HAS_TEST_AND_SET - - #elif defined(__arm__) - typedef unsigned char slock_t; - - #define HAS_TEST_AND_SET - - #elif defined(__ia64__) - typedef unsigned int slock_t; - - #define HAS_TEST_AND_SET - - #elif defined(__s390__) || defined(__s390x__) - typedef unsigned int slock_t; - - #define HAS_TEST_AND_SET - - #elif defined(__mc68000__) - typedef unsigned char slock_t; - - #define HAS_TEST_AND_SET - - #endif --- 0 ---- Index: src/include/port/netbsd.h =================================================================== RCS file: /cvsroot/pgsql-server/src/include/port/netbsd.h,v retrieving revision 1.12 diff -c -c -r1.12 netbsd.h *** src/include/port/netbsd.h 23 Dec 2003 00:32:06 -0000 1.12 --- src/include/port/netbsd.h 23 Dec 2003 03:28:46 -0000 *************** *** 1,51 **** - #if defined(__i386__) || defined(__x86_64__) - #define HAS_TEST_AND_SET - typedef unsigned char slock_t; - #endif - - #if defined(__ia64) - #define HAS_TEST_AND_SET - typedef unsigned int slock_t; - #endif - - #if defined(__sparc__) - #define HAS_TEST_AND_SET - typedef unsigned char slock_t; - #endif - - #if defined(__vax__) - #define NEED_VAX_TAS_ASM - #define HAS_TEST_AND_SET - typedef unsigned char slock_t; - #endif - - #if defined(__ns32k__) - #define NEED_NS32K_TAS_ASM - #define HAS_TEST_AND_SET - typedef unsigned char slock_t; - #endif - - #if defined(__m68k__) - #define HAS_TEST_AND_SET - typedef unsigned char slock_t; - #endif - - #if defined(__arm__) - #define HAS_TEST_AND_SET - typedef unsigned char slock_t; - #endif - - #if defined(__mips__) - /* # undef HAS_TEST_AND_SET */ - #endif - - #if defined(__alpha__) - #define HAS_TEST_AND_SET - typedef unsigned long slock_t; - #endif - - #if defined(__powerpc__) - #define HAS_TEST_AND_SET - typedef unsigned int slock_t; - - #endif --- 0 ---- Index: src/include/port/nextstep.h =================================================================== RCS file: /cvsroot/pgsql-server/src/include/port/nextstep.h,v retrieving revision 1.6 diff -c -c -r1.6 nextstep.h *** src/include/port/nextstep.h 28 Oct 2000 23:53:00 -0000 1.6 --- src/include/port/nextstep.h 23 Dec 2003 03:28:46 -0000 *************** *** 15,18 **** #endif #define NO_WAITPID - typedef struct mutex slock_t; --- 15,17 ---- Index: src/include/port/openbsd.h =================================================================== RCS file: /cvsroot/pgsql-server/src/include/port/openbsd.h,v retrieving revision 1.11 diff -c -c -r1.11 openbsd.h *** src/include/port/openbsd.h 23 Dec 2003 00:32:06 -0000 1.11 --- src/include/port/openbsd.h 23 Dec 2003 03:28:46 -0000 *************** *** 1,51 **** - #if defined(__i386__) || defined(__x86_64__) - #define HAS_TEST_AND_SET - typedef unsigned char slock_t; - #endif - - #if defined(__ia64) - #define HAS_TEST_AND_SET - typedef unsigned int slock_t; - #endif - - #if defined(__sparc__) - #define HAS_TEST_AND_SET - typedef unsigned char slock_t; - #endif - - #if defined(__vax__) - #define NEED_VAX_TAS_ASM - #define HAS_TEST_AND_SET - typedef unsigned char slock_t; - #endif - - #if defined(__ns32k__) - #define NEED_NS32K_TAS_ASM - #define HAS_TEST_AND_SET - typedef unsigned char slock_t; - #endif - - #if defined(__m68k__) - #define HAS_TEST_AND_SET - typedef unsigned char slock_t; - #endif - - #if defined(__arm__) - #define HAS_TEST_AND_SET - typedef unsigned char slock_t; - #endif - - #if defined(__mips__) - /* # undef HAS_TEST_AND_SET */ - #endif - - #if defined(__alpha__) - #define HAS_TEST_AND_SET - typedef unsigned long slock_t; - #endif - - #if defined(__powerpc__) - #define HAS_TEST_AND_SET - typedef unsigned int slock_t; - - #endif --- 0 ---- Index: src/include/port/osf.h =================================================================== RCS file: /cvsroot/pgsql-server/src/include/port/osf.h,v retrieving revision 1.7 diff -c -c -r1.7 osf.h *** src/include/port/osf.h 28 Oct 2001 06:26:08 -0000 1.7 --- src/include/port/osf.h 23 Dec 2003 03:28:46 -0000 *************** *** 1,7 **** #define NOFIXADE #define DISABLE_XOPEN_NLS - #define HAS_TEST_AND_SET - /* #include */ /* for msemaphore */ - /*typedef msemaphore slock_t;*/ - #include - typedef volatile long slock_t; --- 1,2 ---- Index: src/include/port/qnx4.h =================================================================== RCS file: /cvsroot/pgsql-server/src/include/port/qnx4.h,v retrieving revision 1.8 diff -c -c -r1.8 qnx4.h *** src/include/port/qnx4.h 9 May 2003 16:59:43 -0000 1.8 --- src/include/port/qnx4.h 23 Dec 2003 03:28:46 -0000 *************** *** 5,12 **** #include #include /* for select */ - #define HAS_TEST_AND_SET - #undef HAVE_GETRUSAGE #define strncasecmp strnicmp --- 5,10 ---- *************** *** 21,28 **** #endif /* NAN */ typedef u_short ushort; - - typedef unsigned char slock_t; extern int isnan(double dsrc); --- 19,24 ---- Index: src/include/port/sco.h =================================================================== RCS file: /cvsroot/pgsql-server/src/include/port/sco.h,v retrieving revision 1.15 diff -c -c -r1.15 sco.h *** src/include/port/sco.h 23 Dec 2003 00:32:06 -0000 1.15 --- src/include/port/sco.h 23 Dec 2003 03:28:46 -0000 *************** *** 1,16 **** /* see src/backend/libpq/pqcomm.c */ #define SCO_ACCEPT_BUG - #define HAS_TEST_AND_SET - #define USE_UNIVEL_CC - - #if defined(__ia64) - typedef unsigned int slock_t; - #else - typedef unsigned char slock_t; - #endif - #ifndef BIG_ENDIAN #define BIG_ENDIAN 4321 --- 1,7 ---- Index: src/include/port/solaris.h =================================================================== RCS file: /cvsroot/pgsql-server/src/include/port/solaris.h,v retrieving revision 1.9 diff -c -c -r1.9 solaris.h *** src/include/port/solaris.h 29 Nov 2003 19:52:08 -0000 1.9 --- src/include/port/solaris.h 23 Dec 2003 03:28:46 -0000 *************** *** 1,8 **** /* $PostgreSQL: pgsql-server/src/include/port/solaris.h,v 1.9 2003/11/29 19:52:08 pgsql Exp $ */ - #define HAS_TEST_AND_SET - typedef unsigned char slock_t; - /* * Sort this out for all operating systems some time. The __xxx * symbols are defined on both GCC and Solaris CC, although GCC --- 1,5 ---- Index: src/include/port/sunos4.h =================================================================== RCS file: /cvsroot/pgsql-server/src/include/port/sunos4.h,v retrieving revision 1.7 diff -c -c -r1.7 sunos4.h *** src/include/port/sunos4.h 28 Oct 2001 06:26:08 -0000 1.7 --- src/include/port/sunos4.h 23 Dec 2003 03:28:46 -0000 *************** *** 1,6 **** - #define HAS_TEST_AND_SET - typedef unsigned char slock_t; - /* sprintf() returns char *, not int, on SunOS 4.1.x */ #define SPRINTF_CHAR --- 1,3 ---- Index: src/include/port/svr4.h =================================================================== RCS file: /cvsroot/pgsql-server/src/include/port/svr4.h,v retrieving revision 1.11 diff -c -c -r1.11 svr4.h *** src/include/port/svr4.h 28 Oct 2001 06:26:08 -0000 1.11 --- src/include/port/svr4.h 23 Dec 2003 03:28:46 -0000 *************** *** 3,13 **** #define BYTE_ORDER BIG_ENDIAN #endif #endif - - #ifdef sinix - #define HAS_TEST_AND_SET - - #include "abi_mutex.h" - typedef abilock_t slock_t; - - #endif --- 3,5 ---- Index: src/include/port/univel.h =================================================================== RCS file: /cvsroot/pgsql-server/src/include/port/univel.h,v retrieving revision 1.19 diff -c -c -r1.19 univel.h *** src/include/port/univel.h 23 Dec 2003 00:32:06 -0000 1.19 --- src/include/port/univel.h 23 Dec 2003 03:28:46 -0000 *************** *** 6,18 **** ***************************************/ #define USE_UNIVEL_CC - #if defined(__ia64) - typedef unsigned int slock_t; - #else - typedef unsigned char slock_t; - #endif - - #ifndef BIG_ENDIAN #define BIG_ENDIAN 4321 #endif --- 6,11 ---- Index: src/include/port/unixware.h =================================================================== RCS file: /cvsroot/pgsql-server/src/include/port/unixware.h,v retrieving revision 1.13 diff -c -c -r1.13 unixware.h *** src/include/port/unixware.h 23 Dec 2003 00:32:06 -0000 1.13 --- src/include/port/unixware.h 23 Dec 2003 03:28:46 -0000 *************** *** 9,21 **** ***************************************/ #define USE_UNIVEL_CC - #if defined(__ia64) - typedef unsigned int slock_t; - #else - typedef unsigned char slock_t; - #endif - - #ifndef BIG_ENDIAN #define BIG_ENDIAN 4321 #endif --- 9,14 ---- Index: src/include/storage/s_lock.h =================================================================== RCS file: /cvsroot/pgsql-server/src/include/storage/s_lock.h,v retrieving revision 1.119 diff -c -c -r1.119 s_lock.h *** src/include/storage/s_lock.h 23 Dec 2003 00:32:06 -0000 1.119 --- src/include/storage/s_lock.h 23 Dec 2003 03:28:46 -0000 *************** *** 73,84 **** #include "storage/pg_sema.h" - #if defined(HAS_TEST_AND_SET) - - #if defined(__GNUC__) || defined(__ICC) /************************************************************************* * All the gcc inlines */ /* --- 73,83 ---- #include "storage/pg_sema.h" #if defined(__GNUC__) || defined(__ICC) /************************************************************************* * All the gcc inlines + * Gcc consistently defines the CPU as __cpu__. + * Other compilers use __cpu or __cpu__ so we test for both in those cases. */ /* *************** *** 95,100 **** --- 94,102 ---- #if defined(__i386__) || defined(__x86_64__) /* AMD Opteron */ + typedef unsigned char slock_t; + #define HAS_TEST_AND_SET + #define TAS(lock) tas(lock) static __inline__ int *************** *** 114,120 **** /* Intel Itanium */ ! #if defined(__ia64__) || defined(__ia64) #define TAS(lock) tas(lock) static __inline__ int --- 116,125 ---- /* Intel Itanium */ ! #if defined(__ia64__) || defined(__ia64) /* __ia64 is used by ICC the compiler? */ ! typedef unsigned int slock_t; ! #define HAS_TEST_AND_SET ! #define TAS(lock) tas(lock) static __inline__ int *************** *** 135,140 **** --- 140,148 ---- #if defined(__arm__) || defined(__arm) + typedef unsigned char slock_t; + #define HAS_TEST_AND_SET + #define TAS(lock) tas(lock) static __inline__ int *************** *** 153,161 **** #if defined(__s390__) && !defined(__s390x__) ! /* ! * S/390 Linux ! */ #define TAS(lock) tas(lock) static __inline__ int --- 161,170 ---- #if defined(__s390__) && !defined(__s390x__) ! typedef unsigned int slock_t; ! #define HAS_TEST_AND_SET ! ! /* S/390 Linux */ #define TAS(lock) tas(lock) static __inline__ int *************** *** 179,187 **** #endif /* __s390__ */ #if defined(__s390x__) ! /* ! * S/390x Linux (64-bit zSeries) ! */ #define TAS(lock) tas(lock) static __inline__ int --- 188,196 ---- #endif /* __s390__ */ #if defined(__s390x__) ! typedef unsigned int slock_t; ! #define HAS_TEST_AND_SET ! /* S/390x Linux (64-bit zSeries) */ #define TAS(lock) tas(lock) static __inline__ int *************** *** 206,211 **** --- 215,222 ---- #if defined(__sparc__) + typedef unsigned char slock_t; + #define HAS_TEST_AND_SET #define TAS(lock) tas(lock) static __inline__ int *************** *** 223,228 **** --- 234,247 ---- #endif /* __sparc__ */ #if defined(__ppc__) || defined(__powerpc__) || defined(__powerpc64__) + /* Is this correct? */ + #ifndef defined(__powerpc64__) + typedef unsigned int slock_t; + #else + typedef unsigned long slock_t; + #endif + #define HAS_TEST_AND_SET + #define TAS(lock) tas(lock) /* * NOTE: per the Enhanced PowerPC Architecture manual, v1.0 dated 7-May-2002, *************** *** 255,264 **** --- 274,295 ---- return _res; } + /* + * PowerPC S_UNLOCK is almost standard but requires a "sync" instruction. + */ + #define S_UNLOCK(lock) \ + do \ + {\ + __asm__ __volatile__ (" sync \n"); \ + *((volatile slock_t *) (lock)) = 0; \ + } while (0) + #endif /* powerpc */ #if defined(__mc68000__) && defined(__linux__) + typedef unsigned char slock_t; + #define HAS_TEST_AND_SET #define TAS(lock) tas(lock) static __inline__ int *************** *** 280,304 **** #endif /* defined(__mc68000__) && defined(__linux__) */ ! #if defined(__ppc__) || defined(__powerpc__) || defined(__powerpc64__) ! /* ! * PowerPC S_UNLOCK is almost standard but requires a "sync" instruction. ! */ ! #define S_UNLOCK(lock) \ ! do \ ! {\ ! __asm__ __volatile__ (" sync \n"); \ ! *((volatile slock_t *) (lock)) = 0; \ ! } while (0) ! ! #endif /* powerpc */ ! ! ! #if defined(NEED_VAX_TAS_ASM) /* * VAXen -- even multiprocessor ones * (thanks to Tom Ivar Helbekkmo) */ #define TAS(lock) tas(lock) static __inline__ int --- 311,323 ---- #endif /* defined(__mc68000__) && defined(__linux__) */ ! #if defined(__vax__) /* * VAXen -- even multiprocessor ones * (thanks to Tom Ivar Helbekkmo) */ + typedef unsigned char slock_t; + #define HAS_TEST_AND_SET #define TAS(lock) tas(lock) static __inline__ int *************** *** 317,326 **** return _res; } ! #endif /* NEED_VAX_TAS_ASM */ ! #if defined(NEED_NS32K_TAS_ASM) #define TAS(lock) tas(lock) static __inline__ int --- 336,347 ---- return _res; } ! #endif /* __vax__ */ ! #if defined(__ns32k__) ! typedef unsigned char slock_t; ! #define HAS_TEST_AND_SET #define TAS(lock) tas(lock) static __inline__ int *************** *** 335,388 **** return _res; } ! #endif /* NEED_NS32K_TAS_ASM */ ! ! ! ! #else /* !__GNUC__ */ ! ! /*************************************************************************** ! * All non-gcc inlines ! */ ! ! #if defined(USE_UNIVEL_CC) ! #define TAS(lock) tas(lock) ! ! asm int ! tas(volatile slock_t *s_lock) ! { ! /* UNIVEL wants %mem in column 1, so we don't pg_indent this file */ ! %mem s_lock ! pushl %ebx ! movl s_lock, %ebx ! movl $255, %eax ! lock ! xchgb %al, (%ebx) ! popl %ebx ! } ! ! #endif /* defined(USE_UNIVEL_CC) */ ! ! #endif /* defined(__GNUC__) */ ! ! ! ! /************************************************************************* ! * These are the platforms that have only one compiler, or do not use inline ! * assembler (and hence have common code for gcc and non-gcc compilers, ! * if both are available). ! */ #if defined(__alpha) || defined(__alpha__) - /* * Correct multi-processor locking methods are explained in section 5.5.3 * of the Alpha AXP Architecture Handbook, which at this writing can be * found at ftp://ftp.netbsd.org/pub/NetBSD/misc/dec-docs/index.html. * For gcc we implement the handbook's code directly with inline assembler. */ ! #if defined(__GNUC__) #define TAS(lock) tas(lock) #define S_UNLOCK(lock) \ --- 356,373 ---- return _res; } ! #endif /* __ns32k__ */ #if defined(__alpha) || defined(__alpha__) /* * Correct multi-processor locking methods are explained in section 5.5.3 * of the Alpha AXP Architecture Handbook, which at this writing can be * found at ftp://ftp.netbsd.org/pub/NetBSD/misc/dec-docs/index.html. * For gcc we implement the handbook's code directly with inline assembler. */ ! typedef unsigned long slock_t; ! #define HAS_TEST_AND_SET #define TAS(lock) tas(lock) #define S_UNLOCK(lock) \ *************** *** 416,423 **** return (int) _res; } ! #else /* !defined(__GNUC__) */ /* * The Tru64 compiler doesn't support gcc-style inline asm, but it does * have some builtin functions that accomplish much the same results. --- 401,469 ---- return (int) _res; } ! #endif /* __alpha || __alpha__ */ ! ! ! /* These live in s_lock.c, but only for gcc */ ! ! #if defined(__m68k__) ! typedef unsigned char slock_t; ! #define HAS_TEST_AND_SET ! #endif ! ! #ifdef sinix /* This symbol is not protected with __, for SvR4 port */ ! #include "abi_mutex.h" ! typedef abilock_t slock_t; ! #define HAS_TEST_AND_SET ! #endif ! ! ! /* These are in s_lock.c */ ! ! #if defined(__m68k__) ! typedef unsigned char slock_t; ! #define HAS_TEST_AND_SET ! #endif ! ! #if defined(__mips__) && !defined(__sgi) ! typedef unsigned char slock_t; ! #define HAS_TEST_AND_SET ! #endif ! ! #endif /* __GNUC__ */ ! ! ! ! /*************************************************************************** ! * Uses non-gcc inline assembly: ! */ ! ! #if !defined(HAS_TEST_AND_SET) ! ! #if defined(USE_UNIVEL_CC) ! typedef unsigned char slock_t; ! #define HAS_TEST_AND_SET ! #define TAS(lock) tas(lock) ! ! asm int ! tas(volatile slock_t *s_lock) ! { ! /* UNIVEL wants %mem in column 1, so we don't pg_indent this file */ ! %mem s_lock ! pushl %ebx ! movl s_lock, %ebx ! movl $255, %eax ! lock ! xchgb %al, (%ebx) ! popl %ebx ! } ! ! #endif /* defined(USE_UNIVEL_CC) */ ! + #if defined(__alpha) || defined(__alpha__) + typedef volatile long slock_t; + #define HAS_TEST_AND_SET /* * The Tru64 compiler doesn't support gcc-style inline asm, but it does * have some builtin functions that accomplish much the same results. *************** *** 428,444 **** */ #include - #define S_INIT_LOCK(lock) (*(lock) = 0) #define TAS(lock) (__LOCK_LONG_RETRY((lock), 1) == 0) #define S_UNLOCK(lock) __UNLOCK_LONG(lock) - #endif /* defined(__GNUC__) */ - #endif /* __alpha || __alpha__ */ #if defined(__hppa) /* * HP's PA-RISC * --- 474,492 ---- */ #include #define S_INIT_LOCK(lock) (*(lock) = 0) #define TAS(lock) (__LOCK_LONG_RETRY((lock), 1) == 0) #define S_UNLOCK(lock) __UNLOCK_LONG(lock) #endif /* __alpha || __alpha__ */ #if defined(__hppa) + typedef struct + { + int sema[4]; + } slock_t; + #define HAS_TEST_AND_SET /* * HP's PA-RISC * *************** *** 462,468 **** --- 510,519 ---- #endif /* __hppa */ + #if defined(__QNX__) && defined(__WATCOMC__) + typedef unsigned char slock_t; + #define HAS_TEST_AND_SET /* * QNX 4 using WATCOM C */ *************** *** 490,495 **** --- 541,548 ---- * assembly from his NECEWS SVR4 port, but we probably ought to retain this * for the R3000 chips out there. */ + typedef unsigned long slock_t; + #define HAS_TEST_AND_SET #include "mutex.h" #define TAS(lock) (test_and_set(lock,1)) #define S_UNLOCK(lock) (test_then_and(lock,0)) *************** *** 497,502 **** --- 550,556 ---- #define S_LOCK_FREE(lock) (test_then_add(lock,0) == 0) #endif /* __sgi */ + #if defined(sinix) /* * SINIX / Reliant UNIX *************** *** 504,509 **** --- 558,564 ---- * member. (Basically same as SGI) * */ + #define HAS_TEST_AND_SET #define TAS(lock) (!acquire_lock(lock)) #define S_UNLOCK(lock) release_lock(lock) #define S_INIT_LOCK(lock) init_lock(lock) *************** *** 517,532 **** * * Note that slock_t on POWER/POWER2/PowerPC is int instead of char */ #define TAS(lock) _check_lock(lock, 0, 1) #define S_UNLOCK(lock) _clear_lock(lock, 0) #endif /* _AIX */ #if defined (nextstep) ! /* ! * NEXTSTEP (mach) ! * slock_t is defined as a struct mutex. ! */ #define S_LOCK(lock) mutex_lock(lock) #define S_UNLOCK(lock) mutex_unlock(lock) --- 572,586 ---- * * Note that slock_t on POWER/POWER2/PowerPC is int instead of char */ + #define HAS_TEST_AND_SET #define TAS(lock) _check_lock(lock, 0, 1) #define S_UNLOCK(lock) _clear_lock(lock, 0) #endif /* _AIX */ #if defined (nextstep) ! typedef struct mutex slock_t; ! #define HAS_TEST_AND_SET #define S_LOCK(lock) mutex_lock(lock) #define S_UNLOCK(lock) mutex_unlock(lock) *************** *** 535,547 **** #define S_LOCK_FREE(alock) ((alock)->lock == 0) #endif /* nextstep */ - #else /* HAS_TEST_AND_SET */ #ifdef HAVE_SPINLOCKS #error PostgreSQL does not have native spinlock support on this platform. To continue the compilation, rerun configure using --disable-spinlocks. However, performance will be poor. Please report this to pgsql-bugs@postgresql.org. ! #endif /* * Fake spinlock implementation using semaphores --- slow and prone --- 589,616 ---- #define S_LOCK_FREE(alock) ((alock)->lock == 0) #endif /* nextstep */ + /* These are in s_lock.c */ + #if defined(sun3) + typedef unsigned char slock_t; + #define HAS_TEST_AND_SET + #endif + + #if defined(__sparc__) || defined(__sparc) + #define HAS_TEST_AND_SET + typedef unsigned char slock_t; + #endif + + + #endif /* !defined(HAS_TEST_AND_SET */ + + #ifndef HAS_TEST_AND_SET #ifdef HAVE_SPINLOCKS #error PostgreSQL does not have native spinlock support on this platform. To continue the compilation, rerun configure using --disable-spinlocks. However, performance will be poor. Please report this to pgsql-bugs@postgresql.org. ! ! #else /* * Fake spinlock implementation using semaphores --- slow and prone *************** *** 560,566 **** #define S_INIT_LOCK(lock) s_init_lock_sema(lock) #define TAS(lock) tas_sema(lock) ! #endif /* HAS_TEST_AND_SET */ --- 629,636 ---- #define S_INIT_LOCK(lock) s_init_lock_sema(lock) #define TAS(lock) tas_sema(lock) ! #endif /* HAVE_SPINLOCKS */ ! #endif /* HAS_TEST_AND_SET */