diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2004-05-28 05:13:32 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2004-05-28 05:13:32 +0000 |
commit | 1a321f26d88e5c64bccba9d36920aede1e201729 (patch) | |
tree | 43940a3ed5cc754bff68748502550731b0ad19a0 /src/backend/main/main.c | |
parent | 37da0ba0e0f2d92857dc62789820d21e177dc00f (diff) | |
download | postgresql-1a321f26d88e5c64bccba9d36920aede1e201729.tar.gz postgresql-1a321f26d88e5c64bccba9d36920aede1e201729.zip |
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.
Diffstat (limited to 'src/backend/main/main.c')
-rw-r--r-- | src/backend/main/main.c | 52 |
1 files changed, 15 insertions, 37 deletions
diff --git a/src/backend/main/main.c b/src/backend/main/main.c index bbf3fc47ecd..272d4cc0d0a 100644 --- a/src/backend/main/main.c +++ b/src/backend/main/main.c @@ -13,7 +13,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/main/main.c,v 1.83 2004/05/27 15:07:40 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/main/main.c,v 1.84 2004/05/28 05:12:50 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -242,9 +242,9 @@ main(int argc, char *argv[]) /* * Now dispatch to one of PostmasterMain, PostgresMain, GucInfoMain, - * SubPostmasterMain, pgstat_main, pgstat_mainChild or BootstrapMain - * depending on the program name (and possibly first argument) we were - * called with. The lack of consistency here is historical. + * SubPostmasterMain, or BootstrapMain depending on the program name + * (and possibly first argument) we were called with. The lack of + * consistency here is historical. */ len = strlen(argv[0]); @@ -259,43 +259,21 @@ main(int argc, char *argv[]) } /* - * If the first argument is "-boot", then invoke bootstrap mode. Note - * we remove "-boot" from the arguments passed on to BootstrapMain. + * If the first argument begins with "-fork", then invoke + * SubPostmasterMain. This is used for forking postmaster child + * processes on systems where we can't simply fork. */ - if (argc > 1 && strcmp(argv[1], "-boot") == 0) - exit(BootstrapMain(argc - 1, argv + 1)); - #ifdef EXEC_BACKEND + if (argc > 1 && strncmp(argv[1], "-fork", 5) == 0) + exit(SubPostmasterMain(argc, argv)); +#endif /* - * If the first argument is "-forkexec", then invoke - * SubPostmasterMain. Note we remove "-forkexec" from the arguments - * passed on to SubPostmasterMain. - */ - if (argc > 1 && strcmp(argv[1], "-forkexec") == 0) - { - SubPostmasterMain(argc - 2, argv + 2); - exit(0); - } - - /* - * If the first argument is "-statBuf", then invoke pgstat_main. - */ - if (argc > 1 && strcmp(argv[1], "-statBuf") == 0) - { - pgstat_main(argc, argv); - exit(0); - } - - /* - * If the first argument is "-statCol", then invoke pgstat_mainChild. + * If the first argument is "-boot", then invoke bootstrap mode. + * (This path is taken only for a standalone bootstrap process.) */ - if (argc > 1 && strcmp(argv[1], "-statCol") == 0) - { - pgstat_mainChild(argc, argv); - exit(0); - } -#endif + if (argc > 1 && strcmp(argv[1], "-boot") == 0) + exit(BootstrapMain(argc, argv)); /* * If the first argument is "--describe-config", then invoke runtime @@ -331,7 +309,7 @@ main(int argc, char *argv[]) exit(1); } } -#endif +#endif /* WIN32 */ exit(PostgresMain(argc, argv, pw_name_persist)); } |