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
 
bool remove_temp_files_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 45 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 43 of file postmaster.h.

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

Function Documentation

◆ ClosePostmasterPorts()

void ClosePostmasterPorts ( bool  am_syslogger)

Definition at line 2556 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(), pgstat_start(), StartAutoVacWorker(), StartChildProcess(), and SysLogger_Start().

2557 {
2558  int i;
2559 
2560 #ifndef WIN32
2561 
2562  /*
2563  * Close the write end of postmaster death watch pipe. It's important to
2564  * do this as early as possible, so that if postmaster dies, others won't
2565  * think that it's still running because we're holding the pipe open.
2566  */
2568  ereport(FATAL,
2570  errmsg_internal("could not close postmaster death monitoring pipe in child process: %m")));
2572  /* Notify fd.c that we released one pipe FD. */
2574 #endif
2575 
2576  /*
2577  * Close the postmaster's listen sockets. These aren't tracked by fd.c,
2578  * so we don't call ReleaseExternalFD() here.
2579  */
2580  for (i = 0; i < MAXLISTEN; i++)
2581  {
2582  if (ListenSocket[i] != PGINVALID_SOCKET)
2583  {
2586  }
2587  }
2588 
2589  /*
2590  * If using syslogger, close the read side of the pipe. We don't bother
2591  * tracking this in fd.c, either.
2592  */
2593  if (!am_syslogger)
2594  {
2595 #ifndef WIN32
2596  if (syslogPipe[0] >= 0)
2597  close(syslogPipe[0]);
2598  syslogPipe[0] = -1;
2599 #else
2600  if (syslogPipe[0])
2601  CloseHandle(syslogPipe[0]);
2602  syslogPipe[0] = 0;
2603 #endif
2604  }
2605 
2606 #ifdef USE_BONJOUR
2607  /* If using Bonjour, close the connection to the mDNS daemon */
2608  if (bonjour_sdref)
2609  close(DNSServiceRefSockFD(bonjour_sdref));
2610 #endif
2611 }
void StreamClose(pgsocket sock)
Definition: pqcomm.c:850
#define FATAL
Definition: elog.h:49
#define POSTMASTER_FD_OWN
Definition: postmaster.h:45
int errcode_for_file_access(void)
Definition: elog.c:721
int postmaster_alive_fds[2]
Definition: postmaster.c:571
static pgsocket ListenSocket[MAXLISTEN]
Definition: postmaster.c:221
#define PGINVALID_SOCKET
Definition: port.h:33
#define ereport(elevel,...)
Definition: elog.h:157
int errmsg_internal(const char *fmt,...)
Definition: elog.c:996
void ReleaseExternalFD(void)
Definition: fd.c:1148
int i
#define close(a)
Definition: win32.h:12
#define MAXLISTEN
Definition: postmaster.c:220
int syslogPipe[2]
Definition: syslogger.c:114

◆ InitProcessGlobals()

void InitProcessGlobals ( void  )

Definition at line 2620 of file postmaster.c.

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

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

2621 {
2622  unsigned int rseed;
2623 
2624  MyProcPid = getpid();
2627 
2628  /*
2629  * Set a different seed for random() in every process. We want something
2630  * unpredictable, so if possible, use high-quality random bits for the
2631  * seed. Otherwise, fall back to a seed based on timestamp and PID.
2632  */
2633  if (!pg_strong_random(&rseed, sizeof(rseed)))
2634  {
2635  /*
2636  * Since PIDs and timestamps tend to change more frequently in their
2637  * least significant bits, shift the timestamp left to allow a larger
2638  * total number of seeds in a given time period. Since that would
2639  * leave only 20 bits of the timestamp that cycle every ~1 second,
2640  * also mix in some higher bits.
2641  */
2642  rseed = ((uint64) MyProcPid) ^
2643  ((uint64) MyStartTimestamp << 12) ^
2644  ((uint64) MyStartTimestamp >> 20);
2645  }
2646  srandom(rseed);
2647 }
int MyProcPid
Definition: globals.c:43
TimestampTz GetCurrentTimestamp(void)
Definition: timestamp.c:1580
pg_time_t MyStartTime
Definition: globals.c:44
pg_time_t timestamptz_to_time_t(TimestampTz t)
Definition: timestamp.c:1754
TimestampTz MyStartTimestamp
Definition: globals.c:45
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 5664 of file postmaster.c.

References autovacuum_max_workers, max_wal_senders, max_worker_processes, and MaxConnections.

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

5665 {
5666  return 2 * (MaxConnections + autovacuum_max_workers + 1 +
5668 }
int max_wal_senders
Definition: walsender.c:121
int MaxConnections
Definition: globals.c:136
int autovacuum_max_workers
Definition: autovacuum.c:116
int max_worker_processes
Definition: globals.c:137

◆ PostmasterMain()

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

Definition at line 581 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().

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

◆ PostmasterMarkPIDForWorkerNotify()

bool PostmasterMarkPIDForWorkerNotify ( int  )

Definition at line 6080 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, query_id_enabled, redirection_done, ReserveExternalFD(), SetDataDir(), ShmemAlloc(), ShmemLock, ShmemProtectiveRegion, ShmemVariableCache, SIGCHLD, Port::sock, SpinlockSemaArray, strerror, strlcpy(), syslogPipe, UsedShmemSegAddr, UsedShmemSegID, and write_stderr.

Referenced by BackgroundWorkerStateChange().

6081 {
6082  dlist_iter iter;
6083  Backend *bp;
6084 
6085  dlist_foreach(iter, &BackendList)
6086  {
6087  bp = dlist_container(Backend, elem, iter.cur);
6088  if (bp->pid == pid)
6089  {
6090  bp->bgworker_notify = true;
6091  return true;
6092  }
6093  }
6094  return false;
6095 }
#define dlist_foreach(iter, lhead)
Definition: ilist.h:526
bool bgworker_notify
Definition: postmaster.c:185
#define dlist_container(type, membername, ptr)
Definition: ilist.h:496
static dlist_head BackendList
Definition: postmaster.c:189
dlist_node * cur
Definition: ilist.h:161
pid_t pid
Definition: postmaster.c:180

Variable Documentation

◆ AuthenticationTimeout

int AuthenticationTimeout

Definition at line 237 of file postmaster.c.

Referenced by BackendInitialize(), and PerformAuthentication().

◆ bonjour_name

char* bonjour_name

Definition at line 244 of file postmaster.c.

Referenced by PostmasterMain().

◆ ClientAuthInProgress

◆ enable_bonjour

bool enable_bonjour

Definition at line 243 of file postmaster.c.

Referenced by PostmasterMain().

◆ EnableSSL

bool EnableSSL

Definition at line 234 of file postmaster.c.

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

◆ ListenAddresses

char* ListenAddresses

Definition at line 206 of file postmaster.c.

Referenced by PostmasterMain().

◆ Log_connections

bool Log_connections

Definition at line 240 of file postmaster.c.

Referenced by BackendInitialize(), PerformAuthentication(), and set_authn_id().

◆ log_hostname

bool log_hostname

Definition at line 239 of file postmaster.c.

Referenced by BackendInitialize().

◆ postmaster_alive_fds

◆ PostPortNumber

PGDLLIMPORT int PostPortNumber

Definition at line 200 of file postmaster.c.

Referenced by CreateLockFile(), and PostmasterMain().

◆ PreAuthDelay

int PreAuthDelay

Definition at line 236 of file postmaster.c.

Referenced by BackendInitialize().

◆ progname

◆ remove_temp_files_after_crash

bool remove_temp_files_after_crash

Definition at line 246 of file postmaster.c.

Referenced by PostmasterStateMachine().

◆ ReservedBackends

int ReservedBackends

Definition at line 217 of file postmaster.c.

Referenced by InitPostgres(), and PostmasterMain().

◆ restart_after_crash

bool restart_after_crash

Definition at line 245 of file postmaster.c.

Referenced by PostmasterStateMachine().

◆ Unix_socket_directories

char* Unix_socket_directories

Definition at line 203 of file postmaster.c.

Referenced by PostmasterMain().

◆ Unix_socket_group

char* Unix_socket_group

Definition at line 109 of file pqcomm.c.

Referenced by StreamServerPort().

◆ Unix_socket_permissions

int Unix_socket_permissions

Definition at line 108 of file pqcomm.c.

Referenced by show_unix_socket_permissions(), and StreamServerPort().