PostgreSQL Source Code git master
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
ipc.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define PG_ENSURE_ERROR_CLEANUP(cleanup_function, arg)
 
#define PG_END_ENSURE_ERROR_CLEANUP(cleanup_function, arg)
 

Typedefs

typedef void(* pg_on_exit_callback) (int code, Datum arg)
 
typedef void(* shmem_startup_hook_type) (void)
 

Functions

pg_noreturn void proc_exit (int code)
 
void shmem_exit (int code)
 
void on_proc_exit (pg_on_exit_callback function, Datum arg)
 
void on_shmem_exit (pg_on_exit_callback function, Datum arg)
 
void before_shmem_exit (pg_on_exit_callback function, Datum arg)
 
void cancel_before_shmem_exit (pg_on_exit_callback function, Datum arg)
 
void on_exit_reset (void)
 
void check_on_shmem_exit_lists_are_empty (void)
 
Size CalculateShmemSize (int *num_semaphores)
 
void CreateSharedMemoryAndSemaphores (void)
 
void InitializeShmemGUCs (void)
 

Variables

PGDLLIMPORT bool proc_exit_inprogress
 
PGDLLIMPORT bool shmem_exit_inprogress
 
PGDLLIMPORT shmem_startup_hook_type shmem_startup_hook
 

Macro Definition Documentation

◆ PG_END_ENSURE_ERROR_CLEANUP

#define PG_END_ENSURE_ERROR_CLEANUP (   cleanup_function,
  arg 
)
Value:
cancel_before_shmem_exit(cleanup_function, arg); \
PG_CATCH(); \
{ \
cancel_before_shmem_exit(cleanup_function, arg); \
cleanup_function (0, arg); \
PG_RE_THROW(); \
} \
PG_END_TRY(); \
} while (0)
void cancel_before_shmem_exit(pg_on_exit_callback function, Datum arg)
Definition: ipc.c:394
void * arg

Definition at line 52 of file ipc.h.

◆ PG_ENSURE_ERROR_CLEANUP

#define PG_ENSURE_ERROR_CLEANUP (   cleanup_function,
  arg 
)
Value:
do { \
before_shmem_exit(cleanup_function, arg); \
PG_TRY()

Definition at line 47 of file ipc.h.

Typedef Documentation

◆ pg_on_exit_callback

typedef void(* pg_on_exit_callback) (int code, Datum arg)

Definition at line 21 of file ipc.h.

◆ shmem_startup_hook_type

typedef void(* shmem_startup_hook_type) (void)

Definition at line 22 of file ipc.h.

Function Documentation

◆ before_shmem_exit()

void before_shmem_exit ( pg_on_exit_callback  function,
Datum  arg 
)

Definition at line 337 of file ipc.c.

338{
341 (errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
342 errmsg_internal("out of before_shmem_exit slots")));
343
346
348
350 {
351 atexit(atexit_callback);
353 }
354}
int errmsg_internal(const char *fmt,...)
Definition: elog.c:1158
int errcode(int sqlerrcode)
Definition: elog.c:854
#define FATAL
Definition: elog.h:41
#define ereport(elevel,...)
Definition: elog.h:149
static bool atexit_callback_setup
Definition: ipc.c:51
static void atexit_callback(void)
Definition: ipc.c:294
#define MAX_ON_EXITS
Definition: ipc.c:71
static int before_shmem_exit_index
Definition: ipc.c:85
static struct ONEXIT before_shmem_exit_list[MAX_ON_EXITS]
Definition: ipc.c:81
on_exit_nicely_callback function
Datum arg
Definition: ipc.c:76
pg_on_exit_callback function
Definition: ipc.c:75

References ONEXIT::arg, arg, atexit_callback(), atexit_callback_setup, before_shmem_exit_index, before_shmem_exit_list, ereport, errcode(), errmsg_internal(), FATAL, ONEXIT::function, function, and MAX_ON_EXITS.

Referenced by ApplyLauncherMain(), AtEOXact_Namespace(), autoprewarm_main(), AuxiliaryProcessMainCommon(), BaseInit(), CheckpointerMain(), Exec_ListenPreCommit(), InitPostgres(), InitTemporaryFileAccess(), injection_points_set_local(), LoadArchiveLibrary(), LockGXact(), logicalrep_worker_attach(), MarkAsPreparing(), ParallelApplyWorkerMain(), ParallelWorkerMain(), pgaio_init_backend(), pgstat_initialize(), register_persistent_abort_backup_handler(), ReplicationSlotInitialize(), ReplSlotSyncWorkerMain(), and SetupApplyOrSyncWorker().

◆ CalculateShmemSize()

Size CalculateShmemSize ( int *  num_semaphores)

Definition at line 90 of file ipci.c.

91{
92 Size size;
93 int numSemas;
94
95 /* Compute number of semaphores we'll need */
96 numSemas = ProcGlobalSemas();
97
98 /* Return the number of semaphores if requested by the caller */
99 if (num_semaphores)
100 *num_semaphores = numSemas;
101
102 /*
103 * Size of the Postgres shared-memory block is estimated via moderately-
104 * accurate estimates for the big hogs, plus 100K for the stuff that's too
105 * small to bother with estimating.
106 *
107 * We take some care to ensure that the total size request doesn't
108 * overflow size_t. If this gets through, we don't need to be so careful
109 * during the actual allocation phase.
110 */
111 size = 100000;
112 size = add_size(size, PGSemaphoreShmemSize(numSemas));
114 sizeof(ShmemIndexEnt)));
115 size = add_size(size, dsm_estimate_size());
116 size = add_size(size, DSMRegistryShmemSize());
117 size = add_size(size, BufferManagerShmemSize());
118 size = add_size(size, LockManagerShmemSize());
119 size = add_size(size, PredicateLockShmemSize());
120 size = add_size(size, ProcGlobalShmemSize());
121 size = add_size(size, XLogPrefetchShmemSize());
122 size = add_size(size, VarsupShmemSize());
123 size = add_size(size, XLOGShmemSize());
124 size = add_size(size, XLogRecoveryShmemSize());
125 size = add_size(size, CLOGShmemSize());
126 size = add_size(size, CommitTsShmemSize());
127 size = add_size(size, SUBTRANSShmemSize());
128 size = add_size(size, TwoPhaseShmemSize());
129 size = add_size(size, BackgroundWorkerShmemSize());
130 size = add_size(size, MultiXactShmemSize());
131 size = add_size(size, LWLockShmemSize());
132 size = add_size(size, ProcArrayShmemSize());
133 size = add_size(size, BackendStatusShmemSize());
134 size = add_size(size, SharedInvalShmemSize());
135 size = add_size(size, PMSignalShmemSize());
136 size = add_size(size, ProcSignalShmemSize());
137 size = add_size(size, CheckpointerShmemSize());
138 size = add_size(size, AutoVacuumShmemSize());
139 size = add_size(size, ReplicationSlotsShmemSize());
140 size = add_size(size, ReplicationOriginShmemSize());
141 size = add_size(size, WalSndShmemSize());
142 size = add_size(size, WalRcvShmemSize());
143 size = add_size(size, WalSummarizerShmemSize());
144 size = add_size(size, PgArchShmemSize());
145 size = add_size(size, ApplyLauncherShmemSize());
146 size = add_size(size, BTreeShmemSize());
147 size = add_size(size, SyncScanShmemSize());
148 size = add_size(size, AsyncShmemSize());
149 size = add_size(size, StatsShmemSize());
150 size = add_size(size, WaitEventCustomShmemSize());
151 size = add_size(size, InjectionPointShmemSize());
152 size = add_size(size, SlotSyncShmemSize());
153 size = add_size(size, AioShmemSize());
155
156 /* include additional requested shmem from preload libraries */
157 size = add_size(size, total_addin_request);
158
159 /* might as well round it off to a multiple of a typical page size */
160 size = add_size(size, 8192 - (size % 8192));
161
162 return size;
163}
Size AioShmemSize(void)
Definition: aio_init.c:117
Size AsyncShmemSize(void)
Definition: async.c:485
Size AutoVacuumShmemSize(void)
Definition: autovacuum.c:3323
Size BackendStatusShmemSize(void)
Size BackgroundWorkerShmemSize(void)
Definition: bgworker.c:146
Size BufferManagerShmemSize(void)
Definition: buf_init.c:162
size_t Size
Definition: c.h:576
Size CheckpointerShmemSize(void)
Definition: checkpointer.c:939
Size CLOGShmemSize(void)
Definition: clog.c:781
Size CommitTsShmemSize(void)
Definition: commit_ts.c:519
size_t dsm_estimate_size(void)
Definition: dsm.c:470
Size DSMRegistryShmemSize(void)
Definition: dsm_registry.c:63
Size hash_estimate_size(long num_entries, Size entrysize)
Definition: dynahash.c:783
Size InjectionPointShmemSize(void)
static Size total_addin_request
Definition: ipci.c:61
Size ApplyLauncherShmemSize(void)
Definition: launcher.c:896
Size LockManagerShmemSize(void)
Definition: lock.c:3723
Size LWLockShmemSize(void)
Definition: lwlock.c:434
Size MemoryContextReportingShmemSize(void)
Definition: mcxtfuncs.c:619
Size MultiXactShmemSize(void)
Definition: multixact.c:1947
Size BTreeShmemSize(void)
Definition: nbtutils.c:3655
Size ReplicationOriginShmemSize(void)
Definition: origin.c:511
Size PgArchShmemSize(void)
Definition: pgarch.c:156
Size StatsShmemSize(void)
Definition: pgstat_shmem.c:127
Size PMSignalShmemSize(void)
Definition: pmsignal.c:130
Size PGSemaphoreShmemSize(int maxSemas)
Definition: posix_sema.c:165
Size PredicateLockShmemSize(void)
Definition: predicate.c:1357
Size ProcArrayShmemSize(void)
Definition: procarray.c:376
Size ProcSignalShmemSize(void)
Definition: procsignal.c:116
Size add_size(Size s1, Size s2)
Definition: shmem.c:493
#define SHMEM_INDEX_SIZE
Definition: shmem.h:53
Size SharedInvalShmemSize(void)
Definition: sinvaladt.c:217
Size ReplicationSlotsShmemSize(void)
Definition: slot.c:186
Size SlotSyncShmemSize(void)
Definition: slotsync.c:1662
Size ProcGlobalShmemSize(void)
Definition: proc.c:140
int ProcGlobalSemas(void)
Definition: proc.c:158
Size SUBTRANSShmemSize(void)
Definition: subtrans.c:214
Size SyncScanShmemSize(void)
Definition: syncscan.c:126
Size TwoPhaseShmemSize(void)
Definition: twophase.c:237
Size VarsupShmemSize(void)
Definition: varsup.c:41
Size WaitEventCustomShmemSize(void)
Definition: wait_event.c:103
Size WalRcvShmemSize(void)
Size WalSndShmemSize(void)
Definition: walsender.c:3614
Size WalSummarizerShmemSize(void)
Size XLOGShmemSize(void)
Definition: xlog.c:5049
size_t XLogPrefetchShmemSize(void)
Size XLogRecoveryShmemSize(void)
Definition: xlogrecovery.c:453

References add_size(), AioShmemSize(), ApplyLauncherShmemSize(), AsyncShmemSize(), AutoVacuumShmemSize(), BackendStatusShmemSize(), BackgroundWorkerShmemSize(), BTreeShmemSize(), BufferManagerShmemSize(), CheckpointerShmemSize(), CLOGShmemSize(), CommitTsShmemSize(), dsm_estimate_size(), DSMRegistryShmemSize(), hash_estimate_size(), InjectionPointShmemSize(), LockManagerShmemSize(), LWLockShmemSize(), MemoryContextReportingShmemSize(), MultiXactShmemSize(), PgArchShmemSize(), PGSemaphoreShmemSize(), PMSignalShmemSize(), PredicateLockShmemSize(), ProcArrayShmemSize(), ProcGlobalSemas(), ProcGlobalShmemSize(), ProcSignalShmemSize(), ReplicationOriginShmemSize(), ReplicationSlotsShmemSize(), SharedInvalShmemSize(), SHMEM_INDEX_SIZE, SlotSyncShmemSize(), StatsShmemSize(), SUBTRANSShmemSize(), SyncScanShmemSize(), total_addin_request, TwoPhaseShmemSize(), VarsupShmemSize(), WaitEventCustomShmemSize(), WalRcvShmemSize(), WalSndShmemSize(), WalSummarizerShmemSize(), XLogPrefetchShmemSize(), XLogRecoveryShmemSize(), and XLOGShmemSize().

Referenced by CreateSharedMemoryAndSemaphores(), and InitializeShmemGUCs().

◆ cancel_before_shmem_exit()

void cancel_before_shmem_exit ( pg_on_exit_callback  function,
Datum  arg 
)

Definition at line 394 of file ipc.c.

395{
396 if (before_shmem_exit_index > 0 &&
398 == function &&
401 else
402 elog(ERROR, "before_shmem_exit callback (%p,0x%" PRIxPTR ") is not the latest entry",
403 function, arg);
404}
#define ERROR
Definition: elog.h:39
#define elog(elevel,...)
Definition: elog.h:226

References arg, before_shmem_exit_index, before_shmem_exit_list, elog, ERROR, and function.

◆ check_on_shmem_exit_lists_are_empty()

void check_on_shmem_exit_lists_are_empty ( void  )

Definition at line 432 of file ipc.c.

433{
435 elog(FATAL, "before_shmem_exit has been called prematurely");
437 elog(FATAL, "on_shmem_exit has been called prematurely");
438 /* Checking DSM detach state seems unnecessary given the above */
439}
static int on_shmem_exit_index
Definition: ipc.c:84

References before_shmem_exit_index, elog, FATAL, and on_shmem_exit_index.

Referenced by BackendInitialize().

◆ CreateSharedMemoryAndSemaphores()

void CreateSharedMemoryAndSemaphores ( void  )

Definition at line 202 of file ipci.c.

203{
204 PGShmemHeader *shim;
205 PGShmemHeader *seghdr;
206 Size size;
207 int numSemas;
208
210
211 /* Compute the size of the shared-memory block */
212 size = CalculateShmemSize(&numSemas);
213 elog(DEBUG3, "invoking IpcMemoryCreate(size=%zu)", size);
214
215 /*
216 * Create the shmem segment
217 */
218 seghdr = PGSharedMemoryCreate(size, &shim);
219
220 /*
221 * Make sure that huge pages are never reported as "unknown" while the
222 * server is running.
223 */
224 Assert(strcmp("unknown",
225 GetConfigOption("huge_pages_status", false, false)) != 0);
226
227 InitShmemAccess(seghdr);
228
229 /*
230 * Create semaphores
231 */
232 PGReserveSemaphores(numSemas);
233
234 /*
235 * Set up shared memory allocation mechanism
236 */
238
239 /* Initialize subsystems */
241
242 /* Initialize dynamic shared memory facilities. */
244
245 /*
246 * Now give loadable modules a chance to set up their shmem allocations
247 */
250}
void dsm_postmaster_startup(PGShmemHeader *shim)
Definition: dsm.c:177
#define DEBUG3
Definition: elog.h:28
bool IsUnderPostmaster
Definition: globals.c:121
const char * GetConfigOption(const char *name, bool missing_ok, bool restrict_privileged)
Definition: guc.c:4355
Assert(PointerIsAligned(start, uint64))
shmem_startup_hook_type shmem_startup_hook
Definition: ipci.c:59
Size CalculateShmemSize(int *num_semaphores)
Definition: ipci.c:90
static void CreateOrAttachShmemStructs(void)
Definition: ipci.c:268
void PGReserveSemaphores(int maxSemas)
Definition: posix_sema.c:196
void InitShmemAccess(PGShmemHeader *seghdr)
Definition: shmem.c:102
void InitShmemAllocation(void)
Definition: shmem.c:115
PGShmemHeader * PGSharedMemoryCreate(Size size, PGShmemHeader **shim)
Definition: sysv_shmem.c:700

References Assert(), CalculateShmemSize(), CreateOrAttachShmemStructs(), DEBUG3, dsm_postmaster_startup(), elog, GetConfigOption(), InitShmemAccess(), InitShmemAllocation(), IsUnderPostmaster, PGReserveSemaphores(), PGSharedMemoryCreate(), and shmem_startup_hook.

Referenced by BootstrapModeMain(), PostgresSingleUserMain(), PostmasterMain(), and PostmasterStateMachine().

◆ InitializeShmemGUCs()

void InitializeShmemGUCs ( void  )

Definition at line 358 of file ipci.c.

359{
360 char buf[64];
361 Size size_b;
362 Size size_mb;
363 Size hp_size;
364 int num_semas;
365
366 /*
367 * Calculate the shared memory size and round up to the nearest megabyte.
368 */
369 size_b = CalculateShmemSize(&num_semas);
370 size_mb = add_size(size_b, (1024 * 1024) - 1) / (1024 * 1024);
371 sprintf(buf, "%zu", size_mb);
372 SetConfigOption("shared_memory_size", buf,
374
375 /*
376 * Calculate the number of huge pages required.
377 */
378 GetHugePageSize(&hp_size, NULL);
379 if (hp_size != 0)
380 {
381 Size hp_required;
382
383 hp_required = add_size(size_b / hp_size, 1);
384 sprintf(buf, "%zu", hp_required);
385 SetConfigOption("shared_memory_size_in_huge_pages", buf,
387 }
388
389 sprintf(buf, "%d", num_semas);
391}
void SetConfigOption(const char *name, const char *value, GucContext context, GucSource source)
Definition: guc.c:4332
@ PGC_S_DYNAMIC_DEFAULT
Definition: guc.h:114
@ PGC_INTERNAL
Definition: guc.h:73
static char * buf
Definition: pg_test_fsync.c:72
#define sprintf
Definition: port.h:241
void GetHugePageSize(Size *hugepagesize, int *mmap_flags)
Definition: sysv_shmem.c:479

References add_size(), buf, CalculateShmemSize(), GetHugePageSize(), PGC_INTERNAL, PGC_S_DYNAMIC_DEFAULT, SetConfigOption(), and sprintf.

Referenced by PostgresSingleUserMain(), and PostmasterMain().

◆ on_exit_reset()

void on_exit_reset ( void  )

Definition at line 416 of file ipc.c.

417{
422}
void reset_on_dsm_detach(void)
Definition: dsm.c:1170
static int on_proc_exit_index
Definition: ipc.c:83

References before_shmem_exit_index, on_proc_exit_index, on_shmem_exit_index, and reset_on_dsm_detach().

Referenced by InitPostmasterChild().

◆ on_proc_exit()

void on_proc_exit ( pg_on_exit_callback  function,
Datum  arg 
)

◆ on_shmem_exit()

◆ proc_exit()

pg_noreturn void proc_exit ( int  code)

Definition at line 104 of file ipc.c.

105{
106 /* not safe if forked by system(), etc. */
107 if (MyProcPid != (int) getpid())
108 elog(PANIC, "proc_exit() called in child process");
109
110 /* Clean up everything that must be cleaned up */
111 proc_exit_prepare(code);
112
113#ifdef PROFILE_PID_DIR
114 {
115 /*
116 * If we are profiling ourself then gprof's mcleanup() is about to
117 * write out a profile to ./gmon.out. Since mcleanup() always uses a
118 * fixed file name, each backend will overwrite earlier profiles. To
119 * fix that, we create a separate subdirectory for each backend
120 * (./gprof/pid) and 'cd' to that subdirectory before we exit() - that
121 * forces mcleanup() to write each profile into its own directory. We
122 * end up with something like: $PGDATA/gprof/8829/gmon.out
123 * $PGDATA/gprof/8845/gmon.out ...
124 *
125 * To avoid undesirable disk space bloat, autovacuum workers are
126 * discriminated against: all their gmon.out files go into the same
127 * subdirectory. Without this, an installation that is "just sitting
128 * there" nonetheless eats megabytes of disk space every few seconds.
129 *
130 * Note that we do this here instead of in an on_proc_exit() callback
131 * because we want to ensure that this code executes last - we don't
132 * want to interfere with any other on_proc_exit() callback. For the
133 * same reason, we do not include it in proc_exit_prepare ... so if
134 * you are exiting in the "wrong way" you won't drop your profile in a
135 * nice place.
136 */
137 char gprofDirName[32];
138
140 snprintf(gprofDirName, 32, "gprof/avworker");
141 else
142 snprintf(gprofDirName, 32, "gprof/%d", (int) getpid());
143
144 /*
145 * Use mkdir() instead of MakePGDirectory() since we aren't making a
146 * PG directory here.
147 */
148 mkdir("gprof", S_IRWXU | S_IRWXG | S_IRWXO);
149 mkdir(gprofDirName, S_IRWXU | S_IRWXG | S_IRWXO);
150 chdir(gprofDirName);
151 }
152#endif
153
154 elog(DEBUG3, "exit(%d)", code);
155
156 exit(code);
157}
#define PANIC
Definition: elog.h:42
int MyProcPid
Definition: globals.c:48
static void proc_exit_prepare(int code)
Definition: ipc.c:165
#define AmAutoVacuumWorkerProcess()
Definition: miscadmin.h:383
#define snprintf
Definition: port.h:239
#define S_IRWXG
Definition: win32_port.h:300
#define S_IRWXO
Definition: win32_port.h:312
#define mkdir(a, b)
Definition: win32_port.h:80
#define S_IRWXU
Definition: win32_port.h:288

References AmAutoVacuumWorkerProcess, DEBUG3, elog, mkdir, MyProcPid, PANIC, proc_exit_prepare(), S_IRWXG, S_IRWXO, S_IRWXU, and snprintf.

Referenced by apply_worker_exit(), ApplyWorkerMain(), auth_failed(), AutoVacLauncherMain(), AutoVacLauncherShutdown(), AutoVacWorkerMain(), BackendInitialize(), BackgroundWorkerMain(), BootstrapModeMain(), CheckerModeMain(), CheckpointerMain(), DisableSubscriptionAndExit(), errfinish(), ExitPostmaster(), finish_sync_worker(), InitializeLogRepWorker(), IoWorkerMain(), maybe_reread_subscription(), PerformWalRecovery(), PgArchiverMain(), PostgresMain(), PostgresSingleUserMain(), PreRestoreCommand(), process_syncing_tables_for_apply(), ProcessInterrupts(), ProcessMainLoopInterrupts(), ProcessParallelApplyInterrupts(), ProcessPgArchInterrupts(), ProcessRepliesIfAny(), ProcessSlotSyncInterrupts(), ProcessStandbyMessage(), ProcessStartupProcInterrupts(), ProcessWalSummarizerInterrupts(), ReplSlotSyncWorkerMain(), RestoreArchivedFile(), slotsync_reread_config(), StartLogicalReplication(), StartReplication(), StartupProcessMain(), StartupProcShutdownHandler(), SysLoggerMain(), test_shm_mq_main(), WaitEventSetWaitBlock(), WalRcvWaitForStartPosition(), WalReceiverMain(), WalSndDone(), WalSndErrorCleanup(), WalSndShutdown(), WalSndWait(), and WalSummarizerMain().

◆ shmem_exit()

void shmem_exit ( int  code)

Definition at line 228 of file ipc.c.

229{
231
232 /*
233 * Call before_shmem_exit callbacks.
234 *
235 * These should be things that need most of the system to still be up and
236 * working, such as cleanup of temp relations, which requires catalog
237 * access; or things that need to be completed because later cleanup steps
238 * depend on them, such as releasing lwlocks.
239 */
240 elog(DEBUG3, "shmem_exit(%d): %d before_shmem_exit callbacks to make",
242 while (--before_shmem_exit_index >= 0)
246
247 /*
248 * Call dynamic shared memory callbacks.
249 *
250 * These serve the same purpose as late callbacks, but for dynamic shared
251 * memory segments rather than the main shared memory segment.
252 * dsm_backend_shutdown() has the same kind of progressive logic we use
253 * for the main shared memory segment; namely, it unregisters each
254 * callback before invoking it, so that we don't get stuck in an infinite
255 * loop if one of those callbacks itself throws an ERROR or FATAL.
256 *
257 * Note that explicitly calling this function here is quite different from
258 * registering it as an on_shmem_exit callback for precisely this reason:
259 * if one dynamic shared memory callback errors out, the remaining
260 * callbacks will still be invoked. Thus, hard-coding this call puts it
261 * equal footing with callbacks for the main shared memory segment.
262 */
264
265 /*
266 * Call on_shmem_exit callbacks.
267 *
268 * These are generally releasing low-level shared memory resources. In
269 * some cases, this is a backstop against the possibility that the early
270 * callbacks might themselves fail, leading to re-entry to this routine;
271 * in other cases, it's cleanup that only happens at process exit.
272 */
273 elog(DEBUG3, "shmem_exit(%d): %d on_shmem_exit callbacks to make",
274 code, on_shmem_exit_index);
275 while (--on_shmem_exit_index >= 0)
279
280 shmem_exit_inprogress = false;
281}
void dsm_backend_shutdown(void)
Definition: dsm.c:757
bool shmem_exit_inprogress
Definition: ipc.c:45

References arg, before_shmem_exit_index, before_shmem_exit_list, DEBUG3, dsm_backend_shutdown(), elog, ONEXIT::function, on_shmem_exit_index, on_shmem_exit_list, and shmem_exit_inprogress.

Referenced by PostmasterStateMachine(), and proc_exit_prepare().

Variable Documentation

◆ proc_exit_inprogress

◆ shmem_exit_inprogress

PGDLLIMPORT bool shmem_exit_inprogress
extern

Definition at line 45 of file ipc.c.

Referenced by AtAbort_Portals(), and shmem_exit().

◆ shmem_startup_hook

PGDLLIMPORT shmem_startup_hook_type shmem_startup_hook
extern

Definition at line 59 of file ipci.c.

Referenced by _PG_init(), and CreateSharedMemoryAndSemaphores().