1/*-------------------------------------------------------------------------
4 * Interrupt handling routines.
6 * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group
7 * Portions Copyright (c) 1994, Regents of the University of California
10 * src/backend/postmaster/interrupt.c
12 *-------------------------------------------------------------------------
31 * Simple interrupt handler for main loops of background processes.
48 /* Perform logging of memory contexts of this process */
54 * Simple signal handler for triggering a configuration reload.
56 * Normally, this handler would be used for SIGHUP. The idea is that code
57 * which uses it would arrange to check the ConfigReloadPending flag at
58 * convenient places inside main loops, or else call ProcessMainLoopInterrupts.
68 * Simple signal handler for exiting quickly as if due to a crash.
70 * Normally, this would be used for handling SIGQUIT.
76 * We DO NOT want to run proc_exit() or atexit() callbacks -- we're here
77 * because shared memory may be corrupted, so we don't want to try to
78 * clean up our transaction. Just nail the windows shut and get out of
79 * town. The callbacks wouldn't be safe to run from a signal handler,
82 * Note we do _exit(2) not _exit(0). This is to force the postmaster into
83 * a system reset cycle if someone sends a manual SIGQUIT to a random
84 * backend. This is necessary precisely because we don't clean up our
85 * shared memory state. (The "dead man switch" mechanism in pmsignal.c
86 * should ensure the postmaster sees this as a crash, too, but no harm in
93 * Simple signal handler for triggering a long-running background process to
96 * Typically, this handler would be used for SIGTERM, but some processes use
97 * other signals. In particular, the checkpointer and parallel apply worker
98 * exit on SIGUSR2, and the WAL writer exits on either SIGINT or SIGTERM.
100 * ShutdownRequestPending should be checked at a convenient place within the
101 * main loop, or else the main loop should call ProcessMainLoopInterrupts.
volatile sig_atomic_t LogMemoryContextPending
volatile sig_atomic_t ProcSignalBarrierPending
void ProcessConfigFile(GucContext context)
void SignalHandlerForShutdownRequest(SIGNAL_ARGS)
void ProcessMainLoopInterrupts(void)
volatile sig_atomic_t ShutdownRequestPending
volatile sig_atomic_t ConfigReloadPending
void SignalHandlerForConfigReload(SIGNAL_ARGS)
void SignalHandlerForCrashExit(SIGNAL_ARGS)
void SetLatch(Latch *latch)
void ProcessLogMemoryContextInterrupt(void)
void ProcessProcSignalBarrier(void)