1
0
mirror of https://github.com/postgres/postgres.git synced 2025-10-28 11:55:03 +03:00

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.
This commit is contained in:
Tom Lane
2002-05-05 00:03:29 +00:00
parent 91fc10fdac
commit 72a3902a66
37 changed files with 1659 additions and 1370 deletions

View File

@@ -16,7 +16,7 @@
*
* Copyright (c) 2001, PostgreSQL Global Development Group
*
* $Header: /cvsroot/pgsql/src/backend/postmaster/pgstat.c,v 1.19 2002/04/03 00:27:25 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/postmaster/pgstat.c,v 1.20 2002/05/05 00:03:28 tgl Exp $
* ----------
*/
#include "postgres.h"
@@ -44,6 +44,7 @@
#include "miscadmin.h"
#include "utils/memutils.h"
#include "storage/backendid.h"
#include "storage/ipc.h"
#include "utils/rel.h"
#include "utils/hsearch.h"
#include "utils/ps_status.h"

View File

@@ -37,7 +37,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.272 2002/04/04 04:25:48 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.273 2002/05/05 00:03:28 tgl Exp $
*
* NOTES
*
@@ -1361,18 +1361,15 @@ ClosePostmasterPorts(bool pgstat_too)
static void
reset_shared(unsigned short port)
{
/*
* Reset assignment of shared mem and semaphore IPC keys. Doing this
* means that in normal cases we'll assign the same keys on each
* "cycle of life", and thereby avoid leaving dead IPC objects
* floating around if the postmaster crashes and is restarted.
*/
IpcInitKeyAssignment(port);
/*
* Create or re-create shared memory and semaphores.
*
* Note: in each "cycle of life" we will normally assign the same IPC
* keys (if using SysV shmem and/or semas), since the port number is
* used to determine IPC keys. This helps ensure that we will clean up
* dead IPC objects if the postmaster crashes and is restarted.
*/
CreateSharedMemoryAndSemaphores(false, MaxBackends);
CreateSharedMemoryAndSemaphores(false, MaxBackends, port);
}