*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/storage/buffer/buf_init.c,v 1.4 1997/01/16 08:04:30 vadim Exp $
+ * $Header: /cvsroot/pgsql/src/backend/storage/buffer/buf_init.c,v 1.5 1997/01/23 18:14:40 momjian Exp $
*
*-------------------------------------------------------------------------
*/
bool foundBufs,foundDescs;
int i;
+ /* check padding of BufferDesc and BufferHdr */
+ if (sizeof(struct sbufdesc) != PADDED_SBUFDESC_SIZE)
+ elog(WARN,"Internal error: sbufdesc does not have the proper size, "
+ "contact the Postgres developers");
+ if (sizeof(struct sbufdesc_unpadded) <= PADDED_SBUFDESC_SIZE/2)
+ elog(WARN,"Internal error: sbufdesc is greatly over-sized, "
+ "contact the Postgres developers");
+
Data_Descriptors = NBuffers;
Free_List_Descriptor = Data_Descriptors;
Lookup_List_Descriptor = Data_Descriptors + 1;
# define NEED_SYS_SELECT_H
# define HAVE_TZSET
# define HAVE_ANSI_CPP
-# define SB_PAD 44
# define HAS_TEST_AND_SET
typedef unsigned int slock_t;
#endif
# define NEED_ISINF
# define HAS_LONG_LONG
# define NEED_UNION_SEMUN
-# define SB_PAD 40
# define HAS_TEST_AND_SET
# include <sys/mman.h> /* for msemaphore */
typedef msemaphore slock_t;
# define USE_POSIX_TIME
# define NEED_CBRT
# define NEED_I386_TAS_ASM
-# define SB_PAD 56
# define HAS_TEST_AND_SET
# if defined(__mips__)
# undef HAS_TEST_AND_SET
#if defined(bsdi)
# if defined(i386)
# define NEED_I386_TAS_ASM
-# define SB_PAD 56
# endif
# if defined(sparc)
# define NEED_SPARC_TAS_ASM
-# define SB_PAD 56
# endif
# if defined(PRE_BSDI_2_1)
# define NEED_UNION_SEMUN
# define NEED_CBRT
# define NEED_RINT
# define NEED_UNION_SEMUN
-# define SB_PAD 44
# define HAS_TEST_AND_SET
typedef struct { int sem[4]; } slock_t;
#endif
# define HAVE_TZSET
# define NEED_UNION_SEMUN
# define SYSV_DIRENT
-# define SB_PAD 56
# define HAS_TEST_AND_SET
typedef unsigned char slock_t;
#endif
# define NO_VFORK
# define HAVE_TZSET
# define SYSV_DIRENT
-# define SB_PAD 44
# define HAS_TEST_AND_SET
# include <abi_mutex.h>
typedef abilock_t slock_t;
# define HAVE_TZSET
# define NEED_CBRT
# define NEED_I386_TAS_ASM
-# define SB_PAD 56
# define HAS_TEST_AND_SET
typedef unsigned char slock_t;
#endif
# define USE_LIMITS_H
# define JMP_BUF
-# define SB_PAD 56
# define NO_WAITPID
typedef struct mutex slock_t;
#endif
# define HAVE_TZSET
# define NEED_UNION_SEMUN
# define SYSV_DIRENT
-# define SB_PAD 56
# define HAS_TEST_AND_SET
typedef unsigned char slock_t;
#endif
#if defined(sunos4)
# define USE_POSIX_TIME
-# define SB_PAD 56
# undef HAVE_MEMMOVE
#endif
# define USE_POSIX_TIME
# define NEED_UNION_SEMUN
# define NEED_STRDUP
-# define SB_PAD 60
#endif
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: buf_internals.h,v 1.9 1997/01/20 04:06:13 vadim Exp $
+ * $Id: buf_internals.h,v 1.10 1997/01/23 18:15:29 momjian Exp $
*
* NOTE
* If BUFFERPAGE0 is defined, then 0 will be used as a
* to put the buffer, for all storage managers.
*/
+#define PADDED_SBUFDESC_SIZE 128
+
+/* DO NOT CHANGE THIS NEXT STRUCTURE:
+ It is used only to get padding information for the real sbufdesc structure
+ It should match the sbufdesc structure exactly except for a missing sb_pad
+*/
+struct sbufdesc_unpadded {
+ Buffer freeNext;
+ Buffer freePrev;
+ SHMEM_OFFSET data;
+ BufferTag tag;
+ int buf_id;
+ BufFlags flags;
+ int16 bufsmgr;
+ unsigned refcount;
+ char sb_dbname[NAMEDATALEN+1];
+ char sb_relname[NAMEDATALEN+1];
+#ifdef HAS_TEST_AND_SET
+ slock_t io_in_progress_lock;
+#endif /* HAS_TEST_AND_SET */
+ /* NOTE NO sb_pad HERE */
+};
+
+/* THE REAL STRUCTURE - the structure above must match it, minus sb_pad */
struct sbufdesc {
Buffer freeNext; /* link for freelist chain */
Buffer freePrev;
#endif /* HAS_TEST_AND_SET */
/*
- * I padded this structure to a power of 2 (128 bytes on a MIPS) because
+ * I padded this structure to a power of 2 (PADDED_SBUFDESC_SIZE) because
* BufferDescriptorGetBuffer is called a billion times and it does an
* C pointer subtraction (i.e., "x - y" -> array index of x relative
* to y, which is calculated using division by struct size). Integer
* going to make some of these types bigger soon anyway... -pma 1/2/93
*/
- /*
- * NOTE: This is now defined in the ..../include/config.h file!
- */
-
- char sb_pad[SB_PAD];
+ char sb_pad[PADDED_SBUFDESC_SIZE-sizeof(struct sbufdesc_unpadded)];
};
/*