summaryrefslogtreecommitdiff
path: root/src/backend/storage/ipc/ipci.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2002-05-05 00:03:29 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2002-05-05 00:03:29 +0000
commit72a3902a664c7fbceb2034e28e444b28f96fa717 (patch)
treeff42e4494af6ea1c1cdf524f3feb5fc670217f0c /src/backend/storage/ipc/ipci.c
parent91fc10fdacfcbadc123fd9d8ee16a4568f8c636b (diff)
Create an internal semaphore API that is not tied to SysV semaphores.
As proof of concept, provide an alternate implementation based on POSIX semaphores. Also push the SysV shared-memory implementation into a separate file so that it can be replaced conveniently.
Diffstat (limited to 'src/backend/storage/ipc/ipci.c')
-rw-r--r--src/backend/storage/ipc/ipci.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/src/backend/storage/ipc/ipci.c b/src/backend/storage/ipc/ipci.c
index c2950dc767a..34412e3ed44 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.46 2002/03/02 21:39:29 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/storage/ipc/ipci.c,v 1.47 2002/05/05 00:03:28 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -21,8 +21,11 @@
#include "access/xlog.h"
#include "storage/bufmgr.h"
#include "storage/freespace.h"
+#include "storage/ipc.h"
#include "storage/lmgr.h"
#include "storage/lwlock.h"
+#include "storage/pg_sema.h"
+#include "storage/pg_shmem.h"
#include "storage/pmsignal.h"
#include "storage/proc.h"
#include "storage/sinval.h"
@@ -41,9 +44,12 @@
* memory. This is true for a standalone backend, false for a postmaster.
*/
void
-CreateSharedMemoryAndSemaphores(bool makePrivate, int maxBackends)
+CreateSharedMemoryAndSemaphores(bool makePrivate,
+ int maxBackends,
+ int port)
{
int size;
+ int numSemas;
PGShmemHeader *seghdr;
/*
@@ -70,12 +76,14 @@ CreateSharedMemoryAndSemaphores(bool makePrivate, int maxBackends)
/*
* Create the shmem segment
*/
- seghdr = IpcMemoryCreate(size, makePrivate, IPCProtection);
+ seghdr = PGSharedMemoryCreate(size, makePrivate, port);
/*
- * First initialize spinlocks --- needed by InitShmemAllocation()
+ * Create semaphores
*/
- CreateSpinlocks();
+ numSemas = ProcGlobalSemas(maxBackends);
+ numSemas += SpinlockSemas();
+ PGReserveSemaphores(numSemas, port);
/*
* Set up shared memory allocation mechanism