aboutsummaryrefslogtreecommitdiff
path: root/src/backend/access/transam/slru.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2004-05-28 05:13:32 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2004-05-28 05:13:32 +0000
commit1a321f26d88e5c64bccba9d36920aede1e201729 (patch)
tree43940a3ed5cc754bff68748502550731b0ad19a0 /src/backend/access/transam/slru.c
parent37da0ba0e0f2d92857dc62789820d21e177dc00f (diff)
downloadpostgresql-1a321f26d88e5c64bccba9d36920aede1e201729.tar.gz
postgresql-1a321f26d88e5c64bccba9d36920aede1e201729.zip
Code review for EXEC_BACKEND changes. Reduce the number of #ifdefs by
about a third, make it work on non-Windows platforms again. (But perhaps I broke the WIN32 code, since I have no way to test that.) Fold all the paths that fork postmaster child processes to go through the single routine SubPostmasterMain, which takes care of resurrecting the state that would normally be inherited from the postmaster (including GUC variables). Clean up some places where there's no particularly good reason for the EXEC and non-EXEC cases to work differently. Take care of one or two FIXMEs that remained in the code.
Diffstat (limited to 'src/backend/access/transam/slru.c')
-rw-r--r--src/backend/access/transam/slru.c21
1 files changed, 4 insertions, 17 deletions
diff --git a/src/backend/access/transam/slru.c b/src/backend/access/transam/slru.c
index a12fe885563..dff221bf277 100644
--- a/src/backend/access/transam/slru.c
+++ b/src/backend/access/transam/slru.c
@@ -6,7 +6,7 @@
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/backend/access/transam/slru.c,v 1.13 2004/02/23 23:03:10 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/access/transam/slru.c,v 1.14 2004/05/28 05:12:42 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -164,10 +164,9 @@ static bool SlruScanDirectory(SlruCtl ctl, int cutoffPage, bool doDeletions);
int
SimpleLruShmemSize(void)
{
- return MAXALIGN(sizeof(SlruSharedData)) + BLCKSZ * NUM_CLOG_BUFFERS
-#ifdef EXEC_BACKEND
+ return MAXALIGN(sizeof(SlruSharedData))
+ + BLCKSZ * NUM_CLOG_BUFFERS
+ MAXALIGN(sizeof(SlruLockData))
-#endif
;
}
@@ -181,21 +180,8 @@ SimpleLruInit(SlruCtl ctl, const char *name, const char *subdir)
ptr = ShmemInitStruct(name, SimpleLruShmemSize(), &found);
shared = (SlruShared) ptr;
-
-#ifdef EXEC_BACKEND
- /*
- * Locks are in shared memory
- */
locks = (SlruLock) (ptr + MAXALIGN(sizeof(SlruSharedData)) +
BLCKSZ * NUM_CLOG_BUFFERS);
-#else
- /*
- * Locks are in private memory
- */
- Assert(!IsUnderPostmaster);
- locks = malloc(sizeof(SlruLockData));
- Assert(locks);
-#endif
if (!IsUnderPostmaster)
{
@@ -225,6 +211,7 @@ SimpleLruInit(SlruCtl ctl, const char *name, const char *subdir)
else
Assert(found);
+ /* Initialize the unshared control struct */
ctl->locks = locks;
ctl->shared = shared;