*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.330 2003/05/28 17:25:02 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.331 2003/05/28 19:36:28 tgl Exp $
*
* NOTES
*
static void CleanupProc(int pid, int exitstatus);
static void LogChildExit(int lev, const char *procname,
int pid, int exitstatus);
-static int BackendFinalize(Port *port);
+static int BackendFork(Port *port);
void ExitPostmaster(int status);
static void usage(const char *);
static int ServerLoop(void);
static int BackendStartup(Port *port);
-static void BackendFork(Port *port, Backend *bn);
static int ProcessStartupPacket(Port *port, bool SSLdone);
static void processCancelRequest(Port *port, void *pkt);
static int initMasks(fd_set *rmask, fd_set *wmask);
* Now fetch parameters out of startup packet and save them into the
* Port structure. All data structures attached to the Port struct
* must be allocated in TopMemoryContext so that they won't disappear
- * when we pass them to PostgresMain (see BackendFinalize). We need not worry
+ * when we pass them to PostgresMain (see BackendFork). We need not worry
* about leaking this storage on failure, since we aren't in the postmaster
* process anymore.
*/
pid = fork();
if (pid == 0) /* child */
- BackendFork(port, bn); /* never returns */
+ {
+ int status;
+
+#ifdef LINUX_PROFILE
+ setitimer(ITIMER_PROF, &prof_itimer, NULL);
+#endif
+
+#ifdef __BEOS__
+ /* Specific beos backend startup actions */
+ beos_backend_startup();
+#endif
+ free(bn);
+
+ status = BackendFork(port);
+
+ if (status != 0)
+ elog(LOG, "connection startup failed");
+ proc_exit(status);
+ }
/* in parent, error */
if (pid < 0)
return STATUS_OK;
}
-
-static void
-BackendFork(Port *port, Backend *bn)
-{
- int status;
-
-#ifdef LINUX_PROFILE
- setitimer(ITIMER_PROF, &prof_itimer, NULL);
-#endif
-
-#ifdef __BEOS__
- /* Specific beos backend startup actions */
- beos_backend_startup();
-#endif
- free(bn);
-
- status = BackendFinalize(port);
- if (status != 0)
- {
- elog(LOG, "connection startup failed");
- proc_exit(status);
- }
- else
- proc_exit(0);
-}
-
/*
* Try to report backend fork() failure to client before we close the
* connection. Since we do not care to risk blocking the postmaster on
}
/*
- * BackendFinalize -- perform authentication, and if successful, set up the
+ * BackendFork -- perform authentication, and if successful, set up the
* backend's argument list and invoke backend main().
*
* This used to perform an execv() but we no longer exec the backend;
* If PostgresMain() fails, return status.
*/
static int
-BackendFinalize(Port *port)
+BackendFork(Port *port)
{
char *remote_host;
char **av;
* indefinitely. PreAuthDelay doesn't count against the time limit.
*/
if (!enable_sig_alarm(AuthenticationTimeout * 1000, false))
- elog(FATAL, "BackendFinalize: Unable to set timer for auth timeout");
+ elog(FATAL, "BackendFork: Unable to set timer for auth timeout");
/*
* Receive the startup packet (which might turn out to be a cancel
* SIGTERM/SIGQUIT again until backend startup is complete.
*/
if (!disable_sig_alarm(false))
- elog(FATAL, "BackendFinalize: Unable to disable timer for auth timeout");
+ elog(FATAL, "BackendFork: Unable to disable timer for auth timeout");
PG_SETMASK(&BlockSig);
if (Log_connections)