3737 *
3838 *
3939 * IDENTIFICATION
40- * $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.317 2003/05/0221:59:31 momjian Exp $
40+ * $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.318 2003/05/0222:01:51 momjian Exp $
4141 *
4242 * NOTES
4343 *
@@ -256,12 +256,11 @@ static void dummy_handler(SIGNAL_ARGS);
256256static void CleanupProc (int pid ,int exitstatus );
257257static void LogChildExit (int lev ,const char * procname ,
258258int pid ,int exitstatus );
259- static int BackendFinalize (Port * port );
259+ static int DoBackend (Port * port );
260260void ExitPostmaster (int status );
261261static void usage (const char * );
262262static int ServerLoop (void );
263263static int BackendStartup (Port * port );
264- static void BackendFork (Port * port ,Backend * bn );
265264static int ProcessStartupPacket (Port * port ,bool SSLdone );
266265static void processCancelRequest (Port * port ,void * pkt );
267266static int initMasks (fd_set * rmask ,fd_set * wmask );
@@ -571,9 +570,6 @@ PostmasterMain(int argc, char *argv[])
571570SetDataDir (potential_DataDir );
572571
573572ProcessConfigFile (PGC_POSTMASTER );
574- #ifdef EXEC_BACKEND
575- write_nondefault_variables (PGC_POSTMASTER );
576- #endif
577573
578574/*
579575 * Check for invalid combinations of GUC settings.
@@ -1235,7 +1231,7 @@ ProcessStartupPacket(Port *port, bool SSLdone)
12351231 * Now fetch parameters out of startup packet and save them into the
12361232 * Port structure. All data structures attached to the Port struct
12371233 * must be allocated in TopMemoryContext so that they won't disappear
1238- * when we pass them to PostgresMain (seeBackendFinalize ). We need not worry
1234+ * when we pass them to PostgresMain (seeDoBackend ). We need not worry
12391235 * about leaking this storage on failure, since we aren't in the postmaster
12401236 * process anymore.
12411237 */
@@ -1572,9 +1568,6 @@ SIGHUP_handler(SIGNAL_ARGS)
15721568elog (LOG ,"Received SIGHUP, reloading configuration files" );
15731569SignalChildren (SIGHUP );
15741570ProcessConfigFile (PGC_SIGHUP );
1575- #ifdef EXEC_BACKEND
1576- write_nondefault_variables (PGC_SIGHUP );
1577- #endif
15781571load_hba ();
15791572load_ident ();
15801573}
@@ -2060,7 +2053,28 @@ BackendStartup(Port *port)
20602053pid = fork ();
20612054
20622055if (pid == 0 )/* child */
2063- BackendFork (port ,bn );/* never returns */
2056+ {
2057+ int status ;
2058+
2059+ #ifdef LINUX_PROFILE
2060+ setitimer (ITIMER_PROF ,& prof_itimer ,NULL );
2061+ #endif
2062+
2063+ #ifdef __BEOS__
2064+ /* Specific beos backend startup actions */
2065+ beos_backend_startup ();
2066+ #endif
2067+ free (bn );
2068+
2069+ status = DoBackend (port );
2070+ if (status != 0 )
2071+ {
2072+ elog (LOG ,"connection startup failed" );
2073+ proc_exit (status );
2074+ }
2075+ else
2076+ proc_exit (0 );
2077+ }
20642078
20652079/* in parent, error */
20662080if (pid < 0 )
@@ -2094,31 +2108,6 @@ BackendStartup(Port *port)
20942108}
20952109
20962110
2097- static void
2098- BackendFork (Port * port ,Backend * bn )
2099- {
2100- int status ;
2101-
2102- #ifdef LINUX_PROFILE
2103- setitimer (ITIMER_PROF ,& prof_itimer ,NULL );
2104- #endif
2105-
2106- #ifdef __BEOS__
2107- /* Specific beos backend startup actions */
2108- beos_backend_startup ();
2109- #endif
2110- free (bn );
2111-
2112- status = BackendFinalize (port );
2113- if (status != 0 )
2114- {
2115- elog (LOG ,"connection startup failed" );
2116- proc_exit (status );
2117- }
2118- else
2119- proc_exit (0 );
2120- }
2121-
21222111/*
21232112 * Try to report backend fork() failure to client before we close the
21242113 * connection.Since we do not care to risk blocking the postmaster on
@@ -2184,7 +2173,7 @@ split_opts(char **argv, int *argcp, char *s)
21842173}
21852174
21862175/*
2187- *BackendFinalize -- perform authentication, and if successful, set up the
2176+ *DoBackend -- perform authentication, and if successful, set up the
21882177 *backend's argument list and invoke backend main().
21892178 *
21902179 * This used to perform an execv() but we no longer exec the backend;
@@ -2195,7 +2184,7 @@ split_opts(char **argv, int *argcp, char *s)
21952184 *If PostgresMain() fails, return status.
21962185 */
21972186static int
2198- BackendFinalize (Port * port )
2187+ DoBackend (Port * port )
21992188{
22002189char * remote_host ;
22012190char * * av ;
@@ -2232,10 +2221,6 @@ BackendFinalize(Port *port)
22322221/* Reset MyProcPid to new backend's pid */
22332222MyProcPid = getpid ();
22342223
2235- #ifdef EXEC_BACKEND
2236- read_nondefault_variables ();
2237- #endif
2238-
22392224/*
22402225 * Initialize libpq and enable reporting of elog errors to the client.
22412226 * Must do this now because authentication uses libpq to send
@@ -2263,7 +2248,7 @@ BackendFinalize(Port *port)
22632248unsigned short remote_port ;
22642249char * host_addr ;
22652250#ifdef HAVE_IPV6
2266- char ip_hostinfo [INET6_ADDRSTRLEN ];
2251+ char ip_hostinfo [INET6_ADDRSTRLEN ];
22672252#else
22682253char ip_hostinfo [INET_ADDRSTRLEN ];
22692254#endif
@@ -2309,7 +2294,7 @@ BackendFinalize(Port *port)
23092294}
23102295else
23112296{
2312- /* not AF_INET */
2297+ /* not AF_INET */
23132298remote_host = "[local]" ;
23142299
23152300if (Log_connections )
@@ -2333,7 +2318,7 @@ BackendFinalize(Port *port)
23332318 * indefinitely. PreAuthDelay doesn't count against the time limit.
23342319 */
23352320if (!enable_sig_alarm (AuthenticationTimeout * 1000 , false))
2336- elog (FATAL ,"BackendFinalize : Unable to set timer for auth timeout" );
2321+ elog (FATAL ,"DoBackend : Unable to set timer for auth timeout" );
23372322
23382323/*
23392324 * Receive the startup packet (which might turn out to be a cancel
@@ -2362,7 +2347,7 @@ BackendFinalize(Port *port)
23622347 * SIGTERM/SIGQUIT again until backend startup is complete.
23632348 */
23642349if (!disable_sig_alarm (false))
2365- elog (FATAL ,"BackendFinalize : Unable to disable timer for auth timeout" );
2350+ elog (FATAL ,"DoBackend : Unable to disable timer for auth timeout" );
23662351PG_SETMASK (& BlockSig );
23672352
23682353if (Log_connections )