diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2004-05-28 05:13:32 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2004-05-28 05:13:32 +0000 |
commit | 1a321f26d88e5c64bccba9d36920aede1e201729 (patch) | |
tree | 43940a3ed5cc754bff68748502550731b0ad19a0 /src/backend/storage/ipc/ipci.c | |
parent | 37da0ba0e0f2d92857dc62789820d21e177dc00f (diff) | |
download | postgresql-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/storage/ipc/ipci.c')
-rw-r--r-- | src/backend/storage/ipc/ipci.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/src/backend/storage/ipc/ipci.c b/src/backend/storage/ipc/ipci.c index 3e8c2a6c1b6..4ce5c98b577 100644 --- a/src/backend/storage/ipc/ipci.c +++ b/src/backend/storage/ipc/ipci.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/storage/ipc/ipci.c,v 1.66 2004/04/19 23:27:17 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/storage/ipc/ipci.c,v 1.67 2004/05/28 05:13:03 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -37,9 +37,13 @@ * * This is called by the postmaster or by a standalone backend. * It is also called by a backend forked from the postmaster under - * the EXEC_BACKEND case - * - * In the non EXEC_BACKEND case, backends already have shared memory ready-to-go. + * the EXEC_BACKEND case. (In the non EXEC_BACKEND case, backends + * start life already attached to shared memory.) The initialization + * functions are set up to simply "attach" to pre-existing shared memory + * structures in the latter case. We have to do that in order to + * initialize pointers in local memory that reference the shared structures. + * (In the non EXEC_BACKEND case, these pointer values are inherited via + * fork() from the postmaster.) * * If "makePrivate" is true then we only need private memory, not shared * memory. This is true for a standalone backend, false for a postmaster. @@ -96,8 +100,12 @@ CreateSharedMemoryAndSemaphores(bool makePrivate, * (this should only ever be reached by EXEC_BACKEND code, * and only then with makePrivate == false) */ - Assert(ExecBackend && !makePrivate); +#ifdef EXEC_BACKEND + Assert(!makePrivate); seghdr = PGSharedMemoryCreate(-1, makePrivate, 0); +#else + Assert(false); +#endif } |