aboutsummaryrefslogtreecommitdiff
path: root/src/backend/storage/ipc
diff options
context:
space:
mode:
authorBruce Momjian <bruce@momjian.us>2001-10-25 05:50:21 +0000
committerBruce Momjian <bruce@momjian.us>2001-10-25 05:50:21 +0000
commitb81844b1738c584d92330a5ccd0fbd8b603d2886 (patch)
tree4fae0d4cd26048177fc5cd1a2dd91abc99ba0f99 /src/backend/storage/ipc
parent59da2105d8e6d95345b3b942a2e2aba8cead4838 (diff)
downloadpostgresql-b81844b1738c584d92330a5ccd0fbd8b603d2886.tar.gz
postgresql-b81844b1738c584d92330a5ccd0fbd8b603d2886.zip
pgindent run on all C files. Java run to follow. initdb/regression
tests pass.
Diffstat (limited to 'src/backend/storage/ipc')
-rw-r--r--src/backend/storage/ipc/ipc.c15
-rw-r--r--src/backend/storage/ipc/ipci.c6
-rw-r--r--src/backend/storage/ipc/shmem.c15
-rw-r--r--src/backend/storage/ipc/shmqueue.c6
-rw-r--r--src/backend/storage/ipc/sinval.c48
5 files changed, 43 insertions, 47 deletions
diff --git a/src/backend/storage/ipc/ipc.c b/src/backend/storage/ipc/ipc.c
index 1eb28a48cd8..d083d071bd6 100644
--- a/src/backend/storage/ipc/ipc.c
+++ b/src/backend/storage/ipc/ipc.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/storage/ipc/ipc.c,v 1.71 2001/10/01 23:26:55 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/storage/ipc/ipc.c,v 1.72 2001/10/25 05:49:42 momjian Exp $
*
* NOTES
*
@@ -114,7 +114,6 @@ static int on_proc_exit_index,
void
proc_exit(int code)
{
-
/*
* Once we set this flag, we are committed to exit. Any elog() will
* NOT send control back to the main loop, but right back here.
@@ -275,7 +274,6 @@ InternalIpcSemaphoreCreate(IpcSemaphoreKey semKey,
if (semId < 0)
{
-
/*
* Fail quietly if error indicates a collision with existing set.
* One would expect EEXIST, given that we said IPC_EXCL, but
@@ -592,7 +590,7 @@ InternalIpcMemoryCreate(IpcMemoryKey memKey, uint32 size, int permission)
"\nThis error usually means that PostgreSQL's request for a shared memory\n"
"segment exceeded your kernel's SHMMAX parameter. You can either\n"
"reduce the request size or reconfigure the kernel with larger SHMMAX.\n"
- "To reduce the request size (currently %u bytes), reduce\n"
+ "To reduce the request size (currently %u bytes), reduce\n"
"PostgreSQL's shared_buffers parameter (currently %d) and/or\n"
"its max_connections parameter (currently %d).\n"
"\n"
@@ -607,8 +605,8 @@ InternalIpcMemoryCreate(IpcMemoryKey memKey, uint32 size, int permission)
else if (errno == ENOMEM)
fprintf(stderr,
"\nThis error usually means that PostgreSQL's request for a shared\n"
- "memory segment exceeded available memory or swap space.\n"
- "To reduce the request size (currently %u bytes), reduce\n"
+ "memory segment exceeded available memory or swap space.\n"
+ "To reduce the request size (currently %u bytes), reduce\n"
"PostgreSQL's shared_buffers parameter (currently %d) and/or\n"
"its max_connections parameter (currently %d).\n"
"\n"
@@ -623,7 +621,7 @@ InternalIpcMemoryCreate(IpcMemoryKey memKey, uint32 size, int permission)
"It occurs either if all available shared memory IDs have been taken,\n"
"in which case you need to raise the SHMMNI parameter in your kernel,\n"
"or because the system's overall limit for shared memory has been\n"
- "reached. If you cannot increase the shared memory limit,\n"
+ "reached. If you cannot increase the shared memory limit,\n"
"reduce PostgreSQL's shared memory request (currently %u bytes),\n"
"by reducing its shared_buffers parameter (currently %d) and/or\n"
"its max_connections parameter (currently %d).\n"
@@ -710,7 +708,6 @@ SharedMemoryIsInUse(IpcMemoryKey shmKey, IpcMemoryId shmId)
*/
if (shmctl(shmId, IPC_STAT, &shmStat) < 0)
{
-
/*
* EINVAL actually has multiple possible causes documented in the
* shmctl man page, but we assume it must mean the segment no
@@ -748,7 +745,7 @@ PrivateMemoryCreate(uint32 size)
fprintf(stderr, "PrivateMemoryCreate: malloc(%u) failed\n", size);
proc_exit(1);
}
- MemSet(memAddress, 0, size);/* keep Purify quiet */
+ MemSet(memAddress, 0, size); /* keep Purify quiet */
/* Register on-exit routine to release storage */
on_shmem_exit(PrivateMemoryDelete, PointerGetDatum(memAddress));
diff --git a/src/backend/storage/ipc/ipci.c b/src/backend/storage/ipc/ipci.c
index 7dac93f3a03..cf841a614d3 100644
--- a/src/backend/storage/ipc/ipci.c
+++ b/src/backend/storage/ipc/ipci.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/storage/ipc/ipci.c,v 1.43 2001/09/29 04:02:23 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/storage/ipc/ipci.c,v 1.44 2001/10/25 05:49:42 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -83,8 +83,8 @@ CreateSharedMemoryAndSemaphores(bool makePrivate, int maxBackends)
InitShmemAllocation(seghdr);
/*
- * Now initialize LWLocks, which do shared memory allocation and
- * are needed for InitShmemIndex.
+ * Now initialize LWLocks, which do shared memory allocation and are
+ * needed for InitShmemIndex.
*/
CreateLWLocks();
diff --git a/src/backend/storage/ipc/shmem.c b/src/backend/storage/ipc/shmem.c
index 32f2cf98a1d..3304ec67c59 100644
--- a/src/backend/storage/ipc/shmem.c
+++ b/src/backend/storage/ipc/shmem.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/storage/ipc/shmem.c,v 1.61 2001/10/05 17:28:12 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/storage/ipc/shmem.c,v 1.62 2001/10/25 05:49:42 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -97,8 +97,9 @@ InitShmemAllocation(void *seghdr)
ShmemEnd = ShmemBase + shmhdr->totalsize;
/*
- * Initialize the spinlock used by ShmemAlloc. We have to do the
- * space allocation the hard way, since ShmemAlloc can't be called yet.
+ * Initialize the spinlock used by ShmemAlloc. We have to do the
+ * space allocation the hard way, since ShmemAlloc can't be called
+ * yet.
*/
ShmemLock = (slock_t *) (((char *) shmhdr) + shmhdr->freeoffset);
shmhdr->freeoffset += MAXALIGN(sizeof(slock_t));
@@ -234,7 +235,7 @@ InitShmemIndex(void)
* table at once.
*/
HTAB *
-ShmemInitHash(const char *name, /* table string name for shmem index */
+ShmemInitHash(const char *name, /* table string name for shmem index */
long init_size, /* initial table size */
long max_size, /* max size of the table */
HASHCTL *infoP, /* info about key and bucket size */
@@ -256,7 +257,7 @@ ShmemInitHash(const char *name, /* table string name for shmem index */
/* look it up in the shmem index */
location = ShmemInitStruct(name,
- sizeof(HASHHDR) + infoP->dsize * sizeof(HASHSEGMENT),
+ sizeof(HASHHDR) + infoP->dsize * sizeof(HASHSEGMENT),
&found);
/*
@@ -267,8 +268,8 @@ ShmemInitHash(const char *name, /* table string name for shmem index */
return NULL;
/*
- * if it already exists, attach to it rather than allocate and initialize
- * new space
+ * if it already exists, attach to it rather than allocate and
+ * initialize new space
*/
if (found)
hash_flags |= HASH_ATTACH;
diff --git a/src/backend/storage/ipc/shmqueue.c b/src/backend/storage/ipc/shmqueue.c
index b840596a6ff..4f677887420 100644
--- a/src/backend/storage/ipc/shmqueue.c
+++ b/src/backend/storage/ipc/shmqueue.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/storage/ipc/shmqueue.c,v 1.16 2001/03/22 03:59:45 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/storage/ipc/shmqueue.c,v 1.17 2001/10/25 05:49:42 momjian Exp $
*
* NOTES
*
@@ -33,7 +33,6 @@
#define SHMQUEUE_DEBUG_ELOG NOTICE
static void dumpQ(SHM_QUEUE *q, char *s);
-
#endif
@@ -59,7 +58,6 @@ SHMQueueIsDetached(SHM_QUEUE *queue)
Assert(SHM_PTR_VALID(queue));
return (queue)->prev == INVALID_OFFSET;
}
-
#endif
/*
@@ -152,7 +150,6 @@ SHMQueueInsertAfter(SHM_QUEUE *queue, SHM_QUEUE *elem)
dumpQ(queue, "in SHMQueueInsertAfter: end");
#endif
}
-
#endif /* NOT_USED */
/*--------------------
@@ -256,5 +253,4 @@ dumpQ(SHM_QUEUE *q, char *s)
strcat(buf, elem);
elog(SHMQUEUE_DEBUG_ELOG, "%s: %s", s, buf);
}
-
#endif /* SHMQUEUE_DEBUG */
diff --git a/src/backend/storage/ipc/sinval.c b/src/backend/storage/ipc/sinval.c
index 4a3b1114a90..1d1e9076d7f 100644
--- a/src/backend/storage/ipc/sinval.c
+++ b/src/backend/storage/ipc/sinval.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/storage/ipc/sinval.c,v 1.42 2001/09/29 15:29:48 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/storage/ipc/sinval.c,v 1.43 2001/10/25 05:49:42 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -42,7 +42,7 @@ CreateSharedInvalidationState(int maxBackends)
void
InitBackendSharedInvalidationState(void)
{
- int flag;
+ int flag;
LWLockAcquire(SInvalLock, LW_EXCLUSIVE);
flag = SIBackendInit(shmInvalBuffer);
@@ -75,8 +75,8 @@ SendSharedInvalidMessage(SharedInvalidationMessage *msg)
*/
void
ReceiveSharedInvalidMessages(
- void (*invalFunction) (SharedInvalidationMessage *msg),
- void (*resetFunction) (void))
+ void (*invalFunction) (SharedInvalidationMessage *msg),
+ void (*resetFunction) (void))
{
SharedInvalidationMessage data;
int getResult;
@@ -85,19 +85,19 @@ ReceiveSharedInvalidMessages(
for (;;)
{
/*
- * We can run SIGetDataEntry in parallel with other backends running
- * SIGetDataEntry for themselves, since each instance will modify
- * only fields of its own backend's ProcState, and no instance will
- * look at fields of other backends' ProcStates. We express this
- * by grabbing SInvalLock in shared mode. Note that this is not
- * exactly the normal (read-only) interpretation of a shared lock!
- * Look closely at the interactions before allowing SInvalLock to
- * be grabbed in shared mode for any other reason!
+ * We can run SIGetDataEntry in parallel with other backends
+ * running SIGetDataEntry for themselves, since each instance will
+ * modify only fields of its own backend's ProcState, and no
+ * instance will look at fields of other backends' ProcStates. We
+ * express this by grabbing SInvalLock in shared mode. Note that
+ * this is not exactly the normal (read-only) interpretation of a
+ * shared lock! Look closely at the interactions before allowing
+ * SInvalLock to be grabbed in shared mode for any other reason!
*
- * The routines later in this file that use shared mode are okay
- * with this, because they aren't looking at the ProcState fields
- * associated with SI message transfer; they only use the ProcState
- * array as an easy way to find all the PROC structures.
+ * The routines later in this file that use shared mode are okay with
+ * this, because they aren't looking at the ProcState fields
+ * associated with SI message transfer; they only use the
+ * ProcState array as an easy way to find all the PROC structures.
*/
LWLockAcquire(SInvalLock, LW_SHARED);
getResult = SIGetDataEntry(shmInvalBuffer, MyBackendId, &data);
@@ -209,6 +209,7 @@ TransactionIdIsInProgress(TransactionId xid)
if (pOffset != INVALID_OFFSET)
{
PROC *proc = (PROC *) MAKE_PTR(pOffset);
+
/* Fetch xid just once - see GetNewTransactionId */
TransactionId pxid = proc->xid;
@@ -233,7 +234,7 @@ TransactionIdIsInProgress(TransactionId xid)
* then only backends running in my own database are considered.
*
* This is used by VACUUM to decide which deleted tuples must be preserved
- * in a table. allDbs = TRUE is needed for shared relations, but allDbs =
+ * in a table. allDbs = TRUE is needed for shared relations, but allDbs =
* FALSE is sufficient for non-shared relations, since only backends in my
* own database could ever see the tuples in them.
*
@@ -331,7 +332,7 @@ GetSnapshotData(bool serializable)
/*--------------------
* Unfortunately, we have to call ReadNewTransactionId() after acquiring
* SInvalLock above. It's not good because ReadNewTransactionId() does
- * LWLockAcquire(XidGenLock), but *necessary*. We need to be sure that
+ * LWLockAcquire(XidGenLock), but *necessary*. We need to be sure that
* no transactions exit the set of currently-running transactions
* between the time we fetch xmax and the time we finish building our
* snapshot. Otherwise we could have a situation like this:
@@ -364,18 +365,19 @@ GetSnapshotData(bool serializable)
if (pOffset != INVALID_OFFSET)
{
PROC *proc = (PROC *) MAKE_PTR(pOffset);
+
/* Fetch xid just once - see GetNewTransactionId */
TransactionId xid = proc->xid;
/*
* Ignore my own proc (dealt with my xid above), procs not
- * running a transaction, and xacts started since we read
- * the next transaction ID. There's no need to store XIDs
- * above what we got from ReadNewTransactionId, since we'll
- * treat them as running anyway.
+ * running a transaction, and xacts started since we read the
+ * next transaction ID. There's no need to store XIDs above
+ * what we got from ReadNewTransactionId, since we'll treat
+ * them as running anyway.
*/
if (proc == MyProc ||
- ! TransactionIdIsNormal(xid) ||
+ !TransactionIdIsNormal(xid) ||
TransactionIdFollowsOrEquals(xid, snapshot->xmax))
continue;