/* Read in remaining GUC variables */
read_nondefault_variables();
+ /*
+ * Reload any libraries that were preloaded by the postmaster. Since
+ * we exec'd this process, those libraries didn't come along with us;
+ * but we should load them into all child processes to be consistent
+ * with the non-EXEC_BACKEND behavior.
+ */
+ process_shared_preload_libraries();
+
/* Run backend or appropriate child */
if (strcmp(argv[1], "--forkbackend") == 0)
{
* Need to reinitialize the SSL library in the backend, since the
* context structures contain function pointers and cannot be passed
* through the parameter file.
+ *
+ * XXX should we do this in all child processes? For the moment it's
+ * enough to do it in backend children.
*/
#ifdef USE_SSL
if (EnableSSL)
secure_initialize();
#endif
- /*
- * process any libraries that should be preloaded at postmaster start
- *
- * NOTE: we have to re-load the shared_preload_libraries here because
- * this backend is not fork()ed so we can't inherit any shared
- * libraries / DLL's from our parent (the postmaster).
- */
- process_shared_preload_libraries();
-
/*
* Perform additional initialization and client authentication.
*
#include "storage/spin.h"
+shmem_startup_hook_type shmem_startup_hook = NULL;
+
static Size total_addin_request = 0;
static bool addin_request_allowed = true;
if (!IsUnderPostmaster)
ShmemBackendArrayAllocation();
#endif
+
+ /*
+ * Now give loadable modules a chance to set up their shmem allocations
+ */
+ if (shmem_startup_hook)
+ shmem_startup_hook();
}
#define IPC_H
typedef void (*pg_on_exit_callback) (int code, Datum arg);
+typedef void (*shmem_startup_hook_type) (void);
/*----------
* API for handling cleanup that must occur during either ereport(ERROR)
extern void on_exit_reset(void);
/* ipci.c */
+extern PGDLLIMPORT shmem_startup_hook_type shmem_startup_hook;
+
extern void CreateSharedMemoryAndSemaphores(bool makePrivate, int port);
#endif /* IPC_H */