diff options
Diffstat (limited to 'src/backend/storage/ipc/shmem.c')
| -rw-r--r-- | src/backend/storage/ipc/shmem.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/src/backend/storage/ipc/shmem.c b/src/backend/storage/ipc/shmem.c index 6dfeed0d78..472d7feaa2 100644 --- a/src/backend/storage/ipc/shmem.c +++ b/src/backend/storage/ipc/shmem.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/storage/ipc/shmem.c,v 1.27 1998/06/30 19:09:57 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/storage/ipc/shmem.c,v 1.28 1998/07/21 06:17:35 vadim Exp $ * *------------------------------------------------------------------------- */ @@ -67,6 +67,8 @@ #include "storage/proc.h" #include "utils/dynahash.h" #include "utils/hsearch.h" +#include "utils/memutils.h" +#include "access/transam.h" /* shared memory global variables */ @@ -74,6 +76,8 @@ unsigned long ShmemBase = 0; /* start and end address of shared memory */ static unsigned long ShmemEnd = 0; static unsigned long ShmemSize = 0; /* current size (and default) */ +extern VariableCache ShmemVariableCache; /* varsup.c */ + SPINLOCK ShmemLock; /* lock for shared memory allocation */ SPINLOCK ShmemIndexLock; /* lock for shmem index access */ @@ -151,7 +155,6 @@ InitShmem(unsigned int key, unsigned int size) item; bool found; IpcMemoryId shmid; - /* if zero key, use default memory size */ if (size) ShmemSize = size; @@ -180,9 +183,12 @@ InitShmem(unsigned int key, unsigned int size) ShmemFreeStart = (unsigned long *) ShmemBase; /* next is a shmem pointer to the shmem index */ ShmemIndexOffset = ShmemFreeStart + 1; + /* next is ShmemVariableCache */ + ShmemVariableCache = (VariableCache) (ShmemIndexOffset + 1); currFreeSpace += - sizeof(ShmemFreeStart) + sizeof(ShmemIndexOffset); + sizeof(ShmemFreeStart) + sizeof(ShmemIndexOffset) + + LONGALIGN(sizeof(VariableCacheData)); /* * bootstrap initialize spin locks so we can start to use the @@ -196,7 +202,10 @@ InitShmem(unsigned int key, unsigned int size) * setup the global free space count */ if (ShmemBootstrap) + { *ShmemFreeStart = currFreeSpace; + memset (ShmemVariableCache, 0, sizeof(*ShmemVariableCache)); + } /* if ShmemFreeStart is NULL, then the allocator won't work */ Assert(*ShmemFreeStart); |
