PostgreSQL Source Code  git master
interrupt.h File Reference
#include <signal.h>
Include dependency graph for interrupt.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void HandleMainLoopInterrupts (void)
 
void SignalHandlerForConfigReload (SIGNAL_ARGS)
 
void SignalHandlerForCrashExit (SIGNAL_ARGS)
 
void SignalHandlerForShutdownRequest (SIGNAL_ARGS)
 

Variables

PGDLLIMPORT volatile sig_atomic_t ConfigReloadPending
 
PGDLLIMPORT volatile sig_atomic_t ShutdownRequestPending
 

Function Documentation

◆ HandleMainLoopInterrupts()

void HandleMainLoopInterrupts ( void  )

Definition at line 34 of file interrupt.c.

35 {
38 
40  {
41  ConfigReloadPending = false;
43  }
44 
46  proc_exit(0);
47 
48  /* Perform logging of memory contexts of this process */
51 }
volatile sig_atomic_t LogMemoryContextPending
Definition: globals.c:38
volatile sig_atomic_t ProcSignalBarrierPending
Definition: globals.c:37
@ PGC_SIGHUP
Definition: guc.h:71
void ProcessConfigFile(GucContext context)
volatile sig_atomic_t ShutdownRequestPending
Definition: interrupt.c:28
volatile sig_atomic_t ConfigReloadPending
Definition: interrupt.c:27
void proc_exit(int code)
Definition: ipc.c:104
void ProcessLogMemoryContextInterrupt(void)
Definition: mcxt.c:1199
void ProcessProcSignalBarrier(void)
Definition: procsignal.c:468

References ConfigReloadPending, LogMemoryContextPending, PGC_SIGHUP, proc_exit(), ProcessConfigFile(), ProcessLogMemoryContextInterrupt(), ProcessProcSignalBarrier(), ProcSignalBarrierPending, and ShutdownRequestPending.

Referenced by BackgroundWriterMain().

◆ SignalHandlerForConfigReload()

void SignalHandlerForConfigReload ( SIGNAL_ARGS  )

Definition at line 61 of file interrupt.c.

62 {
63  int save_errno = errno;
64 
65  ConfigReloadPending = true;
67 
68  errno = save_errno;
69 }
struct Latch * MyLatch
Definition: globals.c:58
void SetLatch(Latch *latch)
Definition: latch.c:607

References ConfigReloadPending, MyLatch, and SetLatch().

Referenced by ApplyLauncherMain(), ApplyWorkerMain(), autoprewarm_main(), AutoVacLauncherMain(), AutoVacWorkerMain(), BackgroundWriterMain(), CheckpointerMain(), ParallelApplyWorkerMain(), PgArchiverMain(), PostgresMain(), SysLoggerMain(), WalReceiverMain(), WalSndSignals(), WalWriterMain(), and worker_spi_main().

◆ SignalHandlerForCrashExit()

void SignalHandlerForCrashExit ( SIGNAL_ARGS  )

Definition at line 77 of file interrupt.c.

78 {
79  /*
80  * We DO NOT want to run proc_exit() or atexit() callbacks -- we're here
81  * because shared memory may be corrupted, so we don't want to try to
82  * clean up our transaction. Just nail the windows shut and get out of
83  * town. The callbacks wouldn't be safe to run from a signal handler,
84  * anyway.
85  *
86  * Note we do _exit(2) not _exit(0). This is to force the postmaster into
87  * a system reset cycle if someone sends a manual SIGQUIT to a random
88  * backend. This is necessary precisely because we don't clean up our
89  * shared memory state. (The "dead man switch" mechanism in pmsignal.c
90  * should ensure the postmaster sees this as a crash, too, but no harm in
91  * being doubly sure.)
92  */
93  _exit(2);
94 }

Referenced by InitPostmasterChild().

◆ SignalHandlerForShutdownRequest()

void SignalHandlerForShutdownRequest ( SIGNAL_ARGS  )

Definition at line 109 of file interrupt.c.

110 {
111  int save_errno = errno;
112 
113  ShutdownRequestPending = true;
114  SetLatch(MyLatch);
115 
116  errno = save_errno;
117 }

References MyLatch, SetLatch(), and ShutdownRequestPending.

Referenced by autoprewarm_main(), AutoVacLauncherMain(), BackgroundWriterMain(), CheckpointerMain(), ParallelApplyWorkerMain(), PgArchiverMain(), WalReceiverMain(), and WalWriterMain().

Variable Documentation

◆ ConfigReloadPending

◆ ShutdownRequestPending