85 #include <systemd/sd-daemon.h>
88 #ifdef HAVE_PTHREAD_IS_THREADED_NP
136 #define BACKEND_TYPE_NORMAL 0x0001
137 #define BACKEND_TYPE_AUTOVAC 0x0002
138 #define BACKEND_TYPE_WALSND 0x0004
139 #define BACKEND_TYPE_BGWORKER 0x0008
140 #define BACKEND_TYPE_ALL 0x000F
261 #define SmartShutdown 1
262 #define FastShutdown 2
263 #define ImmediateShutdown 3
342 #define SIGKILL_CHILDREN_AFTER_SECS 5
381 static DNSServiceRef bonjour_sdref = NULL;
401 static void HandleChildCrash(
int pid,
int exitstatus,
const char *procname);
403 int pid,
int exitstatus);
416 #define SignalChildren(sig) SignalSomeChildren(sig, BACKEND_TYPE_ALL)
422 static bool CreateOptsFile(
int argc,
char *argv[],
char *fullprogname);
430 static pid_t waitpid(pid_t pid,
int *exitstatus,
int options);
431 static void WINAPI pgwin32_deadchild_callback(PVOID lpParameter, BOOLEAN TimerOrWaitFired);
433 static HANDLE win32ChildQueue;
440 } win32_deadchild_waitinfo;
444 #define EXIT_STATUS_0(st) ((st) == 0)
445 #define EXIT_STATUS_1(st) (WIFEXITED(st) && WEXITSTATUS(st) == 1)
446 #define EXIT_STATUS_3(st) (WIFEXITED(st) && WEXITSTATUS(st) == 3)
456 HANDLE PostmasterHandle;
468 bool listen_addr_saved =
false;
469 char *output_config_variable = NULL;
518 sigprocmask(SIG_SETMASK, &
BlockSig, NULL);
568 while ((opt =
getopt(argc, argv,
"B:bC:c:D:d:EeFf:h:ijk:lN:OPp:r:S:sTt:W:-:")) != -1)
582 output_config_variable = strdup(
optarg);
596 (
errcode(ERRCODE_SYNTAX_ERROR),
597 errmsg(
"--%s requires a value",
601 (
errcode(ERRCODE_SYNTAX_ERROR),
602 errmsg(
"-c %s requires a value",
635 write_stderr(
"%s: invalid argument for option -f: \"%s\"\n",
708 write_stderr(
"%s: invalid argument for option -t: \"%s\"\n",
720 write_stderr(
"Try \"%s --help\" for more information.\n",
733 write_stderr(
"Try \"%s --help\" for more information.\n",
745 if (output_config_variable != NULL)
770 puts(config_val ? config_val :
"");
799 write_stderr(
"%s: \"superuser_reserved_connections\" (%d) plus \"reserved_connections\" (%d) must be less than \"max_connections\" (%d)\n",
807 (
errmsg(
"WAL archival cannot be enabled when \"wal_level\" is \"minimal\"")));
810 (
errmsg(
"WAL streaming (\"max_wal_senders\" > 0) requires \"wal_level\" to be \"replica\" or \"logical\"")));
813 (
errmsg(
"WAL cannot be summarized when \"wal_level\" is \"minimal\"")));
830 #ifdef HAVE_INT_OPTRESET
940 if (output_config_variable != NULL)
945 puts(config_val ? config_val :
"");
980 win32ChildQueue = CreateIoCompletionPort(INVALID_HANDLE_VALUE, NULL, 0, 1);
981 if (win32ChildQueue == NULL)
983 (
errmsg(
"could not create I/O completion port for child queue")));
1027 errmsg(
"could not remove file \"%s\": %m",
1048 (
errmsg(
"ending log output to stderr"),
1049 errhint(
"Future log output will go to log destination \"%s\".",
1060 (
errmsg(
"starting %s", PG_VERSION_STR)));
1086 (
errcode(ERRCODE_INVALID_PARAMETER_VALUE),
1087 errmsg(
"invalid list syntax in parameter \"%s\"",
1088 "listen_addresses")));
1091 foreach(l, elemlist)
1093 char *curhost = (
char *)
lfirst(l);
1095 if (strcmp(curhost,
"*") == 0)
1114 if (!listen_addr_saved)
1117 listen_addr_saved =
true;
1122 (
errmsg(
"could not create listen socket for \"%s\"",
1128 (
errmsg(
"could not create any TCP/IP sockets")));
1138 DNSServiceErrorType
err;
1146 err = DNSServiceRegister(&bonjour_sdref,
1150 "_postgresql._tcp.",
1158 if (
err != kDNSServiceErr_NoError)
1160 (
errmsg(
"DNSServiceRegister() failed: error code %ld",
1188 (
errcode(ERRCODE_INVALID_PARAMETER_VALUE),
1189 errmsg(
"invalid list syntax in parameter \"%s\"",
1190 "unix_socket_directories")));
1193 foreach(l, elemlist)
1195 char *socketdir = (
char *)
lfirst(l);
1213 (
errmsg(
"could not create Unix-domain socket in directory \"%s\"",
1219 (
errmsg(
"could not create any Unix-domain sockets")));
1230 (
errmsg(
"no socket created for listening")));
1237 if (!listen_addr_saved)
1261 write_stderr(
"%s: could not change permissions of external PID file \"%s\": %m\n",
1265 write_stderr(
"%s: could not write external PID file \"%s\": %m\n",
1305 #ifdef HAVE_PTHREAD_IS_THREADED_NP
1316 if (pthread_is_threaded_np() != 0)
1318 (
errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
1319 errmsg(
"postmaster became multithreaded during startup"),
1320 errhint(
"Set the LC_ALL environment variable to a valid locale.")));
1379 elog(
LOG,
"could not close listen socket: %m");
1419 (
errmsg(
"%s: could not locate my own executable path",
argv0)));
1424 postgres_exec_path) < 0)
1426 (
errmsg(
"%s: could not locate matching postgres executable",
1447 errmsg(
"could not open directory \"%s\": %m",
1449 errhint(
"This may indicate an incomplete PostgreSQL installation, or that the file \"%s\" has been moved away from its proper location.",
1476 write_stderr(
"%s: could not find the database system\n"
1477 "Expected to find it in the directory \"%s\",\n"
1478 "but could not open file \"%s\": %m\n",
1514 return Max(seconds * 1000, 0);
1552 if (next_wakeup == 0 || this_wakeup < next_wakeup)
1553 next_wakeup = this_wakeup;
1557 if (next_wakeup != 0)
1564 return Min(60 * 1000, ms);
1591 if (accept_connections)
1605 time_t last_lockfile_recheck_time,
1611 last_lockfile_recheck_time = last_touch_time = time(NULL);
1627 for (
int i = 0;
i < nevents;
i++)
1659 elog(
LOG,
"could not close client socket: %m");
1678 #ifdef HAVE_PTHREAD_IS_THREADED_NP
1684 Assert(pthread_is_threaded_np() == 0);
1713 (
errmsg(
"issuing %s to recalcitrant children",
1735 (
errmsg(
"performing immediate shutdown because data directory lock file is invalid")));
1738 last_lockfile_recheck_time =
now;
1750 last_touch_time =
now;
1841 errmsg_internal(
"could not close postmaster death monitoring pipe in child process: %m")));
1854 #ifndef EXEC_BACKEND
1860 elog(
LOG,
"could not close listen socket: %m");
1888 close(DNSServiceRefSockFD(bonjour_sdref));
1972 (
errmsg(
"received SIGHUP, reloading configuration files")));
2014 (
errmsg(
"SSL configuration was not reloaded")));
2037 switch (postgres_signal_arg)
2100 (
errmsg(
"received smart shutdown request")));
2105 sd_notify(0,
"STOPPING=1");
2141 (
errmsg(
"received fast shutdown request")));
2146 sd_notify(0,
"STOPPING=1");
2159 (
errmsg(
"aborting any active transactions")));
2183 (
errmsg(
"received immediate shutdown request")));
2188 sd_notify(0,
"STOPPING=1");
2230 while ((pid = waitpid(-1, &exitstatus, WNOHANG)) > 0)
2258 (
errmsg(
"shutdown at recovery target")));
2279 (
errmsg(
"aborting startup due to startup process failure")));
2312 _(
"startup process"));
2335 (
errmsg(
"database system is ready to accept connections")));
2340 sd_notify(0,
"READY=1");
2356 _(
"background writer process"));
2403 _(
"checkpointer process"));
2419 _(
"WAL writer process"));
2434 _(
"WAL receiver process"));
2448 _(
"WAL summarizer process"));
2463 _(
"autovacuum launcher process"));
2478 _(
"archiver process"));
2506 _(
"slot sync worker process"));
2559 bool crashed =
false;
2560 bool logged =
false;
2565 procname =
_(
"dead end backend");
2574 procname =
_(
"server process");
2594 if (exitstatus == ERROR_WAIT_NO_CHILDREN)
2661 procname, bp->
pid, exitstatus);
2704 (
errmsg(
"terminating any other active server processes")));
2796 char activity_buffer[1024];
2797 const char *activity = NULL;
2802 sizeof(activity_buffer));
2810 (
errmsg(
"%s (PID %d) exited with exit code %d",
2812 activity ?
errdetail(
"Failed process was running: %s", activity) : 0));
2821 (
errmsg(
"%s (PID %d) was terminated by exception 0x%X",
2822 procname, pid,
WTERMSIG(exitstatus)),
2823 errhint(
"See C include file \"ntstatus.h\" for a description of the hexadecimal value."),
2824 activity ?
errdetail(
"Failed process was running: %s", activity) : 0));
2831 (
errmsg(
"%s (PID %d) was terminated by signal %d: %s",
2832 procname, pid,
WTERMSIG(exitstatus),
2834 activity ?
errdetail(
"Failed process was running: %s", activity) : 0));
2843 (
errmsg(
"%s (PID %d) exited with unrecognized status %d",
2844 procname, pid, exitstatus),
2845 activity ?
errdetail(
"Failed process was running: %s", activity) : 0));
3085 (
errmsg(
"shutting down due to startup process failure")));
3091 (
errmsg(
"shutting down because \"restart_after_crash\" is off")));
3103 (
errmsg(
"all server processes terminated; reinitializing")));
3264 if (
kill(pid, signal) < 0)
3265 elog(
DEBUG3,
"kill(%ld,%d) failed: %m", (
long) pid, signal);
3274 if (
kill(-pid, signal) < 0)
3275 elog(
DEBUG3,
"kill(%ld,%d) failed: %m", (
long) (-pid), signal);
3309 bool signaled =
false;
3338 signal, (
int) bp->
pid)));
3399 (
errcode(ERRCODE_OUT_OF_MEMORY),
3400 errmsg(
"out of memory")));
3421 (
char *) &startup_data,
sizeof(startup_data),
3426 int save_errno = errno;
3433 (
errmsg(
"could not fork new process for connection: %m")));
3441 (
int) pid, (
int) client_sock->
sock)));
3469 snprintf(buffer,
sizeof(buffer),
"E%s%s\n",
3470 _(
"could not fork new process for connection: "),
3480 rc =
send(client_sock->
sock, buffer, strlen(buffer) + 1, 0);
3481 }
while (rc < 0 && errno ==
EINTR);
3492 #ifdef HAVE_PTHREAD_IS_THREADED_NP
3500 if (pthread_is_threaded_np() != 0)
3502 (
errcode(ERRCODE_INTERNAL_ERROR),
3504 errdetail(
"Please report this to <%s>.", PACKAGE_BUGREPORT)));
3561 sd_notify(0,
"READY=1");
3572 (
errmsg(
"database system is ready to accept read-only connections")));
3577 sd_notify(0,
"READY=1");
3808 (
errcode(ERRCODE_OUT_OF_MEMORY),
3809 errmsg(
"out of memory")));
3838 #define OPTS_FILE "postmaster.opts"
3840 if ((fp = fopen(
OPTS_FILE,
"w")) == NULL)
3848 fprintf(fp,
"%s", fullprogname);
3849 for (
i = 1;
i < argc;
i++)
3922 if (worker_pid == -1)
3926 (
errmsg(
"could not fork background worker process: %m")));
4002 (
errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
4003 errmsg(
"no slot available for new background worker process")));
4011 (
errcode(ERRCODE_OUT_OF_MEMORY),
4012 errmsg(
"out of memory")));
4038 #define MAX_BGWORKERS_TO_LAUNCH 100
4039 int num_launched = 0;
4093 if (notify_pid != 0)
4179 waitpid(pid_t pid,
int *exitstatus,
int options)
4181 win32_deadchild_waitinfo *childinfo;
4188 if (!GetQueuedCompletionStatus(win32ChildQueue, &dwd, &
key, &ovl, 0))
4194 childinfo = (win32_deadchild_waitinfo *)
key;
4195 pid = childinfo->procId;
4201 UnregisterWaitEx(childinfo->waitHandle, NULL);
4203 if (!GetExitCodeProcess(childinfo->procHandle, &exitcode))
4208 write_stderr(
"could not read exit code for process\n");
4211 *exitstatus = exitcode;
4217 CloseHandle(childinfo->procHandle);
4233 pgwin32_deadchild_callback(PVOID lpParameter, BOOLEAN TimerOrWaitFired)
4236 if (TimerOrWaitFired)
4246 if (!PostQueuedCompletionStatus(win32ChildQueue,
4248 (ULONG_PTR) lpParameter,
4250 write_stderr(
"could not post child completion status\n");
4262 pgwin32_register_deadchild_callback(HANDLE procHandle, DWORD procId)
4264 win32_deadchild_waitinfo *childinfo;
4266 childinfo =
palloc(
sizeof(win32_deadchild_waitinfo));
4267 childinfo->procHandle = procHandle;
4268 childinfo->procId = procId;
4270 if (!RegisterWaitForSingleObject(&childinfo->waitHandle,
4272 pgwin32_deadchild_callback,
4275 WT_EXECUTEONLYONCE | WT_EXECUTEINWAITTHREAD))
4277 (
errmsg_internal(
"could not register process for wait: error code %lu",
4307 errmsg_internal(
"could not create pipe to monitor postmaster death: %m")));
4320 errmsg_internal(
"could not set postmaster death monitoring pipe to nonblocking mode: %m")));
4326 if (DuplicateHandle(GetCurrentProcess(),
4327 GetCurrentProcess(),
4328 GetCurrentProcess(),
4332 DUPLICATE_SAME_ACCESS) == 0)
4334 (
errmsg_internal(
"could not duplicate postmaster handle: error code %lu",
bool AutoVacuumingActive(void)
int autovacuum_max_workers
void AutoVacWorkerFailed(void)
bool CheckDateTokenTables(void)
long TimestampDifferenceMilliseconds(TimestampTz start_time, TimestampTz stop_time)
bool TimestampDifferenceExceeds(TimestampTz start_time, TimestampTz stop_time, int msec)
TimestampTz GetCurrentTimestamp(void)
Datum now(PG_FUNCTION_ARGS)
pg_time_t timestamptz_to_time_t(TimestampTz t)
const char * pgstat_get_crashed_backend_activity(int pid, char *buffer, int buflen)
void secure_destroy(void)
int secure_initialize(bool isServerStart)
void ReportBackgroundWorkerPID(RegisteredBgWorker *rw)
void ReportBackgroundWorkerExit(RegisteredBgWorker *rw)
void ResetBackgroundWorkerCrashTimes(void)
dlist_head BackgroundWorkerList
void ForgetBackgroundWorker(RegisteredBgWorker *rw)
void BackgroundWorkerStopNotifications(pid_t pid)
void BackgroundWorkerStateChange(bool allow_new_workers)
void ForgetUnstartedBackgroundWorkers(void)
#define BGW_NEVER_RESTART
@ BgWorkerStart_RecoveryFinished
@ BgWorkerStart_ConsistentState
@ BgWorkerStart_PostmasterStart
#define write_stderr(str)
#define Assert(condition)
#define pg_attribute_noreturn()
int find_my_exec(const char *argv0, char *retpath)
int find_other_exec(const char *argv0, const char *target, const char *versionstr, char *retpath)
int errcode_for_socket_access(void)
int errmsg_internal(const char *fmt,...)
int errcode_for_file_access(void)
int errdetail(const char *fmt,...)
int errhint(const char *fmt,...)
char * Log_destination_string
int errcode(int sqlerrcode)
int errmsg(const char *fmt,...)
#define LOG_DESTINATION_STDERR
#define ereport(elevel,...)
void err(int eval, const char *fmt,...)
FILE * AllocateFile(const char *name, const char *mode)
void ReleaseExternalFD(void)
void RemovePgTempFilesInDir(const char *tmpdirname, bool missing_ok, bool unlink_all)
void RemovePgTempFiles(void)
void ReserveExternalFD(void)
void set_max_safe_fds(void)
DIR * AllocateDir(const char *dirname)
#define MCXT_ALLOC_NO_OOM
#define PG_MODE_MASK_OWNER
#define PG_TEMP_FILES_DIR
char pkglib_path[MAXPGPATH]
TimestampTz MyStartTimestamp
bool IsPostmasterEnvironment
char my_exec_path[MAXPGPATH]
void SetConfigOption(const char *name, const char *value, GucContext context, GucSource source)
bool SelectConfigFiles(const char *userDoption, const char *progname)
void ParseLongOption(const char *string, char **name, char **value)
void InitializeGUCOptions(void)
const char * GetConfigOption(const char *name, bool missing_ok, bool restrict_privileged)
int GetConfigOptionFlags(const char *name, bool missing_ok)
#define GUC_RUNTIME_COMPUTED
void ProcessConfigFile(GucContext context)
#define dlist_foreach(iter, lhead)
static void dlist_delete(dlist_node *node)
static void dlist_push_head(dlist_head *head, dlist_node *node)
#define dlist_foreach_modify(iter, lhead)
static bool dlist_is_empty(const dlist_head *head)
#define DLIST_STATIC_INIT(name)
#define dlist_container(type, membername, ptr)
void on_proc_exit(pg_on_exit_callback function, Datum arg)
void shmem_exit(int code)
void InitializeShmemGUCs(void)
void CreateSharedMemoryAndSemaphores(void)
void FreeWaitEventSetAfterFork(WaitEventSet *set)
void InitializeLatchSupport(void)
void SetLatch(Latch *latch)
WaitEventSet * CreateWaitEventSet(ResourceOwner resowner, int nevents)
int AddWaitEventToSet(WaitEventSet *set, uint32 events, pgsocket fd, Latch *latch, void *user_data)
int WaitEventSetWait(WaitEventSet *set, long timeout, WaitEvent *occurred_events, int nevents, uint32 wait_event_info)
void FreeWaitEventSet(WaitEventSet *set)
void ResetLatch(Latch *latch)
pid_t postmaster_child_launch(BackendType child_type, char *startup_data, size_t startup_data_len, ClientSocket *client_sock)
const char * PostmasterChildName(BackendType child_type)
void ApplyLauncherRegister(void)
void list_free(List *list)
void list_free_deep(List *list)
char * pstrdup(const char *in)
void pfree(void *pointer)
MemoryContext TopMemoryContext
void * palloc_extended(Size size, int flags)
MemoryContext PostmasterContext
#define AllocSetContextCreate
#define ALLOCSET_DEFAULT_SIZES
void ChangeToDataDir(void)
void process_shmem_requests(void)
void AddToDataDirLockFile(int target_line, const char *str)
void InitProcessLocalLatch(void)
void process_shared_preload_libraries(void)
void TouchSocketLockFiles(void)
bool RecheckDataDirLockFile(void)
void CreateDataDirLockFile(bool amPostmaster)
static PgChecksumMode mode
int getopt(int nargc, char *const *nargv, const char *ostr)
PGDLLIMPORT char * optarg
uint32 pg_prng_uint32(pg_prng_state *state)
void pg_prng_seed(pg_prng_state *state, uint64 seed)
pg_prng_state pg_global_prng_state
#define pg_prng_strong_seed(state)
bool PgArchCanRestart(void)
#define PM_STATUS_STARTING
#define PM_STATUS_STOPPING
#define PM_STATUS_STANDBY
#define LOCK_FILE_LINE_LISTEN_ADDR
#define LOCK_FILE_LINE_PM_STATUS
#define LOCK_FILE_LINE_SOCKET_DIR
bool ReleasePostmasterChildSlot(int slot)
bool CheckPostmasterSignal(PMSignalReason reason)
void SetQuitSignalReason(QuitSignalReason reason)
bool IsPostmasterChildWalSender(int slot)
int AssignPostmasterChildSlot(void)
@ PMSIGNAL_START_AUTOVAC_WORKER
@ PMSIGNAL_RECOVERY_STARTED
@ PMSIGNAL_START_WALRECEIVER
@ PMSIGNAL_START_AUTOVAC_LAUNCHER
@ PMSIGNAL_BEGIN_HOT_STANDBY
@ PMSIGNAL_BACKGROUND_WORKER_CHANGE
@ PMSIGNAL_ROTATE_LOGFILE
@ PMSIGNAL_ADVANCE_STATE_MACHINE
void get_pkglib_path(const char *my_exec_path, char *ret_path)
bool pg_set_noblock(pgsocket sock)
pqsigfunc pqsignal(int signo, pqsigfunc func)
const char * pg_strsignal(int signum)
#define PG_BACKEND_VERSIONSTR
void set_debug_options(int debug_flag, GucContext context, GucSource source)
CommandDest whereToSendOutput
bool set_plan_disabling_options(const char *arg, GucContext context, GucSource source)
static const char * userDoption
const char * get_stats_option_name(const char *arg)
pg_stack_base_t set_stack_base(void)
void InitializeMaxBackends(void)
void InitializeFastPathLocks(void)
static void CleanupBackend(Backend *bp, int exitstatus)
static void ExitPostmaster(int status) pg_attribute_noreturn()
#define BACKEND_TYPE_NORMAL
static void process_pm_pmsignal(void)
static pid_t WalReceiverPID
static volatile sig_atomic_t pending_pm_reload_request
static void handle_pm_shutdown_request_signal(SIGNAL_ARGS)
static volatile sig_atomic_t pending_pm_fast_shutdown_request
static void LogChildExit(int lev, const char *procname, int pid, int exitstatus)
static void maybe_start_bgworkers(void)
static void CloseServerPorts(int status, Datum arg)
static void InitPostmasterDeathWatchHandle(void)
#define EXIT_STATUS_1(st)
void InitProcessGlobals(void)
#define ImmediateShutdown
static int DetermineSleepTime(void)
static void report_fork_failure_to_client(ClientSocket *client_sock, int errnum)
static pgsocket * ListenSockets
static void handle_pm_reload_request_signal(SIGNAL_ARGS)
#define EXIT_STATUS_0(st)
static void signal_child(pid_t pid, int signal)
static void PostmasterStateMachine(void)
static void TerminateChildren(int signal)
static CAC_state canAcceptConnections(int backend_type)
static void process_pm_child_exit(void)
static int ServerLoop(void)
static bool HaveCrashedWorker
static Backend * assign_backendlist_entry(void)
#define BACKEND_TYPE_BGWORKER
static void checkControlFile(void)
void PostmasterMain(int argc, char *argv[])
static void LaunchMissingBackgroundProcesses(void)
bool remove_temp_files_after_crash
static volatile sig_atomic_t pending_pm_shutdown_request
static time_t AbortStartTime
static pid_t SlotSyncWorkerPID
static bool start_autovac_launcher
static pid_t StartChildProcess(BackendType type)
bool ClientAuthInProgress
static void handle_pm_pmsignal_signal(SIGNAL_ARGS)
static pid_t CheckpointerPID
BackgroundWorker * MyBgworkerEntry
#define SignalChildren(sig)
static volatile sig_atomic_t pending_pm_pmsignal
static int BackendStartup(ClientSocket *client_sock)
static int NumListenSockets
char * Unix_socket_directories
int postmaster_alive_fds[2]
static bool ReachedNormalRunning
#define SIGKILL_CHILDREN_AFTER_SECS
#define BACKEND_TYPE_AUTOVAC
static bool CreateOptsFile(int argc, char *argv[], char *fullprogname)
#define BACKEND_TYPE_WALSND
static void HandleChildCrash(int pid, int exitstatus, const char *procname)
static pid_t WalWriterPID
static void handle_pm_child_exit_signal(SIGNAL_ARGS)
int MaxLivePostmasterChildren(void)
static bool SignalSomeChildren(int signal, int target)
void ClosePostmasterPorts(bool am_syslogger)
static void StartAutovacuumWorker(void)
static bool do_start_bgworker(RegisteredBgWorker *rw)
bool send_abort_for_crash
static WaitEventSet * pm_wait_set
static void getInstallationPaths(const char *argv0)
static volatile sig_atomic_t pending_pm_immediate_shutdown_request
int AuthenticationTimeout
static void unlink_external_pid_file(int status, Datum arg)
static StartupStatusEnum StartupStatus
static bool WalReceiverRequested
static volatile sig_atomic_t pending_pm_child_exit
#define MAX_BGWORKERS_TO_LAUNCH
static pid_t WalSummarizerPID
static void dummy_handler(SIGNAL_ARGS)
static void process_pm_shutdown_request(void)
static void sigquit_child(pid_t pid)
static int CountChildren(int target)
static bool bgworker_should_start_now(BgWorkerStartTime start_time)
static void ConfigurePostmasterWaitSet(bool accept_connections)
bool PostmasterMarkPIDForWorkerNotify(int pid)
int SuperuserReservedConnections
static dlist_head BackendList
static bool StartWorkerNeeded
static bool avlauncher_needs_signal
#define EXIT_STATUS_3(st)
static pid_t SysLoggerPID
static void process_pm_reload_request(void)
PGDLLIMPORT bool LoadedSSL
#define POSTMASTER_FD_OWN
#define POSTMASTER_FD_WATCH
int ListenServerPort(int family, const char *hostName, unsigned short portNumber, const char *unixSocketDir, pgsocket ListenSockets[], int *NumListenSockets, int MaxListen)
int AcceptConnection(pgsocket server_fd, ClientSocket *client_sock)
void TouchSocketFiles(void)
void RemoveSocketFiles(void)
static int fd(const char *x, int i)
MemoryContextSwitchTo(old_ctx)
void pg_queue_signal(int signum)
void pgwin32_signal_initialize(void)
bool sync_replication_slots
bool SlotSyncWorkerCanRestart(void)
bool ValidateSlotSyncParams(int elevel)
CAC_state canAcceptConnections
char bgw_name[BGW_MAXLEN]
char bgw_type[BGW_MAXLEN]
BgWorkerStartTime bgw_start_time
TimestampTz rw_crashed_at
BackgroundWorker rw_worker
bool CheckLogrotateSignal(void)
void RemoveLogrotateSignalFiles(void)
int SysLogger_Start(void)
#define LOG_METAINFO_DATAFILE
#define TimestampTzPlusMilliseconds(tz, ms)
bool SplitDirectoriesString(char *rawstring, char separator, List **namelist)
bool SplitGUCList(char *rawstring, char separator, List **namelist)
#define send(s, buf, len, flags)
void InitializeWalConsistencyChecking(void)
void LocalProcessControlFile(bool reset)
#define XLogArchivingActive()
#define XLogArchivingAlways()
bool CheckPromoteSignal(void)
void RemovePromoteSignalFiles(void)