PostgreSQL Source Code git master
|
Go to the source code of this file.
Data Structures | |
struct | PMChild |
Macros | |
#define | POSTMASTER_FD_WATCH |
#define | POSTMASTER_FD_OWN 1 /* kept open by postmaster only */ |
#define | MAX_BACKENDS 0x3FFFF |
Typedefs | |
typedef enum DispatchOption | DispatchOption |
Enumerations | |
enum | DispatchOption { DISPATCH_CHECK , DISPATCH_BOOT , DISPATCH_FORKCHILD , DISPATCH_DESCRIBE_CONFIG , DISPATCH_SINGLE , DISPATCH_POSTMASTER } |
Functions | |
void | PostmasterMain (int argc, char *argv[]) pg_attribute_noreturn() |
void | ClosePostmasterPorts (bool am_syslogger) |
void | InitProcessGlobals (void) |
int | MaxLivePostmasterChildren (void) |
bool | PostmasterMarkPIDForWorkerNotify (int) |
pid_t | postmaster_child_launch (BackendType child_type, int child_slot, char *startup_data, size_t startup_data_len, struct ClientSocket *client_sock) |
const char * | PostmasterChildName (BackendType child_type) |
void | InitPostmasterChildSlots (void) |
PMChild * | AssignPostmasterChildSlot (BackendType btype) |
PMChild * | AllocDeadEndChild (void) |
bool | ReleasePostmasterChildSlot (PMChild *pmchild) |
PMChild * | FindPostmasterChildByPid (int pid) |
DispatchOption | parse_dispatch_option (const char *name) |
Variables | |
PGDLLIMPORT bool | EnableSSL |
PGDLLIMPORT int | SuperuserReservedConnections |
PGDLLIMPORT int | ReservedConnections |
PGDLLIMPORT int | PostPortNumber |
PGDLLIMPORT int | Unix_socket_permissions |
PGDLLIMPORT char * | Unix_socket_group |
PGDLLIMPORT char * | Unix_socket_directories |
PGDLLIMPORT char * | ListenAddresses |
PGDLLIMPORT bool | ClientAuthInProgress |
PGDLLIMPORT int | PreAuthDelay |
PGDLLIMPORT int | AuthenticationTimeout |
PGDLLIMPORT bool | Log_connections |
PGDLLIMPORT bool | log_hostname |
PGDLLIMPORT bool | enable_bonjour |
PGDLLIMPORT char * | bonjour_name |
PGDLLIMPORT bool | restart_after_crash |
PGDLLIMPORT bool | remove_temp_files_after_crash |
PGDLLIMPORT bool | send_abort_for_crash |
PGDLLIMPORT bool | send_abort_for_kill |
PGDLLIMPORT int | postmaster_alive_fds [2] |
PGDLLIMPORT const char * | progname |
PGDLLIMPORT bool | redirection_done |
PGDLLIMPORT bool | LoadedSSL |
PGDLLIMPORT struct ClientSocket * | MyClientSocket |
dlist_head | ActiveChildList |
#define MAX_BACKENDS 0x3FFFF |
Definition at line 138 of file postmaster.h.
#define POSTMASTER_FD_OWN 1 /* kept open by postmaster only */ |
Definition at line 85 of file postmaster.h.
#define POSTMASTER_FD_WATCH |
Definition at line 84 of file postmaster.h.
typedef enum DispatchOption DispatchOption |
enum DispatchOption |
Enumerator | |
---|---|
DISPATCH_CHECK | |
DISPATCH_BOOT | |
DISPATCH_FORKCHILD | |
DISPATCH_DESCRIBE_CONFIG | |
DISPATCH_SINGLE | |
DISPATCH_POSTMASTER |
Definition at line 145 of file postmaster.h.
PMChild * AllocDeadEndChild | ( | void | ) |
Definition at line 207 of file pmchild.c.
References ActiveChildList, B_DEAD_END_BACKEND, PMChild::bgworker_notify, PMChild::bkend_type, PMChild::child_slot, DEBUG2, dlist_push_head(), PMChild::elem, elog, MCXT_ALLOC_NO_OOM, palloc_extended(), PMChild::pid, and PMChild::rw.
Referenced by BackendStartup().
PMChild * AssignPostmasterChildSlot | ( | BackendType | btype | ) |
Definition at line 161 of file pmchild.c.
References ActiveChildList, PMChild::bgworker_notify, PMChild::bkend_type, PMChild::child_slot, DEBUG2, dlist_container, dlist_is_empty(), dlist_pop_head_node(), dlist_push_head(), PMChild::elem, elog, ERROR, PMChildPool::first_slotno, PMChildPool::freelist, MarkPostmasterChildSlotAssigned(), PMChild::pid, pmchild_pools, PostmasterChildName(), PMChild::rw, PMChildPool::size, and size.
Referenced by BackendStartup(), StartBackgroundWorker(), StartChildProcess(), and StartSysLogger().
void ClosePostmasterPorts | ( | bool | am_syslogger | ) |
Definition at line 1842 of file postmaster.c.
References close, closesocket, elog, ereport, errcode_for_file_access(), errmsg_internal(), FATAL, FreeWaitEventSetAfterFork(), i, ListenSockets, LOG, NumListenSockets, pfree(), pm_wait_set, postmaster_alive_fds, POSTMASTER_FD_OWN, ReleaseExternalFD(), and syslogPipe.
Referenced by postmaster_child_launch().
PMChild * FindPostmasterChildByPid | ( | int | pid | ) |
Definition at line 273 of file pmchild.c.
References ActiveChildList, dlist_iter::cur, dlist_container, dlist_foreach, and PMChild::pid.
Referenced by process_pm_child_exit().
void InitPostmasterChildSlots | ( | void | ) |
Definition at line 86 of file pmchild.c.
References ActiveChildList, Assert, autovacuum_worker_slots, B_ARCHIVER, B_AUTOVAC_LAUNCHER, B_AUTOVAC_WORKER, B_BACKEND, B_BG_WORKER, B_BG_WRITER, B_CHECKPOINTER, B_INVALID, B_LOGGER, B_SLOTSYNC_WORKER, B_STARTUP, B_WAL_RECEIVER, B_WAL_SUMMARIZER, B_WAL_WRITER, BACKEND_NUM_TYPES, PMChild::bgworker_notify, PMChild::bkend_type, PMChild::child_slot, dlist_init(), dlist_push_tail(), PMChildPool::first_slotno, i, j, max_wal_senders, max_worker_processes, MaxConnections, num_pmchild_slots, palloc(), PMChild::pid, pmchild_pools, PMChild::rw, PMChildPool::size, and size.
Referenced by BootstrapModeMain(), PostgresSingleUserMain(), and PostmasterMain().
void InitProcessGlobals | ( | void | ) |
Definition at line 1919 of file postmaster.c.
References GetCurrentTimestamp(), MyProcPid, MyStartTime, MyStartTimestamp, pg_global_prng_state, pg_prng_seed(), pg_prng_strong_seed, pg_prng_uint32(), timestamptz_to_time_t(), and unlikely.
Referenced by InitPostmasterChild(), InitStandaloneProcess(), and PostmasterMain().
int MaxLivePostmasterChildren | ( | void | ) |
Definition at line 70 of file pmchild.c.
References elog, ERROR, and num_pmchild_slots.
Referenced by PMSignalShmemInit(), and PMSignalShmemSize().
DispatchOption parse_dispatch_option | ( | const char * | name | ) |
Definition at line 243 of file main.c.
References DISPATCH_FORKCHILD, DISPATCH_POSTMASTER, DispatchOptionNames, i, lengthof, and name.
Referenced by BootstrapModeMain(), main(), PostmasterMain(), and process_postgres_switches().
pid_t postmaster_child_launch | ( | BackendType | child_type, |
int | child_slot, | ||
char * | startup_data, | ||
size_t | startup_data_len, | ||
struct ClientSocket * | client_sock | ||
) |
Definition at line 227 of file launch_backend.c.
References Assert, B_LOGGER, child_process_kinds, ClosePostmasterPorts(), dsm_detach_all(), fork_process(), InitPostmasterChild(), IsPostmasterEnvironment, IsUnderPostmaster, child_process_kind::main_fn, MemoryContextSwitchTo(), MyClientSocket, MyPMChildSlot, name, palloc(), pg_unreachable, PGSharedMemoryDetach(), and TopMemoryContext.
Referenced by BackendStartup(), StartBackgroundWorker(), StartChildProcess(), and SysLogger_Start().
const char * PostmasterChildName | ( | BackendType | child_type | ) |
Definition at line 209 of file launch_backend.c.
References child_process_kinds, and child_process_kind::name.
Referenced by AssignPostmasterChildSlot(), and StartChildProcess().
void PostmasterMain | ( | int | argc, |
char * | argv[] | ||
) |
Definition at line 483 of file postmaster.c.
References AddToDataDirLockFile(), ALLOCSET_DEFAULT_SIZES, AllocSetContextCreate, appendStringInfo(), appendStringInfoString(), ApplyLauncherRegister(), ARCHIVE_MODE_OFF, Assert, autovac_init(), B_BG_WRITER, B_CHECKPOINTER, B_STARTUP, BgWriterPMChild, BlockSig, bonjour_name, ChangeToDataDir(), checkControlFile(), checkDataDir(), CheckDateTokenTables(), CheckpointerPMChild, CloseServerPorts(), CreateDataDirLockFile(), CreateOptsFile(), CreateSharedMemoryAndSemaphores(), StringInfoData::data, DEBUG3, DestNone, DISPATCH_POSTMASTER, dummy_handler(), enable_bonjour, EnableSSL, environ, ereport, err(), errcode(), errcode_for_file_access(), errhint(), errmsg(), errmsg_internal(), ERROR, ExitPostmaster(), external_pid_file, FATAL, fprintf, get_stats_option_name(), GetConfigOption(), GetConfigOptionFlags(), GetCurrentTimestamp(), getInstallationPaths(), getopt(), GUC_RUNTIME_COMPUTED, handle_pm_child_exit_signal(), handle_pm_pmsignal_signal(), handle_pm_reload_request_signal(), handle_pm_shutdown_request_signal(), HbaFileName, InitializeFastPathLocks(), InitializeGUCOptions(), InitializeLatchSupport(), InitializeMaxBackends(), InitializeShmemGUCs(), InitializeWalConsistencyChecking(), InitPostmasterChildSlots(), InitPostmasterDeathWatchHandle(), InitProcessGlobals(), InitProcessLocalLatch(), initStringInfo(), IsBinaryUpgrade, IsPostmasterEnvironment, lfirst, list_free(), list_free_deep(), ListenAddresses, ListenServerPort(), ListenSockets, load_hba(), load_ident(), LoadedSSL, LocalProcessControlFile(), LOCK_FILE_LINE_LISTEN_ADDR, LOCK_FILE_LINE_PM_STATUS, LOCK_FILE_LINE_SOCKET_DIR, LOG, Log_destination, LOG_DESTINATION_STDERR, Log_destination_string, LOG_METAINFO_DATAFILE, Logging_collector, max_wal_senders, MaxConnections, MAXLISTEN, maybe_start_bgworkers(), MemoryContextSwitchTo(), message_level_is_interesting(), my_exec_path, MyProcPid, name, NIL, NumListenSockets, on_proc_exit(), optarg, opterr, optind, palloc(), parse_dispatch_option(), ParseLongOption(), pfree(), pg_hton16, PG_MODE_MASK_OWNER, PG_TEMP_FILES_DIR, PGC_POSTMASTER, PGC_S_ARGV, PGC_S_OVERRIDE, PGC_SUSET, PgStartTime, pgwin32_signal_initialize(), PM_STARTUP, PM_STATUS_STARTING, PostmasterContext, PostmasterPid, PostPortNumber, pqinitmask(), pqsignal, process_shared_preload_libraries(), process_shmem_requests(), progname, pstrdup(), RemoveLogrotateSignalFiles(), RemovePgTempFiles(), RemovePgTempFilesInDir(), RemovePromoteSignalFiles(), ReservedConnections, S_IRGRP, S_IROTH, S_IRUSR, S_IWUSR, secure_initialize(), SelectConfigFiles(), ServerLoop(), set_debug_options(), set_max_safe_fds(), set_plan_disabling_options(), SetConfigOption(), SIGALRM, SIGCHLD, SIGHUP, SIGPIPE, SIGQUIT, SIGUSR1, SIGUSR2, SplitDirectoriesString(), SplitGUCList(), StartChildProcess(), StartSysLogger(), STARTUP_RUNNING, StartupPMChild, StartupStatus, STATUS_OK, success, summarize_wal, SuperuserReservedConnections, TopMemoryContext, UnBlockSig, Unix_socket_directories, unlink_external_pid_file(), UpdatePMState(), userDoption, value, wal_level, WAL_LEVEL_MINIMAL, WARNING, whereToSendOutput, write_stderr, and XLogArchiveMode.
Referenced by main().
bool PostmasterMarkPIDForWorkerNotify | ( | int | pid | ) |
Definition at line 4274 of file postmaster.c.
References ActiveChildList, PMChild::bgworker_notify, dlist_iter::cur, dlist_container, dlist_foreach, and PMChild::pid.
Referenced by BackgroundWorkerStateChange().
bool ReleasePostmasterChildSlot | ( | PMChild * | pmchild | ) |
Definition at line 235 of file pmchild.c.
References B_BACKEND, B_DEAD_END_BACKEND, B_WAL_SENDER, PMChild::bkend_type, PMChild::child_slot, DEBUG2, dlist_delete(), dlist_push_head(), PMChild::elem, elog, ERROR, PMChildPool::first_slotno, PMChildPool::freelist, MarkPostmasterChildSlotUnassigned(), pfree(), pmchild_pools, and PMChildPool::size.
Referenced by BackendStartup(), CleanupBackend(), process_pm_child_exit(), StartBackgroundWorker(), StartChildProcess(), and StartSysLogger().
|
extern |
Definition at line 60 of file pmchild.c.
Referenced by AllocDeadEndChild(), AssignPostmasterChildSlot(), CountChildren(), FindPostmasterChildByPid(), InitPostmasterChildSlots(), PostmasterMarkPIDForWorkerNotify(), and SignalChildren().
|
extern |
Definition at line 237 of file postmaster.c.
Referenced by BackendInitialize(), and PerformAuthentication().
|
extern |
Definition at line 243 of file postmaster.c.
Referenced by PostmasterMain().
|
extern |
Definition at line 368 of file postmaster.c.
Referenced by BackendInitialize(), PerformAuthentication(), ProcessInterrupts(), quickdie(), should_output_to_client(), and StatementTimeoutHandler().
|
extern |
Definition at line 242 of file postmaster.c.
Referenced by PostmasterMain().
|
extern |
Definition at line 234 of file postmaster.c.
Referenced by BackendMain(), parse_hba_line(), PostmasterMain(), and process_pm_reload_request().
|
extern |
Definition at line 205 of file postmaster.c.
Referenced by PostmasterMain().
|
extern |
Referenced by BackendMain(), PostmasterMain(), process_pm_reload_request(), ProcessSSLStartup(), and ProcessStartupPacket().
|
extern |
Definition at line 240 of file postmaster.c.
Referenced by BackendInitialize(), ClientAuthentication(), PerformAuthentication(), and set_authn_id().
|
extern |
Definition at line 239 of file postmaster.c.
Referenced by BackendInitialize().
|
extern |
Definition at line 49 of file globals.c.
Referenced by BackendMain(), and postmaster_child_launch().
|
extern |
Definition at line 473 of file postmaster.c.
Referenced by AddWaitEventToSet(), ClosePostmasterPorts(), InitPostmasterChild(), InitPostmasterDeathWatchHandle(), and PostmasterIsAliveInternal().
|
extern |
Definition at line 199 of file postmaster.c.
Referenced by CreateLockFile(), and PostmasterMain().
|
extern |
Definition at line 236 of file postmaster.c.
Referenced by BackendInitialize().
|
extern |
Definition at line 44 of file main.c.
Referenced by _check_database_version(), BootstrapModeMain(), check_root(), checkControlFile(), cluster_all_databases(), cluster_one_database(), ConnectDatabase(), connectDatabase(), connectMaintenanceDatabase(), get_opts(), get_progname(), get_user_name_or_exit(), GetConnection(), help(), main(), ParallelSlotsSetup(), PostgresSingleUserMain(), PostmasterMain(), process_postgres_switches(), reindex_all_databases(), reindex_one_database(), SelectConfigFiles(), set_dump_section(), sigTermHandler(), startup_hacks(), usage(), vacuum_all_databases(), and vacuum_one_database().
|
extern |
Definition at line 371 of file postmaster.c.
Referenced by send_message_to_server_log(), SysLogger_Start(), SysLoggerMain(), and write_console().
|
extern |
Definition at line 245 of file postmaster.c.
Referenced by PostmasterStateMachine().
|
extern |
Definition at line 226 of file postmaster.c.
Referenced by InitPostgres(), and PostmasterMain().
|
extern |
Definition at line 244 of file postmaster.c.
Referenced by PostmasterStateMachine().
|
extern |
Definition at line 253 of file postmaster.c.
Referenced by HandleFatalError().
|
extern |
Definition at line 254 of file postmaster.c.
Referenced by ServerLoop().
|
extern |
Definition at line 225 of file postmaster.c.
Referenced by InitPostgres(), and PostmasterMain().
|
extern |
Definition at line 202 of file postmaster.c.
Referenced by PostmasterMain().
|
extern |
Definition at line 107 of file pqcomm.c.
Referenced by Setup_AF_UNIX().
|
extern |
Definition at line 106 of file pqcomm.c.
Referenced by Setup_AF_UNIX(), and show_unix_socket_permissions().