From 1a321f26d88e5c64bccba9d36920aede1e201729 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Fri, 28 May 2004 05:13:32 +0000 Subject: Code review for EXEC_BACKEND changes. Reduce the number of #ifdefs by about a third, make it work on non-Windows platforms again. (But perhaps I broke the WIN32 code, since I have no way to test that.) Fold all the paths that fork postmaster child processes to go through the single routine SubPostmasterMain, which takes care of resurrecting the state that would normally be inherited from the postmaster (including GUC variables). Clean up some places where there's no particularly good reason for the EXEC and non-EXEC cases to work differently. Take care of one or two FIXMEs that remained in the code. --- src/backend/tcop/postgres.c | 32 ++++++++++++++------------------ 1 file changed, 14 insertions(+), 18 deletions(-) (limited to 'src/backend/tcop/postgres.c') diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c index 7a4390538b6..7acaf9117db 100644 --- a/src/backend/tcop/postgres.c +++ b/src/backend/tcop/postgres.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/tcop/postgres.c,v 1.415 2004/05/26 04:41:35 neilc Exp $ + * $PostgreSQL: pgsql/src/backend/tcop/postgres.c,v 1.416 2004/05/28 05:13:12 tgl Exp $ * * NOTES * this is the "main" module of the postgres backend and @@ -2189,10 +2189,13 @@ PostgresMain(int argc, char *argv[], const char *username) /* Set up reference point for stack depth checking */ stack_base_ptr = &stack_base; - if (my_exec_path[0] == '\0' && find_my_exec(argv[0], my_exec_path) < 0) - elog(FATAL, - gettext("%s: could not locate my own executable path"), - argv[0]); + /* Compute paths, if we didn't inherit them from postmaster */ + if (my_exec_path[0] == '\0') + { + if (find_my_exec(argv[0], my_exec_path) < 0) + elog(FATAL, "%s: could not locate my own executable path", + argv[0]); + } if (pkglib_path[0] == '\0') get_pkglib_path(my_exec_path, pkglib_path); @@ -2547,7 +2550,7 @@ PostgresMain(int argc, char *argv[], const char *username) on_proc_exit(log_disconnections,0); } - if (!IsUnderPostmaster || ExecBackend) + if (!IsUnderPostmaster) { if (!potential_DataDir) { @@ -2563,17 +2566,14 @@ PostgresMain(int argc, char *argv[], const char *username) } Assert(DataDir); - /* Acquire configuration parameters */ - if (IsUnderPostmaster) + /* Acquire configuration parameters, unless inherited from postmaster */ + if (!IsUnderPostmaster) { -#ifdef EXEC_BACKEND - read_nondefault_variables(); -#endif - } else ProcessConfigFile(PGC_POSTMASTER); - /* If timezone is not set, determine what the OS uses */ - pg_timezone_initialize(); + /* If timezone is not set, determine what the OS uses */ + pg_timezone_initialize(); + } /* * Set up signal handlers and masks. @@ -2918,11 +2918,7 @@ PostgresMain(int argc, char *argv[], const char *username) if (got_SIGHUP) { got_SIGHUP = false; -#ifdef EXEC_BACKEND - read_nondefault_variables(); -#else ProcessConfigFile(PGC_SIGHUP); -#endif } /* -- cgit v1.2.3