summaryrefslogtreecommitdiff
path: root/src/backend/storage/ipc
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/storage/ipc')
-rw-r--r--src/backend/storage/ipc/ipc.c146
-rw-r--r--src/backend/storage/ipc/ipci.c6
-rw-r--r--src/backend/storage/ipc/s_lock.c20
-rw-r--r--src/backend/storage/ipc/shmem.c72
-rw-r--r--src/backend/storage/ipc/shmqueue.c24
-rw-r--r--src/backend/storage/ipc/sinval.c14
-rw-r--r--src/backend/storage/ipc/sinvaladt.c108
-rw-r--r--src/backend/storage/ipc/spin.c20
8 files changed, 205 insertions, 205 deletions
diff --git a/src/backend/storage/ipc/ipc.c b/src/backend/storage/ipc/ipc.c
index 3dd6d2ec094..af59de7cca8 100644
--- a/src/backend/storage/ipc/ipc.c
+++ b/src/backend/storage/ipc/ipc.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/storage/ipc/ipc.c,v 1.12 1997/09/07 04:48:30 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/storage/ipc/ipc.c,v 1.13 1997/09/08 02:28:44 momjian Exp $
*
* NOTES
*
@@ -44,14 +44,14 @@
#endif
#if defined(bsd44)
-int UsePrivateMemory = 1;
+int UsePrivateMemory = 1;
#else
-int UsePrivateMemory = 0;
+int UsePrivateMemory = 0;
#endif
-static void IpcMemoryDetach(int status, char *shmaddr);
+static void IpcMemoryDetach(int status, char *shmaddr);
/* ----------------------------------------------------------------
* exit() handling stuff
@@ -62,26 +62,26 @@ static void IpcMemoryDetach(int status, char *shmaddr);
static struct ONEXIT
{
- void (*function) ();
- caddr_t arg;
-} onexit_list[MAX_ON_EXITS];
+ void (*function) ();
+ caddr_t arg;
+} onexit_list[MAX_ON_EXITS];
-static int onexit_index;
-static void IpcConfigTip(void);
+static int onexit_index;
+static void IpcConfigTip(void);
typedef struct _PrivateMemStruct
{
- int id;
- char *memptr;
-} PrivateMem;
+ int id;
+ char *memptr;
+} PrivateMem;
-PrivateMem IpcPrivateMem[16];
+PrivateMem IpcPrivateMem[16];
static int
PrivateMemoryCreate(IpcMemoryKey memKey,
uint32 size)
{
- static int memid = 0;
+ static int memid = 0;
UsePrivateMemory = 1;
@@ -94,7 +94,7 @@ PrivateMemoryCreate(IpcMemoryKey memKey,
return (memid++);
}
-static char *
+static char *
PrivateMemoryAttach(IpcMemoryId memid)
{
return (IpcPrivateMem[memid].memptr);
@@ -110,12 +110,12 @@ PrivateMemoryAttach(IpcMemoryId memid)
* -cim 2/6/90
* ----------------------------------------------------------------
*/
-static int exitpg_inprogress = 0;
+static int exitpg_inprogress = 0;
void
exitpg(int code)
{
- int i;
+ int i;
/* ----------------
* if exitpg_inprocess is true, then it means that we
@@ -147,7 +147,7 @@ exitpg(int code)
void
quasi_exitpg()
{
- int i;
+ int i;
/* ----------------
* if exitpg_inprocess is true, then it means that we
@@ -179,7 +179,7 @@ quasi_exitpg()
* ----------------------------------------------------------------
*/
int
- on_exitpg(void (*function) (), caddr_t arg)
+ on_exitpg(void (*function) (), caddr_t arg)
{
if (onexit_index >= MAX_ON_EXITS)
return (-1);
@@ -200,7 +200,7 @@ static void
IPCPrivateSemaphoreKill(int status,
int semId) /* caddr_t */
{
- union semun semun;
+ union semun semun;
semctl(semId, 0, IPC_RMID, semun);
}
@@ -259,11 +259,11 @@ IpcSemaphoreCreate(IpcSemaphoreKey semKey,
int removeOnExit,
int *status)
{
- int i;
- int errStatus;
- int semId;
- u_short array[IPC_NMAXSEM];
- union semun semun;
+ int i;
+ int errStatus;
+ int semId;
+ u_short array[IPC_NMAXSEM];
+ union semun semun;
/* get a semaphore if non-existent */
/* check arguments */
@@ -332,13 +332,13 @@ IpcSemaphoreCreate(IpcSemaphoreKey semKey,
/* note: the xxx_return variables are only used for debugging. */
/****************************************************************************/
#ifdef NOT_USED
-static int IpcSemaphoreSet_return;
+static int IpcSemaphoreSet_return;
void
IpcSemaphoreSet(int semId, int semno, int value)
{
- int errStatus;
- union semun semun;
+ int errStatus;
+ union semun semun;
semun.val = value;
errStatus = semctl(semId, semno, SETVAL, semun);
@@ -360,8 +360,8 @@ IpcSemaphoreSet(int semId, int semno, int value)
void
IpcSemaphoreKill(IpcSemaphoreKey key)
{
- int semId;
- union semun semun;
+ int semId;
+ union semun semun;
/* kill semaphore if existent */
@@ -375,14 +375,14 @@ IpcSemaphoreKill(IpcSemaphoreKey key)
/* */
/* note: the xxx_return variables are only used for debugging. */
/****************************************************************************/
-static int IpcSemaphoreLock_return;
+static int IpcSemaphoreLock_return;
void
IpcSemaphoreLock(IpcSemaphoreId semId, int sem, int lock)
{
- extern int errno;
- int errStatus;
- struct sembuf sops;
+ extern int errno;
+ int errStatus;
+ struct sembuf sops;
sops.sem_op = lock;
sops.sem_flg = 0;
@@ -419,14 +419,14 @@ IpcSemaphoreLock(IpcSemaphoreId semId, int sem, int lock)
/* */
/* note: the xxx_return variables are only used for debugging. */
/****************************************************************************/
-static int IpcSemaphoreUnlock_return;
+static int IpcSemaphoreUnlock_return;
void
IpcSemaphoreUnlock(IpcSemaphoreId semId, int sem, int lock)
{
- extern int errno;
- int errStatus;
- struct sembuf sops;
+ extern int errno;
+ int errStatus;
+ struct sembuf sops;
sops.sem_op = -lock;
sops.sem_flg = 0;
@@ -462,8 +462,8 @@ IpcSemaphoreUnlock(IpcSemaphoreId semId, int sem, int lock)
int
IpcSemaphoreGetCount(IpcSemaphoreId semId, int sem)
{
- int semncnt;
- union semun dummy; /* for Solaris */
+ int semncnt;
+ union semun dummy; /* for Solaris */
semncnt = semctl(semId, sem, GETNCNT, dummy);
return semncnt;
@@ -472,8 +472,8 @@ IpcSemaphoreGetCount(IpcSemaphoreId semId, int sem)
int
IpcSemaphoreGetValue(IpcSemaphoreId semId, int sem)
{
- int semval;
- union semun dummy; /* for Solaris */
+ int semval;
+ union semun dummy; /* for Solaris */
semval = semctl(semId, sem, GETVAL, dummy);
return semval;
@@ -489,7 +489,7 @@ IpcSemaphoreGetValue(IpcSemaphoreId semId, int sem)
IpcMemoryId
IpcMemoryCreate(IpcMemoryKey memKey, uint32 size, int permission)
{
- IpcMemoryId shmid;
+ IpcMemoryId shmid;
if (memKey == PrivateIPCKey)
{
@@ -523,7 +523,7 @@ IpcMemoryCreate(IpcMemoryKey memKey, uint32 size, int permission)
IpcMemoryId
IpcMemoryIdGet(IpcMemoryKey memKey, uint32 size)
{
- IpcMemoryId shmid;
+ IpcMemoryId shmid;
shmid = shmget(memKey, size, 0);
@@ -560,10 +560,10 @@ IpcMemoryDetach(int status, char *shmaddr)
/* CALL IT: addr = (struct <MemoryStructure> *) IpcMemoryAttach(memId); */
/* */
/****************************************************************************/
-char *
+char *
IpcMemoryAttach(IpcMemoryId memId)
{
- char *memAddress;
+ char *memAddress;
if (UsePrivateMemory)
{
@@ -596,7 +596,7 @@ IpcMemoryAttach(IpcMemoryId memId)
void
IpcMemoryKill(IpcMemoryKey memKey)
{
- IpcMemoryId shmid;
+ IpcMemoryId shmid;
if (!UsePrivateMemory && (shmid = shmget(memKey, 0, 0)) >= 0)
{
@@ -615,26 +615,26 @@ IpcMemoryKill(IpcMemoryKey memKey)
* supply of locks.
* ------------------
*/
-static SLock *SLockArray = NULL;
-static SLock **FreeSLockPP;
-static int *UnusedSLockIP;
+static SLock *SLockArray = NULL;
+static SLock **FreeSLockPP;
+static int *UnusedSLockIP;
static slock_t *SLockMemoryLock;
static IpcMemoryId SLockMemoryId = -1;
struct ipcdummy
{ /* to get alignment/size right */
- SLock *free;
- int unused;
- slock_t memlock;
- SLock slocks[NSLOCKS];
+ SLock *free;
+ int unused;
+ slock_t memlock;
+ SLock slocks[NSLOCKS];
};
-static int SLockMemorySize = sizeof(struct ipcdummy);
+static int SLockMemorySize = sizeof(struct ipcdummy);
void
CreateAndInitSLockMemory(IPCKey key)
{
- int id;
- SLock *slckP;
+ int id;
+ SLock *slckP;
SLockMemoryId = IpcMemoryCreate(key,
SLockMemorySize,
@@ -687,7 +687,7 @@ shlock = %d, exlock =%d)\n", LOCK->locklock, \
void
ExclusiveLock(int lockid)
{
- SLock *slckP;
+ SLock *slckP;
slckP = &(SLockArray[lockid]);
#ifdef LOCKDEBUG
@@ -699,29 +699,29 @@ ex_try_again:
S_LOCK(&(slckP->locklock));
switch (slckP->flag)
{
- case NOLOCK:
- slckP->flag = EXCLUSIVELOCK;
- S_LOCK(&(slckP->exlock));
- S_LOCK(&(slckP->shlock));
- S_UNLOCK(&(slckP->locklock));
+ case NOLOCK:
+ slckP->flag = EXCLUSIVELOCK;
+ S_LOCK(&(slckP->exlock));
+ S_LOCK(&(slckP->shlock));
+ S_UNLOCK(&(slckP->locklock));
#ifdef LOCKDEBUG
- printf("OUT: ");
- PRINT_LOCK(slckP);
+ printf("OUT: ");
+ PRINT_LOCK(slckP);
#endif
- return;
- case SHAREDLOCK:
- case EXCLUSIVELOCK:
- S_UNLOCK(&(slckP->locklock));
- S_LOCK(&(slckP->exlock));
- S_UNLOCK(&(slckP->exlock));
- goto ex_try_again;
+ return;
+ case SHAREDLOCK:
+ case EXCLUSIVELOCK:
+ S_UNLOCK(&(slckP->locklock));
+ S_LOCK(&(slckP->exlock));
+ S_UNLOCK(&(slckP->exlock));
+ goto ex_try_again;
}
}
void
ExclusiveUnlock(int lockid)
{
- SLock *slckP;
+ SLock *slckP;
slckP = &(SLockArray[lockid]);
#ifdef LOCKDEBUG
diff --git a/src/backend/storage/ipc/ipci.c b/src/backend/storage/ipc/ipci.c
index 4aad8e85f54..b6740b524d7 100644
--- a/src/backend/storage/ipc/ipci.c
+++ b/src/backend/storage/ipc/ipci.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/storage/ipc/ipci.c,v 1.6 1997/09/07 04:48:33 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/storage/ipc/ipci.c,v 1.7 1997/09/08 02:28:48 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -57,7 +57,7 @@ SystemPortAddressCreateIPCKey(SystemPortAddress address)
void
CreateSharedMemoryAndSemaphores(IPCKey key)
{
- int size;
+ int size;
#ifdef HAS_TEST_AND_SET
/* ---------------
@@ -114,7 +114,7 @@ CreateSharedMemoryAndSemaphores(IPCKey key)
void
AttachSharedMemoryAndSemaphores(IPCKey key)
{
- int size;
+ int size;
/* ----------------
* create rather than attach if using private key
diff --git a/src/backend/storage/ipc/s_lock.c b/src/backend/storage/ipc/s_lock.c
index 70f0deb62c9..3f75c5bc79b 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.22 1997/09/07 04:48:35 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/storage/ipc/Attic/s_lock.c,v 1.23 1997/09/08 02:28:51 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -161,7 +161,7 @@ S_LOCK_FREE(slock_t * lock)
defined(sparc_solaris)
/* for xxxxx_solaris, this is defined in port/.../tas.s */
-static int tas(slock_t * lock);
+static int tas(slock_t * lock);
void
S_LOCK(slock_t * lock)
@@ -227,9 +227,9 @@ S_INIT_LOCK(slock_t * lock)
* a "set" slock_t has a single word cleared. a "clear" slock_t has
* all words set to non-zero.
*/
-static slock_t clear_lock = {-1, -1, -1, -1};
+static slock_t clear_lock = {-1, -1, -1, -1};
-static int tas(slock_t * lock);
+static int tas(slock_t * lock);
void
S_LOCK(slock_t * lock)
@@ -253,7 +253,7 @@ S_INIT_LOCK(slock_t * lock)
int
S_LOCK_FREE(slock_t * lock)
{
- register int *lock_word = (int *) (((long) lock + 15) & ~15);
+ register int *lock_word = (int *) (((long) lock + 15) & ~15);
return (*lock_word != 0);
}
@@ -266,7 +266,7 @@ S_LOCK_FREE(slock_t * lock)
#if defined(sun3)
-static int tas(slock_t * lock);
+static int tas(slock_t * lock);
void
S_LOCK(slock_t * lock)
@@ -320,7 +320,7 @@ tas_dummy()
#define asm(x) __asm__(x)
#endif
-static int tas(slock_t * lock);
+static int tas(slock_t * lock);
static int
tas_dummy()
@@ -388,7 +388,7 @@ S_INIT_LOCK(unsigned char *addr)
void
S_LOCK(slock_t * lock)
{
- slock_t res;
+ slock_t res;
do
{
@@ -416,7 +416,7 @@ S_INIT_LOCK(slock_t * lock)
void
S_LOCK(slock_t * lock)
{
- slock_t res;
+ slock_t res;
do
{
@@ -456,7 +456,7 @@ S_INIT_LOCK(slock_t * lock)
void
S_LOCK(slock_t * lock)
{
- slock_t res;
+ slock_t res;
do
{
diff --git a/src/backend/storage/ipc/shmem.c b/src/backend/storage/ipc/shmem.c
index 63848171a1f..5a1af74584d 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.11 1997/09/07 04:48:37 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/storage/ipc/shmem.c,v 1.12 1997/09/08 02:28:53 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -70,23 +70,23 @@
/* shared memory global variables */
-unsigned long ShmemBase = 0; /* start and end address of shared memory */
+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) */
-SPINLOCK ShmemLock; /* lock for shared memory allocation */
+SPINLOCK ShmemLock; /* lock for shared memory allocation */
-SPINLOCK BindingLock; /* lock for binding table access */
+SPINLOCK BindingLock; /* lock for binding table access */
static unsigned long *ShmemFreeStart = NULL; /* pointer to the OFFSET
* of first free shared
* memory */
static unsigned long *ShmemBindingTabOffset = NULL; /* start of the binding
* table (for bootstrap) */
-static int ShmemBootstrap = FALSE; /* flag becomes true when shared
+static int ShmemBootstrap = FALSE; /* flag becomes true when shared
* mem is created by POSTMASTER */
-static HTAB *BindingTable = NULL;
+static HTAB *BindingTable = NULL;
/* ---------------------
* ShmemBindingTabReset() - Resets the binding table to NULL....
@@ -142,15 +142,15 @@ ShmemCreate(unsigned int key, unsigned int size)
int
InitShmem(unsigned int key, unsigned int size)
{
- Pointer sharedRegion;
- unsigned long currFreeSpace;
+ Pointer sharedRegion;
+ unsigned long currFreeSpace;
- HASHCTL info;
- int hash_flags;
- BindingEnt *result,
- item;
- bool found;
- IpcMemoryId shmid;
+ HASHCTL info;
+ int hash_flags;
+ BindingEnt *result,
+ item;
+ bool found;
+ IpcMemoryId shmid;
/* if zero key, use default memory size */
if (size)
@@ -223,8 +223,8 @@ InitShmem(unsigned int key, unsigned int size)
/*
* Now, check the binding table for an entry to the binding table. If
- * there is an entry there, someone else created the table.
- * Otherwise, we did and we have to initialize it.
+ * there is an entry there, someone else created the table. Otherwise,
+ * we did and we have to initialize it.
*/
memset(item.key, 0, BTABLE_KEYSIZE);
strncpy(item.key, "BindingTable", BTABLE_KEYSIZE);
@@ -276,11 +276,11 @@ InitShmem(unsigned int key, unsigned int size)
* of space. Has to return a real pointer in order
* to be compatable with malloc().
*/
-long *
+long *
ShmemAlloc(unsigned long size)
{
- unsigned long tmpFree;
- long *newSpace;
+ unsigned long tmpFree;
+ long *newSpace;
/*
* ensure space is word aligned.
@@ -338,15 +338,15 @@ ShmemIsValid(unsigned long addr)
* table at once. Use SpinAlloc() to create a spinlock
* for the structure before creating the structure itself.
*/
-HTAB *
+HTAB *
ShmemInitHash(char *name, /* table string name for binding */
long init_size, /* initial size */
long max_size, /* max size of the table */
HASHCTL * infoP, /* info about key and bucket size */
int hash_flags) /* info about infoP */
{
- bool found;
- long *location;
+ bool found;
+ long *location;
/*
* shared memory hash tables have a fixed max size so that the control
@@ -402,9 +402,9 @@ ShmemInitHash(char *name, /* table string name for binding */
bool
ShmemPIDLookup(int pid, SHMEM_OFFSET * locationPtr)
{
- BindingEnt *result,
- item;
- bool found;
+ BindingEnt *result,
+ item;
+ bool found;
Assert(BindingTable);
memset(item.key, 0, BTABLE_KEYSIZE);
@@ -448,10 +448,10 @@ ShmemPIDLookup(int pid, SHMEM_OFFSET * locationPtr)
SHMEM_OFFSET
ShmemPIDDestroy(int pid)
{
- BindingEnt *result,
- item;
- bool found;
- SHMEM_OFFSET location = 0;
+ BindingEnt *result,
+ item;
+ bool found;
+ SHMEM_OFFSET location = 0;
Assert(BindingTable);
@@ -496,12 +496,12 @@ ShmemPIDDestroy(int pid)
* the object is already in the binding table (hence, already
* initialized).
*/
-long *
+long *
ShmemInitStruct(char *name, unsigned long size, bool * foundPtr)
{
- BindingEnt *result,
- item;
- long *structPtr;
+ BindingEnt *result,
+ item;
+ long *structPtr;
strncpy(item.key, name, BTABLE_KEYSIZE);
item.location = BAD_LOCATION;
@@ -512,7 +512,7 @@ ShmemInitStruct(char *name, unsigned long size, bool * foundPtr)
{
/* Assert() is a macro now. substitutes inside quotes. */
#ifndef NO_ASSERT_CHECKING
- char *strname = "BindingTable";
+ char *strname = "BindingTable";
#endif
@@ -613,8 +613,8 @@ ShmemInitStruct(char *name, unsigned long size, bool * foundPtr)
bool
TransactionIdIsInProgress(TransactionId xid)
{
- BindingEnt *result;
- PROC *proc;
+ BindingEnt *result;
+ PROC *proc;
Assert(BindingTable);
diff --git a/src/backend/storage/ipc/shmqueue.c b/src/backend/storage/ipc/shmqueue.c
index 8080fc70208..d4cf06f1718 100644
--- a/src/backend/storage/ipc/shmqueue.c
+++ b/src/backend/storage/ipc/shmqueue.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/storage/ipc/shmqueue.c,v 1.4 1997/09/07 04:48:42 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/storage/ipc/shmqueue.c,v 1.5 1997/09/08 02:28:56 momjian Exp $
*
* NOTES
*
@@ -76,8 +76,8 @@ SHMQueueElemInit(SHM_QUEUE * queue)
void
SHMQueueDelete(SHM_QUEUE * queue)
{
- SHM_QUEUE *nextElem = (SHM_QUEUE *) MAKE_PTR((queue)->next);
- SHM_QUEUE *prevElem = (SHM_QUEUE *) MAKE_PTR((queue)->prev);
+ SHM_QUEUE *nextElem = (SHM_QUEUE *) MAKE_PTR((queue)->next);
+ SHM_QUEUE *prevElem = (SHM_QUEUE *) MAKE_PTR((queue)->prev);
Assert(SHM_PTR_VALID(queue));
Assert(SHM_PTR_VALID(nextElem));
@@ -99,10 +99,10 @@ SHMQueueDelete(SHM_QUEUE * queue)
void
dumpQ(SHM_QUEUE * q, char *s)
{
- char elem[16];
- char buf[1024];
- SHM_QUEUE *start = q;
- int count = 0;
+ char elem[16];
+ char buf[1024];
+ SHM_QUEUE *start = q;
+ int count = 0;
sprintf(buf, "q prevs: %x", MAKE_OFFSET(q));
q = (SHM_QUEUE *) MAKE_PTR(q->prev);
@@ -154,8 +154,8 @@ dumpQ(SHM_QUEUE * q, char *s)
void
SHMQueueInsertHD(SHM_QUEUE * queue, SHM_QUEUE * elem)
{
- SHM_QUEUE *prevPtr = (SHM_QUEUE *) MAKE_PTR((queue)->prev);
- SHMEM_OFFSET elemOffset = MAKE_OFFSET(elem);
+ SHM_QUEUE *prevPtr = (SHM_QUEUE *) MAKE_PTR((queue)->prev);
+ SHMEM_OFFSET elemOffset = MAKE_OFFSET(elem);
Assert(SHM_PTR_VALID(queue));
Assert(SHM_PTR_VALID(elem));
@@ -179,8 +179,8 @@ SHMQueueInsertHD(SHM_QUEUE * queue, SHM_QUEUE * elem)
void
SHMQueueInsertTL(SHM_QUEUE * queue, SHM_QUEUE * elem)
{
- SHM_QUEUE *nextPtr = (SHM_QUEUE *) MAKE_PTR((queue)->next);
- SHMEM_OFFSET elemOffset = MAKE_OFFSET(elem);
+ SHM_QUEUE *nextPtr = (SHM_QUEUE *) MAKE_PTR((queue)->next);
+ SHMEM_OFFSET elemOffset = MAKE_OFFSET(elem);
Assert(SHM_PTR_VALID(queue));
Assert(SHM_PTR_VALID(elem));
@@ -224,7 +224,7 @@ SHMQueueInsertTL(SHM_QUEUE * queue, SHM_QUEUE * elem)
void
SHMQueueFirst(SHM_QUEUE * queue, Pointer * nextPtrPtr, SHM_QUEUE * nextQueue)
{
- SHM_QUEUE *elemPtr = (SHM_QUEUE *) MAKE_PTR((queue)->next);
+ SHM_QUEUE *elemPtr = (SHM_QUEUE *) MAKE_PTR((queue)->next);
Assert(SHM_PTR_VALID(queue));
*nextPtrPtr = (Pointer) (((unsigned long) *nextPtrPtr) +
diff --git a/src/backend/storage/ipc/sinval.c b/src/backend/storage/ipc/sinval.c
index af16c8a7196..44f7b2b6e96 100644
--- a/src/backend/storage/ipc/sinval.c
+++ b/src/backend/storage/ipc/sinval.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/storage/ipc/sinval.c,v 1.8 1997/09/07 04:48:43 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/storage/ipc/sinval.c,v 1.9 1997/09/08 02:28:59 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -22,13 +22,13 @@
#include "storage/sinvaladt.h"
#include "storage/spin.h"
-extern SISeg *shmInvalBuffer; /* the shared buffer segment, set by */
+extern SISeg *shmInvalBuffer; /* the shared buffer segment, set by */
/* SISegmentAttach() */
extern BackendId MyBackendId;
extern BackendTag MyBackendTag;
-SPINLOCK SInvalLock = (SPINLOCK) NULL;
+SPINLOCK SInvalLock = (SPINLOCK) NULL;
/****************************************************************************/
/* CreateSharedInvalidationState(key) Create a buffer segment */
@@ -38,7 +38,7 @@ SPINLOCK SInvalLock = (SPINLOCK) NULL;
void
CreateSharedInvalidationState(IPCKey key)
{
- int status;
+ int status;
/*
* REMOVED SISyncKill(IPCKeyGetSIBufferMemorySemaphoreKey(key));
@@ -62,7 +62,7 @@ CreateSharedInvalidationState(IPCKey key)
void
AttachSharedInvalidationState(IPCKey key)
{
- int status;
+ int status;
if (key == PrivateIPCKey)
{
@@ -165,8 +165,8 @@ RegisterSharedInvalid(int cacheId, /* XXX */
/* should be called by a backend */
/****************************************************************************/
void
- InvalidateSharedInvalid(void (*invalFunction) (),
- void (*resetFunction) ())
+ InvalidateSharedInvalid(void (*invalFunction) (),
+ void (*resetFunction) ())
{
SpinAcquire(SInvalLock);
SIReadEntryData(shmInvalBuffer, MyBackendId,
diff --git a/src/backend/storage/ipc/sinvaladt.c b/src/backend/storage/ipc/sinvaladt.c
index 43c4d7c0ac2..368b2675bd1 100644
--- a/src/backend/storage/ipc/sinvaladt.c
+++ b/src/backend/storage/ipc/sinvaladt.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/storage/ipc/sinvaladt.c,v 1.6 1997/09/07 04:48:44 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/storage/ipc/sinvaladt.c,v 1.7 1997/09/08 02:29:01 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -49,19 +49,19 @@
* ----------------
*/
#ifdef HAS_TEST_AND_SET
-int SharedInvalidationLockId;
+int SharedInvalidationLockId;
#else
-IpcSemaphoreId SharedInvalidationSemaphore;
+IpcSemaphoreId SharedInvalidationSemaphore;
#endif
-SISeg *shmInvalBuffer;
+SISeg *shmInvalBuffer;
extern BackendId MyBackendId;
-static void CleanupInvalidationState(int status, SISeg * segInOutP);
+static void CleanupInvalidationState(int status, SISeg * segInOutP);
static BackendId SIAssignBackendId(SISeg * segInOutP, BackendTag backendTag);
-static int SIGetNumEntries(SISeg * segP);
+static int SIGetNumEntries(SISeg * segP);
/************************************************************************/
/* SISetActiveProcess(segP, backendId) set the backend status active */
@@ -85,8 +85,8 @@ SISetActiveProcess(SISeg * segInOutP, BackendId backendId)
int
SIBackendInit(SISeg * segInOutP)
{
- LRelId LtCreateRelId();
- TransactionId LMITransactionIdCopy();
+ LRelId LtCreateRelId();
+ TransactionId LMITransactionIdCopy();
Assert(MyBackendTag > 0);
@@ -108,11 +108,11 @@ SIBackendInit(SISeg * segInOutP)
* SIAssignBackendId
* ----------------
*/
-static BackendId
+static BackendId
SIAssignBackendId(SISeg * segInOutP, BackendTag backendTag)
{
- Index index;
- ProcState *stateP;
+ Index index;
+ ProcState *stateP;
stateP = NULL;
@@ -211,12 +211,12 @@ CleanupInvalidationState(int status, /* XXX */
static SISegOffsets *
SIComputeSize(int *segSize)
{
- int A,
- B,
- a,
- b,
- totalSize;
- SISegOffsets *oP;
+ int A,
+ B,
+ a,
+ b,
+ totalSize;
+ SISegOffsets *oP;
A = 0;
a = SizeSISeg; /* offset to first data entry */
@@ -245,7 +245,7 @@ SISetStartEntrySection(SISeg * segP, Offset offset)
/************************************************************************/
/* SIGetStartEntrySection(segP) - returnss the offset */
/************************************************************************/
-static Offset
+static Offset
SIGetStartEntrySection(SISeg * segP)
{
return (segP->startEntrySection);
@@ -273,7 +273,7 @@ SISetEndEntryChain(SISeg * segP, Offset offset)
/************************************************************************/
/* SIGetEndEntryChain(segP) - returnss the offset */
/************************************************************************/
-static Offset
+static Offset
SIGetEndEntryChain(SISeg * segP)
{
return (segP->endEntryChain);
@@ -291,7 +291,7 @@ SISetStartEntryChain(SISeg * segP, Offset offset)
/************************************************************************/
/* SIGetStartEntryChain(segP) - returns the offset */
/************************************************************************/
-static Offset
+static Offset
SIGetStartEntryChain(SISeg * segP)
{
return (segP->startEntryChain);
@@ -300,7 +300,7 @@ SIGetStartEntryChain(SISeg * segP)
/************************************************************************/
/* SISetNumEntries(segP, num) sets the current nuber of entries */
/************************************************************************/
-static bool
+static bool
SISetNumEntries(SISeg * segP, int num)
{
if (num <= MAXNUMMESSAGES)
@@ -327,7 +327,7 @@ SIGetNumEntries(SISeg * segP)
/************************************************************************/
/* SISetMaxNumEntries(segP, num) sets the maximal number of entries */
/************************************************************************/
-static bool
+static bool
SISetMaxNumEntries(SISeg * segP, int num)
{
if (num <= MAXNUMMESSAGES)
@@ -354,7 +354,7 @@ SIGetProcStateLimit(SISeg * segP, int i)
/************************************************************************/
/* SIIncNumEntries(segP, num) increments the current nuber of entries */
/************************************************************************/
-static bool
+static bool
SIIncNumEntries(SISeg * segP, int num)
{
if ((segP->numEntries + num) <= MAXNUMMESSAGES)
@@ -371,7 +371,7 @@ SIIncNumEntries(SISeg * segP, int num)
/************************************************************************/
/* SIDecNumEntries(segP, num) decrements the current nuber of entries */
/************************************************************************/
-static bool
+static bool
SIDecNumEntries(SISeg * segP, int num)
{
if ((segP->numEntries - num) >= 0)
@@ -397,7 +397,7 @@ SISetStartFreeSpace(SISeg * segP, Offset offset)
/************************************************************************/
/* SIGetStartFreeSpace(segP) - returns the offset */
/************************************************************************/
-static Offset
+static Offset
SIGetStartFreeSpace(SISeg * segP)
{
return (segP->startFreeSpace);
@@ -411,8 +411,8 @@ SIGetStartFreeSpace(SISeg * segP)
static SISegEntry *
SIGetFirstDataEntry(SISeg * segP)
{
- SISegEntry *eP;
- Offset startChain;
+ SISegEntry *eP;
+ Offset startChain;
startChain = SIGetStartEntryChain(segP);
@@ -432,8 +432,8 @@ SIGetFirstDataEntry(SISeg * segP)
static SISegEntry *
SIGetLastDataEntry(SISeg * segP)
{
- SISegEntry *eP;
- Offset endChain;
+ SISegEntry *eP;
+ Offset endChain;
endChain = SIGetEndEntryChain(segP);
@@ -452,7 +452,7 @@ SIGetLastDataEntry(SISeg * segP)
static SISegEntry *
SIGetNextDataEntry(SISeg * segP, Offset offset)
{
- SISegEntry *eP;
+ SISegEntry *eP;
if (offset == InvalidOffset)
return (NULL);
@@ -471,8 +471,8 @@ static SISegEntry *
SIGetNthDataEntry(SISeg * segP,
int n) /* must range from 1 to MaxMessages */
{
- SISegEntry *eP;
- int i;
+ SISegEntry *eP;
+ int i;
if (n <= 0)
return (NULL);
@@ -490,7 +490,7 @@ SIGetNthDataEntry(SISeg * segP,
/************************************************************************/
/* SIEntryOffset(segP, entryP) returns the offset for an pointer */
/************************************************************************/
-static Offset
+static Offset
SIEntryOffset(SISeg * segP, SISegEntry * entryP)
{
/* relative to B !! */
@@ -506,9 +506,9 @@ SIEntryOffset(SISeg * segP, SISegEntry * entryP)
bool
SISetDataEntry(SISeg * segP, SharedInvalidData * data)
{
- Offset offsetToNewData;
- SISegEntry *eP,
- *lastP;
+ Offset offsetToNewData;
+ SISegEntry *eP,
+ *lastP;
if (!SIIncNumEntries(segP, 1))
return (false); /* no space */
@@ -545,7 +545,7 @@ SISetDataEntry(SISeg * segP, SharedInvalidData * data)
static void
SIDecProcLimit(SISeg * segP, int num)
{
- int i;
+ int i;
for (i = 0; i < MaxBackendId; i++)
{
@@ -570,7 +570,7 @@ SIDecProcLimit(SISeg * segP, int num)
bool
SIDelDataEntry(SISeg * segP)
{
- SISegEntry *e1P;
+ SISegEntry *e1P;
if (!SIDecNumEntries(segP, 1))
{
@@ -602,7 +602,7 @@ SIDelDataEntry(SISeg * segP)
void
SISetProcStateInvalid(SISeg * segP)
{
- int i;
+ int i;
for (i = 0; i < MaxBackendId; i++)
{
@@ -630,8 +630,8 @@ SIReadEntryData(SISeg * segP,
void (*invalFunction) (),
void (*resetFunction) ())
{
- int i = 0;
- SISegEntry *data;
+ int i = 0;
+ SISegEntry *data;
Assert(segP->procState[backendId - 1].tag == MyBackendTag);
@@ -675,9 +675,9 @@ SIReadEntryData(SISeg * segP,
void
SIDelExpiredDataEntries(SISeg * segP)
{
- int min,
- i,
- h;
+ int min,
+ i,
+ h;
min = 9999999;
for (i = 0; i < MaxBackendId; i++)
@@ -711,10 +711,10 @@ SIDelExpiredDataEntries(SISeg * segP)
static void
SISegInit(SISeg * segP)
{
- SISegOffsets *oP;
- int segSize,
- i;
- SISegEntry *eP;
+ SISegOffsets *oP;
+ int segSize,
+ i;
+ SISegEntry *eP;
oP = SIComputeSize(&segSize);
/* set sempahore ids in the segment */
@@ -771,12 +771,12 @@ SISegmentKill(int key) /* the corresponding key for the segment */
/* SISegmentGet(key, size) - get a shared segment of size <size> */
/* returns a segment id */
/************************************************************************/
-static IpcMemoryId
+static IpcMemoryId
SISegmentGet(int key, /* the corresponding key for the segment */
int size, /* size of segment in bytes */
bool create)
{
- IpcMemoryId shmid;
+ IpcMemoryId shmid;
if (create)
{
@@ -811,10 +811,10 @@ SISegmentAttach(IpcMemoryId shmid)
int
SISegmentInit(bool killExistingSegment, IPCKey key)
{
- SISegOffsets *oP;
- int segSize;
- IpcMemoryId shmId;
- bool create;
+ SISegOffsets *oP;
+ int segSize;
+ IpcMemoryId shmId;
+ bool create;
if (killExistingSegment)
{
diff --git a/src/backend/storage/ipc/spin.c b/src/backend/storage/ipc/spin.c
index e93d5894a58..3443c2db95b 100644
--- a/src/backend/storage/ipc/spin.c
+++ b/src/backend/storage/ipc/spin.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/storage/ipc/Attic/spin.c,v 1.7 1997/09/07 04:48:45 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/storage/ipc/Attic/spin.c,v 1.8 1997/09/08 02:29:02 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -36,7 +36,7 @@
#endif
/* globals used in this file */
-IpcSemaphoreId SpinLockId;
+IpcSemaphoreId SpinLockId;
#ifdef HAS_TEST_AND_SET
/* real spin lock implementations */
@@ -97,8 +97,8 @@ SpinRelease(SPINLOCK lock)
#else /* HAS_TEST_AND_SET */
/* Spinlocks are implemented using SysV semaphores */
-static bool AttachSpinLocks(IPCKey key);
-static bool SpinIsLocked(SPINLOCK lock);
+static bool AttachSpinLocks(IPCKey key);
+static bool SpinIsLocked(SPINLOCK lock);
/*
* SpinAcquire -- try to grab a spinlock
@@ -125,10 +125,10 @@ SpinRelease(SPINLOCK lock)
IpcSemaphoreUnlock(SpinLockId, lock, IpcExclusiveLock);
}
-static bool
+static bool
SpinIsLocked(SPINLOCK lock)
{
- int semval;
+ int semval;
semval = IpcSemaphoreGetValue(SpinLockId, lock);
return (semval < IpcSemaphoreDefaultStartValue);
@@ -143,8 +143,8 @@ bool
CreateSpinlocks(IPCKey key)
{
- int status;
- IpcSemaphoreId semid;
+ int status;
+ IpcSemaphoreId semid;
semid = IpcSemaphoreCreate(key, MAX_SPINS, IPCProtection,
IpcSemaphoreDefaultStartValue, 1, &status);
@@ -169,10 +169,10 @@ CreateSpinlocks(IPCKey key)
/*
* Attach to existing spinlock set
*/
-static bool
+static bool
AttachSpinLocks(IPCKey key)
{
- IpcSemaphoreId id;
+ IpcSemaphoreId id;
id = semget(key, MAX_SPINS, 0);
if (id < 0)