summaryrefslogtreecommitdiff
path: root/src/backend/storage
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/storage')
-rw-r--r--src/backend/storage/buf_internals.h39
-rw-r--r--src/backend/storage/file/fd.c7
-rw-r--r--src/backend/storage/ipc.h53
-rw-r--r--src/backend/storage/ipc/s_lock.c22
-rw-r--r--src/backend/storage/smgr/md.c4
5 files changed, 81 insertions, 44 deletions
diff --git a/src/backend/storage/buf_internals.h b/src/backend/storage/buf_internals.h
index 84583867fa..90e9c38487 100644
--- a/src/backend/storage/buf_internals.h
+++ b/src/backend/storage/buf_internals.h
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: buf_internals.h,v 1.1.1.1 1996/07/09 06:21:52 scrappy Exp $
+ * $Id: buf_internals.h,v 1.2 1996/07/22 22:59:42 scrappy Exp $
*
* NOTE
* If BUFFERPAGE0 is defined, then 0 will be used as a
@@ -135,18 +135,41 @@ struct sbufdesc {
* It eats up more shared memory, of course, but we're (allegedly)
* going to make some of these types bigger soon anyway... -pma 1/2/93
*/
+
+/* NO spinlock */
+
#if defined(PORTNAME_ultrix4)
char sb_pad[60]; /* no slock_t */
#endif /* mips */
-#if defined(PORTNAME_sparc) || defined(PORTNAME_sparc_solaris) || defined(PORTNAME_irix5)
- char sb_pad[56]; /* has slock_t */
-#endif /* sparc || irix5 */
-#if defined(PORTNAME_hpux)
- char sb_pad[44]; /* has slock_t */
-#endif /* alpha */
+
+/* HAS_TEST_AND_SET -- platform dependent size */
+
+#if defined(PORTNAME_aix)
+ char sb_pad[44]; /* typedef unsigned int slock_t; */
+#endif /* aix */
#if defined(PORTNAME_alpha)
- char sb_pad[40]; /* has slock_t */
+ char sb_pad[40]; /* typedef msemaphore slock_t; */
#endif /* alpha */
+#if defined(PORTNAME_hpux)
+ char sb_pad[44]; /* typedef struct { int sem[4]; } slock_t; */
+#endif /* hpux */
+#if defined(PORTNAME_irix5)
+ char sb_pad[44]; /* typedef abilock_t slock_t; */
+#endif /* irix5 */
+#if defined(PORTNAME_next)
+ char sb_pad[56]; /* typedef struct mutex slock_t; */
+#endif /* next */
+
+/* HAS_TEST_AND_SET -- default 1 byte spinlock */
+
+#if defined(PORTNAME_BSD44_derived) || \
+ defined(PORTNAME_bsdi) || \
+ defined(PORTNAME_i86pc_solaris) || \
+ defined(PORTNAME_linux) || \
+ defined(PORTNAME_sparc) || \
+ defined(PORTNAME_sparc_solaris)
+ char sb_pad[56]; /* has slock_t */
+#endif /* 1 byte slock_t */
};
/*
diff --git a/src/backend/storage/file/fd.c b/src/backend/storage/file/fd.c
index 8f1bafef4d..9adb9985c9 100644
--- a/src/backend/storage/file/fd.c
+++ b/src/backend/storage/file/fd.c
@@ -6,7 +6,7 @@
* Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $Id: fd.c,v 1.3 1996/07/18 04:59:42 scrappy Exp $
+ * $Id: fd.c,v 1.4 1996/07/22 22:59:50 scrappy Exp $
*
* NOTES:
*
@@ -62,11 +62,12 @@
#define NOFILE NOFILE_IN_U
#endif /* PORTNAME_sparc */
-#ifdef PORTNAME_sparc_solaris
+#if defined(PORTNAME_sparc_solaris) || defined(PORTNAME_i386_solaris)
#include <sys/user.h>
#undef NOFILE
#define NOFILE 64
-#endif /* PORTNAME_sparc_solaris */
+#endif /* PORTNAME_sparc_solaris || PORTNAME_i386_solaris */
+
/*
* Problem: Postgres does a system(ld...) to do dynamic loading. This
* will open several extra files in addition to those used by
diff --git a/src/backend/storage/ipc.h b/src/backend/storage/ipc.h
index 36cb3c8f62..174e672e3d 100644
--- a/src/backend/storage/ipc.h
+++ b/src/backend/storage/ipc.h
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: ipc.h,v 1.2 1996/07/20 08:35:24 scrappy Exp $
+ * $Id: ipc.h,v 1.3 1996/07/22 22:59:43 scrappy Exp $
*
* NOTES
* This file is very architecture-specific. This stuff should actually
@@ -30,30 +30,22 @@
* atomic test-and-set instruction). However, we have only written
* spinlock code for the architectures listed.
*/
-#if (defined(PORTNAME_aix) || \
+#if defined(PORTNAME_aix) || \
defined(PORTNAME_alpha) || \
+ defined(PORTNAME_BSD44_derived) || \
+ defined(PORTNAME_bsdi) || \
defined(PORTNAME_hpux) || \
+ defined(PORTNAME_i386_solaris) || \
defined(PORTNAME_irix5) || \
+ defined(PORTNAME_linux) || \
defined(PORTNAME_next) || \
defined(PORTNAME_sparc) || \
- defined(PORTNAME_sparc_solaris) || \
- (defined(__i386__) && defined(__GNUC__))) && \
- !defined(PORTNAME_i386_solaris)
+ defined(PORTNAME_sparc_solaris)
#define HAS_TEST_AND_SET
#endif
#if defined(HAS_TEST_AND_SET)
-#if defined(PORTNAME_next)
-/*
- * Use Mach mutex routines since these are, in effect, test-and-set
- * spinlocks.
- */
-#undef NEVER /* definition in cthreads.h conflicts with parse.h */
-#include <mach/cthreads.h>
-
-typedef struct mutex slock_t;
-#else /* next */
#if defined(PORTNAME_aix)
/*
* The AIX C library has the cs(3) builtin for compare-and-set that
@@ -61,10 +53,12 @@ typedef struct mutex slock_t;
*/
typedef unsigned int slock_t;
#else /* aix */
+
#if defined(PORTNAME_alpha)
#include <sys/mman.h>
typedef msemaphore slock_t;
#else /* alpha */
+
#if defined(PORTNAME_hpux)
/*
* The PA-RISC "semaphore" for the LDWCX instruction is 4 bytes aligned
@@ -72,29 +66,45 @@ typedef msemaphore slock_t;
*/
typedef struct { int sem[4]; } slock_t;
#else /* hpux */
+
#if defined(PORTNAME_irix5)
#include <abi_mutex.h>
typedef abilock_t slock_t;
#else /* irix5 */
+
+#if defined(PORTNAME_next)
+/*
+ * Use Mach mutex routines since these are, in effect, test-and-set
+ * spinlocks.
+ */
+#undef NEVER /* definition in cthreads.h conflicts with parse.h */
+#include <mach/cthreads.h>
+typedef struct mutex slock_t;
+#else /* next */
+
/*
* On all other architectures spinlocks are a single byte.
*/
typedef unsigned char slock_t;
+
+#endif /* next */
#endif /* irix5 */
#endif /* hpux */
#endif /* alpha */
#endif /* aix */
-#endif /* next */
extern void S_LOCK(slock_t *lock);
extern void S_UNLOCK(slock_t *lock);
extern void S_INIT_LOCK(slock_t *lock);
-#if defined(PORTNAME_hpux) || defined(PORTNAME_alpha) || defined(PORTNAME_irix5) || defined(PORTNAME_next)
+#if defined(PORTNAME_alpha) || \
+ defined(PORTNAME_hpux) || \
+ defined(PORTNAME_irix5) || \
+ defined(PORTNAME_next)
extern int S_LOCK_FREE(slock_t *lock);
-#else /* PORTNAME_hpux */
+#else
#define S_LOCK_FREE(lock) ((*lock) == 0)
-#endif /* PORTNAME_hpux */
+#endif
#endif /* HAS_TEST_AND_SET */
@@ -108,9 +118,10 @@ extern int S_LOCK_FREE(slock_t *lock);
defined(PORTNAME_aix) || \
defined(PORTNAME_alpha) || \
defined(PORTNAME_hpux) || \
+ defined(PORTNAME_i386_solaris) || \
defined(PORTNAME_sparc_solaris) || \
- defined(WIN32) || \
- defined(PORTNAME_ultrix4)
+ defined(PORTNAME_ultrix4) || \
+ defined(WIN32)
union semun {
int val;
struct semid_ds *buf;
diff --git a/src/backend/storage/ipc/s_lock.c b/src/backend/storage/ipc/s_lock.c
index 260120dfcc..df8aa514e4 100644
--- a/src/backend/storage/ipc/s_lock.c
+++ b/src/backend/storage/ipc/s_lock.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/storage/ipc/Attic/s_lock.c,v 1.3 1996/07/16 07:13:16 scrappy Exp $
+ * $Header: /cvsroot/pgsql/src/backend/storage/ipc/Attic/s_lock.c,v 1.4 1996/07/22 23:00:03 scrappy Exp $
*
*-------------------------------------------------------------------------
*/
@@ -70,8 +70,7 @@ S_INIT_LOCK(slock_t *lock)
int
S_LOCK_FREE(slock_t *lock)
{
- /* For Mach, we have to delve inside the entrails of `struct
-mutex'. Ick! */
+/* For Mach, we have to delve inside the entrails of `struct mutex'. Ick! */
return (lock->lock == 0);
}
@@ -159,9 +158,10 @@ S_LOCK_FREE(slock_t *lock)
* Solaris 2
*/
-#if defined(PORTNAME_sparc_solaris)
+#if defined(PORTNAME_i386_solaris) || \
+ defined(PORTNAME_sparc_solaris)
-/* defined in port/.../tas.s */
+/* for xxxxx_solaris, this is defined in port/.../tas.s */
extern int tas(slock_t *lock);
void
@@ -183,7 +183,7 @@ S_INIT_LOCK(slock_t *lock)
S_UNLOCK(lock);
}
-#endif /* PORTNAME_sparc_solaris */
+#endif /* PORTNAME_i86pc_solaris || PORTNAME_sparc_solaris */
/*
* AIX (POWER)
@@ -266,7 +266,7 @@ S_LOCK_FREE(slock_t *lock)
* sun3
*/
-#if (defined(sun) && ! defined(sparc))
+#if (defined(sun3) && ! defined(sparc))
void
S_LOCK(slock_t *lock)
@@ -381,8 +381,10 @@ S_INIT_LOCK(unsigned char *addr)
* Linux and friends
*/
-#if defined(PORTNAME_linux) || defined(PORTNAME_BSD44_derived) || defined(PORTNAME_bsdi) || defined(PORTNAME_bsdi_2_1)
-
+#if defined(PORTNAME_BSD44_derived) || \
+ defined(PORTNAME_bsdi) || \
+ defined(PORTNAME_bsdi_2_1) || \
+ defined(PORTNAME_linux)
int
tas(slock_t *m)
@@ -411,7 +413,7 @@ S_INIT_LOCK(slock_t *lock)
S_UNLOCK(lock);
}
-#endif /* PORTNAME_linux || PORTNAME_BSD44_derived || PORTNAME_bsdi || PORTNAME_bsdi_2_1 */
+#endif /* linux and friends */
#endif /* HAS_TEST_AND_SET */
diff --git a/src/backend/storage/smgr/md.c b/src/backend/storage/smgr/md.c
index 416b661f80..5b7ebfede9 100644
--- a/src/backend/storage/smgr/md.c
+++ b/src/backend/storage/smgr/md.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/storage/smgr/md.c,v 1.3 1996/07/15 19:22:12 scrappy Exp $
+ * $Header: /cvsroot/pgsql/src/backend/storage/smgr/md.c,v 1.4 1996/07/22 23:00:18 scrappy Exp $
*
*-------------------------------------------------------------------------
*/
@@ -476,8 +476,8 @@ mdblindwrt(char *dbstr,
if (write(fd, buffer, BLCKSZ) != BLCKSZ || (pg_fsync(fd) < 0))
#else
if (write(fd, buffer, BLCKSZ) != BLCKSZ || fsync(fd) < 0)
- status = SM_FAIL;
#endif
+ status = SM_FAIL;
if (close(fd) < 0)
status = SM_FAIL;