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 33 of file interrupt.c.

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

Referenced by BackgroundWriterMain(), and WalWriterMain().

34 {
37 
39  {
40  ConfigReloadPending = false;
42  }
43 
45  proc_exit(0);
46 }
void ProcessConfigFile(GucContext context)
void ProcessProcSignalBarrier(void)
Definition: procsignal.c:429
void proc_exit(int code)
Definition: ipc.c:104
volatile sig_atomic_t ShutdownRequestPending
Definition: interrupt.c:27
Definition: guc.h:72
volatile sig_atomic_t ProcSignalBarrierPending
Definition: globals.c:35
volatile sig_atomic_t ConfigReloadPending
Definition: interrupt.c:26

◆ SignalHandlerForConfigReload()

void SignalHandlerForConfigReload ( SIGNAL_ARGS  )

Definition at line 56 of file interrupt.c.

References ConfigReloadPending, MyLatch, and SetLatch().

Referenced by ApplyLauncherMain(), ApplyWorkerMain(), AutoVacLauncherMain(), AutoVacWorkerMain(), BackgroundWriterMain(), CheckpointerMain(), PgArchiverMain(), PgstatCollectorMain(), PostgresMain(), WalSndSignals(), and WalWriterMain().

57 {
58  int save_errno = errno;
59 
60  ConfigReloadPending = true;
62 
63  errno = save_errno;
64 }
void SetLatch(Latch *latch)
Definition: latch.c:457
volatile sig_atomic_t ConfigReloadPending
Definition: interrupt.c:26
struct Latch * MyLatch
Definition: globals.c:54

◆ SignalHandlerForCrashExit()

void SignalHandlerForCrashExit ( SIGNAL_ARGS  )

Definition at line 72 of file interrupt.c.

Referenced by BackgroundWriterMain(), CheckpointerMain(), StartBackgroundWorker(), StartupProcessMain(), WalReceiverMain(), and WalWriterMain().

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

◆ SignalHandlerForShutdownRequest()

void SignalHandlerForShutdownRequest ( SIGNAL_ARGS  )

Definition at line 104 of file interrupt.c.

References MyLatch, SetLatch(), and ShutdownRequestPending.

Referenced by AutoVacLauncherMain(), BackgroundWriterMain(), CheckpointerMain(), PgArchiverMain(), PgstatCollectorMain(), and WalWriterMain().

105 {
106  int save_errno = errno;
107 
108  ShutdownRequestPending = true;
109  SetLatch(MyLatch);
110 
111  errno = save_errno;
112 }
void SetLatch(Latch *latch)
Definition: latch.c:457
volatile sig_atomic_t ShutdownRequestPending
Definition: interrupt.c:27
struct Latch * MyLatch
Definition: globals.c:54

Variable Documentation

◆ ConfigReloadPending

◆ ShutdownRequestPending