*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/postmaster/postmaster.c,v 1.442 2004/12/31 22:00:40 pgsql Exp $
+ * $PostgreSQL: pgsql/src/backend/postmaster/postmaster.c,v 1.445 2005/02/22 04:36:36 momjian Exp $
*
* NOTES
*
#include <DNSServiceDiscovery/DNSServiceDiscovery.h>
#endif
+#include "catalog/pg_control.h"
#include "catalog/pg_database.h"
#include "commands/async.h"
#include "lib/dllist.h"
static const char *progname = NULL;
/* The socket(s) we're listening to. */
-#define MAXLISTEN 10
+#define MAXLISTEN 64
static int ListenSocket[MAXLISTEN];
/*
#endif
char my_exec_path[MAXPGPATH];
char ExtraOptions[MAXPGPATH];
- char lc_collate[MAXPGPATH];
- char lc_ctype[MAXPGPATH];
+ char lc_collate[LOCALE_NAME_BUFLEN];
+ char lc_ctype[LOCALE_NAME_BUFLEN];
} BackendParameters;
static void read_backend_variables(char *id, Port *port);
pgstat_init();
/*
- * Load cached files for client authentication.
+ * Load configuration files for client authentication.
*/
load_hba();
load_ident();
- load_user();
- load_group();
/*
* We're ready to rock and roll...
static void
usage(const char *progname)
{
- printf(gettext("%s is the PostgreSQL server.\n\n"), progname);
- printf(gettext("Usage:\n %s [OPTION]...\n\n"), progname);
- printf(gettext("Options:\n"));
+ printf(_("%s is the PostgreSQL server.\n\n"), progname);
+ printf(_("Usage:\n %s [OPTION]...\n\n"), progname);
+ printf(_("Options:\n"));
#ifdef USE_ASSERT_CHECKING
- printf(gettext(" -A 1|0 enable/disable run-time assert checking\n"));
+ printf(_(" -A 1|0 enable/disable run-time assert checking\n"));
#endif
- printf(gettext(" -B NBUFFERS number of shared buffers\n"));
- printf(gettext(" -c NAME=VALUE set run-time parameter\n"));
- printf(gettext(" -d 1-5 debugging level\n"));
- printf(gettext(" -D DATADIR database directory\n"));
- printf(gettext(" -F turn fsync off\n"));
- printf(gettext(" -h HOSTNAME host name or IP address to listen on\n"));
- printf(gettext(" -i enable TCP/IP connections\n"));
- printf(gettext(" -k DIRECTORY Unix-domain socket location\n"));
+ printf(_(" -B NBUFFERS number of shared buffers\n"));
+ printf(_(" -c NAME=VALUE set run-time parameter\n"));
+ printf(_(" -d 1-5 debugging level\n"));
+ printf(_(" -D DATADIR database directory\n"));
+ printf(_(" -F turn fsync off\n"));
+ printf(_(" -h HOSTNAME host name or IP address to listen on\n"));
+ printf(_(" -i enable TCP/IP connections\n"));
+ printf(_(" -k DIRECTORY Unix-domain socket location\n"));
#ifdef USE_SSL
- printf(gettext(" -l enable SSL connections\n"));
+ printf(_(" -l enable SSL connections\n"));
#endif
- printf(gettext(" -N MAX-CONNECT maximum number of allowed connections\n"));
- printf(gettext(" -o OPTIONS pass \"OPTIONS\" to each server process\n"));
- printf(gettext(" -p PORT port number to listen on\n"));
- printf(gettext(" -S silent mode (start in background without logging output)\n"));
- printf(gettext(" --help show this help, then exit\n"));
- printf(gettext(" --version output version information, then exit\n"));
-
- printf(gettext("\nDeveloper options:\n"));
- printf(gettext(" -n do not reinitialize shared memory after abnormal exit\n"));
- printf(gettext(" -s send SIGSTOP to all backend servers if one dies\n"));
-
- printf(gettext("\nPlease read the documentation for the complete list of run-time\n"
+ printf(_(" -N MAX-CONNECT maximum number of allowed connections\n"));
+ printf(_(" -o OPTIONS pass \"OPTIONS\" to each server process\n"));
+ printf(_(" -p PORT port number to listen on\n"));
+ printf(_(" -S silent mode (start in background without logging output)\n"));
+ printf(_(" --help show this help, then exit\n"));
+ printf(_(" --version output version information, then exit\n"));
+
+ printf(_("\nDeveloper options:\n"));
+ printf(_(" -n do not reinitialize shared memory after abnormal exit\n"));
+ printf(_(" -s send SIGSTOP to all backend servers if one dies\n"));
+
+ printf(_("\nPlease read the documentation for the complete list of run-time\n"
"configuration settings and how to set them on the command line or in\n"
"the configuration file.\n\n"
"Report bugs to <pgsql-bugs@postgresql.org>.\n"));
if (SysLoggerPID != 0)
kill(SysLoggerPID, SIGHUP);
/* PgStatPID does not currently need SIGHUP */
+
+ /* Reload authentication config files too */
load_hba();
load_ident();
StartupPID = 0;
if (exitstatus != 0)
{
- LogChildExit(LOG, gettext("startup process"),
+ LogChildExit(LOG, _("startup process"),
pid, exitstatus);
ereport(LOG,
(errmsg("aborting startup due to startup process failure")));
*/
FatalError = false;
+ /*
+ * Load the flat user/group files into postmaster's caches.
+ * The startup process has recomputed these from the database
+ * contents, so we wait till it finishes before loading them.
+ */
+ load_user();
+ load_group();
+
/*
* Crank up the background writer. It doesn't matter if this
* fails, we'll just try again later.
* Any unexpected exit of the bgwriter is treated as a crash.
*/
HandleChildCrash(pid, exitstatus,
- gettext("background writer process"));
+ _("background writer process"));
continue;
}
{
PgArchPID = 0;
if (exitstatus != 0)
- LogChildExit(LOG, gettext("archiver process"),
+ LogChildExit(LOG, _("archiver process"),
pid, exitstatus);
if (XLogArchivingActive() &&
StartupPID == 0 && !FatalError && Shutdown == NoShutdown)
{
PgStatPID = 0;
if (exitstatus != 0)
- LogChildExit(LOG, gettext("statistics collector process"),
+ LogChildExit(LOG, _("statistics collector process"),
pid, exitstatus);
if (StartupPID == 0 && !FatalError && Shutdown == NoShutdown)
PgStatPID = pgstat_start();
/* for safety's sake, launch new logger *first* */
SysLoggerPID = SysLogger_Start();
if (exitstatus != 0)
- LogChildExit(LOG, gettext("system logger process"),
+ LogChildExit(LOG, _("system logger process"),
pid, exitstatus);
continue;
}
{
Dlelem *curr;
- LogChildExit(DEBUG2, gettext("server process"), pid, exitstatus);
+ LogChildExit(DEBUG2, _("server process"), pid, exitstatus);
/*
* If a backend dies in an ugly way (i.e. exit status not 0) then we
*/
if (exitstatus != 0)
{
- HandleChildCrash(pid, exitstatus, gettext("server process"));
+ HandleChildCrash(pid, exitstatus, _("server process"));
return;
}
/* Format the error message packet (always V2 protocol) */
snprintf(buffer, sizeof(buffer), "E%s%s\n",
- gettext("could not fork new process for connection: "),
+ _("could not fork new process for connection: "),
strerror(errnum));
/* Set port to non-blocking. Don't do send() if this fails */
port->remote_port = strdup(remote_port);
/*
- * In EXEC_BACKEND case, we didn't inherit the contents of pg_hba.c
+ * In EXEC_BACKEND case, we didn't inherit the contents of pg_hba.conf
* etcetera from the postmaster, and have to load them ourselves.
* Build the PostmasterContext (which didn't exist before, in this
* process) to contain the data.
StrNCpy(param->ExtraOptions, ExtraOptions, MAXPGPATH);
- StrNCpy(param->lc_collate, setlocale(LC_COLLATE, NULL), MAXPGPATH);
- StrNCpy(param->lc_ctype, setlocale(LC_CTYPE, NULL), MAXPGPATH);
+ StrNCpy(param->lc_collate, setlocale(LC_COLLATE, NULL), LOCALE_NAME_BUFLEN);
+ StrNCpy(param->lc_ctype, setlocale(LC_CTYPE, NULL), LOCALE_NAME_BUFLEN);
return true;
}