diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2009-01-03 17:08:39 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2009-01-03 17:08:39 +0000 |
commit | dad75a62bfb25e3228d1db73e4a06e2c6bd22dd2 (patch) | |
tree | 406f7bbf159c3aec4d3f16de7be4d030a63e10b5 /src/backend/storage/ipc/ipci.c | |
parent | bbeb0bbf6b3e5fdb7cff1a87885f43139ace5c4b (diff) |
Create a "shmem_startup_hook" to be called at the end of shared memory
initialization, to give loadable modules a reasonable place to perform
creation of any shared memory areas they need. This is the logical conclusion
of our previous creation of RequestAddinShmemSpace() and RequestAddinLWLocks().
We don't need an explicit shmem_shutdown_hook, because the existing
on_shmem_exit and on_proc_exit mechanisms serve that need.
Also, adjust SubPostmasterMain so that libraries that got loaded into the
postmaster will be loaded into all child processes, not only regular backends.
This improves consistency with the non-EXEC_BACKEND behavior, and might be
necessary for functionality for some types of add-ons.
Diffstat (limited to 'src/backend/storage/ipc/ipci.c')
-rw-r--r-- | src/backend/storage/ipc/ipci.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/backend/storage/ipc/ipci.c b/src/backend/storage/ipc/ipci.c index 720f4cd2848..f85f0a66df2 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.98 2009/01/01 17:23:47 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/storage/ipc/ipci.c,v 1.99 2009/01/03 17:08:39 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -34,6 +34,8 @@ #include "storage/spin.h" +shmem_startup_hook_type shmem_startup_hook = NULL; + static Size total_addin_request = 0; static bool addin_request_allowed = true; @@ -222,4 +224,10 @@ CreateSharedMemoryAndSemaphores(bool makePrivate, int port) if (!IsUnderPostmaster) ShmemBackendArrayAllocation(); #endif + + /* + * Now give loadable modules a chance to set up their shmem allocations + */ + if (shmem_startup_hook) + shmem_startup_hook(); } |