diff options
Diffstat (limited to 'src/backend/storage/ipc')
-rw-r--r-- | src/backend/storage/ipc/ipc.c | 32 | ||||
-rw-r--r-- | src/backend/storage/ipc/ipci.c | 4 | ||||
-rw-r--r-- | src/backend/storage/ipc/shmem.c | 52 | ||||
-rw-r--r-- | src/backend/storage/ipc/shmqueue.c | 8 | ||||
-rw-r--r-- | src/backend/storage/ipc/sinvaladt.c | 66 | ||||
-rw-r--r-- | src/backend/storage/ipc/spin.c | 20 |
6 files changed, 91 insertions, 91 deletions
diff --git a/src/backend/storage/ipc/ipc.c b/src/backend/storage/ipc/ipc.c index a9c56cf728f..48ccd13fba9 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.31 1998/08/25 21:34:01 scrappy Exp $ + * $Header: /cvsroot/pgsql/src/backend/storage/ipc/ipc.c,v 1.32 1998/09/01 03:25:08 momjian Exp $ * * NOTES * @@ -88,13 +88,13 @@ PrivateMemoryCreate(IpcMemoryKey memKey, elog(ERROR, "PrivateMemoryCreate: not enough memory to malloc"); MemSet(IpcPrivateMem[memid].memptr, 0, size); /* XXX PURIFY */ - return (memid++); + return memid++; } static char * PrivateMemoryAttach(IpcMemoryId memid) { - return (IpcPrivateMem[memid].memptr); + return IpcPrivateMem[memid].memptr; } @@ -205,14 +205,14 @@ int on_proc_exit(void (*function) (), caddr_t arg) { if (on_proc_exit_index >= MAX_ON_EXITS) - return (-1); + return -1; on_proc_exit_list[on_proc_exit_index].function = function; on_proc_exit_list[on_proc_exit_index].arg = arg; ++on_proc_exit_index; - return (0); + return 0; } /* ---------------------------------------------------------------- @@ -226,14 +226,14 @@ int on_shmem_exit(void (*function) (), caddr_t arg) { if (on_shmem_exit_index >= MAX_ON_EXITS) - return (-1); + return -1; on_shmem_exit_list[on_shmem_exit_index].function = function; on_shmem_exit_list[on_shmem_exit_index].arg = arg; ++on_shmem_exit_index; - return (0); + return 0; } /* ---------------------------------------------------------------- @@ -327,7 +327,7 @@ IpcSemaphoreCreate(IpcSemaphoreKey semKey, if (semNum > IPC_NMAXSEM || semNum <= 0) { *status = IpcInvalidArgument; - return (2); /* returns the number of the invalid + return 2; /* returns the number of the invalid * argument */ } @@ -378,7 +378,7 @@ IpcSemaphoreCreate(IpcSemaphoreKey semKey, fflush(stdout); fflush(stderr); #endif - return (semId); + return semId; } @@ -560,13 +560,13 @@ IpcMemoryCreate(IpcMemoryKey memKey, uint32 size, int permission) EPRINTF("IpcMemoryCreate: shmget failed (%s) " "key=%d, size=%d, permission=%o", strerror(errno), memKey, size, permission); - return (IpcMemCreationFailed); + return IpcMemCreationFailed; } /* if (memKey == PrivateIPCKey) */ on_shmem_exit(IPCPrivateMemoryKill, (caddr_t) shmid); - return (shmid); + return shmid; } /****************************************************************************/ @@ -585,10 +585,10 @@ IpcMemoryIdGet(IpcMemoryKey memKey, uint32 size) EPRINTF("IpcMemoryIdGet: shmget failed (%s) " "key=%d, size=%d, permission=%o", strerror(errno), memKey, size, 0); - return (IpcMemIdGetFailed); + return IpcMemIdGetFailed; } - return (shmid); + return shmid; } /****************************************************************************/ @@ -625,13 +625,13 @@ IpcMemoryAttach(IpcMemoryId memId) { EPRINTF("IpcMemoryAttach: shmat failed (%s) id=%d", strerror(errno), memId); - return (IpcMemAttachFailed); + return IpcMemAttachFailed; } if (!UsePrivateMemory) on_shmem_exit(IpcMemoryDetach, (caddr_t) memAddress); - return ((char *) memAddress); + return (char *) memAddress; } @@ -729,7 +729,7 @@ AttachSLockMemory(IPCKey key) bool LockIsFree(int lockid) { - return (SLockArray[lockid].flag == NOLOCK); + return SLockArray[lockid].flag == NOLOCK; } #endif diff --git a/src/backend/storage/ipc/ipci.c b/src/backend/storage/ipc/ipci.c index 330b5273164..f6ce9eda241 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.15 1998/06/27 15:47:44 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/storage/ipc/ipci.c,v 1.16 1998/09/01 03:25:10 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -34,7 +34,7 @@ SystemPortAddressCreateIPCKey(SystemPortAddress address) { Assert(address < 32768); /* XXX */ - return (SystemPortAddressGetIPCKey(address)); + return SystemPortAddressGetIPCKey(address); } /* diff --git a/src/backend/storage/ipc/shmem.c b/src/backend/storage/ipc/shmem.c index 4c74c836aef..f8f45aa4364 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.29 1998/07/27 19:38:10 vadim Exp $ + * $Header: /cvsroot/pgsql/src/backend/storage/ipc/shmem.c,v 1.30 1998/09/01 03:25:11 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -171,7 +171,7 @@ InitShmem(unsigned int key, unsigned int size) if (sharedRegion == NULL) { elog(FATAL, "AttachSharedRegion: couldn't attach to shmem\n"); - return (FALSE); + return FALSE; } /* get pointers to the dimensions of shared memory */ @@ -195,7 +195,7 @@ InitShmem(unsigned int key, unsigned int size) * allocator and shmem index. */ if (!InitSpinLocks(ShmemBootstrap, IPCKeyGetSpinLockSemaphoreKey(key))) - return (FALSE); + return FALSE; /* * We have just allocated additional space for two spinlocks. Now @@ -223,7 +223,7 @@ InitShmem(unsigned int key, unsigned int size) if (!ShmemIndex) { elog(FATAL, "InitShmem: couldn't initialize Shmem Index"); - return (FALSE); + return FALSE; } /* @@ -241,7 +241,7 @@ InitShmem(unsigned int key, unsigned int size) if (!result) { elog(FATAL, "InitShmem: corrupted shmem index"); - return (FALSE); + return FALSE; } if (!found) @@ -267,7 +267,7 @@ InitShmem(unsigned int key, unsigned int size) Assert(result->location == MAKE_OFFSET(ShmemIndex->hctl)); - return (TRUE); + return TRUE; } /* @@ -312,7 +312,7 @@ ShmemAlloc(unsigned long size) if (!newSpace) elog(NOTICE, "ShmemAlloc: out of memory "); - return (newSpace); + return newSpace; } /* @@ -323,7 +323,7 @@ ShmemAlloc(unsigned long size) int ShmemIsValid(unsigned long addr) { - return ((addr < ShmemEnd) && (addr >= ShmemBase)); + return (addr < ShmemEnd) && (addr >= ShmemBase); } /* @@ -366,7 +366,7 @@ ShmemInitHash(char *name, /* table string name for shmem index */ * message since they have more information */ if (location == NULL) - return (0); + return 0; /* * it already exists, attach to it rather than allocate and initialize @@ -381,7 +381,7 @@ ShmemInitHash(char *name, /* table string name for shmem index */ /* directory for hash lookup */ infoP->dir = (long *) (location + sizeof(HHDR)); - return (hash_create(init_size, infoP, hash_flags));; + return hash_create(init_size, infoP, hash_flags);; } /* @@ -414,7 +414,7 @@ ShmemPIDLookup(int pid, SHMEM_OFFSET *locationPtr) SpinRelease(ShmemIndexLock); elog(ERROR, "ShmemInitPID: ShmemIndex corrupted"); - return (FALSE); + return FALSE; } @@ -424,7 +424,7 @@ ShmemPIDLookup(int pid, SHMEM_OFFSET *locationPtr) result->location = *locationPtr; SpinRelease(ShmemIndexLock); - return (TRUE); + return TRUE; } /* @@ -461,14 +461,14 @@ ShmemPIDDestroy(int pid) { elog(ERROR, "ShmemPIDDestroy: PID table corrupted"); - return (INVALID_OFFSET); + return INVALID_OFFSET; } if (found) - return (location); + return location; else - return (INVALID_OFFSET); + return INVALID_OFFSET; } /* @@ -516,14 +516,14 @@ ShmemInitStruct(char *name, unsigned long size, bool *foundPtr) /* in POSTMASTER/Single process */ *foundPtr = FALSE; - return ((long *) ShmemAlloc(size)); + return (long *) ShmemAlloc(size); } else { Assert(ShmemIndexOffset); *foundPtr = TRUE; - return ((long *) MAKE_PTR(*ShmemIndexOffset)); + return (long *) MAKE_PTR(*ShmemIndexOffset); } @@ -540,7 +540,7 @@ ShmemInitStruct(char *name, unsigned long size, bool *foundPtr) SpinRelease(ShmemIndexLock); elog(ERROR, "ShmemInitStruct: Shmem Index corrupted"); - return (NULL); + return NULL; } else if (*foundPtr) @@ -556,7 +556,7 @@ ShmemInitStruct(char *name, unsigned long size, bool *foundPtr) elog(NOTICE, "ShmemInitStruct: ShmemIndex entry size is wrong"); /* let caller print its message too */ - return (NULL); + return NULL; } structPtr = (long *) MAKE_PTR(result->location); } @@ -574,7 +574,7 @@ ShmemInitStruct(char *name, unsigned long size, bool *foundPtr) elog(NOTICE, "ShmemInitStruct: cannot allocate '%s'", name); - return (NULL); + return NULL; } result->size = size; result->location = MAKE_OFFSET(structPtr); @@ -582,7 +582,7 @@ ShmemInitStruct(char *name, unsigned long size, bool *foundPtr) Assert(ShmemIsValid((unsigned long) structPtr)); SpinRelease(ShmemIndexLock); - return (structPtr); + return structPtr; } /* @@ -607,7 +607,7 @@ TransactionIdIsInProgress(TransactionId xid) if (result == (ShmemIndexEnt *) TRUE) { SpinRelease(ShmemIndexLock); - return (false); + return false; } if (result->location == INVALID_OFFSET || strncmp(result->key, "PID ", 4) != 0) @@ -616,13 +616,13 @@ TransactionIdIsInProgress(TransactionId xid) if (proc->xid == xid) { SpinRelease(ShmemIndexLock); - return (true); + return true; } } SpinRelease(ShmemIndexLock); elog(ERROR, "TransactionIdIsInProgress: ShmemIndex corrupted"); - return (false); + return false; } #ifdef LowLevelLocking @@ -665,7 +665,7 @@ GetSnapshotData(bool serialized) MyProc->xmin = snapshot->xmin; SpinRelease(ShmemIndexLock); snapshot->xip[count] = InvalidTransactionId; - return (snapshot); + return snapshot; } if (result->location == INVALID_OFFSET || strncmp(result->key, "PID ", 4) != 0) @@ -693,6 +693,6 @@ GetSnapshotData(bool serialized) free(snapshot->xip); free(snapshot); elog(ERROR, "GetSnapshotData: ShmemIndex corrupted"); - return (NULL); + return NULL; } #endif diff --git a/src/backend/storage/ipc/shmqueue.c b/src/backend/storage/ipc/shmqueue.c index c3156fbb35b..95ebfd01360 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.7 1998/07/20 16:56:54 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/storage/ipc/shmqueue.c,v 1.8 1998/09/01 03:25:13 momjian Exp $ * * NOTES * @@ -54,7 +54,7 @@ bool SHMQueueIsDetached(SHM_QUEUE *queue) { Assert(SHM_PTR_VALID(queue)); - return ((queue)->prev == INVALID_OFFSET); + return (queue)->prev == INVALID_OFFSET; } #endif @@ -250,7 +250,7 @@ SHMQueueEmpty(SHM_QUEUE *queue) if (queue->prev == MAKE_OFFSET(queue)) { Assert(queue->next = MAKE_OFFSET(queue)); - return (TRUE); + return TRUE; } - return (FALSE); + return FALSE; } diff --git a/src/backend/storage/ipc/sinvaladt.c b/src/backend/storage/ipc/sinvaladt.c index 5ddaf3725b1..adfa1757d9b 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.13 1998/08/25 21:31:18 scrappy Exp $ + * $Header: /cvsroot/pgsql/src/backend/storage/ipc/sinvaladt.c,v 1.14 1998/09/01 03:25:14 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -170,7 +170,7 @@ SIAssignBackendId(SISeg *segInOutP, BackendTag backendTag) stateP->tag = backendTag; - return (1 + stateP - &segInOutP->procState[0]); + return 1 + stateP - &segInOutP->procState[0]; } @@ -232,7 +232,7 @@ SIComputeSize(int *segSize) oP->startSegment = A; oP->offsetToFirstEntry = a; /* relatiove to A */ oP->offsetToEndOfSegemnt = totalSize; /* relative to A */ - return (oP); + return oP; } @@ -251,7 +251,7 @@ SISetStartEntrySection(SISeg *segP, Offset offset) static Offset SIGetStartEntrySection(SISeg *segP) { - return (segP->startEntrySection); + return segP->startEntrySection; } @@ -279,7 +279,7 @@ SISetEndEntryChain(SISeg *segP, Offset offset) static Offset SIGetEndEntryChain(SISeg *segP) { - return (segP->endEntryChain); + return segP->endEntryChain; } /************************************************************************/ @@ -297,7 +297,7 @@ SISetStartEntryChain(SISeg *segP, Offset offset) static Offset SIGetStartEntryChain(SISeg *segP) { - return (segP->startEntryChain); + return segP->startEntryChain; } /************************************************************************/ @@ -309,11 +309,11 @@ SISetNumEntries(SISeg *segP, int num) if (num <= MAXNUMMESSAGES) { segP->numEntries = num; - return (true); + return true; } else { - return (false); /* table full */ + return false; /* table full */ } } @@ -323,7 +323,7 @@ SISetNumEntries(SISeg *segP, int num) static int SIGetNumEntries(SISeg *segP) { - return (segP->numEntries); + return segP->numEntries; } @@ -336,11 +336,11 @@ SISetMaxNumEntries(SISeg *segP, int num) if (num <= MAXNUMMESSAGES) { segP->maxNumEntries = num; - return (true); + return true; } else { - return (false); /* wrong number */ + return false; /* wrong number */ } } @@ -351,7 +351,7 @@ SISetMaxNumEntries(SISeg *segP, int num) static int SIGetProcStateLimit(SISeg *segP, int i) { - return (segP->procState[i].limit); + return segP->procState[i].limit; } /************************************************************************/ @@ -376,11 +376,11 @@ SIIncNumEntries(SISeg *segP, int num) if ((segP->numEntries + num) <= MAXNUMMESSAGES) { segP->numEntries = segP->numEntries + num; - return (true); + return true; } else { - return (false); /* table full */ + return false; /* table full */ } } @@ -393,11 +393,11 @@ SIDecNumEntries(SISeg *segP, int num) if ((segP->numEntries - num) >= 0) { segP->numEntries = segP->numEntries - num; - return (true); + return true; } else { - return (false); /* not enough entries in table */ + return false; /* not enough entries in table */ } } @@ -416,7 +416,7 @@ SISetStartFreeSpace(SISeg *segP, Offset offset) static Offset SIGetStartFreeSpace(SISeg *segP) { - return (segP->startFreeSpace); + return segP->startFreeSpace; } @@ -433,12 +433,12 @@ SIGetFirstDataEntry(SISeg *segP) startChain = SIGetStartEntryChain(segP); if (startChain == InvalidOffset) - return (NULL); + return NULL; eP = (SISegEntry *) ((Pointer) segP + SIGetStartEntrySection(segP) + startChain); - return (eP); + return eP; } @@ -454,12 +454,12 @@ SIGetLastDataEntry(SISeg *segP) endChain = SIGetEndEntryChain(segP); if (endChain == InvalidOffset) - return (NULL); + return NULL; eP = (SISegEntry *) ((Pointer) segP + SIGetStartEntrySection(segP) + endChain); - return (eP); + return eP; } /************************************************************************/ @@ -471,12 +471,12 @@ SIGetNextDataEntry(SISeg *segP, Offset offset) SISegEntry *eP; if (offset == InvalidOffset) - return (NULL); + return NULL; eP = (SISegEntry *) ((Pointer) segP + SIGetStartEntrySection(segP) + offset); - return (eP); + return eP; } @@ -491,7 +491,7 @@ SIGetNthDataEntry(SISeg *segP, int i; if (n <= 0) - return (NULL); + return NULL; eP = SIGetFirstDataEntry(segP); for (i = 1; i < n; i++) @@ -500,7 +500,7 @@ SIGetNthDataEntry(SISeg *segP, eP = SIGetNextDataEntry(segP, eP->next); } - return (eP); + return eP; } /************************************************************************/ @@ -527,7 +527,7 @@ SISetDataEntry(SISeg *segP, SharedInvalidData *data) *lastP; if (!SIIncNumEntries(segP, 1)) - return (false); /* no space */ + return false; /* no space */ /* get a free entry */ offsetToNewData = SIGetStartFreeSpace(segP); @@ -551,7 +551,7 @@ SISetDataEntry(SISeg *segP, SharedInvalidData *data) lastP->next = SIEntryOffset(segP, eP); } SISetEndEntryChain(segP, SIEntryOffset(segP, eP)); - return (true); + return true; } @@ -591,7 +591,7 @@ SIDelDataEntry(SISeg *segP) if (!SIDecNumEntries(segP, 1)) { /* no entries in buffer */ - return (false); + return false; } e1P = SIGetFirstDataEntry(segP); @@ -606,7 +606,7 @@ SIDelDataEntry(SISeg *segP) e1P->next = SIGetStartFreeSpace(segP); SISetStartFreeSpace(segP, SIEntryOffset(segP, e1P)); SIDecProcLimit(segP, 1); - return (true); + return true; } @@ -794,7 +794,7 @@ SISegmentGet(int key, /* the corresponding key for the segment */ shmid = IpcMemoryCreate(key, size, IPCProtection); else shmid = IpcMemoryIdGet(key, size); - return (shmid); + return shmid; } /************************************************************************/ @@ -844,7 +844,7 @@ SISegmentInit(bool killExistingSegment, IPCKey key) if (shmId < 0) { perror("SISegmentGet: failed"); - return (-1); /* an error */ + return -1; /* an error */ } /* Attach the shared cache invalidation segment */ @@ -862,10 +862,10 @@ SISegmentInit(bool killExistingSegment, IPCKey key) if (shmId < 0) { perror("SISegmentGet: getting an existent segment failed"); - return (-1); /* an error */ + return -1; /* an error */ } /* Attach the shared cache invalidation segment */ SISegmentAttach(shmId); } - return (1); + return 1; } diff --git a/src/backend/storage/ipc/spin.c b/src/backend/storage/ipc/spin.c index 7f8986e411a..398815fe188 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.15 1998/08/25 21:34:03 scrappy Exp $ + * $Header: /cvsroot/pgsql/src/backend/storage/ipc/Attic/spin.c,v 1.16 1998/09/01 03:25:15 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -47,7 +47,7 @@ bool CreateSpinlocks(IPCKey key) { /* the spin lock shared memory must have been created by now */ - return (TRUE); + return TRUE; } bool @@ -78,7 +78,7 @@ InitSpinLocks(int init, IPCKey key) MMCacheLock = (SPINLOCK) MMCACHELOCKID; #endif - return (TRUE); + return TRUE; } #ifdef LOCKDEBUG @@ -217,7 +217,7 @@ SpinIsLocked(SPINLOCK lock) int semval; semval = IpcSemaphoreGetValue(SpinLockId, lock); - return (semval < IpcSemaphoreDefaultStartValue); + return semval < IpcSemaphoreDefaultStartValue; } /* @@ -245,11 +245,11 @@ CreateSpinlocks(IPCKey key) if (semid >= 0) { SpinLockId = semid; - return (TRUE); + return TRUE; } /* cannot create spinlocks */ elog(FATAL, "CreateSpinlocks: cannot create spin locks"); - return (FALSE); + return FALSE; } /* @@ -270,10 +270,10 @@ AttachSpinLocks(IPCKey key) } /* cannot create spinlocks */ elog(FATAL, "AttachSpinlocks: cannot create spin locks"); - return (FALSE); + return FALSE; } SpinLockId = id; - return (TRUE); + return TRUE; } /* @@ -314,7 +314,7 @@ InitSpinLocks(int init, IPCKey key) if (!AttachSpinLocks(key)) { elog(FATAL, "InitSpinLocks: couldnt attach spin locks"); - return (FALSE); + return FALSE; } } @@ -331,7 +331,7 @@ InitSpinLocks(int init, IPCKey key) MMCacheLock = (SPINLOCK) MMCACHELOCKID; #endif - return (TRUE); + return TRUE; } #endif /* HAS_TEST_AND_SET */ |