PostgreSQL Source Code  git master
interrupt.c File Reference
#include "postgres.h"
#include <unistd.h>
#include "miscadmin.h"
#include "postmaster/interrupt.h"
#include "storage/ipc.h"
#include "storage/latch.h"
#include "storage/procsignal.h"
#include "utils/guc.h"
#include "utils/memutils.h"
Include dependency graph for interrupt.c:

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

volatile sig_atomic_t ConfigReloadPending = false
 
volatile sig_atomic_t ShutdownRequestPending = false
 

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:39
volatile sig_atomic_t ProcSignalBarrierPending
Definition: globals.c:38
@ 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:1174
void ProcessProcSignalBarrier(void)
Definition: procsignal.c:468

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

Referenced by BackgroundWriterMain(), and WalWriterMain().

◆ SignalHandlerForConfigReload()

◆ SignalHandlerForCrashExit()

void SignalHandlerForCrashExit ( SIGNAL_ARGS  )

Definition at line 73 of file interrupt.c.

74 {
75  /*
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,
80  * anyway.
81  *
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
87  * being doubly sure.)
88  */
89  _exit(2);
90 }

Referenced by InitPostmasterChild().

◆ SignalHandlerForShutdownRequest()

Variable Documentation

◆ ConfigReloadPending

◆ ShutdownRequestPending