PostgreSQL Source Code  git master
postmaster.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define POSTMASTER_FD_WATCH
 
#define POSTMASTER_FD_OWN   1 /* kept open by postmaster only */
 
#define MAX_BACKENDS   0x3FFFF
 

Functions

void PostmasterMain (int argc, char *argv[]) pg_attribute_noreturn()
 
void ClosePostmasterPorts (bool am_syslogger)
 
void InitProcessGlobals (void)
 
int MaxLivePostmasterChildren (void)
 
bool PostmasterMarkPIDForWorkerNotify (int)
 

Variables

bool EnableSSL
 
int ReservedBackends
 
PGDLLIMPORT int PostPortNumber
 
int Unix_socket_permissions
 
char * Unix_socket_group
 
char * Unix_socket_directories
 
char * ListenAddresses
 
bool ClientAuthInProgress
 
int PreAuthDelay
 
int AuthenticationTimeout
 
bool Log_connections
 
bool log_hostname
 
bool enable_bonjour
 
char * bonjour_name
 
bool restart_after_crash
 
int postmaster_alive_fds [2]
 
PGDLLIMPORT const char * progname
 

Macro Definition Documentation

◆ MAX_BACKENDS

◆ POSTMASTER_FD_OWN

#define POSTMASTER_FD_OWN   1 /* kept open by postmaster only */

Definition at line 44 of file postmaster.h.

Referenced by ClosePostmasterPorts().

◆ POSTMASTER_FD_WATCH

#define POSTMASTER_FD_WATCH
Value:
0 /* used in children to check for
* postmaster death */

Definition at line 42 of file postmaster.h.

Referenced by AddWaitEventToSet(), InitPostmasterDeathWatchHandle(), and PostmasterIsAliveInternal().

Function Documentation

◆ ClosePostmasterPorts()

void ClosePostmasterPorts ( bool  am_syslogger)

Definition at line 2568 of file postmaster.c.

References close, ereport, errcode_for_file_access(), errmsg_internal(), FATAL, i, ListenSocket, MAXLISTEN, PGINVALID_SOCKET, postmaster_alive_fds, POSTMASTER_FD_OWN, ReleaseExternalFD(), StreamClose(), and syslogPipe.

Referenced by BackendRun(), BackendStartup(), do_start_bgworker(), pgarch_start(), pgstat_start(), StartAutoVacWorker(), StartChildProcess(), and SysLogger_Start().

2569 {
2570  int i;
2571 
2572 #ifndef WIN32
2573 
2574  /*
2575  * Close the write end of postmaster death watch pipe. It's important to
2576  * do this as early as possible, so that if postmaster dies, others won't
2577  * think that it's still running because we're holding the pipe open.
2578  */
2580  ereport(FATAL,
2582  errmsg_internal("could not close postmaster death monitoring pipe in child process: %m")));
2584  /* Notify fd.c that we released one pipe FD. */
2586 #endif
2587 
2588  /*
2589  * Close the postmaster's listen sockets. These aren't tracked by fd.c,
2590  * so we don't call ReleaseExternalFD() here.
2591  */
2592  for (i = 0; i < MAXLISTEN; i++)
2593  {
2594  if (ListenSocket[i] != PGINVALID_SOCKET)
2595  {
2598  }
2599  }
2600 
2601  /*
2602  * If using syslogger, close the read side of the pipe. We don't bother
2603  * tracking this in fd.c, either.
2604  */
2605  if (!am_syslogger)
2606  {
2607 #ifndef WIN32
2608  if (syslogPipe[0] >= 0)
2609  close(syslogPipe[0]);
2610  syslogPipe[0] = -1;
2611 #else
2612  if (syslogPipe[0])
2613  CloseHandle(syslogPipe[0]);
2614  syslogPipe[0] = 0;
2615 #endif
2616  }
2617 
2618 #ifdef USE_BONJOUR
2619  /* If using Bonjour, close the connection to the mDNS daemon */
2620  if (bonjour_sdref)
2621  close(DNSServiceRefSockFD(bonjour_sdref));
2622 #endif
2623 }
void StreamClose(pgsocket sock)
Definition: pqcomm.c:858
#define FATAL
Definition: elog.h:52
#define POSTMASTER_FD_OWN
Definition: postmaster.h:44
int errcode_for_file_access(void)
Definition: elog.c:714
int postmaster_alive_fds[2]
Definition: postmaster.c:565
static pgsocket ListenSocket[MAXLISTEN]
Definition: postmaster.c:220
#define PGINVALID_SOCKET
Definition: port.h:33
#define ereport(elevel,...)
Definition: elog.h:155
int errmsg_internal(const char *fmt,...)
Definition: elog.c:989
void ReleaseExternalFD(void)
Definition: fd.c:1128
int i
#define close(a)
Definition: win32.h:12
#define MAXLISTEN
Definition: postmaster.c:219
int syslogPipe[2]
Definition: syslogger.c:114

◆ InitProcessGlobals()

void InitProcessGlobals ( void  )

Definition at line 2632 of file postmaster.c.

References GetCurrentTimestamp(), MyProcPid, MyStartTime, MyStartTimestamp, pg_strong_random(), srandom(), and timestamptz_to_time_t().

Referenced by InitPostmasterChild(), InitStandaloneProcess(), and PostmasterMain().

2633 {
2634  unsigned int rseed;
2635 
2636  MyProcPid = getpid();
2639 
2640  /*
2641  * Set a different seed for random() in every process. We want something
2642  * unpredictable, so if possible, use high-quality random bits for the
2643  * seed. Otherwise, fall back to a seed based on timestamp and PID.
2644  */
2645  if (!pg_strong_random(&rseed, sizeof(rseed)))
2646  {
2647  /*
2648  * Since PIDs and timestamps tend to change more frequently in their
2649  * least significant bits, shift the timestamp left to allow a larger
2650  * total number of seeds in a given time period. Since that would
2651  * leave only 20 bits of the timestamp that cycle every ~1 second,
2652  * also mix in some higher bits.
2653  */
2654  rseed = ((uint64) MyProcPid) ^
2655  ((uint64) MyStartTimestamp << 12) ^
2656  ((uint64) MyStartTimestamp >> 20);
2657  }
2658  srandom(rseed);
2659 }
int MyProcPid
Definition: globals.c:40
TimestampTz GetCurrentTimestamp(void)
Definition: timestamp.c:1578
pg_time_t MyStartTime
Definition: globals.c:41
pg_time_t timestamptz_to_time_t(TimestampTz t)
Definition: timestamp.c:1752
TimestampTz MyStartTimestamp
Definition: globals.c:42
bool pg_strong_random(void *buf, size_t len)
void srandom(unsigned int seed)
Definition: srandom.c:22

◆ MaxLivePostmasterChildren()

int MaxLivePostmasterChildren ( void  )

Definition at line 5685 of file postmaster.c.

References autovacuum_max_workers, max_wal_senders, max_worker_processes, and MaxConnections.

Referenced by canAcceptConnections(), PMSignalShmemInit(), PMSignalShmemSize(), PostmasterMarkPIDForWorkerNotify(), and processCancelRequest().

5686 {
5687  return 2 * (MaxConnections + autovacuum_max_workers + 1 +
5689 }
int max_wal_senders
Definition: walsender.c:121
int MaxConnections
Definition: globals.c:133
int autovacuum_max_workers
Definition: autovacuum.c:115
int max_worker_processes
Definition: globals.c:134

◆ PostmasterMain()

void PostmasterMain ( int  argc,
char *  argv[] 
)

Definition at line 575 of file postmaster.c.

References AddToDataDirLockFile(), ALLOCSET_DEFAULT_SIZES, AllocSetContextCreate, ApplyLauncherRegister(), ARCHIVE_MODE_OFF, Assert, autovac_init(), BlockSig, bonjour_name, ChangeToDataDir(), checkControlFile(), checkDataDir(), CheckDateTokenTables(), CloseServerPorts(), CreateDataDirLockFile(), CreateOptsFile(), DEBUG3, DestNone, dummy_handler(), enable_bonjour, EnableSSL, environ, ereport, errcode(), errcode_for_file_access(), errhint(), errmsg(), errmsg_internal(), ERROR, ExitPostmaster(), external_pid_file, FATAL, fprintf, free, get_stats_option_name(), GetConfigOption(), GetCurrentTimestamp(), getInstallationPaths(), getopt(), i, InitializeGUCOptions(), InitializeMaxBackends(), InitPostmasterDeathWatchHandle(), InitProcessGlobals(), IsBinaryUpgrade, IsPostmasterEnvironment, lfirst, list_free(), list_free_deep(), ListenAddresses, ListenSocket, load_hba(), load_ident(), 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, max_wal_senders, MaxConnections, MAXLISTEN, maybe_start_bgworkers(), MemoryContextSwitchTo(), my_exec_path, MyProcPid, name, NIL, on_proc_exit(), optarg, opterr, optind, ParseLongOption(), pfree(), pg_hton16, PG_MODE_MASK_OWNER, PG_SETMASK, PG_TEMP_FILES_DIR, PGC_POSTMASTER, PGC_S_ARGV, PGINVALID_SOCKET, PgStartTime, pgstat_init(), PM_STARTUP, PM_STATUS_STARTING, pmdie(), pmState, PostmasterContext, PostmasterPid, PostPortNumber, pqinitmask(), pqsignal_pm(), process_shared_preload_libraries(), progname, pstrdup(), reaper(), Reinit, RemoveLogrotateSignalFiles(), RemovePgTempFiles(), RemovePgTempFilesInDir(), RemovePromoteSignalFiles(), ReservedBackends, reset_shared(), S_IRGRP, S_IROTH, S_IRUSR, S_IWUSR, secure_initialize(), SelectConfigFiles(), SendStop, ServerLoop(), set_debug_options(), set_max_safe_fds(), set_plan_disabling_options(), set_stack_base(), SetConfigOption(), SIG_IGN, SIGALRM, SIGCHLD, SIGHUP, SIGHUP_handler(), SIGPIPE, SIGQUIT, SIGUSR1, sigusr1_handler(), SIGUSR2, SplitDirectoriesString(), SplitGUCList(), STARTUP_RUNNING, StartupDataBase, StartupPID, StartupStatus, status(), STATUS_OK, StreamServerPort(), strerror, success, SysLogger_Start(), SysLoggerPID, TopMemoryContext, Unix_socket_directories, unlink_external_pid_file(), userDoption, value, wal_level, WAL_LEVEL_MINIMAL, WARNING, whereToSendOutput, write_stderr, and XLogArchiveMode.

Referenced by main().

576 {
577  int opt;
578  int status;
579  char *userDoption = NULL;
580  bool listen_addr_saved = false;
581  int i;
582  char *output_config_variable = NULL;
583 
585 
587 
589 
590  /*
591  * We should not be creating any files or directories before we check the
592  * data directory (see checkDataDir()), but just in case set the umask to
593  * the most restrictive (owner-only) permissions.
594  *
595  * checkDataDir() will reset the umask based on the data directory
596  * permissions.
597  */
598  umask(PG_MODE_MASK_OWNER);
599 
600  /*
601  * By default, palloc() requests in the postmaster will be allocated in
602  * the PostmasterContext, which is space that can be recycled by backends.
603  * Allocated data that needs to be available to backends should be
604  * allocated in TopMemoryContext.
605  */
607  "Postmaster",
610 
611  /* Initialize paths to installation files */
612  getInstallationPaths(argv[0]);
613 
614  /*
615  * Set up signal handlers for the postmaster process.
616  *
617  * In the postmaster, we use pqsignal_pm() rather than pqsignal() (which
618  * is used by all child processes and client processes). That has a
619  * couple of special behaviors:
620  *
621  * 1. Except on Windows, we tell sigaction() to block all signals for the
622  * duration of the signal handler. This is faster than our old approach
623  * of blocking/unblocking explicitly in the signal handler, and it should
624  * also prevent excessive stack consumption if signals arrive quickly.
625  *
626  * 2. We do not set the SA_RESTART flag. This is because signals will be
627  * blocked at all times except when ServerLoop is waiting for something to
628  * happen, and during that window, we want signals to exit the select(2)
629  * wait so that ServerLoop can respond if anything interesting happened.
630  * On some platforms, signals marked SA_RESTART would not cause the
631  * select() wait to end.
632  *
633  * Child processes will generally want SA_RESTART, so pqsignal() sets that
634  * flag. We expect children to set up their own handlers before
635  * unblocking signals.
636  *
637  * CAUTION: when changing this list, check for side-effects on the signal
638  * handling setup of child processes. See tcop/postgres.c,
639  * bootstrap/bootstrap.c, postmaster/bgwriter.c, postmaster/walwriter.c,
640  * postmaster/autovacuum.c, postmaster/pgarch.c, postmaster/pgstat.c,
641  * postmaster/syslogger.c, postmaster/bgworker.c and
642  * postmaster/checkpointer.c.
643  */
644  pqinitmask();
646 
647  pqsignal_pm(SIGHUP, SIGHUP_handler); /* reread config file and have
648  * children do same */
649  pqsignal_pm(SIGINT, pmdie); /* send SIGTERM and shut down */
650  pqsignal_pm(SIGQUIT, pmdie); /* send SIGQUIT and die */
651  pqsignal_pm(SIGTERM, pmdie); /* wait for children and shut down */
652  pqsignal_pm(SIGALRM, SIG_IGN); /* ignored */
653  pqsignal_pm(SIGPIPE, SIG_IGN); /* ignored */
654  pqsignal_pm(SIGUSR1, sigusr1_handler); /* message from child process */
655  pqsignal_pm(SIGUSR2, dummy_handler); /* unused, reserve for children */
656  pqsignal_pm(SIGCHLD, reaper); /* handle child termination */
657 
658  /*
659  * No other place in Postgres should touch SIGTTIN/SIGTTOU handling. We
660  * ignore those signals in a postmaster environment, so that there is no
661  * risk of a child process freezing up due to writing to stderr. But for
662  * a standalone backend, their default handling is reasonable. Hence, all
663  * child processes should just allow the inherited settings to stand.
664  */
665 #ifdef SIGTTIN
666  pqsignal_pm(SIGTTIN, SIG_IGN); /* ignored */
667 #endif
668 #ifdef SIGTTOU
669  pqsignal_pm(SIGTTOU, SIG_IGN); /* ignored */
670 #endif
671 
672  /* ignore SIGXFSZ, so that ulimit violations work like disk full */
673 #ifdef SIGXFSZ
674  pqsignal_pm(SIGXFSZ, SIG_IGN); /* ignored */
675 #endif
676 
677  /*
678  * Options setup
679  */
681 
682  opterr = 1;
683 
684  /*
685  * Parse command-line options. CAUTION: keep this in sync with
686  * tcop/postgres.c (the option sets should not conflict) and with the
687  * common help() function in main/main.c.
688  */
689  while ((opt = getopt(argc, argv, "B:bc:C:D:d:EeFf:h:ijk:lN:nOPp:r:S:sTt:W:-:")) != -1)
690  {
691  switch (opt)
692  {
693  case 'B':
694  SetConfigOption("shared_buffers", optarg, PGC_POSTMASTER, PGC_S_ARGV);
695  break;
696 
697  case 'b':
698  /* Undocumented flag used for binary upgrades */
699  IsBinaryUpgrade = true;
700  break;
701 
702  case 'C':
703  output_config_variable = strdup(optarg);
704  break;
705 
706  case 'D':
707  userDoption = strdup(optarg);
708  break;
709 
710  case 'd':
712  break;
713 
714  case 'E':
715  SetConfigOption("log_statement", "all", PGC_POSTMASTER, PGC_S_ARGV);
716  break;
717 
718  case 'e':
719  SetConfigOption("datestyle", "euro", PGC_POSTMASTER, PGC_S_ARGV);
720  break;
721 
722  case 'F':
723  SetConfigOption("fsync", "false", PGC_POSTMASTER, PGC_S_ARGV);
724  break;
725 
726  case 'f':
728  {
729  write_stderr("%s: invalid argument for option -f: \"%s\"\n",
730  progname, optarg);
731  ExitPostmaster(1);
732  }
733  break;
734 
735  case 'h':
736  SetConfigOption("listen_addresses", optarg, PGC_POSTMASTER, PGC_S_ARGV);
737  break;
738 
739  case 'i':
740  SetConfigOption("listen_addresses", "*", PGC_POSTMASTER, PGC_S_ARGV);
741  break;
742 
743  case 'j':
744  /* only used by interactive backend */
745  break;
746 
747  case 'k':
748  SetConfigOption("unix_socket_directories", optarg, PGC_POSTMASTER, PGC_S_ARGV);
749  break;
750 
751  case 'l':
752  SetConfigOption("ssl", "true", PGC_POSTMASTER, PGC_S_ARGV);
753  break;
754 
755  case 'N':
756  SetConfigOption("max_connections", optarg, PGC_POSTMASTER, PGC_S_ARGV);
757  break;
758 
759  case 'n':
760  /* Don't reinit shared mem after abnormal exit */
761  Reinit = false;
762  break;
763 
764  case 'O':
765  SetConfigOption("allow_system_table_mods", "true", PGC_POSTMASTER, PGC_S_ARGV);
766  break;
767 
768  case 'P':
769  SetConfigOption("ignore_system_indexes", "true", PGC_POSTMASTER, PGC_S_ARGV);
770  break;
771 
772  case 'p':
774  break;
775 
776  case 'r':
777  /* only used by single-user backend */
778  break;
779 
780  case 'S':
782  break;
783 
784  case 's':
785  SetConfigOption("log_statement_stats", "true", PGC_POSTMASTER, PGC_S_ARGV);
786  break;
787 
788  case 'T':
789 
790  /*
791  * In the event that some backend dumps core, send SIGSTOP,
792  * rather than SIGQUIT, to all its peers. This lets the wily
793  * post_hacker collect core dumps from everyone.
794  */
795  SendStop = true;
796  break;
797 
798  case 't':
799  {
800  const char *tmp = get_stats_option_name(optarg);
801 
802  if (tmp)
803  {
805  }
806  else
807  {
808  write_stderr("%s: invalid argument for option -t: \"%s\"\n",
809  progname, optarg);
810  ExitPostmaster(1);
811  }
812  break;
813  }
814 
815  case 'W':
816  SetConfigOption("post_auth_delay", optarg, PGC_POSTMASTER, PGC_S_ARGV);
817  break;
818 
819  case 'c':
820  case '-':
821  {
822  char *name,
823  *value;
824 
825  ParseLongOption(optarg, &name, &value);
826  if (!value)
827  {
828  if (opt == '-')
829  ereport(ERROR,
830  (errcode(ERRCODE_SYNTAX_ERROR),
831  errmsg("--%s requires a value",
832  optarg)));
833  else
834  ereport(ERROR,
835  (errcode(ERRCODE_SYNTAX_ERROR),
836  errmsg("-c %s requires a value",
837  optarg)));
838  }
839 
841  free(name);
842  if (value)
843  free(value);
844  break;
845  }
846 
847  default:
848  write_stderr("Try \"%s --help\" for more information.\n",
849  progname);
850  ExitPostmaster(1);
851  }
852  }
853 
854  /*
855  * Postmaster accepts no non-option switch arguments.
856  */
857  if (optind < argc)
858  {
859  write_stderr("%s: invalid argument: \"%s\"\n",
860  progname, argv[optind]);
861  write_stderr("Try \"%s --help\" for more information.\n",
862  progname);
863  ExitPostmaster(1);
864  }
865 
866  /*
867  * Locate the proper configuration files and data directory, and read
868  * postgresql.conf for the first time.
869  */
870  if (!SelectConfigFiles(userDoption, progname))
871  ExitPostmaster(2);
872 
873  if (output_config_variable != NULL)
874  {
875  /*
876  * "-C guc" was specified, so print GUC's value and exit. No extra
877  * permission check is needed because the user is reading inside the
878  * data dir.
879  */
880  const char *config_val = GetConfigOption(output_config_variable,
881  false, false);
882 
883  puts(config_val ? config_val : "");
884  ExitPostmaster(0);
885  }
886 
887  /* Verify that DataDir looks reasonable */
888  checkDataDir();
889 
890  /* Check that pg_control exists */
892 
893  /* And switch working directory into it */
894  ChangeToDataDir();
895 
896  /*
897  * Check for invalid combinations of GUC settings.
898  */
900  {
901  write_stderr("%s: superuser_reserved_connections (%d) must be less than max_connections (%d)\n",
902  progname,
904  ExitPostmaster(1);
905  }
907  ereport(ERROR,
908  (errmsg("WAL archival cannot be enabled when wal_level is \"minimal\"")));
910  ereport(ERROR,
911  (errmsg("WAL streaming (max_wal_senders > 0) requires wal_level \"replica\" or \"logical\"")));
912 
913  /*
914  * Other one-time internal sanity checks can go here, if they are fast.
915  * (Put any slow processing further down, after postmaster.pid creation.)
916  */
917  if (!CheckDateTokenTables())
918  {
919  write_stderr("%s: invalid datetoken tables, please fix\n", progname);
920  ExitPostmaster(1);
921  }
922 
923  /*
924  * Now that we are done processing the postmaster arguments, reset
925  * getopt(3) library so that it will work correctly in subprocesses.
926  */
927  optind = 1;
928 #ifdef HAVE_INT_OPTRESET
929  optreset = 1; /* some systems need this too */
930 #endif
931 
932  /* For debugging: display postmaster environment */
933  {
934  extern char **environ;
935  char **p;
936 
937  ereport(DEBUG3,
938  (errmsg_internal("%s: PostmasterMain: initial environment dump:",
939  progname)));
940  ereport(DEBUG3,
941  (errmsg_internal("-----------------------------------------")));
942  for (p = environ; *p; ++p)
943  ereport(DEBUG3,
944  (errmsg_internal("\t%s", *p)));
945  ereport(DEBUG3,
946  (errmsg_internal("-----------------------------------------")));
947  }
948 
949  /*
950  * Create lockfile for data directory.
951  *
952  * We want to do this before we try to grab the input sockets, because the
953  * data directory interlock is more reliable than the socket-file
954  * interlock (thanks to whoever decided to put socket files in /tmp :-().
955  * For the same reason, it's best to grab the TCP socket(s) before the
956  * Unix socket(s).
957  *
958  * Also note that this internally sets up the on_proc_exit function that
959  * is responsible for removing both data directory and socket lockfiles;
960  * so it must happen before opening sockets so that at exit, the socket
961  * lockfiles go away after CloseServerPorts runs.
962  */
963  CreateDataDirLockFile(true);
964 
965  /*
966  * Read the control file (for error checking and config info).
967  *
968  * Since we verify the control file's CRC, this has a useful side effect
969  * on machines where we need a run-time test for CRC support instructions.
970  * The postmaster will do the test once at startup, and then its child
971  * processes will inherit the correct function pointer and not need to
972  * repeat the test.
973  */
975 
976  /*
977  * Register the apply launcher. Since it registers a background worker,
978  * it needs to be called before InitializeMaxBackends(), and it's probably
979  * a good idea to call it before any modules had chance to take the
980  * background worker slots.
981  */
983 
984  /*
985  * process any libraries that should be preloaded at postmaster start
986  */
988 
989  /*
990  * Initialize SSL library, if specified.
991  */
992 #ifdef USE_SSL
993  if (EnableSSL)
994  {
995  (void) secure_initialize(true);
996  LoadedSSL = true;
997  }
998 #endif
999 
1000  /*
1001  * Now that loadable modules have had their chance to register background
1002  * workers, calculate MaxBackends.
1003  */
1005 
1006  /*
1007  * Set up shared memory and semaphores.
1008  */
1009  reset_shared();
1010 
1011  /*
1012  * Estimate number of openable files. This must happen after setting up
1013  * semaphores, because on some platforms semaphores count as open files.
1014  */
1015  set_max_safe_fds();
1016 
1017  /*
1018  * Set reference point for stack-depth checking.
1019  */
1020  set_stack_base();
1021 
1022  /*
1023  * Initialize pipe (or process handle on Windows) that allows children to
1024  * wake up from sleep on postmaster death.
1025  */
1027 
1028 #ifdef WIN32
1029 
1030  /*
1031  * Initialize I/O completion port used to deliver list of dead children.
1032  */
1033  win32ChildQueue = CreateIoCompletionPort(INVALID_HANDLE_VALUE, NULL, 0, 1);
1034  if (win32ChildQueue == NULL)
1035  ereport(FATAL,
1036  (errmsg("could not create I/O completion port for child queue")));
1037 #endif
1038 
1039 #ifdef EXEC_BACKEND
1040  /* Write out nondefault GUC settings for child processes to use */
1041  write_nondefault_variables(PGC_POSTMASTER);
1042 
1043  /*
1044  * Clean out the temp directory used to transmit parameters to child
1045  * processes (see internal_forkexec, below). We must do this before
1046  * launching any child processes, else we have a race condition: we could
1047  * remove a parameter file before the child can read it. It should be
1048  * safe to do so now, because we verified earlier that there are no
1049  * conflicting Postgres processes in this data directory.
1050  */
1052 #endif
1053 
1054  /*
1055  * Forcibly remove the files signaling a standby promotion request.
1056  * Otherwise, the existence of those files triggers a promotion too early,
1057  * whether a user wants that or not.
1058  *
1059  * This removal of files is usually unnecessary because they can exist
1060  * only during a few moments during a standby promotion. However there is
1061  * a race condition: if pg_ctl promote is executed and creates the files
1062  * during a promotion, the files can stay around even after the server is
1063  * brought up to be the primary. Then, if a new standby starts by using
1064  * the backup taken from the new primary, the files can exist at server
1065  * startup and must be removed in order to avoid an unexpected promotion.
1066  *
1067  * Note that promotion signal files need to be removed before the startup
1068  * process is invoked. Because, after that, they can be used by
1069  * postmaster's SIGUSR1 signal handler.
1070  */
1072 
1073  /* Do the same for logrotate signal file */
1075 
1076  /* Remove any outdated file holding the current log filenames. */
1077  if (unlink(LOG_METAINFO_DATAFILE) < 0 && errno != ENOENT)
1078  ereport(LOG,
1080  errmsg("could not remove file \"%s\": %m",
1082 
1083  /*
1084  * If enabled, start up syslogger collection subprocess
1085  */
1087 
1088  /*
1089  * Reset whereToSendOutput from DestDebug (its starting state) to
1090  * DestNone. This stops ereport from sending log messages to stderr unless
1091  * Log_destination permits. We don't do this until the postmaster is
1092  * fully launched, since startup failures may as well be reported to
1093  * stderr.
1094  *
1095  * If we are in fact disabling logging to stderr, first emit a log message
1096  * saying so, to provide a breadcrumb trail for users who may not remember
1097  * that their logging is configured to go somewhere else.
1098  */
1100  ereport(LOG,
1101  (errmsg("ending log output to stderr"),
1102  errhint("Future log output will go to log destination \"%s\".",
1104 
1106 
1107  /*
1108  * Report server startup in log. While we could emit this much earlier,
1109  * it seems best to do so after starting the log collector, if we intend
1110  * to use one.
1111  */
1112  ereport(LOG,
1113  (errmsg("starting %s", PG_VERSION_STR)));
1114 
1115  /*
1116  * Establish input sockets.
1117  *
1118  * First, mark them all closed, and set up an on_proc_exit function that's
1119  * charged with closing the sockets again at postmaster shutdown.
1120  */
1121  for (i = 0; i < MAXLISTEN; i++)
1123 
1125 
1126  if (ListenAddresses)
1127  {
1128  char *rawstring;
1129  List *elemlist;
1130  ListCell *l;
1131  int success = 0;
1132 
1133  /* Need a modifiable copy of ListenAddresses */
1134  rawstring = pstrdup(ListenAddresses);
1135 
1136  /* Parse string into list of hostnames */
1137  if (!SplitGUCList(rawstring, ',', &elemlist))
1138  {
1139  /* syntax error in list */
1140  ereport(FATAL,
1141  (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
1142  errmsg("invalid list syntax in parameter \"%s\"",
1143  "listen_addresses")));
1144  }
1145 
1146  foreach(l, elemlist)
1147  {
1148  char *curhost = (char *) lfirst(l);
1149 
1150  if (strcmp(curhost, "*") == 0)
1151  status = StreamServerPort(AF_UNSPEC, NULL,
1152  (unsigned short) PostPortNumber,
1153  NULL,
1155  else
1156  status = StreamServerPort(AF_UNSPEC, curhost,
1157  (unsigned short) PostPortNumber,
1158  NULL,
1159  ListenSocket, MAXLISTEN);
1160 
1161  if (status == STATUS_OK)
1162  {
1163  success++;
1164  /* record the first successful host addr in lockfile */
1165  if (!listen_addr_saved)
1166  {
1168  listen_addr_saved = true;
1169  }
1170  }
1171  else
1172  ereport(WARNING,
1173  (errmsg("could not create listen socket for \"%s\"",
1174  curhost)));
1175  }
1176 
1177  if (!success && elemlist != NIL)
1178  ereport(FATAL,
1179  (errmsg("could not create any TCP/IP sockets")));
1180 
1181  list_free(elemlist);
1182  pfree(rawstring);
1183  }
1184 
1185 #ifdef USE_BONJOUR
1186  /* Register for Bonjour only if we opened TCP socket(s) */
1187  if (enable_bonjour && ListenSocket[0] != PGINVALID_SOCKET)
1188  {
1189  DNSServiceErrorType err;
1190 
1191  /*
1192  * We pass 0 for interface_index, which will result in registering on
1193  * all "applicable" interfaces. It's not entirely clear from the
1194  * DNS-SD docs whether this would be appropriate if we have bound to
1195  * just a subset of the available network interfaces.
1196  */
1197  err = DNSServiceRegister(&bonjour_sdref,
1198  0,
1199  0,
1200  bonjour_name,
1201  "_postgresql._tcp.",
1202  NULL,
1203  NULL,
1205  0,
1206  NULL,
1207  NULL,
1208  NULL);
1209  if (err != kDNSServiceErr_NoError)
1210  ereport(LOG,
1211  (errmsg("DNSServiceRegister() failed: error code %ld",
1212  (long) err)));
1213 
1214  /*
1215  * We don't bother to read the mDNS daemon's reply, and we expect that
1216  * it will automatically terminate our registration when the socket is
1217  * closed at postmaster termination. So there's nothing more to be
1218  * done here. However, the bonjour_sdref is kept around so that
1219  * forked children can close their copies of the socket.
1220  */
1221  }
1222 #endif
1223 
1224 #ifdef HAVE_UNIX_SOCKETS
1226  {
1227  char *rawstring;
1228  List *elemlist;
1229  ListCell *l;
1230  int success = 0;
1231 
1232  /* Need a modifiable copy of Unix_socket_directories */
1233  rawstring = pstrdup(Unix_socket_directories);
1234 
1235  /* Parse string into list of directories */
1236  if (!SplitDirectoriesString(rawstring, ',', &elemlist))
1237  {
1238  /* syntax error in list */
1239  ereport(FATAL,
1240  (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
1241  errmsg("invalid list syntax in parameter \"%s\"",
1242  "unix_socket_directories")));
1243  }
1244 
1245  foreach(l, elemlist)
1246  {
1247  char *socketdir = (char *) lfirst(l);
1248 
1249  status = StreamServerPort(AF_UNIX, NULL,
1250  (unsigned short) PostPortNumber,
1251  socketdir,
1252  ListenSocket, MAXLISTEN);
1253 
1254  if (status == STATUS_OK)
1255  {
1256  success++;
1257  /* record the first successful Unix socket in lockfile */
1258  if (success == 1)
1260  }
1261  else
1262  ereport(WARNING,
1263  (errmsg("could not create Unix-domain socket in directory \"%s\"",
1264  socketdir)));
1265  }
1266 
1267  if (!success && elemlist != NIL)
1268  ereport(FATAL,
1269  (errmsg("could not create any Unix-domain sockets")));
1270 
1271  list_free_deep(elemlist);
1272  pfree(rawstring);
1273  }
1274 #endif
1275 
1276  /*
1277  * check that we have some socket to listen on
1278  */
1279  if (ListenSocket[0] == PGINVALID_SOCKET)
1280  ereport(FATAL,
1281  (errmsg("no socket created for listening")));
1282 
1283  /*
1284  * If no valid TCP ports, write an empty line for listen address,
1285  * indicating the Unix socket must be used. Note that this line is not
1286  * added to the lock file until there is a socket backing it.
1287  */
1288  if (!listen_addr_saved)
1290 
1291  /*
1292  * Record postmaster options. We delay this till now to avoid recording
1293  * bogus options (eg, unusable port number).
1294  */
1295  if (!CreateOptsFile(argc, argv, my_exec_path))
1296  ExitPostmaster(1);
1297 
1298  /*
1299  * Write the external PID file if requested
1300  */
1301  if (external_pid_file)
1302  {
1303  FILE *fpidfile = fopen(external_pid_file, "w");
1304 
1305  if (fpidfile)
1306  {
1307  fprintf(fpidfile, "%d\n", MyProcPid);
1308  fclose(fpidfile);
1309 
1310  /* Make PID file world readable */
1311  if (chmod(external_pid_file, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH) != 0)
1312  write_stderr("%s: could not change permissions of external PID file \"%s\": %s\n",
1314  }
1315  else
1316  write_stderr("%s: could not write external PID file \"%s\": %s\n",
1318 
1320  }
1321 
1322  /*
1323  * Remove old temporary files. At this point there can be no other
1324  * Postgres processes running in this directory, so this should be safe.
1325  */
1327 
1328  /*
1329  * Initialize stats collection subsystem (this does NOT start the
1330  * collector process!)
1331  */
1332  pgstat_init();
1333 
1334  /*
1335  * Initialize the autovacuum subsystem (again, no process start yet)
1336  */
1337  autovac_init();
1338 
1339  /*
1340  * Load configuration files for client authentication.
1341  */
1342  if (!load_hba())
1343  {
1344  /*
1345  * It makes no sense to continue if we fail to load the HBA file,
1346  * since there is no way to connect to the database in this case.
1347  */
1348  ereport(FATAL,
1349  (errmsg("could not load pg_hba.conf")));
1350  }
1351  if (!load_ident())
1352  {
1353  /*
1354  * We can start up without the IDENT file, although it means that you
1355  * cannot log in using any of the authentication methods that need a
1356  * user name mapping. load_ident() already logged the details of error
1357  * to the log.
1358  */
1359  }
1360 
1361 #ifdef HAVE_PTHREAD_IS_THREADED_NP
1362 
1363  /*
1364  * On macOS, libintl replaces setlocale() with a version that calls
1365  * CFLocaleCopyCurrent() when its second argument is "" and every relevant
1366  * environment variable is unset or empty. CFLocaleCopyCurrent() makes
1367  * the process multithreaded. The postmaster calls sigprocmask() and
1368  * calls fork() without an immediate exec(), both of which have undefined
1369  * behavior in a multithreaded program. A multithreaded postmaster is the
1370  * normal case on Windows, which offers neither fork() nor sigprocmask().
1371  */
1372  if (pthread_is_threaded_np() != 0)
1373  ereport(FATAL,
1374  (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
1375  errmsg("postmaster became multithreaded during startup"),
1376  errhint("Set the LC_ALL environment variable to a valid locale.")));
1377 #endif
1378 
1379  /*
1380  * Remember postmaster startup time
1381  */
1383 
1384  /*
1385  * Report postmaster status in the postmaster.pid file, to allow pg_ctl to
1386  * see what's happening.
1387  */
1389 
1390  /*
1391  * We're ready to rock and roll...
1392  */
1394  Assert(StartupPID != 0);
1396  pmState = PM_STARTUP;
1397 
1398  /* Some workers may be scheduled to start now */
1400 
1401  status = ServerLoop();
1402 
1403  /*
1404  * ServerLoop probably shouldn't ever return, but if it does, close down.
1405  */
1406  ExitPostmaster(status != STATUS_OK);
1407 
1408  abort(); /* not reached */
1409 }
int StreamServerPort(int family, const char *hostName, unsigned short portNumber, const char *unixSocketDir, pgsocket ListenSocket[], int MaxListen)
Definition: pqcomm.c:328
pg_stack_base_t set_stack_base(void)
Definition: postgres.c:3264
int secure_initialize(bool isServerStart)
Definition: be-secure.c:77
#define NIL
Definition: pg_list.h:65
bool IsPostmasterEnvironment
Definition: globals.c:108
bool EnableSSL
Definition: postmaster.c:232
#define SIGQUIT
Definition: win32_port.h:160
static StartupStatusEnum StartupStatus
Definition: postmaster.c:265
#define S_IRGRP
Definition: win32_port.h:292
#define AllocSetContextCreate
Definition: memutils.h:170
static void unlink_external_pid_file(int status, Datum arg)
Definition: postmaster.c:1452
int MyProcPid
Definition: globals.c:40
int errhint(const char *fmt,...)
Definition: elog.c:1149
#define StartupDataBase()
Definition: postmaster.c:549
static void reset_shared(void)
Definition: postmaster.c:2666
#define DEBUG3
Definition: elog.h:23
#define SIGUSR1
Definition: win32_port.h:171
TimestampTz GetCurrentTimestamp(void)
Definition: timestamp.c:1578
void on_proc_exit(pg_on_exit_callback function, Datum arg)
Definition: ipc.c:305
void AddToDataDirLockFile(int target_line, const char *str)
Definition: miscinit.c:1329
#define SIGCHLD
Definition: win32_port.h:169
int wal_level
Definition: xlog.c:107
char * pstrdup(const char *in)
Definition: mcxt.c:1187
#define pg_hton16(x)
Definition: pg_bswap.h:120
static void dummy_handler(SIGNAL_ARGS)
Definition: postmaster.c:5352
void ParseLongOption(const char *string, char **name, char **value)
Definition: guc.c:10623
bool set_plan_disabling_options(const char *arg, GucContext context, GucSource source)
Definition: postgres.c:3441
static MemoryContext MemoryContextSwitchTo(MemoryContext context)
Definition: palloc.h:109
#define write_stderr(str)
Definition: parallel.c:186
#define S_IROTH
Definition: win32_port.h:304
static bool CreateOptsFile(int argc, char *argv[], char *fullprogname)
Definition: postmaster.c:5641
bool CheckDateTokenTables(void)
Definition: datetime.c:4468
const char * GetConfigOption(const char *name, bool missing_ok, bool restrict_privileged)
Definition: guc.c:7832
#define PG_TEMP_FILES_DIR
Definition: pg_checksums.c:58
int errcode(int sqlerrcode)
Definition: elog.c:691
#define LOG_METAINFO_DATAFILE
Definition: syslogger.h:95
const char * get_stats_option_name(const char *arg)
Definition: postgres.c:3483
int SysLogger_Start(void)
Definition: syslogger.c:539
void set_debug_options(int debug_flag, GucContext context, GucSource source)
Definition: postgres.c:3412
void checkDataDir(void)
Definition: miscinit.c:302
#define SIGPIPE
Definition: win32_port.h:164
#define SIGUSR2
Definition: win32_port.h:172
#define LOG
Definition: elog.h:26
void InitProcessGlobals(void)
Definition: postmaster.c:2632
const char * progname
Definition: pg_standby.c:36
#define fprintf
Definition: port.h:219
void list_free_deep(List *list)
Definition: list.c:1390
char * Unix_socket_directories
Definition: postmaster.c:202
bool IsBinaryUpgrade
Definition: globals.c:110
int getopt(int nargc, char *const *nargv, const char *ostr)
Definition: getopt.c:71
#define PG_SETMASK(mask)
Definition: pqsignal.h:19
bool load_ident(void)
Definition: hba.c:3009
void autovac_init(void)
Definition: autovacuum.c:3305
void pqinitmask(void)
Definition: pqsignal.c:41
static void CloseServerPorts(int status, Datum arg)
Definition: postmaster.c:1416
bool SplitDirectoriesString(char *rawstring, char separator, List **namelist)
Definition: varlena.c:3843
static void InitPostmasterDeathWatchHandle(void)
Definition: postmaster.c:6581
#define PM_STATUS_STARTING
Definition: pidfile.h:51
void pfree(void *pointer)
Definition: mcxt.c:1057
int optind
Definition: getopt.c:50
#define S_IWUSR
Definition: win32_port.h:283
#define ERROR
Definition: elog.h:43
void CreateDataDirLockFile(bool amPostmaster)
Definition: miscinit.c:1273
static pid_t StartupPID
Definition: postmaster.c:246
int PostPortNumber
Definition: postmaster.c:199
static void checkControlFile(void)
Definition: postmaster.c:1518
int ReservedBackends
Definition: postmaster.c:216
static void ExitPostmaster(int status) pg_attribute_noreturn()
Definition: postmaster.c:5108
#define FATAL
Definition: elog.h:52
#define LOCK_FILE_LINE_SOCKET_DIR
Definition: pidfile.h:41
char * external_pid_file
Definition: guc.c:559
#define ALLOCSET_DEFAULT_SIZES
Definition: memutils.h:192
Definition: dest.h:89
void SetConfigOption(const char *name, const char *value, GucContext context, GucSource source)
Definition: guc.c:7808
bool load_hba(void)
Definition: hba.c:2209
char * bonjour_name
Definition: postmaster.c:242
int XLogArchiveMode
Definition: xlog.c:95
void RemovePgTempFilesInDir(const char *tmpdirname, bool missing_ok, bool unlink_all)
Definition: fd.c:3096
int errcode_for_file_access(void)
Definition: elog.c:714
static pid_t SysLoggerPID
Definition: postmaster.c:254
#define SIGHUP
Definition: win32_port.h:159
void LocalProcessControlFile(bool reset)
Definition: xlog.c:5034
void ChangeToDataDir(void)
Definition: miscinit.c:416
int opterr
Definition: getopt.c:49
static void getInstallationPaths(const char *argv0)
Definition: postmaster.c:1464
char * Log_destination_string
Definition: elog.c:111
char * ListenAddresses
Definition: postmaster.c:205
#define STATUS_OK
Definition: c.h:1166
MemoryContext TopMemoryContext
Definition: mcxt.c:44
static void pmdie(SIGNAL_ARGS)
Definition: postmaster.c:2765
static void SIGHUP_handler(SIGNAL_ARGS)
Definition: postmaster.c:2683
#define LOCK_FILE_LINE_LISTEN_ADDR
Definition: pidfile.h:42
bool enable_bonjour
Definition: postmaster.c:241
void RemovePromoteSignalFiles(void)
Definition: xlog.c:12667
int max_wal_senders
Definition: walsender.c:121
#define SIG_IGN
Definition: win32_port.h:156
pid_t PostmasterPid
Definition: globals.c:95
#define WARNING
Definition: elog.h:40
pqsigfunc pqsignal_pm(int signo, pqsigfunc func)
Definition: pqsignal.c:118
char my_exec_path[MAXPGPATH]
Definition: globals.c:72
sigset_t BlockSig
Definition: pqsignal.c:22
static pgsocket ListenSocket[MAXLISTEN]
Definition: postmaster.c:220
static PMState pmState
Definition: postmaster.c:335
bool SelectConfigFiles(const char *userDoption, const char *progname)
Definition: guc.c:5569
void ApplyLauncherRegister(void)
Definition: launcher.c:767
#define PGINVALID_SOCKET
Definition: port.h:33
#define PG_MODE_MASK_OWNER
Definition: file_perm.h:24
int MaxConnections
Definition: globals.c:133
void RemoveLogrotateSignalFiles(void)
Definition: syslogger.c:1550
TimestampTz PgStartTime
Definition: timestamp.c:50
#define LOG_DESTINATION_STDERR
Definition: elog.h:432
static struct @143 value
#define ereport(elevel,...)
Definition: elog.h:155
static bool Reinit
Definition: postmaster.c:228
#define free(a)
Definition: header.h:65
int errmsg_internal(const char *fmt,...)
Definition: elog.c:989
static int ServerLoop(void)
Definition: postmaster.c:1645
#define Assert(condition)
Definition: c.h:800
#define lfirst(lc)
Definition: pg_list.h:169
void RemovePgTempFiles(void)
Definition: fd.c:3037
static void reaper(SIGNAL_ARGS)
Definition: postmaster.c:2915
void InitializeMaxBackends(void)
Definition: postinit.c:503
#define strerror
Definition: port.h:228
#define SIGALRM
Definition: win32_port.h:165
const char * name
Definition: encode.c:561
#define S_IRUSR
Definition: win32_port.h:280
static const char * userDoption
Definition: postgres.c:157
void set_max_safe_fds(void)
Definition: fd.c:970
int errmsg(const char *fmt,...)
Definition: elog.c:902
char * optarg
Definition: getopt.c:52
void list_free(List *list)
Definition: list.c:1376
int i
static void sigusr1_handler(SIGNAL_ARGS)
Definition: postmaster.c:5141
void pgstat_init(void)
Definition: pgstat.c:399
int Log_destination
Definition: elog.c:110
bool SplitGUCList(char *rawstring, char separator, List **namelist)
Definition: varlena.c:3964
char ** environ
CommandDest whereToSendOutput
Definition: postgres.c:91
static void static void status(const char *fmt,...) pg_attribute_printf(1
Definition: pg_regress.c:227
static bool success
Definition: initdb.c:162
static int SendStop
Definition: postmaster.c:229
void process_shared_preload_libraries(void)
Definition: miscinit.c:1657
#define LOCK_FILE_LINE_PM_STATUS
Definition: pidfile.h:44
Definition: pg_list.h:50
#define MAXLISTEN
Definition: postmaster.c:219
MemoryContext PostmasterContext
Definition: mcxt.c:46
static void maybe_start_bgworkers(void)
Definition: postmaster.c:5982
void InitializeGUCOptions(void)
Definition: guc.c:5346

◆ PostmasterMarkPIDForWorkerNotify()

bool PostmasterMarkPIDForWorkerNotify ( int  )

Definition at line 6101 of file postmaster.c.

References AllocateFile(), Assert, AuxiliaryProcs, bkend::bgworker_notify, bkend::child_slot, closesocket, dlist_iter::cur, DataDir, generate_unaccent_rules::dest, dlist_container, dlist_foreach, bkend::elem, ereport, errmsg(), errmsg_internal(), first_syslogger_file_time, free, FreeFile(), i, IsBinaryUpgrade, sort-test::key, ListenSocket, LOG, MainLWLockArray, max_safe_fds, MaxBackends, MaxLivePostmasterChildren(), MAXPGPATH, mul_size(), my_exec_path, MyCancelKey, MyPMChildSlot, NamedLWLockTrancheArray, NamedLWLockTrancheRequests, PG_BINARY_R, pg_queue_signal(), PGINVALID_SOCKET, PgReloadTime, PgStartTime, pgStatSock, pgwin32_create_signal_listener(), pgwin32_initial_signal_pipe, bkend::pid, pkglib_path, PMSignalState, postmaster_alive_fds, PostmasterPid, PreparedXactProcs, ProcGlobal, ProcStructLock, redirection_done, ReserveExternalFD(), SetDataDir(), ShmemAlloc(), ShmemLock, ShmemProtectiveRegion, ShmemVariableCache, SIGCHLD, Port::sock, SpinlockSemaArray, strerror, strlcpy(), syslogPipe, UsedShmemSegAddr, UsedShmemSegID, and write_stderr.

Referenced by BackgroundWorkerStateChange().

6102 {
6103  dlist_iter iter;
6104  Backend *bp;
6105 
6106  dlist_foreach(iter, &BackendList)
6107  {
6108  bp = dlist_container(Backend, elem, iter.cur);
6109  if (bp->pid == pid)
6110  {
6111  bp->bgworker_notify = true;
6112  return true;
6113  }
6114  }
6115  return false;
6116 }
#define dlist_foreach(iter, lhead)
Definition: ilist.h:507
bool bgworker_notify
Definition: postmaster.c:184
#define dlist_container(type, membername, ptr)
Definition: ilist.h:477
static dlist_head BackendList
Definition: postmaster.c:188
dlist_node * cur
Definition: ilist.h:161
pid_t pid
Definition: postmaster.c:179

Variable Documentation

◆ AuthenticationTimeout

int AuthenticationTimeout

Definition at line 235 of file postmaster.c.

Referenced by BackendInitialize(), and PerformAuthentication().

◆ bonjour_name

char* bonjour_name

Definition at line 242 of file postmaster.c.

Referenced by PostmasterMain().

◆ ClientAuthInProgress

◆ enable_bonjour

bool enable_bonjour

Definition at line 241 of file postmaster.c.

Referenced by PostmasterMain().

◆ EnableSSL

bool EnableSSL

Definition at line 232 of file postmaster.c.

Referenced by BackendRun(), parse_hba_line(), PostmasterMain(), and SIGHUP_handler().

◆ ListenAddresses

char* ListenAddresses

Definition at line 205 of file postmaster.c.

Referenced by PostmasterMain().

◆ Log_connections

bool Log_connections

Definition at line 238 of file postmaster.c.

Referenced by BackendInitialize(), and PerformAuthentication().

◆ log_hostname

bool log_hostname

Definition at line 237 of file postmaster.c.

Referenced by BackendInitialize().

◆ postmaster_alive_fds

◆ PostPortNumber

PGDLLIMPORT int PostPortNumber

Definition at line 199 of file postmaster.c.

Referenced by CreateLockFile(), and PostmasterMain().

◆ PreAuthDelay

int PreAuthDelay

Definition at line 234 of file postmaster.c.

Referenced by BackendInitialize().

◆ progname

◆ ReservedBackends

int ReservedBackends

Definition at line 216 of file postmaster.c.

Referenced by InitPostgres(), and PostmasterMain().

◆ restart_after_crash

bool restart_after_crash

Definition at line 243 of file postmaster.c.

Referenced by PostmasterStateMachine().

◆ Unix_socket_directories

char* Unix_socket_directories

Definition at line 202 of file postmaster.c.

Referenced by PostmasterMain().

◆ Unix_socket_group

char* Unix_socket_group

Definition at line 120 of file pqcomm.c.

Referenced by StreamServerPort().

◆ Unix_socket_permissions

int Unix_socket_permissions

Definition at line 119 of file pqcomm.c.

Referenced by show_unix_socket_permissions(), and StreamServerPort().