PostgreSQL Source Code
git master
|
#include "postgres.h"
#include <signal.h>
#include <unistd.h>
#include "miscadmin.h"
#include "postmaster/postmaster.h"
#include "replication/walsender.h"
#include "storage/pmsignal.h"
#include "storage/shmem.h"
#include "utils/memutils.h"
Go to the source code of this file.
Data Structures | |
struct | PMSignalData |
Macros | |
#define | PM_CHILD_UNUSED 0 /* these values must fit in sig_atomic_t */ |
#define | PM_CHILD_ASSIGNED 1 |
#define | PM_CHILD_ACTIVE 2 |
#define | PM_CHILD_WALSENDER 3 |
Functions | |
Size | PMSignalShmemSize (void) |
void | PMSignalShmemInit (void) |
void | SendPostmasterSignal (PMSignalReason reason) |
bool | CheckPostmasterSignal (PMSignalReason reason) |
void | SetQuitSignalReason (QuitSignalReason reason) |
QuitSignalReason | GetQuitSignalReason (void) |
int | AssignPostmasterChildSlot (void) |
bool | ReleasePostmasterChildSlot (int slot) |
bool | IsPostmasterChildWalSender (int slot) |
void | MarkPostmasterChildActive (void) |
void | MarkPostmasterChildWalSender (void) |
void | MarkPostmasterChildInactive (void) |
bool | PostmasterIsAliveInternal (void) |
void | PostmasterDeathSignalInit (void) |
Variables | |
NON_EXEC_STATIC volatile PMSignalData * | PMSignalState = NULL |
static int | num_child_inuse |
static int | next_child_inuse |
static bool * | PMChildInUse |
#define PM_CHILD_ACTIVE 2 |
Definition at line 67 of file pmsignal.c.
#define PM_CHILD_ASSIGNED 1 |
Definition at line 66 of file pmsignal.c.
#define PM_CHILD_UNUSED 0 /* these values must fit in sig_atomic_t */ |
Definition at line 65 of file pmsignal.c.
#define PM_CHILD_WALSENDER 3 |
Definition at line 68 of file pmsignal.c.
int AssignPostmasterChildSlot | ( | void | ) |
Definition at line 247 of file pmsignal.c.
References elog, FATAL, next_child_inuse, num_child_inuse, PM_CHILD_ASSIGNED, PMSignalData::PMChildFlags, PMChildInUse, and PMSignalState.
Referenced by assign_backendlist_entry(), BackendStartup(), and StartAutovacuumWorker().
bool CheckPostmasterSignal | ( | PMSignalReason | reason | ) |
Definition at line 198 of file pmsignal.c.
References PMSignalData::PMSignalFlags, and PMSignalState.
Referenced by process_pm_pmsignal().
QuitSignalReason GetQuitSignalReason | ( | void | ) |
Definition at line 229 of file pmsignal.c.
References IsUnderPostmaster, PMQUIT_NOT_SENT, PMSignalState, and PMSignalData::sigquit_reason.
Referenced by quickdie().
bool IsPostmasterChildWalSender | ( | int | slot | ) |
Definition at line 307 of file pmsignal.c.
References Assert, num_child_inuse, PM_CHILD_WALSENDER, PMSignalData::PMChildFlags, and PMSignalState.
Referenced by CountChildren(), and SignalSomeChildren().
void MarkPostmasterChildActive | ( | void | ) |
Definition at line 323 of file pmsignal.c.
References Assert, MyPMChildSlot, PM_CHILD_ACTIVE, PM_CHILD_ASSIGNED, PMSignalData::PMChildFlags, and PMSignalState.
Referenced by InitProcess().
void MarkPostmasterChildInactive | ( | void | ) |
Definition at line 356 of file pmsignal.c.
References Assert, MyPMChildSlot, PM_CHILD_ACTIVE, PM_CHILD_ASSIGNED, PM_CHILD_WALSENDER, PMSignalData::PMChildFlags, and PMSignalState.
Referenced by ProcKill().
void MarkPostmasterChildWalSender | ( | void | ) |
Definition at line 339 of file pmsignal.c.
References am_walsender, Assert, MyPMChildSlot, PM_CHILD_ACTIVE, PM_CHILD_WALSENDER, PMSignalData::PMChildFlags, and PMSignalState.
void PMSignalShmemInit | ( | void | ) |
Definition at line 144 of file pmsignal.c.
References MaxLivePostmasterChildren(), MemoryContextAllocZero(), MemSet, next_child_inuse, PMSignalData::num_child_flags, num_child_inuse, pfree(), PMChildInUse, PMSignalShmemSize(), PMSignalState, PostmasterContext, ShmemInitStruct(), and unvolatize.
Referenced by CreateOrAttachShmemStructs().
Size PMSignalShmemSize | ( | void | ) |
Definition at line 129 of file pmsignal.c.
References add_size(), MaxLivePostmasterChildren(), mul_size(), and size.
Referenced by CalculateShmemSize(), and PMSignalShmemInit().
void PostmasterDeathSignalInit | ( | void | ) |
Definition at line 437 of file pmsignal.c.
References elog, ERROR, and pqsignal().
Referenced by InitPostmasterChild().
bool PostmasterIsAliveInternal | ( | void | ) |
Definition at line 376 of file pmsignal.c.
References EAGAIN, elog, EWOULDBLOCK, FATAL, postmaster_alive_fds, POSTMASTER_FD_WATCH, and read.
Referenced by WaitEventSetWaitBlock().
bool ReleasePostmasterChildSlot | ( | int | slot | ) |
Definition at line 284 of file pmsignal.c.
References Assert, num_child_inuse, PM_CHILD_ASSIGNED, PM_CHILD_UNUSED, PMSignalData::PMChildFlags, PMChildInUse, and PMSignalState.
Referenced by BackendStartup(), CleanupBackend(), do_start_bgworker(), and StartAutovacuumWorker().
void SendPostmasterSignal | ( | PMSignalReason | reason | ) |
Definition at line 181 of file pmsignal.c.
References IsUnderPostmaster, kill, PMSignalData::PMSignalFlags, PMSignalState, PostmasterPid, and SIGUSR1.
Referenced by CheckRecoveryConsistency(), do_start_worker(), GetNewMultiXactId(), GetNewTransactionId(), PerformWalRecovery(), pg_rotate_logfile(), RegisterDynamicBackgroundWorker(), RequestXLogStreaming(), SetMultiXactIdLimit(), SetTransactionIdLimit(), and TerminateBackgroundWorker().
void SetQuitSignalReason | ( | QuitSignalReason | reason | ) |
Definition at line 218 of file pmsignal.c.
References PMSignalState, and PMSignalData::sigquit_reason.
Referenced by HandleChildCrash(), and process_pm_shutdown_request().
|
static |
Definition at line 91 of file pmsignal.c.
Referenced by AssignPostmasterChildSlot(), and PMSignalShmemInit().
|
static |
Definition at line 90 of file pmsignal.c.
Referenced by AssignPostmasterChildSlot(), IsPostmasterChildWalSender(), PMSignalShmemInit(), and ReleasePostmasterChildSlot().
|
static |
Definition at line 92 of file pmsignal.c.
Referenced by AssignPostmasterChildSlot(), PMSignalShmemInit(), and ReleasePostmasterChildSlot().
NON_EXEC_STATIC volatile PMSignalData* PMSignalState = NULL |
Definition at line 83 of file pmsignal.c.
Referenced by AssignPostmasterChildSlot(), CheckPostmasterSignal(), GetQuitSignalReason(), IsPostmasterChildWalSender(), MarkPostmasterChildActive(), MarkPostmasterChildInactive(), MarkPostmasterChildWalSender(), PMSignalShmemInit(), ReleasePostmasterChildSlot(), SendPostmasterSignal(), and SetQuitSignalReason().