summaryrefslogtreecommitdiff
path: root/src/backend/storage/ipc/ipci.c
diff options
context:
space:
mode:
authorTom Lane1999-02-19 06:06:39 +0000
committerTom Lane1999-02-19 06:06:39 +0000
commite77b630cf0c1501008b3b72b5621f2951ef82b71 (patch)
tree6b25afa56af95f41ced9eab5e56f12eb58f03d7b /src/backend/storage/ipc/ipci.c
parent612b8434e40edc299e38bd6e4d7ac07183513118 (diff)
Allow maximum number of backends to be set at configure time
(--with-maxbackends). Add a postmaster switch (-N backends) that allows the limit to be reduced at postmaster start time. (You can't increase it, sorry to say, because there are still some fixed-size arrays.) Grab the number of semaphores indicated by min(MAXBACKENDS, -N) at postmaster startup, so that this particular form of bogus configuration is exposed immediately rather than under heavy load.
Diffstat (limited to 'src/backend/storage/ipc/ipci.c')
-rw-r--r--src/backend/storage/ipc/ipci.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/backend/storage/ipc/ipci.c b/src/backend/storage/ipc/ipci.c
index 0a75af6c3e0..fb27b92d224 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.18 1999/02/13 23:18:11 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/storage/ipc/ipci.c,v 1.19 1999/02/19 06:06:04 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -44,17 +44,19 @@ SystemPortAddressCreateIPCKey(SystemPortAddress address)
CreateSharedMemoryAndSemaphores
is called exactly *ONCE* by the postmaster.
- It is *NEVER* called by the postgres backend
+ It is *NEVER* called by the postgres backend,
+ except in the case of a standalone backend.
0) destroy any existing semaphores for both buffer
and lock managers.
1) create the appropriate *SHARED* memory segments
for the two resource managers.
+ 2) create shared semaphores as needed.
**************************************************/
void
-CreateSharedMemoryAndSemaphores(IPCKey key)
+CreateSharedMemoryAndSemaphores(IPCKey key, int maxBackends)
{
int size;
@@ -98,7 +100,7 @@ CreateSharedMemoryAndSemaphores(IPCKey key)
* do process table stuff
* ----------------
*/
- InitProcGlobal(key);
+ InitProcGlobal(key, maxBackends);
on_shmem_exit(ProcFreeAllSemaphores, NULL);
CreateSharedInvalidationState(key);
@@ -120,7 +122,7 @@ AttachSharedMemoryAndSemaphores(IPCKey key)
*/
if (key == PrivateIPCKey)
{
- CreateSharedMemoryAndSemaphores(key);
+ CreateSharedMemoryAndSemaphores(key, 1);
return;
}